diff --git a/docsql/yz-views.sql b/docsql/yz-views.sql new file mode 100644 index 00000000..0d0dadbe --- /dev/null +++ b/docsql/yz-views.sql @@ -0,0 +1,246 @@ +##全部,根据finishTime判断代办,已办 +DROP view vw_flow_all; +CREATE VIEW vw_flow_all AS ( + SELECT + RES.ID_ AS procInsId, + DEF.DEPLOYMENT_ID_ AS deployId, + RES.START_TIME_ AS createTime, + RES.END_TIME_ AS finishTime, + CASE + WHEN RES.END_TIME_ IS NULL THEN + TIMESTAMPDIFF( + MINUTE, + RES.START_TIME_, + DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S') + ) + ELSE + TIMESTAMPDIFF( + MINUTE, + RES.START_TIME_, + RES.END_TIME_ + ) + END AS duration, + DEF.NAME_ AS procDefName, + DEF.VERSION_ AS procDefVersion, + DEF.CATEGORY_ AS category, + DEF.KEY_ AS procDefKey, + v1.TEXT_ AS startUserId, + v2.TEXT_ AS startUserName, + v3.TEXT_ AS startDeptName, + v4.TEXT_ AS startComId, + v5.TEXT_ AS startComName, + v6.TEXT_ AS startProId, + v7.TEXT_ AS startProName, + v8.TEXT_ AS businessKey, + RES.PROC_INST_ID_, + IFNULL(hr.ID_,ht.taskId) as taskId, + IFNULL(hr.NAME_,ht.taskName) as taskName, + IF(hr.ID_ IS NULL, ht.assigneeId, tu.user_id) as assigneeId, + IF(hr.ID_ IS NULL, ht.assigneeName, tu.nick_name) as assigneeName, + IF(hr.ID_ IS NULL, ht.assigneeDeptName, td.dept_name) as assigneeDeptName, + IF(hr.ID_ IS NULL, ht.taskComType, 0) as taskComType +FROM + ACT_HI_PROCINST RES +LEFT JOIN ACT_RE_PROCDEF DEF ON RES.PROC_DEF_ID_ = DEF.ID_ +LEFT JOIN act_hi_varinst v1 ON v1.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v1.NAME_ = 'INITIATOR' +LEFT JOIN act_hi_varinst v2 ON v2.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v2.NAME_ = 'userName' +LEFT JOIN act_hi_varinst v3 ON v3.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v3.NAME_ = 'userDeptName' +LEFT JOIN act_hi_varinst v4 ON v4.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v4.NAME_ = 'comId' +LEFT JOIN act_hi_varinst v5 ON v5.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v5.NAME_ = 'comName' +LEFT JOIN act_hi_varinst v6 ON v6.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v6.NAME_ = 'proId' +LEFT JOIN act_hi_varinst v7 ON v7.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v7.NAME_ = 'proName' +LEFT JOIN act_hi_varinst v8 ON v8.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v8.NAME_ = 'businessKey' +LEFT JOIN act_ru_task hr ON hr.PROC_INST_ID_ = RES.PROC_INST_ID_ +LEFT JOIN act_ru_actinst ra ON ra.TASK_ID_ = hr.ID_ AND ra.PROC_INST_ID_ = RES.PROC_INST_ID_ +LEFT JOIN sys_user tu ON tu.user_id = ra.ASSIGNEE_ +LEFT JOIN sys_dept td ON td.dept_id = tu.dept_id +LEFT JOIN ( + SELECT + ht.ID_ AS taskId, + ht.NAME_ AS taskName, + tu.user_id AS assigneeId, + tu.nick_name AS assigneeName, + td.dept_name AS assigneeDeptName, + ht.PROC_INST_ID_, + ahc.TYPE_ as taskComType + FROM + act_hi_taskinst ht + LEFT JOIN sys_user tu ON tu.user_id = ht.ASSIGNEE_ + LEFT JOIN sys_dept td ON td.dept_id = tu.dept_id + left join act_hi_comment ahc on ahc.TASK_ID_ = ht.ID_ AND ahc.PROC_INST_ID_ is not NULL + WHERE + ht.ID_ IN ( + SELECT + MAX(ID_) + FROM + act_hi_taskinst + GROUP BY + PROC_INST_ID_ + ) + GROUP BY ht.PROC_INST_ID_ +) ht ON ht.PROC_INST_ID_ = RES.PROC_INST_ID_ +) + +##待办 +DROP view vw_flow_await; +CREATE VIEW vw_flow_await AS ( +SELECT + RES.ID_ AS taskId, + RES.NAME_ AS taskName, + re.ID_ AS procInsId, + DEF.DEPLOYMENT_ID_ AS deployId, + DATE_FORMAT(re.START_TIME_, '%Y-%m-%d %H:%i:%S') AS createTime, + TIMESTAMPDIFF( + MINUTE, + re.START_TIME_, + DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S') + ) AS duration, + DEF.NAME_ AS procDefName, + DEF.VERSION_ AS procDefVersion, + DEF.CATEGORY_ AS category, + DEF.KEY_ AS procDefKey, + v1.TEXT_ AS startUserId, + v2.TEXT_ AS startUserName, + v3.TEXT_ AS startDeptName, + v4.TEXT_ AS startComId, + v5.TEXT_ AS startComName, + v6.TEXT_ AS startProId, + v7.TEXT_ AS startProName, + v8.TEXT_ AS businessKey, + RES.SUSPENSION_STATE_, + RES.ASSIGNEE_, + LINK.USER_ID_, + LINK.GROUP_ID_ +FROM + ACT_RU_TASK RES +LEFT JOIN act_ru_execution re ON re.PARENT_ID_ IS NULL AND re.PROC_INST_ID_ = RES.PROC_INST_ID_ +LEFT OUTER JOIN ACT_RE_PROCDEF DEF ON re.PROC_DEF_ID_ = DEF.ID_ +LEFT JOIN act_hi_varinst v1 ON v1.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v1.NAME_ = 'INITIATOR' +LEFT JOIN act_hi_varinst v2 ON v2.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v2.NAME_ = 'userName' +LEFT JOIN act_hi_varinst v3 ON v3.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v3.NAME_ = 'userDeptName' +LEFT JOIN act_hi_varinst v4 ON v4.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v4.NAME_ = 'comId' +LEFT JOIN act_hi_varinst v5 ON v5.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v5.NAME_ = 'comName' +LEFT JOIN act_hi_varinst v6 ON v6.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v6.NAME_ = 'proId' +LEFT JOIN act_hi_varinst v7 ON v7.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v7.NAME_ = 'proName' +LEFT JOIN act_hi_varinst v8 ON v8.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v8.NAME_ = 'businessKey' +LEFT JOIN ACT_RU_IDENTITYLINK LINK on LINK.TASK_ID_ = RES.ID_ AND LINK.TYPE_ = 'candidate' +WHERE + RES.SUSPENSION_STATE_ = 1) +##下面是当前登录人代办查询条件 +-- AND ( +-- RES.ASSIGNEE_ = 1 +-- OR ( +-- RES.ASSIGNEE_ IS NULL +-- AND EXISTS ( +-- SELECT +-- LINK.ID_ +-- FROM +-- ACT_RU_IDENTITYLINK LINK +-- WHERE +-- LINK.TASK_ID_ = RES.ID_ +-- AND LINK.TYPE_ = 'candidate' +-- AND ( +-- LINK.USER_ID_ = 1 +-- OR ( +-- LINK.GROUP_ID_ IN (1, 42, 45, 46) +-- ) +-- ) +-- ) +-- ) +-- ) + +##审批意见 +DROP view vw_flow_comment; +CREATE VIEW vw_flow_comment AS ( +SELECT + hc.ID_ AS commentId, + hc.TYPE_ AS commentType, + ht.ID_ AS taskId, + ht.NAME_ AS taskName, + ht.REV_ AS rev, + CASE +WHEN hc.TYPE_ = 1 and ht.NAME_ !='提交申请' THEN + '通过' +WHEN hc.TYPE_ = 2 THEN + '退回' +WHEN hc.TYPE_ = 3 THEN + '驳回' +WHEN hc.TYPE_ = 4 THEN + '委派' +WHEN hc.TYPE_ = 5 THEN + '转办' +WHEN hc.TYPE_ = 6 THEN + '终止' +WHEN hc.TYPE_ = 7 THEN + '撤回' +END AS commentResult, + ht.PROC_INST_ID_ AS procInstId, + ht.TASK_DEF_KEY_ AS taskDefKey, + ht.EXECUTION_ID_ AS executionId, + ht.DELETE_REASON_ AS deleteReason, + DATE_FORMAT( + ht.START_TIME_, + '%Y-%m-%d %H:%i:%S' +) AS startTime, + DATE_FORMAT( + ht.END_TIME_, + '%Y-%m-%d %H:%i:%S' +) AS endTime, + ht.DURATION_ AS duration, + hc.MESSAGE_ AS message, + ru.nick_name AS assigneeName, + IF(ru.dept_id IS NOT NULL, rd.dept_name, ru.remark) as deptName, + sr.role_name as candidate +FROM + act_hi_taskinst ht +LEFT JOIN act_hi_comment hc ON hc.TASK_ID_ = ht.ID_ or (hc.TASK_ID_ is null and hc.PROC_INST_ID_ = ht.PROC_INST_ID_) +LEFT JOIN act_hi_identitylink hi on hi.TASK_ID_ = ht.ID_ and hi.TYPE_ = 'candidate' +left JOIN sys_role sr on sr.role_id = hi.group_Id_ +LEFT JOIN sys_user ru ON ru.user_id = ht.ASSIGNEE_ +LEFT JOIN sys_dept rd ON rd.dept_id = ru.dept_id +where hc.TYPE_ is null or hc.TYPE_!='event') + +##已办 +DROP view vw_flow_finished; +CREATE VIEW vw_flow_finished AS ( +SELECT + RES.ID_ AS taskId, + RES.NAME_ AS taskName, + RES.PROC_INST_ID_ AS procInsId, + pd.DEPLOYMENT_ID_ as deployId, + DATE_FORMAT(RES.START_TIME_, '%Y-%m-%d %H:%i:%S') AS createTime, + DATE_FORMAT(RES.END_TIME_, '%Y-%m-%d %H:%i:%S') AS endTime, + TIMESTAMPDIFF( + MINUTE, + res.START_TIME_, + RES.END_TIME_ + ) AS duration, +DEF.END_TIME_ as finishTime, + pd.NAME_ AS procDefName, + pd.CATEGORY_ AS category, + pd.KEY_ AS procDefKey, + v1.TEXT_ AS startUserId, + v2.TEXT_ AS startUserName, + v3.TEXT_ AS startDeptName, + v4.TEXT_ AS startComId, + v5.TEXT_ AS startComName, + v6.TEXT_ AS startProId, + v7.TEXT_ AS startProName, + v8.TEXT_ AS businessKey, + RES.ASSIGNEE_, + ahc.TYPE_ as taskComType +FROM + act_hi_taskinst RES +LEFT OUTER JOIN act_hi_procinst DEF ON RES.PROC_INST_ID_ = DEF.PROC_INST_ID_ +LEFT OUTER join act_re_procdef pd on RES.PROC_DEF_ID_ = pd.ID_ +LEFT JOIN act_hi_varinst v1 ON v1.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v1.NAME_ = 'INITIATOR' +LEFT JOIN act_hi_varinst v2 ON v2.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v2.NAME_ = 'userName' +LEFT JOIN act_hi_varinst v3 ON v3.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v3.NAME_ = 'userDeptName' +LEFT JOIN act_hi_varinst v4 ON v4.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v4.NAME_ = 'comId' +LEFT JOIN act_hi_varinst v5 ON v5.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v5.NAME_ = 'comName' +LEFT JOIN act_hi_varinst v6 ON v6.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v6.NAME_ = 'proId' +LEFT JOIN act_hi_varinst v7 ON v7.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v7.NAME_ = 'proName' +LEFT JOIN act_hi_varinst v8 ON v8.PROC_INST_ID_ = RES.PROC_INST_ID_ AND v8.NAME_ = 'businessKey' +left join act_hi_comment ahc on ahc.TASK_ID_ = RES.ID_ AND ahc.PROC_INST_ID_ is not NULL +WHERE + RES.ASSIGNEE_ is not null and RES.END_TIME_ is not null) \ No newline at end of file diff --git a/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/RemoteProService.java b/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/RemoteProService.java index 62d8635c..de31a8ca 100644 --- a/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/RemoteProService.java +++ b/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/RemoteProService.java @@ -3,6 +3,7 @@ package com.yanzhu.system.api; import com.yanzhu.common.core.constant.SecurityConstants; import com.yanzhu.common.core.constant.ServiceNameConstants; import com.yanzhu.common.core.domain.R; +import com.yanzhu.common.core.web.domain.AjaxResult; import com.yanzhu.system.api.domain.SysUser; import com.yanzhu.system.api.factory.RemoteFileFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; @@ -38,4 +39,14 @@ public interface RemoteProService */ @GetMapping("/proProjectInfoUsers/projects/{userId}") public R>> getProjects(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); + + /** + * 分包人员审批通过信息同步 + * + * @param busKey 业务主键 + * @param source 请求来源 + * @return 结果 + */ + @GetMapping("/proProjectInfoSubdeptsUsers/approveSubDeptsUser/{busKey}") + public R approveSubDeptsUser(@PathVariable("busKey") Long busKey, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); } diff --git a/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/factory/RemoteProFallbackFactory.java b/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/factory/RemoteProFallbackFactory.java index b1a7a03a..d60cb9b0 100644 --- a/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/factory/RemoteProFallbackFactory.java +++ b/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/factory/RemoteProFallbackFactory.java @@ -1,6 +1,7 @@ package com.yanzhu.system.api.factory; import com.yanzhu.common.core.domain.R; +import com.yanzhu.common.core.web.domain.AjaxResult; import com.yanzhu.system.api.RemoteProService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,6 +38,12 @@ public class RemoteProFallbackFactory implements FallbackFactory approveSubDeptsUser(Long busKey, String source) + { + return R.fail("审批通过信息同步失败:" + throwable.getMessage()); + } }; } } diff --git a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/web/domain/BaseEntity.java b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/web/domain/BaseEntity.java index 710bbf43..b8cf50f8 100644 --- a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/web/domain/BaseEntity.java +++ b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/web/domain/BaseEntity.java @@ -56,7 +56,7 @@ public class BaseEntity implements Serializable /** 选中项目 */ private String activeProjectName; - /** 选中页签 */ + /** 选中用户 */ private Long currentUserId; /** 数据来源 */ diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/my/FlowTaskEntity.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/my/FlowTaskEntity.java index eeb10be4..bebd6c91 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/my/FlowTaskEntity.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/my/FlowTaskEntity.java @@ -19,9 +19,6 @@ public class FlowTaskEntity extends BaseEntity { private String businessKey; - @ApiModelProperty("业务名称") - private String businessKeyName; - @ApiModelProperty("任务编号") private String taskId; @@ -40,9 +37,6 @@ public class FlowTaskEntity extends BaseEntity { @ApiModelProperty("部门名称") private String deptName; - @ApiModelProperty("流程发起人部门名称") - private String startDeptName; - @ApiModelProperty("任务执行人名称") private String assigneeName; @@ -55,6 +49,9 @@ public class FlowTaskEntity extends BaseEntity { @ApiModelProperty("流程发起人名称") private String startUserName; + @ApiModelProperty("流程发起人单位") + private String startDeptName; + @ApiModelProperty("流程类型") private String category; @@ -91,10 +88,6 @@ public class FlowTaskEntity extends BaseEntity { @ApiModelProperty("候选执行人") private String candidate; - @ApiModelProperty("任务创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - @ApiModelProperty("任务完成时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date finishTime; @@ -102,38 +95,24 @@ public class FlowTaskEntity extends BaseEntity { @ApiModelProperty("任务完成类型") private String taskComType; - private long deptId; - private long projectId; + @ApiModelProperty("公司主键") + private String startComId; + + @ApiModelProperty("公司名称") + private String startComName; + + @ApiModelProperty("项目单位") + private String startProId; + + @ApiModelProperty("项目单位名称") + private String startProName; @ApiModelProperty("单位祖籍列表") private String deptAncestors; - public long getDeptId() { - return deptId; - } - - public void setDeptId(long deptId) { - this.deptId = deptId; - } - - public long getProjectId() { - return projectId; - } - - public void setProjectId(long projectId) { - this.projectId = projectId; - } - + @ApiModelProperty("角色列表") private List roleIds; - public String getBusinessKeyName() { - return businessKeyName; - } - - public void setBusinessKeyName(String businessKeyName) { - this.businessKeyName = businessKeyName; - } - public String getTaskId() { return taskId; } @@ -318,16 +297,6 @@ public class FlowTaskEntity extends BaseEntity { this.candidate = candidate; } - @Override - public Date getCreateTime() { - return createTime; - } - - @Override - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - public Date getFinishTime() { return finishTime; } @@ -360,6 +329,38 @@ public class FlowTaskEntity extends BaseEntity { this.taskComType = taskComType; } + public String getStartComId() { + return startComId; + } + + public void setStartComId(String startComId) { + this.startComId = startComId; + } + + public String getStartComName() { + return startComName; + } + + public void setStartComName(String startComName) { + this.startComName = startComName; + } + + public String getStartProId() { + return startProId; + } + + public void setStartProId(String startProId) { + this.startProId = startProId; + } + + public String getStartProName() { + return startProName; + } + + public void setStartProName(String startProName) { + this.startProName = startProName; + } + public String getDeptAncestors() { return deptAncestors; } @@ -367,4 +368,6 @@ public class FlowTaskEntity extends BaseEntity { public void setDeptAncestors(String deptAncestors) { this.deptAncestors = deptAncestors; } + + } diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowQueryVo.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowQueryVo.java index 25eb4aad..32bb0858 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowQueryVo.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/domain/vo/FlowQueryVo.java @@ -14,9 +14,15 @@ import lombok.Data; @ApiModel("工作流任务相关--请求参数") public class FlowQueryVo { + @ApiModelProperty("项目单位") + private String proName; + @ApiModelProperty("流程名称") private String name; + @ApiModelProperty("流程分类") + private String category; + @ApiModelProperty("开始时间") private String startTime; diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowBusinessKeyMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowBusinessKeyMapper.java index d714ca7c..f8a62a36 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowBusinessKeyMapper.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowBusinessKeyMapper.java @@ -1,7 +1,6 @@ package com.yanzhu.flowable.mapper; import com.yanzhu.flowable.domain.my.FlowTaskEntity; -import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; @@ -25,13 +24,6 @@ public interface FlowBusinessKeyMapper { */ public FlowTaskEntity findFlowTaskByProcInsId(String procInsId); - /** - * 查询项目信息 - * @param proId - * @return - */ - public Map selectSurProjectById(Long proId); - /** * 根据流程Id查询操作日志 * @param procInsId @@ -74,39 +66,4 @@ public interface FlowBusinessKeyMapper { */ public List> selectMyFinishedFlowTask(FlowTaskEntity flowTaskEntity); - public List groupByCategory(FlowTaskEntity where); - - public List groupByUnit(FlowTaskEntity where); - - public List listByUnit(FlowTaskEntity where); - - public List listByState(FlowTaskEntity where); - - public List groupByUnitTotal(FlowTaskEntity where); - - public List groupByUnitFinish(FlowTaskEntity where); - - public List groupByProject(@Param("deptId")long deptId,@Param("proType")String proType); - - /** - * 根据条件查询安全类作业工作流列表 - * @param flowTaskEntity - * @return - */ - public List findSafetyWorkList(FlowTaskEntity flowTaskEntity); - - public List listByCategory(FlowTaskEntity where); - - /** - * 工程管理-分包单位占比 - * @param where - * @return - */ - public List groupFlowBySubDeptType(FlowTaskEntity where); - /** - * 工程管理-分包单位资质审批明细 - * @param where - * @return - */ - public List listFlowBySubDeptType(FlowTaskEntity where); } diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusTrainingVideoUser.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusTrainingVideoUser.java index 7990d188..41cc1b85 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusTrainingVideoUser.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusTrainingVideoUser.java @@ -77,12 +77,18 @@ public class BusTrainingVideoUser extends BaseEntity private String trainTitle; /** 培训类型 */ - @Excel(name = "培训类型") private String trainType; + /** 培训类型 */ + @Excel(name = "培训类型") + private String trainTypeName; + + /** 培训级别 */ + private String trainLevel; + /** 培训级别 */ @Excel(name = "培训级别") - private String trainLevel; + private String trainLevelName; /** 培训文件地址 */ @Excel(name = "培训文件地址") @@ -253,6 +259,22 @@ public class BusTrainingVideoUser extends BaseEntity this.playDates = playDates; } + public String getTrainTypeName() { + return trainTypeName; + } + + public void setTrainTypeName(String trainTypeName) { + this.trainTypeName = trainTypeName; + } + + public String getTrainLevelName() { + return trainLevelName; + } + + public void setTrainLevelName(String trainLevelName) { + this.trainLevelName = trainLevelName; + } + @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/ProProjectInfoSubdepts.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdepts.java index a609cbb9..676ea686 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 @@ -78,19 +78,19 @@ public class ProProjectInfoSubdepts extends BaseEntity @Excel(name = "合同承包内容") private String contractInfos; - /** 进场时间 */ + /** 进入场地时间 */ @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "进场时间") + @Excel(name = "进入场地时间") private Date useDates; - /** 进场时间 */ + /** 计划开工时间 */ @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "进场时间") + @Excel(name = "计划开工时间") private Date startWorkDates; - /** 进场时间 */ + /** 计划完工时间 */ @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "进场时间") + @Excel(name = "计划完工时间") private Date endWorkDates; /** 进场状态 */ 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 9375f8a1..19d30a4c 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 @@ -57,6 +57,7 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity /** 单位类型 */ private String subDeptType; + private String subDeptTypeName; /** 用户主键 */ @@ -139,6 +140,9 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity /** 劳务人员学历 */ private String degreeGrade; + /** 劳务人员学历 */ + private String degreeGradeName; + /** * 用户岗位 */ @@ -483,6 +487,22 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity this.qrCode = qrCode; } + public String getSubDeptTypeName() { + return subDeptTypeName; + } + + public void setSubDeptTypeName(String subDeptTypeName) { + this.subDeptTypeName = subDeptTypeName; + } + + public String getDegreeGradeName() { + return degreeGradeName; + } + + public void setDegreeGradeName(String degreeGradeName) { + this.degreeGradeName = degreeGradeName; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml index e1073c36..c65252ad 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml @@ -4,47 +4,23 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - - - - - - - - - - - select vf.* as startUserPhone from vw_flow_all vf - where vf.procInsId = #{procInsId} + select * from vw_flow_all where procInsId = #{procInsId} - select * from vw_flow_comment where procInstId = #{procInstId} order by startTime DESC - select * from vw_flow_comment where procInstId = #{procInstId} order by startTime DESC limit 1 - select hv.NAME_ as `name`,hv.TEXT_ as text from act_hi_varinst hv where hv.PROC_INST_ID_ = #{procInstId} - select fa.* from vw_flow_await fa where - 1=1 + fa.taskName != '申请人提交' and fa.procDefName like concat('%', #{procDefName}, '%') and fa.businessKey = #{businessKey} - and fa.businessKeyName like concat('%', #{businessKeyName}, '%') + and fa.startUserId = #{startUserId} + and fa.startUserName like concat('%', #{startUserName}, '%') + and fa.startDeptName like concat('%', #{startDeptName}, '%') and fa.category = #{category} - and fa.createTime between #{params.beginDate} and #{params.endDate} + and date(fa.createTime) between #{params.beginTime} and #{params.endTime} - and fa.businessDeptId = #{projectDeptId} - - and fa.businessDeptId = #{nowDept} - - and fa.businessKey in (select DISTINCT projectId from sur_project_unit_info where unitId=#{nowDept} and del_flag=0) - - and fa.businessKey in (select DISTINCT project_id from sur_project_userinfo where user_id=#{nowUser} and is_del=0) - AND (fa.ASSIGNEE_ = #{nowUser} - OR ( - fa.ASSIGNEE_ IS NULL - AND ( - fa.USER_ID_ = #{nowUser} + and fa.startComId = #{startComId} + and fa.startComName like concat('%', #{startComName}, '%') + and fa.startProId = #{startProId} + and fa.startProName like concat('%', #{startProName}, '%') + + AND (fa.ASSIGNEE_ = #{assigneeId} OR ( - fa.GROUP_ID_ IN - - #{roleId} - + fa.ASSIGNEE_ IS NULL + AND ( + fa.USER_ID_ = #{assigneeId} + OR ( + fa.GROUP_ID_ IN + + #{roleId} + + ) ) ) ) - ) + order by fa.createTime desc - + select fa.category, count(1) as total from vw_flow_await fa where 1=1 and fa.procDefName like concat('%', #{procDefName}, '%') and fa.businessKey = #{businessKey} - and fa.businessKeyName like concat('%', #{businessKeyName}, '%') - and fa.createTime between #{params.beginDate} and #{params.endDate} + and fa.startUserId = #{startUserId} + and fa.startUserName like concat('%', #{startUserName}, '%') + and fa.startDeptName like concat('%', #{startDeptName}, '%') + and date(fa.createTime) between #{params.beginTime} and #{params.endTime} - and fa.businessDeptId = #{projectDeptId} - - and fa.businessDeptId = #{nowDept} - - and fa.businessKey in (select DISTINCT projectId from sur_project_unit_info where unitId=#{nowDept} and del_flag=0) - - and fa.businessKey in (select DISTINCT project_id from sur_project_userinfo where user_id=#{nowUser} and is_del=0) - AND (fa.ASSIGNEE_ = #{nowUser} - OR ( - fa.ASSIGNEE_ IS NULL - AND ( - fa.USER_ID_ = #{nowUser} - OR ( - fa.GROUP_ID_ IN - - #{roleId} - - ) - ) - ) - ) + and fa.startComId = #{startComId} + and fa.startComName like concat('%', #{startComName}, '%') + and fa.startProId = #{startProId} + and fa.startProName like concat('%', #{startProName}, '%') + AND (fa.ASSIGNEE_ = #{assigneeId} + OR ( + fa.ASSIGNEE_ IS NULL + AND ( fa.USER_ID_ = #{assigneeId} + OR ( + fa.GROUP_ID_ IN + + #{roleId} + + ) + ) + ) + ) group by fa.category - select fa.* from vw_flow_finished fa where - fa.ASSIGNEE_=#{nowUser} + fa.ASSIGNEE_=#{assigneeId} and fa.procDefName like concat('%', #{procDefName}, '%') and fa.businessKey = #{businessKey} - and fa.businessKeyName like concat('%', #{businessKeyName}, '%') + and fa.startUserId = #{startUserId} + and fa.startUserName like concat('%', #{startUserName}, '%') + and fa.startDeptName like concat('%', #{startDeptName}, '%') and fa.category = #{category} - and fa.endTime between #{params.beginDate} and #{params.endDate} + and fa.startComId = #{startComId} + and fa.startComName like concat('%', #{startComName}, '%') + and fa.startProId = #{startProId} + and fa.startProName like concat('%', #{startProName}, '%') + and fa.endTime between #{params.beginTime} and #{params.endTime} order by fa.endTime desc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - delete from act_re_procdef_role where ROLE_ID_ = #{roleId} - - - - insert into act_re_procdef_role( PROCDEF_KEY_, ROLE_ID_) values - - ( #{item.key}, #{item.roleId}) - - - - - update act_re_procdef_role set SORT_=#{sort} where PROCDEF_KEY_=#{key} and ROLE_ID_=#{roleId} - - - - - 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/BusTrainingVideoUserMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusTrainingVideoUserMapper.xml index f9527f54..8e01cbfe 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusTrainingVideoUserMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusTrainingVideoUserMapper.xml @@ -16,7 +16,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -33,12 +35,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select btvu.id, btvu.com_id, sd.dept_name as com_name, btvu.project_id, pi.project_name, btvu.user_id, su.nick_name as user_nick, su.user_name, btvu.video_id, btv.train_title, - btv.train_type, btv.train_level, btv.train_file_path, btv.train_file_image, btvu.play_times, btvu.play_dates, + btv.train_type, dic1.dict_label as train_type_name, btv.train_level, dic2.dict_label as train_level_name, btv.train_file_path, btv.train_file_image, btvu.play_times, btvu.play_dates, btvu.play_status, btvu.sort_by, btvu.is_del, btvu.create_by, btvu.create_time, btvu.update_by, btvu.update_time, btvu.remark from bus_training_video_user btvu left join bus_training_video btv on btv.id = btvu.video_id left join pro_project_info pi on pi.id = btvu.project_id left join sys_dept sd on sd.com_id = btvu.com_id left join sys_user su on su.user_id = btvu.user_id + left join sys_dict_data dic1 ON btv.train_type = dic1.`dict_value` AND dic1.`dict_type`='edu_train_type' + left join sys_dict_data dic2 ON btv.train_level = dic2.`dict_value` AND dic2.`dict_type`='edu_train_level' - + diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoSubdeptsUsersMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoSubdeptsUsersMapper.xml index 83d28fb9..df9ffb35 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoSubdeptsUsersMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoSubdeptsUsersMapper.xml @@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -42,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -67,10 +69,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - SELECT psu.id, psu.par_id, psu.com_id, psu.project_id, pi.project_name, psu.sub_dept_id, psu.sub_dept_type, psu.sub_dept_name, psu.sub_dept_power_path, psu.user_id, psu.sub_dept_group, + SELECT psu.id, psu.par_id, psu.com_id, psu.project_id, pi.project_name, psu.sub_dept_id, psu.sub_dept_type, dic3.dict_label as sub_dept_type_name, psu.sub_dept_name, psu.sub_dept_power_path, psu.user_id, psu.sub_dept_group, psu.sub_dept_group_name, psu.user_post, psu.craft_type, psu.craft_post, psu.edu_status, psu.edu_file_path, psu.edu_sign_path, psu.edu_date, psu.approve_status, psu.use_status, psu.qr_code, psu.sub_step, psu.illness_status, psu.sup_illness_status, psu.is_del, psu.create_by, psu.create_time, psu.update_by, psu.update_time, - psu.remark, psu.degree_grade, su.`user_name`,su.`nick_name`,su.`user_type`,su.`card_type`,su.`card_code`,su.admitGuid,su.admitGuid usAdmitGuid, + psu.remark, psu.degree_grade, dic4.dict_label as degree_grade_name, su.`user_name`,su.`nick_name`,su.`user_type`,su.`card_type`,su.`card_code`,su.admitGuid,su.admitGuid usAdmitGuid, dic1.dict_label craft_type_name,dic2.dict_label craft_post_name,psu.enter_state,sd.dept_name comName, su.`user_picture`, su.`card_img_inv`,su.`card_img_pos`,su.`user_infos`,su.`email`,su.`phonenumber`,su.`sex`,su.`avatar`,su.`login_ip`,su.`login_date` FROM pro_project_info_subdepts_users psu @@ -79,6 +81,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN sys_dept sd ON sd.dept_id = pi.com_id LEFT JOIN sys_dict_data dic1 ON psu.`craft_type`=dic1.`dict_value` AND dic1.`dict_type`='pro_craft_type' LEFT JOIN sys_dict_data dic2 ON psu.`craft_post`=dic2.`dict_value` AND dic2.`dict_type`='pro_craft_post' + LEFT JOIN sys_dict_data dic3 ON psu.`sub_dept_type`=dic3.`dict_value` AND dic3.`dict_type`='sub_dept_type' + LEFT JOIN sys_dict_data dic4 ON psu.`degree_grade`=dic4.`dict_value` AND dic4.`dict_type`='educational_type' \ No newline at end of file diff --git a/yanzhu-common/yanzhu-common-security/src/main/java/com/yanzhu/common/security/utils/SecurityUtils.java b/yanzhu-common/yanzhu-common-security/src/main/java/com/yanzhu/common/security/utils/SecurityUtils.java index 813ad771..dd02c673 100644 --- a/yanzhu-common/yanzhu-common-security/src/main/java/com/yanzhu/common/security/utils/SecurityUtils.java +++ b/yanzhu-common/yanzhu-common-security/src/main/java/com/yanzhu/common/security/utils/SecurityUtils.java @@ -103,6 +103,16 @@ public class SecurityUtils return getLoginUser().getRoles().contains("gsAdmin"); } + /** + * 是否为项目管理员 + * + * @return 结果 + */ + public static boolean isXMAdmin() + { + return getLoginUser().getRoles().contains("xmAdmin"); + } + /** * 是否为公司管理员 * diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/enums/FlowComment.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/enums/FlowComment.java index cd0dbcc9..aa42fd45 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/enums/FlowComment.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/common/enums/FlowComment.java @@ -16,7 +16,8 @@ public enum FlowComment { REJECT("3", "驳回意见"), DELEGATE("4", "委派意见"), ASSIGN("5", "转办意见"), - STOP("6", "终止流程"); + STOP("6", "终止流程"), + REVOKE("7", "撤回流程"); /** * 类型 diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableGlobalListenerConfig.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableGlobalListenerConfig.java index 227de838..1858db54 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableGlobalListenerConfig.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/config/FlowableGlobalListenerConfig.java @@ -33,7 +33,6 @@ public class FlowableGlobalListenerConfig implements ApplicationListener role.getRoleId()).collect(Collectors.toList())); + LoginUser loginUser = SecurityUtils.getLoginUser(); + if(SecurityUtils.isAdmin(loginUser.getUserid())){ + // TODO:超管查询所有申请... + if(Objects.nonNull(loginUser.getProjectDeptId())){ + flowTaskEntity.setStartComId(Convert.toStr(loginUser.getProjectDeptId())); + } + if(Objects.nonNull(loginUser.getProjectId())){ + flowTaskEntity.setStartProId(Convert.toStr(loginUser.getProjectId())); + } + }else if(SecurityUtils.isGSAdmin()){ + // 公司管理员查询公司内的所有申请... + flowTaskEntity.setStartComId(Convert.toStr(loginUser.getProjectDeptId())); + if(Objects.nonNull(loginUser.getProjectId())){ + flowTaskEntity.setStartProId(Convert.toStr(loginUser.getProjectId())); + } + }else if(SecurityUtils.isXMAdmin()){ + // 公司管理员查询公司内的所有申请... + flowTaskEntity.setStartProId(Convert.toStr(loginUser.getProjectId())); + }else{ + flowTaskEntity.setAssigneeId(SecurityUtils.getUserId()); + flowTaskEntity.setRoleIds(Arrays.asList(SecurityUtils.getLoginUser().getSysUser().getRoleIds())); } startPage(); return getDataTable(flowBusinessKeyService.selectMyAwaitFlowTask(flowTaskEntity)); @@ -125,22 +173,24 @@ public class FlowBusinessKeyController extends BaseController { @GetMapping(value = "/findMyTask") public AjaxResult findMyTask() { FlowTaskEntity flowTaskEntity = new FlowTaskEntity(); - SysUser sysUser = SecurityUtils.getLoginUser().getSysUser(); - //超管查询所有数据 - if(!SecurityUtils.isAdmin(sysUser.getUserId())){ - flowTaskEntity.setAssigneeId(sysUser.getUserId()); - flowTaskEntity.setDeptAncestors(sysUser.getDept().getAncestors()+","+sysUser.getDeptId()); - flowTaskEntity.setRoleIds(sysUser.getRoles().stream().map(role -> role.getRoleId()).collect(Collectors.toList())); + flowTaskEntity.setAssigneeId(SecurityUtils.getUserId()); + List roles = SecurityUtils.getLoginUser().getSysUser().getRoles(); + if(StringUtils.isNotEmpty(roles)){ + List roleIds = roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()); + flowTaskEntity.setRoleIds(roleIds); + }else{ + List roleIds = new ArrayList<>(); + roleIds.add(0L); + flowTaskEntity.setRoleIds(roleIds); } List> list = flowBusinessKeyService.selectMyAwaitFlowTask(flowTaskEntity); Map data = new HashMap<>(); if(CollectionUtils.isNotEmpty(list)){ data.put("todo",list.size()); }else{ - data.put("todo",0); + data.put("todo",5); } return success(data); } - } diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/flow/ModelUtils.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/flow/ModelUtils.java new file mode 100644 index 00000000..d47ed702 --- /dev/null +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/flow/ModelUtils.java @@ -0,0 +1,373 @@ +package com.yanzhu.flowable.flow; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import org.flowable.bpmn.converter.BpmnXMLConverter; +import org.flowable.bpmn.model.Process; +import org.flowable.bpmn.model.*; +import org.flowable.common.engine.impl.util.io.StringStreamSource; + +import java.util.*; + +/** + * @author KonBAI + * @createTime 2022/3/26 19:04 + */ +public class ModelUtils { + + private static final BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter(); + + /** + * xml转bpmnModel对象 + * + * @param xml xml + * @return bpmnModel对象 + */ + public static BpmnModel getBpmnModel(String xml) { + return bpmnXMLConverter.convertToBpmnModel(new StringStreamSource(xml), false, false); + } + + /** + * bpmnModel转xml字符串 + * + * @deprecated 存在会丢失 bpmn 连线问题 + * @param bpmnModel bpmnModel对象 + * @return xml字符串 + */ + @Deprecated + public static String getBpmnXmlStr(BpmnModel bpmnModel) { + return StrUtil.utf8Str(getBpmnXml(bpmnModel)); + } + + /** + * bpmnModel转xml对象 + * + * @deprecated 存在丢失 bpmn 连线问题 + * @param bpmnModel bpmnModel对象 + * @return xml + */ + @Deprecated + public static byte[] getBpmnXml(BpmnModel bpmnModel) { + return bpmnXMLConverter.convertToXML(bpmnModel); + } + + /** + * 根据节点,获取入口连线 + * + * @param source 起始节点 + * @return 入口连线列表 + */ + public static List getElementIncomingFlows(FlowElement source) { + List sequenceFlows = new ArrayList<>(); + if (source instanceof FlowNode) { + sequenceFlows = ((FlowNode) source).getIncomingFlows(); + } + return sequenceFlows; + } + + + /** + * 根据节点,获取出口连线 + * + * @param source 起始节点 + * @return 出口连线列表 + */ + public static List getElementOutgoingFlows(FlowElement source) { + List sequenceFlows = new ArrayList<>(); + if (source instanceof FlowNode) { + sequenceFlows = ((FlowNode) source).getOutgoingFlows(); + } + return sequenceFlows; + } + + /** + * 获取开始节点 + * + * @param model bpmnModel对象 + * @return 开始节点(未找到开始节点,返回null) + */ + public static StartEvent getStartEvent(BpmnModel model) { + Process process = model.getMainProcess(); + FlowElement startElement = process.getInitialFlowElement(); + if (startElement instanceof StartEvent) { + return (StartEvent) startElement; + } + return getStartEvent(process.getFlowElements()); + } + + /** + * 获取开始节点 + * + * @param flowElements 流程元素集合 + * @return 开始节点(未找到开始节点,返回null) + */ + public static StartEvent getStartEvent(Collection flowElements) { + for (FlowElement flowElement : flowElements) { + if (flowElement instanceof StartEvent) { + return (StartEvent) flowElement; + } + } + return null; + } + + /** + * 获取结束节点 + * + * @param model bpmnModel对象 + * @return 结束节点(未找到开始节点,返回null) + */ + public static EndEvent getEndEvent(BpmnModel model) { + Process process = model.getMainProcess(); + return getEndEvent(process.getFlowElements()); + } + + /** + * 获取结束节点 + * + * @param flowElements 流程元素集合 + * @return 结束节点(未找到开始节点,返回null) + */ + public static EndEvent getEndEvent(Collection flowElements) { + for (FlowElement flowElement : flowElements) { + if (flowElement instanceof EndEvent) { + return (EndEvent) flowElement; + } + } + return null; + } + + public static UserTask getUserTaskByKey(BpmnModel model, String taskKey) { + Process process = model.getMainProcess(); + FlowElement flowElement = process.getFlowElement(taskKey); + if (flowElement instanceof UserTask) { + return (UserTask) flowElement; + } + return null; + } + + /** + * 获取流程元素信息 + * + * @param model bpmnModel对象 + * @param flowElementId 元素ID + * @return 元素信息 + */ + public static FlowElement getFlowElementById(BpmnModel model, String flowElementId) { + Process process = model.getMainProcess(); + return process.getFlowElement(flowElementId); + } + + /** + * 获取元素表单Key(限开始节点和用户节点可用) + * + * @param flowElement 元素 + * @return 表单Key + */ + public static String getFormKey(FlowElement flowElement) { + if (flowElement != null) { + if (flowElement instanceof StartEvent) { + return ((StartEvent) flowElement).getFormKey(); + } else if (flowElement instanceof UserTask) { + return ((UserTask) flowElement).getFormKey(); + } + } + return null; + } + + /** + * 获取开始节点属性值 + * @param model bpmnModel对象 + * @param name 属性名 + * @return 属性值 + */ + public static String getStartEventAttributeValue(BpmnModel model, String name) { + StartEvent startEvent = getStartEvent(model); + return getElementAttributeValue(startEvent, name); + } + + /** + * 获取结束节点属性值 + * @param model bpmnModel对象 + * @param name 属性名 + * @return 属性值 + */ + public static String getEndEventAttributeValue(BpmnModel model, String name) { + EndEvent endEvent = getEndEvent(model); + return getElementAttributeValue(endEvent, name); + } + + /** + * 获取用户任务节点属性值 + * @param model bpmnModel对象 + * @param taskKey 任务Key + * @param name 属性名 + * @return 属性值 + */ + public static String getUserTaskAttributeValue(BpmnModel model, String taskKey, String name) { + UserTask userTask = getUserTaskByKey(model, taskKey); + return getElementAttributeValue(userTask, name); + } + + /** + * 获取元素属性值 + * @param baseElement 流程元素 + * @param name 属性名 + * @return 属性值 + */ + public static String getElementAttributeValue(BaseElement baseElement, String name) { + if (baseElement != null) { + List attributes = baseElement.getAttributes().get(name); + if (attributes != null && !attributes.isEmpty()) { + attributes.iterator().next().getValue(); + Iterator attrIterator = attributes.iterator(); + if(attrIterator.hasNext()) { + ExtensionAttribute attribute = attrIterator.next(); + return attribute.getValue(); + } + } + } + return null; + } + + public static boolean isMultiInstance(BpmnModel model, String taskKey) { + UserTask userTask = getUserTaskByKey(model, taskKey); + if (ObjectUtil.isNotNull(userTask)) { + return userTask.hasMultiInstanceLoopCharacteristics(); + } + return false; + } + + /** + * 获取所有用户任务节点 + * + * @param model bpmnModel对象 + * @return 用户任务节点列表 + */ + public static Collection getAllUserTaskEvent(BpmnModel model) { + Process process = model.getMainProcess(); + Collection flowElements = process.getFlowElements(); + return getAllUserTaskEvent(flowElements, null); + } + + /** + * 获取所有用户任务节点 + * @param flowElements 流程元素集合 + * @param allElements 所有流程元素集合 + * @return 用户任务节点列表 + */ + public static Collection getAllUserTaskEvent(Collection flowElements, Collection allElements) { + allElements = allElements == null ? new ArrayList<>() : allElements; + for (FlowElement flowElement : flowElements) { + if (flowElement instanceof UserTask) { + allElements.add((UserTask) flowElement); + } + if (flowElement instanceof SubProcess) { + // 继续深入子流程,进一步获取子流程 + allElements = getAllUserTaskEvent(((SubProcess) flowElement).getFlowElements(), allElements); + } + } + return allElements; + } + + /** + * 查找起始节点下一个用户任务列表列表 + * @param source 起始节点 + * @return 结果 + */ + public static List findNextUserTasks(FlowElement source) { + return findNextUserTasks(source, null, null); + } + + /** + * 查找起始节点下一个用户任务列表列表 + * @param source 起始节点 + * @param hasSequenceFlow 已经经过的连线的 ID,用于判断线路是否重复 + * @param userTaskList 用户任务列表 + * @return 结果 + */ + public static List findNextUserTasks(FlowElement source, Set hasSequenceFlow, List userTaskList) { + hasSequenceFlow = Optional.ofNullable(hasSequenceFlow).orElse(new HashSet<>()); + userTaskList = Optional.ofNullable(userTaskList).orElse(new ArrayList<>()); + // 获取出口连线 + List sequenceFlows = getElementOutgoingFlows(source); + if (!sequenceFlows.isEmpty()) { + for (SequenceFlow sequenceFlow : sequenceFlows) { + // 如果发现连线重复,说明循环了,跳过这个循环 + if (hasSequenceFlow.contains(sequenceFlow.getId())) { + continue; + } + // 添加已经走过的连线 + hasSequenceFlow.add(sequenceFlow.getId()); + FlowElement targetFlowElement = sequenceFlow.getTargetFlowElement(); + if (targetFlowElement instanceof UserTask) { + // 若节点为用户任务,加入到结果列表中 + userTaskList.add((UserTask) targetFlowElement); + } else { + // 若节点非用户任务,继续递归查找下一个节点 + findNextUserTasks(targetFlowElement, hasSequenceFlow, userTaskList); + } + } + } + return userTaskList; + } + + /** + * 迭代从后向前扫描,判断目标节点相对于当前节点是否是串行 + * 不存在直接回退到子流程中的情况,但存在从子流程出去到父流程情况 + * @param source 起始节点 + * @param target 目标节点 + * @param visitedElements 已经经过的连线的 ID,用于判断线路是否重复 + * @return 结果 + */ + public static boolean isSequentialReachable(FlowElement source, FlowElement target, Set visitedElements) { + visitedElements = visitedElements == null ? new HashSet<>() : visitedElements; + if (source instanceof StartEvent && isInEventSubprocess(source)) { + return false; + } + + // 根据类型,获取入口连线 + List sequenceFlows = getElementIncomingFlows(source); + if (sequenceFlows != null && sequenceFlows.size() > 0) { + // 循环找到目标元素 + for (SequenceFlow sequenceFlow: sequenceFlows) { + // 如果发现连线重复,说明循环了,跳过这个循环 + if (visitedElements.contains(sequenceFlow.getId())) { + continue; + } + // 添加已经走过的连线 + visitedElements.add(sequenceFlow.getId()); + FlowElement sourceFlowElement = sequenceFlow.getSourceFlowElement(); + // 这条线路存在目标节点,这条线路完成,进入下个线路 + if (target.getId().equals(sourceFlowElement.getId())) { + continue; + } + // 如果目标节点为并行网关,则不继续 + if (sourceFlowElement instanceof ParallelGateway) { + return false; + } + // 否则就继续迭代 + boolean isSequential = isSequentialReachable(sourceFlowElement, target, visitedElements); + if (!isSequential) { + return false; + } + } + } + return true; + } + + protected static boolean isInEventSubprocess(FlowElement flowElement) { + FlowElementsContainer flowElementsContainer = flowElement.getParentContainer(); + while (flowElementsContainer != null) { + if (flowElementsContainer instanceof EventSubProcess) { + return true; + } + + if (flowElementsContainer instanceof FlowElement) { + flowElementsContainer = ((FlowElement) flowElementsContainer).getParentContainer(); + } else { + flowElementsContainer = null; + } + } + return false; + } +} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/listener/GlobalEventListener.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/listener/GlobalEventListener.java index a937b6ce..e414a81d 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/listener/GlobalEventListener.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/listener/GlobalEventListener.java @@ -1,13 +1,19 @@ package com.yanzhu.flowable.listener; +import com.yanzhu.common.core.constant.SecurityConstants; +import com.yanzhu.common.core.text.Convert; import com.yanzhu.common.redis.service.RedisService; +import com.yanzhu.flowable.constant.FlowCacheConstants; +import com.yanzhu.system.api.RemoteProService; import lombok.extern.slf4j.Slf4j; import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent; import org.flowable.engine.RepositoryService; import org.flowable.engine.RuntimeService; -import org.flowable.engine.TaskService; import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener; +import org.flowable.engine.repository.ProcessDefinition; +import org.flowable.engine.runtime.ProcessInstance; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; /** @@ -23,10 +29,11 @@ public class GlobalEventListener extends AbstractFlowableEngineEventListener { private RedisService redisService; @Autowired - private TaskService taskService; + private RuntimeService runtimeService; @Autowired - private RuntimeService runtimeService; + @Lazy + private RemoteProService remoteProService; @Autowired private RepositoryService repositoryService; @@ -35,6 +42,16 @@ public class GlobalEventListener extends AbstractFlowableEngineEventListener { protected void processCompleted(FlowableEngineEntityEvent event) { log.info("任务流程审批完成...{}",event.getProcessInstanceId()); super.processCompleted(event); + Boolean isCompleted = Convert.toBool(redisService.getCacheObject(FlowCacheConstants.STOP_PROCESS+event.getProcessInstanceId()),true); + if(isCompleted){ + // 获取流程定义对象 + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(event.getProcessInstanceId()).singleResult(); + ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(event.getProcessDefinitionId()).singleResult(); + log.info("同步修改审批信息...Category...{}...BusinessKey...{}",processDefinition.getCategory(),processInstance.getBusinessKey()); + if(Convert.toInt(processDefinition.getCategory())<5){ + remoteProService.approveSubDeptsUser(Convert.toLong(processInstance.getBusinessKey()), SecurityConstants.INNER); + } + } } } diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowBusinessKeyService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowBusinessKeyService.java index 79358592..90123bce 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowBusinessKeyService.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowBusinessKeyService.java @@ -40,7 +40,7 @@ public interface IFlowBusinessKeyService { public Map selectFormDatasByProcInsId(String procInsId); /** - * 查询我的代办任务 + * 统计我的代办任务 * @param flowTaskEntity * @return */ diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowBusinessKeyServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowBusinessKeyServiceImpl.java index 75655181..4f526889 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowBusinessKeyServiceImpl.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowBusinessKeyServiceImpl.java @@ -19,8 +19,8 @@ import java.util.Map; * @author Tony * @date 2021-04-03 */ -@Service @Slf4j +@Service public class FlowBusinessKeyServiceImpl implements IFlowBusinessKeyService { @Resource diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowInstanceServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowInstanceServiceImpl.java index 6727b5f8..a0de8b28 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowInstanceServiceImpl.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowInstanceServiceImpl.java @@ -32,7 +32,6 @@ public class FlowInstanceServiceImpl extends FlowServiceFactory implements IFlow @Override public void stopProcessInstance(FlowTaskVo vo) { String taskId = vo.getTaskId(); - } /** @@ -63,7 +62,6 @@ public class FlowInstanceServiceImpl extends FlowServiceFactory implements IFlow @Override @Transactional(rollbackFor = Exception.class) public void delete(String instanceId, String deleteReason) { - // 查询历史数据 HistoricProcessInstance historicProcessInstance = getHistoricProcessInstanceById(instanceId); if (historicProcessInstance.getEndTime() != null) { diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowTaskServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowTaskServiceImpl.java index 519709bb..cd61b395 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowTaskServiceImpl.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowTaskServiceImpl.java @@ -1,14 +1,18 @@ package com.yanzhu.flowable.service.impl; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.TypeReference; import com.github.pagehelper.PageInfo; import com.yanzhu.common.core.exception.base.BaseException; 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.constant.FlowCacheConstants; import com.yanzhu.flowable.domain.SysForm; import com.yanzhu.flowable.domain.dto.FlowCommentDto; import com.yanzhu.flowable.domain.dto.FlowNextDto; @@ -20,6 +24,7 @@ import com.yanzhu.flowable.factory.FlowServiceFactory; import com.yanzhu.flowable.flow.CustomProcessDiagramGenerator; import com.yanzhu.flowable.flow.FindNextNodeUtil; import com.yanzhu.flowable.flow.FlowableUtils; +import com.yanzhu.flowable.flow.ModelUtils; import com.yanzhu.flowable.rpc.RemoteSystemService; import com.yanzhu.flowable.service.IFlowTaskService; import com.yanzhu.flowable.service.ISysDeployFormService; @@ -35,6 +40,7 @@ import org.flowable.bpmn.model.Process; import org.flowable.bpmn.model.*; import org.flowable.common.engine.api.FlowableException; import org.flowable.common.engine.api.FlowableObjectNotFoundException; +import org.flowable.common.engine.impl.identity.Authentication; import org.flowable.engine.ProcessEngineConfiguration; import org.flowable.engine.history.HistoricActivityInstance; import org.flowable.engine.history.HistoricProcessInstance; @@ -52,6 +58,7 @@ import org.flowable.task.api.Task; import org.flowable.task.api.TaskQuery; import org.flowable.task.api.history.HistoricTaskInstance; import org.flowable.task.api.history.HistoricTaskInstanceQuery; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -61,6 +68,7 @@ import java.lang.reflect.Field; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -73,13 +81,18 @@ import java.util.stream.Collectors; @Slf4j public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTaskService { - @Resource - private RemoteSystemService remoteSystemService; - @Resource - private ISysDeployFormService sysInstanceFormService; + @Autowired + private RedisService redisService; + @Resource private ISysFormService sysFormService; + @Resource + private RemoteSystemService remoteSystemService; + + @Resource + private ISysDeployFormService sysInstanceFormService; + /** * 完成任务 * @@ -92,13 +105,18 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask if (Objects.isNull(task)) { return AjaxResult.error("任务不存在"); } + String userId = taskVo.getUserId(); if (DelegationState.PENDING.equals(task.getDelegationState())) { taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment()); taskService.resolveTask(taskVo.getTaskId(), taskVo.getVariables()); } else { + if(StringUtils.isNotEmpty(taskVo.getComment())){ + taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getComment()); + }else{ + taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getAssignee()+"重新提交流程申请!!"); + } taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getComment()); - Long userId = SecurityUtils.getLoginUser().getUserid(); - taskService.setAssignee(taskVo.getTaskId(), userId.toString()); + taskService.setAssignee(taskVo.getTaskId(), userId); taskService.complete(taskVo.getTaskId(), taskVo.getVariables()); } return AjaxResult.success(); @@ -577,6 +595,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask */ @Override public AjaxResult stopProcess(FlowTaskVo flowTaskVo) { + // 将终止的实例加入到缓存 + redisService.setCacheObject(FlowCacheConstants.STOP_PROCESS+flowTaskVo.getInstanceId(),false,2L, TimeUnit.MINUTES); List task = taskService.createTaskQuery().processInstanceId(flowTaskVo.getInstanceId()).list(); if (CollectionUtils.isEmpty(task)) { throw new BaseException("流程未启动或已执行完成,取消申请失败"); @@ -590,12 +610,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask Process process = bpmnModel.getMainProcess(); List endNodes = process.findFlowElementsOfType(EndEvent.class, false); if (CollectionUtils.isNotEmpty(endNodes)) { - // TODO 取消流程为什么要设置流程发起人? -// SysUser loginUser = SecurityUtils.getLoginUser().getUser(); -// Authentication.setAuthenticatedUserId(loginUser.getUserId().toString()); - -// taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(), -// StringUtils.isBlank(flowTaskVo.getComment()) ? "取消申请" : flowTaskVo.getComment()); + // 设置流程终止人 + Authentication.setAuthenticatedUserId(flowTaskVo.getUserId()); + taskService.addComment(flowTaskVo.getTaskId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(), + StringUtils.isBlank(flowTaskVo.getComment()) ? "取消申请" : flowTaskVo.getComment()); // 获取当前流程最后一个节点 String endId = endNodes.get(0).getId(); List executions = runtimeService.createExecutionQuery() @@ -619,50 +637,64 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask */ @Override public AjaxResult revokeProcess(FlowTaskVo flowTaskVo) { - Task task = taskService.createTaskQuery() - .processInstanceId(flowTaskVo.getInstanceId()) + String procInsId = flowTaskVo.getInstanceId(); + String taskId = flowTaskVo.getTaskId(); + // 校验流程是否结束 + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery() + .processInstanceId(procInsId) + .active() .singleResult(); - if (task == null) { - throw new BaseException("流程未启动或已执行完成,无法撤回"); + if(ObjectUtil.isNull(processInstance)) { + throw new RuntimeException("流程已结束或已挂起,无法执行撤回操作"); } + // 获取待撤回任务实例 + HistoricTaskInstance currTaskIns = historyService.createHistoricTaskInstanceQuery() + .taskId(taskId) + .taskAssignee(flowTaskVo.getUserId()) + .singleResult(); + if (ObjectUtil.isNull(currTaskIns)) { + throw new RuntimeException("当前任务无法执行撤回操作或不存在。"); + } + // 获取 bpmn 模型 + BpmnModel bpmnModel = repositoryService.getBpmnModel(currTaskIns.getProcessDefinitionId()); + UserTask currUserTask = ModelUtils.getUserTaskByKey(bpmnModel, currTaskIns.getTaskDefinitionKey()); + // 查找下一级用户任务列表 + List nextUserTaskList = ModelUtils.findNextUserTasks(currUserTask); + List nextUserTaskKeys = nextUserTaskList.stream().map(UserTask::getId).collect(Collectors.toList()); - SysUser loginUser = SecurityUtils.getLoginUser().getSysUser(); - List htiList = historyService.createHistoricTaskInstanceQuery() - .processInstanceId(task.getProcessInstanceId()) - .orderByTaskCreateTime() - .asc() + // 获取当前节点之后已完成的流程历史节点 + List finishedTaskInsList = historyService.createHistoricTaskInstanceQuery() + .processInstanceId(procInsId) + .taskCreatedAfter(currTaskIns.getEndTime()) + .finished() .list(); - String myTaskId = null; - for (HistoricTaskInstance hti : htiList) { - if (loginUser.getUserId().toString().equals(hti.getAssignee())) { - myTaskId = hti.getId(); - break; + for (HistoricTaskInstance finishedTaskInstance : finishedTaskInsList) { + // 检查已完成流程历史节点是否存在下一级中 + if (CollUtil.contains(nextUserTaskKeys, finishedTaskInstance.getTaskDefinitionKey())) { + throw new RuntimeException("下一流程已处理,无法执行撤回操作"); } } - if (null == myTaskId) { - throw new BaseException("该任务非当前用户提交,无法撤回"); - } - List historicTaskInstanceList = historyService - .createHistoricTaskInstanceQuery() - .processInstanceId(task.getProcessInstanceId()) - .orderByHistoricTaskInstanceStartTime() - .asc() - .list(); - Iterator it = historicTaskInstanceList.iterator(); - //循环节点,获取当前节点的上一节点的key - String tarKey = ""; - while (it.hasNext()) { - HistoricTaskInstance his = it.next(); - if (!task.getTaskDefinitionKey().equals(his.getTaskDefinitionKey())) { - tarKey = his.getTaskDefinitionKey(); + // 获取所有激活的任务节点,找到需要撤回的任务 + List activateTaskList = taskService.createTaskQuery().processInstanceId(procInsId).list(); + List revokeExecutionIds = new ArrayList<>(); + for (Task task : activateTaskList) { + // 检查激活的任务节点是否存在下一级中,如果存在,则加入到需要撤回的节点 + if (CollUtil.contains(nextUserTaskKeys, task.getTaskDefinitionKey())) { + // 添加撤回审批信息 + taskService.setAssignee(task.getId(), flowTaskVo.getUserId()); + taskService.addComment(task.getId(), task.getProcessInstanceId(), FlowComment.REVOKE.getType(), flowTaskVo.getAssignee() + "撤回流程审批"); + revokeExecutionIds.add(task.getExecutionId()); } } - // 跳转节点 - runtimeService.createChangeActivityStateBuilder() - .processInstanceId(flowTaskVo.getInstanceId()) - .moveActivityIdTo(task.getTaskDefinitionKey(), tarKey) - .changeState(); - + try { + runtimeService.createChangeActivityStateBuilder() + .processInstanceId(procInsId) + .moveExecutionsToSingleActivityId(revokeExecutionIds, currTaskIns.getTaskDefinitionKey()).changeState(); + } catch (FlowableObjectNotFoundException e) { + throw new RuntimeException("未找到流程实例,流程可能已发生变化"); + } catch (FlowableException e) { + throw new RuntimeException("执行撤回操作失败"); + } return AjaxResult.success(); } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/BusExamUserController.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/BusExamUserController.java index d39196fd..7bb69475 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/BusExamUserController.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/BusExamUserController.java @@ -1,5 +1,6 @@ package com.yanzhu.manage.controller; +import com.yanzhu.common.core.utils.StringUtils; import com.yanzhu.common.core.utils.poi.ExcelUtil; import com.yanzhu.common.core.web.controller.BaseController; import com.yanzhu.common.core.web.domain.AjaxResult; @@ -63,6 +64,22 @@ public class BusExamUserController extends BaseController return success(busExamUserService.selectBusExamUserById(id)); } + /** + * 获取用户试卷详细信息 + * @RequiresPermissions("manage:busExamUser:query") + */ + @GetMapping(value = "/last/{userId}") + public AjaxResult findBusExamUserList(@PathVariable("userId") Long userId) + { + BusExamUser query = new BusExamUser(); + query.setUserId(userId); + List list = busExamUserService.selectBusExamUserList(query); + if(StringUtils.isNotEmpty(list)){ + return success(busExamUserService.selectBusExamUserById(list.get(0).getId())); + } + return success(); + } + /** * 修改用户试卷 */ diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/BusTrainingVideoUserController.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/BusTrainingVideoUserController.java index 087367f1..37d670ea 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/BusTrainingVideoUserController.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/BusTrainingVideoUserController.java @@ -63,6 +63,18 @@ public class BusTrainingVideoUserController extends BaseController return success(busTrainingVideoUserService.selectBusTrainingVideoUserById(id)); } + /** + * 获取用户培训视频详细信息 + * @RequiresPermissions("manage:busTrainingVideoUser:query") + */ + @GetMapping(value = "/last/{userId}") + public AjaxResult findBusTrainingVideoUserLast(@PathVariable("userId") Long userId) + { + BusTrainingVideoUser query = new BusTrainingVideoUser(); + query.setUserId(userId); + return success(busTrainingVideoUserService.selectBusTrainingVideoUserList(query)); + } + /** * 新增用户培训视频 */ diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProProjectInfoSubdeptsController.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProProjectInfoSubdeptsController.java index 0b66a663..d47dfa8c 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProProjectInfoSubdeptsController.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProProjectInfoSubdeptsController.java @@ -55,8 +55,8 @@ public class ProProjectInfoSubdeptsController extends BaseController /** * 获取分包单位详细信息 + * @RequiresPermissions("manage:proProjectInfoSubdepts:query") */ - @RequiresPermissions("manage:proProjectInfoSubdepts:query") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProProjectInfoSubdeptsUsersController.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProProjectInfoSubdeptsUsersController.java index 4614b3f8..59847f5c 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProProjectInfoSubdeptsUsersController.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProProjectInfoSubdeptsUsersController.java @@ -1,14 +1,13 @@ package com.yanzhu.manage.controller; import com.alibaba.fastjson2.JSONObject; -import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A; -import com.yanzhu.common.core.utils.DateUtils; import com.yanzhu.common.core.utils.poi.ExcelUtil; import com.yanzhu.common.core.web.controller.BaseController; import com.yanzhu.common.core.web.domain.AjaxResult; import com.yanzhu.common.core.web.page.TableDataInfo; import com.yanzhu.common.log.annotation.Log; import com.yanzhu.common.log.enums.BusinessType; +import com.yanzhu.common.security.annotation.InnerAuth; import com.yanzhu.common.security.annotation.RequiresPermissions; import com.yanzhu.manage.domain.ProProjectInfoSubdeptsUsers; import com.yanzhu.manage.service.IProProjectInfoSubdeptsUsersService; @@ -18,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; -import java.util.Calendar; import java.util.Date; import java.util.List; @@ -97,8 +95,8 @@ public class ProProjectInfoSubdeptsUsersController extends BaseController /** * 获取分包单位工人详细信息 + * @RequiresPermissions("manage:proProjectInfoSubdeptsUsers:query") */ - @RequiresPermissions("manage:proProjectInfoSubdeptsUsers:query") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { @@ -137,6 +135,24 @@ public class ProProjectInfoSubdeptsUsersController extends BaseController { return toAjax(proProjectInfoSubdeptsUsersService.deleteProProjectInfoSubdeptsUsersByIds(ids)); } + + /** + * 分包人员审批通过信息同步 + */ + @InnerAuth + @GetMapping("/approveSubDeptsUser/{busKey}") + public AjaxResult approveSubDeptsUser(@PathVariable("busKey") Long busKey) + { + proProjectInfoSubdeptsUsersService.approveSubDeptsUser(busKey); + return success(); + } + + /** + * 修改人员进场状态 + * @param ids + * @param state + * @return + */ @RequiresPermissions("manage:proProjectInfoSubdeptsUsers:remove") @PostMapping("/enterState/{state}") public AjaxResult updateEnterState(@RequestBody List ids,@PathVariable int state){ 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 b605b504..3c7bb59c 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 @@ -188,4 +188,14 @@ public class WxController extends BaseController { { return success(proProjectInfoSubdeptsUsersService.submitUserSignets(signetFileVo)); } + + /** + * 确认签署承诺书 + */ + @GetMapping("/v1/startFlowableProcess") + public AjaxResult startFlowableProcess() + { + proProjectInfoSubdeptsUsersService.startFlowableProcess(); + return success(); + } } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IBusTrainingVideoUserService.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IBusTrainingVideoUserService.java index 3adc44c0..761c80f7 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IBusTrainingVideoUserService.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IBusTrainingVideoUserService.java @@ -77,4 +77,5 @@ public interface IBusTrainingVideoUserService * @param id 用户培训视频主键 */ public int finishEduVideo(Long id); + } 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 e91e493c..df4dd748 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 @@ -13,6 +13,7 @@ import com.yanzhu.manage.domain.ProProjectInfoSubdepts; */ public interface IProProjectInfoSubdeptsService { + /** * 查询分包单位 * 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 e026882b..c11154f8 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 @@ -1,11 +1,10 @@ package com.yanzhu.manage.service; -import java.util.List; -import java.util.Map; - import com.yanzhu.manage.domain.ProProjectInfoSubdeptsUsers; import com.yanzhu.manage.domain.SignetFileVo; +import java.util.List; + /** * 分包单位工人Service接口 * @@ -14,6 +13,7 @@ import com.yanzhu.manage.domain.SignetFileVo; */ public interface IProProjectInfoSubdeptsUsersService { + /** * 查询分包单位工人 * @@ -93,6 +93,17 @@ public interface IProProjectInfoSubdeptsUsersService */ public ProProjectInfoSubdeptsUsers submitUserSignets(SignetFileVo signetFileVo); + /** + * 启动工作流【演示...】 + */ + public void startFlowableProcess(); + + /** + * 分包人员审批通过信息同步 + * @param id + */ + public void approveSubDeptsUser(Long id); + /** * 大屏-项目详情-在岗人员统计 * @param proProjectInfoSubdeptsUsers diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/BusExamUserServiceImpl.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/BusExamUserServiceImpl.java index b3da962d..00efea63 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/BusExamUserServiceImpl.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/BusExamUserServiceImpl.java @@ -235,7 +235,6 @@ public class BusExamUserServiceImpl implements IBusExamUserService busExamUser.setCreateTime(DateUtils.getNowDate()); busExamUser.setFullMark(findExamInfo.getFullMark()); busExamUser.setPassMark(findExamInfo.getPassMark()); - busExamUser.setUseTimes(DateUtils.getTime()); busExamUserMapper.insertBusExamUser(busExamUser); List busExamUserResultList = new ArrayList<>(); @@ -442,6 +441,9 @@ public class BusExamUserServiceImpl implements IBusExamUserService } } busExamUser.setUserMark(mark); + long stimes = busExamUser.getCreateTime().getTime(); + long etimes = DateUtils.getNowDate().getTime(); + busExamUser.setUseTimes(Convert.toStr(etimes-stimes)); if(busExamUser.getPassMark()>mark){ busExamUser.setResStatus(ShiFouEnums.FOU.getCode()); }else{ 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 aa30e01b..809bc70e 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,27 +1,21 @@ 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.domain.R; 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.domain.*; 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.ProProjectInfoSubdeptsMapper; import com.yanzhu.manage.mapper.ProProjectInfoSubdeptsUsersMapper; import com.yanzhu.manage.service.IProProjectInfoSubdeptsUsersService; import com.yanzhu.manage.service.IUniService; @@ -38,8 +32,6 @@ 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.*; @@ -69,11 +61,14 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu private RemoteFlowService remoteFlowService; @Autowired - private ProProjectInfoSubdeptsUsersMapper proProjectInfoSubdeptsUsersMapper; + private ProProjectInfoSubdeptsMapper proProjectInfoSubdeptsMapper; @Autowired private ProProjectInfoSubdeptsGroupMapper proProjectInfoSubdeptsGroupMapper; + @Autowired + private ProProjectInfoSubdeptsUsersMapper proProjectInfoSubdeptsUsersMapper; + private static final Logger log = LoggerFactory.getLogger(ProProjectInfoSubdeptsUsersServiceImpl.class); /** @@ -212,6 +207,7 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu user.setSex(StringUtils.judgeGender(user.getCardCode())); user.setCreateBy(DataSourceEnuns.APP.getInfo()); user.setCreateTime(DateUtils.getNowDate()); + user.setRemark(proProjectInfoSubdeptsUsers.getSubDeptName()); Long userId = remoteUserService.registerUserInfo(user, SecurityConstants.INNER).getData(); proProjectInfoSubdeptsUsers.setUserId(userId); proProjectInfoSubdeptsUsersMapper.insertProProjectInfoSubdeptsUsers(proProjectInfoSubdeptsUsers); @@ -352,6 +348,7 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu user.setSex(StringUtils.judgeGender(user.getCardCode())); user.setUpdateBy(DataSourceEnuns.APP.getInfo()); user.setUpdateTime(DateUtils.getNowDate()); + user.setRemark(proProjectInfoSubdeptsUsers.getSubDeptName()); Long userId = remoteUserService.registerUserInfo(user, SecurityConstants.INNER).getData(); proProjectInfoSubdeptsUsers.setUserId(userId); proProjectInfoSubdeptsUsersMapper.updateProProjectInfoSubdeptsUsers(proProjectInfoSubdeptsUsers); @@ -482,12 +479,56 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu Map variables = new HashMap<>(); variables.put("INITIATOR",proSubdeptsUser.getUserId()); variables.put("userName",proSubdeptsUser.getUser().getNickName()); + variables.put("userDeptName",proSubdeptsUser.getSubDeptName()); + variables.put("comId",proSubdeptsUser.getComId()); + variables.put("comName",proSubdeptsUser.getComName()); + variables.put("proId",proSubdeptsUser.getProjectId()); + variables.put("proName",proSubdeptsUser.getProjectName()); variables.put("businessKey",proSubdeptsUser.getId()); remoteFlowService.startDefinitionByParams(procDefId,variables,SecurityConstants.INNER); } return proSubdeptsUser; } + /** + * 启动工作流【演示...】 + */ + @Override + public void startFlowableProcess(){ + String procDefId = Convert.toStr("flow_bg7gh1jg:1:102504"); + // 启动工作流审批节点... + Map variables = new HashMap<>(); + variables.put("INITIATOR",17); + variables.put("userName","姜玉琦_TEST"); + variables.put("userDeptName","中国西电集团_TEST"); + variables.put("comId","101"); + variables.put("comName","建安公司"); + variables.put("proId","116"); + variables.put("proName","泾河新城"); + variables.put("businessKey",12); + remoteFlowService.startDefinitionByParams(procDefId,variables,SecurityConstants.INNER); + } + + /** + * 分包人员审批通过信息同步 + * @param id + */ + @Override + public void approveSubDeptsUser(Long id){ + ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers = proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersById(id); + if(Objects.equals(proProjectInfoSubdeptsUsers.getUserPost(),UserPostEnums.WTDL.getCode())){ + ProProjectInfoSubdepts proProjectInfoSubdepts = proProjectInfoSubdeptsMapper.selectProProjectInfoSubdeptsById(proProjectInfoSubdeptsUsers.getSubDeptId()); + proProjectInfoSubdepts.setApproveStatus(ApproveStatus.exempt.getCode()); + proProjectInfoSubdeptsMapper.updateProProjectInfoSubdepts(proProjectInfoSubdepts); + }else if(Objects.equals(proProjectInfoSubdeptsUsers.getUserPost(),UserPostEnums.BZZ.getCode())){ + ProProjectInfoSubdeptsGroup proProjectInfoSubdeptsGroup = proProjectInfoSubdeptsGroupMapper.selectProProjectInfoSubdeptsGroupById(proProjectInfoSubdeptsUsers.getSubDeptGroup()); + proProjectInfoSubdeptsGroup.setApproveStatus(ApproveStatus.exempt.getCode()); + proProjectInfoSubdeptsGroupMapper.updateProProjectInfoSubdeptsGroup(proProjectInfoSubdeptsGroup); + } + proProjectInfoSubdeptsUsers.setApproveStatus(ApproveStatus.exempt.getCode()); + proProjectInfoSubdeptsUsersMapper.updateProProjectInfoSubdeptsUsers(proProjectInfoSubdeptsUsers); + } + /** * 封装用户文件参数... * @return diff --git a/yanzhu-ui-app/miniprogram/pages/project_qr/index.js b/yanzhu-ui-app/miniprogram/pages/project_qr/index.js index c433f2eb..3796aa87 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_qr/index.js +++ b/yanzhu-ui-app/miniprogram/pages/project_qr/index.js @@ -135,7 +135,7 @@ Page({ console.log(options); if (options && options.SIGID && options.QRPID) { this.getDictCache(options.SIGID); - //this.getMaOpenId(); + this.getMaOpenId(); this.getProjectInfo(options.QRPID); if (options.PARID) { this.setData({ @@ -179,9 +179,6 @@ Page({ userPostList: _userPostList, "form.projectId": options.QRPID, }); - this.getPhoneNumber({ - 'data': '18189138538' - }); } else { app.toast("请求参数异常,请重新扫码..."); // wx.redirectTo({ @@ -272,126 +269,125 @@ Page({ * @param {*} e */ getPhoneNumber(e) { - // if (e.detail.code) { - // let data = { - // openId: getOpenId(), - // sessionKey: getSessionKey(), - // iv: e.detail.iv, - // encryptedData: e.detail.encryptedData - // } - // getMaPhoneNumber(data).then(res => { - // if (res.code == 200) { - //let phoneNumber = res.data; - let phoneNumber = e.data; - //使用手机号码查询详情 - 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; - if (deptRes.data.subDeptInfos.legalPersonCardImgPos) { - deptRes.data.subDeptInfos.legalPersonCardImgPos = (this.data.imgBase + deptRes.data.subDeptInfos.legalPersonCardImgPos).split(','); - } - if (deptRes.data.subDeptInfos.legalPersonCardImgInv) { - deptRes.data.subDeptInfos.legalPersonCardImgInv = (this.data.imgBase + deptRes.data.subDeptInfos.legalPersonCardImgInv).split(','); - } + if (e.detail.code) { + let data = { + openId: getOpenId(), + sessionKey: getSessionKey(), + iv: e.detail.iv, + encryptedData: e.detail.encryptedData + } + getMaPhoneNumber(data).then(res => { + if (res.code == 200) { + let phoneNumber = res.data; + //使用手机号码查询详情 + 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; + if (deptRes.data.subDeptInfos.legalPersonCardImgPos) { + deptRes.data.subDeptInfos.legalPersonCardImgPos = (this.data.imgBase + deptRes.data.subDeptInfos.legalPersonCardImgPos).split(','); + } + if (deptRes.data.subDeptInfos.legalPersonCardImgInv) { + deptRes.data.subDeptInfos.legalPersonCardImgInv = (this.data.imgBase + deptRes.data.subDeptInfos.legalPersonCardImgInv).split(','); + } + } + if (deptRes.data.proProjectInfoSubdeptsUsers && deptRes.data.proProjectInfoSubdeptsUsers.user) { + if (deptRes.data.proProjectInfoSubdeptsUsers.user.cardImgPos) { + deptRes.data.leaderCardImgPos = (this.data.imgBase + deptRes.data.proProjectInfoSubdeptsUsers.user.cardImgPos).split(','); + } + if (deptRes.data.proProjectInfoSubdeptsUsers.user.cardImgInv) { + deptRes.data.leaderCardImgInv = (this.data.imgBase + deptRes.data.proProjectInfoSubdeptsUsers.user.cardImgInv).split(','); + } + if (deptRes.data.proProjectInfoSubdeptsUsers.user.userPicture) { + deptRes.data.leaderUserPicture = (this.data.imgBase + deptRes.data.proProjectInfoSubdeptsUsers.user.userPicture).split(','); + } + if (deptRes.data.proProjectInfoSubdeptsUsers.subDeptPowerPath) { + deptRes.data.subDeptLeaderPowerPath = (this.data.imgBase + deptRes.data.proProjectInfoSubdeptsUsers.subDeptPowerPath).split(','); + } + if (deptRes.data.businessLicensePath) { + deptRes.data.businessLicensePath = (this.data.imgBase + deptRes.data.businessLicensePath).split(','); + } + } + this.setData({ + form: deptRes.data, + userPhoneNumber: phoneNumber, + active: deptRes.data.subStep + }); + if (deptRes.data.proProjectInfoSubdeptsUsers.subStep == 1) { + this.initBusEduVideos(false); + } else if (deptRes.data.proProjectInfoSubdeptsUsers.subStep == 2) { + this.initBusEduQuestion(false); + } else if (deptRes.data.proProjectInfoSubdeptsUsers.subStep == 3) { + this.startSignFile(false); + } + } else { + this.setData({ + userPhoneNumber: phoneNumber, + "form.subDeptLeaderPhone": phoneNumber, + }); + } + }); + } else { + findProSubDeptsUser(this.data.proId, phoneNumber).then(userRes => { + if (userRes.code == 200 && userRes.data) { + 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.phoneNumber": phoneNumber, + 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, + "form.phoneNumber": phoneNumber, + }); + } + }); } - if (deptRes.data.proProjectInfoSubdeptsUsers && deptRes.data.proProjectInfoSubdeptsUsers.user) { - if (deptRes.data.proProjectInfoSubdeptsUsers.user.cardImgPos) { - deptRes.data.leaderCardImgPos = (this.data.imgBase + deptRes.data.proProjectInfoSubdeptsUsers.user.cardImgPos).split(','); - } - if (deptRes.data.proProjectInfoSubdeptsUsers.user.cardImgInv) { - deptRes.data.leaderCardImgInv = (this.data.imgBase + deptRes.data.proProjectInfoSubdeptsUsers.user.cardImgInv).split(','); - } - if (deptRes.data.proProjectInfoSubdeptsUsers.user.userPicture) { - deptRes.data.leaderUserPicture = (this.data.imgBase + deptRes.data.proProjectInfoSubdeptsUsers.user.userPicture).split(','); - } - if (deptRes.data.proProjectInfoSubdeptsUsers.subDeptPowerPath) { - deptRes.data.subDeptLeaderPowerPath = (this.data.imgBase + deptRes.data.proProjectInfoSubdeptsUsers.subDeptPowerPath).split(','); - } - if (deptRes.data.businessLicensePath) { - deptRes.data.businessLicensePath = (this.data.imgBase + deptRes.data.businessLicensePath).split(','); - } - } - this.setData({ - form: deptRes.data, - userPhoneNumber: phoneNumber, - active: deptRes.data.subStep - }); - if (deptRes.data.proProjectInfoSubdeptsUsers.subStep == 1) { - this.initBusEduVideos(false); - } else if (deptRes.data.proProjectInfoSubdeptsUsers.subStep == 2) { - this.initBusEduQuestion(false); - } else if (deptRes.data.proProjectInfoSubdeptsUsers.subStep == 3) { - this.startSignFile(false); - } - } else { - this.setData({ - userPhoneNumber: phoneNumber, - "form.subDeptLeaderPhone": phoneNumber, - }); } - }); + }) } else { - findProSubDeptsUser(this.data.proId, phoneNumber).then(userRes => { - if (userRes.code == 200 && userRes.data) { - 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.phoneNumber": phoneNumber, - 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, - "form.phoneNumber": phoneNumber, - }); - } - }); + //用户决绝授权 + app.toast("请允许微信手机号一键登录"); } - // } - // }) - // } else { - // //用户决绝授权 - // app.toast("请允许微信手机号一键登录"); - // } }, /** @@ -1051,7 +1047,7 @@ Page({ onChageCraftType(e) { //设置工种岗位 let craftPostList = []; - console.log("this.data.craftPostAllOrginList",this.data.craftPostAllOrginList) + console.log("this.data.craftPostAllOrginList", this.data.craftPostAllOrginList) this.data.craftPostAllOrginList.forEach(item => { if (item.remark == e.detail.id) { craftPostList.push({ diff --git a/yanzhu-ui-app/miniprogram/project.private.config.json b/yanzhu-ui-app/miniprogram/project.private.config.json index c3c9144a..cdd6323e 100644 --- a/yanzhu-ui-app/miniprogram/project.private.config.json +++ b/yanzhu-ui-app/miniprogram/project.private.config.json @@ -11,7 +11,7 @@ { "name": "pages/project_qr/index", "pathName": "pages/project_qr/index", - "query": "QRPID=116&SIGID=3&PARID=16", + "query": "QRPID=116&SIGID=1", "launchMode": "default", "scene": null }, diff --git a/yanzhu-ui-vue3/src/App.vue b/yanzhu-ui-vue3/src/App.vue index c28dbbf1..045bc42e 100644 --- a/yanzhu-ui-vue3/src/App.vue +++ b/yanzhu-ui-vue3/src/App.vue @@ -22,5 +22,48 @@ onMounted(() => { .el-pagination { right: 20px; } +} +.el-sub-menu__title{ + position: relative; + .todo_num_tips{ + top:20px; + position: absolute; + right: 36px; + background-color: #f56c6c; + border-radius: 10px; + color: #fff; + display: inline-block; + font-size: 12px; + height: 18px; + line-height: 18px; + padding: 0 6px; + text-align: center; + white-space: nowrap; + border: 1px solid #fff; + cursor: pointer; + top: 16px; + display: none; + } +} +.nest-menu{ + position: relative; + .todo_num_tips{ + position: absolute; + right: 18px; + background-color: #f56c6c; + border-radius: 10px; + color: #fff; + display: inline-block; + font-size: 12px; + height: 18px; + line-height: 18px; + padding: 0 6px; + text-align: center; + white-space: nowrap; + border: 1px solid #fff; + cursor: pointer; + top: 16px; + display: none; + } } \ No newline at end of file diff --git a/yanzhu-ui-vue3/src/api/flowable/businessKey.js b/yanzhu-ui-vue3/src/api/flowable/businessKey.js new file mode 100644 index 00000000..43baabe3 --- /dev/null +++ b/yanzhu-ui-vue3/src/api/flowable/businessKey.js @@ -0,0 +1,64 @@ +import request from '@/utils/request' + +// 查询业务流程列表 +export function allList(query) { + return request({ + url: '/flowable/businessKey/allList', + method: 'get', + params: query + }) +} + +// 统计业务流程列表 +export function queryCount(query) { + return request({ + url: '/flowable/businessKey/queryCount', + method: 'get', + params: query + }) +} + +// 统计业务流程列表 +export function findMyTasks() { + return request({ + url: '/flowable/businessKey/findMyTask', + method: 'get' + }) +} + +// 根据业务流程查询操作日志 +export function findCommentByProcInsId(query) { + return request({ + url: '/flowable/businessKey/findCommentByProcInsId', + method: 'get', + params: query + }) +} + +// 根据业务流程查询表单数据 +export function findFormDatasByProcInsId(query) { + return request({ + url: '/flowable/businessKey/findFormDatasByProcInsId', + method: 'get', + params: query + }) +} + +// 根据条件查询我的代办任务 +export function myAwaitFlowTaskList(query) { + return request({ + url: '/flowable/businessKey/myAwaitFlowTaskList', + method: 'get', + params: query + }) +} + +// 根据条件查询我的已办任务 +export function myFinishedFlowTaskList(query) { + return request({ + url: '/flowable/businessKey/myFinishedFlowTaskList', + method: 'get', + params: query + }) +} + diff --git a/yanzhu-ui-vue3/src/api/manage/busExamUser.js b/yanzhu-ui-vue3/src/api/manage/busExamUser.js index efb85e79..1c0f7dbf 100644 --- a/yanzhu-ui-vue3/src/api/manage/busExamUser.js +++ b/yanzhu-ui-vue3/src/api/manage/busExamUser.js @@ -17,6 +17,14 @@ export function getBusExamUser(id) { }) } +// 查询用户试卷详细 +export function getBusExamUserLast(userId) { + return request({ + url: '/manage/busExamUser/last/' + userId, + method: 'get' + }) +} + // 新增用户试卷 export function addBusExamUser(data) { return request({ diff --git a/yanzhu-ui-vue3/src/api/manage/busTrainingVideoUser.js b/yanzhu-ui-vue3/src/api/manage/busTrainingVideoUser.js index 140d4b27..43e4be1b 100644 --- a/yanzhu-ui-vue3/src/api/manage/busTrainingVideoUser.js +++ b/yanzhu-ui-vue3/src/api/manage/busTrainingVideoUser.js @@ -17,6 +17,14 @@ export function getBusTrainingVideoUser(id) { }) } +// 查询用户培训视频详细 +export function getBusTrainingVideoUserLast(id) { + return request({ + url: '/manage/busTrainingVideoUser/last/' + id, + method: 'get' + }) +} + // 新增用户培训视频 export function addBusTrainingVideoUser(data) { return request({ diff --git a/yanzhu-ui-vue3/src/layout/components/Navbar.vue b/yanzhu-ui-vue3/src/layout/components/Navbar.vue index 7073da16..5701c069 100644 --- a/yanzhu-ui-vue3/src/layout/components/Navbar.vue +++ b/yanzhu-ui-vue3/src/layout/components/Navbar.vue @@ -59,7 +59,8 @@ const userStore = useUserStore() const settingsStore = useSettingsStore() function toggleSideBar() { - appStore.toggleSideBar() + appStore.toggleSideBar(); + userStore.getTasks(); // 动态获取用户代办任务 } function handleCommand(command) { diff --git a/yanzhu-ui-vue3/src/layout/components/Sidebar/SidebarItem.vue b/yanzhu-ui-vue3/src/layout/components/Sidebar/SidebarItem.vue index c423fb18..67a101e2 100644 --- a/yanzhu-ui-vue3/src/layout/components/Sidebar/SidebarItem.vue +++ b/yanzhu-ui-vue3/src/layout/components/Sidebar/SidebarItem.vue @@ -4,6 +4,7 @@ + 0 @@ -12,6 +13,7 @@ @@ -49,6 +51,7 @@ const props = defineProps({ }) const onlyOneChild = ref({}); +const taskMenus = ref(['Task','Todo']); function hasOneShowingChild(children = [], parent) { if (!children) { diff --git a/yanzhu-ui-vue3/src/main.js b/yanzhu-ui-vue3/src/main.js index cdba650b..be73346b 100644 --- a/yanzhu-ui-vue3/src/main.js +++ b/yanzhu-ui-vue3/src/main.js @@ -24,7 +24,7 @@ import elementIcons from '@/components/SvgIcon/svgicon' import './permission' // permission control import { useDict } from '@/utils/dict' -import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi' +import { parseTime, resetForm, addDateRange, formatDuraDate, formatDuraTime, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi' // 分页组件 import Pagination from '@/components/Pagination' @@ -55,6 +55,8 @@ app.config.globalProperties.parseTime = parseTime app.config.globalProperties.resetForm = resetForm app.config.globalProperties.handleTree = handleTree app.config.globalProperties.addDateRange = addDateRange +app.config.globalProperties.formatDuraDate = formatDuraDate +app.config.globalProperties.formatDuraTime = formatDuraTime app.config.globalProperties.selectDictLabel = selectDictLabel app.config.globalProperties.selectDictLabels = selectDictLabels app.config.globalProperties.$tryToJson=(str,df)=>{ diff --git a/yanzhu-ui-vue3/src/permission.js b/yanzhu-ui-vue3/src/permission.js index 13f1261a..af9b30c6 100644 --- a/yanzhu-ui-vue3/src/permission.js +++ b/yanzhu-ui-vue3/src/permission.js @@ -31,9 +31,10 @@ router.beforeEach((to, from, next) => { // 根据roles权限生成可访问的路由表 accessRoutes.forEach(route => { if (!isHttp(route.path)) { - router.addRoute(route) // 动态添加可访问路由表 + router.addRoute(route); // 动态添加可访问路由表 } }) + useUserStore().getTasks(); // 动态获取用户代办任务 next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 }) }).catch(err => { diff --git a/yanzhu-ui-vue3/src/store/modules/user.js b/yanzhu-ui-vue3/src/store/modules/user.js index ccf6877a..c69458bf 100644 --- a/yanzhu-ui-vue3/src/store/modules/user.js +++ b/yanzhu-ui-vue3/src/store/modules/user.js @@ -1,4 +1,5 @@ import { login, logout, getInfo } from '@/api/login' +import { findMyTasks } from '@/api/flowable/businessKey' import { getToken, setToken, removeToken } from '@/utils/auth' import defAva from '@/assets/images/profile.jpg' @@ -7,7 +8,9 @@ const useUserStore = defineStore( { state: () => ({ token: getToken(), + uid: '', name: '', + nickName: '', avatar: '', compInfo:{}, roles: [], @@ -48,7 +51,9 @@ const useUserStore = defineStore( } else { this.roles = ['ROLE_DEFAULT'] } + this.uid = user.userId; this.name = user.userName; + this.nickName = user.nickName; this.compInfo=user.comp; this.avatar = avatar; this.currentComId = user.activeComId; @@ -61,6 +66,38 @@ const useUserStore = defineStore( }) }) }, + // 获取用户代办 + getTasks(){ + return new Promise((resolve, reject) => { + findMyTasks().then(response => { + let todos = document.querySelectorAll(".tips_Todo"); + let tasks = document.querySelectorAll(".tips_Task"); + if (todos.length > 0) { + todos.forEach(el => { + el.innerHTML = response.data.todo; + if (response.data.todo > 0) { + el.style.display = "inline"; + } else { + el.style.display = "none"; + } + }); + } + if (tasks.length > 0) { + tasks.forEach(el => { + el.innerHTML = response.data.todo; + if (response.data.todo > 0) { + el.style.display = "inline"; + } else { + el.style.display = "none"; + } + }); + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, // 退出系统 logOut() { return new Promise((resolve, reject) => { diff --git a/yanzhu-ui-vue3/src/utils/ruoyi.js b/yanzhu-ui-vue3/src/utils/ruoyi.js index 4efca08f..67951f35 100644 --- a/yanzhu-ui-vue3/src/utils/ruoyi.js +++ b/yanzhu-ui-vue3/src/utils/ruoyi.js @@ -201,6 +201,85 @@ export function handleTree(data, id, parentId, children) { return tree; } +/** +* 时间格式化为时间差 +* @param {*} duration 时间分钟 +*/ +export function formatDuraDate(duration){ + let day = 0; + let hours = 0; + let min = parseInt(duration); + if (min > 1440) { + day = parseInt(min / 1440); + min = min % 1440; + if (min > 60) { + hours = parseInt(min / 60); + min = min % 60; + } + } else if (min > 60) { + hours = parseInt(min / 60); + min = min % 60; + } + if (day > 0) { + if (day < 10) day = "0" + day; + if (hours < 10) hours = "0" + hours; + if (min < 10) min = "0" + min; + return day + "天" + hours + "小时" + min + "分钟"; + } + if (hours > 0) { + if (hours < 10) hours = "0" + hours; + if (min < 10) min = "0" + min; + return hours + "小时" + min + "分钟"; + } + if (min > 0) { + if (min < 10) min = "0" + min; + return min + "分钟"; + } + if (min == 0) { + return "1分钟"; + } +} + +/** +* 时间格式化为时间差 +* @param {*} val 时间 +*/ +export function formatDuraTime(val){ + // 计算出相差天数 + let days = Math.floor(val / (24 * 3600 * 1000)); + // 计算出小时数 + let leave1 = val % (24 * 3600 * 1000); // 计算天数后剩余的毫秒数 + let hours = Math.floor(leave1 / (3600 * 1000)); + // 计算相差分钟数 + let leave2 = leave1 % (3600 * 1000); // 计算小时数后剩余的毫秒数 + let minutes = Math.floor(leave2 / (60 * 1000)); + // 计算相差秒数 + let leave3 = leave2 % (60 * 1000); // 计算分钟数后剩余的毫秒数 + let seconds = Math.round(leave3 / 1000); + if (days > 0) { + if (days < 10) days = "0" + days; + if (hours < 10) hours = "0" + hours; + if (minutes < 10) minutes = "0" + minutes; + if (seconds < 10) seconds = "0" + seconds; + return days + "天" + hours + "小时" + minutes + "分钟" + seconds + "秒"; + } + if (hours > 0) { + if (hours < 10) hours = "0" + hours; + if (minutes < 10) minutes = "0" + minutes; + if (seconds < 10) seconds = "0" + seconds; + return hours + "小时" + minutes + "分钟" + seconds + "秒"; + } + if (minutes > 0) { + if (minutes < 10) minutes = "0" + minutes; + if (seconds < 10) seconds = "0" + seconds; + return minutes + "分钟" + seconds + "秒"; + } + if (seconds > 0) { + if (seconds < 10) seconds = "0" + seconds; + return seconds + "秒"; + } +} + /** * 参数处理 * @param {*} params 参数 diff --git a/yanzhu-ui-vue3/src/views/flowable/definition/index.vue b/yanzhu-ui-vue3/src/views/flowable/definition/index.vue index 2d3488fb..0c609046 100644 --- a/yanzhu-ui-vue3/src/views/flowable/definition/index.vue +++ b/yanzhu-ui-vue3/src/views/flowable/definition/index.vue @@ -17,7 +17,7 @@ @keyup.enter="handleQuery" /> - +
- - + +
- - + + diff --git a/yanzhu-ui-vue3/src/views/flowable/task/finished/index.vue b/yanzhu-ui-vue3/src/views/flowable/task/finished/index.vue index 0c634f7a..d52b6f8d 100644 --- a/yanzhu-ui-vue3/src/views/flowable/task/finished/index.vue +++ b/yanzhu-ui-vue3/src/views/flowable/task/finished/index.vue @@ -1,12 +1,42 @@