Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

songxy 1 anno fa
parent
commit
7e0e235a89

+ 2 - 0
zjugis-business/src/main/java/com/zjugis/business/converter/leave/LeaveConvert.java

@@ -20,4 +20,6 @@ public interface LeaveConvert {
     LeaveDO convert(LeaveCreateReqVO reqVO);
     LeaveDO convert(LeaveCreateReqVO reqVO);
 
 
     LeaveDO convert(LeaveUpdateReqVO reqVO);
     LeaveDO convert(LeaveUpdateReqVO reqVO);
+
+    LeaveUpdateReqVO convert(LeaveDO entity);
 }
 }

+ 4 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/leave/dao/LeaveDao.java

@@ -2,6 +2,7 @@ package com.zjugis.business.flow.leave.dao;
 
 
 import com.zjugis.business.flow.leave.entity.LeaveDO;
 import com.zjugis.business.flow.leave.entity.LeaveDO;
 import com.zjugis.framework.mybatis.core.mapper.BaseMapperX;
 import com.zjugis.framework.mybatis.core.mapper.BaseMapperX;
+import com.zjugis.framework.mybatis.core.query.LambdaQueryWrapperX;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 
 
 /**
 /**
@@ -11,4 +12,7 @@ import org.apache.ibatis.annotations.Mapper;
  */
  */
 @Mapper
 @Mapper
 public interface LeaveDao extends BaseMapperX<LeaveDO> {
 public interface LeaveDao extends BaseMapperX<LeaveDO> {
+    default LeaveDO findByInstanceId(String flowInstanceId) {
+        return selectOne(new LambdaQueryWrapperX<LeaveDO>().eqIfPresent(LeaveDO::getInstanceId, flowInstanceId));
+    }
 }
 }

+ 6 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/leave/dao/LeaveTimeDao.java

@@ -2,8 +2,11 @@ package com.zjugis.business.flow.leave.dao;
 
 
 import com.zjugis.business.flow.leave.entity.LeaveTimeDO;
 import com.zjugis.business.flow.leave.entity.LeaveTimeDO;
 import com.zjugis.framework.mybatis.core.mapper.BaseMapperX;
 import com.zjugis.framework.mybatis.core.mapper.BaseMapperX;
+import com.zjugis.framework.mybatis.core.query.LambdaQueryWrapperX;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 
 
+import java.util.List;
+
 /**
 /**
  * @Author 陈俊
  * @Author 陈俊
  * @Date 2023/11/21 13:15
  * @Date 2023/11/21 13:15
@@ -11,4 +14,7 @@ import org.apache.ibatis.annotations.Mapper;
  */
  */
 @Mapper
 @Mapper
 public interface LeaveTimeDao extends BaseMapperX<LeaveTimeDO> {
 public interface LeaveTimeDao extends BaseMapperX<LeaveTimeDO> {
+    default List<LeaveTimeDO> getListByLeaveId(String leaveId) {
+        return selectList(new LambdaQueryWrapperX<LeaveTimeDO>().eqIfPresent(LeaveTimeDO::getLeaveId, leaveId));
+    }
 }
 }

+ 186 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/leave/event/LeaveEvent.java

