|
@@ -1,5 +1,6 @@
|
|
|
package org.springblade.manager.controller;
|
|
|
|
|
|
+import cn.hutool.core.stream.CollectorUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -18,6 +19,7 @@ import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.support.Kv;
|
|
|
+import org.springblade.core.tool.utils.CollectionUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
@@ -754,11 +756,48 @@ public class WbsTreePrivateController extends BladeController {
|
|
|
// 获取试验记录信息实体 从而获取委托单编号
|
|
|
TrialSelfInspectionRecord trialSelfInspectionRecord = null;
|
|
|
if(ObjectUtil.isNotEmpty(id)){
|
|
|
- String sqlForInspectionRecord = "select entrust_id from u_trial_self_inspection_record where id=" + id;
|
|
|
+ String sqlForInspectionRecord = "select table_ids, entrust_id from u_trial_self_inspection_record where id=" + id;
|
|
|
trialSelfInspectionRecord = jdbcTemplate.queryForObject(sqlForInspectionRecord, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class));
|
|
|
}
|
|
|
|
|
|
List<WbsTreePrivateVO4> wbsTreePrivateVO4s = wbsTreePrivateService.searchNodeAllTable(primaryKeyId, type, tableType, contractId, projectId, isAdd, id);
|
|
|
+ if(trialSelfInspectionRecord != null && StringUtil.isNotBlank(trialSelfInspectionRecord.getTableIds())){
|
|
|
+ //根据表单类型分组
|
|
|
+ Map<Integer, List<WbsTreePrivateVO4>> collect = wbsTreePrivateVO4s.stream().collect(Collectors.groupingBy(WbsTreePrivateVO4::getTableType));
|
|
|
+ List<Long> list = Arrays.asList(trialSelfInspectionRecord.getTableIds().split(",")).stream().map(Long::parseLong).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //判断是否存在记录表的数据
|
|
|
+ if("1".equals(tableType)){
|
|
|
+ //报告表
|
|
|
+ List<WbsTreePrivateVO4> wbsTreePrivateVO4s1 = collect.get(1);
|
|
|
+ if(CollectionUtil.isNotEmpty(wbsTreePrivateVO4s1)){
|
|
|
+ List<Long> collect1 = wbsTreePrivateVO4s1.stream().map(WbsTreePrivateVO4::getPKeyId).collect(Collectors.toList());
|
|
|
+ if(list.stream().anyMatch(collect1::contains)){
|
|
|
+ wbsTreePrivateVO4s = wbsTreePrivateVO4s.stream().filter(f -> list.contains(f.getPKeyId())).collect(Collectors.toList());
|
|
|
+ } else {
|
|
|
+ //如果id为空 就不查询复制表
|
|
|
+ wbsTreePrivateVO4s = wbsTreePrivateVO4s.stream().filter(f -> f.getIsCopyTab() == 0).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //判断是否存在报告单的数据
|
|
|
+ if("2".equals(tableType)){
|
|
|
+ //记录表
|
|
|
+ List<WbsTreePrivateVO4> wbsTreePrivateVO4s2 = collect.get(2);
|
|
|
+ if(CollectionUtil.isNotEmpty(wbsTreePrivateVO4s2)){
|
|
|
+ List<Long> collect2 = wbsTreePrivateVO4s2.stream().map(WbsTreePrivateVO4::getPKeyId).collect(Collectors.toList());
|
|
|
+ if(list.stream().anyMatch(collect2::contains)){
|
|
|
+ wbsTreePrivateVO4s = wbsTreePrivateVO4s.stream().filter(f -> list.contains(f.getPKeyId())).collect(Collectors.toList());
|
|
|
+ } else {
|
|
|
+ //如果id为空 就不查询复制表
|
|
|
+ wbsTreePrivateVO4s = wbsTreePrivateVO4s.stream().filter(f -> f.getIsCopyTab() == 0).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ //如果id为空 就不查询复制表
|
|
|
+ wbsTreePrivateVO4s = wbsTreePrivateVO4s.stream().filter(f -> f.getIsCopyTab() == 0).collect(Collectors.toList());
|
|
|
+ }
|
|
|
for (WbsTreePrivateVO4 treePrivate : wbsTreePrivateVO4s) {
|
|
|
//试验新增
|
|
|
if ((new Integer(1).equals(isAdd)) && ObjectUtil.isEmpty(id)) {
|