فهرست منبع

Merge remote-tracking branch 'origin/master' into master

yangyj 2 سال پیش
والد
کامیت
adc091d3ab

+ 72 - 41
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -919,7 +919,7 @@ public class InformationWriteQueryController extends BladeController {
         //判断是否未生成文件
         List<String> list = Arrays.asList(ids.split(","));
         for (String s : list) {
-            if (StringUtils.isBlank(s)){
+            if (StringUtils.isBlank(s)) {
                 return R.fail("选择的资料未生成文件");
             }
         }
@@ -981,7 +981,7 @@ public class InformationWriteQueryController extends BladeController {
             //判断是否未生成文件
             List<String> list = Arrays.asList(ids.split(","));
             for (String s : list) {
-                if (StringUtils.isBlank(s)){
+                if (StringUtils.isBlank(s)) {
                     return R.fail("选择的资料未生成文件");
                 }
             }
@@ -1000,7 +1000,7 @@ public class InformationWriteQueryController extends BladeController {
                 }
             }
             return R.success("下载成功");
-        }else {
+        } else {
             return R.fail("选择的资料未生成文件");
         }
     }
@@ -1014,6 +1014,19 @@ public class InformationWriteQueryController extends BladeController {
     public R<Boolean> batchAbolish(@RequestParam String ids, String primaryKeyId) {
         //获取所有相关任务记录
         List<Task> taskList = this.taskClient.queryTaskListByFormDataId(ids);
+
+        if (taskList.size() == 0) {
+            //试验
+            List<InformationQuery> dataList = this.informationQueryService.getBaseMapper().selectList(Wrappers.<InformationQuery>lambdaQuery()
+                    .select(InformationQuery::getId)
+                    .eq(InformationQuery::getType, 2)
+                    .in(InformationQuery::getWbsId, Func.toStrList(ids)));
+            if (dataList.size() > 0) {
+                List<Long> dataIds = dataList.stream().map(InformationQuery::getId).collect(Collectors.toList());
+                taskList = this.taskClient.queryTaskListByFormDataId(StringUtils.join(dataIds, ","));
+            }
+        }
+
         if (taskList != null && taskList.size() > 0) {
             try {
                 //执行废除
@@ -1156,10 +1169,10 @@ public class InformationWriteQueryController extends BladeController {
                 String sql;
                 if (StringUtils.isNotEmpty(primaryKeyId)) {
                     //单个废除
-                    sql = "update u_trial_self_inspection_record set task_status = '未上报' where id in(" + primaryKeyId + ")";
+                    sql = "update u_trial_self_inspection_record set task_status = '已废除' where id = " + primaryKeyId;
                 } else {
                     //批量废除直接调的该接口,primaryKeyId为null,ids=当前试验记录的ids
-                    sql = "update u_trial_self_inspection_record set task_status = '未上报' where id in(" + ids + ")";
+                    sql = "update u_trial_self_inspection_record set task_status = '已废除' where id in(" + ids + ")";
                 }
                 jdbcTemplate.execute(sql);
 
@@ -1184,6 +1197,16 @@ public class InformationWriteQueryController extends BladeController {
             String[] ids = startTaskVO.getIds().split(",");
             if (ids.length > 0) {
                 List<InformationQuery> queryList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getId, Arrays.asList(ids)));
+
+                //试验批量上报
+                String trialIds = "";
+                if (queryList.size() == 0 && startTaskVO.getTrialSelfInspectionRecordId() == 1L) {
+                    queryList = new ArrayList<>(this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, Arrays.asList(ids))));
+                    trialIds = startTaskVO.getIds();
+                    //试验记录ids重新赋值映射为数据源ids
+                    ids = queryList.stream().map(InformationQuery::getId).map(String::valueOf).toArray(String[]::new);
+                }
+
                 Map<String, String> queryMap = new HashMap<>();
                 queryList.forEach(query -> queryMap.put(query.getId().toString(), query.getName()));
                 try {
@@ -1225,13 +1248,21 @@ public class InformationWriteQueryController extends BladeController {
                             //修改记录
                             this.informationQueryService.update(wrappers);
 
-                            //修改试验记录上报任务状态
-                            if (ObjectUtil.isNotEmpty(startTaskVO.getTrialSelfInspectionRecordId())) {
+                            //修改试验记录上报任务状态(单上报)
+                            if (ObjectUtil.isNotEmpty(startTaskVO.getTrialSelfInspectionRecordId()) && startTaskVO.getTrialSelfInspectionRecordId() != 1L) {
                                 String sql = "update u_trial_self_inspection_record set task_status = '待审批' where id = " + startTaskVO.getTrialSelfInspectionRecordId();
                                 jdbcTemplate.execute(sql);
                             }
                         }
                     }
+
+                    if (StringUtils.isNotEmpty(trialIds)) {
+                        //修改试验记录上报任务状态(批量上报)
+                        String sql = "update u_trial_self_inspection_record set task_status = '待审批' where id in(" + trialIds + ")";
+                        jdbcTemplate.execute(sql);
+                    }
+
+
                 } catch (Exception e) {
                     e.printStackTrace();
                     return R.data(300, false, "上报失败");
@@ -1277,10 +1308,10 @@ public class InformationWriteQueryController extends BladeController {
     public R<Boolean> diySort(@RequestBody DiySortVO vo) {
         List<String> sortLists = vo.getSortList();
         boolean b = wbsTreeContractClient.diySort(sortLists);
-        if(sortLists!=null){
+        if (sortLists != null) {
             WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(sortLists.get(0));
             //获取父节点信息
-            informationQueryService.AsyncWbsTree(needCopyNode.getParentId()+ "",needCopyNode.getParentId()+ "",needCopyNode.getContractId(),"","1");
+            informationQueryService.AsyncWbsTree(needCopyNode.getParentId() + "", needCopyNode.getParentId() + "", needCopyNode.getContractId(), "", "1");
         }
         return R.status(b);
     }
@@ -1295,13 +1326,13 @@ public class InformationWriteQueryController extends BladeController {
         //首先查询需要复制的节点及其下级所有子节点的信息
         WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
         // 获取当前节点的所有子节点
-        String vocational = SnowFlakeUtil.getId()+"";
+        String vocational = SnowFlakeUtil.getId() + "";
         //新增施工台账
-        List<WbsTreeContract>   saveList = new ArrayList<>();
+        List<WbsTreeContract> saveList = new ArrayList<>();
         List<ConstructionLedger> saveLedger = new ArrayList<>();
         // 获取附件
-        List<WbsTreeContract> nodeChildAll = informationQueryService.getNodeChildAllByNodeId(needCopyNode.getId() + "", needCopyNode.getContractId(),vo.getNeedCopyPrimaryKeyId());
-       // 获取实体表列对象
+        List<WbsTreeContract> nodeChildAll = informationQueryService.getNodeChildAllByNodeId(needCopyNode.getId() + "", needCopyNode.getContractId(), vo.getNeedCopyPrimaryKeyId());
+        // 获取实体表列对象
         List<QueryProcessDataVO> nodeTabCols = informationQueryService.getNodeChildTabColsAllByNodeId(needCopyNode.getId() + "", needCopyNode.getContractId());
         // 转化为map
         Map<String, String> nodeTabColsMap = nodeTabCols.stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, QueryProcessDataVO::getAncestors, (key1, key2) -> key2));
@@ -1370,25 +1401,25 @@ public class InformationWriteQueryController extends BladeController {
                 }
 
                 // 组织复制值Sql
-                if(nodeTabColsMap!=null && node.getType()==2){
+                if (nodeTabColsMap != null && node.getType() == 2) {
                     String tableName = newData.getInitTableName();
                     String col = nodeTabColsMap.get(tableName);
                     String colVal = nodeTabColsMap.get(tableName);
-                    colVal = colVal.replaceAll("id,p_key_id,","'"+SnowFlakeUtil.getId()+"' as id,'"+newData.getPKeyId()+"' as p_key_id,");
-                    copeSql.append("insert into "+tableName+"  ("+col+") select "+colVal+" from "+tableName+" where p_key_id='"+node.getPKeyId()+"' ;");
+                    colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + newData.getPKeyId() + "' as p_key_id,");
+                    copeSql.append("insert into " + tableName + "  (" + col + ") select " + colVal + " from " + tableName + " where p_key_id='" + node.getPKeyId() + "' ;");
                 }
             });
         }
         //保存节点信息
-         R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 32, needCopyNode);
+        R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 32, needCopyNode);
 
         //复制数据逻辑
-        if(nodeTabColsMap!=null &&copeSql.length()>=10){
+        if (nodeTabColsMap != null && copeSql.length() >= 10) {
             jdbcTemplate.execute(copeSql.toString());
         }
 
         //获取父节点信息
-        informationQueryService.AsyncWbsTree(needCopyNode.getParentId()+ "",needCopyNode.getParentId()+ "",needCopyNode.getContractId(),"","1");
+        informationQueryService.AsyncWbsTree(needCopyNode.getParentId() + "", needCopyNode.getParentId() + "", needCopyNode.getContractId(), "", "1");
         return booleanR;
     }
 
@@ -1424,23 +1455,23 @@ public class InformationWriteQueryController extends BladeController {
             });
         }
         //复制结构信息
