From 497177d5218b57a023d396a51cfeabfac62fffd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E7=8E=89=E7=90=A6?= <7507756+jiang_yuqi@user.noreply.gitee.com> Date: Fri, 20 Dec 2024 20:24:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 102 +-- .../common/core/enums/UseStateEnums.java | 1 + .../flowable/domain/dto/FlowSaveXmlVo.java | 5 + .../flowable/mapper/FlowDeployMapper.java | 38 +- .../manage/domain/ProProjectInfoSubdepts.java | 10 + .../domain/ProProjectInfoSubdeptsUsers.java | 24 + .../ProProjectInfoSubdeptsGroupMapper.java | 1 + .../mapper/flowable/FlowDeployMapper.xml | 46 +- .../ProProjectInfoSubdeptsGroupMapper.xml | 5 +- .../ProProjectInfoSubdeptsUsersMapper.xml | 22 +- .../resources/mapper/system/SysRoleMapper.xml | 3 + .../file/controller/SysFileController.java | 48 ++ .../service/FastDfsSysFileServiceImpl.java | 20 +- .../yanzhu/file/service/ISysFileService.java | 9 + .../file/service/LocalSysFileServiceImpl.java | 13 + .../file/service/MinioSysFileServiceImpl.java | 24 +- .../yanzhu/file/utils/FileUploadUtils.java | 141 +++- .../controller/FlowDefinitionController.java | 16 +- .../service/IFlowDefinitionService.java | 17 +- .../impl/FlowDefinitionServiceImpl.java | 53 +- yanzhu-modules/yanzhu-manage/pom.xml | 18 +- .../controller/wechat/WxController.java | 43 +- .../yanzhu/manage/enums/CraftPostEnums.java | 2 +- .../IProProjectInfoSubdeptsService.java | 16 + .../IProProjectInfoSubdeptsUsersService.java | 18 +- .../yanzhu/manage/service/IUniService.java | 15 +- .../impl/ProProjectInfoServiceImpl.java | 23 +- .../ProProjectInfoSubdeptsServiceImpl.java | 235 ++++-- ...roProjectInfoSubdeptsUsersServiceImpl.java | 324 ++++++-- .../manage/service/impl/UniServiceImpl.java | 4 +- .../manage/utils/pdf/MyTableRenderPolicy.java | 304 ------- .../com/yanzhu/manage/utils/pdf/PoiUtil.java | 21 +- .../pdf/ShangWuBiaoTableRenderPolicy.java | 191 ----- .../src/main/resources/template.json | 159 +--- yanzhu-ui-app/miniprogram/api/project.js | 19 +- yanzhu-ui-app/miniprogram/api/publics.js | 8 + yanzhu-ui-app/miniprogram/app.js | 14 +- .../miniprogram/pages/project_qr/index.js | 748 +++++++++++++++--- .../miniprogram/pages/project_qr/index.wxml | 209 ++--- .../miniprogram/pages/project_qr/index.wxss | 12 + .../miniprogram/project.private.config.json | 4 +- yanzhu-ui-app/miniprogram/utils/request.js | 47 +- yanzhu-ui-vue3/src/App.vue | 5 + .../src/components/Process/designer.vue | 3 +- .../components/Process/flowable/flowable.json | 5 + .../src/components/Process/index.vue | 23 +- .../components/Process/panel/commonPanel.vue | 51 +- .../Process/panel/multiInstance.vue | 2 +- .../components/Process/panel/taskPanel.vue | 2 +- .../src/components/flow/Role/index.vue | 18 + .../src/views/flowable/definition/index.vue | 60 +- .../src/views/flowable/definition/model.vue | 1 + .../src/views/manage/basTemplate/index.vue | 18 +- .../src/views/system/role/index.vue | 10 +- 54 files changed, 2094 insertions(+), 1136 deletions(-) delete mode 100644 yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/pdf/MyTableRenderPolicy.java delete mode 100644 yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/pdf/ShangWuBiaoTableRenderPolicy.java diff --git a/pom.xml b/pom.xml index 30bd2d21..f5143abf 100644 --- a/pom.xml +++ b/pom.xml @@ -42,9 +42,10 @@ 5.8.20 1.9.1 2.1.7 - 1.6.0-beta1 + 1.12.0 1.0 5.5.13 + 15.8.0 @@ -125,6 +126,57 @@ ${poi.version} + + + com.lowagie + itext + ${lowagie.version} + + + + com.lowagie + itext-rtf + ${lowagie.version} + + + + com.lowagie + iTextAsian + ${lowagie.iTextAsian.version} + + + + + org.apache.poi + poi + ${poi.version} + + + + org.apache.poi + poi-ooxml-schemas + 4.1.2 + + + + com.deepoove + poi-tl + ${poi-tl.version} + + + + + org.aspectj + aspectjweaver + ${aspectjweaver.version} + + + + com.aspose + aspose-words + ${aspose.words.version} + + org.apache.velocity @@ -230,54 +282,6 @@ ${yanzhu.version} - - - org.apache.poi - poi - ${poi.version} - - - - com.lowagie - itext - ${lowagie.version} - - - - com.lowagie - itext-rtf - ${lowagie.version} - - - - com.deepoove - poi-tl - ${poi-tl.version} - - - - - - org.aspectj - aspectjweaver - ${aspectjweaver.version} - - - - com.aspose - aspose-words - 15.8.0 - - - - - - com.itextpdf - itextpdf - ${itextpdf.version} - - - net.sf.mpxj mpxj diff --git a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/UseStateEnums.java b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/UseStateEnums.java index 1ce256ee..dfc7dbaf 100644 --- a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/UseStateEnums.java +++ b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/UseStateEnums.java @@ -7,6 +7,7 @@ package com.yanzhu.common.core.enums; */ public enum UseStateEnums { + AW("0", "待入场"), IN("1", "进场"), OUT("2", "离场"); diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/dto/FlowSaveXmlVo.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/dto/FlowSaveXmlVo.java index 00311897..41aa8e89 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/dto/FlowSaveXmlVo.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/dto/FlowSaveXmlVo.java @@ -11,6 +11,11 @@ import java.io.Serializable; @Data public class FlowSaveXmlVo implements Serializable { + /** + * 项目主键 + */ + private String proId; + /** * 流程名称 */ diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowDeployMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowDeployMapper.java index 68cb8036..805a70ae 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowDeployMapper.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowDeployMapper.java @@ -1,8 +1,11 @@ package com.yanzhu.flowable.mapper; import com.yanzhu.flowable.domain.dto.FlowProcDefDto; +import com.yanzhu.flowable.domain.my.FlowDeptVo; +import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; /** * 流程定义查询 @@ -15,8 +18,39 @@ public interface FlowDeployMapper { /** * 流程定义列表 - * @param name + * @param name 流程名称 + * @param category 流程分类 + * @param comId 单位主键 + * @param proId 项目主键 + * @param proName 项目主键 * @return */ - List selectDeployList(String name); + List selectDeployList(@Param("name") String name, @Param("category") String category,@Param("comId") Long comId, @Param("proId") Long proId, @Param("proName") String proName); + + /** + * 删除流程定义和项目关联 + * + * @param proId 流程主键 + * @param type 流程主键 + * @return 结果 + */ + List> selectProcdefDeptByParam(@Param("proId") Long proId, @Param("type") String type); + + /** + * 删除流程定义和项目关联 + * + * @param defId 流程主键 + * @param proId 流程主键 + * @param type 流程主键 + * @return 结果 + */ + int deleteProcdefDeptByParam(@Param("defId") String defId, @Param("proId") String proId, @Param("type") String type); + + /** + * 保存流程定义和项目关联 + * + * @param flowDeptVo 工作流项目单位关系 + * @return 结果 + */ + void saveProcdefDeptByParam(FlowDeptVo flowDeptVo); } diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdepts.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdepts.java index 8d785c57..a609cbb9 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdepts.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdepts.java @@ -115,6 +115,8 @@ public class ProProjectInfoSubdepts extends BaseEntity private String leaderCardImgInv; /** 委托人半身照片 */ private String leaderUserPicture; + /** 委托代理人学历 */ + private String leaderDegreeGrade; /** * 用户信息 @@ -354,6 +356,14 @@ public class ProProjectInfoSubdepts extends BaseEntity this.proProjectInfoSubdeptsUsers = proProjectInfoSubdeptsUsers; } + public String getLeaderDegreeGrade() { + return leaderDegreeGrade; + } + + public void setLeaderDegreeGrade(String leaderDegreeGrade) { + this.leaderDegreeGrade = leaderDegreeGrade; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdeptsUsers.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdeptsUsers.java index a7bc687d..9375f8a1 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdeptsUsers.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdeptsUsers.java @@ -28,6 +28,9 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity /** 主键 */ private Long id; + /** 上级主键 */ + private Long parId; + @Excel(name = "姓名") private String userName; @Excel(name = "身份证") @@ -140,6 +143,10 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity * 用户岗位 */ private String userPost; + /** + * 二维码 + */ + private String qrCode; public String getEnterState() { return enterState; @@ -237,6 +244,15 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity { return id; } + + public Long getParId() { + return parId; + } + + public void setParId(Long parId) { + this.parId = parId; + } + public void setComId(Long comId) { this.comId = comId; @@ -459,6 +475,14 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity this.userPost = userPost; } + public String getQrCode() { + return qrCode; + } + + public void setQrCode(String qrCode) { + this.qrCode = qrCode; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/ProProjectInfoSubdeptsGroupMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/ProProjectInfoSubdeptsGroupMapper.java index d75c3bb3..cc580ddb 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/ProProjectInfoSubdeptsGroupMapper.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/ProProjectInfoSubdeptsGroupMapper.java @@ -58,4 +58,5 @@ public interface ProProjectInfoSubdeptsGroupMapper * @return 结果 */ public int deleteProProjectInfoSubdeptsGroupByIds(Long[] ids); + } diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowDeployMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowDeployMapper.xml index 1f08e80b..e7840d74 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowDeployMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowDeployMapper.xml @@ -15,17 +15,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" rp.key_ as flowKey, rp.version_ as version, rp.suspension_state_ as suspensionState, - rd.deploy_time_ as deploymentTime + rd.deploy_time_ as deploymentTime, + sd.dept_id as deptId, + sd.dept_name as deptName, + pi.id as projectId, + pi.project_name as projectName FROM act_re_procdef rp LEFT JOIN act_re_deployment rd ON rp.deployment_id_ = rd.id_ + LEFT JOIN act_re_procdef_dept rpd ON rpd.PROCDEF_ID_ = rp.ID_ + LEFT JOIN pro_project_info pi on pi.id = rpd.PROJ_ID_ + LEFT JOIN sys_dept sd on sd.dept_id = pi.com_id and rd.name_ like concat('%', #{name}, '%') + + and rd.category_ = #{category} + + + and rpd.DEPT_ID_ = #{comId} + + + and rpd.PROJ_ID_ = #{proId} + + + and pi.project_name like concat('%', #{proName}, '%') + order by rd.deploy_time_ desc + + + + delete from act_re_procdef_dept where PROCDEF_ID_ = #{defId} and PROJ_ID_ = #{proId} and TYPE_ = #{type} + + + + insert into act_re_procdef_dept + + PROCDEF_ID_, + TYPE_, + DEPT_ID_, + PROJ_ID_, + SORT_, + + + #{procdefId}, + #{prtype}, + #{deptId}, + #{projId}, + #{sort}, + + \ No newline at end of file diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoSubdeptsGroupMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoSubdeptsGroupMapper.xml index 48cef70f..ef1380a6 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoSubdeptsGroupMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoSubdeptsGroupMapper.xml @@ -41,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" \ No newline at end of file diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/system/SysRoleMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/system/SysRoleMapper.xml index 71370180..9d2e159c 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/system/SysRoleMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/system/SysRoleMapper.xml @@ -57,6 +57,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND rd.dept_id = #{deptId} + + AND (d.dept_id = #{projectId} or find_in_set(#{projectId},d.ancestors)) + AND r.role_name like concat('%', #{roleName}, '%') diff --git a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/controller/SysFileController.java b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/controller/SysFileController.java index c794b3c0..2d0309d5 100644 --- a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/controller/SysFileController.java +++ b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/controller/SysFileController.java @@ -73,6 +73,28 @@ public class SysFileController } } + /** + * 文件上传请求 + */ + @PostMapping("/NoSecurity/signUpload") + public R noSecuritySignUpload(MultipartFile file) + { + try + { + // 上传并返回访问地址 + String url = sysFileService.uploadSignetFile(file); + SysFile sysFile = new SysFile(); + sysFile.setName(FileUtils.getName(url)); + sysFile.setUrl(url); + return R.ok(sysFile); + } + catch (Exception e) + { + log.error("上传文件失败", e); + return R.fail(e.getMessage()); + } + } + /** * 文件上传请求 */ @@ -120,4 +142,30 @@ public class SysFileController log.error("下载文件失败", e); } } + + /** + * 文件通用下载... + * @param fileName + * @param response + */ + @GetMapping("/NoSecurity/download") + public void noSecurityDownloadFile(String fileName, HttpServletResponse response) { + try + { + if (!FileUtils.checkAllowDownload(fileName)) + { + throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); + } + String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); + String filePath = sysFileService.findFilePath(fileName); + + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + FileUtils.setAttachmentResponseHeader(response, realFileName); + FileUtils.writeBytes(filePath, response.getOutputStream()); + } + catch (Exception e) + { + log.error("下载文件失败", e); + } + } } \ No newline at end of file diff --git a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/FastDfsSysFileServiceImpl.java b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/FastDfsSysFileServiceImpl.java index c1b2d034..4d23a40f 100644 --- a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/FastDfsSysFileServiceImpl.java +++ b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/FastDfsSysFileServiceImpl.java @@ -1,12 +1,12 @@ package com.yanzhu.file.service; +import com.github.tobato.fastdfs.domain.fdfs.StorePath; +import com.github.tobato.fastdfs.service.FastFileStorageClient; +import com.yanzhu.common.core.utils.file.FileTypeUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; -import com.github.tobato.fastdfs.domain.fdfs.StorePath; -import com.github.tobato.fastdfs.service.FastFileStorageClient; -import com.yanzhu.common.core.utils.file.FileTypeUtils; /** * FastDFS 文件存储 @@ -40,6 +40,20 @@ public class FastDfsSysFileServiceImpl implements ISysFileService return domain + "/" + storePath.getFullPath(); } + /** + * 签名文件上传接口 + * + * @param file 上传的文件 + * @return 访问地址 + * @throws Exception + */ + public String uploadSignetFile(MultipartFile file) throws Exception + { + StorePath storePath = storageClient.uploadFile(file.getInputStream(), file.getSize(), + FileTypeUtils.getExtension(file), null); + return domain + "/" + storePath.getFullPath(); + } + /** * 获取文件地址... * diff --git a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/ISysFileService.java b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/ISysFileService.java index 3263a657..8aabba25 100644 --- a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/ISysFileService.java +++ b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/ISysFileService.java @@ -18,6 +18,15 @@ public interface ISysFileService */ public String uploadFile(MultipartFile file) throws Exception; + /** + * 签名文件上传接口 + * + * @param file 上传的文件 + * @return 访问地址 + * @throws Exception + */ + public String uploadSignetFile(MultipartFile file) throws Exception; + /** * 获取文件地址... * diff --git a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/LocalSysFileServiceImpl.java b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/LocalSysFileServiceImpl.java index e5c66a51..e0cc7da3 100644 --- a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/LocalSysFileServiceImpl.java +++ b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/LocalSysFileServiceImpl.java @@ -47,6 +47,19 @@ public class LocalSysFileServiceImpl implements ISysFileService return localFilePrefix + name; } + /** + * 签名文件上传接口 + * + * @param file 上传的文件 + * @return 访问地址 + * @throws Exception + */ + public String uploadSignetFile(MultipartFile file) throws Exception + { + String name = FileUploadUtils.signetUpload(localFilePath, file); + return localFilePrefix + name; + } + /** * 获取文件地址... * diff --git a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/MinioSysFileServiceImpl.java b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/MinioSysFileServiceImpl.java index 334b9746..9a1dd3cf 100644 --- a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/MinioSysFileServiceImpl.java +++ b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/MinioSysFileServiceImpl.java @@ -2,11 +2,11 @@ package com.yanzhu.file.service; import com.yanzhu.file.config.MinioConfig; import com.yanzhu.file.utils.FileUploadUtils; +import io.minio.MinioClient; +import io.minio.PutObjectArgs; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; -import io.minio.MinioClient; -import io.minio.PutObjectArgs; /** * Minio 文件存储 @@ -43,6 +43,26 @@ public class MinioSysFileServiceImpl implements ISysFileService return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName; } + /** + * 签名文件上传接口 + * + * @param file 上传的文件 + * @return 访问地址 + * @throws Exception + */ + public String uploadSignetFile(MultipartFile file) throws Exception + { + String fileName = FileUploadUtils.extractFilename(file); + PutObjectArgs args = PutObjectArgs.builder() + .bucket(minioConfig.getBucketName()) + .object(fileName) + .stream(file.getInputStream(), file.getSize(), -1) + .contentType(file.getContentType()) + .build(); + client.putObject(args); + return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName; + } + /** * 获取文件地址... * diff --git a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/utils/FileUploadUtils.java b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/utils/FileUploadUtils.java index c00610e5..c00f4770 100644 --- a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/utils/FileUploadUtils.java +++ b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/utils/FileUploadUtils.java @@ -1,5 +1,7 @@ package com.yanzhu.file.utils; +import java.awt.*; +import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.nio.file.Paths; @@ -9,7 +11,6 @@ import java.util.Objects; import cn.hutool.core.img.ImgUtil; import cn.hutool.core.io.FileUtil; import com.yanzhu.common.core.utils.file.FileUtils; -import com.yanzhu.common.core.utils.file.ImageUtils; import org.apache.commons.io.FilenameUtils; import org.springframework.web.multipart.MultipartFile; import com.yanzhu.common.core.exception.file.FileNameLengthLimitExceededException; @@ -21,6 +22,8 @@ import com.yanzhu.common.core.utils.file.FileTypeUtils; import com.yanzhu.common.core.utils.file.MimeTypeUtils; import com.yanzhu.common.core.utils.uuid.Seq; +import javax.imageio.ImageIO; + /** * 文件上传工具类 * @@ -58,6 +61,26 @@ public class FileUploadUtils } } + /** + * 根据文件路径上传 + * + * @param baseDir 相对应用的基目录 + * @param file 上传的文件 + * @return 文件名称 + * @throws IOException + */ + public static final String signetUpload(String baseDir, MultipartFile file) throws IOException + { + try + { + return signetUpload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + /** * 文件上传 * @@ -91,6 +114,39 @@ public class FileUploadUtils return getPathFileName(fileName); } + /** + * 文件上传 + * + * @param baseDir 相对应用的基目录 + * @param file 上传的文件 + * @param allowedExtension 上传文件类型 + * @return 返回上传成功的文件名 + * @throws FileSizeLimitExceededException 如果超出最大大小 + * @throws FileNameLengthLimitExceededException 文件名太长 + * @throws IOException 比如读写文件出错时 + * @throws InvalidExtensionException 文件校验异常 + */ + public static final String signetUpload(String baseDir, MultipartFile file, String[] allowedExtension) + throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, + InvalidExtensionException + { + int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length(); + if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) + { + throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); + } + + assertAllowed(file, allowedExtension); + + String fileName = extractFilename(file); + + String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath(); + file.transferTo(Paths.get(absPath)); + // 压缩图片 + makeSignImage(absPath); + return getPathFileName(fileName); + } + /** * 图谱压缩 xx.min.jpg * @param absPath @@ -115,6 +171,89 @@ public class FileUploadUtils } } + /** + * 签名图片裁剪白边 + * @param absPath + */ + private static void makeSignImage(String absPath) { + try { + String ext = FileUtils.getFileExt(absPath).toLowerCase(); + String exts = Arrays.toString(new String[]{"jpg", "jpeg", "png", "bmp"}); + if (exts.contains(ext)) { + if (new File(absPath).exists()) { + BufferedImage bufferedImage = ImageIO.read(org.apache.commons.io.FileUtils.getFile(absPath)); + // 这里裁剪图片可能报错,报错用原图 + int[] array = bufferedImageToIntArray(bufferedImage,bufferedImage.getWidth(),bufferedImage.getHeight()); + // blank是作为四周边距留白 + int blank = 30; + boolean cutResult = false; + try { + // 图片裁剪 + ImgUtil.cut(FileUtil.file(absPath), + FileUtil.file(absPath + ".v1.png"), new Rectangle(array[0]-blank,array[1]-blank,array[2]+blank*2, array[3]+blank*2)); + ImgUtil.rotate(FileUtil.file(absPath+".v1.png"),270,FileUtil.file(absPath + ".sign.png")); + cutResult = true; + }catch (Exception ex){ + ex.printStackTrace(); + } + absPath = cutResult?(absPath+".sign.png"):absPath; + int w = ImgUtil.read(FileUtil.file(absPath)).getWidth()/20; + ImgUtil.scale(FileUtil.file(absPath), + FileUtil.file(absPath + ".min.png"), w); + } + } + }catch (Exception ex){ + ex.printStackTrace(); + } + } + + /** + * 图片裁剪 + * @param image + * @return + */ + public static int[] bufferedImageToIntArray(BufferedImage image, int width, int height) { + try { + int rgb = 0; + int x1 = width; + int y1 = height; + int x2 = 0; + int y2 = 0; + int temp1 = 0; + int temp2 = 0; + // 方式一:通过getRGB()方式获得像素数组 + for (int i = 0; i < width; i++) { + for (int j = 0; j < height; j++) { + rgb = image.getRGB(i, j); + if (rgb == -16777216) { + temp1 = i; + temp2 = j; + // 计算最左侧 + if (x1 >= temp1) { + x1 = temp1; + } + // 计算最右侧 + if (x2 <= temp1) { + x2 = temp1; + } + // 计算最下方 + if (y2 <= temp2) { + y2 = temp2; + } + // 计算最上方 + if (y1 >= temp2) { + y1 = temp2; + } + } + } + } + return new int[] {x1, y1, x2 - x1, y2 - y1}; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + /** * 编码文件名 */ diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowDefinitionController.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowDefinitionController.java index 1a4c9aa9..476f445e 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowDefinitionController.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowDefinitionController.java @@ -1,5 +1,6 @@ package com.yanzhu.flowable.controller; +import com.yanzhu.common.core.text.Convert; import com.yanzhu.common.core.utils.StringUtils; import com.yanzhu.common.core.web.controller.BaseController; import com.yanzhu.common.core.web.domain.AjaxResult; @@ -61,9 +62,11 @@ public class FlowDefinitionController extends BaseController { @GetMapping(value = "/list") @ApiOperation(value = "流程定义列表", response = FlowProcDefDto.class) - public TableDataInfo list(@ApiParam(value = "流程名称", required = false) @RequestParam(required = false) String name) { + public TableDataInfo list(@ApiParam(value = "流程名称", required = false) @RequestParam(required = false) String name, + @ApiParam(value = "流程分类", required = false) @RequestParam(required = false) String category, + @ApiParam(value = "项目单位", required = false) @RequestParam(required = false) String proName) { startPage(); - List list = flowDefinitionService.list(name); + List list = flowDefinitionService.list(name,category,proName); return getDataTable(list); } @@ -139,11 +142,10 @@ public class FlowDefinitionController extends BaseController { InputStream in = null; try { String xml = vo.getXml(); - //将xml数据进行base64解码 - xml = StringUtils.utf8Str(xml); - //in = new ByteArrayInputStream(vo.getXml().getBytes(StandardCharsets.UTF_8)); - in = new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)); - flowDefinitionService.importFile(vo.getName(), vo.getCategory(), in); + // 将xml数据进行base64解码 + byte[] xmlBytes = Base64.getDecoder().decode(xml); + in = new ByteArrayInputStream(xmlBytes); + flowDefinitionService.importFile(Convert.toLong(vo.getProId()), vo.getName(), vo.getCategory(), in); } catch (Exception e) { log.error("导入失败:", e); return AjaxResult.error(e.getMessage()); diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowDefinitionService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowDefinitionService.java index b5a0a0f1..ce9f7af0 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowDefinitionService.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowDefinitionService.java @@ -18,10 +18,12 @@ public interface IFlowDefinitionService { /** * 流程定义列表 - * + * @param name 流程名称 + * @param category 流程分类 + * @param proName 项目单位 * @return 流程定义分页列表数据 */ - List list(String name); + List list(String name, String category, String proName); /** * 导入流程文件 @@ -33,6 +35,17 @@ public interface IFlowDefinitionService { */ void importFile(String name, String category, InputStream in); + /** + * 导入流程文件 + * 当每个key的流程第一次部署时,指定版本为1。对其后所有使用相同key的流程定义, + * 部署时版本会在该key当前已部署的最高版本号基础上加1。key参数用于区分流程定义 + * @param proId 项目主键 + * @param name 流程名称 + * @param category 流程类型 + * @param in 流程文件 + */ + void importFile(Long proId, String name, String category, InputStream in); + /** * 读取xml * @param deployId diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowDefinitionServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowDefinitionServiceImpl.java index 98432d6f..e9b24d8a 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowDefinitionServiceImpl.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowDefinitionServiceImpl.java @@ -1,16 +1,20 @@ package com.yanzhu.flowable.service.impl; +import com.yanzhu.common.core.constant.CacheConstants; import com.yanzhu.common.core.text.Convert; import com.yanzhu.common.core.web.domain.AjaxResult; +import com.yanzhu.common.redis.service.RedisService; import com.yanzhu.common.security.utils.SecurityUtils; import com.yanzhu.flowable.common.constant.ProcessConstants; import com.yanzhu.flowable.common.enums.FlowComment; import com.yanzhu.flowable.domain.SysForm; import com.yanzhu.flowable.domain.dto.FlowProcDefDto; +import com.yanzhu.flowable.domain.my.FlowDeptVo; import com.yanzhu.flowable.factory.FlowServiceFactory; import com.yanzhu.flowable.mapper.FlowDeployMapper; import com.yanzhu.flowable.service.IFlowDefinitionService; import com.yanzhu.flowable.service.ISysDeployFormService; +import com.yanzhu.manage.domain.ProProjectInfo; import com.yanzhu.system.api.domain.SysUser; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; @@ -21,6 +25,7 @@ import org.flowable.engine.repository.ProcessDefinitionQuery; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.image.impl.DefaultProcessDiagramGenerator; import org.flowable.task.api.Task; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -42,12 +47,15 @@ import java.util.Objects; @Slf4j public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFlowDefinitionService { - @Resource - private ISysDeployFormService sysDeployFormService; + @Autowired + private RedisService redisService; @Resource private FlowDeployMapper flowDeployMapper; + @Resource + private ISysDeployFormService sysDeployFormService; + private static final String BPMN_FILE_SUFFIX = ".bpmn"; @Override @@ -58,24 +66,24 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl return count > 0 ? true : false; } - /** * 流程定义列表 - * + * @param name 流程名称 + * @param category 流程分类 + * @param proName 项目单位 * @return 流程定义分页列表数据 */ @Override - public List list(String name) { - - final List dataList = flowDeployMapper.selectDeployList(name); + public List list(String name, String category, String proName) { + final List dataList = flowDeployMapper.selectDeployList(name,category,SecurityUtils.getLoginUser().getProjectDeptId(),SecurityUtils.getLoginUser().getProjectId(),proName); // 加载挂表单 - for (FlowProcDefDto procDef : dataList) { + /**for (FlowProcDefDto procDef : dataList) { SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(procDef.getDeploymentId()); if (Objects.nonNull(sysForm)) { procDef.setFormName(sysForm.getFormName()); procDef.setFormId(sysForm.getFormId()); } - } + }*/ return dataList; } @@ -119,6 +127,33 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl } + /** + * 导入流程文件 + * 当每个key的流程第一次部署时,指定版本为1。对其后所有使用相同key的流程定义, + * 部署时版本会在该key当前已部署的最高版本号基础上加1。key参数用于区分流程定义 + * @param proId 项目主键 + * @param name 流程名称 + * @param category 流程类型 + * @param in 流程文件 + */ + @Override + public void importFile(Long proId, String name, String category, InputStream in){ + + // 获取项目缓存信息 + ProProjectInfo info = redisService.getCacheObject(CacheConstants.PRO_PROJECT+proId); + Deployment deploy = repositoryService.createDeployment().addInputStream(name + BPMN_FILE_SUFFIX, in).name(name).category(category).deploy(); + ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deploy.getId()).singleResult(); + repositoryService.setProcessDefinitionCategory(definition.getId(), category); + // 修改项目单位和流程关系... + FlowDeptVo flowDeptVo = new FlowDeptVo(); + flowDeptVo.setProcdefId(definition.getId()); + flowDeptVo.setPrtype(category); + flowDeptVo.setDeptId(info.getComId()); + flowDeptVo.setProjId(proId); + flowDeptVo.setSort(Convert.toStr(definition.getVersion(),"0")); + flowDeployMapper.saveProcdefDeptByParam(flowDeptVo); + } + /** * 读取xml * diff --git a/yanzhu-modules/yanzhu-manage/pom.xml b/yanzhu-modules/yanzhu-manage/pom.xml index 8c9e4fec..c51fea3e 100644 --- a/yanzhu-modules/yanzhu-manage/pom.xml +++ b/yanzhu-modules/yanzhu-manage/pom.xml @@ -97,6 +97,17 @@ poi + + + org.apache.poi + poi-ooxml + + + + org.apache.poi + poi-ooxml-schemas + + com.lowagie itext @@ -110,9 +121,6 @@ com.lowagie iTextAsian - 1.0.0 - system - ${pom.basedir}\libs\iTextAsian-1.0.0.jar @@ -130,9 +138,6 @@ com.aspose aspose-words - 15.8.0 - system - ${pom.basedir}\libs\aspose-words-15.8.0-jdk16.jar @@ -140,6 +145,7 @@ com.itextpdf itextpdf + ${itextpdf.version} diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/wechat/WxController.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/wechat/WxController.java index 8cb84938..b605b504 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/wechat/WxController.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/wechat/WxController.java @@ -2,8 +2,10 @@ package com.yanzhu.manage.controller.wechat; import com.yanzhu.common.core.web.controller.BaseController; import com.yanzhu.common.core.web.domain.AjaxResult; +import com.yanzhu.common.security.utils.DictUtils; import com.yanzhu.manage.domain.BusExamUser; import com.yanzhu.manage.domain.ProProjectInfoSubdepts; +import com.yanzhu.manage.domain.ProProjectInfoSubdeptsUsers; import com.yanzhu.manage.domain.SignetFileVo; import com.yanzhu.manage.service.*; import org.springframework.beans.factory.annotation.Autowired; @@ -39,6 +41,15 @@ public class WxController extends BaseController { @Autowired private IProProjectInfoSubdeptsUsersService proProjectInfoSubdeptsUsersService; + /** + * 查询数据字典缓存 + */ + @GetMapping("/findDictCache/{type}") + public AjaxResult findDictCache(@PathVariable("type") String type) + { + return success(DictUtils.getDictCache(type)); + } + /** * 获取我的项目列表 */ @@ -54,13 +65,24 @@ public class WxController extends BaseController { @PostMapping("/registerSubDepts") public AjaxResult registerSubDepts(@RequestBody ProProjectInfoSubdepts proProjectInfoSubdepts) { - int res; if(Objects.isNull(proProjectInfoSubdepts.getId())){ - res = proProjectInfoSubdeptsService.insertProProjectInfoSubdepts(proProjectInfoSubdepts); + return success(proProjectInfoSubdeptsService.insertProProjectInfoSubdeptsWX(proProjectInfoSubdepts)); }else{ - res = proProjectInfoSubdeptsService.updateProProjectInfoSubdepts(proProjectInfoSubdepts); + return success(proProjectInfoSubdeptsService.updateProProjectInfoSubdeptsWX(proProjectInfoSubdepts)); + } + } + + /** + * 新增分包单位人员 + */ + @PostMapping("/registerSubDeptsUsers") + public AjaxResult registerSubDeptsUsers(@RequestBody ProProjectInfoSubdeptsUsers ProProjectInfoSubdeptsUsers) + { + if(Objects.isNull(ProProjectInfoSubdeptsUsers.getId())){ + return success(proProjectInfoSubdeptsUsersService.insertProProjectInfoSubdeptsUsersWX(ProProjectInfoSubdeptsUsers)); + }else{ + return success(proProjectInfoSubdeptsUsersService.updateProProjectInfoSubdeptsUsersWX(ProProjectInfoSubdeptsUsers)); } - return toAjax(res); } /** @@ -74,6 +96,16 @@ public class WxController extends BaseController { return success(proProjectInfoSubdeptsService.findProSubDeptsInfo(proId,phoneNumber)); } + /** + * 查询分包单位人员 + * @param id 人员主键 + */ + @GetMapping("/findProSubDeptsUser/{id}") + public AjaxResult findProSubDeptsUserById(@PathVariable("id")Long id) + { + return success(proProjectInfoSubdeptsUsersService.selectProProjectInfoSubdeptsUsersById(id)); + } + /** * 查询分包人员信息 * @param proId 项目主键 @@ -154,7 +186,6 @@ public class WxController extends BaseController { @PostMapping("/submitUserSignets") public AjaxResult submitUserSignets(@RequestBody SignetFileVo signetFileVo) { - proProjectInfoSubdeptsUsersService.submitUserSignets(signetFileVo); - return success(); + return success(proProjectInfoSubdeptsUsersService.submitUserSignets(signetFileVo)); } } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/enums/CraftPostEnums.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/enums/CraftPostEnums.java index 66596af9..9a9a7329 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/enums/CraftPostEnums.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/enums/CraftPostEnums.java @@ -6,7 +6,7 @@ package com.yanzhu.manage.enums; public enum CraftPostEnums { WTDL("1022", "委托代理人"), - XMJL("1023", "委托代理人"); + XMJL("1023", "项目经理"); private final String code; private final String info; diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IProProjectInfoSubdeptsService.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IProProjectInfoSubdeptsService.java index d69d9c8c..e91e493c 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IProProjectInfoSubdeptsService.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IProProjectInfoSubdeptsService.java @@ -37,6 +37,14 @@ public interface IProProjectInfoSubdeptsService */ public int insertProProjectInfoSubdepts(ProProjectInfoSubdepts proProjectInfoSubdepts); + /** + * 新增分包单位 微信 + * + * @param proProjectInfoSubdepts 分包单位 + * @return 结果 + */ + public ProProjectInfoSubdepts insertProProjectInfoSubdeptsWX(ProProjectInfoSubdepts proProjectInfoSubdepts); + /** * 修改分包单位 * @@ -45,6 +53,14 @@ public interface IProProjectInfoSubdeptsService */ public int updateProProjectInfoSubdepts(ProProjectInfoSubdepts proProjectInfoSubdepts); + /** + * 修改分包单位 + * + * @param proProjectInfoSubdepts 分包单位 + * @return 结果 + */ + public ProProjectInfoSubdepts updateProProjectInfoSubdeptsWX(ProProjectInfoSubdepts proProjectInfoSubdepts); + /** * 修改分包单位 * diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IProProjectInfoSubdeptsUsersService.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IProProjectInfoSubdeptsUsersService.java index fcc2df8c..e026882b 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IProProjectInfoSubdeptsUsersService.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IProProjectInfoSubdeptsUsersService.java @@ -38,6 +38,14 @@ public interface IProProjectInfoSubdeptsUsersService */ public int insertProProjectInfoSubdeptsUsers(ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers); + /** + * 新增分包单位工人 + * + * @param proProjectInfoSubdeptsUsers 分包单位工人 + * @return 结果 + */ + public ProProjectInfoSubdeptsUsers insertProProjectInfoSubdeptsUsersWX(ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers); + /** * 修改分包单位工人 * @@ -46,6 +54,14 @@ public interface IProProjectInfoSubdeptsUsersService */ public int updateProProjectInfoSubdeptsUsers(ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers); + /** + * 修改分包单位工人 + * + * @param proProjectInfoSubdeptsUsers 分包单位工人 + * @return 结果 + */ + public ProProjectInfoSubdeptsUsers updateProProjectInfoSubdeptsUsersWX(ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers); + /** * 批量删除分包单位工人 * @@ -75,7 +91,7 @@ public interface IProProjectInfoSubdeptsUsersService * 提交文件签署 * @param signetFileVo */ - public void submitUserSignets(SignetFileVo signetFileVo); + public ProProjectInfoSubdeptsUsers submitUserSignets(SignetFileVo signetFileVo); /** * 大屏-项目详情-在岗人员统计 diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IUniService.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IUniService.java index 84bffe65..da0199d5 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IUniService.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IUniService.java @@ -1,8 +1,6 @@ package com.yanzhu.manage.service; -import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; -import com.yanzhu.manage.domain.ProProjectInfoSubdeptsUsers; import java.security.NoSuchAlgorithmException; import java.util.Map; @@ -11,9 +9,10 @@ import java.util.Map; * 宇泛服务封装 */ public interface IUniService { + /** * 鉴权接口 - * @param data + * @param projectId * @return */ public Map auth(long projectId) throws NoSuchAlgorithmException; @@ -53,7 +52,6 @@ public interface IUniService { */ public JSONObject admitPage(JSONObject data); - /** * 人员接口-人像注册 * @param data @@ -61,8 +59,6 @@ public interface IUniService { */ public JSONObject faceRegister(JSONObject data); - - /** * 人员接口-人像删除 * @param data @@ -119,7 +115,6 @@ public interface IUniService { */ public JSONObject authDeviceUpdate(JSONObject data); - /** * 授权接口-设备销权识别主体 * @param data @@ -127,7 +122,6 @@ public interface IUniService { */ public String authDeviceRevoke(JSONObject data); - /** * 同步宇泛的人员和头像 * @param userId @@ -151,6 +145,11 @@ public interface IUniService { */ public Long syncUniDeviceUser(Long deviceId,Long projectId); + /** + * 删除入厂 + * @param ids + * @return + */ public long syncUniDeviceDelete(Long[] ids); /** diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoServiceImpl.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoServiceImpl.java index 1d85efec..57996b2b 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoServiceImpl.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoServiceImpl.java @@ -141,16 +141,6 @@ public class ProProjectInfoServiceImpl implements IProProjectInfoService proDept.setLeader(proProjectInfo.getProjectPerson()); proDept.setPhone(proProjectInfo.getProjectPersonPhone()); proDept.setCreateBy(SecurityUtils.getUsername()); - try { - String accessToken = wxMaService.getAccessToken(); - String imgPath = profileConfig.getPath()+"/"+System.currentTimeMillis()+".png"; - log.info("accessToken...{}",accessToken); - WxQrCodeUtils.generateQrCode(imgPath, "pages/index/index", "aa=108&bb=2&cc=3", accessToken); - // TODO:生成二维码 - proProjectInfo.setProjectQrCode(imgPath); - }catch (Exception e){ - log.error(e.getMessage()); - } int res = proProjectInfoMapper.insertDept(proDept); if(res>0){ proProjectInfo.setId(proDept.getDeptId()); @@ -158,6 +148,19 @@ public class ProProjectInfoServiceImpl implements IProProjectInfoService proProjectInfo.setProjectPackage(projectPackage(proProjectInfo.getProjectName(),proDept.getDeptId())); proProjectInfo.setCreateTime(DateUtils.getNowDate()); res = proProjectInfoMapper.insertProProjectInfo(proProjectInfo); + try { + // 生成二维码 + String accessToken = wxMaService.getAccessToken(); + String filePath = DateUtils.datePath()+"/"+System.currentTimeMillis()+".png"; + String savePath = ProfileConfig.profilePath+"/"+filePath; + String profilePath = ProfileConfig.profile+"/"+filePath; + log.info("accessToken...{}",accessToken); + WxQrCodeUtils.generateQrCode(savePath, "pages/project_qr/index", "SIGID=1&QRPID="+proProjectInfo.getId(), accessToken); + proProjectInfo.setProjectQrCode(profilePath); + proProjectInfoMapper.updateProProjectInfo(proProjectInfo); + }catch (Exception e){ + log.error(e.getMessage()); + } loadingProjectsCache(); return res; }else{ diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsServiceImpl.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsServiceImpl.java index 89bbbadc..f5179757 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsServiceImpl.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsServiceImpl.java @@ -16,9 +16,12 @@ import com.yanzhu.manage.domain.ProProjectInfoSubdeptsUsers; import com.yanzhu.manage.enums.CraftTypeEnums; import com.yanzhu.manage.enums.SubDeptsEnums; import com.yanzhu.manage.enums.CraftPostEnums; +import com.yanzhu.manage.enums.UserPostEnums; import com.yanzhu.manage.mapper.ProProjectInfoSubdeptsMapper; import com.yanzhu.manage.mapper.ProProjectInfoSubdeptsUsersMapper; import com.yanzhu.manage.service.IProProjectInfoSubdeptsService; +import com.yanzhu.manage.service.IUniService; +import com.yanzhu.manage.utils.WxQrCodeUtils; import com.yanzhu.system.api.RemoteUserService; import com.yanzhu.system.api.domain.SysUser; import me.chanjar.weixin.mp.api.WxMpService; @@ -40,15 +43,15 @@ import java.util.Objects; @Service public class ProProjectInfoSubdeptsServiceImpl implements IProProjectInfoSubdeptsService { + @Autowired + private IUniService uniService; + @Autowired private WxMpService wxMpService; @Autowired private RedisService redisService; - @Autowired - private ProfileConfig profileConfig; - @Autowired private RemoteUserService remoteUserService; @@ -115,11 +118,7 @@ public class ProProjectInfoSubdeptsServiceImpl implements IProProjectInfoSubdept sysUser.setCardImgPos(proProjectInfoSubdepts.getLeaderCardImgPos()); sysUser.setCardImgInv(proProjectInfoSubdepts.getLeaderCardImgInv()); sysUser.setSex(StringUtils.judgeGender(proProjectInfoSubdepts.getSubDeptLeaderCode())); - if(Objects.equals(DataSourceEnuns.WEB.getCode(),proProjectInfoSubdepts.getDataSource())){ - sysUser.setCreateBy(SecurityUtils.getUsername()); - }else{ - sysUser.setCreateBy(DataSourceEnuns.APP.getInfo()); - } + sysUser.setCreateBy(SecurityUtils.getUsername()); sysUser.setCreateTime(DateUtils.getNowDate()); sysUser.setRemark(proProjectInfoSubdepts.getSubDeptName()); try { @@ -131,13 +130,8 @@ public class ProProjectInfoSubdeptsServiceImpl implements IProProjectInfoSubdept } } } - if(Objects.equals(DataSourceEnuns.WEB.getCode(),proProjectInfoSubdepts.getDataSource())){ - proProjectInfoSubdepts.setCreateBy(SecurityUtils.getUsername()); - proProjectInfoSubdepts.setApproveStatus(ApproveStatus.passed.getCode()); - }else{ - proProjectInfoSubdepts.setCreateBy(DataSourceEnuns.APP.getInfo()); - proProjectInfoSubdepts.setApproveStatus(ApproveStatus.await.getCode()); - } + proProjectInfoSubdepts.setCreateBy(SecurityUtils.getUsername()); + proProjectInfoSubdepts.setApproveStatus(ApproveStatus.passed.getCode()); proProjectInfoSubdepts.setCreateTime(DateUtils.getNowDate()); int res = proProjectInfoSubdeptsMapper.insertProProjectInfoSubdepts(proProjectInfoSubdepts); // 将人员信息同步至单位人员表 @@ -151,25 +145,108 @@ public class ProProjectInfoSubdeptsServiceImpl implements IProProjectInfoSubdept subdeptsUser.setSubDeptType(proProjectInfoSubdepts.getSubDeptType()); subdeptsUser.setSubDeptPowerPath(proProjectInfoSubdepts.getSubDeptLeaderPowerPath()); subdeptsUser.setUserId(proProjectInfoSubdepts.getSubDeptLeaderId()); + subdeptsUser.setUserPost(UserPostEnums.WTDL.getCode()); subdeptsUser.setCraftType(CraftTypeEnums.GLRY.getCode()); subdeptsUser.setCraftPost(CraftPostEnums.WTDL.getCode()); - subdeptsUser.setDegreeGrade(""); + subdeptsUser.setDegreeGrade(proProjectInfoSubdepts.getLeaderDegreeGrade()); + subdeptsUser.setEduStatus(ShiFouEnums.FOU.getCodeStr()); + subdeptsUser.setSubStep(1L); + subdeptsUser.setCreateBy(SecurityUtils.getUsername()); + subdeptsUser.setApproveStatus(ApproveStatus.passed.getCode()); + subdeptsUser.setCreateTime(DateUtils.getNowDate()); + int r = proProjectInfoSubdeptsUsersMapper.insertProProjectInfoSubdeptsUsers(subdeptsUser); + // 系统添加的人员默认增加入场信息 + uniService.syncUniUser(subdeptsUser.getUserId(),subdeptsUser.getProjectId()); + try { + if(r>0){ + String accessToken = wxMpService.getAccessToken(); + String filePath = DateUtils.datePath()+"/"+System.currentTimeMillis()+".png"; + String savePath = ProfileConfig.profilePath+"/"+filePath; + String profilePath = ProfileConfig.profile+"/"+filePath; + log.info("accessToken...{}",accessToken); + // 生成二维码 + WxQrCodeUtils.generateQrCode(savePath, "pages/project_qr/index", "SIGID=2&QRPID="+subdeptsUser.getProjectId()+"&PARID="+subdeptsUser.getId(), accessToken); + subdeptsUser.setQrCode(profilePath); + proProjectInfoSubdeptsUsersMapper.updateProProjectInfoSubdeptsUsers(subdeptsUser); + } + }catch (Exception e){ + log.error(e.getMessage()); + } + + } + return res; + } + + /** + * 新增分包单位 + * + * @param proProjectInfoSubdepts 分包单位 + * @return 结果 + */ + @Override + @Transactional + public ProProjectInfoSubdepts insertProProjectInfoSubdeptsWX(ProProjectInfoSubdepts proProjectInfoSubdepts) + { + ProProjectInfo info = redisService.getCacheObject(CacheConstants.PRO_PROJECT+proProjectInfoSubdepts.getProjectId()); + if(Objects.isNull(info)){ + throw new ServiceException("项目信息异常..."); + } + proProjectInfoSubdepts.setComId(info.getComId()); + if(Objects.equals(proProjectInfoSubdepts.getSubDeptType(), SubDeptsEnums.ZYFB.getCode()) || Objects.equals(proProjectInfoSubdepts.getSubDeptType(),SubDeptsEnums.LWFB.getCode())){ + // 单位委托人信息 + if(StringUtils.isNotEmpty(proProjectInfoSubdepts.getSubDeptLeaderName()) && StringUtils.isNotEmpty(proProjectInfoSubdepts.getSubDeptLeaderCode()) && StringUtils.isNotEmpty(proProjectInfoSubdepts.getSubDeptLeaderPhone())){ + SysUser sysUser = new SysUser(); + sysUser.setUserName(proProjectInfoSubdepts.getSubDeptLeaderPhone()); + sysUser.setNickName(proProjectInfoSubdepts.getSubDeptLeaderName()); + sysUser.setUserType(UserTypeEnums.FBDL.getCode()); + sysUser.setPhonenumber(proProjectInfoSubdepts.getSubDeptLeaderPhone()); + sysUser.setCardType(CardTypeEnums.SFZ.getCode()); + sysUser.setCardCode(proProjectInfoSubdepts.getSubDeptLeaderCode()); + sysUser.setUserPicture(proProjectInfoSubdepts.getLeaderUserPicture()); + sysUser.setCardImgPos(proProjectInfoSubdepts.getLeaderCardImgPos()); + sysUser.setCardImgInv(proProjectInfoSubdepts.getLeaderCardImgInv()); + sysUser.setSex(StringUtils.judgeGender(proProjectInfoSubdepts.getSubDeptLeaderCode())); + sysUser.setCreateBy(DataSourceEnuns.APP.getInfo()); + sysUser.setCreateTime(DateUtils.getNowDate()); + sysUser.setRemark(proProjectInfoSubdepts.getSubDeptName()); + try { + R userResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER); + proProjectInfoSubdepts.setSubDeptLeaderId(userResult.getData()); + }catch (Exception e){ + // 已注册账号!!忽略异常... + e.printStackTrace(); + } + } + } + proProjectInfoSubdepts.setCreateBy(DataSourceEnuns.APP.getInfo()); + proProjectInfoSubdepts.setApproveStatus(ApproveStatus.await.getCode()); + proProjectInfoSubdepts.setCreateTime(DateUtils.getNowDate()); + int res = proProjectInfoSubdeptsMapper.insertProProjectInfoSubdepts(proProjectInfoSubdepts); + // 将人员信息同步至单位人员表 + if(res>0 && (Objects.equals(proProjectInfoSubdepts.getSubDeptType(), SubDeptsEnums.ZYFB.getCode()) || Objects.equals(proProjectInfoSubdepts.getSubDeptType(),SubDeptsEnums.LWFB.getCode()))){ + // 保存单位人员信息 + ProProjectInfoSubdeptsUsers subdeptsUser = new ProProjectInfoSubdeptsUsers(); + subdeptsUser.setComId(info.getComId()); + subdeptsUser.setProjectId(info.getId()); + subdeptsUser.setSubDeptId(proProjectInfoSubdepts.getId()); + subdeptsUser.setSubDeptName(proProjectInfoSubdepts.getSubDeptName()); + subdeptsUser.setSubDeptType(proProjectInfoSubdepts.getSubDeptType()); + subdeptsUser.setSubDeptPowerPath(proProjectInfoSubdepts.getSubDeptLeaderPowerPath()); + subdeptsUser.setUserId(proProjectInfoSubdepts.getSubDeptLeaderId()); + subdeptsUser.setUserPost(UserPostEnums.WTDL.getCode()); + subdeptsUser.setCraftType(CraftTypeEnums.GLRY.getCode()); + subdeptsUser.setCraftPost(CraftPostEnums.WTDL.getCode()); + subdeptsUser.setDegreeGrade(proProjectInfoSubdepts.getLeaderDegreeGrade()); subdeptsUser.setEduStatus(ShiFouEnums.FOU.getCodeStr()); subdeptsUser.setApproveStatus(ApproveStatus.await.getCode()); if(Objects.isNull(subdeptsUser.getSubStep()) || subdeptsUser.getSubStep()<1){ subdeptsUser.setSubStep(1L); } - if(Objects.equals(DataSourceEnuns.WEB.getCode(),proProjectInfoSubdepts.getDataSource())){ - subdeptsUser.setCreateBy(SecurityUtils.getUsername()); - subdeptsUser.setApproveStatus(ApproveStatus.passed.getCode()); - }else{ - subdeptsUser.setCreateBy(DataSourceEnuns.APP.getInfo()); - subdeptsUser.setApproveStatus(ApproveStatus.await.getCode()); - } + subdeptsUser.setCreateBy(DataSourceEnuns.APP.getInfo()); subdeptsUser.setCreateTime(DateUtils.getNowDate()); proProjectInfoSubdeptsUsersMapper.insertProProjectInfoSubdeptsUsers(subdeptsUser); } - return res; + return proProjectInfoSubdepts; } /** @@ -200,29 +277,17 @@ public class ProProjectInfoSubdeptsServiceImpl implements IProProjectInfoSubdept sysUser.setCardImgPos(proProjectInfoSubdepts.getLeaderCardImgPos()); sysUser.setCardImgInv(proProjectInfoSubdepts.getLeaderCardImgInv()); sysUser.setSex(StringUtils.judgeGender(proProjectInfoSubdepts.getSubDeptLeaderCode())); - if(Objects.equals(DataSourceEnuns.WEB.getCode(),proProjectInfoSubdepts.getDataSource())){ - sysUser.setUpdateBy(SecurityUtils.getUsername()); - }else{ - sysUser.setUpdateBy(DataSourceEnuns.APP.getInfo()); - } + sysUser.setUpdateBy(SecurityUtils.getUsername()); sysUser.setUpdateTime(DateUtils.getNowDate()); sysUser.setRemark(proProjectInfoSubdepts.getSubDeptName()); try { - R userResult = remoteUserService.updateUserInfo(sysUser, SecurityConstants.INNER); - proProjectInfoSubdepts.setSubDeptLeaderId(userResult.getData()); + remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER); }catch (Exception e){ - // 已注册账号!!忽略异常... e.printStackTrace(); } - - // TODO:实名制接入 } } - if(Objects.equals(DataSourceEnuns.WEB.getCode(),proProjectInfoSubdepts.getDataSource())){ - proProjectInfoSubdepts.setUpdateBy(SecurityUtils.getUsername()); - }else{ - proProjectInfoSubdepts.setUpdateBy(DataSourceEnuns.APP.getInfo()); - } + proProjectInfoSubdepts.setUpdateBy(SecurityUtils.getUsername()); proProjectInfoSubdepts.setUpdateTime(DateUtils.getNowDate()); int res = proProjectInfoSubdeptsMapper.updateProProjectInfoSubdepts(proProjectInfoSubdepts); // 将人员信息同步至单位人员表 @@ -241,17 +306,15 @@ public class ProProjectInfoSubdeptsServiceImpl implements IProProjectInfoSubdept subdeptsUser.setUserId(proProjectInfoSubdepts.getSubDeptLeaderId()); subdeptsUser.setCraftType(CraftTypeEnums.GLRY.getCode()); subdeptsUser.setCraftPost(CraftPostEnums.WTDL.getCode()); - subdeptsUser.setDegreeGrade(""); + subdeptsUser.setDegreeGrade(proProjectInfoSubdepts.getLeaderDegreeGrade()); subdeptsUser.setEduStatus(ShiFouEnums.FOU.getCodeStr()); - subdeptsUser.setApproveStatus(ApproveStatus.await.getCode()); + if(Objects.isNull(subdeptsUser.getApproveStatus())){ + subdeptsUser.setApproveStatus(ApproveStatus.passed.getCode()); + } if(Objects.isNull(subdeptsUser.getSubStep()) || subdeptsUser.getSubStep()<1){ subdeptsUser.setSubStep(1L); } - if(Objects.equals(DataSourceEnuns.WEB.getCode(),proProjectInfoSubdepts.getDataSource())){ - subdeptsUser.setCreateBy(SecurityUtils.getUsername()); - }else{ - subdeptsUser.setCreateBy(DataSourceEnuns.APP.getInfo()); - } + subdeptsUser.setCreateBy(SecurityUtils.getUsername()); subdeptsUser.setCreateTime(DateUtils.getNowDate()); if(Objects.isNull(subdeptsUser.getId())){ proProjectInfoSubdeptsUsersMapper.insertProProjectInfoSubdeptsUsers(subdeptsUser); @@ -262,6 +325,86 @@ public class ProProjectInfoSubdeptsServiceImpl implements IProProjectInfoSubdept return res; } + /** + * 修改分包单位 + * + * @param proProjectInfoSubdepts 分包单位 + * @return 结果 + */ + @Override + @Transactional + public ProProjectInfoSubdepts updateProProjectInfoSubdeptsWX(ProProjectInfoSubdepts proProjectInfoSubdepts) + { + ProProjectInfo info = redisService.getCacheObject(CacheConstants.PRO_PROJECT+proProjectInfoSubdepts.getProjectId()); + if(Objects.isNull(info)){ + throw new ServiceException("项目信息异常..."); + } + if(Objects.equals(proProjectInfoSubdepts.getSubDeptType(), SubDeptsEnums.ZYFB.getCode()) || Objects.equals(proProjectInfoSubdepts.getSubDeptType(), SubDeptsEnums.LWFB.getCode())){ + // 单位委托人信息 + if(StringUtils.isNotEmpty(proProjectInfoSubdepts.getSubDeptLeaderName()) && StringUtils.isNotEmpty(proProjectInfoSubdepts.getSubDeptLeaderCode()) && StringUtils.isNotEmpty(proProjectInfoSubdepts.getSubDeptLeaderPhone())){ + SysUser sysUser = new SysUser(); + sysUser.setUserName(proProjectInfoSubdepts.getSubDeptLeaderPhone()); + sysUser.setNickName(proProjectInfoSubdepts.getSubDeptLeaderName()); + sysUser.setPhonenumber(proProjectInfoSubdepts.getSubDeptLeaderPhone()); + sysUser.setUserType(UserTypeEnums.FBDL.getCode()); + sysUser.setCardType(CardTypeEnums.SFZ.getCode()); + sysUser.setCardCode(proProjectInfoSubdepts.getSubDeptLeaderCode()); + sysUser.setUserPicture(proProjectInfoSubdepts.getLeaderUserPicture()); + sysUser.setCardImgPos(proProjectInfoSubdepts.getLeaderCardImgPos()); + sysUser.setCardImgInv(proProjectInfoSubdepts.getLeaderCardImgInv()); + sysUser.setSex(StringUtils.judgeGender(proProjectInfoSubdepts.getSubDeptLeaderCode())); + sysUser.setUpdateBy(DataSourceEnuns.APP.getInfo()); + sysUser.setUpdateTime(DateUtils.getNowDate()); + sysUser.setRemark(proProjectInfoSubdepts.getSubDeptName()); + try { + R userResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER); + proProjectInfoSubdepts.setSubDeptLeaderId(userResult.getData()); + }catch (Exception e){ + // 已注册账号!!忽略异常... + e.printStackTrace(); + } + } + } + + proProjectInfoSubdepts.setUpdateBy(DataSourceEnuns.APP.getInfo()); + proProjectInfoSubdepts.setUpdateTime(DateUtils.getNowDate()); + int res = proProjectInfoSubdeptsMapper.updateProProjectInfoSubdepts(proProjectInfoSubdepts); + // 将人员信息同步至单位人员表 + if(res>0 && (Objects.equals(proProjectInfoSubdepts.getSubDeptType(), SubDeptsEnums.ZYFB.getCode()) || Objects.equals(proProjectInfoSubdepts.getSubDeptType(),SubDeptsEnums.LWFB.getCode()))){ + // 保存单位人员信息 + ProProjectInfoSubdeptsUsers subdeptsUser = proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersByParamId(proProjectInfoSubdepts.getProjectId(),proProjectInfoSubdepts.getSubDeptLeaderId()); + if(Objects.isNull(subdeptsUser)){ + subdeptsUser = new ProProjectInfoSubdeptsUsers(); + subdeptsUser.setComId(info.getComId()); + subdeptsUser.setProjectId(info.getId()); + subdeptsUser.setSubDeptId(proProjectInfoSubdepts.getId()); + } + subdeptsUser.setSubDeptName(proProjectInfoSubdepts.getSubDeptName()); + subdeptsUser.setSubDeptType(proProjectInfoSubdepts.getSubDeptType()); + subdeptsUser.setSubDeptPowerPath(proProjectInfoSubdepts.getSubDeptLeaderPowerPath()); + subdeptsUser.setUserId(proProjectInfoSubdepts.getSubDeptLeaderId()); + subdeptsUser.setCraftType(UserPostEnums.WTDL.getCode()); + subdeptsUser.setCraftType(CraftTypeEnums.GLRY.getCode()); + subdeptsUser.setCraftPost(CraftPostEnums.WTDL.getCode()); + subdeptsUser.setDegreeGrade(proProjectInfoSubdepts.getLeaderDegreeGrade()); + subdeptsUser.setEduStatus(ShiFouEnums.FOU.getCodeStr()); + if(Objects.isNull(subdeptsUser.getApproveStatus())){ + subdeptsUser.setApproveStatus(ApproveStatus.await.getCode()); + } + if(Objects.isNull(subdeptsUser.getSubStep()) || subdeptsUser.getSubStep()<1){ + subdeptsUser.setSubStep(1L); + } + subdeptsUser.setCreateBy(DataSourceEnuns.APP.getInfo()); + subdeptsUser.setCreateTime(DateUtils.getNowDate()); + if(Objects.isNull(subdeptsUser.getId())){ + proProjectInfoSubdeptsUsersMapper.insertProProjectInfoSubdeptsUsers(subdeptsUser); + }else{ + proProjectInfoSubdeptsUsersMapper.updateProProjectInfoSubdeptsUsers(subdeptsUser); + } + } + return proProjectInfoSubdepts; + } + /** * 修改分包单位 * diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsUsersServiceImpl.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsUsersServiceImpl.java index 4687c8b1..aa30e01b 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsUsersServiceImpl.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsUsersServiceImpl.java @@ -1,35 +1,45 @@ package com.yanzhu.manage.service.impl; import com.alibaba.fastjson.JSON; +import com.deepoove.poi.data.PictureRenderData; import com.yanzhu.common.core.constant.SecurityConstants; -import com.yanzhu.common.core.context.SecurityContextHolder; import com.yanzhu.common.core.domain.R; -import com.yanzhu.common.core.enums.ApproveStatus; -import com.yanzhu.common.core.enums.ShiFouEnums; +import com.yanzhu.common.core.enums.*; import com.yanzhu.common.core.exception.ServiceException; import com.yanzhu.common.core.text.Convert; import com.yanzhu.common.core.utils.DateUtils; import com.yanzhu.common.core.utils.StringUtils; import com.yanzhu.common.core.web.domain.AjaxResult; import com.yanzhu.common.security.utils.DictUtils; +import com.yanzhu.common.security.utils.SecurityUtils; import com.yanzhu.manage.config.ProfileConfig; import com.yanzhu.manage.domain.BasTemplate; +import com.yanzhu.manage.domain.ProProjectInfoSubdeptsGroup; import com.yanzhu.manage.domain.ProProjectInfoSubdeptsUsers; import com.yanzhu.manage.domain.SignetFileVo; +import com.yanzhu.manage.enums.CraftTypeEnums; import com.yanzhu.manage.enums.SignetKeyEnums; +import com.yanzhu.manage.enums.UserPostEnums; import com.yanzhu.manage.mapper.BasTemplateMapper; +import com.yanzhu.manage.mapper.ProProjectInfoSubdeptsGroupMapper; import com.yanzhu.manage.mapper.ProProjectInfoSubdeptsUsersMapper; import com.yanzhu.manage.service.IProProjectInfoSubdeptsUsersService; import com.yanzhu.manage.service.IUniService; +import com.yanzhu.manage.utils.WxQrCodeUtils; import com.yanzhu.manage.utils.pdf.PoiUtil; import com.yanzhu.system.api.RemoteFlowService; import com.yanzhu.system.api.RemoteUserService; import com.yanzhu.system.api.domain.SysUser; +import me.chanjar.weixin.mp.api.WxMpService; import org.apache.commons.io.FileUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; import java.io.File; import java.util.*; @@ -46,6 +56,9 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu @Autowired private IUniService uniService; + @Autowired + private WxMpService wxMpService; + @Autowired private BasTemplateMapper basTemplateMapper; @@ -58,6 +71,11 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu @Autowired private ProProjectInfoSubdeptsUsersMapper proProjectInfoSubdeptsUsersMapper; + @Autowired + private ProProjectInfoSubdeptsGroupMapper proProjectInfoSubdeptsGroupMapper; + + private static final Logger log = LoggerFactory.getLogger(ProProjectInfoSubdeptsUsersServiceImpl.class); + /** * 查询分包单位工人 * @@ -91,19 +109,113 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu @Override public int insertProProjectInfoSubdeptsUsers(ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers) { - proProjectInfoSubdeptsUsers.setUseStatus("0"); + proProjectInfoSubdeptsUsers.setUseStatus(UseStateEnums.IN.getCode()); proProjectInfoSubdeptsUsers.setCreateTime(DateUtils.getNowDate()); - proProjectInfoSubdeptsUsers.setCreateBy(SecurityContextHolder.getUserName()); - SysUser user=proProjectInfoSubdeptsUsers.getUser(); - if(user.getUserId()==null||user.getUserId().intValue()==0){ - Long userId= remoteUserService.registerUserInfo(user, SecurityConstants.INNER).getData(); - user.setUserId(userId); - proProjectInfoSubdeptsUsers.setUserId(userId); - }else{ - remoteUserService.updateUserInfo(user,SecurityConstants.INNER).getData(); + proProjectInfoSubdeptsUsers.setCreateBy(SecurityUtils.getUsername()); + proProjectInfoSubdeptsUsers.setSubStep(1L); + proProjectInfoSubdeptsUsers.setApproveStatus(ApproveStatus.passed.getCode()); + SysUser user = proProjectInfoSubdeptsUsers.getUser(); + Long userId= remoteUserService.registerUserInfo(user, SecurityConstants.INNER).getData(); + proProjectInfoSubdeptsUsers.setUserId(userId); + uniService.syncUniUser(userId,proProjectInfoSubdeptsUsers.getProjectId()); + int res = proProjectInfoSubdeptsUsersMapper.insertProProjectInfoSubdeptsUsers(proProjectInfoSubdeptsUsers); + if(res>0 && Objects.nonNull(proProjectInfoSubdeptsUsers.getUserPost())){ + // 生成二维码 + try { + String accessToken = wxMpService.getAccessToken(); + String filePath = DateUtils.datePath()+"/"+System.currentTimeMillis()+".png"; + String savePath = ProfileConfig.profilePath+"/"+filePath; + String profilePath = ProfileConfig.profile+"/"+filePath; + log.info("accessToken...{}",accessToken); + // 生成二维码 + if(Objects.equals(proProjectInfoSubdeptsUsers.getUserPost(), UserPostEnums.XMJL.getCode())){ + WxQrCodeUtils.generateQrCode(savePath, "pages/project_qr/index", "SIGID=3&QRPID="+proProjectInfoSubdeptsUsers.getProjectId()+"&PARID="+proProjectInfoSubdeptsUsers.getId(), accessToken); + }else if(Objects.equals(proProjectInfoSubdeptsUsers.getUserPost(), UserPostEnums.BZZ.getCode())){ + WxQrCodeUtils.generateQrCode(savePath, "pages/project_qr/index", "SIGID=4&QRPID="+proProjectInfoSubdeptsUsers.getProjectId()+"&PARID="+proProjectInfoSubdeptsUsers.getId(), accessToken); + } + proProjectInfoSubdeptsUsers.setQrCode(profilePath); + proProjectInfoSubdeptsUsersMapper.updateProProjectInfoSubdeptsUsers(proProjectInfoSubdeptsUsers); + }catch (Exception e){ + log.error(e.getMessage()); + } } - uniService.syncUniUser(user.getUserId(),proProjectInfoSubdeptsUsers.getProjectId()); - return proProjectInfoSubdeptsUsersMapper.insertProProjectInfoSubdeptsUsers(proProjectInfoSubdeptsUsers); + return res; + } + + /** + * 新增分包单位工人 + * + * @param proProjectInfoSubdeptsUsers 分包单位工人 + * @return 结果 + */ + @Override + @Transactional + public ProProjectInfoSubdeptsUsers insertProProjectInfoSubdeptsUsersWX(ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers){ + ProProjectInfoSubdeptsUsers parUsers = proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersById(proProjectInfoSubdeptsUsers.getParId()); + if(Objects.isNull(parUsers)){ + throw new ServiceException("用户信息异常...请重新扫码"); + } + SysUser user = proProjectInfoSubdeptsUsers.getUser(); + + proProjectInfoSubdeptsUsers.setComId(parUsers.getComId()); + proProjectInfoSubdeptsUsers.setProjectId(parUsers.getProjectId()); + proProjectInfoSubdeptsUsers.setSubDeptId(parUsers.getSubDeptId()); + proProjectInfoSubdeptsUsers.setSubDeptName(parUsers.getSubDeptName()); + proProjectInfoSubdeptsUsers.setSubDeptType(parUsers.getSubDeptType()); + proProjectInfoSubdeptsUsers.setUseStatus(UseStateEnums.AW.getCode()); + proProjectInfoSubdeptsUsers.setCreateBy(DataSourceEnuns.APP.getInfo()); + proProjectInfoSubdeptsUsers.setCreateTime(DateUtils.getNowDate()); + proProjectInfoSubdeptsUsers.setSubStep(1L); + proProjectInfoSubdeptsUsers.setApproveStatus(ApproveStatus.await.getCode()); + // 班组信息处理 + if(Objects.nonNull(proProjectInfoSubdeptsUsers.getUserPost())){ + // 班组长新增班组 + if(Objects.equals(proProjectInfoSubdeptsUsers.getUserPost(), UserPostEnums.BZZ.getCode())){ + ProProjectInfoSubdeptsGroup query = new ProProjectInfoSubdeptsGroup(); + query.setProjectId(proProjectInfoSubdeptsUsers.getProjectId()); + query.setSubDeptId(proProjectInfoSubdeptsUsers.getSubDeptId()); + query.setCraftPost(proProjectInfoSubdeptsUsers.getCraftPost()); + List proSubdeptsGroupList = proProjectInfoSubdeptsGroupMapper.selectProProjectInfoSubdeptsGroupList(query); + ProProjectInfoSubdeptsGroup proSubdeptsGroup = new ProProjectInfoSubdeptsGroup(); + proSubdeptsGroup.setComId(proProjectInfoSubdeptsUsers.getComId()); + proSubdeptsGroup.setProjectId(proProjectInfoSubdeptsUsers.getProjectId()); + proSubdeptsGroup.setSubDeptId(proProjectInfoSubdeptsUsers.getSubDeptId()); + proSubdeptsGroup.setSubDeptName(proProjectInfoSubdeptsUsers.getSubDeptName()); + proSubdeptsGroup.setSubDeptType(proProjectInfoSubdeptsUsers.getSubDeptType()); + int count = proSubdeptsGroupList.size()+1; + String pre = Objects.equals(proProjectInfoSubdeptsUsers.getCraftType(), CraftTypeEnums.PYGZ.getCode())?"普通":"特殊"; + String craftPostName = DictUtils.getDictLabel("pro_craft_post",proProjectInfoSubdeptsUsers.getCraftPost()); + proSubdeptsGroup.setGroupName(pre+craftPostName+"班组"+count); + proSubdeptsGroup.setCraftType(proProjectInfoSubdeptsUsers.getCraftType()); + proSubdeptsGroup.setCraftPost(proProjectInfoSubdeptsUsers.getCraftPost()); + proSubdeptsGroup.setGroupLeaderName(user.getNickName()); + proSubdeptsGroup.setGroupLeaderCode(user.getCardCode()); + proSubdeptsGroup.setGroupLeaderPhone(user.getPhonenumber()); + proSubdeptsGroup.setUseStatus(UseStateEnums.AW.getCode()); + proSubdeptsGroup.setApproveStatus(ApproveStatus.await.getCode()); + proSubdeptsGroup.setCreateBy(DataSourceEnuns.APP.getInfo()); + proSubdeptsGroup.setCreateTime(DateUtils.getNowDate()); + proProjectInfoSubdeptsGroupMapper.insertProProjectInfoSubdeptsGroup(proSubdeptsGroup); + proProjectInfoSubdeptsUsers.setSubDeptGroup(proSubdeptsGroup.getId()); + proProjectInfoSubdeptsUsers.setSubDeptGroupName(proSubdeptsGroup.getGroupName()); + }else if(Objects.equals(proProjectInfoSubdeptsUsers.getUserPost(), UserPostEnums.LWGR.getCode())){ + // 劳务人员绑定班组信息 + proProjectInfoSubdeptsUsers.setSubDeptGroup(parUsers.getSubDeptGroup()); + proProjectInfoSubdeptsUsers.setSubDeptGroupName(parUsers.getSubDeptGroupName()); + } + } + // 完善人员信息... + user.setUserName(proProjectInfoSubdeptsUsers.getPhoneNumber()); + user.setPhonenumber(proProjectInfoSubdeptsUsers.getPhoneNumber()); + user.setUserType(UserTypeEnums.FBRY.getCode()); + user.setCardType(CardTypeEnums.SFZ.getCode()); + user.setSex(StringUtils.judgeGender(user.getCardCode())); + user.setCreateBy(DataSourceEnuns.APP.getInfo()); + user.setCreateTime(DateUtils.getNowDate()); + Long userId = remoteUserService.registerUserInfo(user, SecurityConstants.INNER).getData(); + proProjectInfoSubdeptsUsers.setUserId(userId); + proProjectInfoSubdeptsUsersMapper.insertProProjectInfoSubdeptsUsers(proProjectInfoSubdeptsUsers); + return proProjectInfoSubdeptsUsers; } /** @@ -115,21 +227,136 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu @Override public int updateProProjectInfoSubdeptsUsers(ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers) { + proProjectInfoSubdeptsUsers.setUpdateBy(SecurityUtils.getUsername()); proProjectInfoSubdeptsUsers.setUpdateTime(DateUtils.getNowDate()); - proProjectInfoSubdeptsUsers.setUpdateBy(SecurityContextHolder.getUserName()); - SysUser user=proProjectInfoSubdeptsUsers.getUser(); - if(user.getUserId()==null||user.getUserId().intValue()==0){ - Long userId= remoteUserService.registerUserInfo(user, SecurityConstants.INNER).getData(); - user.setUserId(userId); - proProjectInfoSubdeptsUsers.setUserId(userId); - }else{ - remoteUserService.updateUserInfo(user,SecurityConstants.INNER).getData(); - } - uniService.syncUniUser(user.getUserId(),proProjectInfoSubdeptsUsers.getProjectId()); + SysUser user = proProjectInfoSubdeptsUsers.getUser(); + Long userId = remoteUserService.registerUserInfo(user, SecurityConstants.INNER).getData(); + proProjectInfoSubdeptsUsers.setUserId(userId); + uniService.syncUniUser(userId,proProjectInfoSubdeptsUsers.getProjectId()); return proProjectInfoSubdeptsUsersMapper.updateProProjectInfoSubdeptsUsers(proProjectInfoSubdeptsUsers); } + /** + * 修改分包单位工人 + * + * @param proProjectInfoSubdeptsUsers 分包单位工人 + * @return 结果 + */ + @Override + @Transactional + public ProProjectInfoSubdeptsUsers updateProProjectInfoSubdeptsUsersWX(ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers) + { + ProProjectInfoSubdeptsUsers parUsers = proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersById(proProjectInfoSubdeptsUsers.getParId()); + if(Objects.isNull(parUsers)){ + throw new ServiceException("用户信息异常...请重新扫码"); + } + SysUser user = proProjectInfoSubdeptsUsers.getUser(); + proProjectInfoSubdeptsUsers.setComId(parUsers.getComId()); + proProjectInfoSubdeptsUsers.setProjectId(parUsers.getProjectId()); + proProjectInfoSubdeptsUsers.setSubDeptId(parUsers.getSubDeptId()); + proProjectInfoSubdeptsUsers.setSubDeptName(parUsers.getSubDeptName()); + proProjectInfoSubdeptsUsers.setSubDeptType(parUsers.getSubDeptType()); + proProjectInfoSubdeptsUsers.setUpdateBy(DataSourceEnuns.APP.getInfo()); + proProjectInfoSubdeptsUsers.setUpdateTime(DateUtils.getNowDate()); + if(Objects.isNull(proProjectInfoSubdeptsUsers.getSubStep()) || proProjectInfoSubdeptsUsers.getSubStep()<1){ + proProjectInfoSubdeptsUsers.setSubStep(1L); + } + if(Objects.isNull(proProjectInfoSubdeptsUsers.getApproveStatus())){ + proProjectInfoSubdeptsUsers.setApproveStatus(ApproveStatus.await.getCode()); + } + // 班组信息处理 + if(Objects.nonNull(proProjectInfoSubdeptsUsers.getUserPost())){ + // 班组长新增班组 + if(Objects.equals(proProjectInfoSubdeptsUsers.getUserPost(), UserPostEnums.BZZ.getCode())){ + ProProjectInfoSubdeptsGroup query = new ProProjectInfoSubdeptsGroup(); + query.setProjectId(proProjectInfoSubdeptsUsers.getProjectId()); + query.setSubDeptId(proProjectInfoSubdeptsUsers.getSubDeptId()); + query.setGroupLeaderPhone(user.getPhonenumber()); + List groupList = proProjectInfoSubdeptsGroupMapper.selectProProjectInfoSubdeptsGroupList(query); + if(StringUtils.isNotEmpty(groupList)){ + ProProjectInfoSubdeptsGroup proSubdeptsGroup = groupList.get(0); + // 判断班组信息是否更新 + if(!Objects.equals(proProjectInfoSubdeptsUsers.getCraftPost(),groupList.get(0).getCraftPost()) || !Objects.equals(proProjectInfoSubdeptsUsers.getSubDeptId(),groupList.get(0).getSubDeptId())){ + ProProjectInfoSubdeptsGroup groupQuery = new ProProjectInfoSubdeptsGroup(); + groupQuery.setProjectId(proProjectInfoSubdeptsUsers.getProjectId()); + groupQuery.setSubDeptId(proProjectInfoSubdeptsUsers.getSubDeptId()); + groupQuery.setCraftPost(proProjectInfoSubdeptsUsers.getCraftPost()); + List proSubdeptsGroupList = proProjectInfoSubdeptsGroupMapper.selectProProjectInfoSubdeptsGroupList(groupQuery); + proSubdeptsGroup.setSubDeptId(proProjectInfoSubdeptsUsers.getSubDeptId()); + proSubdeptsGroup.setSubDeptName(proProjectInfoSubdeptsUsers.getSubDeptName()); + proSubdeptsGroup.setSubDeptType(proProjectInfoSubdeptsUsers.getSubDeptType()); + int count = proSubdeptsGroupList.size()+1; + String pre = Objects.equals(proProjectInfoSubdeptsUsers.getCraftType(), CraftTypeEnums.PYGZ.getCode())?"普通":"特殊"; + String craftPostName = DictUtils.getDictLabel("pro_craft_post",proProjectInfoSubdeptsUsers.getCraftPost()); + proSubdeptsGroup.setGroupName(pre+craftPostName+"班组"+count); + proSubdeptsGroup.setCraftType(proProjectInfoSubdeptsUsers.getCraftType()); + proSubdeptsGroup.setCraftPost(proProjectInfoSubdeptsUsers.getCraftPost()); + proSubdeptsGroup.setGroupLeaderName(user.getNickName()); + proSubdeptsGroup.setGroupLeaderCode(user.getCardCode()); + proSubdeptsGroup.setGroupLeaderPhone(user.getPhonenumber()); + proSubdeptsGroup.setUpdateBy(DataSourceEnuns.APP.getInfo()); + proSubdeptsGroup.setUpdateTime(DateUtils.getNowDate()); + proProjectInfoSubdeptsGroupMapper.updateProProjectInfoSubdeptsGroup(proSubdeptsGroup); + proProjectInfoSubdeptsUsers.setSubDeptGroup(proSubdeptsGroup.getId()); + proProjectInfoSubdeptsUsers.setSubDeptGroupName(proSubdeptsGroup.getGroupName()); + }else{ + // 班组主要信息未变更时只修改班组长信息 + proSubdeptsGroup.setGroupLeaderName(user.getNickName()); + proSubdeptsGroup.setGroupLeaderCode(user.getCardCode()); + proSubdeptsGroup.setGroupLeaderPhone(user.getPhonenumber()); + proSubdeptsGroup.setUpdateBy(DataSourceEnuns.APP.getInfo()); + proSubdeptsGroup.setUpdateTime(DateUtils.getNowDate()); + proProjectInfoSubdeptsGroupMapper.updateProProjectInfoSubdeptsGroup(proSubdeptsGroup); + } + }else{ + ProProjectInfoSubdeptsGroup groupQuery = new ProProjectInfoSubdeptsGroup(); + groupQuery.setProjectId(proProjectInfoSubdeptsUsers.getProjectId()); + groupQuery.setSubDeptId(proProjectInfoSubdeptsUsers.getSubDeptId()); + groupQuery.setCraftPost(proProjectInfoSubdeptsUsers.getCraftPost()); + List proSubdeptsGroupList = proProjectInfoSubdeptsGroupMapper.selectProProjectInfoSubdeptsGroupList(groupQuery); + ProProjectInfoSubdeptsGroup proSubdeptsGroup = new ProProjectInfoSubdeptsGroup(); + proSubdeptsGroup.setComId(proProjectInfoSubdeptsUsers.getComId()); + proSubdeptsGroup.setProjectId(proProjectInfoSubdeptsUsers.getProjectId()); + proSubdeptsGroup.setSubDeptId(proProjectInfoSubdeptsUsers.getSubDeptId()); + proSubdeptsGroup.setSubDeptName(proProjectInfoSubdeptsUsers.getSubDeptName()); + proSubdeptsGroup.setSubDeptType(proProjectInfoSubdeptsUsers.getSubDeptType()); + int count = proSubdeptsGroupList.size()+1; + String pre = Objects.equals(proProjectInfoSubdeptsUsers.getCraftType(), CraftTypeEnums.PYGZ.getCode())?"普通":"特殊"; + String craftPostName = DictUtils.getDictLabel("pro_craft_post",proProjectInfoSubdeptsUsers.getCraftPost()); + proSubdeptsGroup.setGroupName(pre+craftPostName+"班组"+count); + proSubdeptsGroup.setCraftType(proProjectInfoSubdeptsUsers.getCraftType()); + proSubdeptsGroup.setCraftPost(proProjectInfoSubdeptsUsers.getCraftPost()); + proSubdeptsGroup.setGroupLeaderName(user.getNickName()); + proSubdeptsGroup.setGroupLeaderCode(user.getCardCode()); + proSubdeptsGroup.setGroupLeaderPhone(user.getPhonenumber()); + proSubdeptsGroup.setUseStatus(UseStateEnums.AW.getCode()); + proSubdeptsGroup.setApproveStatus(ApproveStatus.await.getCode()); + proSubdeptsGroup.setCreateBy(DataSourceEnuns.APP.getInfo()); + proSubdeptsGroup.setCreateTime(DateUtils.getNowDate()); + proProjectInfoSubdeptsGroupMapper.insertProProjectInfoSubdeptsGroup(proSubdeptsGroup); + proProjectInfoSubdeptsUsers.setSubDeptGroup(proSubdeptsGroup.getId()); + proProjectInfoSubdeptsUsers.setSubDeptGroupName(proSubdeptsGroup.getGroupName()); + } + }else if(Objects.equals(proProjectInfoSubdeptsUsers.getUserPost(), UserPostEnums.LWGR.getCode())){ + // 劳务人员绑定班组信息 + proProjectInfoSubdeptsUsers.setSubDeptGroup(parUsers.getSubDeptGroup()); + proProjectInfoSubdeptsUsers.setSubDeptGroupName(parUsers.getSubDeptGroupName()); + } + } + + // 完善人员信息 + user.setUserName(user.getPhonenumber()); + user.setUserType(UserTypeEnums.FBRY.getCode()); + user.setCardType(CardTypeEnums.SFZ.getCode()); + user.setSex(StringUtils.judgeGender(user.getCardCode())); + user.setUpdateBy(DataSourceEnuns.APP.getInfo()); + user.setUpdateTime(DateUtils.getNowDate()); + Long userId = remoteUserService.registerUserInfo(user, SecurityConstants.INNER).getData(); + proProjectInfoSubdeptsUsers.setUserId(userId); + proProjectInfoSubdeptsUsersMapper.updateProProjectInfoSubdeptsUsers(proProjectInfoSubdeptsUsers); + return proProjectInfoSubdeptsUsers; + } /** * 批量删除分包单位工人 @@ -183,7 +410,7 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu */ @Override @Transactional - public void submitUserSignets(SignetFileVo signetFileVo) { + public ProProjectInfoSubdeptsUsers submitUserSignets(SignetFileVo signetFileVo) { ProProjectInfoSubdeptsUsers query = new ProProjectInfoSubdeptsUsers(); query.setProjectId(signetFileVo.getProId()); query.setPhoneNumber(signetFileVo.getUserPhone()); @@ -199,12 +426,6 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu if(StringUtils.isEmpty(proSubdeptsUser.getUserPost())){ throw new ServiceException("用户信息异常..."); } - // 工作流配置查询 - List> procdefDatas = proProjectInfoSubdeptsUsersMapper.findActReProcdefDept(proSubdeptsUser.getProjectId(),proSubdeptsUser.getUserPost()); - if(StringUtils.isEmpty(procdefDatas)){ - throw new ServiceException("工作流配置异常...请联系管理员配置"); - } - String procDefId = Convert.toStr(procdefDatas.get(0).get("PROCDEF_ID_")); // 生成安全承诺教育书... BasTemplate querys = new BasTemplate(); @@ -226,13 +447,16 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu String fileName = UUID.randomUUID() + ".pdf"; String filePath = DateUtils.datePath(); // 生成的签署文件地址 - String saveWordFilePath = rootSavePath + filePath + fileName; - String saveEdusFilePath = ProfileConfig.profile + filePath + fileName; + String saveWordFilePath = rootSavePath + "/" +filePath + "/" + fileName; + String saveEdusFilePath = ProfileConfig.profile + "/" + filePath + "/" + fileName; // 生成文件夹 File dirFile = FileUtils.getFile(rootSavePath + filePath); if (!dirFile.exists()) { dirFile.mkdirs(); } + proSubdeptsUser.setSubStep(100L); + proSubdeptsUser.setEduSignPath(signetFileVo.getImgPath()); + proSubdeptsUser.setEduFilePath(saveEdusFilePath); // word文件转PDF文件 Map dataMap = getUserDataMap(proSubdeptsUser); try { @@ -240,23 +464,28 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu }catch (Exception e){ throw new ServiceException("承诺书生成失败...服务器异常!!!"); } - proSubdeptsUser.setSubStep(100L); - proSubdeptsUser.setEduSignPath(signetFileVo.getImgPath()); - proSubdeptsUser.setEduFilePath(saveEdusFilePath); - proSubdeptsUser.setApproveStatus(ApproveStatus.check.getCode()); + + // 判断是否需要审批... + if(Objects.nonNull(proSubdeptsUser.getApproveStatus()) && proSubdeptsUser.getApproveStatus()0){ + // 待审核时启动工作流审批 + if(res>0 && Objects.equals(proSubdeptsUser.getApproveStatus(),ApproveStatus.check.getCode())){ + // 工作流配置查询 + List> procdefDatas = proProjectInfoSubdeptsUsersMapper.findActReProcdefDept(proSubdeptsUser.getProjectId(),proSubdeptsUser.getUserPost()); + if(StringUtils.isEmpty(procdefDatas)){ + throw new ServiceException("工作流配置异常...请联系管理员配置"); + } + String procDefId = Convert.toStr(procdefDatas.get(0).get("PROCDEF_ID_")); // 启动工作流审批节点... Map variables = new HashMap<>(); variables.put("INITIATOR",proSubdeptsUser.getUserId()); variables.put("userName",proSubdeptsUser.getUser().getNickName()); variables.put("businessKey",proSubdeptsUser.getId()); - R result = remoteFlowService.startDefinitionByParams(procDefId,variables,SecurityConstants.INNER); - System.out.println("flowable.RESULT==>"+JSON.toJSONString(result)); - if(Objects.isNull(result) || Objects.isNull(result.getData()) || result.getData().isError()){ - throw new ServiceException("工作流启动失败...服务器异常!!!"); - } + remoteFlowService.startDefinitionByParams(procDefId,variables,SecurityConstants.INNER); } + return proSubdeptsUser; } /** @@ -269,10 +498,17 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu dataMap.put("fName",sysUser.getNickName()); dataMap.put("fSex",StringUtils.judgeGenderText(sysUser.getCardCode())); dataMap.put("fAge",StringUtils.getAgeFromIdCard(sysUser.getCardCode())); + dataMap.put("fCode",sysUser.getCardCode()); dataMap.put("fIllnessStatus",Objects.equals(ShiFouEnums.FOU.getCode(),proSubdeptsUser.getIllnessStatus())?"无":"有"); dataMap.put("fSupIllnessStatus",Objects.equals(ShiFouEnums.FOU.getCode(),proSubdeptsUser.getSupIllnessStatus())?"无":"有"); dataMap.put("fCraftPost", DictUtils.getDictLabel("pro_craft_post",proSubdeptsUser.getCraftPost())); - dataMap.put("fUserSign", SignetKeyEnums.USER_SIGN.getCode()); + dataMap.put("fDate", DateUtils.dateTimeNow("yyyy年MM月dd日")); + dataMap.put("fGroupName", proSubdeptsUser.getSubDeptGroupName()); + dataMap.put("fGrade", DictUtils.getDictLabel("educational_type",proSubdeptsUser.getDegreeGrade())); + String userPicturePath = proSubdeptsUser.getUser().getUserPicture().replaceAll(ProfileConfig.profile, ProfileConfig.profilePath); + dataMap.put("fUserPicture", userPicturePath+".min.jpg"); + String userSignPath = proSubdeptsUser.getEduSignPath().replaceAll(ProfileConfig.profile, ProfileConfig.profilePath); + dataMap.put("fUserSign", userSignPath+".sign.png.min.png"); dataMap.put("fGroupSign", SignetKeyEnums.GROUP_SIGN.getCode()); dataMap.put("fProjectSign", SignetKeyEnums.PROJECT_SIGN.getCode()); dataMap.put("fCompanySign", SignetKeyEnums.COMPANY_SIGN.getCode()); diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/UniServiceImpl.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/UniServiceImpl.java index e51c0803..0e186e78 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/UniServiceImpl.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/UniServiceImpl.java @@ -471,6 +471,7 @@ public class UniServiceImpl implements IUniService{ } return 0l; } + @Override public Long syncUniUser(Long userId, Long projectId) { SysUser user=remoteUserService.getSysUserInfo(userId, SecurityConstants.INNER).getData(); @@ -530,13 +531,12 @@ public class UniServiceImpl implements IUniService{ } user.setUserInfos(jo.toJSONString()); if(hasUpdate){ - Long ret= remoteUserService.updateUserInfo(user,SecurityConstants.INNER).getData(); + Long ret= remoteUserService.registerUserInfo(user,SecurityConstants.INNER).getData(); if(ret==null){ return 0l; } return ret.longValue(); } - return 0l; } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/pdf/MyTableRenderPolicy.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/pdf/MyTableRenderPolicy.java deleted file mode 100644 index 3a23074f..00000000 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/pdf/MyTableRenderPolicy.java +++ /dev/null @@ -1,304 +0,0 @@ -package com.yanzhu.manage.utils.pdf; - -import com.deepoove.poi.NiceXWPFDocument; -import com.deepoove.poi.XWPFTemplate; -import com.deepoove.poi.policy.AbstractRenderPolicy; -import com.deepoove.poi.template.ElementTemplate; -import com.deepoove.poi.template.run.RunTemplate; -import com.yanzhu.common.core.text.Convert; -import com.yanzhu.common.core.utils.StringUtils; -import org.apache.poi.xwpf.usermodel.*; -import org.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge; - -import java.util.ArrayList; -import java.util.List; - -/** - * //////////////////////////////////////////////////////////////////// - * // _ooOoo_ - * // o8888888o - * // 88" . "88 - * // (| ^_^ |) - * // O\ = /O - * // ____/`---'\____ - * // .' \\| |// `. - * // / \\||| : |||// \ - * // / _||||| -:- |||||- \ - * // | | \\\ - /// | | - * // | \_| ''\---/'' | | - * // \ .-\__ `-` ___/-. / - * // ___`. .' /--.--\ `. . ___ - * // ."" '< `.___\_<|>_/___.' >'"". - * // | | : `- \`.;`\ _ /`;.`/ - ` : | | - * // \ \ `-. \_ __\ /__ _/ .-` / / - * // ========`-.____`-.___\_____/___.-`____.-'======== - * // `=---=' - * // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * // 佛祖保佑 永无BUG 永不修改 - * //////////////////////////////////////////////////////////////////// - * - * @ClassName MyTableRenderPolicy - * @Description 自动以table渲染类 - * @Author JiangYuQi - * @DateTime 2021/6/8 16:50 - * @Version 1.0 - */ -public class MyTableRenderPolicy extends AbstractRenderPolicy { - - @Override - public void doRender(RunTemplate runTemplate, Object data, XWPFTemplate template) throws Exception { - NiceXWPFDocument doc = template.getXWPFDocument(); - List dataList = (List) data; - // 表格 - List tables = this.getTable(doc, runTemplate); //当前表格 - if (tables != null && tables.size() > 0) { - for (XWPFTable table : tables) { - Integer templateRowIndex = null; - List rows = table.getRows(); - int index = 0, lastTemplateCellIndex = 0; - //计算模板所在行索引 - for (XWPFTableRow row : rows) { - boolean isTemplateRow = false; - for (XWPFTableCell tableCell : row.getTableCells()) { - if (tableCell.getText().indexOf("%") > -1) { - isTemplateRow = true; - break; - } - } - if (isTemplateRow) { - templateRowIndex = index; - break; - } - index++; - } - if (StringUtils.isNull(templateRowIndex)) { - continue; - } - XWPFTableRow templateRow = table.getRow(templateRowIndex); //模板行 - index = 0; - //计算模板行最后模板参数列索引 - for (XWPFTableCell tableCell : templateRow.getTableCells()) { - index++; - if (tableCell.getText().indexOf("%") > -1) { - lastTemplateCellIndex = index; - } - } - lastTemplateCellIndex = lastTemplateCellIndex - 1; - Integer nowCellIndex = this.getNowCellIndex(templateRow.getTableCells(), runTemplate); - if (nowCellIndex != null) { - List verticallyList = new ArrayList<>(); - List horizontalList = new ArrayList<>(); - for (int i = 0; i < dataList.size(); i++) { - int nowRowsSize = table.getNumberOfRows(); //当前表格的行数 - int nowRowIndex = i + templateRowIndex + 1; - if (nowRowsSize - 1 < nowRowIndex) { - XWPFTableRow newCreateRow = table.createRow(); - CopyTableRow(newCreateRow, templateRow);// 复制模板行文本和样式到新行 - } - XWPFTableCell cell = table.getRow(nowRowIndex).getCell(nowCellIndex); - //赋值时候判断是否有合并,找出横纵项的合并参数 - String text = Convert.toStr(dataList.get(i)); - if (StringUtils.isNotEmpty(text) && (text.startsWith("Vertically:") || text.startsWith("Horizontal:"))) { - if (text.startsWith("Vertically:")) { - verticallyList.add(nowCellIndex + "-" + text.split(":")[1]); - } - if (text.startsWith("Horizontal:")) { - horizontalList.add(nowRowIndex + "-" + text.split(":")[1]); - } - } else { - setCellText(cell,text); - } - } - //纵向合并 - if (StringUtils.isNotNull(verticallyList) && verticallyList.size() > 0) { - verticallyList.forEach(vertically -> { - String[] params = vertically.split("-"); - mergeCellsVertically(table, Convert.toInt(params[0]), Convert.toInt(params[1]) + 1, Convert.toInt(params[2]) + 1); - }); - } - //横向合并 - if (StringUtils.isNotNull(horizontalList) && horizontalList.size() > 0) { - horizontalList.forEach(horizontal -> { - String[] params = horizontal.split("-"); - mergeCellsHorizontal(table, Convert.toInt(params[0]) , Convert.toInt(params[1]), Convert.toInt(params[2])); - }); - } - //当模板参数渲染完后删除模板行 - if (StringUtils.isNotNull(templateRowIndex) && lastTemplateCellIndex == nowCellIndex) { - table.removeRow(templateRowIndex); - } - } - } - } - } - - /** - * @description:填充单元格内容 - * @author: wangjunsheng - * @date: 2022/9/9 17:21 - * @param: cell - * @param: text - **/ - private void setCellText(XWPFTableCell cell, String text) { - if (text.indexOf("\n") != -1) { - XWPFRun run = cell.getParagraphs().get(0).createRun(); - String[] textArr = text.split("\n"); - for (int k = 0; k < textArr.length; k++) { - if (k == 0) { - run.setText(textArr[k].trim()); - } else { - run.addBreak(); - run.setText(textArr[k].trim()); - } - } - } else { - cell.setText(text); - } - } - - /** - * @Description: 跨行合并 - */ - public void mergeCellsVertically(XWPFTable table, int col, int fromRow, int toRow) { - for (int rowIndex = fromRow; rowIndex <= toRow; rowIndex++) { - XWPFTableCell cell = table.getRow(rowIndex).getCell(col); - if (rowIndex == fromRow) { - // 设置起始合并位置 - cell.getCTTc().addNewTcPr().addNewVMerge().setVal(STMerge.RESTART); - } else { - // 设置继续合并位置 - cell.getCTTc().addNewTcPr().addNewVMerge().setVal(STMerge.CONTINUE); - } - } - } - - /** - * @Description: 跨列合并 - */ - public void mergeCellsHorizontal(XWPFTable table, int row, int fromCell, int toCell) { - for (int cellIndex = fromCell; cellIndex <= toCell; cellIndex++) { - XWPFTableCell cell = table.getRow(row).getCell(cellIndex); - if (cellIndex == fromCell) { - // 设置起始合并位置 - cell.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.RESTART); - } else { - // 设置继续合并位置 - cell.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.CONTINUE); - } - } - } - - /** - * @Description: 获取当前标签所在列的索引 - * @Param: [eleTemplate] - * @return: int - * @Author: JiangYuQi - * @Date: 2019/8/8 17:42 - */ - private Integer getNowCellIndex(List templateCells, ElementTemplate eleTemplate) { - Integer nowCellIndex = null; - int index = 0; - for (XWPFTableCell cell : templateCells) { - if (cell.getText().contains(eleTemplate.getTagName())) { - nowCellIndex = index; - break; - } - index++; - } - return nowCellIndex; - } - - /** - * @Description: 获取当前标签所在的table - * @Param: [doc, eleTemplate] - * @return: org.apache.poi.xwpf.usermodel.XWPFTable - * @Author: JiangYuQi - * @Date: 2019/8/8 17:42 - */ - private List getTable(NiceXWPFDocument doc, ElementTemplate eleTemplate) { - List resultTables = new ArrayList(); - List tables = doc.getTables(); - for (XWPFTable t : tables) { - if (t.getText().contains(eleTemplate.getTagName())) { - resultTables.add(t); - } - } - return resultTables; - } - - /** - * 复制表格行XWPFTableRow格式 - * - * @param target 待修改格式的XWPFTableRow - * @param source 模板XWPFTableRow - */ - private void CopyTableRow(XWPFTableRow target, XWPFTableRow source) { - - // 复制样式 - target.getCtRow().setTrPr(source.getCtRow().getTrPr()); - // 复制单元格 - for (int i = 0; i < source.getTableCells().size(); i++) { - copyTableCell(target.getCell(i), source.getCell(i)); - } - } - - - /** - * 复制单元格XWPFTableCell格式 - * - * @param newTableCell 新创建的的单元格 - * @param templateTableCell 模板单元格 - * @author Juveniless - * @date 2017年11月27日 下午3:41:02 - */ - private void copyTableCell(XWPFTableCell newTableCell, XWPFTableCell templateTableCell) { - // 列属性 - newTableCell.getCTTc().setTcPr(templateTableCell.getCTTc().getTcPr()); - // 删除目标 targetCell 所有文本段落 - for (int pos = 0; pos < newTableCell.getParagraphs().size(); pos++) { - newTableCell.removeParagraph(pos); - } - // 添加新文本段落 - for (XWPFParagraph sp : templateTableCell.getParagraphs()) { - XWPFParagraph targetP = newTableCell.addParagraph(); - copyParagraph(targetP, sp); - if (templateTableCell.getText().indexOf("%") < 0) { - newTableCell.setText(templateTableCell.getText()); - } - } - } - - /** - * 复制文本段落XWPFParagraph格式 - * - * @param newParagraph 新创建的的段落 - * @param templateParagraph 模板段落 - * @author Juveniless - * @date 2017年11月27日 下午3:43:08 - */ - private void copyParagraph(XWPFParagraph newParagraph, XWPFParagraph templateParagraph) { - // 设置段落样式 - newParagraph.getCTP().setPPr(templateParagraph.getCTP().getPPr()); - // 添加Run标签 - for (int pos = 0; pos < newParagraph.getRuns().size(); pos++) { - newParagraph.removeRun(pos); - - } - for (XWPFRun s : templateParagraph.getRuns()) { - XWPFRun targetrun = newParagraph.createRun(); - CopyRun(targetrun, s); - } - } - - /** - * 复制文本节点run - * - * @param newRun 新创建的的文本节点 - * @param templateRun 模板文本节点 - * @author Juveniless - * @date 2017年11月27日 下午3:47:17 - */ - private void CopyRun(XWPFRun newRun, XWPFRun templateRun) { - newRun.getCTR().setRPr(templateRun.getCTR().getRPr()); - } -} diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/pdf/PoiUtil.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/pdf/PoiUtil.java index ea90bfb8..d5ecedae 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/pdf/PoiUtil.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/pdf/PoiUtil.java @@ -57,19 +57,18 @@ public class PoiUtil { * @Author: JiangYuQi * @Date: 2019/8/8 11:54 */ - public static void createWordByWordTemplate(String wordTemplateFilePath, String saveWordFilePath, Map dataMap) throws Exception { - - if (StringUtils.isNotEmpty(wordTemplateFilePath) && StringUtils.isNotEmpty(saveWordFilePath)&&saveWordFilePath.endsWith(".docx")) { + public static void createWordByWordTemplate(String wordTemplateFilePath, String saveWordFilePath, Map dataMap) throws Exception + { + if (StringUtils.isNotEmpty(wordTemplateFilePath) && StringUtils.isNotEmpty(saveWordFilePath) && saveWordFilePath.endsWith(".docx")) { try { dataMap = formatMap(dataMap); - Configure.ConfigureBuilder builder = Configure.newBuilder(); - builder.addPlugin('%', new MyTableRenderPolicy()); - //builder.addPlugin('&', new ShangWuBiaoTableRenderPolicy()); - XWPFTemplate template = XWPFTemplate.compile(wordTemplateFilePath, builder.build()).render(dataMap); - FileOutputStream out = FileUtils.openOutputStream(FileUtils.getFile(saveWordFilePath)); - template.write(out); - out.flush(); - out.close(); + XWPFTemplate template = XWPFTemplate.compile(wordTemplateFilePath); + // 填充数据 + template.render(dataMap); + // 输出生成的文档 + try (FileOutputStream out = new FileOutputStream(saveWordFilePath)) { + template.write(out); + } template.close(); } catch (IOException e) { e.printStackTrace(); diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/pdf/ShangWuBiaoTableRenderPolicy.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/pdf/ShangWuBiaoTableRenderPolicy.java deleted file mode 100644 index f7701936..00000000 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/pdf/ShangWuBiaoTableRenderPolicy.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.yanzhu.manage.utils.pdf; - -import com.deepoove.poi.policy.DynamicTableRenderPolicy; -import com.deepoove.poi.util.TableTools; -import com.yanzhu.common.core.utils.StringUtils; -import org.apache.poi.xwpf.usermodel.XWPFTable; -import org.apache.poi.xwpf.usermodel.XWPFTableCell; -import org.apache.poi.xwpf.usermodel.XWPFTableRow; - -import java.util.List; -import java.util.Map; - -/** - * //////////////////////////////////////////////////////////////////// - * // _ooOoo_ - * // o8888888o - * // 88" . "88 - * // (| ^_^ |) - * // O\ = /O - * // ____/`---'\____ - * // .' \\| |// `. - * // / \\||| : |||// \ - * // / _||||| -:- |||||- \ - * // | | \\\ - /// | | - * // | \_| ''\---/'' | | - * // \ .-\__ `-` ___/-. / - * // ___`. .' /--.--\ `. . ___ - * // ."" '< `.___\_<|>_/___.' >'"". - * // | | : `- \`.;`\ _ /`;.`/ - ` : | | - * // \ \ `-. \_ __\ /__ _/ .-` / / - * // ========`-.____`-.___\_____/___.-`____.-'======== - * // `=---=' - * // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * // 佛祖保佑 永无BUG 永不修改 - * //////////////////////////////////////////////////////////////////// - * - * @ClassName MyJiShuBiaoTableRenderPolicy - * @Description 技术标汇总表专用 - * @Author JiangYuQi - * @DateTime 2021/6/8 16:50 - * @Version 1.0 - */ -public class ShangWuBiaoTableRenderPolicy extends DynamicTableRenderPolicy { - - // 列数 - int cellNum = 8; - //行高 - int rowHeight = 100; - - float cellWidths[]={9f,3f,3f,3f,3f,3f,3f}; //列宽单位CM - - @Override - public void render(XWPFTable table, Object data) { - createTable2(table, data); - } - - private void createTable1(XWPFTable table, Object data) { - if (StringUtils.isNull(data)) { - return; - } - Map shangWuBiaoTableMap = (Map) data; - - table.removeRow(0); - /**************************创建表头-开始********************************/ - - TableTools.widthTable(table,cellWidths); - - XWPFTableRow titleNewRow = table.insertNewTableRow(0); - table.setCellMargins(5 ,2,5,2); - titleNewRow.setHeight(rowHeight); - for (int i = 0; i < cellNum; i++) { - XWPFTableCell cell = titleNewRow.createCell(); - cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); - - switch (i) { - case 0: - cell.setText("序号"); - break; - case 1: - cell.setText("供应商名称"); - break; - case 2: - cell.setText("最终报价"); - break; - case 3: - cell.setText("价格扣除"); - break; - case 4: - cell.setText("评审报价"); - break; - case 5: - cell.setText("最终报价基准"); - break; - case 6: - cell.setText("最终报价得分"); - break; - case 7: - cell.setText("报价总分"); - break; - } - - } - /**************************创建表头-结束********************************/ - - /**************************创建公司商务标行并赋值-开始********************************/ - if (StringUtils.isNotEmpty(shangWuBiaoTableMap)) { - - List> gongSiShangWuBiaoList = (List>) shangWuBiaoTableMap.get("gongSiShangWuBiaoList"); - if (StringUtils.isNotEmpty(gongSiShangWuBiaoList)) { - int rowIndex = 1; //行所以 - for (Map gongSiShangWuBiao : gongSiShangWuBiaoList) { - XWPFTableRow newRow = table.insertNewTableRow(rowIndex); - newRow.setHeight(rowHeight); - for (int i = 0; i < cellNum; i++) { - XWPFTableCell cell = newRow.addNewTableCell(); - cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); - - switch (i) { - case 0: - cell.setText(rowIndex + ""); - break; - case 1://公司名称 - cell.setText(toStirng(gongSiShangWuBiao.get("GSMC"))); - break; - case 2: //最终报价 - cell.setText(toStirng(gongSiShangWuBiao.get("ZZBJ"))+"元"); - break; - case 3: //价格扣除 - cell.setText(toStirng(gongSiShangWuBiao.get("JGKC"))); - break; - case 4: //评审报价 - cell.setText(toStirng(gongSiShangWuBiao.get("PSBJ"))+"元"); - break; - case 5: //最终报价基准 - break; - case 6: //最终报价得分 - cell.setText(toStirng(gongSiShangWuBiao.get("ZZBJDF"))); - break; - case 7: //报价总分 - cell.setText(toStirng(gongSiShangWuBiao.get("BJDF"))); - break; - } - } - rowIndex++; - } - //合并最终报价基准行 - TableTools.mergeCellsVertically(table, 5, 1, rowIndex - 1); - //最终报价基准赋值 - XWPFTableCell zzbjjzCell = table.getRow(1).getCell(5); - zzbjjzCell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); - zzbjjzCell.setText(toStirng(shangWuBiaoTableMap.get("ZZBJJZ"))+"元"); - } - } - /**************************创建公司商务标行并赋值-开始********************************/ - } - - private void createTable2(XWPFTable table, Object data) { - if (StringUtils.isNull(data)) { - return; - } - Map ZZBJJZMap = (Map) data; - - String ZZBJJZ = toStirng(ZZBJJZMap.get("ZZBJJZ")); - int GSSIZE = ZZBJJZMap.get("GSSIZE")==null?0:Integer.parseInt(toStirng(ZZBJJZMap.get("GSSIZE"))); - //合并最终报价基准行 - TableTools.mergeCellsVertically(table, 5, 1, GSSIZE+1); - - XWPFTableCell cell = table.getRow(2).getCell(5); - cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); - cell.setText(ZZBJJZ); - } - - /*** - * @param obj - * @return java.lang.String - * @exception - * @Author JiangYuQi - * @Description 转字符串 - * @Date 2022/6/15 16:27 - **/ - private String toStirng(Object obj) - { - if(obj!=null && "null".equals(obj)){ - return ""; - }else{ - return obj.toString(); - } - } - - -} diff --git a/yanzhu-modules/yanzhu-manage/src/main/resources/template.json b/yanzhu-modules/yanzhu-manage/src/main/resources/template.json index 31f8382e..ae166a37 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/resources/template.json +++ b/yanzhu-modules/yanzhu-manage/src/main/resources/template.json @@ -1,146 +1,19 @@ { "default": { - "heTongBianHao":"HT12345678910112", - "yiFangMingCheng":"张三丰", - "yiFangDaiMa": "61042719900625****", - "sflb":"身份证号", -"heTongShiChang":"12", -"ksn": "2023", -"ksy":"02", -"ksr": "13", -"jsn": "2024", -"jsy": "02", -"jsr": "14", -"youHuiBiLi":79, -"buChongTiaoKuan": "", -"jfgz":"[serviceKeyWord]", -"yfgz":"[userKeyWord]", -"jfqdsj": "[待甲方签订]", -"yfqdsj": "[待乙方签订]", -"lianXiDianHua": "181****8536", -"muQianJingYing":"", -"yinHangKaHao":"", -"kaiHuHang":"", -"kaiHuHangHangHao":"", -"daiXiaoFeiBiLi":"", -"sheBeiXingHao":"", -"sheBeiBianHao":"", -"sheBeiYaJin":"", -"yaJinPiaoHao":"", -"zhanDianXiangXiDiZhi":"", -"cnsKeyWord": "[cnsKeyWord]", -"cnsKeyDate": "[cnsKeyDate]", -"jfzg": "[JFZG]" - }, - "tzzht": { - "zhanDianBianHao": "6124211", - "yiFangMingCheng":"张三丰", - "yiFangXingBie":"男", - "yiFangDaiMa":"61042719900625****", - "chuShengRiQi":"1990-06-25", - "huKouSuoZaiDi": "陕西省彬县*********", - "zhuSuoDiZhi": "陕西省西安市三桥街道******", - "tongXunDiZhi": "陕西省西安市三桥街道******", - "yFLianXiDianHua": "18740352322", - "businessAddress": "陕西省西安市三桥街道******127号A座101", - "yFYouBian": "", - "shiMingCheng": "西安市", - "city":"西安", - "quXianMingCheng": "未央", - "xiangXiDiZhi": "陕西省西安市三桥街道******127号A座101", - "daiXiaoLeiXingMingCheng": "乐透数字型、即开型福利彩票", - "daiXiaoQiXian":1, - "ksn": "2023", - "ksy":"02", - "ksr": "13", - "jsn": "2024", - "jsy": "02", - "jsr": "14", - "sz":"[SZ]", - "jfgz":"[serviceKeyWord]", - "jfdbr":"[jfdbrKeyWord]", - "jfwtdlr":"[jfwtdlrKeyWord]", - "yfgz":"[userKeyWord]", - "yfyj": "[yfyjKeyWord]", - "jfqdsj": "[待甲方签订]", - "yfqdsj": "[待乙方签订]", - "cnsKeyWord": "[cnsKeyWord]", - "cnsKeyDate": "[cnsKeyDate]", - "LTSZDXF": "", - "JKYXDXF": "", - "JFWYJBFB": "", - "JFWYJZGBFB": "", - "JFZZWYJBFB": "", - "JFZZWYJZGBFB": "", - "YFWYJBFB": "", - "YFWYJZGBFB": "" - }, - "zsght": { - "heTongBianHao":"HT12345678910112", - "yiFangMingCheng":"张三丰", - "yiFangDaiMa": "61042719900625****", - "sflb":"身份证号", - "heTongShiChang":12, - "ksn": "2023", - "ksy":"02", - "ksr": "13", - "jsn": "2024", - "jsy": "02", - "jsr": "14", - "sheBeiYaJin":"1000", - "youHuiBiLi":91.5, - "jfgz":"[serviceKeyWord]", - "yfgz":"[userKeyWord]", - "jfqdsj": "[待甲方签订]", - "yfqdsj": "[待乙方签订]", - "lianXiDianHua":"181891385**", - "muQianJingYing":"", - "yinHangKaHao":"", - "kaiHuHang":"", - "zhanDianXiangXiDiZhi":"", - "kaiHuHangHangHao":"", - "daiXiaoFeiBiLi":"", - "cnsKeyWord": "[cnsKeyWord]", - "cnsKeyDate": "[cnsKeyDate]", - "sheBeiXingHao":"", - "sheBeiBianHao":"", - "yaJinPiaoHao":"", - "hangYeLeiXing":"", - "xiaoShouDiZhi":"" - }, - "bjzdht": { - "heTongBianHao":"HT12345678910112", - "yiFangMingCheng":"张三丰", - "yiFangDaiMa": "61042719900625****", - "sflb":"身份证号", - "heTongShiChang":12, - "ksn": "2023", - "ksy":"02", - "ksr": "13", - "jsn": "2024", - "jsy": "02", - "jsr": "14", - "sheBeiYaJin":"1000", - "youHuiBiLi":91.5, - "jfgz":"[serviceKeyWord]", - "yfgz":"[userKeyWord]", - "jfqdsj": "[待甲方签订]", - "yfqdsj": "[待乙方签订]", - "lianXiDianHua":"181891385**", - "muQianJingYing":"", - "yinHangKaHao":"", - "kaiHuHang":"", - "zhanDianXiangXiDiZhi":"", - "kaiHuHangHangHao":"", - "daiXiaoFeiBiLi":"", - "cnsKeyWord": "[cnsKeyWord]", - "cnsKeyDate": "[cnsKeyDate]", - "sheBeiXingHao":"", - "sheBeiBianHao":"", - "yaJinPiaoHao":"", - "hangYeLeiXing":"", - "xiaoShouDiZhi":"" + "fName": "张三丰", + "fSex": "男", + "fAge": "32", + "fCode": "61042719900625****", + "fIllnessStatus": "无", + "fSupIllnessStatus": "无", + "fCraftPost": "木工", + "fDate": "2025年01月01日", + "fGroupName": "普通木工班组1", + "fGrade": "高中", + "fUserPicture": "https://guangzhou.sxyanzhu.com/YZLJXM/profile/static/userPicture.jpg", + "fUserSign": "https://guangzhou.sxyanzhu.com/YZLJXM/profile/static/userSign.png", + "fGroupSign": "[GROUP-SIGN]", + "fProjectSign": "[PROJECT-SIGN]", + "fCompanySign": "[COMPANY-SIGN]" } -} - - +} \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/api/project.js b/yanzhu-ui-app/miniprogram/api/project.js index ac2de4c9..6a6cf0b1 100644 --- a/yanzhu-ui-app/miniprogram/api/project.js +++ b/yanzhu-ui-app/miniprogram/api/project.js @@ -3,7 +3,7 @@ import { } from '../utils/request' // 查询项目信息详细 -export function getProjectInfo(id) { +export function findProjectInfo(id) { return request({ url: '/manage/wxApi/findProject/' + id, method: 'get' @@ -33,4 +33,21 @@ export function findProSubDeptsUser(proId, phoneNumber) { url: '/manage/wxApi/findProSubDeptsUser?proId=' + proId + '&phoneNumber=' + phoneNumber, method: 'get' }) +} + +// 查询项目参建单位人员 +export function findProSubDeptsUserById(id) { + return request({ + url: '/manage/wxApi/findProSubDeptsUser/' + id, + method: 'get' + }) +} + +// 新增项目参建单位人员 +export function registerSubDeptsUsers(data) { + return request({ + url: '/manage/wxApi/registerSubDeptsUsers', + method: 'post', + data: data + }) } \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/api/publics.js b/yanzhu-ui-app/miniprogram/api/publics.js index ba00d996..ce8da2f7 100644 --- a/yanzhu-ui-app/miniprogram/api/publics.js +++ b/yanzhu-ui-app/miniprogram/api/publics.js @@ -1,5 +1,13 @@ import {request} from '../utils/request' +// 查询数据字典缓存 +export function findDictCache(key) { + return request({ + url: '/manage/wxApi/findDictCache/'+key, + method: 'get' + }) +} + // 获取用户详细信息 export function getUserInfo() { return request({ diff --git a/yanzhu-ui-app/miniprogram/app.js b/yanzhu-ui-app/miniprogram/app.js index e75f539e..2b94bd3b 100644 --- a/yanzhu-ui-app/miniprogram/app.js +++ b/yanzhu-ui-app/miniprogram/app.js @@ -52,11 +52,6 @@ App({ }) } this.autoUpdate(); - - //防卡死定时器 - setInterval(() => { - wx.hideLoading(); - }, 30000); /** * 初始化页面未登录时跳转到登录页 @@ -80,6 +75,15 @@ App({ }, + /** + * 安全加载 + */ + securityLoading(){ + setTimeout(() => { + wx.hideLoading(); + }, 60000); + }, + //页面弹窗 toast: function (msg, type) { wx.showToast({ diff --git a/yanzhu-ui-app/miniprogram/pages/project_qr/index.js b/yanzhu-ui-app/miniprogram/pages/project_qr/index.js index ce26ebea..c433f2eb 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_qr/index.js +++ b/yanzhu-ui-app/miniprogram/pages/project_qr/index.js @@ -10,10 +10,12 @@ import { getMaPhoneNumber, } from '../../api/login' import { - getProjectInfo, + findProjectInfo, registerSubDepts, + registerSubDeptsUsers, findProSubDeptsUser, - findProSubDeptsInfo + findProSubDeptsInfo, + findProSubDeptsUserById } from '../../api/project' import { findBusExamInfos, @@ -25,7 +27,11 @@ import { submitUserSignets } from '../../api/busEdu' import { - securityFileUpload + findDictCache +} from '../../api/publics' +import { + securityFileUpload, + securitySignFileUpload } from '../../utils/request' const app = getApp(); Page({ @@ -36,16 +42,21 @@ Page({ form: { subDeptType: null, craftType: null, - craftPost: '1', + craftPost: null, + user: {}, + leaderDegreeGrade: null, + degreeGrade: null }, + parForm: {}, limit: 1, maxDate: new Date(2088, 1, 1).getTime(), currentDate: new Date().getTime(), title: "", proId: null, - signType: null, + userPost: null, initProject: {}, userPhoneNumber: null, + userPostList: [], deptTypeList: [{ "id": "4", "text": "劳务分包" @@ -53,10 +64,9 @@ Page({ "id": "5", "text": "专业分包" }], - craftPostList: [{ - "id": "23", - "text": "项目经理" - }], + craftTypeList: [], + craftPostList: [], + craftPostAllOrginList: [], flowNodes: [{ "id": "1", "name": "信息登记", @@ -86,6 +96,7 @@ Page({ 'text': '测试222' }] }], + eduCationalType: [], showDetailsName: "", showDetailsPopup: false, mainActiveIndex: null, @@ -103,7 +114,7 @@ Page({ timeStr: '', isPapers: false, fileForm: {}, - signTime: 5, + signTime: 180, signTimer: null, signPath: '', youWuList: [{ @@ -122,32 +133,54 @@ Page({ */ onLoad(options) { console.log(options); - if (options && options.signType && options.QRPID) { + if (options && options.SIGID && options.QRPID) { + this.getDictCache(options.SIGID); //this.getMaOpenId(); - this.findProjectInfo(options.QRPID); + this.getProjectInfo(options.QRPID); + if (options.PARID) { + this.setData({ + "form.parId": options.PARID, + }); + this.getProSubDeptsUser(); + } let title = ""; - if (options.signType == '1') { - title = "参建单位信息注册"; - } else if (options.signType == '2' || options.signType == '3') { - this.setData({ - "form.subDeptId": options.KeyId, - "form.craftPost": options.signType == '2' ? '23' : null, + let _userPostList = []; + if (options.SIGID == '1') { + title = "参建单位信息登记"; + _userPostList.push({ + "id": "1", + "text": "委托代理人" }); - title = "参建单位管理人员信息注册"; - } else if (options.signType == '4') { - this.setData({ - "form.subDeptId": options.KeyId + } else if (options.SIGID == '2' || options.SIGID == '3') { + if (options.SIGID == '2') { + _userPostList.push({ + "id": "2", + "text": "项目经理" + }); + } else { + _userPostList.push({ + "id": "3", + "text": "班组长" + }); + } + title = "参建单位管理人员信息登记"; + } else if (options.SIGID == '4') { + title = "参建单位劳务人员信息登记"; + _userPost.push({ + "id": "4", + "text": "劳务人员" }); - title = "参建单位劳务人员信息注册"; } this.setData({ title, proId: options.QRPID, - signType: options.signType, + userPost: options.SIGID, + "form.userPost": options.SIGID, + userPostList: _userPostList, "form.projectId": options.QRPID, }); this.getPhoneNumber({ - 'data': '18189138536' + 'data': '18189138538' }); } else { app.toast("请求参数异常,请重新扫码..."); @@ -157,6 +190,54 @@ Page({ } }, + /** + * 获取字典缓存数据 + */ + getDictCache(signId) { + if (signId == '3') { + // 初始化工种类型 + findDictCache("pro_craft_type").then(res => { + if (res.code == 200) { + let craftTypeList = []; + res.data.forEach(item => { + if (item.dictValue != "3") { + craftTypeList.push({ + "id": item.dictValue, + "text": item.dictLabel + }); + } + }) + this.setData({ + craftTypeList + }); + } + }) + // 初始化工种岗位 + findDictCache("pro_craft_post").then(res => { + if (res.code == 200) { + this.setData({ + craftPostAllOrginList: res.data + }); + } + }) + } + // 初始化学历类型 + findDictCache("educational_type").then(res => { + if (res.code == 200) { + let eduCationalType = []; + res.data.forEach(item => { + eduCationalType.push({ + "id": item.dictValue, + "text": item.dictLabel + }); + }) + this.setData({ + eduCationalType + }); + } + }) + }, + /** * 授权登录 */ @@ -173,6 +254,19 @@ Page({ }) }, + /** + * 查询单位上级人员信息 + */ + getProSubDeptsUser() { + findProSubDeptsUserById(this.data.form.parId).then(res => { + if (res.code == 200) { + this.setData({ + parForm: res.data + }); + } + }); + }, + /** * 获取手机号码 * @param {*} e @@ -190,10 +284,13 @@ Page({ //let phoneNumber = res.data; let phoneNumber = e.data; //使用手机号码查询详情 - if (this.data.signType == "1") { + if (this.data.userPost == "1") { findProSubDeptsInfo(this.data.proId, phoneNumber).then(deptRes => { if (deptRes.code == 200 && deptRes.data) { deptRes.data.subDeptLeaderPhone = phoneNumber; + deptRes.data.leaderDegreeGrade = deptRes.data.proProjectInfoSubdeptsUsers.degreeGrade; + deptRes.data.eduFilePath = deptRes.data.proProjectInfoSubdeptsUsers.eduFilePath; + deptRes.data.subStep = deptRes.data.proProjectInfoSubdeptsUsers.subStep; if (deptRes.data.subDeptInfos) { let subDeptInfosJSON = JSON.parse(deptRes.data.subDeptInfos); deptRes.data.subDeptInfos = subDeptInfosJSON; @@ -224,7 +321,7 @@ Page({ this.setData({ form: deptRes.data, userPhoneNumber: phoneNumber, - active: deptRes.data.proProjectInfoSubdeptsUsers.subStep + active: deptRes.data.subStep }); if (deptRes.data.proProjectInfoSubdeptsUsers.subStep == 1) { this.initBusEduVideos(false); @@ -243,19 +340,44 @@ Page({ } else { findProSubDeptsUser(this.data.proId, phoneNumber).then(userRes => { if (userRes.code == 200 && userRes.data) { - if (userRes.data.subDeptInfos) { - let subDeptInfosJSON = JSON.parse(userRes.data.subDeptInfos); - userRes.data.subDeptInfos = subDeptInfosJSON; + if (userRes.data.user) { + if (userRes.data.user.userInfos) { + let userInfosJSON = JSON.parse(userRes.data.user.userInfos); + userRes.data.user.phonenumber = userInfosJSON.phoneNumber; + userRes.data.user.nativePlace = userInfosJSON.nativePlace; + userRes.data.user.address = userInfosJSON.address; + userRes.data.user.emergencyContact = userInfosJSON.emergencyContact; + userRes.data.user.contactPhone = userInfosJSON.contactPhone; + userRes.data.user.bankName = userInfosJSON.bankName; + userRes.data.user.bankOffice = userInfosJSON.bankOffice; + userRes.data.user.bankCardNo = userInfosJSON.bankCardNo; + } + if (userRes.data.user.cardImgPos) { + userRes.data.user.cardImgPos = (this.data.imgBase + userRes.data.user.cardImgPos).split(','); + } + if (userRes.data.user.cardImgInv) { + userRes.data.user.cardImgInv = (this.data.imgBase + userRes.data.user.cardImgInv).split(','); + } + if (userRes.data.user.userPicture) { + userRes.data.user.userPicture = (this.data.imgBase + userRes.data.user.userPicture).split(','); + } + if (userRes.data.subDeptPowerPath) { + userRes.data.subDeptPowerPath = (this.data.imgBase + userRes.data.subDeptPowerPath).split(','); + } } this.setData({ form: userRes.data, userPhoneNumber: phoneNumber, - "form.leaderCardImgPos": userRes.data.proProjectInfoSubdeptsUsers.user.cardImgPos, - "form.leaderCardImgInv": userRes.data.proProjectInfoSubdeptsUsers.user.cardImgInv, - "form.leaderUserPicture": userRes.data.proProjectInfoSubdeptsUsers.user.userPicture, "form.phoneNumber": phoneNumber, - active: userRes.data.proProjectInfoSubdeptsUsers.subStep + active: userRes.data.subStep }); + if (userRes.data.subStep == 1) { + this.initBusEduVideos(false); + } else if (userRes.data.subStep == 2) { + this.initBusEduQuestion(false); + } else if (userRes.data.subStep == 3) { + this.startSignFile(false); + } } else { this.setData({ userPhoneNumber: phoneNumber, @@ -370,7 +492,7 @@ Page({ startBusEduExamNode: function () { let videoSize = this.data.eduVideoItem.length; let currentVideo = this.data.videoIdx + 1; - if (this.data.form.proProjectInfoSubdeptsUsers.subStep > 1 || currentVideo >= videoSize) { + if (this.data.form.subStep > 1 || currentVideo >= videoSize) { this.initBusEduQuestion(true); } else { app.toast("请学习完所有视频后再进行考试。"); @@ -384,6 +506,7 @@ Page({ this.setData({ isPapers: false }) + this.initBusEduQuestion(false); }, /** @@ -392,7 +515,11 @@ Page({ initBusEduQuestion: function (skip) { this.setData({ active: skip ? (this.data.active + 1) : this.data.active - }) + }); + clearInterval(this.data.timer); + this.setData({ + time: 3600 + }); this.startCountdown(); // 页面加载时开始倒计时 findBusExamInfos(this.data.proId, this.data.userPhoneNumber).then(res => { if (res.code == 200) { @@ -514,22 +641,29 @@ Page({ startSignFile(skip) { let _fileForm = {}; let currDate = new Date().toLocaleString().substring(0, 10).split("/"); - if (this.data.signType == 1) { + if (this.data.userPost == 1) { _fileForm.fName = this.data.form.subDeptLeaderName; _fileForm.fCardId = this.data.form.subDeptLeaderCode; _fileForm.fSex = this.getGenderFromIdCard(this.data.form.subDeptLeaderCode); _fileForm.fPost = "委托人"; _fileForm.fDate = currDate[0] + "年" + currDate[1] + "月" + currDate[2] + "日"; } else { - // let fPost = ""; - // this.data.craftPostList.forEach(item =>{ - // if(item.id==this.data.form.) - // }) + _fileForm.fName = this.data.form.user.nickName; + _fileForm.fCardId = this.data.form.user.cardCode; + _fileForm.fSex = this.getGenderFromIdCard(this.data.form.user.cardCode); + this.data.craftPostAllOrginList.forEach(item => { + if (this.data.form.craftPost == item.dictValue) { + _fileForm.fPost = item.dictLabel; + } + }); + _fileForm.fDate = currDate[0] + "年" + currDate[1] + "月" + currDate[2] + "日"; } this.setData({ active: skip ? (this.data.active + 1) : this.data.active, - fileForm: _fileForm + fileForm: _fileForm, + signTime: 180 }) + clearInterval(this.data.signTimer); this.startSignCountdown(); }, @@ -570,7 +704,7 @@ Page({ */ sign(e) { let tempFilePath = e.detail - securityFileUpload(tempFilePath).then(res => { + securitySignFileUpload(tempFilePath).then(res => { if (res.code == 200) { this.setData({ signPath: res.data.url @@ -586,7 +720,7 @@ Page({ let { proId, signPath, - phoneNumber, + userPhoneNumber, illnessStatus, supIllnessStatus } = this.data; @@ -598,7 +732,11 @@ Page({ app.toast("请选择身体严重疾病情况!"); return false; } - if (proId && phoneNumber && imgPath) { + if (signPath == "") { + app.toast("请填入受教育人手写签名!"); + return false; + } + if (proId && userPhoneNumber && signPath) { let that = this; //弹出确认 wx.showModal({ @@ -623,25 +761,51 @@ Page({ let { proId, signPath, - phoneNumber, + userPhoneNumber, illnessStatus, supIllnessStatus } = this.data; let param = {}; param.proId = proId; - param.userPhone = phoneNumber; + param.userPhone = userPhoneNumber; param.imgPath = signPath; param.illnessStatus = illnessStatus; param.supIllnessStatus = supIllnessStatus; submitUserSignets(param).then(res => { if (res.code == 200) { this.setData({ - active: 100 + active: res.data.subStep, + "form.subStep": res.data.subStep, + "form.approveStatus": res.data.approveStatus, + "form.eduFilePath": res.data.eduFilePath }); } }); }, + /** + * 下载签名文件 + */ + downloadSignetFiles() { + let that = this; + wx.downloadFile({ + // 示例 url,并非真实存在 + url: config.baseUrl + '/file/NoSecurity/download?fileName=' + that.data.form.eduFilePath, + success: function (res) { + const filePath = res.tempFilePath + wx.openDocument({ + filePath: filePath, + success: function (res) { + console.log('打开文档成功') + }, + fail: function (res) { + console.log(res) + } + }) + } + }) + }, + /** * 根据身份证号获取性别 * @param {*} idCard @@ -672,8 +836,8 @@ Page({ /** * 授权登录 */ - findProjectInfo: function (proId) { - getProjectInfo(proId).then(res => { + getProjectInfo: function (proId) { + findProjectInfo(proId).then(res => { let list = []; list.push({ 'id': res.data.id, @@ -870,6 +1034,192 @@ Page({ }) }, + /** + * 负责人学历 + * @param {*} e + */ + onLeaderDegreeGrade(e) { + this.setData({ + "form.leaderDegreeGrade": e.detail.id + }) + }, + + /** + * 选中工种类型 + * @param {*} e + */ + onChageCraftType(e) { + //设置工种岗位 + let craftPostList = []; + console.log("this.data.craftPostAllOrginList",this.data.craftPostAllOrginList) + this.data.craftPostAllOrginList.forEach(item => { + if (item.remark == e.detail.id) { + craftPostList.push({ + "id": item.dictValue, + "text": item.dictLabel + }); + } + }) + this.setData({ + craftPostList, + "form.craftType": e.detail.id, + "form.craftPost": null + }) + }, + + /** + * 选中工种岗位 + * @param {*} e + */ + onChageCraftPost(e) { + this.setData({ + "form.craftPost": e.detail.id + }) + }, + + /** + * 个人身份证正面照 + * @param {*} options + */ + fileUploadCardImgPos(options) { + let file = options.detail; + this.setData({ + "form.user.cardImgPos": file + }); + }, + + /** + * 个人身份证反面照 + * @param {*} options + */ + fileUploadCardImgInv(options) { + let file = options.detail; + this.setData({ + "form.user.cardImgInv": file + }); + }, + + /** + * 个人半身近照 + * @param {*} options + */ + fileUploadUserPicture(options) { + let file = options.detail; + this.setData({ + "form.user.userPicture": file + }); + }, + + /** + * 单位委托书 + * @param {*} options + */ + fileUploadDeptPower(options) { + let file = options.detail; + this.setData({ + "form.subDeptPowerPath": file + }); + }, + + /** + * 输入个人姓名 + * @param {*} e + */ + inputUserName(e) { + this.setData({ + "form.user.nickName": e.detail.value + }) + }, + + /** + * 输入个人身份证号 + * @param {*} e + */ + inputUserCode(e) { + this.setData({ + "form.user.cardCode": e.detail.value + }) + }, + + /** + * 个人籍贯民族 + * @param {*} e + */ + inputOriginNative(e) { + this.setData({ + "form.user.nativePlace": e.detail.value + }) + }, + /** + * 个人籍贯地址 + * @param {*} e + */ + inputOriginAddress(e) { + this.setData({ + "form.user.address": e.detail.value + }) + }, + + /** + * 紧急联系人 + * @param {*} e + */ + inputUrgentUser(e) { + this.setData({ + "form.user.emergencyContact": e.detail.value + }) + }, + + /** + * 紧急联系人电话 + * @param {*} e + */ + inputUrgentUserPhone(e) { + this.setData({ + "form.user.contactPhone": e.detail.value + }) + }, + + /** + * 个人文化程度 + * @param {*} e + */ + onDegreeGrade(e) { + this.setData({ + "form.degreeGrade": e.detail.id + }) + }, + + /** + * 开户行名称 + * @param {*} e + */ + inputBankName(e) { + this.setData({ + "form.user.bankName": e.detail.value + }) + }, + + /** + * 开户行网点 + * @param {*} e + */ + inputBankOffice(e) { + this.setData({ + "form.user.bankOffice": e.detail.value + }) + }, + + /** + * 开户行卡号 + * @param {*} e + */ + inputBankCardNo(e) { + this.setData({ + "form.user.bankCardNo": e.detail.value + }) + }, + /** * 委托代理提交参建单位信息 */ @@ -918,6 +1268,10 @@ Page({ app.toast("请填写合同约定的承包范围!"); return false; } + if (!form.startWorkDates) { + app.toast("请选择进入场地时间!"); + return false; + } if (!form.startWorkDates) { app.toast("请选择计划开工时间!"); return false; @@ -954,11 +1308,15 @@ Page({ app.toast("请填写委托人联系电话!"); return false; } + if (!form.leaderDegreeGrade) { + app.toast("请选择委托人学历信息!"); + return false; + } let that = this; //弹出确认 wx.showModal({ title: '提示', - content: '是否确认保存参建单位信息?', + content: '是否确认保存参建单位信息登记?', success: function (sm) { if (sm.confirm) { that.submitSubDeptForm(); @@ -971,15 +1329,17 @@ Page({ * 委托代理提交参建单位表单 */ submitSubDeptForm() { - let { - form - } = this.data; - let subDeptInfos = form.subDeptInfos; + let _form = { + ...this.data.form + }; + let subDeptInfos = { + ..._form.subDeptInfos + }; let uploadFiles = []; - if (form.businessLicensePath && form.businessLicensePath.length > 0) { + if (_form.businessLicensePath && _form.businessLicensePath.length > 0) { uploadFiles.push({ type: 'businessLicensePath', - path: form.businessLicensePath[0] + path: _form.businessLicensePath[0] }); } if (subDeptInfos.legalPersonCardImgPos && subDeptInfos.legalPersonCardImgPos.length > 0) { @@ -994,82 +1354,79 @@ Page({ path: subDeptInfos.legalPersonCardImgInv[0] }); } - if (form.leaderCardImgPos && form.leaderCardImgPos.length > 0) { + if (_form.leaderCardImgPos && _form.leaderCardImgPos.length > 0) { uploadFiles.push({ type: 'leaderCardImgPos', - path: form.leaderCardImgPos[0] + path: _form.leaderCardImgPos[0] }); } - if (form.leaderCardImgInv && form.leaderCardImgInv.length > 0) { + if (_form.leaderCardImgInv && _form.leaderCardImgInv.length > 0) { uploadFiles.push({ type: 'leaderCardImgInv', - path: form.leaderCardImgInv[0] + path: _form.leaderCardImgInv[0] }); } - if (form.leaderUserPicture && form.leaderUserPicture.length > 0) { + if (_form.leaderUserPicture && _form.leaderUserPicture.length > 0) { uploadFiles.push({ type: 'leaderUserPicture', - path: form.leaderUserPicture[0] + path: _form.leaderUserPicture[0] }); } - if (form.subDeptLeaderPowerPath && form.subDeptLeaderPowerPath.length > 0) { + if (_form.subDeptLeaderPowerPath && _form.subDeptLeaderPowerPath.length > 0) { uploadFiles.push({ type: 'subDeptLeaderPowerPath', - path: form.subDeptLeaderPowerPath[0] + path: _form.subDeptLeaderPowerPath[0] }); } - uploadFiles.forEach(async (item, idx) => { + let that = this; + let uploads = []; + uploadFiles.forEach(async (item) => { let obj; if (item.path.indexOf(this.data.imgBase) > -1) { obj = { data: { - url: item.path.replace(this.data.imgBase, "") + data: { + url: item.path.replace(this.data.imgBase, "") + } } } } else { //这里复杂的图片上传,改为同步上传,因为小程序只能上传一张图片 - obj = await securityFileUpload(item.path); + obj = await that.syncUploadImage(item.path); } if (item.type == "businessLicensePath") { - this.setData({ - "form.businessLicensePath": obj.data.url - }) + _form.businessLicensePath = obj.data.data.url; } if (item.type == "legalPersonCardImgPos") { - subDeptInfos.legalPersonCardImgPos = obj.data.url; + subDeptInfos.legalPersonCardImgPos = obj.data.data.url; } if (item.type == "legalPersonCardImgInv") { - subDeptInfos.legalPersonCardImgInv = obj.data.url; + subDeptInfos.legalPersonCardImgInv = obj.data.data.url; } if (item.type == "leaderCardImgPos") { - this.setData({ - "form.leaderCardImgPos": obj.data.url - }) + _form.leaderCardImgPos = obj.data.data.url; } if (item.type == "leaderCardImgInv") { - this.setData({ - "form.leaderCardImgInv": obj.data.url - }) + _form.leaderCardImgInv = obj.data.data.url; } if (item.type == "leaderUserPicture") { - this.setData({ - "form.leaderUserPicture": obj.data.url - }) + _form.leaderUserPicture = obj.data.data.url; } if (item.type == "subDeptLeaderPowerPath") { - this.setData({ - "form.subDeptLeaderPowerPath": obj.data.url - }) + _form.subDeptLeaderPowerPath = obj.data.data.url; } + uploads.push(obj.data.data.url); //验证图片上传完毕 - if ((idx + 1) == uploadFiles.length) { - this.setData({ - "form.subDeptInfos": JSON.stringify(subDeptInfos) - }) - registerSubDepts(form).then(res => { + if (uploads.length == uploadFiles.length) { + _form.subDeptInfos = JSON.stringify(subDeptInfos); + registerSubDepts(_form).then(res => { if (res.code == 200) { + this.setData({ + "form.id": res.data.id, + "form.subStep": res.data.subStep + }); //跳转视频页面... - this.initBusEduVideos(true); + that.initBusEduVideos(true); } }); } @@ -1082,57 +1439,187 @@ Page({ submitSubUserValues() { let { form, - signType + userPost } = this.data; + debugger //数据效验 - if (signType != '4') { + if (userPost == '3') { + if (!form.craftType) { + app.toast("请选择工种类型!"); + return false; + } if (!form.craftPost) { - app.toast("请选择岗位类型!"); + app.toast("请选择工种岗位!"); return false; } } - if (!form.leaderCardImgPos && form.leaderCardImgPos.length > 0) { - app.toast("请上传委托人身份证正面照!"); + if (!form.user.cardImgPos || form.user.cardImgPos.length == 0) { + app.toast("请上传身份证正面照!"); return false; } - if (!form.leaderCardImgInv && form.leaderCardImgInv.length > 0) { - app.toast("请上传委托人身份证反面照!"); + if (!form.user.cardImgInv || form.user.cardImgInv.length == 0) { + app.toast("请上传身份证反面照!"); return false; } - if (!form.leaderUserPicture && form.leaderUserPicture.length > 0) { - app.toast("请上传委托人半身近照!"); + if (!form.user.userPicture || form.user.userPicture.length == 0) { + app.toast("请上传进场半身近照!"); return false; } - if (!form.subDeptLeaderPowerPath && form.subDeptLeaderPowerPath.length > 0) { + if (!form.subDeptPowerPath || form.subDeptPowerPath.length == 0) { app.toast("请上传委托人单位委托书!"); return false; } - if (!form.subDeptLeaderName) { - app.toast("请填写委托人姓名!"); + if (!form.user.nickName) { + app.toast("请填写姓名!"); return false; } - if (!form.subDeptLeaderCode) { - app.toast("请填写委托人身份证号!"); + if (!form.user.cardCode) { + app.toast("请填写身份证号!"); return false; } - if (!form.subDeptLeaderPhone) { - app.toast("请填写委托人联系电话!"); + if (!form.phoneNumber) { + app.toast("请填写联系电话!"); return false; } + if (!form.user.nativePlace) { + app.toast("请填写籍贯民族!"); + return false; + } + if (!form.user.address) { + app.toast("请填写籍贯地址!"); + return false; + } + if (!form.user.emergencyContact) { + app.toast("请填写紧急联系人!"); + return false; + } + if (!form.user.contactPhone) { + app.toast("请填写紧急联系人电话!"); + return false; + } + if (!form.degreeGrade) { + app.toast("请选择文化程度!"); + return false; + } + if (userPost == '4') { + if (!form.user.bankName) { + app.toast("请填写开户银行名称!"); + return false; + } + if (!form.user.bankOffice) { + app.toast("请填写开户银行网点!"); + return false; + } + if (!form.bankCardNo) { + app.toast("请填写工资银行卡号!"); + return false; + } + } let that = this; //弹出确认 wx.showModal({ title: '提示', - content: '是否确认提交参建单位信息?', + content: '是否确认保存单位人员信息登记?', success: function (sm) { if (sm.confirm) { - that.submitSubDeptForm(); + that.submitSubUserForm(); } } }) }, + /** + * 单位人员信息登记 + */ + submitSubUserForm() { + let _form = { + ...this.data.form + }; + let userModel = { + ..._form.user + }; + let uploadFiles = []; + if (userModel.cardImgPos && userModel.cardImgPos.length > 0) { + uploadFiles.push({ + type: 'cardImgPos', + path: userModel.cardImgPos[0] + }); + } + if (userModel.cardImgInv && userModel.cardImgInv.length > 0) { + uploadFiles.push({ + type: 'cardImgInv', + path: userModel.cardImgInv[0] + }); + } + if (userModel.userPicture && userModel.userPicture.length > 0) { + uploadFiles.push({ + type: 'userPicture', + path: userModel.userPicture[0] + }); + } + if (_form.subDeptPowerPath && _form.subDeptPowerPath.length > 0) { + uploadFiles.push({ + type: 'subDeptPowerPath', + path: _form.subDeptPowerPath[0] + }); + } + let that = this; + let uploads = []; + uploadFiles.forEach(async (item, idx) => { + let obj; + if (item.path.indexOf(this.data.imgBase) > -1) { + obj = { + data: { + data: { + url: item.path.replace(this.data.imgBase, "") + } + } + } + } else { + //这里复杂的图片上传,改为同步上传,因为小程序只能上传一张图片 + obj = await that.syncUploadImage(item.path); + } + if (item.type == "cardImgPos") { + userModel.cardImgPos = obj.data.data.url; + } + if (item.type == "cardImgInv") { + userModel.cardImgInv = obj.data.data.url; + } + if (item.type == "userPicture") { + userModel.userPicture = obj.data.data.url; + } + if (item.type == "subDeptPowerPath") { + _form.subDeptPowerPath = obj.data.data.url; + } + uploads.push(obj.data.data.url); + //验证图片上传完毕 + if (uploads.length == uploadFiles.length) { + let userInfos = {}; + userInfos.phonenumber = _form.phoneNumber; + userInfos.nativePlace = userModel.nativePlace; + userInfos.address = userModel.address; + userInfos.emergencyContact = userModel.emergencyContact; + userInfos.contactPhone = userModel.contactPhone; + userInfos.bankName = userModel.bankName; + userInfos.bankOffice = userModel.bankOffice; + userInfos.bankCardNo = userModel.bankCardNo; + userModel.userInfos = JSON.stringify(userInfos); + _form.user = userModel; + registerSubDeptsUsers(_form).then(res => { + if (res.code == 200) { + this.setData({ + "form.id": res.data.id, + "form.subStep": res.data.subStep + }); + //跳转视频页面... + this.initBusEduVideos(true); + } + }); + } + }); + }, + /** * 委托人半身照 * @param {*} options @@ -1214,12 +1701,11 @@ Page({ */ onClickPreviousNode() { if (this.data.active == 2) { - this.initBusEduVideos(true); - } else { - this.setData({ - active: this.data.active - 1 - }) + this.initBusEduVideos(false); } + this.setData({ + active: this.data.active - 1 + }) }, /** @@ -1289,6 +1775,40 @@ Page({ }); }, + /** + * 这里考虑上传图片异步问题,封装为同步 + */ + syncUploadImage(file) { + return new Promise((resolve, reject) => { + wx.uploadFile({ + url: config.baseUrl + "/file/NoSecurity/upload", // 上传的服务器接口地址 + filePath: file, + header: { + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" + }, + name: "file", //上传的所需字段,后端提供 + formData: {}, + success: (res) => { + // 上传完成操作 + const data = JSON.parse(res.data) + resolve({ + data: data + }) + }, + fail: (err) => { + //上传失败:修改pedding为reject + console.log("访问接口失败", err); + wx.showToast({ + title: "网络出错,上传失败", + icon: 'none', + duration: 1000 + }); + reject(err) + } + }); + }) + }, + /** * 生命周期函数--监听页面卸载 */ diff --git a/yanzhu-ui-app/miniprogram/pages/project_qr/index.wxml b/yanzhu-ui-app/miniprogram/pages/project_qr/index.wxml index 37a8cd41..3cf2e28e 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_qr/index.wxml +++ b/yanzhu-ui-app/miniprogram/pages/project_qr/index.wxml @@ -17,7 +17,7 @@ - + {{title}} @@ -92,7 +92,7 @@ 进入场地时间 - + @@ -159,15 +159,21 @@ + + 代理人文化程度 + + + + - 下 一 步 + 信 息 登 记 - + {{title}} @@ -180,13 +186,13 @@ 单位名称 - + - 岗位类型 + 岗位级别 - + @@ -195,14 +201,14 @@ 个人身份证正面 - + 个人身份证反面 - + @@ -212,7 +218,7 @@ [进场扫脸,请上传清晰照片] - + @@ -220,66 +226,65 @@ [需加盖劳务单位的公章委托书照片] - + 项目经理姓名 - + 项目经理身份证号 - + 项目经理联系电话 - + + + + + 籍贯民族 + + 籍贯地址 - - - - - 详细地址 - -