Explorar el Código

流程调整添加结束时间

yzc hace 11 meses
padre
commit
98e5322603

+ 8 - 0
hx-flow/src/main/java/com/fjhx/flow/entity/flow/po/FlowExample.java

@@ -4,9 +4,12 @@ package com.fjhx.flow.entity.flow.po;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.Version;
 import com.ruoyi.common.core.domain.BasePo;
+import lombok.Data;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.Date;
+
 /**
  * <p>
  * 流程实例
@@ -71,4 +74,9 @@ public class FlowExample extends BasePo {
     @Version
     private Integer version;
 
+    /**
+     * 流程结束时间
+     */
+    private Date endTime;
+
 }

+ 28 - 19
hx-flow/src/main/java/com/fjhx/flow/service/flow/impl/FlowProcessServiceImpl.java

@@ -757,6 +757,14 @@ public class FlowProcessServiceImpl implements FlowProcessService {
 //        flowExample.setDefinitionNodeId(jumpNode.getId());
 //        flowExample.setHandleUserId(context.getJumpHandleUserId());
         flowExample.setStatus(context.getFlowStatus().getKey());
+
+        //赋值流程结束时间
+        if (context.getFlowStatus() == FlowStatusEnum.PASS ||
+                context.getFlowStatus() == FlowStatusEnum.REJECT ||
+                context.getFlowStatus() == FlowStatusEnum.CANCELLATION) {
+            flowExample.setEndTime(new Date());
+        }
+
         boolean updateFlag = flowExampleService.updateById(flowExample);
         if (!updateFlag) {
             throw new ServiceException("流程已被处理");
@@ -985,12 +993,12 @@ public class FlowProcessServiceImpl implements FlowProcessService {
                 flowResult.setUserId(dynamicUserIdsStr);
                 return flowResult;
             case DEPT_MANAGER:
-                Long deptId ;
-                if(ObjectUtil.isEmpty(node.getJumpCondition())){
+                Long deptId;
+                if (ObjectUtil.isEmpty(node.getJumpCondition())) {
                     //没表达式取发起人部门
                     SysUser createUser = sysUserService.getById(FlowThreadLocalUtil.getFlowCreateUser());
                     deptId = createUser.getDeptId();
-                }else {
+                } else {
                     //有表达式取表达式部门
                     Expression exp = AviatorEvaluator.compile(node.getJumpCondition());
                     Object execute = exp.execute(FlowThreadLocalUtil.getTemplateData());
@@ -1016,28 +1024,28 @@ public class FlowProcessServiceImpl implements FlowProcessService {
                         .eq(SysUserIdentity::getDeptId, sysDept1.getDeptId())
                         .eq(SysUserIdentity::getIdentity, node.getHandleObjectId())
                 );
-                String identityName ;
-                switch (node.getHandleObjectId()){
-                    case  "10":
-                       identityName =  "员工";
-                    break;
-                    case  "15":
-                        identityName =  "组长";
+                String identityName;
+                switch (node.getHandleObjectId()) {
+                    case "10":
+                        identityName = "员工";
+                        break;
+                    case "15":
+                        identityName = "组长";
                         break;
-                    case  "20":
-                        identityName =  "主管";
+                    case "20":
+                        identityName = "主管";
                         break;
-                    case  "30":
-                        identityName =  "经理";
+                    case "30":
+                        identityName = "经理";
                         break;
-                    case  "40":
-                        identityName =  "总监";
+                    case "40":
+                        identityName = "总监";
                         break;
                     default:
                         identityName = "未知职级";
                 }
                 if (identityList.size() == 0) {
-                    throw new ServiceException(StrUtil.format("流程节点处理人异常:部门无部门{}!",identityName));
+                    throw new ServiceException(StrUtil.format("流程节点处理人异常:部门无部门{}!", identityName));
                 }
                 List<Long> userIds = identityList.stream().map(SysUserIdentity::getUserId).collect(Collectors.toList());
                 List<SysUser> identityUserList = sysUserService.list(Wrappers.<SysUser>lambdaQuery().in(SysUser::getUserId, userIds));
@@ -1098,7 +1106,8 @@ public class FlowProcessServiceImpl implements FlowProcessService {
                     pushUserIds.add(Long.valueOf(s));
                 }
             }
-            title = "您有一条新的待审批事项,请及时处理。";
+            FlowExample flowExample = flowExampleService.getById(flowId);
+            title = StrUtil.format("您有一条新的待审批事项,【{}】,请及时处理。", flowExample.getTitle());
         }
 
         for (Long pushUserId : pushUserIds) {
@@ -1159,7 +1168,7 @@ public class FlowProcessServiceImpl implements FlowProcessService {
                 }
                 // 如果下一节点不为结束节点
                 else {
-                    String title = "您有一条新的待审批事项,请及时处理。";
+                    String title = StrUtil.format("您有一条新的待审批事项,【{}】,请及时处理。", flowExample.getTitle());
                     for (Long userId : jumpHandleUserIdList) {
                         PushParam pushParam = new PushParam();
                         pushParam.setUserId(userId);

+ 1 - 0
hx-socket/src/main/java/com/fjhx/socket/core/WebSocketServer.java

@@ -181,6 +181,7 @@ public class WebSocketServer {
                         .and(s -> s.isNull(PushInfo::getFailureTime).or().ge(PushInfo::getFailureTime, new Date()))
                 );
                 msg.put("count", count);
+                msg.put("title", pushParam.getTitle());
                 break;
             case PUSH_NOTIFICATION:
                 msg.put("title", pushParam.getTitle());