Prechádzať zdrojové kódy

内部报验功能-执行,接收/有条件接收/拒收

wangming 1 rok pred
rodič
commit
a20ef2253f

+ 8 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxInsideInspectionService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.rongwei.bsentity.dto.InsideInspectionOperRequest;
 import com.rongwei.bsentity.dto.inside.InsideInspectionCancelDto;
 import com.rongwei.bsentity.dto.inside.InsideInspectionDispatchRequest;
+import com.rongwei.bsentity.dto.inside.InsideInspectionExecuteRequest;
 
 /**
  * <p>
@@ -43,4 +44,11 @@ public interface ZhcxInsideInspectionService extends IService<ZhcxInsideInspecti
      * @param dto
      */
     void reDispatch(InsideInspectionDispatchRequest dto);
+
+    /**
+     * 执行:接收、有条件接收、拒收
+     *
+     * @param req
+     */
+    void execute(InsideInspectionExecuteRequest req);
 }

+ 96 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxInsideInspectionServiceImpl.java

@@ -16,6 +16,7 @@ import com.rongwei.bsentity.dto.InsideOperLogDto;
 import com.rongwei.bsentity.dto.OperDto;
 import com.rongwei.bsentity.dto.inside.InsideInspectionCancelDto;
 import com.rongwei.bsentity.dto.inside.InsideInspectionDispatchRequest;
+import com.rongwei.bsentity.dto.inside.InsideInspectionExecuteRequest;
 import com.rongwei.bsentity.dto.inside.InsideOperDto;
 import com.rongwei.commonservice.serial.service.SysSerialNumberService;
 import com.rongwei.rwadmincommon.system.domain.SysUserDo;
@@ -179,6 +180,101 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         dispatch(dto);
     }
 
+    /**
+     * 执行:接收、有条件接收、拒收
+     *
+     * @param req
+     */
+    @Override
+    public void execute(InsideInspectionExecuteRequest req) {
+        if(ObjectUtil.isEmpty(req.getInsideIdList())) {
+            return ;
+        }
+
+        OperDto operDto = getOper();
+
+        List<String> msgList = new ArrayList<>();
+        List<ZhcxInsideInspectionDispatchDo> dispatchList = new ArrayList<>();
+        List<ZhcxInsideInspectionDo> inspectionList = new ArrayList<>();
+
+        for(String insideId : req.getInsideIdList()) {
+            InsideOperDto inOper = getInsideOperDto(insideId);
+            inOper.setOperTime(operDto.getOperTime());
+            inOper.setOperUser(operDto.getOperUser());
+
+            //校验
+            String msg = checkParam4Execute(inOper, req);
+
+            if(ObjectUtil.isNotEmpty(msg)) {
+                msgList.add(msg);
+                continue;
+            }
+
+            //派单
+            ZhcxInsideInspectionDispatchDo dispatch = new ZhcxInsideInspectionDispatchDo();
+            dispatch.setId(inOper.getDispatch().getId());
+            dispatch.setInspectionconclusion(req.getConclusion());
+            dispatch.setRefusereason(req.getReason());
+            dispatch.setCheckstarttime(req.getStartDate());
+            dispatch.setCheckendtime(req.getEndDate());
+            dispatch.setSfiles(req.getFiles());
+            dispatch.setCanvas(req.getCanvas());
+            dispatch.setSignature(req.getSignature());
+            dispatchList.add(dispatch);
+
+            //报验单
+            ZhcxInsideInspectionDo inspection = new ZhcxInsideInspectionDo();
+            inspection.setInspectioncode(insideId);
+            inspection.setInspectionstatus("30");
+
+            if(ObjectUtil.isNull(inOper.getInspection().getInspectioncomplatetime())) {
+                inspection.setInspectioncomplatetime(new Date());
+            }
+
+            inspectionList.add(inspection);
+        }
+
+        if(ObjectUtil.isNotEmpty(msgList)) {
+            throw new CustomException(StringUtils.join(msgList, "<br>"));
+        }
+
+        //批量派单
+        dispatchService.updateBatchById(dispatchList);
+        //修改
+        updateBatchById(inspectionList);
+    }
+
+    /**
+     * 执行校验
+     *
+     * @param inOper
+     * @param req
+     * @return
+     */
+    private String checkParam4Execute(InsideOperDto inOper, InsideInspectionExecuteRequest req) {
+
+        if(ObjectUtil.isEmpty(inOper.getDispatch().getSupervisionid())) {
+            return "单据号:".concat(inOper.getInspection().getInspectioncode()).concat("未派单,请先派单再执行");
+        }
+
+        if(!inOper.getOperUser().getId().equals(inOper.getDispatch().getSupervisionid())) {
+            return "单据号:".concat(inOper.getInspection().getInspectioncode()).concat("已被改派,不能操作,请刷新数据查看");
+        }
+
+        //取消
+        if("40".equals(inOper.getInspection().getInspectionstatus())){
+            return "单据号:".concat(inOper.getInspection().getInspectioncode()).concat("已被取消,请刷新数据查看");
+        }
+
+        //非待报验状态
+        if(!"20".equals(inOper.getInspection().getInspectionstatus())) {
+            return "单据号:".concat(inOper.getInspection().getInspectioncode()).concat("已被执行,请刷新数据查看");
+        }
+
+
+        return null;
+    }
+
     /**
      * 派单校验
      *

+ 54 - 0
business-entity/src/main/java/com/rongwei/bsentity/dto/inside/InsideInspectionExecuteRequest.java

@@ -0,0 +1,54 @@
+package com.rongwei.bsentity.dto.inside;
+
+import com.rongwei.bsentity.dto.InsideInspectionOperBaseDto;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+import java.util.Date;
+
+@Setter
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+public class InsideInspectionExecuteRequest extends InsideInspectionOperBaseDto {
+
+    /**
+     * 结论
+     * 10:接收
+     * 20:拒收
+     * 30:有条件接收
+     */
+    private String conclusion;
+
+    /**
+     * 签名
+     */
+    private String signature;
+
+    /**
+     * 补充说明
+     */
+    private String reason;
+
+
+    /**
+     * 开始时间
+     * */
+    private Date startDate;
+
+    /**
+     * 结束时间
+     */
+    private Date endDate;
+
+    /**
+     * 附件
+     */
+    private String files;
+    /**
+     * 画布
+     */
+    private String canvas;
+}

+ 13 - 0
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxInsideInspectionController.java

@@ -4,6 +4,7 @@ package com.rongwei.bsserver.controller;
 import com.rongwei.bscommon.sys.service.ZhcxInsideInspectionService;
 import com.rongwei.bsentity.dto.InsideInspectionOperRequest;
 import com.rongwei.bsentity.dto.inside.InsideInspectionDispatchRequest;
+import com.rongwei.bsentity.dto.inside.InsideInspectionExecuteRequest;
 import com.rongwei.rwcommon.base.R;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -63,5 +64,17 @@ public class ZhcxInsideInspectionController {
         zhcxInsideInspectionService.reDispatch(req);
         return R.ok("改派成功");
     }
+
+    /**
+     * 执行
+     *
+     * @param req
+     * @return
+     */
+    @PostMapping("/execute")
+    public R execute(@RequestBody InsideInspectionExecuteRequest req){
+        zhcxInsideInspectionService.execute(req);
+        return R.ok("执行成功");
+    }
 }