Browse Source

对接任务列表查看项目合同段非必填

chenr 6 months ago
parent
commit
167e45350e

+ 25 - 18
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/APIController.java

@@ -61,9 +61,9 @@ public class APIController {
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "获取任务列表", notes = "ApiTaskPageDto")
     public R<IPage<ApiTaskPageVo>> apiPage(@RequestBody ApiTaskPageDto dto) {
-        if (ObjectUtil.isEmpty(dto.getProjectId()) || ObjectUtil.isEmpty(dto.getContractId())) {
-            throw new ServiceException("未获取到当前项目或合同段信息");
-        }
+//        if (ObjectUtil.isEmpty(dto.getProjectId()) || ObjectUtil.isEmpty(dto.getContractId())) {
+//            throw new ServiceException("未获取到当前项目或合同段信息");
+//        }
         if(dto.getCurrent()==null){
             dto.setCurrent(1);
         }
@@ -75,22 +75,23 @@ public class APIController {
         int size = dto.getSize();
         List<Object> params = new ArrayList<>();
         StringBuilder sqlString = new StringBuilder("SELECT * FROM u_task WHERE 1=1 AND is_deleted = 0 AND approval_type in (5,6,7,8) "); //approval_type = 5 计量任务
+        if(dto.getContractId()!=null&&dto.getProjectId()!=null){
+            ContractInfo contractInfo = jdbcTemplate.queryForObject("select contract_type from m_contract_info where id = " + dto.getContractId(), new BeanPropertyRowMapper<>(ContractInfo.class));
+            if (contractInfo != null && Arrays.asList(1, 4).contains(contractInfo.getContractType())) {
+                /*施工、计量合同段(总承包合同段)按照项目id、合同段id正常查询*/
+                if (ObjectUtil.isNotEmpty(dto.getProjectId()) && ObjectUtil.isNotEmpty(dto.getContractId())) {
+                    sqlString.append(" AND project_id = ? AND contract_id = ?");
+                    params.add(dto.getProjectId());
+                    params.add(dto.getContractId());
+                }
 
-        ContractInfo contractInfo = jdbcTemplate.queryForObject("select contract_type from m_contract_info where id = " + dto.getContractId(), new BeanPropertyRowMapper<>(ContractInfo.class));
-        if (contractInfo != null && Arrays.asList(1, 4).contains(contractInfo.getContractType())) {
-            /*施工、计量合同段(总承包合同段)按照项目id、合同段id正常查询*/
-            if (ObjectUtil.isNotEmpty(dto.getProjectId()) && ObjectUtil.isNotEmpty(dto.getContractId())) {
-                sqlString.append(" AND project_id = ? AND contract_id = ?");
-                params.add(dto.getProjectId());
-                params.add(dto.getContractId());
+            } else if (contractInfo != null && Arrays.asList(2, 3).contains(contractInfo.getContractType())) {
+                /*监理、业主(指挥部)合同段,默认查询当前项目下所有关联的合同段*/
+                List<ContractRelationJlyz> contractRelationJLYZ = jdbcTemplate.query("select contract_id_sg from m_contract_relation_jlyz where contract_id_jlyz = " + dto.getContractId(), new BeanPropertyRowMapper<>(ContractRelationJlyz.class));
+                Set<Long> ids = contractRelationJLYZ.stream().map(ContractRelationJlyz::getContractIdSg).collect(Collectors.toSet());
+                ids.add(Long.parseLong(dto.getContractId())); //把本身合同段也加入查询
+                sqlString.append(" AND contract_id in(").append(StringUtils.join(ids, ",")).append(")");
             }
-
-        } else if (contractInfo != null && Arrays.asList(2, 3).contains(contractInfo.getContractType())) {
-            /*监理、业主(指挥部)合同段,默认查询当前项目下所有关联的合同段*/
-            List<ContractRelationJlyz> contractRelationJLYZ = jdbcTemplate.query("select contract_id_sg from m_contract_relation_jlyz where contract_id_jlyz = " + dto.getContractId(), new BeanPropertyRowMapper<>(ContractRelationJlyz.class));
-            Set<Long> ids = contractRelationJLYZ.stream().map(ContractRelationJlyz::getContractIdSg).collect(Collectors.toSet());
-            ids.add(Long.parseLong(dto.getContractId())); //把本身合同段也加入查询
-            sqlString.append(" AND contract_id in(").append(StringUtils.join(ids, ",")).append(")");
         }
         if (ObjectUtil.isNotEmpty(dto.getSelectedType())) {
             sqlString.append(" AND (");
@@ -194,9 +195,15 @@ public class APIController {
         page.setTotal(totalCount);
         return R.data(page);
     }
+
+    /**
+     * 第三方对接 获取任务流程状态
+     * @param taskId
+     * @return
+     */
     @GetMapping("/task/getTaskProcessInfo")
     @ApiOperationSupport(order = 2)
-    @ApiOperation(value = "获取任务流程", notes = "taskId")
+    @ApiOperation(value = "获取任务流程状态", notes = "taskId")
     public List<Map<String, Object>> getTaskProcessInfo(Long taskId){
         Task task = jdbcTemplate.query("SELECT * FROM u_task WHERE id = ?", new Object[]{taskId}, new BeanPropertyRowMapper<>(Task.class)).stream().findAny().orElse(null);
         if(task!=null){