|
@@ -2,7 +2,9 @@ package com.rongwei.bscommon.sys.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.rongwei.bscommon.sys.service.*;
|
|
|
import com.rongwei.bscommon.sys.utils.ZhcxCommon;
|
|
@@ -22,6 +24,7 @@ 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 org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
@@ -124,12 +127,14 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public R operInspectionStatus(List<OperOutsideInspectionVo> vo) {
|
|
|
/* 10: 取消 20: 拒收 30: 派单 40: 转派 50: 接收 60: 有条件接收 */
|
|
|
// String operType = vo.getOperType();
|
|
|
// List<String> itpIds = vo.getItpIds();
|
|
|
// List<String> dispatchIds = vo.getDispatchIds();
|
|
|
boolean hasDispatch ;
|
|
|
+ boolean hasUpdate ;
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
List<ZhcxOutsideInspectionItpSupervisionDispatchDo> saveDispatchDos = new ArrayList<>();
|
|
|
List<ZhcxOutsideInspectionItpSupervisionDispatchDo> updateDispatchDos = new ArrayList<>();
|
|
@@ -139,29 +144,40 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
String itpId = vo.get(i).getItpId();
|
|
|
String dispatchId = vo.get(i).getDispatchId();
|
|
|
hasDispatch = false;
|
|
|
+ hasUpdate = false;
|
|
|
log.info("执行OperInspectionStatus函数的"+operType+"操作, itpId="+itpId);
|
|
|
- log.info("10: 取消 20: 拒收 30: 派单 40: 转派 50: 接收 60: 有条件接收");
|
|
|
+ log.info("10: 取消 20: 拒收 30: 派单 40: 转派 50: 接收 60: 有条件接收 70:修改检验开始结束时间");
|
|
|
ZhcxOutsideInspectionItpDo inspectionItpDo = getById(itpId);
|
|
|
String inspectionStatus = inspectionItpDo.getInspectionstatus();
|
|
|
String inspectioncode = inspectionItpDo.getInspectioncode();
|
|
|
- ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchDo = new ZhcxOutsideInspectionItpSupervisionDispatchDo();
|
|
|
- if (dispatchId != null) {
|
|
|
- dispatchDo = dispatchService.getById(dispatchId);
|
|
|
- } else {
|
|
|
- dispatchDo.setId(SecurityUtil.getUUID());
|
|
|
- }
|
|
|
+ LambdaQueryWrapper<ZhcxOutsideInspectionItpSupervisionDispatchDo> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.eq(ZhcxOutsideInspectionItpSupervisionDispatchDo::getItpid,itpId);
|
|
|
+ ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchDo = dispatchService.getOne(wrapper);
|
|
|
+ //ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchDo = new ZhcxOutsideInspectionItpSupervisionDispatchDo();
|
|
|
+// if (dispatchId != null) {
|
|
|
+// dispatchDo = dispatchService.getById(dispatchId);
|
|
|
+// } else {
|
|
|
+// dispatchDo.setId(SecurityUtil.getUUID());
|
|
|
+// }
|
|
|
SysUserVo user = zhcxCommon.getCurrentUser();
|
|
|
log.info("当前登录用户ID"+user.getId());
|
|
|
-
|
|
|
- if (dispatchId == null || (dispatchDo != null && dispatchDo.getSupervisionid() == null)) {
|
|
|
+ //10未派单 20已派单
|
|
|
+ if (dispatchDo != null && "20".equals(dispatchDo.getDispatchstatus())) {
|
|
|
+ log.info("有Dispatch,有dispatchId="+dispatchId);
|
|
|
+ hasDispatch = true;
|
|
|
+ hasUpdate = true;
|
|
|
+ }else if(dispatchDo != null && !"20".equals(dispatchDo.getDispatchstatus())){
|
|
|
+ hasUpdate = true;
|
|
|
+ } else {
|
|
|
log.info("没有Dispatch");
|
|
|
+ dispatchDo = new ZhcxOutsideInspectionItpSupervisionDispatchDo();
|
|
|
+ dispatchDo.setId(SecurityUtil.getUUID());
|
|
|
dispatchDo.setCreateuserid(user.getId());
|
|
|
dispatchDo.setCreatedate(new Date());
|
|
|
dispatchDo.setCreateusername(user.getName());
|
|
|
dispatchDo.setItpid(itpId);
|
|
|
- } else {
|
|
|
- log.info("有Dispatch,有dispatchId="+dispatchId);
|
|
|
- hasDispatch = true;
|
|
|
+ dispatchDo.setDispatchstatus("10");
|
|
|
+ dispatchDo.setDeleted("0");
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotEmpty(inspectionStatus) && inspectionStatus.equals("40")) {
|
|
@@ -171,7 +187,7 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
}
|
|
|
/* 取消 */
|
|
|
if ("10".equals(operType)) {
|
|
|
- /* 10: QC 20: 监理主管 30: 监理检验员 */
|
|
|
+ /* 10: QC 20: 监理 */
|
|
|
/* 10: 派单前监理取消 20: 派单后监理取消 30: 派单前QC取消 40: 派单后QC取消 */
|
|
|
String cancelSource = vo.get(i).getSource();
|
|
|
switch (cancelSource) {
|
|
@@ -181,9 +197,6 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
case "20":
|
|
|
dispatchDo.setCanceltype(hasDispatch ? "20" : "10");
|
|
|
break;
|
|
|
- default:
|
|
|
- dispatchDo.setCanceltype("20");
|
|
|
- break;
|
|
|
}
|
|
|
dispatchDo.setRefusereason(vo.get(i).getReason());
|
|
|
dispatchDo.setDispatchstatus("30");
|
|
@@ -192,6 +205,7 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
/* 检验员才有拒收 */
|
|
|
dispatchDo.setInspectionconclusion("20");
|
|
|
dispatchDo.setRefusereason(vo.get(i).getReason());
|
|
|
+ dispatchDo.setLastrefusereason(vo.get(i).getReason());
|
|
|
inspectionItpDo.setInspectionstatus("30");
|
|
|
} else if (Arrays.asList("30", "40").contains(operType)) {
|
|
|
if ("30".equals(operType) && hasDispatch) {
|
|
@@ -234,7 +248,7 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
if(sb.length() > 0){
|
|
|
continue;
|
|
|
}else{
|
|
|
- if (hasDispatch) {
|
|
|
+ if (hasUpdate) {
|
|
|
updateDispatchDos.add(dispatchDo);
|
|
|
}else{
|
|
|
saveDispatchDos.add(dispatchDo);
|