-      //   R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 32, needCopyNode);
+        //   R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 32, needCopyNode);
         // 复制表数据
 
-        System.out.println("1="+DateUtil.formatDateTime(DateUtil.now()));
+        System.out.println("1=" + DateUtil.formatDateTime(DateUtil.now()));
         List<WbsTreeContract> parentList = new ArrayList<>(), childList = new ArrayList<>(), allList = new ArrayList<>(), saveList = new ArrayList<>();
         //新增施工台账
         List<ConstructionLedger> saveLedger = new ArrayList<>();
 
         parentList.add(needCopyNode);
-        System.out.println("2="+DateUtil.formatDateTime(DateUtil.now()));
+        System.out.println("2=" + DateUtil.formatDateTime(DateUtil.now()));
         //查询所有有效子节点(慢 10分钟)
         this.foreachQueryChildContract(parentList, childList, contractAllNodeMap);
 
-        System.out.println("3="+DateUtil.formatDateTime(DateUtil.now()));
+        System.out.println("3=" + DateUtil.formatDateTime(DateUtil.now()));
         allList.addAll(parentList);
         allList.addAll(childList);
-        System.out.println("4="+DateUtil.formatDateTime(DateUtil.now()));
+        System.out.println("4=" + DateUtil.formatDateTime(DateUtil.now()));
         if ("1".equals(vo.getCopyType())) {
             if (StringUtils.isNotEmpty(vo.getNeedCopyPrimaryKeyId())) {
                 WbsTreeContract parent = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getParentPrimaryKeyId());
@@ -1455,7 +1486,7 @@ public class InformationWriteQueryController extends BladeController {
                 });
 
 
