|
@@ -2,21 +2,24 @@ package com.rongwei.bscommon.sys.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
-import com.rongwei.bscommon.sys.service.ZhcxOutsideInspectionItpNdtResultService;
|
|
|
-import com.rongwei.bscommon.sys.service.ZhcxOutsideInspectionItpQcItemResultService;
|
|
|
+import com.rongwei.bscommon.sys.service.*;
|
|
|
+import com.rongwei.bscommon.sys.utils.ZhcxCommon;
|
|
|
import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpDo;
|
|
|
import com.rongwei.bscommon.sys.dao.ZhcxOutsideInspectionItpDao;
|
|
|
-import com.rongwei.bscommon.sys.service.ZhcxOutsideInspectionItpService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpSupervisionDispatchDo;
|
|
|
+import com.rongwei.bsentity.vo.OperOutsideInspectionVo;
|
|
|
import com.rongwei.commonservice.serial.service.SysSerialNumberService;
|
|
|
+import com.rongwei.rwadmincommon.system.domain.SysUserDo;
|
|
|
+import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
|
+import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
import com.rongwei.rwcommonentity.commonservers.vo.SysSerialVo;
|
|
|
+import lombok.extern.java.Log;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -27,15 +30,27 @@ import java.util.List;
|
|
|
* @since 2023-12-26
|
|
|
*/
|
|
|
@Service
|
|
|
+@Log
|
|
|
public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutsideInspectionItpDao, ZhcxOutsideInspectionItpDo> implements ZhcxOutsideInspectionItpService {
|
|
|
|
|
|
@Autowired
|
|
|
private ZhcxOutsideInspectionItpNdtResultService itpNdtResultService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ZhcxOutsideInspectionItpQcItemResultService qcItemResultService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private SysSerialNumberService serialNumberService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ZhcxOutsideInspectionItpSupervisionDispatchService dispatchService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ZhcxSubcontractorUserService userService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ZhcxCommon zhcxCommon;
|
|
|
+
|
|
|
/**
|
|
|
* 拆单
|
|
|
*
|
|
@@ -114,4 +129,102 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
updateBatchById(updateList);
|
|
|
saveBatch(insertList);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String OperInspectionStatus(OperOutsideInspectionVo vo) {
|
|
|
+ /* 10: 取消 20: 拒收 30: 派单 40: 转派 50: 接收 60: 有条件接收 */
|
|
|
+ String operType = vo.getOperType();
|
|
|
+ log.info("执行OperInspectionStatus函数的"+operType+"操作, itpId="+vo.getItpId());
|
|
|
+ log.info("10: 取消 20: 拒收 30: 派单 40: 转派 50: 接收 60: 有条件接收");
|
|
|
+ ZhcxOutsideInspectionItpDo inspectionItpDo = getById(vo.getItpId());
|
|
|
+ String inspectionStatus = inspectionItpDo.getInspectionstatus();
|
|
|
+ String dispatchId = vo.getDispatchId();
|
|
|
+ ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchDo = new ZhcxOutsideInspectionItpSupervisionDispatchDo();
|
|
|
+
|
|
|
+ SysUserVo user = zhcxCommon.getCurrentUser();
|
|
|
+ log.info("当前登录用户ID"+user.getId());
|
|
|
+ boolean hasDispatch = false;
|
|
|
+ if (dispatchId == null) {
|
|
|
+ log.info("没有Dispatch");
|
|
|
+ dispatchDo.setId(SecurityUtil.getUUID());
|
|
|
+ dispatchDo.setCreateuserid(user.getId());
|
|
|
+ dispatchDo.setCreatedate(new Date());
|
|
|
+ dispatchDo.setCreateusername(user.getName());
|
|
|
+ dispatchDo.setItpid(vo.getItpId());
|
|
|
+ } else {
|
|
|
+ log.info("有Dispatch,有dispatchId="+dispatchId);
|
|
|
+ dispatchDo = dispatchService.getById(dispatchId);
|
|
|
+ hasDispatch = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(inspectionStatus) && inspectionStatus.equals("40")) {
|
|
|
+ return "该报验单已取消";
|
|
|
+ }
|
|
|
+ /* 取消 */
|
|
|
+ if ("10".equals(operType)) {
|
|
|
+ /* 10: QC 20: 监理主管 30: 监理检验员 */
|
|
|
+ /* 10: 派单前监理取消 20: 派单后监理取消 30: 派单前QC取消 40: 派单后QC取消 */
|
|
|
+ String cancelSource = vo.getSource();
|
|
|
+ switch (cancelSource) {
|
|
|
+ case "10":
|
|
|
+ dispatchDo.setCanceltype(hasDispatch ? "40" : "30");
|
|
|
+ break;
|
|
|
+ case "20":
|
|
|
+ dispatchDo.setCanceltype(hasDispatch ? "20" : "10");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ dispatchDo.setCanceltype("20");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dispatchDo.setRefusereason(vo.getReason());
|
|
|
+ dispatchDo.setDispatchstatus("30");
|
|
|
+ inspectionItpDo.setInspectionstatus("40");
|
|
|
+ } else if ("20".equals(operType)) {
|
|
|
+ /* 检验员才有拒收 */
|
|
|
+ dispatchDo.setInspectionconclusion("20");
|
|
|
+ dispatchDo.setRefusereason(vo.getReason());
|
|
|
+ inspectionItpDo.setInspectionstatus("30");
|
|
|
+ } else if (Arrays.asList("30", "40").contains(operType)) {
|
|
|
+ if ("30".equals(operType) && hasDispatch) {
|
|
|
+ return "该报验单已派单";
|
|
|
+ }
|
|
|
+ SysUserDo toUser = userService.getById(vo.getToUser());
|
|
|
+ dispatchDo.setSupervisionid(toUser.getId());
|
|
|
+ dispatchDo.setSupervision(toUser.getName());
|
|
|
+ dispatchDo.setSupervisionphone(toUser.getMobile());
|
|
|
+ dispatchDo.setSupervisionaccount(toUser.getAccount());
|
|
|
+ /* 已派单 */
|
|
|
+ dispatchDo.setDispatchstatus("20");
|
|
|
+ } else {
|
|
|
+ /* 接收/有条件接收 */
|
|
|
+ dispatchDo.setInspectionconclusion(operType.equals("50") ? "10" : "30");
|
|
|
+ dispatchDo.setRemark(vo.getReason());
|
|
|
+ inspectionItpDo.setInspectionstatus("30");
|
|
|
+ }
|
|
|
+ /* 检验员拒收和接收时会传回检验开始/结束时间和文件 */
|
|
|
+ if (Arrays.asList("20", "50", "60").contains(operType)) {
|
|
|
+ dispatchDo.setCheckstarttime(vo.getStartDate());
|
|
|
+ dispatchDo.setCheckendtime(vo.getEndDate());
|
|
|
+ dispatchDo.setSfiles(vo.getFiles());
|
|
|
+ }
|
|
|
+ /* 当前操作人 */
|
|
|
+ if (user != null && user.getId() != null) {
|
|
|
+ inspectionItpDo.setModifydate(new Date());
|
|
|
+ inspectionItpDo.setModifyuserid(user.getId());
|
|
|
+ inspectionItpDo.setModifyusername(user.getName());
|
|
|
+ dispatchDo.setModifydate(new Date());
|
|
|
+ dispatchDo.setModifyuserid(user.getId());
|
|
|
+ dispatchDo.setModifyusername(user.getName());
|
|
|
+ }
|
|
|
+ dispatchDo.setDeleted("0");
|
|
|
+ inspectionItpDo.setDeleted("0");
|
|
|
+ if (hasDispatch) {
|
|
|
+ dispatchService.updateById(dispatchDo);
|
|
|
+ } else {
|
|
|
+ dispatchService.save(dispatchDo);
|
|
|
+ }
|
|
|
+ updateById(inspectionItpDo);
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
}
|