Selaa lähdekoodia

新增项目变更计划申请接口

wangliang 1 vuosi sitten
vanhempi
commit
a9937b662f

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

@@ -35,7 +35,7 @@ public class SysSupplier extends BaseEntity implements Serializable {
     private SupplierTypeEnum type;
 
     @ApiModelProperty(value = "是否启用,0:停用,1:启用")
-    @NotNull(message = "s是否启用不能为空")
+    @NotNull(message = "是否启用不能为空")
     private Boolean enable;
 
     @ApiModelProperty(value = "备注")

+ 2 - 1
sop-business/src/main/java/com/qmth/sop/business/entity/SysUser.java

@@ -12,6 +12,7 @@ import io.swagger.annotations.ApiModelProperty;
 import org.hibernate.validator.constraints.Length;
 
 import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 
@@ -76,7 +77,7 @@ public class SysUser extends BaseEntity implements Serializable {
 
     @JsonSerialize(using = ToStringSerializer.class)
     @TableField(exist = false)
-    @NotNull(message = "请选择角色")
+    @NotEmpty(message = "请选择角色")
     private Long[] roleIds;
 
     public String getNewPassword() {

+ 15 - 2
sop-business/src/main/java/com/qmth/sop/business/entity/TBDingApply.java

@@ -4,11 +4,13 @@ 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.DingExceptionApproveEnum;
 import com.qmth.sop.common.enums.InOutTypeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.StringUtils;
 
+import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotEmpty;
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
@@ -45,7 +47,7 @@ public class TBDingApply implements Serializable {
     private Long applyTime;
 
     @ApiModelProperty(value = "补卡原因")
-    @NotNull(message = "补卡原因不能为空")
+    @NotBlank(message = "补卡原因不能为空")
     private String reason;
 
     @ApiModelProperty(value = "附件id")
@@ -68,9 +70,12 @@ public class TBDingApply implements Serializable {
     @ApiModelProperty(value = "创建时间")
     private Long createTime;
 
+    @ApiModelProperty(value = "审批操作,PASS:通过,NO_PASS:不通过")
+    DingExceptionApproveEnum approve;
+
     @TableField(exist = false)
     @ApiModelProperty(value = "流程部署id")
-    @NotNull(message = "流程部署id不能为空")
+    @NotBlank(message = "流程部署id不能为空")
     private String flowDeploymentId;
 
     @ApiModelProperty(value = "流程审批人")
@@ -86,6 +91,14 @@ public class TBDingApply implements Serializable {
         this.attachmentIds = StringUtils.join(attachmentIdList, SystemConstant.LIST_JOIN_SPLIT);
     }
 
+    public DingExceptionApproveEnum getApprove() {
+        return approve;
+    }
+
+    public void setApprove(DingExceptionApproveEnum approve) {
+        this.approve = approve;
+    }
+
     public List<String> getApproveUserIds() {
         return approveUserIds;
     }

+ 82 - 1
sop-business/src/main/java/com/qmth/sop/business/entity/TBProjectExchange.java

@@ -1,12 +1,18 @@
 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.DelayWarnTypeEnum;
+import com.qmth.sop.common.enums.ProductTypeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * <p>
@@ -16,7 +22,7 @@ import java.io.Serializable;
  * @author wangliang
  * @since 2023-08-01
  */
-@ApiModel(value="TBProjectExchange对象", description="项目变更计划表")
+@ApiModel(value = "TBProjectExchange对象", description = "项目变更计划表")
 public class TBProjectExchange implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -26,9 +32,11 @@ public class TBProjectExchange implements Serializable {
     private Long id;
 
     @ApiModelProperty(value = "sop单号")
+    @NotBlank(message = "sop单号不能为空")
     private String sopNo;
 
     @ApiModelProperty(value = "crm单号")
+    @NotBlank(message = "crm单号不能为空")
     private String crmNo;
 
     @ApiModelProperty(value = "变更编号")
@@ -36,12 +44,28 @@ public class TBProjectExchange implements Serializable {
 
     @ApiModelProperty(value = "服务单元id")
     @JsonSerialize(using = ToStringSerializer.class)
+    @NotNull(message = "服务单元id不能为空")
     private Long serviceId;
 
+    @ApiModelProperty(value = "客户经理id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    @NotNull(message = "客户经理id不能为空")
+    private Long accountManagerId;
+
+    @ApiModelProperty(value = "客户类型,OFFICE:教务处,CLOUD_MARK:云阅卷")
+    @NotNull(message = "客户类型不能为空")
+    private ProductTypeEnum customType;
+
+    @ApiModelProperty(value = "客户名称")
+    @NotBlank(message = "客户名称不能为空")
+    private String customName;
+
     @ApiModelProperty(value = "变更类型,PLAN:项目信息及计划,TIME:处理时限,CANCEL:项目取消")
+    @NotNull(message = "变更类型不能为空")
     private DelayWarnTypeEnum type;
 
     @ApiModelProperty(value = "变更原因")
+    @NotBlank(message = "变更原因不能为空")
     private String reason;
 
     @ApiModelProperty(value = "变更内容json")
@@ -57,6 +81,63 @@ public class TBProjectExchange implements Serializable {
     @ApiModelProperty(value = "创建时间")
     private Long createTime;
 
+    @TableField(exist = false)
+    @ApiModelProperty(value = "流程部署id")
+    @NotBlank(message = "流程部署id不能为空")
+    private String flowDeploymentId;
+
+    @ApiModelProperty(value = "流程审批人")
+    @TableField(exist = false)
+    @JsonSerialize(using = ToStringSerializer.class)
+    private List<String> approveUserIds;
+
+    public String getFlowDeploymentId() {
+        return flowDeploymentId;
+    }
+
+    public void setFlowDeploymentId(String flowDeploymentId) {
+        this.flowDeploymentId = flowDeploymentId;
+    }
+
+    public List<String> getApproveUserIds() {
+        return approveUserIds;
+    }
+
+    public void setApproveUserIds(List<String> approveUserIds) {
+        this.approveUserIds = approveUserIds;
+    }
+
+    public void setCode(String exchangeNo, Long userId){
+        this.exchangeNo = exchangeNo;
+        setId(SystemConstant.getDbUuid());
+        setCreateId(userId);
+        setCreateTime(System.currentTimeMillis());
+    }
+
+    public Long getAccountManagerId() {
+        return accountManagerId;
+    }
+
+    public void setAccountManagerId(Long accountManagerId) {
+        this.accountManagerId = accountManagerId;
+    }
+
+    public ProductTypeEnum getCustomType() {
+        return customType;
+    }
+
+    public void setCustomType(ProductTypeEnum customType) {
+        this.customType = customType;
+    }
+
+    public String getCustomName() {
+        return customName;
+    }
+
+    public void setCustomName(String customName) {
+        this.customName = customName;
+    }
+
     public String getExchangeNo() {
         return exchangeNo;
     }

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

@@ -76,9 +76,10 @@ public interface TBDingApplyService extends IService<TBDingApply> {
      * 更新考勤异常打卡时间
      *
      * @param dingExceptionNo
+     * @param dingExceptionApprove
      * @return
      */
-    Boolean updateDingExceptionTime(String dingExceptionNo);
+    Boolean updateDingExceptionTime(String dingExceptionNo, DingExceptionApproveEnum dingExceptionApprove);
 
     /**
      * 考勤异常审核接口

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

@@ -1,7 +1,7 @@
 package com.qmth.sop.business.service;
 
-import com.qmth.sop.business.entity.TBProjectExchange;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.entity.TBProjectExchange;
 
 /**
  * <p>
@@ -13,4 +13,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface TBProjectExchangeService extends IService<TBProjectExchange> {
 
+    /**
+     * 新增项目变更计划申请
+     *
+     * @param tbProjectExchange
+     * @return
+     * @throws InterruptedException
+     */
+    Boolean saveProjectExchange(TBProjectExchange tbProjectExchange) throws InterruptedException;
 }

+ 18 - 11
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java

@@ -58,6 +58,9 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
     @Resource
     TaskService taskService;
 
+    @Resource
+    TBDingApplyService tbDingApplyService;
+
     /**
      * 新增考勤异常补卡申请
      *
@@ -177,23 +180,27 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
      * 更新考勤异常打卡时间
      *
      * @param dingExceptionNo
+     * @param dingExceptionApprove
      * @return
      */
     @Override
     @Transactional
-    public Boolean updateDingExceptionTime(String dingExceptionNo) {
+    public Boolean updateDingExceptionTime(String dingExceptionNo, DingExceptionApproveEnum dingExceptionApprove) {
         TBDingApply tbDingApply = this.getOne(new QueryWrapper<TBDingApply>().lambda().eq(TBDingApply::getDingExceptionNo, dingExceptionNo));
         Optional.ofNullable(tbDingApply).orElseThrow(() -> ExceptionResultEnum.DING_APPLY_NO_DATA.exception());
-
-        TBDing tbDing = tbDingService.getById(tbDingApply.getDingId());
-        Optional.ofNullable(tbDing).orElseThrow(() -> ExceptionResultEnum.DING_NO_DATA.exception());
-
-        if (tbDingApply.getType() == InOutTypeEnum.IN) {
-            tbDing.setSignInTime(tbDingApply.getApplyTime());
-        } else if (tbDingApply.getType() == InOutTypeEnum.OUT) {
-            tbDing.setSignOutTime(tbDingApply.getApplyTime());
+        if (dingExceptionApprove == DingExceptionApproveEnum.PASS) {
+            TBDing tbDing = tbDingService.getById(tbDingApply.getDingId());
+            Optional.ofNullable(tbDing).orElseThrow(() -> ExceptionResultEnum.DING_NO_DATA.exception());
+
+            if (tbDingApply.getType() == InOutTypeEnum.IN) {
+                tbDing.setSignInTime(tbDingApply.getApplyTime());
+            } else if (tbDingApply.getType() == InOutTypeEnum.OUT) {
+                tbDing.setSignOutTime(tbDingApply.getApplyTime());
+            }
+            tbDingService.updateById(tbDing);
         }
-        return tbDingService.updateById(tbDing);
+        tbDingApply.setApprove(dingExceptionApprove);
+        return tbDingApplyService.updateById(tbDingApply);
     }
 
     /**
@@ -234,6 +241,6 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         activitiService.taskApprove(new FlowApproveParam(taskId, FlowApprovePassEnum.PASS, Arrays.asList(String.valueOf(userId)), tfCustomFlowEntity.getCrmNo(), dingExceptionApprove.getTitle()));
 
         TBDingApplyService tbDingApplyService = SpringContextHolder.getBean(TBDingApplyService.class);
-        return tbDingApplyService.updateDingExceptionTime(tfCustomFlowEntity.getCode());
+        return tbDingApplyService.updateDingExceptionTime(tfCustomFlowEntity.getCode(), dingExceptionApprove);
     }
 }

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

@@ -1,10 +1,24 @@
 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.TBProjectExchange;
+import com.qmth.sop.business.entity.TFCustomFlowEntity;
 import com.qmth.sop.business.mapper.TBProjectExchangeMapper;
 import com.qmth.sop.business.service.TBProjectExchangeService;
-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 org.springframework.util.CollectionUtils;
+
+import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.Map;
 
 /**
  * <p>
@@ -17,4 +31,28 @@ import org.springframework.stereotype.Service;
 @Service
 public class TBProjectExchangeServiceImpl extends ServiceImpl<TBProjectExchangeMapper, TBProjectExchange> implements TBProjectExchangeService {
 
+    @Resource
+    ActivitiService activitiService;
+
+    @Resource
+    TFCustomFlowEntityService tfCustomFlowEntityService;
+
+    /**
+     * 新增项目变更计划申请
+     *
+     * @param tbProjectExchange
+     * @return
+     * @throws InterruptedException
+     */
+    @Override
+    @Transactional
+    public Boolean saveProjectExchange(TBProjectExchange tbProjectExchange) throws InterruptedException {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        Map<String, Object> map = activitiService.taskApprove(new FlowApproveParam(tbProjectExchange.getFlowDeploymentId(), FlowApprovePassEnum.START, !CollectionUtils.isEmpty(tbProjectExchange.getApproveUserIds()) ? tbProjectExchange.getApproveUserIds() : Arrays.asList(String.valueOf(sysUser.getId())), tbProjectExchange.getCrmNo()));
+        TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.FLOW_ENTITY);
+        tbProjectExchange.setCode(tfCustomFlowEntity.getCode(), sysUser.getId());
+        tfCustomFlowEntity.setObjId(tbProjectExchange.getId());
+        tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
+        return this.saveOrUpdate(tbProjectExchange);
+    }
 }

+ 34 - 1
sop-business/src/main/resources/db/log/wangliang_update_log.sql

@@ -745,4 +745,37 @@ WHERE id=31;
 
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(3023, '获取违规延期预警待办接口', '/api/admin/my/work_bench/warn/list', 'URL', 64, 25, 'SYS', NULL, 1, 1, 0);
+VALUES(3023, '获取违规延期预警待办接口', '/api/admin/my/work_bench/warn/list', 'URL', 64, 25, 'SYS', NULL, 1, 1, 0);
+
+ALTER TABLE t_b_project_exchange ADD account_manager_id BIGINT
+    COMMENT '客户经理id' NOT NULL after service_id;
+
+ALTER TABLE t_b_project_exchange ADD custom_type VARCHAR(20)
+    COMMENT '客户类型,OFFICE:教务处,CLOUD_MARK:云阅卷' NOT NULL after account_manager_id;
+
+ALTER TABLE t_b_project_exchange ADD custom_name VARCHAR(100)
+    COMMENT '客户名称' NOT NULL after custom_type;
+
+ALTER TABLE t_b_ding_apply ADD approve VARCHAR(20)
+    COMMENT '审批操作,PASS:通过,NO_PASS:不通过' NULL after ding_exception_no;
+
+UPDATE sys_privilege
+SET name='待审核-批量不通过', url='BatchNoPass', `type`='BUTTON', parent_id=27, `sequence`=2, property='AUTH', related='3017,3022', enable=1, default_auth=0, front_display=1
+WHERE id=135;
+UPDATE sys_privilege
+SET name='待审核-不通过', url='NoPass', `type`='LINK', parent_id=27, `sequence`=2, property='AUTH', related='3017,3021', enable=1, default_auth=0, front_display=1
+WHERE id=137;
+
+INSERT INTO sys_privilege
+(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
+VALUES(3024, '处理完毕', 'Finish', 'LINK', 44, 1, 'AUTH', NULL, 1, 0, 1);
+INSERT INTO sys_privilege
+(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
+VALUES(3025, '项目变更计划申请接口', '/api/admin/project/exchange/save', 'URL', 40, 1, 'AUTH', NULL, 1, 1, 0);
+
+UPDATE sys_privilege
+SET name='计划变更报备', url='ProjectExchange', `type`='LINK', parent_id=41, `sequence`=2, property='AUTH', related='3025', enable=1, default_auth=0, front_display=1
+WHERE id=176;
+UPDATE sys_privilege
+SET name='计划变更报备', url='ProjectExchange', `type`='LINK', parent_id=42, `sequence`=2, property='AUTH', related='3025', enable=1, default_auth=0, front_display=1
+WHERE id=185;

+ 1 - 0
sop-common/src/main/java/com/qmth/sop/common/contant/SystemConstant.java

@@ -168,6 +168,7 @@ public class SystemConstant {
     public static final String PREFIX_URL_DING_EXCEPTION_APPLY = "/admin/ding/exception/apply";
     public static final String PREFIX_URL_PRODUCT = "/admin/tb/product";
     public static final String PREFIX_URL_MY_WORK_BENCH = "/admin/my/work_bench";
+    public static final String PREFIX_URL_PROJECT_EXCHANGE = "/admin/project/exchange";
 
     /**
      * 缓存配置

+ 30 - 2
sop-server/src/main/java/com/qmth/sop/server/api/TBProjectExchangeController.java

@@ -1,10 +1,24 @@
 package com.qmth.sop.server.api;
 
 
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.sop.business.entity.TBProjectExchange;
+import com.qmth.sop.business.service.TBProjectExchangeService;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.util.Result;
+import com.qmth.sop.common.util.ResultUtil;
+import io.swagger.annotations.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.RequestBody;
 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;
+
 /**
  * <p>
  * 项目变更计划表 前端控制器
@@ -13,8 +27,22 @@ import org.springframework.web.bind.annotation.RestController;
  * @author wangliang
  * @since 2023-08-01
  */
+@Api(tags = "项目变更计划Controller")
 @RestController
-@RequestMapping("/t-bproject-exchange")
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_PROJECT_EXCHANGE)
 public class TBProjectExchangeController {
+    private final static Logger log = LoggerFactory.getLogger(TBProjectExchangeController.class);
+
+    @Resource
+    TBProjectExchangeService tbProjectExchangeService;
 
+    @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 TBProjectExchange tbProjectExchange, BindingResult bindingResult) throws InterruptedException {
+        if (bindingResult.hasErrors()) {
+            return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
+        }
+        return ResultUtil.ok(tbProjectExchangeService.saveProjectExchange(tbProjectExchange));
+    }
 }