-                System.out.println("5="+DateUtil.formatDateTime(DateUtil.now()));
+                System.out.println("5=" + DateUtil.formatDateTime(DateUtil.now()));
                 //todo 单份复制
                 allList.forEach(node -> {
                     WbsTreeContract newData = new WbsTreeContract();
@@ -1527,7 +1558,7 @@ public class InformationWriteQueryController extends BladeController {
                     }
                 });
             }
-            System.out.println("6="+DateUtil.formatDateTime(DateUtil.now()));
+            System.out.println("6=" + DateUtil.formatDateTime(DateUtil.now()));
         } else {
             //todo 多份复制
             //获取需要复制到的位置集合
@@ -1814,7 +1845,7 @@ public class InformationWriteQueryController extends BladeController {
         Boolean aBoolean = this.wbsTreeContractClient.updateContractNodeParameter(node);
 
         //获取父节点信息
-        informationQueryService.AsyncWbsTree(queries.getParentId()+ "",queries.getParentId()+ "",queries.getContractId(),"","1");
+        informationQueryService.AsyncWbsTree(queries.getParentId() + "", queries.getParentId() + "", queries.getContractId(), "", "1");
         return R.data(aBoolean);
     }
 
@@ -1886,9 +1917,9 @@ public class InformationWriteQueryController extends BladeController {
 
         if (queryProcess != null && queryProcess.size() > 0) {
             //检查这些填报节点是否存在已经审批或已经上报的节点,如果存在则不允许删除
-            List<QueryProcessDataVO> approvalList = queryProcess.stream().filter(vo -> new Integer("2").equals(vo.getStatus()) && vo.getInformationQueryId()!=null).collect(Collectors.toList());
+            List<QueryProcessDataVO> approvalList = queryProcess.stream().filter(vo -> new Integer("2").equals(vo.getStatus()) && vo.getInformationQueryId() != null).collect(Collectors.toList());
             //
-            List<QueryProcessDataVO> runTaskList = queryProcess.stream().filter(vo -> new Integer("1").equals(vo.getStatus()) && vo.getInformationQueryId()!=null).collect(Collectors.toList());
+            List<QueryProcessDataVO> runTaskList = queryProcess.stream().filter(vo -> new Integer("1").equals(vo.getStatus()) && vo.getInformationQueryId() != null).collect(Collectors.toList());
             if (approvalList.size() > 0 || runTaskList.size() > 0) {
                 //说明存在已经审批或已经上报的节点,不允许删除
                 return R.data(300, false, "存在已经上报或审批的节点,不允许删除");
@@ -1915,7 +1946,7 @@ public class InformationWriteQueryController extends BladeController {
         this.recycleBinClient.saveDelBusinessData(idArray, StringUtils.isNotEmpty(removeNode.getFullName()) ? removeNode.getFullName() : removeNode.getNodeName(), 2, parentNodeName.toString(), removeNode.getProjectId(), removeNode.getContractId());
         Boolean aBoolean = this.wbsTreeContractClient.removeContractTreeNode(idArray);
         // 更新redis
-        this.informationQueryService.AsyncWbsTree(removeNode.getParentId()+ "",removeNode.getParentId()+ "",removeNode.getContractId(),"","1");
+        this.informationQueryService.AsyncWbsTree(removeNode.getParentId() + "", removeNode.getParentId() + "", removeNode.getContractId(), "", "1");
         return R.data(aBoolean);
     }
 
@@ -2103,9 +2134,9 @@ public class InformationWriteQueryController extends BladeController {
         R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 2, treeContract);
 
         //更新redis
-        List<WbsTreeContractTreeVOS> wbsTreeContractTreeVOS = this.informationQueryService.queryContractTree(treeContract.getId()+ "", treeContract.getContractId(), "", "1");
+        List<WbsTreeContractTreeVOS> wbsTreeContractTreeVOS = this.informationQueryService.queryContractTree(treeContract.getId() + "", treeContract.getContractId(), "", "1");
 
-        informationQueryService.AsyncWbsTree(treeContract.getId()+ "",treeContract.getId()+ "",treeContract.getContractId(),"","1");
+        informationQueryService.AsyncWbsTree(treeContract.getId() + "", treeContract.getId() + "", treeContract.getContractId(), "", "1");
         return booleanR;
     }
 
@@ -2360,9 +2391,9 @@ public class InformationWriteQueryController extends BladeController {
             //如果是首件列表请求,则删掉没有标记为首件的数据
             if (queryDataResult != null && queryDataResult.size() > 0) {
                 if (StringUtils.isNotEmpty(vo.getIsFirst())) {
-                    if (StringUtils.isNotEmpty(vo.getFirstTitle())){
-                        queryDataResult = queryDataResult.stream().filter(qdr->"3".equals(qdr.getQueryType())).collect(Collectors.toList());
-                    }else {
+                    if (StringUtils.isNotEmpty(vo.getFirstTitle())) {
+                        queryDataResult = queryDataResult.stream().filter(qdr -> "3".equals(qdr.getQueryType())).collect(Collectors.toList());
+                    } else {
                         //节点主键集合
                         List<String> treeIds = queryDataResult.stream().map(QueryProcessDataVO::getPrimaryKeyId).distinct().collect(Collectors.toList());
                         //通过合同段主键在首件关联表中查询出所有数据
@@ -2422,22 +2453,22 @@ public class InformationWriteQueryController extends BladeController {
                                                                                    @RequestParam String parentId,
                                                                                    @RequestParam String contractId,
                                                                                    @RequestParam String contractIdRelation,
-                                                                                   @RequestParam String classifyType){
+                                                                                   @RequestParam String classifyType) {
         if (StringUtils.isNotEmpty(primaryKeyId)) {
             parentId = primaryKeyId;
         }
 
-        String dataInfoId = contractId+"_"+parentId+"_"+classifyType;
-        Object data = RedisTemplate.opsForValue().get("blade-manager::contract:wbstree:"+dataInfoId);
+        String dataInfoId = contractId + "_" + parentId + "_" + classifyType;
+        Object data = RedisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + dataInfoId);
         List<WbsTreeContractTreeVOS> wbsTreeContractTreeVOS = null;
-        if(data!=null){
+        if (data != null) {
             wbsTreeContractTreeVOS = JSON.parseArray(data.toString(), WbsTreeContractTreeVOS.class);
         }
 
         if (wbsTreeContractTreeVOS == null) {
             wbsTreeContractTreeVOS = this.informationQueryService.queryContractTree(parentId, contractId, contractIdRelation, classifyType);
-            JSONArray array= JSONArray.parseArray(JSON.toJSONString(wbsTreeContractTreeVOS));
-            RedisTemplate.opsForValue().set("blade-manager::contract:wbstree:"+dataInfoId,JSON.toJSON(array).toString());
+            JSONArray array = JSONArray.parseArray(JSON.toJSONString(wbsTreeContractTreeVOS));
+            RedisTemplate.opsForValue().set("blade-manager::contract:wbstree:" + dataInfoId, JSON.toJSON(array).toString());
         }
         return R.data(wbsTreeContractTreeVOS);
     }

+ 19 - 6
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceUseServiceImpl.java

@@ -47,10 +47,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
@@ -377,18 +374,34 @@ public class TrialDeviceUseServiceImpl extends BaseServiceImpl<TrialDeviceUseMap
 
     @Async
     public void addDeviceUseInfo(TrialSelfInspectionRecordDTO dto) {
-        if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotEmpty(dto.getDeviceUseIds())) {
+        if (StringUtils.isNotEmpty(dto.getDeviceUseIds())) {
             //获取进场记录
             List<TrialDeviceInfo> deviceInfos = trialDeviceInfoMapper.selectList(Wrappers.<TrialDeviceInfo>lambdaQuery().in(TrialDeviceInfo::getId, dto.getDeviceUseIds()));
 
+            //获取样品编号、名称
+            String sampleNames = "";
+            String sampleNumbers = "";
+            if (StringUtils.isNotEmpty(dto.getSampleIds())) {
+                List<TrialSampleInfo> trialSampleInfos = trialSampleInfoService.getBaseMapper().selectList(Wrappers.<TrialSampleInfo>lambdaQuery()
+                        .select(TrialSampleInfo::getSpecificationNumber, TrialSampleInfo::getMaterialName)
+                        .in(TrialSampleInfo::getId, Func.toLongList(dto.getSampleIds())));
+                List<String> names = trialSampleInfos.stream().map(TrialSampleInfo::getMaterialName).filter(string -> !string.isEmpty()).collect(Collectors.toList());
+                sampleNames = StringUtils.join(names, "、");
+                List<String> numbers = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationNumber).filter(string -> !string.isEmpty()).collect(Collectors.toList());
+                sampleNumbers = StringUtils.join(numbers, "、");
+            }
+
             //构造使用记录
             List<TrialDeviceUse> list = new ArrayList<>();
             for (TrialDeviceInfo deviceInfo : deviceInfos) {
                 TrialDeviceUse trialDeviceUses = BeanUtil.copyProperties(deviceInfo, TrialDeviceUse.class);
                 if (trialDeviceUses != null) {
+                    trialDeviceUses.setId(SnowFlakeUtil.getId());
                     trialDeviceUses.setNodeId(dto.getNodeId());
                     trialDeviceUses.setDeviceInfoId(deviceInfo.getId());
-                    trialDeviceUses.setId(SnowFlakeUtil.getId());
+                    trialDeviceUses.setManagerName(dto.getTrialUserName());
+                    trialDeviceUses.setMaterialName(sampleNames);
+                    trialDeviceUses.setSpecificationNumber(sampleNumbers);
                     list.add(trialDeviceUses);
                 }
             }

+ 6 - 27
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -239,7 +239,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             List<String> mobilizationIds = new ArrayList<>();
             for (String sampleId : sampleIds) {
                 String mobilizationId = baseMapper.selectMobilizationRecord(sampleId);
-                if (StringUtils.isNotEmpty(mobilizationId)){
+                if (StringUtils.isNotEmpty(mobilizationId)) {
                     mobilizationIds.add(mobilizationId);
                 }
             }
@@ -930,38 +930,17 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             }
 
             //取样信息
-            List<TrialSampleInfo> trialSampleInfos = trialSampleInfoMapper.selectList(Wrappers.<TrialSampleInfo>lambdaQuery()
-                    .isNotNull(TrialSampleInfo::getSamplingLocation)
-                    .isNotNull(TrialSampleInfo::getSupplierUnit)
-                    .isNotNull(TrialSampleInfo::getSpecificationNumber)
-                    .isNotNull(TrialSampleInfo::getSpecificationModel)
-                    .in(TrialSampleInfo::getId, ids));
-            List<String> samplingLocations = trialSampleInfos.stream().map(TrialSampleInfo::getSamplingLocation).collect(Collectors.toList());
-            /*String samplingLocation = samplingLocations.stream().findAny().orElse(null);
-            if (samplingLocations.size() > 1 && StringUtils.isNotEmpty(samplingLocation)) {
-                samplingLocation = samplingLocation + "等" + samplingLocations.size() + "个取样地点";
-            }*/
+            List<TrialSampleInfo> trialSampleInfos = trialSampleInfoMapper.selectList(Wrappers.<TrialSampleInfo>lambdaQuery().in(TrialSampleInfo::getId, ids));
+            List<String> samplingLocations = trialSampleInfos.stream().map(TrialSampleInfo::getSamplingLocation).filter(string -> !string.isEmpty()).collect(Collectors.toList());
             String samplingLocation = org.apache.commons.lang.StringUtils.join(samplingLocations, "、");
 
-            List<String> calculationUnits = trialSampleInfos.stream().map(TrialSampleInfo::getCalculationUnit).collect(Collectors.toList());
-            /*String supplierUnit = supplierUnits.stream().findAny().orElse(null);
-            if (supplierUnits.size() > 1 && StringUtils.isNotEmpty(supplierUnit)) {
-                supplierUnit = supplierUnit + "等" + supplierUnits.size() + "个单位";
-            }*/
+            List<String> calculationUnits = trialSampleInfos.stream().map(TrialSampleInfo::getCalculationUnit).filter(string -> !string.isEmpty()).collect(Collectors.toList());
             String calculationUnit = org.apache.commons.lang.StringUtils.join(calculationUnits, "、");
 
-            List<String> specificationNumbers = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationNumber).collect(Collectors.toList());
-            /*String specificationNumber = supplierUnits.stream().findAny().orElse(null);
-            if (specificationNumbers.size() > 1 && StringUtils.isNotEmpty(specificationNumber)) {
-                specificationNumber = specificationNumber + "等" + specificationNumbers.size() + "个样品编号";
-            }*/
+            List<String> specificationNumbers = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationNumber).filter(string -> !string.isEmpty()).collect(Collectors.toList());
             String specificationNumber = org.apache.commons.lang.StringUtils.join(specificationNumbers, "、");
 
-            List<String> specificationModels = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationModel).collect(Collectors.toList());
-            /*String specificationModel = supplierUnits.stream().findAny().orElse(null);
-            if (specificationModels.size() > 1 && StringUtils.isNotEmpty(specificationModel)) {
-                specificationModel = specificationModel + "等" + specificationModels.size() + "个规格类型";
-            }*/
+            List<String> specificationModels = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationModel).filter(string -> !string.isEmpty()).collect(Collectors.toList());
             String specificationModel = org.apache.commons.lang.StringUtils.join(specificationModels, "、");
 
             //更新

+ 14 - 5
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/TrialClassificationConfigurationController.java

@@ -11,6 +11,8 @@ import org.springblade.core.cache.utils.CacheUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.support.Kv;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.manager.entity.TrialClassificationConfiguration;
 import org.springblade.manager.service.ITrialClassificationConfigurationService;
 import org.springblade.manager.vo.TrialClassificationConfigurationTreeVO;
@@ -56,12 +58,19 @@ public class TrialClassificationConfigurationController extends BladeController
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "删除节点", notes = "传入节点id")
     @RequestMapping(value = "/remove", method = RequestMethod.GET)
-    public R<Object> remove(@Valid @RequestParam Long id) {
-        List<TrialDetectionData> query = jdbcTemplate.query("select id from m_trial_detection_data where is_deleted = 0 and node_id = " + id, new BeanPropertyRowMapper<>(TrialDetectionData.class));
-        if (query.size() > 0) {
-            throw new ServiceException("当前节点下存在数据,删除失败");
+    public R<Object> remove(@Valid @RequestParam Long id, Long contractId) {
+        if (ObjectUtil.isNotEmpty(contractId)) {
+            //客户端删除
+            List<TrialDetectionData> query = jdbcTemplate.query("select id from m_trial_detection_data where is_deleted = 0 and node_id = " + id + " and contract_id = " + contractId, new BeanPropertyRowMapper<>(TrialDetectionData.class));
+            if (query.size() > 0) {
+                throw new ServiceException("当前节点下存在数据,删除失败");
+            }
+            TrialClassificationConfiguration obj = iTrialClassificationConfigurationService.getBaseMapper().selectById(id);
+            if (obj != null && ObjectUtil.isEmpty(obj.getContractId())) {
+                throw new ServiceException("公共节点无法删除,请联系管理员");
+            }
         }
-        return R.status(iTrialClassificationConfigurationService.removeById(id));
+        return R.status(iTrialClassificationConfigurationService.deleteLogic(Func.toLongList(String.valueOf(id))));
     }
 
     @ApiOperationSupport(order = 4)

+ 8 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/TrialClassificationConfigurationServiceImpl.java

@@ -7,6 +7,7 @@ import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.tool.constant.BladeConstant;
 import org.springblade.core.tool.node.ForestNodeMerger;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.core.tool.utils.StringPool;
 import org.springblade.manager.entity.TrialClassificationConfiguration;
 import org.springblade.manager.mapper.TrialClassificationConfigurationMapper;
@@ -33,6 +34,13 @@ public class TrialClassificationConfigurationServiceImpl
 
     @Override
     public boolean submit(TrialClassificationConfiguration obj) {
+        if (ObjectUtil.isNotEmpty(obj.getId())) {
+            //修改
+            TrialClassificationConfiguration trialObj = baseMapper.selectById(obj.getId());
+            if (ObjectUtil.isNotEmpty(obj.getContractId()) && ObjectUtil.isEmpty(trialObj.getContractId())) {
+                throw new ServiceException("公共节点无法修改,请联系管理员");
+            }
+        }
         if (Func.isEmpty(obj.getParentId())) {
             obj.setParentId(BladeConstant.TOP_PARENT_ID);
             obj.setAncestors(String.valueOf(BladeConstant.TOP_PARENT_ID));