liuyc 2 жил өмнө
parent
commit
512db64299

+ 17 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -1,5 +1,6 @@
 package org.springblade.business.controller;
 
+import cn.hutool.core.lang.hash.Hash;
 import com.alibaba.excel.util.DateUtils;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -1200,17 +1201,32 @@ public class InformationWriteQueryController extends BladeController {
 
                 //试验批量上报
                 String trialIds = "";
+                Map<Long, Long> mapKey = new HashMap<>();
                 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();
+                    //重新绑定trialSelfInspectionRecordId使用map
+                    for (InformationQuery informationQuery : queryList) {
+                        mapKey.put(informationQuery.getId(), informationQuery.getWbsId());
+                    }
                     //试验记录ids重新赋值映射为数据源ids
                     ids = queryList.stream().map(InformationQuery::getId).map(String::valueOf).toArray(String[]::new);
+                    trialIds = startTaskVO.getIds();
                 }
 
                 Map<String, String> queryMap = new HashMap<>();
                 queryList.forEach(query -> queryMap.put(query.getId().toString(), query.getName()));
                 try {
                     for (String id : ids) {
+
+                        //试验-批量上报时,重新绑定当前试验记录id
+                        if (ObjectUtil.isNotEmpty(startTaskVO.getTrialSelfInspectionRecordId()) && startTaskVO.getTrialSelfInspectionRecordId() == 1L) {
+                            Long wbsId = mapKey.get(Long.parseLong(id));
+                            if (ObjectUtil.isNotEmpty(wbsId)) {
+                                startTaskVO.setTrialSelfInspectionRecordId(wbsId);
+                            }
+                        }
+
                         //生成任务实体
                         TaskVO taskVO = new TaskVO();
                         BeanUtils.copyProperties(startTaskVO, taskVO);

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java

@@ -150,7 +150,7 @@ public class TrialDetectionController extends BladeController {
     public R<Object> selfRemove(@Valid @RequestParam String ids) {
         List<TrialSelfInspectionRecord> recordList = iTrialSelfInspectionRecordService.getBaseMapper().selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
                 .select(TrialSelfInspectionRecord::getTaskStatus)
-                .ne(TrialSelfInspectionRecord::getTaskStatus, "未上报")
+                .and(obj -> obj.ne(TrialSelfInspectionRecord::getTaskStatus, "未上报").ne(TrialSelfInspectionRecord::getTaskStatus, "已废除"))
                 .in(TrialSelfInspectionRecord::getId, Func.toLongList(ids)));
         if (recordList.size() > 0) {
             return R.fail("只能删除未上报记录信息,操作失败");