|
@@ -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;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 派单校验
|
|
|
*
|