Explorar o código

新增考前异常流程申请

wangliang hai 1 ano
pai
achega
dabeb73613

+ 6 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/params/FlowApproveParam.java

@@ -45,6 +45,12 @@ public class FlowApproveParam implements Serializable {
 
     }
 
+    public FlowApproveParam(String flowDeploymentId, FlowApprovePassEnum approve, List<String> approveUserIds) {
+        this.flowDeploymentId = flowDeploymentId;
+        this.approve = approve;
+        this.approveUserIds = approveUserIds;
+    }
+
     public FlowApproveParam(String flowDeploymentId, FlowApprovePassEnum approve, String formProperties, List<String> approveUserIds) {
         this.flowDeploymentId = flowDeploymentId;
         this.approve = approve;

+ 30 - 1
sop-business/src/main/java/com/qmth/sop/business/entity/TBDingApply.java

@@ -1,11 +1,15 @@
 package com.qmth.sop.business.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.sop.common.contant.SystemConstant;
 import com.qmth.sop.common.enums.InOutTypeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 
 /**
@@ -16,7 +20,7 @@ import java.io.Serializable;
  * @author wangliang
  * @since 2023-08-01
  */
-@ApiModel(value="TBDingApply对象", description="考勤补卡申请表")
+@ApiModel(value = "TBDingApply对象", description = "考勤补卡申请表")
 public class TBDingApply implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -27,18 +31,23 @@ public class TBDingApply implements Serializable {
 
     @ApiModelProperty(value = "考勤id")
     @JsonSerialize(using = ToStringSerializer.class)
+    @NotNull(message = "考勤id不能为空")
     private Long dingId;
 
     @ApiModelProperty(value = "类型,IN:签到,OUT:签退")
+    @NotNull(message = "类型不能为空")
     private InOutTypeEnum type;
 
     @ApiModelProperty(value = "补卡时间")
+    @NotNull(message = "补卡时间不能为空")
     private Long applyTime;
 
     @ApiModelProperty(value = "补卡原因")
+    @NotNull(message = "补卡原因不能为空")
     private String reason;
 
     @ApiModelProperty(value = "附件id")
+    @NotBlank(message = "补卡附件不能为空")
     private String attachmentIds;
 
     @ApiModelProperty(value = "考勤异常编号")
@@ -52,6 +61,26 @@ public class TBDingApply implements Serializable {
     @ApiModelProperty(value = "创建时间")
     private Long createTime;
 
+    @TableField(exist = false)
+    @ApiModelProperty(value = "流程部署id")
+    @NotNull(message = "流程部署id不能为空")
+    private String flowDeploymentId;
+
+    public void setCode(String dingExceptionNo, Long userId) {
+        this.dingExceptionNo = dingExceptionNo;
+        setId(SystemConstant.getDbUuid());
+        setCreateId(userId);
+        setCreateTime(System.currentTimeMillis());
+    }
+
+    public String getFlowDeploymentId() {
+        return flowDeploymentId;
+    }
+
+    public void setFlowDeploymentId(String flowDeploymentId) {
+        this.flowDeploymentId = flowDeploymentId;
+    }
+
     public Long getId() {
         return id;
     }

+ 3 - 1
sop-business/src/main/java/com/qmth/sop/business/entity/TBQualityProblemApply.java

@@ -94,9 +94,11 @@ public class TBQualityProblemApply extends BaseEntity implements Serializable {
         this.attachmentIds = attachmentIds;
     }
 
-    public void setCode(String problemNo){
+    public void setCode(String problemNo, Long userId) {
         this.problemNo = problemNo;
         setId(SystemConstant.getDbUuid());
+        setCreateId(userId);
+        setCreateTime(System.currentTimeMillis());
     }
 
     public String getFormProperties() {

+ 9 - 1
sop-business/src/main/java/com/qmth/sop/business/service/TBDingApplyService.java

@@ -1,7 +1,7 @@
 package com.qmth.sop.business.service;
 
-import com.qmth.sop.business.entity.TBDingApply;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.entity.TBDingApply;
 
 /**
  * <p>
@@ -13,4 +13,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface TBDingApplyService extends IService<TBDingApply> {
 
+    /**
+     * 新增考勤异常补卡申请
+     *
+     * @param tbDingApply
+     * @return
+     * @throws InterruptedException
+     */
+    Boolean saveDingApply(TBDingApply tbDingApply) throws InterruptedException;
 }

+ 38 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java

@@ -1,10 +1,23 @@
 package com.qmth.sop.business.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.sop.business.activiti.service.ActivitiService;
+import com.qmth.sop.business.bean.params.FlowApproveParam;
+import com.qmth.sop.business.entity.SysUser;
 import com.qmth.sop.business.entity.TBDingApply;
+import com.qmth.sop.business.entity.TFCustomFlowEntity;
 import com.qmth.sop.business.mapper.TBDingApplyMapper;
 import com.qmth.sop.business.service.TBDingApplyService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.sop.business.service.TFCustomFlowEntityService;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.enums.FlowApprovePassEnum;
+import com.qmth.sop.common.util.ServletUtil;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.Map;
 
 /**
  * <p>
@@ -17,4 +30,28 @@ import org.springframework.stereotype.Service;
 @Service
 public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDingApply> implements TBDingApplyService {
 
+    @Resource
+    TFCustomFlowEntityService tfCustomFlowEntityService;
+
+    @Resource
+    ActivitiService activitiService;
+
+    /**
+     * 新增考勤异常补卡申请
+     *
+     * @param tbDingApply
+     * @return
+     * @throws InterruptedException
+     */
+    @Override
+    @Transactional
+    public Boolean saveDingApply(TBDingApply tbDingApply) throws InterruptedException {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        Map<String, Object> map = activitiService.taskApprove(new FlowApproveParam(tbDingApply.getFlowDeploymentId(), FlowApprovePassEnum.START, Arrays.asList(String.valueOf(sysUser.getId()))));
+        TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.CUSTOM_FLOW_ENTITY);
+        tbDingApply.setCode(tfCustomFlowEntity.getCode(), sysUser.getId());
+        tfCustomFlowEntity.setObjId(tbDingApply.getId());
+        tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
+        return this.saveOrUpdate(tbDingApply);
+    }
 }

+ 1 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBQualityProblemApplyServiceImpl.java

@@ -67,7 +67,7 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         Map<String, Object> map = activitiService.taskApprove(new FlowApproveParam(tbQualityProblemApply.getFlowDeploymentId(), FlowApprovePassEnum.START, tbQualityProblemApply.getFormProperties(), Arrays.asList(String.valueOf(sysUser.getId()))));
         TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.CUSTOM_FLOW_ENTITY);
-        tbQualityProblemApply.setCode(tfCustomFlowEntity.getCode());
+        tbQualityProblemApply.setCode(tfCustomFlowEntity.getCode(), sysUser.getId());
         tfCustomFlowEntity.setObjId(tbQualityProblemApply.getId());
         tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
         return this.saveOrUpdate(tbQualityProblemApply);

+ 35 - 0
sop-business/src/main/resources/db/log/wangliang_update_log.sql

@@ -458,6 +458,41 @@ SET name='上报质量问题', url='ProblemSubmit', `type`='LINK', parent_id=41,
 WHERE id=179;
 
 --2023.8.15update
+INSERT INTO sys_privilege
+(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
+VALUES(3017, '考勤异常申请接口', '/api/admin/ding/exception/apply/save', 'URL', 26, 1, 'AUTH', NULL, 1, 1, 0);
+
+UPDATE sys_privilege
+SET name='列表', url='List', `type`='LIST', parent_id=21, `sequence`=1, property='AUTH', related='1031', enable=1, default_auth=0, front_display=1
+WHERE id=127;
+UPDATE sys_privilege
+SET name='考勤打卡', url='ding', `type`='MENU', parent_id=25, `sequence`=1, property=NULL, related='3017', enable=1, default_auth=0, front_display=1
+WHERE id=26;
+UPDATE sys_privilege
+SET name='待审核-列表', url='List', `type`='LIST', parent_id=27, `sequence`=1, property='AUTH', related='3017', enable=1, default_auth=0, front_display=1
+WHERE id=131;
+UPDATE sys_privilege
+SET name='待审核-批量通过', url='BatchPass', `type`='BUTTON', parent_id=27, `sequence`=1, property='AUTH', related='3017', enable=1, default_auth=0, front_display=1
+WHERE id=132;
+UPDATE sys_privilege
+SET name='待审核-查询', url='Select', `type`='BUTTON', parent_id=27, `sequence`=3, property='AUTH', related='3017', enable=1, default_auth=0, front_display=1
+WHERE id=134;
+UPDATE sys_privilege
+SET name='待审核-批量拒绝', url='BatchReject', `type`='BUTTON', parent_id=27, `sequence`=2, property='AUTH', related='3017', enable=1, default_auth=0, front_display=1
+WHERE id=135;
+UPDATE sys_privilege
+SET name='待审核-通过', url='Pass', `type`='LINK', parent_id=27, `sequence`=1, property='AUTH', related='3017', enable=1, default_auth=0, front_display=1
+WHERE id=136;
+UPDATE sys_privilege
+SET name='待审核-拒绝', url='Reject', `type`='LINK', parent_id=27, `sequence`=2, property='AUTH', related='3017', enable=1, default_auth=0, front_display=1
+WHERE id=137;
+UPDATE sys_privilege
+SET name='已审核-列表', url='List', `type`='LIST', parent_id=27, `sequence`=1, property='AUTH', related='3017', enable=1, default_auth=0, front_display=1
+WHERE id=138;
+UPDATE sys_privilege
+SET name='已审核-查询', url='Select', `type`='BUTTON', parent_id=27, `sequence`=3, property='AUTH', related='3017', enable=1, default_auth=0, front_display=1
+WHERE id=140;
+
 ALTER TABLE t_b_quality_problem_apply ADD CONSTRAINT t_b_quality_problem_apply_UN_probem_no UNIQUE KEY (problem_no);
 
 ALTER TABLE t_b_ding_apply CHANGE COLUMN flow_id ding_exception_no VARCHAR(100)

+ 5 - 5
sop-common/src/main/java/com/qmth/sop/common/enums/TFCustomTypeEnum.java

@@ -9,15 +9,15 @@ package com.qmth.sop.common.enums;
  */
 public enum TFCustomTypeEnum {
 
-    OFFICE_SOP_FLOW("教务处SOP", "officeSopFlow", "testform1.zip","SOPO"),
+    OFFICE_SOP_FLOW("教务处SOP", "officeSopFlow", "testform1.zip","SOP_O"),
 
-    CLOUD_MARK_SOP_FLOW("云阅卷SOP", "cloudMarkSopFlow", null,"SOPC"),
+    CLOUD_MARK_SOP_FLOW("云阅卷SOP", "cloudMarkSopFlow", null,"SOP_C"),
 
-    DING_EXCEPTION_FLOW("考勤异常审核流程", "dingExceptionFlow", "dingExceptionFlow.zip","SOPD"),
+    DING_EXCEPTION_FLOW("考勤异常审核流程", "dingExceptionFlow", "dingExceptionFlow.zip","DE"),
 
-    PROJECT_EXCHANGE_FLOW("项目计划变更流程 ", "projectExchangeFlow", "projectExchangeFlow.zip","SOPE"),
+    PROJECT_EXCHANGE_FLOW("项目计划变更流程 ", "projectExchangeFlow", "projectExchangeFlow.zip","SOP_E"),
 
-    QUALITY_PROBLEM_FLOW("质量问题反馈流程 ", "qualityProblemFlow", "qualityProblemFlow.zip","SOPQ");
+    QUALITY_PROBLEM_FLOW("质量问题反馈流程 ", "qualityProblemFlow", "qualityProblemFlow.zip","QF");
 
     private String title;
 

+ 9 - 4
sop-server/src/main/java/com/qmth/sop/server/api/TBDingApplyController.java

@@ -2,7 +2,8 @@ package com.qmth.sop.server.api;
 
 
 import com.qmth.boot.api.constant.ApiConstant;
-import com.qmth.sop.business.entity.TBQualityProblemApply;
+import com.qmth.sop.business.entity.TBDingApply;
+import com.qmth.sop.business.service.TBDingApplyService;
 import com.qmth.sop.common.contant.SystemConstant;
 import com.qmth.sop.common.util.Result;
 import com.qmth.sop.common.util.ResultUtil;
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import javax.validation.Valid;
 
 /**
@@ -28,13 +30,16 @@ import javax.validation.Valid;
 @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_DING_EXCEPTION_APPLY)
 public class TBDingApplyController {
 
-    @ApiOperation(value = "考勤异常申请新增接口")
+    @Resource
+    TBDingApplyService tbDingApplyService;
+
+    @ApiOperation(value = "考勤异常申请接口")
     @RequestMapping(value = "/save", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
-    public Result save(@Valid @ApiParam(value = "考勤异常申请信息", required = true) @RequestBody TBQualityProblemApply tbQualityProblemApply, BindingResult bindingResult) throws InterruptedException {
+    public Result save(@Valid @ApiParam(value = "考勤异常申请信息", required = true) @RequestBody TBDingApply tbDingApply, BindingResult bindingResult) throws InterruptedException {
         if (bindingResult.hasErrors()) {
             return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
         }
-        return ResultUtil.ok();
+        return ResultUtil.ok(tbDingApplyService.saveDingApply(tbDingApply));
     }
 }