@@ -0,0 +1,186 @@
+package com.zjugis.business.flow.leave.event;
+
+import com.google.common.base.Strings;
+import com.zjugis.business.converter.leave.LeaveConvert;
+import com.zjugis.business.flow.leave.entity.LeaveDO;
+import com.zjugis.business.flow.leave.entity.LeaveTimeDO;
+import com.zjugis.business.flow.leave.service.LeaveService;
+import com.zjugis.business.flow.leave.service.LeaveTimeService;
+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.spring.resovler.ParamModel;
+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.LocalDate;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * @Author 陈俊
+ * @Date 2023/11/21 17:51
+ * @Version 1.0
+ */
+@RestController
+@RequestMapping("/leave-event")
+public class LeaveEvent extends BaseController {
+
+    public static final Logger log = LoggerFactory.getLogger(LeaveEvent.class);
+
+    @Resource
+    private LeaveService leaveService;
+    @Resource
+    private LeaveTimeService leaveTimeService;
+
+    /**
+     * 设置流程描述
+     *
+     * @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();
+                LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
+                String flowDesc = "";
+                if (!Strings.isNullOrEmpty(entity.getDeptName())) {
+                    flowDesc += "/" + entity.getDeptName();
+                }
+                if (!Strings.isNullOrEmpty(entity.getUserNickname())) {
+                    flowDesc += "/" + entity.getUserNickname();
+                }
+
+                entity.setFlowStatus(1);
+                leaveService.updateLeave(LeaveConvert.INSTANCE.convert(entity));
+                flowDesc = flowDesc.length() > 1 ? flowDesc.substring(1) : flowDesc;
+//                String result = E_FlowUtils.setFlowDesc(flowDesc, flowInstanceId);
+                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();
+                LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
+                entity.setFlowStatus(90);
+                entity.setFlowFinishtime(LocalDate.now());
+                leaveService.updateLeave(LeaveConvert.INSTANCE.convert(entity));
+                //根据请假情况修改考勤表
+                List<LeaveTimeDO> leaveTimeDOList = leaveTimeService.getListByLeaveId(entity.getId());
+                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();
+                LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
+                entity.setFlowStatus(20);
+                entity.setIsvalid(0);
+                leaveService.updateLeave(LeaveConvert.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();
+                LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
+                entity.setFlowStatus(1);
+                entity.setIsvalid(1);
+                leaveService.updateLeave(LeaveConvert.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();
+                LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
+                leaveService.deleteLeave(entity.getId());
+                return ok("true");
+            } else {
+                throw new BusinessException("执行事件出错,请联系管理员!");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(),e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+}

+ 8 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/leave/service/LeaveService.java

@@ -2,6 +2,7 @@ package com.zjugis.business.flow.leave.service;
 
 
 import com.zjugis.business.flow.leave.controller.vo.LeaveCreateReqVO;
 import com.zjugis.business.flow.leave.controller.vo.LeaveCreateReqVO;
 import com.zjugis.business.flow.leave.controller.vo.LeaveUpdateReqVO;
 import com.zjugis.business.flow.leave.controller.vo.LeaveUpdateReqVO;
+import com.zjugis.business.flow.leave.entity.LeaveDO;
 
 
 /**
 /**
  * @Author 陈俊
  * @Author 陈俊
@@ -27,4 +28,11 @@ public interface LeaveService {
      * @param id
      * @param id
      */
      */
     void deleteLeave(String id);
     void deleteLeave(String id);
+
+    /**
+     * 通过流程实例ID查找记录
+     * @param flowInstanceId
+     * @return
+     */
+    LeaveDO findByInstanceId(String flowInstanceId);
 }
 }

+ 5 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/leave/service/LeaveServiceImpl.java

@@ -65,6 +65,11 @@ public class LeaveServiceImpl implements LeaveService {
         leaveDao.deleteById(id);
         leaveDao.deleteById(id);
     }
     }
 
 
