Browse Source

1.资产业务AssetsNodeHandler流程分叉开发(待测试)
2.新增产品是否已有流程的判断接口

GouGengquan 1 year ago
parent
commit
eee1a7a26f

+ 6 - 1
biz-base/src/main/java/com/dayou/controller/AssetsProductionController.java

@@ -124,7 +124,7 @@ public class AssetsProductionController extends BaseController {
     public RestResponse<Boolean> writeAssetsProduction(@RequestBody TaskRecordDTO<AssetsProduction> taskRecordDTO) {
         Boolean flag = assetsProductionService.writeAssetsProduction(taskRecordDTO.getTaskData());
         if (ObjectUtil.isNull(flag)){
-            return RestResponse.success(flag,"该产品出具!");
+            return RestResponse.success(flag,"该产品出具!");
         }
         return RestResponse.data(flag);
     }
@@ -149,5 +149,10 @@ public class AssetsProductionController extends BaseController {
         return RestResponse.data(assetsProductionService.getProductionList(aProListSelectDTO));
     }
 
+    @GetMapping("/getInatanceCount")
+    public Integer getInatanceCount(AProListSelectDTO aProListSelectDTO) {
+        return assetsProductionService.getInatanceCount(aProListSelectDTO);
+    }
+
 }
 

+ 7 - 0
dao/src/main/java/com/dayou/mapper/AssetsProductionMapper.java

@@ -69,4 +69,11 @@ public interface AssetsProductionMapper extends CustomBaseMapper<AssetsProductio
      * @return List<AssetsProduction>
      */
     List<AssetsProduction> getProductionList(AProListSelectDTO aProListSelectDTO);
+
+    /**
+     * 根据业务id与产品号查询该产品是否已有提交的流程实例信息
+     * @param aProListSelectDTO 查询dto
+     * @return Integer
+     */
+    Integer getInatanceCount(AProListSelectDTO aProListSelectDTO);
 }

+ 10 - 2
dao/src/main/resources/mapper/AssetsProductionMapper.xml

@@ -106,15 +106,23 @@
         SELECT id, business_id, production_no, production_type, signatory, client_name, client_tel, valuation_basis_date, evaluate_acreage, evaluate_amount, evaluate_price, owner, print_count, create_production_date, comment, repertory_state, repertory_in_time, repertory_out_time, file_path, save_file_date, delivery, qr_code
         FROM assets_production
         WHERE business_id = #{businessId}
-        <if test="production_no != null and production_no != '' ">
+        <if test="productionNo != null and productionNo != '' ">
             AND production_no = #{productionNo}
         </if>
-        <if test="production_no == null or production_no == '' ">
+        <if test="productionNo == null or productionNo == '' ">
             AND create_production_date IS NOT NULL
         </if>
         AND deleted = 0
     </select>
 
+    <!--根据业务id与产品号查询该产品是否已有提交的流程实例信息-->
+    <select id="getInatanceCount" resultType="java.lang.Integer">
+        SELECT COUNT(id)
+        FROM work_flow_node_instance
+        WHERE deleted = 0
+        AND business_id = #{businessId}
+        AND business_sub_id = #{productionNo}
+    </select>
 
 
 </mapper>

+ 7 - 0
service/src/main/java/com/dayou/service/IAssetsProductionService.java

@@ -73,4 +73,11 @@ public interface IAssetsProductionService extends IService<AssetsProduction> {
          */
         List<AssetsProduction> getProductionList(AProListSelectDTO aProListSelectDTO);
 
+        /**
+         * 根据业务id与产品号查询该产品是否已有提交的流程实例信息
+         * @param aProListSelectDTO 查询dto
+         * @return Integer
+         */
+        Integer getInatanceCount(AProListSelectDTO aProListSelectDTO);
+
 }

+ 11 - 0
service/src/main/java/com/dayou/service/impl/AssetsProductionServiceImpl.java

@@ -5,6 +5,7 @@ import com.dayou.dto.AProListSelectDTO;
 import com.dayou.dto.AssetsProductionDetailDTO;
 import com.dayou.dto.TaskRecordDTO;
 import com.dayou.entity.AssetsProduction;
