|
@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.rongwei.bscommon.sys.feign.SysNotifyFeginService;
|
|
|
import com.rongwei.bscommon.sys.service.*;
|
|
|
import com.rongwei.bscommon.sys.utils.ZhcxCommon;
|
|
|
+import com.rongwei.bsentity.domain.ZhcxOutsideInspectionComponentTrackDo;
|
|
|
import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpDo;
|
|
|
import com.rongwei.bscommon.sys.dao.ZhcxOutsideInspectionItpDao;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -79,6 +80,9 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
@Autowired
|
|
|
private SysFileItemService sysFileItemService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ZhcxOutsideInspectionComponentTrackService inspectionComponentTrackService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private SysNotifyFeginService notifyFeginService;
|
|
|
@Value("${temp.filepath:#{null}}")
|
|
@@ -110,72 +114,12 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
//只有一个构件和报验点时
|
|
|
//不需要拆单
|
|
|
if(structureNames.length * inspectionContents.length <= 1) {
|
|
|
-
|
|
|
- //生成空派单
|
|
|
- genEmptyDispatch(id);
|
|
|
-
|
|
|
- //存在报验单号,则不再生成
|
|
|
- if(ObjectUtil.isNotEmpty(itpDo.getInspectioncode())) {
|
|
|
- return ;
|
|
|
- }
|
|
|
- ZhcxOutsideInspectionItpDo updateEntity = new ZhcxOutsideInspectionItpDo();
|
|
|
- updateEntity.setId(id);
|
|
|
- updateEntity.setInspectioncode(genCode());
|
|
|
- updateById(updateEntity);
|
|
|
+ saveSingle(itpDo);
|
|
|
return ;
|
|
|
}
|
|
|
|
|
|
- List<ZhcxOutsideInspectionItpDo> insertList = new ArrayList<>();
|
|
|
- List<ZhcxOutsideInspectionItpSupervisionDispatchDo> insertDispatchList = new ArrayList<>();
|
|
|
- List<ZhcxOutsideInspectionItpDo> updateList = new ArrayList<>();
|
|
|
- List<String> newItpIdList = new ArrayList<>();
|
|
|
-
|
|
|
- int count = -1;
|
|
|
- for(int m = 0, n = structureNames.length; m < n; m++) {
|
|
|
- for(String inspectionContent : inspectionContents) {
|
|
|
- count++;
|
|
|
-
|
|
|
- if(count == 0) { //第一个做修改
|
|
|
- itpDo.setStructurename(structureNames[m]);
|
|
|
- itpDo.setInspectioncontent(inspectionContent);
|
|
|
- itpDo.setInspectioncode(genCode());
|
|
|
-// itpDo.setStructureid(structureIds[m]);
|
|
|
- updateList.add(itpDo);
|
|
|
-
|
|
|
- //生成空派单数据
|
|
|
- genEmptyDispatch(id);
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- ZhcxOutsideInspectionItpDo entity = new ZhcxOutsideInspectionItpDo();
|
|
|
- BeanUtil.copyProperties(itpDo, entity);
|
|
|
- entity.setStructurename(structureNames[m]);
|
|
|
- entity.setInspectioncontent(inspectionContent);
|
|
|
- entity.setId(SecurityUtil.getUUID());
|
|
|
- entity.setInspectioncode(genCode());
|
|
|
-// entity.setStructureid(structureIds[m]);
|
|
|
- insertList.add(entity);
|
|
|
- newItpIdList.add(entity.getId());
|
|
|
-
|
|
|
- //空派单
|
|
|
- ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchDo = new ZhcxOutsideInspectionItpSupervisionDispatchDo();
|
|
|
- dispatchDo.setId(SecurityUtil.getUUID());
|
|
|
- dispatchDo.setDeleted("0");
|
|
|
- dispatchDo.setItpid(entity.getId());
|
|
|
- insertDispatchList.add(dispatchDo);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //报验单明细
|
|
|
- insertChildren(itpDo, newItpIdList);
|
|
|
-
|
|
|
- //报验单
|
|
|
- updateBatchById(updateList);
|
|
|
- saveBatch(insertList);
|
|
|
-
|
|
|
- //空派单数据
|
|
|
- dispatchService.saveBatch(insertDispatchList);
|
|
|
+ //保存多个构件/报验点
|
|
|
+ saveMany(itpDo, structureNames, inspectionContents);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -464,6 +408,106 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 保存多条构件,报验点
|
|
|
+ *
|
|
|
+ * @param itpDo
|
|
|
+ * @param structureNames
|
|
|
+ * @param inspectionContents
|
|
|
+ */
|
|
|
+ private void saveMany(ZhcxOutsideInspectionItpDo itpDo, String[] structureNames, String[] inspectionContents) {
|
|
|
+ List<ZhcxOutsideInspectionItpDo> insertList = new ArrayList<>();
|
|
|
+ List<ZhcxOutsideInspectionItpSupervisionDispatchDo> insertDispatchList = new ArrayList<>();
|
|
|
+ List<ZhcxOutsideInspectionItpDo> updateList = new ArrayList<>();
|
|
|
+ List<String> newItpIdList = new ArrayList<>();
|
|
|
+ List<ZhcxOutsideInspectionComponentTrackDo> trackDos = new ArrayList<>();
|
|
|
+
|
|
|
+ int count = -1;
|
|
|
+ for(int m = 0, n = structureNames.length; m < n; m++) {
|
|
|
+ for(String inspectionContent : inspectionContents) {
|
|
|
+ count++;
|
|
|
+
|
|
|
+ if(count == 0) { //第一个做修改
|
|
|
+ itpDo.setStructurename(structureNames[m]);
|
|
|
+ itpDo.setInspectioncontent(inspectionContent);
|
|
|
+ itpDo.setInspectioncode(genCode());
|
|
|
+// itpDo.setStructureid(structureIds[m]);
|
|
|
+ updateList.add(itpDo);
|
|
|
+
|
|
|
+ //生成空派单数据
|
|
|
+ genEmptyDispatch(itpDo.getId());
|
|
|
+
|
|
|
+ //跟踪
|
|
|
+ ZhcxOutsideInspectionComponentTrackDo trackDo = inspectionComponentTrackService.getByItp(itpDo);
|
|
|
+ if(ObjectUtil.isNotNull(trackDo)) {
|
|
|
+ trackDos.add(trackDo);
|
|
|
+ }
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ ZhcxOutsideInspectionItpDo entity = new ZhcxOutsideInspectionItpDo();
|
|
|
+ BeanUtil.copyProperties(itpDo, entity);
|
|
|
+ entity.setStructurename(structureNames[m]);
|
|
|
+ entity.setInspectioncontent(inspectionContent);
|
|
|
+ entity.setId(SecurityUtil.getUUID());
|
|
|
+ entity.setInspectioncode(genCode());
|
|
|
+// entity.setStructureid(structureIds[m]);
|
|
|
+ insertList.add(entity);
|
|
|
+ newItpIdList.add(entity.getId());
|
|
|
+
|
|
|
+ //空派单
|
|
|
+ ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchDo = new ZhcxOutsideInspectionItpSupervisionDispatchDo();
|
|
|
+ dispatchDo.setId(SecurityUtil.getUUID());
|
|
|
+ dispatchDo.setDeleted("0");
|
|
|
+ dispatchDo.setItpid(entity.getId());
|
|
|
+ insertDispatchList.add(dispatchDo);
|
|
|
+
|
|
|
+ //跟踪
|
|
|
+ ZhcxOutsideInspectionComponentTrackDo trackDo = inspectionComponentTrackService.getByItp(entity);
|
|
|
+ if(ObjectUtil.isNotNull(trackDo)) {
|
|
|
+ trackDos.add(trackDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //报验单明细
|
|
|
+ insertChildren(itpDo, newItpIdList);
|
|
|
+
|
|
|
+ //报验单
|
|
|
+ updateBatchById(updateList);
|
|
|
+ saveBatch(insertList);
|
|
|
+
|
|
|
+ //空派单数据
|
|
|
+ dispatchService.saveBatch(insertDispatchList);
|
|
|
+
|
|
|
+ if(ObjectUtil.isNotEmpty(trackDos)) {
|
|
|
+ inspectionComponentTrackService.saveBatch(trackDos);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存单条构件,报验点
|
|
|
+ *
|
|
|
+ * @param itpDo
|
|
|
+ */
|
|
|
+ private void saveSingle(ZhcxOutsideInspectionItpDo itpDo) {
|
|
|
+ //生成空派单
|
|
|
+ genEmptyDispatch(itpDo.getId());
|
|
|
+
|
|
|
+ //构件跟踪
|
|
|
+ inspectionComponentTrackService.saveByItp(itpDo);
|
|
|
+
|
|
|
+ //存在报验单号,则不再生成
|
|
|
+ if(ObjectUtil.isNotEmpty(itpDo.getInspectioncode())) {
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ ZhcxOutsideInspectionItpDo updateEntity = new ZhcxOutsideInspectionItpDo();
|
|
|
+ updateEntity.setId(itpDo.getId());
|
|
|
+ updateEntity.setInspectioncode(genCode());
|
|
|
+ updateById(updateEntity);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 生成派单
|
|
|
* 1、校验是否已存在
|