|
@@ -267,8 +267,11 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
|
if(!resultCheckParameterSetDetail.isEmpty()){
|
|
|
commissionCheckParameterSetDetalService.saveBatch(resultCheckParameterSetDetail);
|
|
|
}
|
|
|
+ // 保存树表
|
|
|
if(!targetList.isEmpty()){
|
|
|
- zhcxCommissionCheckDetailTreeService.saveBatch(targetList);
|
|
|
+ // 异步保存
|
|
|
+ //zhcxCommissionCheckDetailTreeService.saveBatch(targetList);
|
|
|
+ zhcxCommissionCheckDetailTreeService.saveTreeBatch(targetList);
|
|
|
}
|
|
|
return R.ok("保存成功");
|
|
|
}
|
|
@@ -280,11 +283,11 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
|
return R.error("主表id为空");
|
|
|
}
|
|
|
// 判断该机台是否已发运 如果已发运 就直接返回
|
|
|
- if(baseMapper.checkedShippedByMasterId(masterId) >0){
|
|
|
+ if(baseMapper.checkedShippedByMasterId2(masterId) == 0){
|
|
|
return R.ok("该机台已发运,无需同步");
|
|
|
}
|
|
|
// 找到该项目下面其他 还没有发运的 机台主表数据
|
|
|
- List<ZhcxCommissionCheckDo> list = baseMapper.getOtherShippeCheckList(masterId);
|
|
|
+ List<ZhcxCommissionCheckDo> list = baseMapper.getOtherShippeCheckList2(masterId);
|
|
|
if(list.isEmpty()){
|
|
|
return R.ok("暂无其他机台需要同步");
|
|
|
}
|
|
@@ -296,9 +299,34 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
|
if(detailDos.isEmpty()){
|
|
|
return R.ok("试车检查内容为空");
|
|
|
}
|
|
|
- // 创建检查内容结果集合
|
|
|
+ // 主试车检查下的试车子树表
|
|
|
+ LambdaQueryWrapper<ZhcxCommissionCheckDetailTreeDo> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper1.eq(ZhcxCommissionCheckDetailTreeDo::getDeleted,"0")
|
|
|
+ .eq(ZhcxCommissionCheckDetailTreeDo::getBaseinfoid,masterId);
|
|
|
+ List<ZhcxCommissionCheckDetailTreeDo> treeDoList = zhcxCommissionCheckDetailTreeService.list(queryWrapper1);
|
|
|
+ if(treeDoList.isEmpty()){
|
|
|
+ return R.ok("左侧树数据为空");
|
|
|
+ }
|
|
|
+ // 创建检查内容结果集合+树集合
|
|
|
List<ZhcxCommissionCheckDetailDo> resultCheckDetailDo = new ArrayList<>();
|
|
|
+ List<ZhcxCommissionCheckDetailTreeDo> resultTreeDo = new ArrayList<>();
|
|
|
for (ZhcxCommissionCheckDo zhcxCommissionCheckDo : list) {
|
|
|
+ // 左侧树数据同步
|
|
|
+ baseMapper.deleteTreeByPid(zhcxCommissionCheckDo.getId());
|
|
|
+ treeDoList.forEach(tree -> {
|
|
|
+ ZhcxCommissionCheckDetailTreeDo target = new ZhcxCommissionCheckDetailTreeDo();
|
|
|
+ BeanUtils.copyProperties(tree, target);
|
|
|
+ String id = tree.getId().split("_")[0]+"_"+zhcxCommissionCheckDo.getProjectcode()+zhcxCommissionCheckDo.getMachineno();
|
|
|
+ target.setId(id);
|
|
|
+ target.setRemark(tree.getId().split("_")[0]);
|
|
|
+ target.setBaseinfoid(zhcxCommissionCheckDo.getId());
|
|
|
+ if(!target.getPid().equals("-1")){
|
|
|
+ String pid = target.getPid().split("_")[0]+"_"+zhcxCommissionCheckDo.getProjectcode()+zhcxCommissionCheckDo.getMachineno();
|
|
|
+ target.setPid(pid);
|
|
|
+ }
|
|
|
+ resultTreeDo.add(target);
|
|
|
+ });
|
|
|
+
|
|
|
// 1.将其他机台的子表全删
|
|
|
baseMapper.deleteCheckDetailByPid(zhcxCommissionCheckDo.getId());
|
|
|
Map<String, ZhcxCommissionCheckDetailDo> historyDetailMap = baseMapper.getHistoryDetailMap(zhcxCommissionCheckDo.getId());
|
|
@@ -334,6 +362,10 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
|
// 异步保存
|
|
|
commissionCheckDetailService.saveCheckDetailBatch(resultCheckDetailDo);
|
|
|
}
|
|
|
+ if(!resultTreeDo.isEmpty()){
|
|
|
+ // 异步保存
|
|
|
+ zhcxCommissionCheckDetailTreeService.saveTreeBatch(resultTreeDo);
|
|
|
+ }
|
|
|
return R.ok("同步成功");
|
|
|
}
|
|
|
/*@Async("batchSaveThreadPool")
|