Browse Source

修改bug:资料上报废除、撤回后生成新的未上报记录;任务查询试验相关

lvy 3 months ago
parent
commit
e321cd2701

+ 1 - 1
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/Task.java

@@ -119,7 +119,7 @@ public class Task extends BaseEntity {
     private Integer type;
 
     /**
-     * 上报类型,1填报资料,2工程文件
+     * 上报类型, 1=填报数据(质量填报) 2=工程文件(档案) 3=日志资料  4=档案数据   5=计量支付证书  6=计量 材料预付款  7= 计量 中间支付  8委托单 9试验上报 10 首件上报 11变更令
      */
     @ApiModelProperty("上报类型,1填报资料,2工程文件,3日志资料,4档案,5计量")
     private Integer approvalType;

+ 31 - 27
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -610,21 +610,27 @@ public class InformationWriteQueryController extends BladeController {
     @ApiOperation(value = "单个废除")
 //    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
     public R<Object> abolishOne(@RequestParam String primaryKeyId, @RequestParam String classify, @RequestParam String projectId, @RequestParam String contractId) {
-        WbsTreeContract obj = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId);
-        if (obj == null) {
-            return R.fail("未找到节点数据");
-        }
-        if (!contractId.equals(obj.getContractId())) {
-            contractId = obj.getContractId();
-        }
         //查询填报状态
         InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId)
                 .eq(InformationQuery::getContractId, contractId)
                 .eq(InformationQuery::getClassify, classify).eq(InformationQuery::getType, 1).in(InformationQuery::getStatus, 1,2));
+        if (businessData != null) {
+            //使用批量废除接口
+            return this.batchAbolish(businessData.getId().toString(), primaryKeyId + "*", projectId, contractId, "撤回成功");
+        }
+        WbsTreeContract obj = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId);
+        if (obj != null) {
+            if (!contractId.equals(obj.getContractId())) {
+                contractId = obj.getContractId();
+            }
+            businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId)
+                    .eq(InformationQuery::getContractId, contractId)
+                    .eq(InformationQuery::getClassify, classify).eq(InformationQuery::getType, 1).in(InformationQuery::getStatus, 1,2));
+        }
         primaryKeyId = primaryKeyId + "*";
         if (businessData != null) {
             //使用批量废除接口
-            return this.batchAbolish(businessData.getId().toString(), primaryKeyId, projectId, contractId, "撤回成功");
+            return this.batchAbolish(businessData.getId().toString(), primaryKeyId + "*", projectId, contractId, "撤回成功");
         } else {
             //试验
             InformationQuery businessDataTrial = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify)
@@ -1205,6 +1211,18 @@ public R<String> batchDownloadFileToZip(String ids, HttpServletResponse response
 //                        wrapper.set(InformationQuery::getAuditUserIdAndName, null);
 
                         this.informationQueryService.update(wrapper.in(InformationQuery::getId, Arrays.asList(task.getFormDataId().split(","))));
+                        List<InformationQuery> informationQueries = this.informationQueryService.getBaseMapper().selectBatchIds(Arrays.asList(task.getFormDataId().split(",")));
+                        if (informationQueries != null && !informationQueries.isEmpty()) {
+                            for (InformationQuery informationQuery : informationQueries) {
+                                informationQuery.setStatus(0);
+                                informationQuery.setId(SnowFlakeUtil.getId());
+                                informationQuery.setEVisaPdfUrl(null);
+                                informationQuery.setReportNumber(null);
+                                informationQuery.setAuditUserIdAndName(null);
+                                informationQuery.setTaskId(null);
+                            }
+                            this.informationQueryService.saveBatch(informationQueries);
+                        }
                     }
 
                     List<InformationQuery> queries = this.informationQueryService.getBaseMapper().selectBatchIds(Arrays.asList(task.getFormDataId().split(",")));
