|
@@ -138,11 +138,12 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
|
if(StringUtils.isEmpty(productTypeId)){
|
|
|
return R.error("引用标准库不能为空");
|
|
|
}
|
|
|
+
|
|
|
LambdaQueryWrapper<ZhcxCommissionCheckBaseInfoTreeDo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(ZhcxCommissionCheckBaseInfoTreeDo::getDeleted,"0")
|
|
|
.eq(ZhcxCommissionCheckBaseInfoTreeDo::getBaseinfoid,productTypeId);
|
|
|
- List<ZhcxCommissionCheckBaseInfoTreeDo> list = zhcxCommissionCheckBaseInfoTreeService.list(queryWrapper);
|
|
|
- if(!list.isEmpty()){
|
|
|
+ List<ZhcxCommissionCheckBaseInfoTreeDo> treeList = zhcxCommissionCheckBaseInfoTreeService.list(queryWrapper);
|
|
|
+ /*if(!list.isEmpty()){
|
|
|
List<ZhcxCommissionCheckDetailTreeDo> targetList = new ArrayList<>();
|
|
|
list.forEach(tree -> {
|
|
|
tree.setId(tree.getId()+check.getProjectcode()).setBaseinfoid(check.getProjectcode());
|
|
@@ -153,25 +154,23 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
|
BeanUtils.copyProperties(tree, target);
|
|
|
targetList.add(target);
|
|
|
});
|
|
|
-
|
|
|
LambdaQueryWrapper<ZhcxCommissionCheckDetailTreeDo> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
queryWrapper2.eq(ZhcxCommissionCheckDetailTreeDo::getDeleted,"0")
|
|
|
.eq(ZhcxCommissionCheckDetailTreeDo::getBaseinfoid,check.getProjectcode());
|
|
|
List<ZhcxCommissionCheckDetailTreeDo> listed = zhcxCommissionCheckDetailTreeService.list(queryWrapper2);
|
|
|
- //zhcxCommissionCheckBaseInfoTreeService.saveBatch(list);
|
|
|
if(listed.isEmpty()){
|
|
|
zhcxCommissionCheckDetailTreeService.saveBatch(targetList);
|
|
|
}else{
|
|
|
return R.error("该项目已创建,请选择相同的试车标准库");
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
// 试车子表
|
|
|
List<ZhcxCommissionCheckDetailDo> checkDetails = checkDTO.getCheckDetails();
|
|
|
// 查询已保存过的子表数据(平台bug,已保存的数据只能去数据库中查)
|
|
|
- List<ZhcxCommissionCheckDetailDo> savedcheckDetails = getSavedDataByPid(check.getId());
|
|
|
+/* List<ZhcxCommissionCheckDetailDo> savedcheckDetails = getSavedDataByPid(check.getId());
|
|
|
if(!savedcheckDetails.isEmpty()){
|
|
|
checkDetails.addAll(savedcheckDetails);
|
|
|
- }
|
|
|
+ }*/
|
|
|
// 创建新增集合
|
|
|
// 试车主子表
|
|
|
List<ZhcxCommissionCheckDo> resultCheckDo = new ArrayList<>();
|
|
@@ -181,6 +180,8 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
|
|
|
|
// 试车参数主表
|
|
|
ZhcxCommissionCheckParameterSetDo parameterSetDo = checkParameterSetData(check);
|
|
|
+ // 试车树表
|
|
|
+ List<ZhcxCommissionCheckDetailTreeDo> targetList = new ArrayList<>();
|
|
|
// 正片开始
|
|
|
for (ZhcxCommissionCheckParameterSetDetalDo setDetail : setDetails) {
|
|
|
// 试车检查主表机号判断 如果该机已存在就返回
|
|
@@ -220,6 +221,27 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
|
setDetail.setCheckid(newCheckId);
|
|
|
setDetail.setProjectid(check.getProjectid());
|
|
|
resultCheckParameterSetDetail.add(setDetail);
|
|
|
+ // 树的子表
|
|
|
+ treeList.forEach(tree -> {
|
|
|
+ ZhcxCommissionCheckDetailTreeDo target = new ZhcxCommissionCheckDetailTreeDo();
|
|
|
+ BeanUtils.copyProperties(tree, target);
|
|
|
+ target.setId(tree.getId()+"_"+machineno);
|
|
|
+ target.setRemark(tree.getId());
|
|
|
+ target.setBaseinfoid(newCheckId);
|
|
|
+ if(!target.getPid().equals("-1")){
|
|
|
+ target.setPid(target.getPid()+"_"+machineno);
|
|
|
+ }
|
|
|
+ // 判断是否为伪删状态
|
|
|
+ if (!checkDTO.getTreeNode().isEmpty()) {
|
|
|
+ List<String> treeNode = checkDTO.getTreeNode();
|
|
|
+ if (treeNode.contains(tree.getId())) {
|
|
|
+ target.setDeleted("0");
|
|
|
+ }else {
|
|
|
+ target.setDeleted("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ targetList.add(target);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
// 保存操作
|
|
@@ -227,13 +249,15 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
|
this.saveBatch(resultCheckDo);
|
|
|
}
|
|
|
if(!resultCheckDetailDo.isEmpty()){
|
|
|
- //commissionCheckDetailService.saveBatch(resultCheckDetailDo);
|
|
|
// 异步保存
|
|
|
commissionCheckDetailService.saveCheckDetailBatch(resultCheckDetailDo);
|
|
|
}
|
|
|
if(!resultCheckParameterSetDetail.isEmpty()){
|
|
|
commissionCheckParameterSetDetalService.saveBatch(resultCheckParameterSetDetail);
|
|
|
}
|
|
|
+ if(!targetList.isEmpty()){
|
|
|
+ zhcxCommissionCheckDetailTreeService.saveBatch(targetList);
|
|
|
+ }
|
|
|
return R.ok("保存成功");
|
|
|
}
|
|
|
|