+    @Override
+    public LeaveDO findByInstanceId(String flowInstanceId) {
+        return leaveDao.findByInstanceId(flowInstanceId);
+    }
+
     private void validateLeaveExists(String id) {
     private void validateLeaveExists(String id) {
         if (leaveDao.selectById(id) == null) {
         if (leaveDao.selectById(id) == null) {
             throw exception(LEAVE_NOT_EXISTS);
             throw exception(LEAVE_NOT_EXISTS);

+ 19 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/leave/service/LeaveTimeService.java

@@ -0,0 +1,19 @@
+package com.zjugis.business.flow.leave.service;
+
+import com.zjugis.business.flow.leave.entity.LeaveTimeDO;
+
+import java.util.List;
+
+/**
+ * @Author 陈俊
+ * @Date 2023/11/21 19:09
+ * @Version 1.0
+ */
+public interface LeaveTimeService {
+    /**
+     * 通过请假申请ID获取请假时间段列表
+     * @param leaveId
+     * @return
+     */
+    List<LeaveTimeDO> getListByLeaveId(String leaveId);
+}

+ 25 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/leave/service/LeaveTimeServiceImpl.java

@@ -0,0 +1,25 @@
+package com.zjugis.business.flow.leave.service;
+
+import com.zjugis.business.flow.leave.dao.LeaveTimeDao;
+import com.zjugis.business.flow.leave.entity.LeaveTimeDO;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @Author 陈俊
+ * @Date 2023/11/21 19:09
+ * @Version 1.0
+ */
+@Service
+public class LeaveTimeServiceImpl implements LeaveTimeService{
+
+    @Resource
+    private LeaveTimeDao leaveTimeDao;
+
+    @Override
+    public List<LeaveTimeDO> getListByLeaveId(String leaveId) {
+        return leaveTimeDao.getListByLeaveId(leaveId);
+    }
+}

+ 123 - 19
zjugis-business/src/main/resources/templates/Leave/index.ftl

@@ -1,28 +1,28 @@
 <@w.workFlow javascripts=['/Leave/js/index.js']>
 <@w.workFlow javascripts=['/Leave/js/index.js']>
     <div class="z-form-wrap" name="demoForm2">
     <div class="z-form-wrap" name="demoForm2">
-        <div class="z-form-row z-subtitle text-info z-border-title">
-            <strong>基本信息</strong>
+        <div class="form-wrap-title">
+            <i class="icon"></i>基本信息
         </div>
         </div>
         <div class="z-form-row">
         <div class="z-form-row">
             <div class="z-form-group z-col-30">
             <div class="z-form-group z-col-30">
-                <div class="z-form-label z-col-30">请假人</div>
-                <div class="z-form-control z-col-70">
-                    <div class="z-comp-input z-readonly" name="demoForm2$field1">
+                <div class="form-label">请假人</div>
+                <div class="form-item">
+                    <div class="z-comp-input z-readonly" name="demoForm1$field1">
                         <input type="text" value="陈俊">
                         <input type="text" value="陈俊">
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
             <div class="z-form-group z-col-40">
             <div class="z-form-group z-col-40">
-                <div class="z-form-label z-col-30">所在部门</div>
-                <div class="z-form-control z-col-70">
+                <div class="form-label">所在部门</div>
+                <div class="form-item">
                     <div class="z-comp-input z-readonly" name="demoForm2$field2">
                     <div class="z-comp-input z-readonly" name="demoForm2$field2">
                         <input type="text" value="自然资源产品部">
                         <input type="text" value="自然资源产品部">
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
             <div class="z-form-group z-col-30">
             <div class="z-form-group z-col-30">
-                <div class="z-form-label z-col-30">请假单号</div>
-                <div class="z-form-control z-col-70">
+                <div class="form-label">请假单号</div>
+                <div class="form-item">
                     <div class="z-comp-input z-readonly" name="demoForm2$field2">
                     <div class="z-comp-input z-readonly" name="demoForm2$field2">
                         <input type="text" value="TEST1234">
                         <input type="text" value="TEST1234">
                     </div>
                     </div>
@@ -31,16 +31,16 @@
         </div>
         </div>
         <div class="z-form-row">
         <div class="z-form-row">
             <div class="z-form-group z-col-30">
             <div class="z-form-group z-col-30">
-                <div class="z-form-label z-col-30">申请时间</div>
-                <div class="z-form-control z-col-70">
+                <div class="form-label">申请时间</div>
+                <div class="form-item">
                     <div class="z-comp-date z-readonly" name="demoForm2$field8">
                     <div class="z-comp-date z-readonly" name="demoForm2$field8">
                         <input type="text" value="2023-10-10">
                         <input type="text" value="2023-10-10">
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
             <div class="z-form-group z-col-40">
             <div class="z-form-group z-col-40">
-                <div class="z-form-label z-col-30">请假类型</div>
-                <div class="z-form-control z-col-70">
+                <div class="form-label">申请时间</div>
+                <div class="form-item">
                     <div class="z-comp-inputselect" name="demoForm2$field14"
                     <div class="z-comp-inputselect" name="demoForm2$field14"
                          data='${leaveTypeJSON!}'>
                          data='${leaveTypeJSON!}'>
                         <div class="z-inputselect-bar">
                         <div class="z-inputselect-bar">
@@ -50,18 +50,122 @@
                 </div>
                 </div>
             </div>
             </div>
             <div class="z-form-group z-col-30">
             <div class="z-form-group z-col-30">
-                <div class="z-form-label z-col-30">请假天数</div>
-                <div class="z-form-control z-col-70">
+                <div class="form-label">请假天数</div>
+                <div class="form-item">
                     <div class="z-comp-input z-readonly" name="demoForm2$field2">
                     <div class="z-comp-input z-readonly" name="demoForm2$field2">
                         <input type="text" value="0">
                         <input type="text" value="0">
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
         </div>
         </div>
-        <div class="z-form-row z-subtitle text-info z-border-title">
-            <strong>请假时间信息</strong>
-            <a class="btn btn-success pull-right" name="ydqkAdd">新增</a>
+        <div class="form-wrap-title">
+            <i class="icon"></i> 请假时间信息
+        </div>
+        <div class="table-wrap">
+            <button type="button" class="addTableTrHandle">新增1</button>
+            <table>
+                <thead>
+                <tr>
+                    <th>序号</th>
+                    <th>起始时间</th>
+                    <th>截止时间</th>
+                    <th>备注</th>
+                    <th>操作</th>
+                </tr>
+                </thead>
+                <tbody class="table-wrap-tbody">
+                <tr>
+                    <td>1</td>
+                    <td>
+                        <div class="z-comp-date" name="demoForm1$field8">
+                            <input type="text" value="2015-05-03">
+                        </div>
+                    </td>
+                    <td>
+                        <div class="z-comp-date" name="demoForm1$field8">
+                            <input type="text" value="2015-05-03">
+                        </div>
+                    </td>
+                </tr>
+                </tbody>
+            </table>
         </div>
         </div>
-        <div name="leave_time_list"></div>
     </div>
     </div>
 </@w.workFlow>
 </@w.workFlow>
+<style type="text/css">
+    .form-wrap-title {
+        font-size: 18px;
+        color: #2D333C;
+        font-weight: bold;
+        display: flex;
+        align-items: center;
+        padding: 10px;
+    }
+    .form-wrap-title>i {
+        width: 18px;
+        height: 18px;
+        margin-right: 5px;
+        background: url("./imgs/form-wrap-title-icon.png") no-repeat;
+        background-size: 100% 100%;
+    }
+    .form-group {
+    }
+    .form-label {
+        color: #404956;
+        font-size: 16px;
+    }
+    .form-item {
+        margin: 10px 0px;
+    }
+    .form-group .form-label {
+        margin-bottom: 10px;
+    }
+    .form-item input[type=text],
+    .form-item input[type=number],
+    .form-item textarea,
+    .form-item .z-comp-input,
+    .form-item .z-radio-item,
+    .form-item .z-comp-inputsearch,
+    .form-item .z-comp-inputselect,
+    .form-item .z-comp-select,
+    .form-item .z-comp-select .z-inputselect-bar>span,
+    .form-item .z-comp-selectsearch,
+    .form-item .z-comp-selecttree,
+    .form-item .z-checkbox-item,
+    .form-item .z-comp-textarea,
+    .form-item .z-selecttree {
+        font-size: 16px;
+        color: #121518;
+    }
+    .form-item .z-readonly,
+    .form-item .z-readonly input,
+    .form-item .z-readonly textarea {
+        background: #F5F5F5;
+    }
+    /** 表格样式 **/
+    .table-wrap table {
+        margin-top: 10px;
+        width: 100%;
+        border-collapse: collapse;
+    }
+    .table-wrap thead {
+        background: #F2F4F8;
+    }
+    .table-wrap tr {
+        border: 1px solid #E8EBF1;
+    }
+    .table-wrap th {
+        font-weight: 500;
+        font-size: 16px;
+        color: #505A69;
+    }
+    .table-wrap table th,
+    .table-wrap table td {
+        padding: 5px 10px;
+        font-size: 16px;
+    }
+
+    .table-wrap table td input {
+        font-size: 16px;
+    }
+</style>