Browse Source

1.新增接口产品update接口,与产品更新选择类型区分开来
2.查询产品list接口SQL修改
3.优化取号逻辑
4.查询评估对象SQL修改

GouGengquan 1 year ago
parent
commit
5e32e4ebaa

+ 14 - 3
biz-base/src/main/java/com/dayou/controller/AssetsProductionController.java

@@ -81,12 +81,23 @@ public class AssetsProductionController extends BaseController {
     }
 
     /**
-     * 资产产品表更新
+     * 资产产品选择类型表更新
      */
     @FinishTask
+    @PutMapping("/update/choice")
+    public RestResponse<Boolean> updateChoice(@RequestBody TaskRecordDTO<AssetsProduction> taskRecordDTO) {
+        Boolean ret = assetsProductionService.updateChoice(taskRecordDTO.getTaskData());
+        return RestResponse.data(ret);
+    }
+
+    /**
+     * 产品信息更新
+     * @param assetsProduction prod
+     * @return RestResponse<Boolean>
+     */
     @PutMapping("/update")
-    public RestResponse<Boolean> update(@RequestBody TaskRecordDTO<AssetsProduction> taskRecordDTO) {
-        Boolean ret = assetsProductionService.update(taskRecordDTO.getTaskData());
+    public RestResponse<Boolean> update(@RequestBody AssetsProduction assetsProduction) {
+        Boolean ret = assetsProductionService.update(assetsProduction);
         return RestResponse.data(ret);
     }
 

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

@@ -60,4 +60,11 @@ public interface AssetsEvaluationTargetMapper extends CustomBaseMapper<AssetsEva
      * @return Boolean
      */
     Boolean checkValue(AssetsEvaluationTarget assetsEvaluationTarget);
+
+    /**
+     * 根据业务id查询该订单下的所有评估对象
+     * @param businessId 业务id
+     * @return Integer
+     */
+    Integer targetCount(@Param("businessId") Long businessId, @Param("statementNo") String statementNo);
 }

+ 17 - 0
dao/src/main/resources/mapper/AssetsEvaluationTargetMapper.xml

@@ -66,9 +66,15 @@
         <if test="statementNo != null and statementNo != '' ">
             AND statement_no = #{statementNo}
         </if>
+        <if test="statementNo == null or statementNo == '' ">
+            AND (SELECT COUNT(work_flow_node_instance.id) FROM work_flow_node_instance WHERE business_sub_id = statement_no AND work_flow_node_instance.deleted = 0) = 0
+        </if>
         <if test="reportNo != null and reportNo != '' ">
             AND report_no = #{reportNo}
         </if>
+        <if test="reportNo == null or reportNo == '' ">
+            AND (SELECT COUNT(work_flow_node_instance.id) FROM work_flow_node_instance WHERE business_min_id = report_no AND work_flow_node_instance.deleted = 0) = 0
+        </if>
         AND target.deleted = 0
     </select>
 
@@ -123,4 +129,15 @@
           AND deleted = 0
     </update>
 
+    <!--根据业务id查询该订单下的所有评估对象-->
+    <select id="targetCount" resultType="java.lang.Integer">
+        SELECT COUNT(id)
+        FROM assets_evaluation_target
+        WHERE assets_id = #{businessId}
+        AND deleted = 0
+        <if test="statementNo != null and statementNo != ''">
+            AND statement_no = #{statementNo}
+        </if>
+    </select>
+
 </mapper>

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

@@ -131,28 +131,25 @@
         qr_code
         FROM assets_production
         WHERE business_id = #{businessId}
-        <if test="statementNo != null and statementNo != ''">
-            AND production_no = #{statementNo}
+        <if test="statementNos != null and statementNos.size() > 0">
+            AND production_no IN
+            <foreach collection="statementNos" index="index" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
-        <if test="(statementNo != null and statementNo != '') and (reportNos != null and reportNos.size() > 0) ">
+        <if test="(statementNos != null and statementNos.size() > 0) and (reportNos != null and reportNos.size() > 0) ">
             OR production_no IN
             <foreach collection="reportNos" index="index" item="item" open="(" separator="," close=")">
                 #{item}
             </foreach>
         </if>