@@ -1234,9 +1252,6 @@ public R<String> batchDownloadFileToZip(String ids, HttpServletResponse response
                         }
 
                         for (InformationQuery query : queries) {
-                            if (query.getStatus() != null && query.getStatus() != 3) {
-                                this.informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().eq(InformationQuery::getId, query.getId()).set(InformationQuery::getStatus, 3));
-                            }
                             if (StringUtils.isNotEmpty(query.getFileUserIdAndName())) {
                                 String[] userArray = query.getFileUserIdAndName().split(",");
                                 for (String str : userArray) {
@@ -1410,10 +1425,12 @@ public R<Object> batchTask(@RequestBody StartTaskVO startTaskVO) {
             }
 
             Map<String, InformationQuery> queryMap = new HashMap<>();
-            List<InformationQuery> saveQueryList = new ArrayList<>();
             List<InformationQuery> queryTempList = new ArrayList<>();
             Map<String, InformationQuery> queryTempMap = new HashMap<>();
             queryList.forEach(query -> {
+                if (query.getStatus() != 0) {
+                    return;
+                }
                 if (query.getType() == 3) {
                     startTaskVO.setTrialSelfInspectionRecordId(3L);
                 }
@@ -1422,27 +1439,14 @@ public R<Object> batchTask(@RequestBody StartTaskVO startTaskVO) {
                     return;
                 }
                 queryTempMap.put(query.getWbsId() + "," + query.getContractId() + "," + query.getClassify(), query);
-                // todo 待优化
-                long count = this.informationQueryService.count(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, query.getWbsId()).eq(InformationQuery::getClassify, query.getClassify())
-                        .eq(InformationQuery::getContractId, query.getContractId()).in(InformationQuery::getStatus, 1, 2));
-                if (count == 0) {
-                    queryTempList.add(query);
-                    if (query.getStatus() != null && query.getStatus() == 3) {
-                        query.setId(SnowFlakeUtil.getId());
-                        query.setStatus(0);
-                        saveQueryList.add(query);
-                    }
-                    queryMap.put(query.getId().toString(), query);
-                }
+                queryTempList.add(query);
+                queryMap.put(query.getId().toString(), query);
             });
             queryList = queryTempList;
             if (queryList.isEmpty()) {
                 return R.fail( "已上报,无需重复上报");
             }
             appType = startTaskVO.getTrialSelfInspectionRecordId();
-            if (!saveQueryList.isEmpty()) {
-                this.informationQueryService.saveBatch(saveQueryList);
-            }
             ids = queryList.stream().map(InformationQuery::getId).map(String::valueOf).toArray(String[]::new);
             boolean var = false;
 

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

@@ -1273,7 +1273,7 @@ public class TaskController extends BladeController {
         int size = dto.getSize();
         //封装入参SQL
         List<Object> params = new ArrayList<>();
-        StringBuilder sqlString = new StringBuilder("SELECT * FROM u_task WHERE 1=1 AND is_deleted = 0 AND approval_type in(1,2,3,4,8)");
+        StringBuilder sqlString = new StringBuilder("SELECT * FROM u_task WHERE 1=1 AND is_deleted = 0 AND approval_type in(1,2,3,4,8,9,10)");
         if (ObjectUtil.isNotEmpty(dto.getTypeValue())) {
             sqlString.append(" AND type = ?");
             params.add(dto.getTypeValue());

+ 49 - 9
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -198,6 +198,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 //日志资料
                 return this.queryTheLogFileBusinessData(taskApprovalVO.getFormDataId());
             case 8:
+            case 9:
+            case 10:
                 //委拖单
                 return this.queryProcessSubmitBusinessData(taskApprovalVO.getFormDataId(), false);
             default:
@@ -444,8 +446,19 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         this.update(Wrappers.<Task>lambdaUpdate().set(Task::getStatus, 3).eq(Task::getId, task.getId()));
         //修改业务数据状态为未上报
         // this.updateBusinessDataByFormDataId(task, 0, null);
-        this.updateBusinessDataByFormDataId(task, 0, null, -1L);
-
+        this.updateBusinessDataByFormDataId(task, 3, null, -1L);
+        List<InformationQuery> informationQueries = this.informationQueryService.getBaseMapper().selectBatchIds(Arrays.asList(task.getFormDataId().split(",")));
+        if (informationQueries != null && !informationQueries.isEmpty()) {
+            for (InformationQuery informationQuery : informationQueries) {
+                informationQuery.setStatus(0);
+                informationQuery.setId(SnowFlakeUtil.getId());
+                informationQuery.setEVisaPdfUrl(null);
+                informationQuery.setReportNumber(null);
+                informationQuery.setAuditUserIdAndName(null);
+                informationQuery.setTaskId(null);
+            }
+            this.informationQueryService.saveBatch(informationQueries);
+        }
         return true;
     }
 
@@ -677,11 +690,34 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     jdbcTemplate.execute(up_task);
 
                     if(taskApp.getApprovalType() == 3){
-                        jdbcTemplate.execute("update u_contract_log set status=0 where id='"+taskApp.getFormDataId()+"'");
+                        jdbcTemplate.execute("update u_contract_log set status=3 where id='"+taskApp.getFormDataId()+"'");
                     }else if (taskApp.getApprovalType()==8) {
                         this.jdbcTemplate.execute("update u_entrust_info set status=1 where id=(SELECT wbs_id from u_information_query where id='"+taskApp.getFormDataId()+"')");
                     }else {
                         jdbcTemplate.execute("update u_information_query set e_visa_pdf_url='',status=3 where id='"+taskApp.getFormDataId()+"'");
+                        InformationQuery informationQuery = informationQueryService.getById(taskApp.getFormDataId());
+                        Long primaryKeyId = informationQuery.getWbsId();
+                        informationQuery.setStatus(0);
+                        informationQuery.setId(SnowFlakeUtil.getId());
+                        informationQuery.setEVisaPdfUrl(null);
+                        informationQuery.setReportNumber(null);
+                        informationQuery.setAuditUserIdAndName(null);
+                        informationQuery.setTaskId(null);
+                        informationQueryService.save(informationQuery);
+                        if (taskApp.getApprovalType() == 9 && primaryKeyId != null) {
+                            //修改试验任务状态为未上报
+                            String sql = "update u_trial_self_inspection_record set task_status = '未上报' where id=" + primaryKeyId;
+                            String sql1 = "SELECT e.* from u_entrust_info e left join u_trial_self_inspection_record t on t.entrust_id=e.id where t.id=" + primaryKeyId;
+                            jdbcTemplate.execute(sql);
+                            List<EntrustInfo> query = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(EntrustInfo.class));
+                            if (!query.isEmpty()) {
+                                String[] idss = query.stream()
+                                        .map(item -> String.valueOf(item.getId()))
+                                        .toArray(String[]::new);
+                                String update = "update u_entrust_info set status=3 where id in(" + String.join(",", idss) + ")";
+                                jdbcTemplate.execute(update);
+                            }
+                        }
                     }
                 }
             }
