Bläddra i källkod

资料填报上报修改,u_task上报类型修改

lvy 3 månader sedan
förälder
incheckning
64f3b6ffce

+ 3 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TaskParallel.java

@@ -86,6 +86,9 @@ public class TaskParallel extends BaseEntity {
         this.setIsDeleted(0);
         this.setCreateUser(AuthUtil.getUserId());
         this.setCreateTime(new Date());
+        this.initiative = 1;
+        this.exeCount = 0;
+        this.setStatus(1);
     }
 
     public TaskParallel() {

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

@@ -552,6 +552,7 @@ public class ContractLogController extends BladeController {
                     //生成任务实体
                     TaskVO taskVO = new TaskVO();
                     BeanUtils.copyProperties(startTaskVO, taskVO);
+                    taskVO.setApprovalType(3);
                     if (taskVO.getUserTasks() != null && taskVO.getUserTasks().size() > 0) {
                         //标记为自定义流程
                         taskVO.setFixedFlowId(Long.parseLong("0"));

+ 2 - 2
blade-service/blade-business/src/main/java/org/springblade/business/controller/EVisaTaskCheckController.java

@@ -97,7 +97,7 @@ public class EVisaTaskCheckController {
             InformationQuery node = informationQueryService.getOne(new LambdaQueryWrapper<InformationQuery>()
                     .eq(InformationQuery::getWbsId, json.getString("nodeId"))
                     .eq(InformationQuery::getContractId, json.getString("contractId"))
-                    .eq(InformationQuery::getClassify, tableOwner));
+                    .eq(InformationQuery::getClassify, tableOwner).last("order by id desc limit 1"));
 
             if (node == null || StringUtils.isBlank(node.getPdfUrl())) {
                 return R.fail(300, "当前节点还未生成PDF,不能上报");
@@ -365,7 +365,7 @@ public class EVisaTaskCheckController {
         InformationQuery node = informationQueryService.getOne(new LambdaQueryWrapper<InformationQuery>()
                 .eq(InformationQuery::getWbsId, json.getString("nodeId"))
                 .eq(InformationQuery::getContractId, contractId)
-                .eq(InformationQuery::getClassify, tableOwner));
+                .eq(InformationQuery::getClassify, tableOwner).last("ORDER BY id DESC limit 1"));
 
         if (node == null || StringUtils.isBlank(node.getPdfUrl())) {
             return R.fail(300, "当前节点还未生成PDF,不能上报");

+ 54 - 13
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -611,14 +611,16 @@ public class InformationWriteQueryController extends BladeController {
 //    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
     public R<Object> abolishOne(@RequestParam String primaryKeyId, @RequestParam String classify, @RequestParam String projectId, @RequestParam String contractId) {
         //查询填报状态
-        InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).eq(InformationQuery::getType, 1));
+        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));
         primaryKeyId = primaryKeyId + "*";
         if (businessData != null) {
             //使用批量废除接口
             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).eq(InformationQuery::getType, 2));
+            InformationQuery businessDataTrial = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).eq(InformationQuery::getContractId, contractId)
+                    .eq(InformationQuery::getType, 2).in(InformationQuery::getStatus, 1,2));
             if (businessDataTrial != null) {
                 //使用批量废除接口
                 return this.batchAbolish(businessDataTrial.getId().toString(), primaryKeyId, projectId, contractId, "撤回成功");
@@ -655,7 +657,7 @@ public class InformationWriteQueryController extends BladeController {
         //记录状态
         String status = "1";
         //查询填报状态,type=1资料填报
-        InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).eq(InformationQuery::getType, 1).last("limit 1"));
+        InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).eq(InformationQuery::getType, 1).last("order by id desc limit 1"));
         if (businessData != null) {
             switch (businessData.getStatus()) {
                 case 0:
@@ -717,7 +719,7 @@ public class InformationWriteQueryController extends BladeController {
         //记录状态
         String status = "1";
         //查询填报状态,type=1资料填报
-        InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).eq(InformationQuery::getType, 1));
+        InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).eq(InformationQuery::getType, 1).last("order by id desc limit 1"));
         if (businessData != null) {
             switch (businessData.getStatus()) {
                 case 0:
@@ -782,7 +784,7 @@ public class InformationWriteQueryController extends BladeController {
         //查询填报状态,type=3首件
         InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery()
                 .eq(InformationQuery::getId, id)
-                .eq(InformationQuery::getType, 3)
+                .eq(InformationQuery::getType, 3).last("order by id desc limit 1")
         );
         if (businessData != null) {
             switch (businessData.getStatus()) {
@@ -908,7 +910,7 @@ public class InformationWriteQueryController extends BladeController {
         //此时的ids是当前节点的primaryKeyId但并不是业务数据ID,需要根据ids和classify去查询具体的业务ID
         if (ObjectUtil.isNotEmpty(startTaskVO.getTrialSelfInspectionRecordId())) {
             //试验
-            businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, startTaskVO.getIds().replaceAll(",", "")).eq(InformationQuery::getClassify, startTaskVO.getClassify().toString()).eq(InformationQuery::getType, 2).eq(InformationQuery::getContractId,startTaskVO.getContractId()));
+            businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, startTaskVO.getIds().replaceAll(",", "")).eq(InformationQuery::getClassify, startTaskVO.getClassify().toString()).eq(InformationQuery::getType, 2).eq(InformationQuery::getContractId,startTaskVO.getContractId()).last("order by id desc limit 1"));
             if (businessData != null) {
                 //设置业务数据ID
                 startTaskVO.setIds(businessData.getWbsId().toString());
@@ -918,7 +920,7 @@ public class InformationWriteQueryController extends BladeController {
                 return R.data(300, false, "未查询到填报信息,上报失败");
             }
         } else { //质检
-            businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, startTaskVO.getIds().replaceAll(",", "")).eq(InformationQuery::getClassify, startTaskVO.getClassify().toString()).eq(InformationQuery::getType, 1));
+            businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, startTaskVO.getIds().replaceAll(",", "")).eq(InformationQuery::getClassify, startTaskVO.getClassify().toString()).eq(InformationQuery::getType, 1).last("order by id desc limit 1"));
             if (businessData != null) {
                 //设置业务数据ID
                 startTaskVO.setIds(businessData.getId().toString());
@@ -1172,7 +1174,7 @@ public R<String> batchDownloadFileToZip(String ids, HttpServletResponse response
                         //已审批、已撤销的任务,修改业务数据的审批状态为未上报并撤签即可
                         LambdaUpdateWrapper<InformationQuery> wrapper = Wrappers.lambdaUpdate();
                         //更改状态为未上报
-                        wrapper.set(InformationQuery::getStatus, 0);
+                        wrapper.set(InformationQuery::getStatus, 3);
                         //将电签的pdf路径置空
                         wrapper.set(InformationQuery::getEVisaPdfUrl, null);
                         //将上报批次置空
@@ -1210,6 +1212,9 @@ 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) {
@@ -1355,7 +1360,7 @@ public R<String> batchDownloadFileToZip(String ids, HttpServletResponse response
 @ApiOperation(value = "批量上报")
 //    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
 public R<Object> batchTask(@RequestBody StartTaskVO startTaskVO) {
-    // 1= 代表 试验 流程上报  2=试验 - 委托单上报   其他=质检或别的项目上报
+    // 1= 代表 试验 流程上报  2=试验 - 委托单上报 3=首件上报  其他=质检或别的项目上报
     Long appType = startTaskVO.getTrialSelfInspectionRecordId();
     if (ObjectUtil.isEmpty(SecureUtil.getUserId()) || SecureUtil.getUserId() == -1L) {
         throw new ServiceException("未获取到当前用户信息");
@@ -1379,11 +1384,40 @@ public R<Object> batchTask(@RequestBody StartTaskVO startTaskVO) {
                     trialIds = startTaskVO.getIds();
                 }
                 //试验记录 和 委托单 ids重新赋值映射为数据源ids
-                ids = queryList.stream().map(InformationQuery::getId).map(String::valueOf).toArray(String[]::new);
+//                ids = queryList.stream().map(InformationQuery::getId).map(String::valueOf).toArray(String[]::new);
             }
 
             Map<String, InformationQuery> queryMap = new HashMap<>();
-            queryList.forEach(query -> queryMap.put(query.getId().toString(), query));
+            List<InformationQuery> saveQueryList = new ArrayList<>();
+            List<InformationQuery> queryTempList = new ArrayList<>();
+            Map<String, InformationQuery> queryTempMap = new HashMap<>();
+            queryList.forEach(query -> {
+                InformationQuery temp = queryTempMap.get(query.getWbsId() + "," + query.getContractId() + "," + query.getClassify());
+                if (temp != null) {
+                    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);
+                }
+            });
+            queryList = queryTempList;
+            if (queryList.isEmpty()) {
+                return R.fail( "已上报,无需重复上报");
+            }
+            if (!saveQueryList.isEmpty()) {
+                this.informationQueryService.saveBatch(saveQueryList);
+            }
+            ids = queryList.stream().map(InformationQuery::getId).map(String::valueOf).toArray(String[]::new);
             boolean var = false;
 
             try {
@@ -1407,7 +1441,7 @@ public R<Object> batchTask(@RequestBody StartTaskVO startTaskVO) {
                         taskVO.setFixedFlowId(startTaskVO.getFixedFlowId());
                     }
                     //设置任务名称
-                    if (StringUtils.isNotEmpty(queryMap.get(id).toString())) {
+                    if (queryMap.get(id) != null && StringUtils.isNotEmpty(queryMap.get(id).getName())) {
                         taskVO.setTaskName(queryMap.get(id).getName());
                     }
                     //设置数据源指向
@@ -1415,6 +1449,10 @@ public R<Object> batchTask(@RequestBody StartTaskVO startTaskVO) {
                     //设置上报类型
                     if (appType != null && appType == 2L) {
                         taskVO.setApprovalType(8);
+                    } else if (appType != null && appType == 1L) {
+                        taskVO.setApprovalType(9);
+                    } else if (appType != null && appType == 3L) {
+                        taskVO.setApprovalType(10);
                     } else {
                         taskVO.setApprovalType(1);
                     }
@@ -1456,7 +1494,7 @@ public R<Object> batchTask(@RequestBody StartTaskVO startTaskVO) {
                             jdbcTemplate.execute(sql);
                         }
                         var = true;
-//                        getPdfs(queryMap.get(id));
+                        getPdfs(queryMap.get(id));
                     } else {
                         return R.fail("创建主流程失败");
                     }
@@ -4605,6 +4643,9 @@ public R<Object> customAddContractNode(@RequestBody CustomAddContractNodeDTO dto
 
     @Async
     public R getPdfs(InformationQuery query){
+        if (query == null) {
+            return null;
+        }
         try {
             return excelTabClient.getPdfS(query.getWbsId() + "", query.getClassify() + "", query.getContractId() + "");
         } catch (IOException e) {

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

@@ -1202,7 +1202,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                                 approvalVO.setTaskId(task.getId().toString());
                                 approvalVO.setFlag("OK");
                                 approvalVO.setComment("重新发起电签");
-                                approvalVO.setApprovalType(1);
+                                approvalVO.setApprovalType(9);
                                 approvalVO.setFormDataId(task.getFormDataId());
                                 approvalVO.setParallelProcessInstanceId(taskParallel.getParallelProcessInstanceId());
                                 approvalVO.setYsNickName(taskParallel.getTaskUserName());

+ 6 - 2
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

@@ -672,7 +672,11 @@ public class TaskController extends BladeController {
 
             task.setType(1);
 
-            task.setApprovalType(meterTaskType+4); //计量
+            if (meterTaskType == 4) {
+                task.setApprovalType(11); //计量
+            } else {
+                task.setApprovalType(meterTaskType+4); //计量
+            }
             task.setFixedFlowId(ObjectUtil.isNotEmpty(approvalDTO.getFixedFlowId()) ? Long.parseLong(approvalDTO.getFixedFlowId()) : 0L);
             task.setStatus(1); //待审批
             task.setIsDeleted(0);
@@ -3960,7 +3964,7 @@ public class TaskController extends BladeController {
                 jdbcTemplate.execute(uptPeriod);
                 jdbcTemplate.execute(updta);
                 jdbcTemplate.execute(upData);
-                jdbcTemplate.execute("update s_contract_material_adjust set `status` = 0 where (contract_period_id = "+ periodId +"or meter_period_id = "+ periodId +") and is_deleted = 0;");
+                jdbcTemplate.execute("update s_contract_material_adjust set `status` = 0 where (contract_period_id = "+ periodId +" or meter_period_id = "+ periodId +") and is_deleted = 0;");
 
                 //同时删除映射task表数据
                 deleteMapTask1 = "DELETE from s_middle_meter_apply_task where task_id = "+task.getId();

+ 13 - 0
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@@ -1773,6 +1773,19 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
                         } else {
                             return page.setRecords(null);
                         }
+                    } else {
+                        long current = (page.getCurrent() - 1) * page.getSize();
+                        if (current < 0) {
+                            throw new IllegalArgumentException("当前页码不能小于0");
+                        }
+                        int currentNow = (int) (current / page.getSize() + 1);
+                        int pageSize = (int) page.getSize();
+                        int fromIndex = (currentNow - 1) * pageSize;
+                        int toIndex = Math.min(currentNow * pageSize, voResult.size());
+                        List<InformationQueryVO> subList = voResult.subList(fromIndex, toIndex);
+                        page.setRecords(subList);
+                        page.setTotal(voResult.size());
+                        return page;
                     }
                 }
             }