Przeglądaj źródła

公章外带申请流程开发

zhangjq 1 rok temu
rodzic
commit
101befe48c

+ 24 - 0
zjugis-business/src/main/java/com/zjugis/business/converter/officialSeal/OfficialSealOuterConvert.java

@@ -0,0 +1,24 @@
+package com.zjugis.business.converter.officialSeal;
+
+
+import com.zjugis.business.flow.officialSeal.entity.OfficialSealOuterDO;
+import com.zjugis.business.flow.officialSeal.vo.OfficialSealOuterVO;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+/**
+ * @Author:zjq
+ * @Date:2024-02-27
+ */
+@Mapper
+public interface OfficialSealOuterConvert {
+
+    OfficialSealOuterConvert INSTANCE = Mappers.getMapper(OfficialSealOuterConvert.class);
+
+
+    OfficialSealOuterDO convert(OfficialSealOuterVO reqVO);
+
+
+    OfficialSealOuterVO convert(OfficialSealOuterDO reqVO);
+
+}

+ 2 - 2
zjugis-business/src/main/java/com/zjugis/business/converter/officialSeal/OfficialSealConvert.java → zjugis-business/src/main/java/com/zjugis/business/converter/officialSeal/OfficialSealUseConvert.java

@@ -10,9 +10,9 @@ import org.mapstruct.factory.Mappers;
  * @Date:2024-02-27
  */
 @Mapper