+import com.dayou.entity.WorkFlowNodeInstance;
 import com.dayou.mapper.AssetsProductionMapper;
 import com.dayou.service.IAssetsProductionService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -140,4 +141,14 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
     public List<AssetsProduction> getProductionList(AProListSelectDTO aProListSelectDTO) {
         return assetsProductionMapper.getProductionList(aProListSelectDTO);
     }
+
+    /**
+     * 根据业务id与产品号查询该产品是否已有提交的流程实例信息
+     * @param aProListSelectDTO 查询dto
+     * @return Integer
+     */
+    @Override
+    public Integer getInatanceCount(AProListSelectDTO aProListSelectDTO) {
+        return assetsProductionMapper.getInatanceCount(aProListSelectDTO);
+    }
 }

+ 10 - 10
service/src/main/java/com/dayou/workflow/handler/AssetsNodeHandler.java

@@ -93,17 +93,17 @@ public class AssetsNodeHandler extends WorkNodeProcessable {
 
                 if (workflowNodeEnum.equals(WorkflowNodeEnum.GENERATE_STATEMENT)){
                     for (String businessSubId :workNodeCommit.getReportNos()){
-                        AssetsProduction assetsProduction = assetsProductionService.getOne(new LambdaQueryWrapper<AssetsProduction>().select(AssetsProduction::getCreateProductionDate).eq(AssetsProduction::getProductionNo, businessSubId).eq(BaseEntity::getDeleted, Boolean.FALSE));
-//                        addNextInstanceNode(currentInstanceNode,nextWorkNode, workNodeCommit.getNextHandlerId(),businessSubId,null);
+//                        AssetsProduction assetsProduction = assetsProductionService.getOne(new LambdaQueryWrapper<AssetsProduction>().select(AssetsProduction::getCreateProductionDate).eq(AssetsProduction::getProductionNo, businessSubId).eq(BaseEntity::getDeleted, Boolean.FALSE));
+                        addNextInstanceNode(currentInstanceNode,nextWorkNode, workNodeCommit.getNextHandlerId(),businessSubId,null);
                         // 产品出具日期是否为null,为null说明还没撰写产品的信息
-                        if (ObjectUtil.isNotNull(assetsProduction)){
-                            addNextInstanceNode(currentInstanceNode,nextWorkNode, workNodeCommit.getNextHandlerId(),businessSubId,null);
-                        }else {
-                            workFlowNodeInstanceService.save(currentInstanceNode);
-                            WorkTaskRecord workTaskRecord = workTaskRecordService.getOne(new LambdaQueryWrapper<WorkTaskRecord>().select(WorkTaskRecord::getHandlerId,WorkTaskRecord::getTaskId).eq(WorkTaskRecord::getInstanceId,workNodeCommit.getInstanceNodeId()));
-                            workTaskRecord.setInstanceId(currentInstanceNode.getId());
-                            workTaskRecordService.save(workTaskRecord);
-                        }
+//                        if (ObjectUtil.isNotNull(assetsProduction)){
+//                            addNextInstanceNode(currentInstanceNode,nextWorkNode, workNodeCommit.getNextHandlerId(),businessSubId,null);
+//                        }else {
+//                            workFlowNodeInstanceService.save(currentInstanceNode);
+//                            WorkTaskRecord workTaskRecord = workTaskRecordService.getOne(new LambdaQueryWrapper<WorkTaskRecord>().select(WorkTaskRecord::getHandlerId,WorkTaskRecord::getTaskId).eq(WorkTaskRecord::getInstanceId,workNodeCommit.getInstanceNodeId()));
+//                            workTaskRecord.setInstanceId(currentInstanceNode.getId());
+//                            workTaskRecordService.save(workTaskRecord);
+//                        }
                     }
                 }
                 else if(workflowNodeEnum.equals(WorkflowNodeEnum.WRITE_REPORT) || workflowNodeEnum.equals(WorkflowNodeEnum.WRITE_LETTER)){