Bläddra i källkod

1.取号流程优化
2.订单列表查询SQL修改
3.资产评估对象查询接口修改

GouGengquan 1 år sedan
förälder
incheckning
936231bf4a

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

@@ -128,7 +128,7 @@ public class AssetsController extends BaseController {
      * @param dto 取号dto
      * @return RestResponse<String>
      */
-    @GetMapping("/takeAssetsProductionNo")
+    @PostMapping("/takeAssetsProductionNo")
     public RestResponse<String> takeAssetsProductionNo(@RequestBody TakeAssetsProductionNoDTO dto) {
         return RestResponse.data(assetsService.takeAssetsProductionNo(dto));
     }

+ 5 - 4
biz-base/src/main/java/com/dayou/controller/AssetsEvaluationTargetController.java

@@ -1,5 +1,6 @@
 package com.dayou.controller;
 
+import com.dayou.dto.AETargetListSelectDTO;
 import com.dayou.dto.TaskRecordDTO;
 import com.dayou.vo.AssetsEvaluationTargetVO;
 import com.dayou.workflow.annotation.FinishTask;
@@ -40,12 +41,12 @@ public class AssetsEvaluationTargetController extends BaseController {
 
     /**
      * 根据资产业务id获取资产业务评估对象集合
-     * @param id 资产业务id
+     * @param dto 查询dto
      * @return RestResponse<List<AssetsEvaluationTargetVO>>
      */
-    @GetMapping("/getAETargetListByAssetsId/{id}")
-    public RestResponse<List<AssetsEvaluationTargetVO>> getAETargetListByAssetsId(@PathVariable Long id) {
-        return RestResponse.data(assetsEvaluationTargetService.getAETargetListByAssetsId(id));
+    @GetMapping("/getAETargetListByAssetsId")
+    public RestResponse<List<AssetsEvaluationTargetVO>> getAETargetListByAssetsId(AETargetListSelectDTO dto) {
+        return RestResponse.data(assetsEvaluationTargetService.getAETargetListByAssetsId(dto.getBusinessId(), dto.getProductionNo()));
     }
 
     /**

+ 8 - 1
dao/src/main/java/com/dayou/mapper/AssetsEvaluationTargetMapper.java

@@ -22,7 +22,7 @@ public interface AssetsEvaluationTargetMapper extends CustomBaseMapper<AssetsEva
      * @param id 资产订单id
      * @return List<AssetsEvaluationTargetVO>
      */
-    List<AssetsEvaluationTargetVO> getAETargetListByAssetsId(@Param("id") Long id);
+    List<AssetsEvaluationTargetVO> getAETargetListByAssetsId(@Param("id") Long id,@Param("productionNo") String productionNo);
 
     /**
      * 评估对象添加产品号
@@ -31,4 +31,11 @@ public interface AssetsEvaluationTargetMapper extends CustomBaseMapper<AssetsEva
      * @return BOolean
      */
     Boolean updateTargetProductionNo(@Param("id") Long id, @Param("productionNo") String productionNo);
+
+    /**
+     * 根据业务id获取已取号评估对象的产品号
+     * @param businessId 资产业务id
+     * @return List<String>
+     */
+    List<String> getProductionNoList(@Param("businessId") Long businessId);
 }

+ 2 - 3
dao/src/main/java/com/dayou/mapper/AssetsProductionMapper.java

@@ -32,11 +32,10 @@ public interface AssetsProductionMapper extends CustomBaseMapper<AssetsProductio
 
     /**
      * 获取产品号集合(用于判断下一个子号)
-     * @param businessId 业务id
-     * @param productionType 产品类型
+     * @param targetId 评估对象id
      * @return List<String>
      */
-    List<String> getgetProductionNo(@Param("businessId") Long businessId, @Param("productionType") String productionType);
+    List<String> getProductionNo(@Param("id") Long targetId);
 
     /**
      * 跟新产品的产品号信息

+ 27 - 12
dao/src/main/resources/mapper/AssetsEvaluationTargetMapper.xml

@@ -38,22 +38,27 @@
     <!--根据资产业务订单id获取评估对象信息-->
     <select id="getAETargetListByAssetsId" resultType="com.dayou.vo.AssetsEvaluationTargetVO">
         SELECT target.id,
-               the_holder,
-               total_asset_carrying_amount,
-               total_liabilities_carrying_amount,
-               carrying_amount_of_net_assets,
-               estimated_value,
-               check_value,
-               purpose_name,
-               type_name,
-               (SELECT assets_evaluation_target_type.type_name FROM assets_evaluation_target_type WHERE assets_evaluation_target_type.id = target.evaluation_type_id) AS targetTypename,
-               (SELECT assets_evaluation_target_type.type_name FROM assets_evaluation_target_type WHERE assets_evaluation_target_type.id = target.evaluation_type_sec_id) AS secTargetTypaName,
-               value_type.type_name AS valueTypeName,
-               production_no
+        the_holder,
+        total_asset_carrying_amount,
+        total_liabilities_carrying_amount,
+        carrying_amount_of_net_assets,
+        estimated_value,
+        check_value,
+        purpose_name,
+        type_name,
+        (SELECT assets_evaluation_target_type.type_name FROM assets_evaluation_target_type WHERE
+        assets_evaluation_target_type.id = target.evaluation_type_id) AS targetTypename,
+        (SELECT assets_evaluation_target_type.type_name FROM assets_evaluation_target_type WHERE
+        assets_evaluation_target_type.id = target.evaluation_type_sec_id) AS secTargetTypaName,
+        value_type.type_name AS valueTypeName,
+        production_no
         FROM assets_evaluation_target AS target
         LEFT JOIN assets_evaluation_target_purpose AS purpose ON purpose.id = target.evaluation_purpose_id
         LEFT JOIN assets_value_type AS value_type ON value_type.id = target.assets_value_id
         WHERE target.assets_id = #{id}
+        <if test="productionNo!=null and productionNo != '' ">
+            AND production_no = #{productionNo}
+        </if>
         AND target.deleted = 0
     </select>
 
@@ -65,4 +70,14 @@
         AND deleted = 0
     </update>
 
+    <!--根据业务id获取已取号评估对象的产品号-->
+    <select id="getProductionNoList" resultType="java.lang.String">
+        SELECT production_no
+        FROM assets_evaluation_target
+        WHERE assets_id = #{businessId}
+        AND deleted = 0
+        AND production_no IS NOT NULL
+        AND production_no != ''
+    </select>
+
 </mapper>

+ 10 - 6
dao/src/main/resources/mapper/AssetsMapper.xml

@@ -48,7 +48,8 @@
 
     <!--条件查询资产任务列表-->
     <select id="selectPage" resultType="com.dayou.vo.AssetsVO">
-        SELECT assets.id,
+        SELECT (@i :=  @i + 1) AS id,
+        assets.id AS assetsId,
         assets.name,
         order_id,
         assets_business_gener,
@@ -68,8 +69,9 @@
         nodeInfo.businessId,
         nodeInfo.currentNodeName,
         nodeInfo.currentNodeCode,
-        nodeInfo.handlerName
-        FROM assets
+        nodeInfo.handlerName,
+        production_type
+        FROM (SELECT @i := 0) AS sort,assets
         LEFT JOIN assets_production AS production ON production.business_id = assets.id
         LEFT JOIN user ON user.id = assets.principal_id
         LEFT JOIN customer_company AS customer ON customer.id = assets.clientele_id
@@ -120,7 +122,8 @@
 
     <!--条件查询我的资产任务订单列表-->
     <select id="selectMyOrderPage" resultType="com.dayou.vo.AssetsVO">
-        SELECT assets.id,
+        SELECT (@i :=  @i + 1) AS id,
+        assets.id AS assetsId,
         assets.name,
         assets.order_id,
         assets_business_gener,
@@ -147,8 +150,9 @@
         nodeInfo.businessId,
         nodeInfo.currentNodeName,
         nodeInfo.currentNodeCode,
-        nodeInfo.handlerName
-        FROM assets
+        nodeInfo.handlerName,
+        production.production_type
+        FROM (SELECT @i := 0) AS sort,assets
         LEFT JOIN assets_production AS production ON production.business_id = assets.id
         LEFT JOIN user ON user.id = assets.principal_id
         LEFT JOIN customer_company AS customer ON customer.id = assets.clientele_id

+ 6 - 4
dao/src/main/resources/mapper/AssetsProductionMapper.xml

@@ -53,15 +53,17 @@
         FROM assets_production
         WHERE business_id = #{businessId}
           AND deleted = 0
+        LIMIT 1
     </select>
 
     <!--获取产品号集合(用于判断下一个子号)-->
-    <select id="getgetProductionNo" resultType="java.lang.String">
+    <select id="getProductionNo" resultType="java.lang.String">
         SELECT production_no
-        FROM assets_production
-        WHERE business_id = #{businessId}
-        AND production_type = #{productionType}
+        FROM assets_evaluation_target
+        WHERE assets_id = #{id}
         AND deleted = 0
+        AND production_no IS NOT NULL
+        AND production_no != ''
     </select>
 
     <!--跟新产品的产品号信息-->

+ 18 - 0
domain/src/main/java/com/dayou/dto/AETargetListSelectDTO.java

@@ -0,0 +1,18 @@
+package com.dayou.dto;
+
+import lombok.Data;
+
+@Data
+public class AETargetListSelectDTO {
+
+    /**
+     * 资产业务id
+     */
+    private Long businessId;
+
+    /**
+     * 资产业务产品号
+     */
+    private String productionNo;
+
+}

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

@@ -20,7 +20,7 @@ public class TakeAssetsProductionNoDTO {
     /**
      * 是否还有未取号产品
      */
-    private Boolean hasNotTakeNumTarget;
+    private Boolean hasNotTakeNumTargetSelect;
 
     /**
      * 是否选择全部评估对象

+ 10 - 0
domain/src/main/java/com/dayou/vo/AssetsVO.java

@@ -10,6 +10,11 @@ import java.util.List;
 public class AssetsVO extends Assets {
 
     /**
+     * 资产业务id
+     */
+    private Long assetsId;
+
+    /**
      * 产品号
      */
     private String productionNo;
@@ -129,4 +134,9 @@ public class AssetsVO extends Assets {
      * 项目参与人(json数组)
      */
     private String members;
+
+    /**
+     * 产品类型
+     */
+    private String productionType;
 }

+ 1 - 1
service/src/main/java/com/dayou/service/IAssetsEvaluationTargetService.java

@@ -24,7 +24,7 @@ public interface IAssetsEvaluationTargetService extends IService<AssetsEvaluatio
          * @param id 资产业务id
          * @return List<AssetsEvaluationTarget>
          */
-        List<AssetsEvaluationTargetVO> getAETargetListByAssetsId(Long id);
+        List<AssetsEvaluationTargetVO> getAETargetListByAssetsId(Long id, String productionNo);
 
         Page<AssetsEvaluationTarget> selectPage(Page page,AssetsEvaluationTarget assetsEvaluationTarget);
 

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

@@ -33,8 +33,8 @@ public class AssetsEvaluationTargetServiceImpl extends ServiceImpl<AssetsEvaluat
      * @return List<AssetsEvaluationTargetVO>
      */
     @Override
-    public List<AssetsEvaluationTargetVO> getAETargetListByAssetsId(Long id) {
-        return assetsEvaluationTargetMapper.getAETargetListByAssetsId(id);
+    public List<AssetsEvaluationTargetVO> getAETargetListByAssetsId(Long id, String productionNo) {
+        return assetsEvaluationTargetMapper.getAETargetListByAssetsId(id,productionNo);
     }
 
     @Override

+ 78 - 63
service/src/main/java/com/dayou/service/impl/AssetsServiceImpl.java

@@ -161,11 +161,11 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
         //产品添加产品号
         assetsProductionMapper.updateProductionNo(dto.getBusinessId(), dto.getProductionType(), productionNo);
         //如果还有未取号评估对象,再添加一份同类型产品
-        if (!dto.getHasNotTakeNumTarget()){
+        if (dto.getHasNotTakeNumTargetSelect()) {
             assetsProductionMapper.copyProductionInfo(dto.getBusinessId(), dto.getProductionType(), dto.getPrintCount());
         }
         //评估对象添加产品号
-        for (Long id : dto.getTargetIdList()){
+        for (Long id : dto.getTargetIdList()) {
             assetsEvaluationTargetMapper.updateTargetProductionNo(id, productionNo);
         }
         return null;
@@ -173,6 +173,7 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
 
     /**
      * 生成资产产品号
+     *
      * @param takeAssetsProductionNoDTO 取号dto
      * @return String
      */
@@ -185,89 +186,103 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
         //获取资产产品取号信息
         BusinessNumber businessNumber = assetsMapper.getBusinessNum(takeAssetsProductionNoDTO.getProductionType() + "_NUMBER", ASSET_BUSINESS.getCode(), nowYear);
 
-        //判断是否有取号信息
-        if (ObjectUtil.isNotNull(businessNumber)) { //取号信息不为空组合产品号
-            //判断两个进位是否都>9,具有两位数
-            if (businessNumber.getMonth() > 9 && businessNumber.getNextNo() > 9) {
-                productionNo = productionNo + businessNumber.getMonth() + businessNumber.getNextNo();
-            } else {
-                //第一进位小于10,前面多加一个0组成两位
-                if (businessNumber.getMonth() < 10) {
-                    productionNo = productionNo + "0" + businessNumber.getMonth() + businessNumber.getNextNo();
+        //获取当前资产业务评估对象已经生成的产品号集合
+        List<String> productionNoList = assetsEvaluationTargetMapper.getProductionNoList(takeAssetsProductionNoDTO.getBusinessId());
+        //判断该资产业务订单是否有取过号
+        if (ObjectUtil.isNull(productionNoList) || productionNoList.isEmpty()) {
+            //判断是否有取号信息
+            if (ObjectUtil.isNotNull(businessNumber)) { //取号信息不为空组合产品号
+                //判断两个进位是否都>9,具有两位数
+                if (businessNumber.getMonth() > 9 && businessNumber.getNextNo() > 9) {
+                    productionNo = productionNo + businessNumber.getMonth() + businessNumber.getNextNo();
+                } else {
+                    //第一进位小于10,前面多加一个0组成两位
+                    if (businessNumber.getMonth() < 10) {
+                        productionNo = productionNo + "0" + businessNumber.getMonth();
+                    } else {
+                        productionNo = productionNo + businessNumber.getMonth();
+                    }
+                    //第二进位小于10,前面多加一个0组成两位
+                    if (businessNumber.getNextNo() < 10) {
+                        productionNo = productionNo + "0" + businessNumber.getNextNo();
+                    } else {
+                        productionNo = productionNo + businessNumber.getNextNo();
+                    }
                 }
-                //第二进位小于10,前面多加一个0组成两位
-                if (businessNumber.getNextNo() < 10) {
-                    productionNo = productionNo + businessNumber.getMonth() + "0" + businessNumber.getNextNo();
+                //设置下一个产品号取号信息
+                if (businessNumber.getNextNo() < 99) {
+                    businessNumber.setNextNo(businessNumber.getNextNo() + 1);
+                } else {
+                    businessNumber.setMonth(businessNumber.getMonth() + 1);
+                    businessNumber.setNextNo(1);
                 }
-            }
-            //设置下一个产品号取号信息
-            if (businessNumber.getNextNo() < 99) {
-                businessNumber.setNextNo(businessNumber.getNextNo() + 1);
-            } else {
-                businessNumber.setMonth(businessNumber.getMonth() + 1);
-                businessNumber.setNextNo(1);
-            }
-            //更新取号信息
-            assetsMapper.updateBusinessNum(businessNumber);
-        } else { //为空插入取号规则信息,并重新获取
-            businessNumber = addBusinessNumber(takeAssetsProductionNoDTO.getProductionType() + "_NUMBER", ASSET_BUSINESS.getCode(), nowYear);
-            //判断两个进位是否都>9,具有两位数
-            if (businessNumber.getMonth() > 9 && businessNumber.getNextNo() > 9) {
-                productionNo = productionNo + businessNumber.getMonth() + businessNumber.getNextNo();
-            } else {
-                //第一进位小于10,前面多加一个0组成两位
-                if (businessNumber.getMonth() < 10) {
-                    productionNo = productionNo + "0" + businessNumber.getMonth() + businessNumber.getNextNo();
+                //更新取号信息
+                assetsMapper.updateBusinessNum(businessNumber);
+            } else { //为空插入取号规则信息,并重新获取
+                businessNumber = addBusinessNumber(takeAssetsProductionNoDTO.getProductionType() + "_NUMBER", ASSET_BUSINESS.getCode(), nowYear);
+                //判断两个进位是否都>9,具有两位数
+                if (businessNumber.getMonth() > 9 && businessNumber.getNextNo() > 9) {
+                    productionNo = productionNo + businessNumber.getMonth() + businessNumber.getNextNo();
+                } else {
+                    //第一进位小于10,前面多加一个0组成两位
+                    if (businessNumber.getMonth() < 10) {
+                        productionNo = productionNo + "0" + businessNumber.getMonth();
+                    } else {
+                        productionNo = productionNo + businessNumber.getMonth();
+                    }
+                    //第二进位小于10,前面多加一个0组成两位
+                    if (businessNumber.getNextNo() < 10) {
+                        productionNo = productionNo + "0" + businessNumber.getNextNo();
+                    } else {
+                        productionNo = productionNo + businessNumber.getNextNo();
+                    }
                 }
-                //第二进位小于10,前面多加一个0组成两位
-                if (businessNumber.getNextNo() < 10) {
-                    productionNo = productionNo + businessNumber.getMonth() + "0" + businessNumber.getNextNo();
+                //设置下一个产品号取号信息
+                if (businessNumber.getNextNo() < 99) {
+                    businessNumber.setNextNo(businessNumber.getNextNo() + 1);
+                } else {
+                    businessNumber.setMonth(businessNumber.getMonth() + 1);
+                    businessNumber.setNextNo(1);
                 }
+                //更新取号信息
+                assetsMapper.updateBusinessNum(businessNumber);
             }
-            //设置下一个产品号取号信息
-            if (businessNumber.getNextNo() < 99) {
-                businessNumber.setNextNo(businessNumber.getNextNo() + 1);
-            } else {
-                businessNumber.setMonth(businessNumber.getMonth() + 1);
-                businessNumber.setNextNo(1);
+
+            //判断取号产品类型
+
+            if (takeAssetsProductionNoDTO.getProductionType().equals(STATEMENT.getCode())) { //取号产品为意见书
+                productionNo = "川友预报字" + productionNo;
+            } else if (takeAssetsProductionNoDTO.getProductionType().equals(REPORT.getCode())) { //取号产品为评估报告
+                productionNo = "川友评报字" + productionNo;
+            } else if (takeAssetsProductionNoDTO.getProductionType().equals(CONSULT.getCode())) { //取号产品为咨询报告
+                productionNo = "川友咨报字" + productionNo;
+            } else if (takeAssetsProductionNoDTO.getProductionType().equals(LETTER.getCode())) { //取号产品为意见函
+                productionNo = "川友字" + productionNo;
+            } else { //都不是返回null
+                return null;
             }
-            //更新取号信息
-            assetsMapper.updateBusinessNum(businessNumber);
+        } else { //已经在该子号之前生成过子号则直接将上一个产品的主体拿过来赋值
+            int dashIndex = productionNoList.get(0).indexOf('-');
+            productionNo = productionNoList.get(0).substring(0, dashIndex);
         }
 
-        //判断取号产品类型
-        if (takeAssetsProductionNoDTO.getProductionType().equals(STATEMENT.getCode())) { //取号产品为意见书
-            productionNo = "川友预报字" + productionNo;
-        } else if (takeAssetsProductionNoDTO.getProductionType().equals(REPORT.getCode())) { //取号产品为评估报告
-            productionNo = "川友评报字" + productionNo;
-        } else if (takeAssetsProductionNoDTO.getProductionType().equals(CONSULT.getCode())) { //取号产品为咨询报告
-            productionNo = "川友咨报字" + productionNo;
-        } else if (takeAssetsProductionNoDTO.getProductionType().equals(LETTER.getCode())) { //取号产品为意见函
-            productionNo = "川友字" + productionNo;
-        } else { //都不是返回null
-            return null;
-        }
 
         // 判断有无子号
         if (takeAssetsProductionNoDTO.getSelectAll()) { //true 则选择了全部评估对象,仅主号无子号
             return productionNo + "号";
         } else { //false 选择了部分评估对象,有子号
-            return getProductionSecNum(productionNo, takeAssetsProductionNoDTO.getBusinessId(), takeAssetsProductionNoDTO.getProductionType());
+            return getProductionSecNum(productionNo, productionNoList);
         }
     }
 
     /**
      * 获取资产产品子号
      *
-     * @param businessId     业务id
-     * @param productionType 业务类型
      * @return String
      */
-    public String getProductionSecNum(String productionNo, Long businessId, String productionType) {
-        // 根据资产业务id与产品类型获取产品号集合
-        List<String> productionNoList = assetsProductionMapper.getgetProductionNo(businessId, productionType);
+    public String getProductionSecNum(String productionNo, List<String> productionNoList) {
         // 判断同一资产业务的同一类型产品是否有生成过子号
-        if (ObjectUtil.isNotNull(productionNoList)) { //为null还没有生成过子号,生成第一个
+        if (ObjectUtil.isNull(productionNoList) || productionNoList.isEmpty()) { //为null还没有生成过子号,生成第一个
             return productionNo + "-1号";
         } else { //不为null则说明已经生成过子号,找到目前最大的子号并生成下一个子号
             // 初始化最大子号为Integer.MIN_VALUE