-        <if test="(statementNo == null or statementNo == '') and (reportNos != null and reportNos.size() > 0) ">
+        <if test="(statementNos = null or statementNos.size() lt 1) and (reportNos != null and reportNos.size() > 0) ">
 #             OR
             AND production_no IN
             <foreach collection="reportNos" index="index" item="item" open="(" separator="," close=")">
                 #{item}
             </foreach>
         </if>
-<!--        <if test="reportNos != null and reportNos.size() > 0">-->
-<!--            production_no IN-->
-<!--            <foreach collection="reportNos" index="index" item="item" open="(" separator="," close=")">-->
-<!--                #{item}-->
-<!--            </foreach>-->
-<!--        </if>-->
         AND create_production_date IS NOT NULL
         AND deleted = 0
     </select>

+ 6 - 1
domain/src/main/java/com/dayou/dto/AProListSelectDTO.java

@@ -37,7 +37,12 @@ public class AProListSelectDTO {
     List<String> productionNos;
 
     /**
-     * 产品号集合
+     * 报告号集合
      */
     List<String> reportNos;
+
+    /**
+     * 意见书号集合
+     */
+    List<String> statementNos;
 }

+ 5 - 0
domain/src/main/java/com/dayou/dto/TakeAssetsProductionNoDTO.java

@@ -42,4 +42,9 @@ public class TakeAssetsProductionNoDTO {
      */
     private List<Long> allTargetIdList;
 
+    /**
+     * 意见书号
+     */
+    private String statementNo;
+
 }

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

@@ -32,8 +32,20 @@ public interface IAssetsProductionService extends IService<AssetsProduction> {
 
         Boolean add(AssetsProduction assetsProduction);
 
+        /**
+         * 产品信息更新
+         * @param assetsProduction prod
+         * @return Boolean
+         */
         Boolean update(AssetsProduction assetsProduction);
 
+        /**
+         * 更新产品选择类型
+         * @param assetsProduction prod
+         * @return Boolean
+         */
+        Boolean updateChoice(AssetsProduction assetsProduction);
+
         Boolean delete(Long id);
 
         /**

+ 13 - 2
service/src/main/java/com/dayou/service/impl/AssetsProductionServiceImpl.java

@@ -121,9 +121,19 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
         return choiceLogService.saveBatch(choiceLogList);
     }
 
+    /**
+     * 产品信息更新
+     * @param assetsProduction prod
+     * @return Boolean
+     */
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public Boolean update(AssetsProduction assetsProduction) {
+        return this.updateById(assetsProduction);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean updateChoice(AssetsProduction assetsProduction) {
         // 更新选择产品时给当前选择产品的评估对象更新选择产品记录
         List<BusinessProductionChoiceLog> choiceLogList = new ArrayList<>();
         for (Long targetId : assetsProduction.getTargetIdList()) {
@@ -490,7 +500,8 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
             // 新增产品收款信息
             OrderFund orderFund = orderFundService.getOne(new LambdaQueryWrapper<OrderFund>()
                     .select(OrderFund::getId)
-                    .eq(OrderFund::getBusinessId, assetsProduction.getBusinessId()));
+                    .eq(OrderFund::getBusinessId, assetsProduction.getBusinessId())
+                    .eq(OrderFund::getBusinessType, "ASSET_BUSINESS"));
             ProductionFund productionFund = new ProductionFund();
             productionFund.setBusinessType(ASSET_BUSINESS.getCode());
             productionFund.setBusinessId(assetsProduction.getBusinessId());

+ 2 - 0
service/src/main/java/com/dayou/service/impl/AssetsServiceImpl.java

@@ -266,6 +266,8 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
     @Override
     public Boolean takeAssetsProductionNo(TakeAssetsProductionNoDTO dto) {
 
+        dto.setSelectAll(assetsEvaluationTargetMapper.targetCount(dto.getBusinessId(), dto.getStatementNo()) == dto.getTargetIdList().size());
+
         // 取号时更新产品选择记录状态
         List<BusinessProductionChoiceLog> choiceLogList = new ArrayList<>();
         // 循环取号的评估对象id集合