@@ -1546,6 +1582,10 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 //日志文件
                 this.updateContractLogBusinessDataStatus(task.getFormDataId(), status, newFileUrl);
                 break;
+            case 9:
+            case 10:
+                this.updateWriteBusinessDataStatus(task.getFormDataId(), status, newFileUrl, UserId);
+                break;
             default:
                 break;
         }
@@ -1558,8 +1598,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
     public void updateContractLogBusinessDataStatus(String formDataId, Integer status, String newFileUrl) {
         this.contractLogService.update(Wrappers.<ContractLog>lambdaUpdate().set(ContractLog::getStatus, status)
                 .set(ContractLog::getEVisaPdfUrl, newFileUrl)
-                .set(ContractLog::getAuditUserIdAndName, null)
-                .set(ContractLog::getBatch, null)
+//                .set(ContractLog::getAuditUserIdAndName, null)
+//                .set(ContractLog::getBatch, null)
                 .in(ContractLog::getId, Arrays.asList(formDataId.split(","))));
     }
 
@@ -1649,8 +1689,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 System.out.println("----- 电签成功--------==修改---=" + dateInfo);
                 this.informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getStatus, status)
                         .set(InformationQuery::getEVisaPdfUrl, newFileUrl)
-                        .set(InformationQuery::getReportNumber, null)
-                        .set(InformationQuery::getAuditUserIdAndName, null)
+//                        .set(InformationQuery::getReportNumber, null)
+//                        .set(InformationQuery::getAuditUserIdAndName, null)
                         .set(InformationQuery::getEVisaPdfPage, pdfPage)
                         .set(InformationQuery::getEVisaPdfSize, pdfSize)
                         .set(InformationQuery::getBusinessTime, dateInfo)
@@ -1666,8 +1706,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         } catch (Exception e) {
             this.informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getStatus, status)
                     .set(InformationQuery::getEVisaPdfUrl, newFileUrl)
-                    .set(InformationQuery::getReportNumber, null)
-                    .set(InformationQuery::getAuditUserIdAndName, null)
+//                    .set(InformationQuery::getReportNumber, null)
+//                    .set(InformationQuery::getAuditUserIdAndName, null)
                     .set(InformationQuery::getEVisaPdfPage, pdfPage)
                     .set(InformationQuery::getEVisaPdfSize, pdfSize)
                     .set(InformationQuery::getBusinessTime, dateInfo)