Quellcode durchsuchen

pms 瑞都日报 审批

zhangcl vor 1 Woche
Ursprung
Commit
e10d060a92

+ 8 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrddailyreport/IotRdDailyReportController.java

@@ -97,6 +97,14 @@ public class IotRdDailyReportController {
         return success(true);
     }
 
+    @PutMapping("/approval")
+    @Operation(summary = "审批日报")
+    @PreAuthorize("@ss.hasPermission('pms:iot-rd-daily-report:update')")
+    public CommonResult<Boolean> approvalRdDailyReport(@Valid @RequestBody IotRdDailyReportSaveReqVO updateReqVO) {
+        iotRdDailyReportService.approvalRdDailyReport(updateReqVO);
+        return success(true);
+    }
+
     @DeleteMapping("/delete")
     @Operation(summary = "删除瑞都日报")
     @Parameter(name = "id", description = "编号", required = true)

+ 4 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrddailyreport/vo/IotRdDailyReportRespVO.java

@@ -178,6 +178,10 @@ public class IotRdDailyReportRespVO {
     @ExcelProperty("审批状态 未提交、审批中、审批通过、审批不通过、已取消")
     private Integer auditStatus;
 
+    @Schema(description = "审批意见", example = "审核通过")
+    @ExcelProperty("审批意见")
+    private String opinion;
+
     @Schema(description = "创建时间")
     @ExcelProperty("创建时间")
     private LocalDateTime createTime;

+ 4 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrddailyreport/vo/IotRdDailyReportSaveReqVO.java

@@ -130,7 +130,10 @@ public class IotRdDailyReportSaveReqVO {
     @Schema(description = "流程实例id", example = "16415")
     private String processInstanceId;
 
-    @Schema(description = "审批状态 未提交、审批中、审批通过、审批不通过、已取消", example = "1")
+    @Schema(description = "审批状态 未提交0、审批中10、审批通过20、审批不通过30、已取消40", example = "1")
     private Integer auditStatus;
 
+    @Schema(description = "审批意见", example = "审核通过")
+    private String opinion;
+
 }

+ 4 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotrddailyreport/IotRdDailyReportDO.java

@@ -191,6 +191,10 @@ public class IotRdDailyReportDO extends BaseDO {
      * 审批状态 未提交、审批中、审批通过、审批不通过、已取消
      */
     private Integer auditStatus;
+    /**
+     * 审核意见
+     */
+    private String opinion;
     /**
      * 日报填写时间
      */

+ 7 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrddailyreport/IotRdDailyReportService.java

@@ -30,6 +30,13 @@ public interface IotRdDailyReportService {
      */
     void updateIotRdDailyReport(@Valid IotRdDailyReportSaveReqVO updateReqVO);
 
+    /**
+     * 审批瑞都日报
+     *
+     * @param updateReqVO 更新信息
+     */
+    void approvalRdDailyReport(@Valid IotRdDailyReportSaveReqVO updateReqVO);
+
     /**
      * 删除瑞都日报
      *

+ 24 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrddailyreport/IotRdDailyReportServiceImpl.java

@@ -1,11 +1,13 @@
 package cn.iocoder.yudao.module.pms.service.iotrddailyreport;
 
+import cn.hutool.core.util.ObjUtil;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 import cn.iocoder.yudao.module.pms.controller.admin.iotrddailyreport.vo.IotRdDailyReportPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.iotrddailyreport.vo.IotRdDailyReportSaveReqVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotrddailyreport.IotRdDailyReportDO;
 import cn.iocoder.yudao.module.pms.dal.mysql.iotrddailyreport.IotRdDailyReportMapper;
+import cn.iocoder.yudao.module.supplier.enums.common.SupplierAuditStatusEnum;
 import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
 
@@ -43,9 +45,27 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
         validateIotRdDailyReportExists(updateReqVO.getId());
         // 更新
         IotRdDailyReportDO updateObj = BeanUtils.toBean(updateReqVO, IotRdDailyReportDO.class);
+        // 设置 日报填写状态 保存 已完成
+        updateObj.setStatus(1);
+        // 设置 日报审批状态为 审批中 auditStatus = 10
+        updateObj.setAuditStatus(10);
         iotRdDailyReportMapper.updateById(updateObj);
     }
 
+    @Override
+    public void approvalRdDailyReport(IotRdDailyReportSaveReqVO updateReqVO) {
+        // 如果审批拒绝 修改日报 填报状态 status = 0 填写中  审批状态 auditStatus = 审批不通过
+        // 审批通过 设置 日报审批状态 auditStatus = 审批通过
+        // 校验存在
+        IotRdDailyReportDO dailyReport = validateIotRdDailyReportExists(updateReqVO.getId());
+        dailyReport.setAuditStatus(updateReqVO.getAuditStatus());
+        if (SupplierAuditStatusEnum.REJECT.getStatus().equals(updateReqVO.getAuditStatus())) {
+            dailyReport.setStatus(0);
+        }
+        dailyReport.setOpinion(updateReqVO.getOpinion());
+        iotRdDailyReportMapper.updateById(dailyReport);
+    }
+
     @Override
     public void deleteIotRdDailyReport(Long id) {
         // 校验存在
@@ -54,10 +74,12 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
         iotRdDailyReportMapper.deleteById(id);
     }
 
-    private void validateIotRdDailyReportExists(Long id) {
-        if (iotRdDailyReportMapper.selectById(id) == null) {
+    private IotRdDailyReportDO validateIotRdDailyReportExists(Long id) {
+        IotRdDailyReportDO dailyReport = iotRdDailyReportMapper.selectById(id);
+        if (ObjUtil.isEmpty(dailyReport)) {
             throw exception(IOT_RD_DAILY_REPORT_NOT_EXISTS);
         }
+        return dailyReport;
     }
 
     @Override