| | |
| | | import org.primefaces.model.LazyDataModel; |
| | | import org.primefaces.model.SortOrder; |
| | | import org.primefaces.model.UploadedFile; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Scope; |
| | | import org.springframework.stereotype.Controller; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.math.BigDecimal; |
| | | import java.nio.charset.CharacterCodingException; |
| | | import java.security.NoSuchAlgorithmException; |
| | |
| | | private BaseRoleService baseRoleService; |
| | | @Resource |
| | | private SysProjectService sysProjectService; |
| | | |
| | | @Value("${personImgPath}") |
| | | private String personImgPath; |
| | | |
| | | private LazyDataModel<SysUser> dataModel; |
| | | private SysUser sysUser; |
| | |
| | | } |
| | | } |
| | | |
| | | // 文件上传 |
| | | public void handleImageUpload(FileUploadEvent event) { |
| | | UploadedFile file = event.getFile(); |
| | | try { |
| | | // 1.上传文件 |
| | | InputStream is = file.getInputstream(); |
| | | String oldName = file.getFileName(); |
| | | String newName = new Date().getTime() + oldName.substring(oldName.lastIndexOf(".")); |
| | | String realPath = personImgPath + "/"; |
| | | File dest = new File(realPath, newName); |
| | | if (!dest.getParentFile().exists()) { |
| | | boolean rel = dest.getParentFile().mkdirs(); |
| | | if (!rel) { |
| | | throw new Exception("文件夹创建失败"); |
| | | } |
| | | } |
| | | |
| | | OutputStream os = new FileOutputStream(dest); |
| | | try { |
| | | byte[] buffer = new byte[8 * 1024]; |
| | | int bytesRead; |
| | | while ((bytesRead = is.read(buffer)) != -1) { |
| | | os.write(buffer, 0, bytesRead); |
| | | } |
| | | // 更新用户url |
| | | sysUser.setUrl("upload/upload/" + newName); |
| | | // 清空图片文件以便再次上传 |
| | | RequestContext.getCurrentInstance().update("dialogForm2"); |
| | | // 更新用户表单 |
| | | RequestContext.getCurrentInstance().update("dialogForm"); |
| | | // 隐藏上传框 |
| | | RequestContext.getCurrentInstance().execute("PF('imgDialog').hide()"); |
| | | |
| | | } catch (Exception e) { |
| | | FacesUtils.warn("文件上传失败。"); |
| | | throw e; |
| | | } finally { |
| | | if (is != null) { |
| | | is.close(); |
| | | } |
| | | if (os != null) { |
| | | os.close(); |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | FacesUtils.warn("操作失败。"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | |
| | | public void initPage() { |
| | | sysUser = sysUserService.getSysUser(getUser().getId()); |
| | |
| | | <result property="roleName" column="roleName"></result> |
| | | <result property="containerCodeList" column="containerCodeList"></result> |
| | | <result property="project" column="project"></result> |
| | | <result property="url" column="url"></result> |
| | | <result property="score" column="score"></result> |
| | | <result property="waster" column="waster" typeHandler="com.nanometer.smartlab.entity.handler.WasterHandler"></result> |
| | | </resultMap> |
| | | |
| | |
| | | </select> |
| | | |
| | | <select id="getSysUserInfoList" parameterType="java.util.Map" resultMap="SysUser"> |
| | | select u.name,u.see_flag,u.role_id,u.valid_flag,u.id_card,u.point,group_concat(container_code SEPARATOR ',') containerCodeList ,u.arp, bm1.meta_value department,bm2.meta_value company,u.project_id projectId from sys_user u |
| | | select u.name,u.see_flag,u.role_id,u.valid_flag,u.id_card,u.point,group_concat(container_code SEPARATOR ',') containerCodeList ,u.arp, bm1.meta_value department,bm2.meta_value company,u.project_id projectId, |
| | | u.url,u.score |
| | | from sys_user u |
| | | left join sys_laboratory l on l.department = u.department and l.valid_flag = 1 |
| | | left join sys_laboratory_container c on c.laboratory_id = l.id and c.valid_flag = 1 |
| | | left join base_meta bm1 on bm1.id = u.department |
| | |
| | | </select> |
| | | |
| | | <insert id="insertSysUser" parameterType="com.nanometer.smartlab.entity.SysUser"> |
| | | insert into sys_user(id, arp, account, password, company, department, name, phone, email, memo, id_card, approver_flag, see_flag, role_id, valid_flag, create_time, update_time,project,waster) |
| | | values (#{id}, #{arp}, #{account}, #{password}, #{company}, #{department}, #{name}, #{phone}, #{email}, #{memo}, #{idCard}, #{approverFlag}, #{seeFlag}, #{roleId}, 1, now(), now(),#{project},#{waster}) |
| | | insert into sys_user(id, arp, account, password, company, department, name, phone, email, memo, id_card, approver_flag, see_flag, role_id, valid_flag, create_time, update_time,project,waster,url,score) |
| | | values (#{id}, #{arp}, #{account}, #{password}, #{company}, #{department}, #{name}, #{phone}, #{email}, #{memo}, #{idCard}, #{approverFlag}, #{seeFlag}, #{roleId}, 1, now(), now(),#{project},#{waster},#{url},#{score}) |
| | | </insert> |
| | | |
| | | <update id="updateSysUser" parameterType="com.nanometer.smartlab.entity.SysUser"> |
| | | update sys_user set arp=#{arp}, account=#{account}, password=#{password}, company=#{company}, department=#{department}, name=#{name}, phone=#{phone}, |
| | | email=#{email}, memo=#{memo}, id_card=#{idCard}, approver_flag=#{approverFlag}, see_flag=#{seeFlag}, role_id=#{roleId}, point=#{point},update_time=now(),project=#{project},waster=#{waster} |
| | | email=#{email}, memo=#{memo}, id_card=#{idCard}, approver_flag=#{approverFlag}, see_flag=#{seeFlag}, role_id=#{roleId}, point=#{point},update_time=now(),project=#{project},waster=#{waster}, |
| | | url= #{url}, |
| | | score = #{score} |
| | | where id=#{id} |
| | | </update> |
| | | |
| | |
| | | package com.nanometer.smartlab.entity; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | |
| | | import com.nanometer.smartlab.entity.enumtype.ApproverFlag; |
| | |
| | | private String roleName; |
| | | private String project; |
| | | private Waster waster; |
| | | // 图片的相对地址 |
| | | private String url; |
| | | // 考试分数 |
| | | private BigDecimal score; |
| | | |
| | | public String getId() { |
| | | return id; |
| | |
| | | public void setWaster(Waster waster) { |
| | | this.waster = waster; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public BigDecimal getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(BigDecimal score) { |
| | | this.score = score; |
| | | } |
| | | } |
| | |
| | | institute.copyright= Copyright\u00A92017 \u65B0\u7586\u7EF4\u543E\u5C14\u81EA\u6CBB\u533A\u5B89\u5168\u79D1\u5B66\u6280\u672F\u7814\u7A76\u9662\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u82CF\u5DDE\u7EB3\u7C73\u6280\u672F\u4E0E\u7EB3\u7C73\u4EFF\u751F\u7814\u7A76\u6240\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u5317\u4EAC\u8FC7\u7A0B\u5DE5\u7A0B\u7814\u7A76\u6240\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | institute.copyright= Copyright\u00A92021 \u6750\u6599\u79D1\u5B66\u59D1\u82CF\u5B9E\u9A8C\u5BA4\u00A0\u82CFICP\u590720047331\u53F7-1 |
| | | |
| | | message.url= http://aq.gusulab.ac.cn:18084/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | jdbc.password=NMS@uss20201! |
| | | |
| | | institute.id = 10 |
| | | institute.name = \u65b0\u7586\u56fd\u6cf0\u65b0\u534e\u77ff\u4e1a\u80a1\u4efd\u6709\u9650\u516c\u53f8 |
| | | institute.name = \u65B0\u7586\u56FD\u6CF0\u65B0\u534E\u77FF\u4E1A\u80A1\u4EFD\u6709\u9650\u516C\u53F8 |
| | | institute.url = http://222.92.213.22:18001 |
| | | institute.app.id = wxef5464cb3cd407ea |
| | | institute.app.secret = f0b8dec4bc340a9863ed7de08cf2dcf1 |
| | | alarm.url = |
| | | reagent.detail.price.api = |
| | | institute.copyright= Copyright\u00A92017 \u65b0\u7586\u56fd\u6cf0\u65b0\u534e\u77ff\u4e1a\u80a1\u4efd\u6709\u9650\u516c\u53f8\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | institute.copyright= Copyright\u00A92017 \u65B0\u7586\u56FD\u6CF0\u65B0\u534E\u77FF\u4E1A\u80A1\u4EFD\u6709\u9650\u516C\u53F8\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u5927\u8FDE\u5316\u5B66\u7269\u7406\u7814\u7A76\u6240\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u65B0\u7586\u7406\u5316\u6280\u672F\u7814\u7A76\u6240\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u5170\u5DDE\u5316\u5B66\u7269\u7406\u7814\u7A76\u6240\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u9752\u6D77\u76D0\u6E56\u7814\u7A76\u6240\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | jdbc.url=jdbc:mysql://localhost:3306/smartlabdb?useUnicode=true&characterEncoding=utf-8&autoReconnect=true |
| | | jdbc.url=jdbc:mysql://sds.sinanoaq.com:13306/smartlabdb?useUnicode=true&characterEncoding=utf-8&autoReconnect=true |
| | | jdbc.username=root |
| | | jdbc.password=Sinanoaq#415 |
| | | #\uFFFD\u0439\uFFFD\uFFFD\uFFFD\u0467\u053A\uFFFD\u00BD\uFFFD\uFFFD\uFFFD\u032C\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u043E\uFFFD\uFFFD\uFFFD |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u65B0\u7586\u751F\u6001\u4E0E\u5730\u7406\u7814\u7A76\u6240\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u4E0A\u6D77\u5149\u5B66\u7CBE\u5BC6\u673A\u68B0\u7814\u7A76\u6240\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E1D\u7EF8\u4E4B\u8DEF\u521B\u65B0\u53D1\u5C55\u7814\u7A76\u9662\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u82CF\u5DDE\u7EB3\u7C73\u6280\u672F\u4E0E\u7EB3\u7C73\u4EFF\u751F\u7814\u7A76\u6240\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | <context:component-scan base-package="com.nanometer.smartlab.api"/> |
| | | <context:component-scan base-package="com.nanometer.smartlab.controller"/> |
| | | |
| | | <!-- 静态资源(js、image等)的访问 --> |
| | | <mvc:default-servlet-handler/> |
| | | |
| | | <context:property-placeholder ignore-unresolvable="true" location="WEB-INF/config.properties" file-encoding="UTF-8"/> |
| | | <!-- 开启注解 --> |
| | | <!-- 默认的注解映射的支持,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping --> |
| | |
| | | <mvc:cors> |
| | | <mvc:mapping path="/**" allowed-origins="*" allow-credentials="true" max-age="1800" allowed-methods="GET,POST"/> |
| | | </mvc:cors> |
| | | |
| | | |
| | | <mvc:resources mapping="/upload/**" location="file:///d:/opt/file/smartlab/img/" /> |
| | | <!-- 静态资源(js、image等)的访问 --> |
| | | <mvc:default-servlet-handler/> |
| | | </beans> |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u82CF\u5DDE\u751F\u7269\u533B\u5B66\u5DE5\u7A0B\u6280\u672F\u7814\u7A76\u6240\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | jdbc.url=jdbc:mysql://139.196.181.203:3306/smartlabdb_test?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false |
| | | jdbc.url=jdbc:mysql://localhost:3306/smartlabdb?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false |
| | | jdbc.username=root |
| | | jdbc.password=GKHY@root20201! |
| | | jdbc.password=123456 |
| | | |
| | | institute.id = 2 |
| | | institute.name = \u4E2D\u56FD\u79D1\u5B66\u9662\u82CF\u5DDE\u7EB3\u7C73\u6280\u672F\u4E0E\u7EB3\u7C73\u4EFF\u751F\u7814\u7A76\u6240 |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u82CF\u5DDE\u7EB3\u7C73\u6280\u672F\u4E0E\u7EB3\u7C73\u4EFF\u751F\u7814\u7A76\u6240\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = file:///d:/opt/file/smartlab/img/ |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u65B0\u7586\u5929\u6587\u53F0\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | <servlet-mapping> |
| | | <servlet-name>MVC Servlet</servlet-name> |
| | | <url-pattern>/api/*</url-pattern> |
| | | <url-pattern>/upload/*</url-pattern> |
| | | |
| | | </servlet-mapping> |
| | | |
| | | <context-param> |
| | |
| | | institute.copyright= Copyright\u00A92017 \u65B0\u7586\u5927\u5B66\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u6280\u672F\u5927\u5B66\u82CF\u5DDE\u9AD8\u7B49\u7814\u7A76\u9662\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u751F\u6001\u73AF\u5883\u7814\u7A76\u4E2D\u5FC3\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u6C34\u751F\u751F\u7269\u7814\u7A76\u6240\u00A0\u82CFICP\u590710220403\u53F7-6 |
| | | |
| | | message.url= https://sinanoaq.com:8095/api/sendmessage |
| | | personImgPath = /opt/file/smartlab/img/ |
| | |
| | | white-space: normal; |
| | | word-break: break-all; |
| | | } |
| | | #dialogForm\:img-pic > tbody > tr > td:nth-child(2):has(img) { |
| | | width: 200px !important; |
| | | } |
| | | </style> |
| | | <p:dataTable id="userMngDataTable" styleClass="data-table" |
| | | paginator="true" paginatorAlwaysVisible="false" paginatorPosition="bottom" |
| | |
| | | |
| | | <p:dialog modal="true" header="#{userMngController.action==constants.ACTION_ADD?'新建':'修改'}" appendTo="@(body)" |
| | | id="dialog" widgetVar="dialog" |
| | | resizable="false" width="800"> |
| | | resizable="false" width="900"> |
| | | |
| | | <h:form id="dialogForm"> |
| | | <p:panelGrid columns="4" styleClass="content2 grid-padding-bottom2"> |
| | | <p:outputLabel value="单位"></p:outputLabel> |
| | |
| | | <f:selectItems value="#{userMngController.wasterSelectList}" |
| | | var="item" itemLabel="#{item.text}" itemValue="#{item}"></f:selectItems> |
| | | </p:selectOneMenu> |
| | | |
| | | <p:outputLabel value="考试分数"/> |
| | | <p:inputNumber value="#{userMngController.sysUser.score}" decimalPlaces="0" minValue="0" |
| | | > </p:inputNumber> |
| | | |
| | | <p:outputLabel /> |
| | | <p:outputLabel /> |
| | | |
| | | </p:panelGrid> |
| | | <p:panelGrid columns="4" styleClass="content2 grid-padding-bottom2" id="img-pic"> |
| | | <p:outputLabel value="图片"/> |
| | | |
| | | <p:graphicImage rendered="#{userMngController.sysUser.url ne null and userMngController.sysUser.url ne ''}" |
| | | url="#{userMngController.sysUser.url}" |
| | | width="120" |
| | | height="120"/> |
| | | |
| | | <p:commandButton value="点击上传" |
| | | oncomplete="PF('imgDialog').show();"/> |
| | | |
| | | </p:panelGrid> |
| | | <p:panel styleClass="btn"> |
| | | <p:commandButton value="保存" actionListener="#{userMngController.onSaveBtnClick}" |
| | |
| | | </p:panel> |
| | | </h:form> |
| | | </p:dialog> |
| | | <p:dialog modal="true" header="图片上传" appendTo="@(body)" |
| | | id="imgDialog" widgetVar="imgDialog" |
| | | resizable="false" width="700"> |
| | | <p:panelGrid columns="1" styleClass="content2 grid-padding-bottom2"> |
| | | <h:form id="dialogForm2"> |
| | | <p:fileUpload fileUploadListener="#{userMngController.handleImageUpload}" |
| | | mode="advanced" |
| | | dragDropSupport="false" |
| | | uploadLabel="上传" |
| | | cancelLabel="取消" |
| | | label="浏览" |
| | | invalidFileMessage="请上传gif、jpe、jpg、png文件" |
| | | multiple="false" |
| | | sizeLimit="10000000" |
| | | fileLimit="1" |
| | | allowTypes="/(\.|\/)(gif|jpe?g|png)$/" |
| | | > </p:fileUpload> |
| | | </h:form> |
| | | |
| | | </p:panelGrid> |
| | | |
| | | </p:dialog> |
| | | </ui:composition> |
| | | </html> |