-public interface OfficialSealConvert {
+public interface OfficialSealUseConvert {
 
-    OfficialSealConvert INSTANCE = Mappers.getMapper(OfficialSealConvert.class);
+    OfficialSealUseConvert INSTANCE = Mappers.getMapper(OfficialSealUseConvert.class);
 
 
     OfficialSealUseDO convert(OfficialSealUseVO reqVO);

+ 12 - 12
zjugis-business/src/main/java/com/zjugis/business/flow/officialSeal/controller/OfficialSealOuterController.java

@@ -1,8 +1,8 @@
 package com.zjugis.business.flow.officialSeal.controller;
 
 
-import com.zjugis.business.flow.officialSeal.service.OfficialSealUseService;
-import com.zjugis.business.flow.officialSeal.vo.OfficialSealUseVO;
+import com.zjugis.business.flow.officialSeal.service.OfficialSealOuterService;
+import com.zjugis.business.flow.officialSeal.vo.OfficialSealOuterVO;
 import com.zjugis.framework.workflow.model.BaseController;
 import com.zjugis.framework.workflow.workflow.WorkFlow;
 import io.swagger.v3.oas.annotations.Parameter;
@@ -26,7 +26,7 @@ import java.util.Map;
 public class OfficialSealOuterController extends BaseController{
 
     @Resource
-    private OfficialSealUseService officialSealUseService;
+    private OfficialSealOuterService officialSealOuterService;
 
 
     /**
@@ -40,41 +40,41 @@ public class OfficialSealOuterController extends BaseController{
     @WorkFlow(isReceiveMaterial = true, isReceiveOpinion = true)
     @GetMapping("/index")
     public String index(String activityTemplateId, String flowInstanceId, String userId) throws Exception {
-        Map<String, Object> map = officialSealUseService.getFormParams(flowInstanceId, userId);
+        Map<String, Object> map = officialSealOuterService.getFormParams(flowInstanceId, userId);
         return resultPage(map);
     }
 
 
     /**
-     * 创建公章申请流程
+     * 创建公章外带申请流程
      * @param createReqVO
      * @return
      */
     @PostMapping("/create")
-    public String createOfficialSeal(@Valid @RequestBody OfficialSealUseVO createReqVO) {
-        return success(officialSealUseService.createOfficialSeal(createReqVO));
+    public String createOfficialSeal(@Valid @RequestBody OfficialSealOuterVO createReqVO) {
+        return success(officialSealOuterService.createOfficialSeal(createReqVO));
     }
 
     /**
-     * 更新公章申请流程
+     * 更新公章外带申请流程
      * @param updateReqVO
      * @return
      */
     @PostMapping("/update")
-    public String updateOfficialSeal(@Valid @RequestBody OfficialSealUseVO updateReqVO) {
-        officialSealUseService.updateOfficialSeal(updateReqVO);
+    public String updateOfficialSeal(@Valid @RequestBody OfficialSealOuterVO updateReqVO) {
+        officialSealOuterService.updateOfficialSeal(updateReqVO);
         return success(true);
     }
 
     /**
-     * 删除公章申请流程
+     * 删除公章外带申请流程
      * @param id
      * @return
      */
     @DeleteMapping("/delete")
     @Parameter(name = "id", description = "编号", required = true)
     public String deleteOfficialSeal(@RequestParam("id") String id) {
-        officialSealUseService.deleteOfficialSeal(id);
+        officialSealOuterService.deleteOfficialSeal(id);
         return success(true);
     }
 }

+ 21 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/officialSeal/dao/OfficialSealOuterDao.java

@@ -0,0 +1,21 @@
+package com.zjugis.business.flow.officialSeal.dao;
+
+import com.zjugis.business.flow.officialSeal.entity.OfficialSealOuterDO;
+import com.zjugis.framework.mybatis.core.mapper.BaseMapperX;
+import com.zjugis.framework.mybatis.core.query.LambdaQueryWrapperX;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author zjq
+ * @since 2024-02-27
+ */
+@Mapper
+public interface OfficialSealOuterDao extends  BaseMapperX<OfficialSealOuterDO> {
+    default OfficialSealOuterDO findByInstanceId(String flowInstanceId) {
+        return selectOne(new LambdaQueryWrapperX<OfficialSealOuterDO>().eqIfPresent(OfficialSealOuterDO::getInstanceId, flowInstanceId));
+    }
+}

+ 164 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/officialSeal/entity/OfficialSealOuterDO.java

@@ -0,0 +1,164 @@
+package com.zjugis.business.flow.officialSeal.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ *
+ * 公章外带
+ * @author zjq
+ * @since 2024-02-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("WF_OFFICIAL_SEAL_OUTER")
+public class OfficialSealOuterDO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId("ID")
+    private String id;
+
+    /**
+     * 流程实例ID
+     */
+    @TableField("INSTANCE_ID")
+    private String instanceId;
+
+    /**
+     * 流程状态 1已完成 2进行中 3已撤销
+     */
+    @TableField("FLOW_STATUS")
+    private Integer flowStatus;
+
+    /**
+     * 流程完成时间
+     */
+    @TableField("FLOW_FINISHTIME")
+    private LocalDateTime flowFinishtime;
+
+    /**
+     * 用户ID
+     */
+    @TableField("USER_ID")
+    private String userId;
+
+    /**
+     * 部门ID
+     */
+    @TableField("DEPT_ID")
+    private String deptId;
+
+    /**
+     * 用户名称
+     */
+    @TableField("USER_NICKNAME")
+    private String userNickname;
+
+    /**
+     * 部门名称
+     */
+    @TableField("DEPT_NAME")
+    private String deptName;
+
+    /**
+     * 公章外带申请单号
+     */
+    @TableField("OFFICIAL_SEAL_OUTER_APPLY_NO")
+    private String officialSealOuterApplyNo;
+
+    /**
+     * 用章类型(字典表)
+     */
+    @TableField("OFFICIAL_SEAL_USE_TYPE")
+    private Integer officialSealUseType;
+
+
+    /**
+     * 公章名称(字典表)
+     */
+    @TableField("OFFICIAL_SEAL_NAME")
+    private Integer officialSealName;
+
+    /**
+     * 申请事由
+     */
+    @TableField("OFFICIAL_SEAL_APPLY_REASON")
+    private String officialSealApplyReason;
+
+    /**
+     * 外带时间
+     */
+    @TableField("PLAN_OUTER_DATE")
+    private LocalDate planOuterDate;
+
+    /**
+     * 预计归还时间
+     */
+    @TableField("PLAN_RETURN_DATE")
+    private LocalDate planReturnDate;
+
+    /**
+     * 实际借出时间
+     */
+    @TableField("REAL_OUTER_DATE")
+    private LocalDate realOuterDate;
+
+    /**
+     * 实际归还时间
+     */
+    @TableField("REAL_RETURN_DATE")
+    private LocalDate realReturnDate;
+
+
+    /**
+     * 创建人
+     */
+    @TableField("CREATE_WORKER")
+    private String createWorker;
+
+    /**
+     * 创建时间
+     */
+    @TableField("CREATE_TIME")
+    private LocalDateTime createTime;
+
+    /**
+     * 最后修改人
+     */
+    @TableField("LATEST_MODIFY_WORKER")
+    private String latestModifyWorker;
+
+    /**
+     * 最后修改时间
+     */
+    @TableField("LATEST_MODIFY_TIME")
+    private LocalDateTime latestModifyTime;
+
+    /**
+     * 排序序号
+     */
+    @TableField("INDEX_CODE")
+    private BigDecimal indexCode;
+
+    /**
+     * 是否启用
+     */
+    @TableField("ISVALID")
+    private Integer isvalid;
+
+
+}

+ 285 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/officialSeal/event/OfficialSealOuterEvent.java

@@ -0,0 +1,285 @@
+package com.zjugis.business.flow.officialSeal.event;
+
+
+import com.zjugis.business.constants.OfficialSealNameConstants;
+import com.zjugis.business.constants.PostConstants;
+import com.zjugis.business.converter.officialSeal.OfficialSealOuterConvert;
+import com.zjugis.business.converter.officialSeal.OfficialSealUseConvert;
+import com.zjugis.business.flow.officialSeal.entity.OfficialSealOuterDO;
+import com.zjugis.business.flow.officialSeal.entity.OfficialSealUseDO;
+import com.zjugis.business.flow.officialSeal.service.OfficialSealOuterService;
+import com.zjugis.business.flow.officialSeal.service.OfficialSealUseService;
+import com.zjugis.framework.common.util.date.LocalDateTimeUtils;
+import com.zjugis.framework.workflow.exception.BusinessException;
+import com.zjugis.framework.workflow.model.BaseController;
+import com.zjugis.framework.workflow.rpc.remote.WorkflowClient;
+import com.zjugis.framework.workflow.spring.resovler.ParamModel;
+import com.zjugis.module.system.api.dept.DeptApi;
+import com.zjugis.module.system.api.dept.dto.DeptRespDTO;
+import com.zjugis.module.system.api.permission.RoleApi;
+import com.zjugis.module.system.api.user.AdminUserApi;
+import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.*;
+
+import static com.zjugis.business.constants.FlowStatusConstants.*;
+
+/**
+ * @author zjq
+ * @since 2024-03-15
+ */
+@RestController
+@RequestMapping("/officialSealOuter-event")
+public class OfficialSealOuterEvent extends BaseController {
+
+    public static final Logger log = LoggerFactory.getLogger(OfficialSealOuterEvent.class);
+
+    @Resource
+    private OfficialSealOuterService officialSealOuterService;
+
+    @Resource
+    private WorkflowClient workflowClient;
+    @Resource
+    private RoleApi roleApi;
+    @Resource
+    private DeptApi deptApi;
+    @Resource
+    private AdminUserApi adminUserApi;
+
+
+    /**
+     * 设置流程描述
+     *
+     * @param flowInstance     流程实例
+     * @param activityInstance 活动实例
+     * @return true/false
+     */
+    @PostMapping("/setFlowDesc")
+    public String setFlowDesc(@ParamModel Map flowInstance, @ParamModel Map activityInstance) {
+        try {
+            if (!Objects.isNull(activityInstance) && activityInstance.containsKey("flowInstanceId")) {
+                String flowInstanceId = activityInstance.get("flowInstanceId").toString();
+                OfficialSealOuterDO entity = officialSealOuterService.findByInstanceId(flowInstanceId);
+                String applyTime = LocalDateTimeUtils.format(entity.getCreateTime(), null);
+                String flowDesc = StringUtils.join(Arrays.asList(entity.getUserNickname(), applyTime, entity.getDeptName()), "/");
+                entity.setFlowStatus(FLOW_PROCESS);
+                officialSealOuterService.updateOfficialSeal(OfficialSealOuterConvert.INSTANCE.convert(entity));
+                workflowClient.saveFlowDescribe(flowInstanceId, flowDesc);
+                return ok("true");
+            } else {
+                throw new BusinessException("执行事件出错,请联系管理员!");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+
+
+    /**
+     * 流程归档事件
+     *
+     * @param flowInstance                  流程实例
+     * @param triggerFinishActivityInstance 触发归档的结束活动实例
+     * @return
+     */
+    @PostMapping("/flowArchingEvent")
+    public String flowArchingEvent(@ParamModel Map flowInstance, @ParamModel Map triggerFinishActivityInstance) {
+        try {
+            if (!Objects.isNull(flowInstance) && flowInstance.containsKey("id")) {
+                String flowInstanceId = flowInstance.get("id").toString();
+                OfficialSealOuterDO entity = officialSealOuterService.findByInstanceId(flowInstanceId);
+                entity.setFlowStatus(FLOW_FINISHED);
+                entity.setFlowFinishtime(LocalDateTime.now());
+                officialSealOuterService.updateOfficialSeal(OfficialSealOuterConvert.INSTANCE.convert(entity));
+                return ok("true");
+            } else {
+                throw new BusinessException("执行事件出错,请联系管理员!");
+            }
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+
+    /**
+     * 作废事件
+     *
+     * @param flowInstance     流程实例
+     * @param activityInstance 申请作废所在活动实例
+     * @param nullyApplyUserId 作废申请人ID
+     * @return
+     */
+    @PostMapping("/nullyEvent")
+    public String nullyEvent(@ParamModel Map flowInstance, @ParamModel Map activityInstance, String nullyApplyUserId) {
+        try {
+            if (!Objects.isNull(flowInstance) && flowInstance.containsKey("id")) {
+                String flowInstanceId = flowInstance.get("id").toString();
+                OfficialSealOuterDO entity = officialSealOuterService.findByInstanceId(flowInstanceId);
+                entity.setFlowStatus(FLOW_NULLY);
+                entity.setIsvalid(0);
+                officialSealOuterService.updateOfficialSeal(OfficialSealOuterConvert.INSTANCE.convert(entity));
+                return ok("true");
+            } else {
+                throw new BusinessException("执行事件出错,请联系管理员!");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+
+    /**
+     * 作废恢复事件
+     *
+     * @param flowInstance      流程实例
+     * @param activityInstance  申请作废所在活动实例
+     * @param nullyApplyUserId  作废申请人ID
+     * @param nullyRecoverserId 作废恢复人ID
+     * @return
+     */
+    @PostMapping("/nullyRecoverEvent")
+    public String nullyRecoverEvent(@ParamModel Map flowInstance, @ParamModel Map activityInstance, String nullyApplyUserId, String nullyRecoverserId) {
+        try {
+            if (!Objects.isNull(flowInstance) && flowInstance.containsKey("id")) {
+                String flowInstanceId = flowInstance.get("id").toString();
+                OfficialSealOuterDO entity = officialSealOuterService.findByInstanceId(flowInstanceId);
+                entity.setFlowStatus(FLOW_PROCESS);
+                entity.setIsvalid(1);
+                officialSealOuterService.updateOfficialSeal(OfficialSealOuterConvert.INSTANCE.convert(entity));
+                return ok("true");
+            } else {
+                throw new BusinessException("执行事件出错,请联系管理员!");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+
+    /**
+     * 彻底作废事件
+     *
+     * @param flowInstance        流程实例
+     * @param activityInstance    申请作废所在活动实例
+     * @param nullyApplyUserId    作废申请人ID
+     * @param nullyCompleteUserId 彻底作废人ID
+     * @return
+     */
+    @PostMapping("/nullyCompleteEvent")
+    public String nullyCompleteEvent(@ParamModel Map flowInstance, @ParamModel Map activityInstance, String nullyApplyUserId, String nullyCompleteUserId) {
+        try {
+            if (!Objects.isNull(flowInstance) && flowInstance.containsKey("id")) {
+                String flowInstanceId = flowInstance.get("id").toString();
+                OfficialSealOuterDO entity = officialSealOuterService.findByInstanceId(flowInstanceId);
+                officialSealOuterService.deleteOfficialSeal(entity.getId());
+                return ok("true");
+            } else {
+                throw new BusinessException("执行事件出错,请联系管理员!");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+
+    /**
+     * 部门经理
+     *
+     * @param flowInstanceId
+     * @return
+     */
+    @PostMapping("/to-dept-manager")
+    public String toDeptManager(String flowInstanceId) {
+        try {
+            if (StringUtils.isNotBlank(flowInstanceId)) {
+                OfficialSealOuterDO entity = officialSealOuterService.findByInstanceId(flowInstanceId);
+                DeptRespDTO deptRespDTO = deptApi.getDept(entity.getDeptId()).getCheckedData();
+                List<Map<String, String>> userMaps = new ArrayList<>();
+                HashMap<String, String> map = new HashMap<>();
+                map.put("id", deptRespDTO.getLeaderUserId());
+                userMaps.add(map);
+                return ok(userMaps);
+            } else {
+                throw new BusinessException("执行事件出错,请联系管理员!");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+
+
+    /**
+     * 分管部门领导
+     * @param flowInstanceId
+     * @return
+     */
+    @PostMapping("/to-dept-manager-leader")
+    public String toDeptManagerLeader(String flowInstanceId) {
+        try {
+            if (StringUtils.isNotBlank(flowInstanceId)) {
+                OfficialSealOuterDO entity = officialSealOuterService.findByInstanceId(flowInstanceId);
+                DeptRespDTO deptRespDTO = deptApi.getDept(entity.getDeptId()).getCheckedData();
+
+                List<Map<String, String>> userMaps = new ArrayList<>();
+                AdminUserRespDTO userLeader = adminUserApi.getUserLeader(deptRespDTO.getLeaderUserId()).getCheckedData();
+                HashMap<String, String> map = new HashMap<>();
+                map.put("id", userLeader.getId());
+                userMaps.add(map);
+                return ok(userMaps);
+            } else {
+                throw new BusinessException("执行事件出错,请联系管理员!");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+
+    /**
+     * 用章参与人
+     *
+     * @param flowInstanceId
+     * @return
+     */
+    @PostMapping("/use-people")
+    public String userOfficialSealFlow1(String flowInstanceId) {
+        try {
+            if (StringUtils.isNotBlank(flowInstanceId)) {
+                OfficialSealOuterDO entity = officialSealOuterService.findByInstanceId(flowInstanceId);
+                List<Map<String, String>> userMaps = new ArrayList<>();
+                if (entity.getOfficialSealName().equals(OfficialSealNameConstants.WW) || entity.getOfficialSealName().equals(OfficialSealNameConstants.WW_JS)) {
+                    int pId = entity.getOfficialSealName().equals(OfficialSealNameConstants.WW) ? PostConstants.OFFICIAL_SEAL_MANAGER : PostConstants.JIANGSU_OFFICIAL_SEAL_MANAGER;
+                    Collection<Long> collection = new ArrayList<>();
+                    collection.add(Long.valueOf(pId));
+                    List<AdminUserRespDTO> userList = adminUserApi.getUserListByPostIds(collection).getCheckedData();
+                    for (AdminUserRespDTO adminUserRespDTO : userList) {
+                        HashMap<String, String> map = new HashMap<>();
+                        map.put("id", adminUserRespDTO.getId());
+                        userMaps.add(map);
+                    }
+                    return ok(userMaps);
+                } else {
+                    throw new BusinessException("执行事件出错,请联系管理员!");
+                }
+
+            } else {
+                throw new BusinessException("执行事件出错,请联系管理员!");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+
+
+}

+ 5 - 5
zjugis-business/src/main/java/com/zjugis/business/flow/officialSeal/event/OfficialSealUseEvent.java

@@ -3,7 +3,7 @@ package com.zjugis.business.flow.officialSeal.event;
 
 import com.zjugis.business.constants.OfficialSealNameConstants;
 import com.zjugis.business.constants.PostConstants;
-import com.zjugis.business.converter.officialSeal.OfficialSealConvert;
+import com.zjugis.business.converter.officialSeal.OfficialSealUseConvert;
 import com.zjugis.business.flow.officialSeal.entity.OfficialSealUseDO;
 import com.zjugis.business.flow.officialSeal.service.OfficialSealUseService;
 
@@ -71,7 +71,7 @@ public class OfficialSealUseEvent extends BaseController {
                 String applyTime = LocalDateTimeUtils.format(entity.getCreateTime(), null);
                 String flowDesc = StringUtils.join(Arrays.asList(entity.getUserNickname(), applyTime, entity.getDeptName()), "/");
                 entity.setFlowStatus(FLOW_PROCESS);
-                officialSealUseService.updateOfficialSeal(OfficialSealConvert.INSTANCE.convert(entity));
+                officialSealUseService.updateOfficialSeal(OfficialSealUseConvert.INSTANCE.convert(entity));
                 workflowClient.saveFlowDescribe(flowInstanceId, flowDesc);
                 return ok("true");
             } else {
@@ -99,7 +99,7 @@ public class OfficialSealUseEvent extends BaseController {
                 OfficialSealUseDO entity = officialSealUseService.findByInstanceId(flowInstanceId);
                 entity.setFlowStatus(FLOW_FINISHED);
                 entity.setFlowFinishtime(LocalDateTime.now());
-                officialSealUseService.updateOfficialSeal(OfficialSealConvert.INSTANCE.convert(entity));
+                officialSealUseService.updateOfficialSeal(OfficialSealUseConvert.INSTANCE.convert(entity));
                 return ok("true");
             } else {
                 throw new BusinessException("执行事件出错,请联系管理员!");
@@ -126,7 +126,7 @@ public class OfficialSealUseEvent extends BaseController {
                 OfficialSealUseDO entity = officialSealUseService.findByInstanceId(flowInstanceId);
                 entity.setFlowStatus(FLOW_NULLY);
                 entity.setIsvalid(0);
-                officialSealUseService.updateOfficialSeal(OfficialSealConvert.INSTANCE.convert(entity));
+                officialSealUseService.updateOfficialSeal(OfficialSealUseConvert.INSTANCE.convert(entity));
                 return ok("true");
             } else {
                 throw new BusinessException("执行事件出错,请联系管理员!");
@@ -154,7 +154,7 @@ public class OfficialSealUseEvent extends BaseController {
                 OfficialSealUseDO entity = officialSealUseService.findByInstanceId(flowInstanceId);
                 entity.setFlowStatus(FLOW_PROCESS);
                 entity.setIsvalid(1);
-                officialSealUseService.updateOfficialSeal(OfficialSealConvert.INSTANCE.convert(entity));
+                officialSealUseService.updateOfficialSeal(OfficialSealUseConvert.INSTANCE.convert(entity));
                 return ok("true");
             } else {
                 throw new BusinessException("执行事件出错,请联系管理员!");

+ 47 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/officialSeal/service/OfficialSealOuterService.java

@@ -0,0 +1,47 @@
+package com.zjugis.business.flow.officialSeal.service;
+
+
+import com.zjugis.business.flow.officialSeal.entity.OfficialSealOuterDO;
+import com.zjugis.business.flow.officialSeal.vo.OfficialSealOuterVO;
+
+import java.util.Map;
+
+/**
+ * @Author:zjq
+ * @Date:2024-02-27
+ */
+public interface OfficialSealOuterService {
+    /**
+     * 创建公章外带申请
+     * @param createReqVO
+     * @return
+     */
+    String createOfficialSeal(OfficialSealOuterVO createReqVO);
+
+    /**
+     * 更新公章外带申请流程
+     * @param updateReqVO
+     */
+    void updateOfficialSeal(OfficialSealOuterVO updateReqVO);
+
+    /**
+     * 删除公章外带申请流程
+     * @param id
+     */
+    void deleteOfficialSeal(String id);
+
+    /**
+     * 通过流程实例ID查找记录
+     * @param flowInstanceId
+     * @return
+     */
+    OfficialSealOuterDO findByInstanceId(String flowInstanceId);
+
+    /**
+     * 获取表单参数
+     * @param flowInstanceId
+     * @return
+     */
+    Map<String, Object> getFormParams(String flowInstanceId, String userId);
+
+}

+ 136 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/officialSeal/service/OfficialSealOuterServiceImpl.java

@@ -0,0 +1,136 @@
+package com.zjugis.business.flow.officialSeal.service;
+
+
+import com.alibaba.fastjson2.JSON;
+import com.zjugis.business.constants.DictConstants;
+import com.zjugis.business.constants.FlowStatusConstants;
+import com.zjugis.business.converter.common.SelectConvert;
+import com.zjugis.business.converter.officialSeal.OfficialSealOuterConvert;
+import com.zjugis.business.flow.officialSeal.dao.OfficialSealOuterDao;
+import com.zjugis.business.flow.officialSeal.entity.OfficialSealOuterDO;
+import com.zjugis.business.flow.officialSeal.vo.OfficialSealOuterVO;
+import com.zjugis.framework.common.pojo.CommonResult;
+import com.zjugis.framework.security.core.util.SecurityFrameworkUtils;
+import com.zjugis.framework.workflow.model.IFlowInstance;
+import com.zjugis.framework.workflow.rpc.remote.WorkflowClient;
+import com.zjugis.framework.workflow.utils.Select;
+import com.zjugis.module.system.api.dict.DictDataApi;
+import com.zjugis.module.system.api.user.AdminUserApi;
+import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+import static com.zjugis.business.enums.ErrorCodeConstants.SEAL_NOT_EXISTS;
+import static com.zjugis.framework.common.exception.util.ServiceExceptionUtil.exception;
+
+
+/**
+ * 用章申请
+ * @Author:zjq
+ * @Date:2024-02-27
+ */
+@Service
+public class OfficialSealOuterServiceImpl implements OfficialSealOuterService {
+    @Resource
+    private WorkflowClient workflowClient;
+    @Resource
+    private OfficialSealOuterDao officialSealOuterDao;
+
+    @Resource
+    private DictDataApi dictDataApi;
+
+    @Resource
+    private AdminUserApi adminUserApi;
+
+
+
+    @Override
+    public String createOfficialSeal(OfficialSealOuterVO createReqVO) {
+        // 插入
+        OfficialSealOuterDO officialSeal = OfficialSealOuterConvert.INSTANCE.convert(createReqVO);
+        officialSealOuterDao.insert(officialSeal);
+
+        // 返回
+        return officialSeal.getId();
+    }
+
+    @Override
+    public void updateOfficialSeal(OfficialSealOuterVO updateReqVO) {
+        // 校验存在
+        validateOfficialSealExists(updateReqVO.getId());
+        // 更新
+        OfficialSealOuterDO updateObj = (OfficialSealOuterConvert.INSTANCE.convert(updateReqVO));
+        officialSealOuterDao.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteOfficialSeal(String id) {
+        // 校验存在
+        validateOfficialSealExists(id);
+        //删除
+        officialSealOuterDao.deleteById(id);
+    }
+
+    @Override
+    public OfficialSealOuterDO findByInstanceId(String flowInstanceId) {
+        return officialSealOuterDao.findByInstanceId(flowInstanceId);
+    }
+
+    @Override
+    public Map<String, Object> getFormParams(String flowInstanceId, String userId) {
+        if (StringUtils.isNotBlank(SecurityFrameworkUtils.getLoginUserId())) {
+            userId = SecurityFrameworkUtils.getLoginUserId();
+        }
+        CommonResult<IFlowInstance> flowResult = workflowClient.flowInstance(flowInstanceId);
+        if (flowResult.isSuccess()) {
+            IFlowInstance flowInstance = flowResult.getData();
+            OfficialSealOuterDO entity = findByInstanceId(flowInstanceId);
+            if (Objects.isNull(entity)) {
+                entity = new OfficialSealOuterDO();
+                entity.setInstanceId(flowInstanceId);
+                entity.setUserId(userId);
+                entity.setOfficialSealOuterApplyNo(flowInstance.getCode());
+                entity.setCreateTime(LocalDateTime.now());
+                entity.setFlowStatus(FlowStatusConstants.FLOW_NOT_START);
+                CommonResult<AdminUserRespDTO> result = adminUserApi.getUser(userId);
+                if (result.isSuccess()) {
+                    entity.setUserNickname(result.getData().getNickname());
+                    entity.setDeptId(result.getData().getDeptId());
+                    entity.setDeptName(result.getData().getDeptName());
+                }
+                officialSealOuterDao.insert(entity);
+            }
+            return createMap(flowInstanceId, entity, userId);
+        }
+        return createModelMap();
+    }
+
+    private Map<String, Object> createModelMap() {
+        Map<String, Object> map = new HashMap<>();
+        map.put("formEntity", new HashMap<>());
+        return map;
+    }
+
+    private Map<String, Object> createMap(String flowInstanceId, OfficialSealOuterDO entity, String userId) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("formEntity", entity);
+        List<Select> sealTypeList = SelectConvert.INSTANCE.convertList(dictDataApi.getDictDataList(DictConstants.WF_SEAL_TYPE).getCheckedData());
+        map.put("sealTypeList", JSON.toJSONString(sealTypeList));
+        List<Select> sealNameList = SelectConvert.INSTANCE.convertList(dictDataApi.getDictDataList(DictConstants.WF_SEAL_NAME).getCheckedData());
+        map.put("sealNameList", JSON.toJSONString(sealNameList));
+        return map;
+    }
+
+    private void validateOfficialSealExists(String id) {
+        if (officialSealOuterDao.selectById(id) == null) {
+            throw exception(SEAL_NOT_EXISTS);
+        }
+    }
+}

+ 3 - 3
zjugis-business/src/main/java/com/zjugis/business/flow/officialSeal/service/OfficialSealUseServiceImpl.java

@@ -6,7 +6,7 @@ import com.zjugis.business.constants.DictConstants;
 import com.zjugis.business.constants.FlowStatusConstants;
 import com.zjugis.business.converter.common.SelectConvert;
 
-import com.zjugis.business.converter.officialSeal.OfficialSealConvert;
+import com.zjugis.business.converter.officialSeal.OfficialSealUseConvert;
 
 import com.zjugis.business.flow.officialSeal.dao.OfficialSealUseDao;
 import com.zjugis.business.flow.officialSeal.entity.OfficialSealUseDO;
@@ -53,7 +53,7 @@ public class OfficialSealUseServiceImpl implements OfficialSealUseService {
     @Override
     public String createOfficialSeal(OfficialSealUseVO createReqVO) {
         // 插入
-        OfficialSealUseDO officialSeal = OfficialSealConvert.INSTANCE.convert(createReqVO);
+        OfficialSealUseDO officialSeal = OfficialSealUseConvert.INSTANCE.convert(createReqVO);
         officialSealUseDao.insert(officialSeal);
 
         // 返回
@@ -65,7 +65,7 @@ public class OfficialSealUseServiceImpl implements OfficialSealUseService {
         // 校验存在
         validateOfficialSealExists(updateReqVO.getId());
         // 更新
-        OfficialSealUseDO updateObj = (OfficialSealConvert.INSTANCE.convert(updateReqVO));
+        OfficialSealUseDO updateObj = (OfficialSealUseConvert.INSTANCE.convert(updateReqVO));
         officialSealUseDao.updateById(updateObj);
     }
 

+ 106 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/officialSeal/vo/OfficialSealOuterVO.java

@@ -0,0 +1,106 @@
+package com.zjugis.business.flow.officialSeal.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * @Author:zjq
+ * @Date:2024-02-27
+ */
+@Data
+public class OfficialSealOuterVO {
+
+    /**
+     * 主键ID
+     */
+    private String id;
+
+    /**
+     * 流程实例ID
+     */
+    private String instanceId;
+
+    /**
+     * 流程状态 1已完成 2进行中 3已撤销
+     */
+    private Integer flowStatus;
+
+    /**
+     * 流程完成时间
+     */
+    private LocalDateTime flowFinishtime;
+
+    /**
+     * 用户ID
+     */
+    private String userId;
+
+    /**
+     * 部门ID
+     */
+    private String deptId;
+
+    /**
+     * 用户名称
+     */
+    @TableField("USER_NICKNAME")
+    private String userNickname;
+
+    /**
+     * 部门名称
+     */
+    @TableField("DEPT_NAME")
+    private String deptName;
+
+
+    /**
+     * 公章申请单号
+     */
+
+    private String officialSealApplyNo;
+
+    /**
+     * 用章类型(字典表)
+     */
+    private Integer officialSealUseType;
+
+
+    /**
+     * 公章名称(字典表)
+     */
+    private Integer officialSealName;
+
+    /**
+     * 申请事由
+     */
+    private String officialSealApplyReason;
+
+    /**
+     * 外带时间
+     */
+    @TableField("PLAN_OUTER_DATE")
+    private LocalDate planOuterDate;
+
+    /**
+     * 预计归还时间
+     */
+    @TableField("PLAN_RETURN_DATE")
+    private LocalDate planReturnDate;
+
+    /**
+     * 实际借出时间
+     */
+    @TableField("REAL_OUTER_DATE")
+    private LocalDate realOuterDate;
+
+    /**
+     * 实际归还时间
+     */
+    @TableField("REAL_RETURN_DATE")
+    private LocalDate realReturnDate;
+
+
+}

+ 210 - 0
zjugis-business/src/main/resources/templates/OfficialSealOuter/index.ftl

@@ -0,0 +1,210 @@
+<@w.workFlow javascripts=['/OfficialSealOuter/js/index.js','/js/moment.js','/flow/js/formCommon.js']
+styles=[ '/flow/css/formCommon.css' ]>
+    <div class="z-position form-boss" name="createReqVO">
+        <div class="z-form-row" style="display: none;">
+            <input type="text" value="${formEntity.instanceId!}" name="createReqVO$instanceId">
+            <input type="text" value="${formEntity.id!}" name="createReqVO$id">
+        </div>
+        <div class="ow-tab-scroll">
+            <div class="ow-tab-content" name="jbxx">
+                <div class="form-title" style="margin-top: 0px;">
+                    <div class="form-icon">
+                        <img src="/imgs/titleIcon.png" alt="">
+                        <span>基本信息</span>
+                    </div>
+                    <div class="form-btn">
+                    </div>
+                </div>
+                <div class="jbxx-box jbxx-box-flex">
+                    <table class="jbxx-table-info">
+                        <tr>
+                            <td class="th">
+                                <div class="form-label">申请人:</div>
+                            </td>
+                            <td>
+                                <div class="form-group">
+                                    <div class="form-item">
+                                        <div class="z-comp-input  z-readonly" name="createReqVO$userNickname">
+                                            <input type="text" value="${formEntity.userNickname!}">
+                                        </div>
+                                    </div>
+                                </div>
+                            </td>
+                            <td class="th">
+                                <div class="form-label">所在部门:</div>
+                            </td>
+                            <td>
+                                <div class="form-group">
+                                    <div class="form-item">
+                                        <div class="z-comp-input  z-readonly" name="createReqVO$deptName">
+                                            <input type="text" value="${formEntity.deptName!}">
+                                        </div>
+                                    </div>
+                                </div>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class="th">
+                                <div class="form-label">申请时间:</div>
+                            </td>
+                            <td>
+                                <div class="form-group">
+                                    <div class="form-item">
+                                        <div class="z-comp-date z-readonly" name="createReqVO$createTime">
+                                            <input type="text" value="${(formEntity.createTime?date)!}">
+                                        </div>
+                                    </div>
+                                </div>
+                            </td>
+                            <td class="th">
+                                <div class="form-label">申请单号:</div>
+                            </td>
+                            <td>
+                                <div class="form-group">
+                                    <div class="form-item">
+                                        <div class="z-comp-input  z-readonly" name="createReqVO$officialSealOuterApplyNo">
+                                            <input type="text" value="${formEntity.officialSealOuterApplyNo!}">
+                                        </div>
+                                    </div>
+                                </div>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class="th">
+                                <div class="form-label">申请事由:</div>
+                            </td>
+                            <td colspan="3">
+                                <div class="form-group">
+                                    <div class="form-item">
+                                        <div class="z-comp-input" name="createReqVO$officialSealApplyReason">
+                                            <input type="text" value="${formEntity.officialSealApplyReason!}">
+                                        </div>
+                                    </div>
+                                </div>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class="th">
+                                <div class="form-label">用章类型:</div>
+                            </td>
+                            <td>
+                                <div class="form-group">
+                                    <div class="form-item">
+                                        <div class="z-comp-select" name="createReqVO$officialSealUseType"
+                                             data='${sealTypeList!}' value="${formEntity.officialSealUseType!}">
+                                            <div class="z-inputselect-bar">
+                                                <span></span><i></i>
+                                            </div>
+                                        </div>
+
+                                    </div>
+                                </div>
+                            </td>
+                            <td class="th">
+                                <div class="form-label">公章名称:</div>
+                            </td>
+                            <td>
+                                <div class="form-group">
+                                    <div class="form-item">
+                                        <div class="z-comp-select" name="createReqVO$officialSealName"
+                                             data='${sealNameList!}' value="${formEntity.officialSealName!}">
+                                            <div class="z-inputselect-bar">
+                                                <span></span><i></i>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class="th">
+                                <div class="form-label">外带时间:</div>
+                            </td>
+                            <td>
+                                <div class="form-group">
+                                    <div class="z-comp-date" name="createReqVO$planOuterDate">
+                                        <input type="text" value="${formEntity.planOuterDate!}">
+                                    </div>
+                                </div>
+                            </td>
+                            <td class="th">
+                                <div class="form-label">预计归还时间:</div>
+                            </td>
+                            <td>
+                                <div class="form-group">
+                                    <div class="z-comp-date" name="createReqVO$planReturnDate">
+                                        <input type="text" value="${formEntity.planReturnDate!}">
+                                    </div>
+                                </div>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class="th">
+                                <div class="form-label">实际借出时间:</div>
+                            </td>
+                            <td>
+                                <div class="form-group">
+                                    <div class="z-comp-date" name="createReqVO$realOuterDate">
+                                        <input type="text" value="${formEntity.realOuterDate!}">
+                                    </div>
+                                </div>
+                            </td>
+                            <td class="th">
+                                <div class="form-label">实际归还时间:</div>
+                            </td>
+                            <td>
+                                <div class="form-group">
+                                    <div class="z-comp-date" name="createReqVO$realReturnDate">
+                                        <input type="text" value="${formEntity.realReturnDate!}">
+                                    </div>
+                                </div>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class="th">
+                                <div class="form-label">责任说明:</div>
+                            </td>
+                            <td colspan="3">
+                                <div class="form-group">
+                                    <div class="form-item">
+                                        <div class="z-comp-textarea   z-readonly" name="createReqVO$dutyDesc">
+                                            <textarea>按照公司规定妥善保管、使用印章,不私自转借章或用于其他用途。如因遗失、管理不善等原因给公司造成经济损失或其他不良影响,申请人需接受公司处罚并承担相应的法律责任。</textarea>
+                                        </div>
+                                    </div>
+                                </div>
+                            </td>
+                        </tr>
+                    </table>
+                </div>
+            </div>
+        </div>
+        <div class="ow-tab-content" name="yj">
+            <#if WORKFLOW.OPINION! !="">
+                <div class="form-title">
+                    <div class="form-icon">
+                        <img src="/imgs/titleIcon.png" alt="">
+                        <span>审批意见</span>
+                    </div>
+                    <div class="form-btn">
+                    </div>
+                </div>
+                <div class="qjsjxx-box">
+                    <div class="z-form-wrap" name="opinionsDiv">
+                        <div class="z-form-row"> ${WORKFLOW.OPINION!} </div>
+                    </div>
+                </div>
+            </#if>
+        </div>
+    </div>
+    <script language="javascript" src="/timeSelector/TimeSelector.js"></script>
+    <script language="javascript">
+        ;
+        (function () {
+        })();
+    </script>
+    <style type="text/css">
+        .qjsjxx-box .form-table-info tr:nth-child(1) {
+            height: 63px;
+        }
+    </style>
+</@w.workFlow>

+ 37 - 0
zjugis-business/src/main/resources/templates/OfficialSealOuter/js/index.js

@@ -0,0 +1,37 @@
+(function () {
+    let flowInstanceId = "";
+    window.onload = function () {
+        flowInstanceId = z.ui.comm.getUrlParam("flowInstanceId");
+        bindEvents();
+    };
+
+    function bindEvents() {
+        z.workflow.saveBtn.addListener("onSaveClick", submit);
+    }
+
+    function submit(all, istransfer) {
+        var postData = z.ui.form.getFormFields($("[name=createReqVO]"));
+        console.log(postData)
+        if (postData === false) {
+            all({ success: false });
+            return;
+        }
+        console.log(JSON.stringify(postData.createReqVO))
+        z.ui.ajax({
+            type: "post",
+            url: "/officialSealOuter/update",
+            data: JSON.stringify(postData.createReqVO),
+
+            contentType: "application/json",
+            success: function () {
+                all({ success: true });
+            },
+            error: function () {
+                all({ success: false });
+            }
+        })
+    }
+
+}());
+
+