Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	sql/update_sql.sql
wucl 1 gadu atpakaļ
vecāks
revīzija
094b43b3be

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

@@ -218,11 +218,21 @@ public class AssetsProductionController extends BaseController {
     /**
      * 查找实收款认领产品列表
      * @param apFundSelectDTO 查询dto
-     * @return List<AssetsProductionFundVo>
+     * @return RestResponse<Page<AssetsProductionFundVo>>
      */
     @GetMapping("/getAssetsProductionFundVoList")
     public RestResponse<Page<AssetsProductionFundVo>> getAssetsProductionFundVoList(Page page, APFundSelectDTO apFundSelectDTO) {
         return RestResponse.data(assetsProductionService.getAssetsProductionFundVoList(page, apFundSelectDTO));
     }
+
+    /**
+     * 查找实收款认领产品列表
+     * @param apFundSelectDTO 查询dto
+     * @return RestResponse<Page<AssetsProductionFundVo>>
+     */
+    @GetMapping("/getAssetsOrderFundVoList")
+    public RestResponse<Page<AssetsProductionFundVo>> getAssetsOrderFundVoList(Page page, APFundSelectDTO apFundSelectDTO) {
+        return RestResponse.data(assetsProductionService.getAssetsOrderFundVoList(page, apFundSelectDTO));
+    }
 }
 

+ 2 - 2
biz-base/src/main/java/com/dayou/controller/CommissionDeclareController.java

@@ -100,7 +100,7 @@ public class CommissionDeclareController extends BaseController {
     }
 
     /**
-     * 资产业务新增绩效分配申报
+     * 获取资产评估人员提成申报列表
      */
     @GetMapping("/assets/evaluate")
     public RestResponse<Page<CommissionDeclareVO>> assetsEvaluateDeclarePage(CommissionDeclareVO commissionDeclare, Page page){
@@ -117,7 +117,7 @@ public class CommissionDeclareController extends BaseController {
     }
 
     /**
-     * 资产业务新增评估人员绩效分配申报
+     * 资产业务新增绩效分配申报
      * @param declareDTO dto
      * @return RestResponse<Boolean>
      */

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

@@ -111,5 +111,12 @@ public interface AssetsProductionMapper extends CustomBaseMapper<AssetsProductio
      * @param apFundSelectDTO 查询dto
      * @return List<AssetsProductionFundVo>
      */
-    Page<AssetsProductionFundVo> getAssetsProductionFundVoList(@Param("page") Page page , @Param("apFundSelectDTO") APFundSelectDTO apFundSelectDTO);
+    Page<AssetsProductionFundVo> getAssetsProductionFundVoList(@Param("page") Page page , @Param("apFundSelectDTO") APFundSelectDTO apFundSelectDTO, @Param("managerId") Long managerId);
+
+    /**
+     * 查找实收款认领订单列表
+     * @param apFundSelectDTO 查询dto
+     * @return List<AssetsProductionFundVo>
+     */
+    Page<AssetsProductionFundVo> getAssetsOrderFundVoList(@Param("page") Page page , @Param("apFundSelectDTO") APFundSelectDTO apFundSelectDTO, @Param("managerId") Long managerId);
 }

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

@@ -54,13 +54,11 @@
         value_type.type_name AS valueTypeName,
         target.statement_no,
         target.report_no,
-#         production.create_production_date,
         (SELECT create_production_date FROM assets_production WHERE production_no = target.statement_no) AS statementCreateProductionDate,
         (SELECT create_production_date FROM assets_production WHERE production_no = target.report_no) AS reportCreateProductionDate
         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
-#         LEFT JOIN assets_production AS production ON production.production_no = target.statement_no OR production.production_no = target.report_no
         WHERE target.assets_id = #{id}
         <if test="(statementNo != null and statementNo != '') or (reportNo != null and reportNo != '') ">
             AND statement_no = #{statementNo}
@@ -68,9 +66,6 @@
         <if test="reportNo != null and reportNo != '' ">
             AND report_no = #{reportNo}
         </if>
-        <!--        <if test="(statementNo == null or statementNo == '') and (reportNo == null or reportNo == '') ">-->
-        <!--            AND create_production_date IS NULL-->
-        <!--        </if>-->
         AND target.deleted = 0
     </select>
 

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

@@ -133,11 +133,11 @@
         <if test="statementNo != null and statementNo != ''">
             AND production_no = #{statementNo}
         </if>
-        <if test="(statementNo != null or statementNo != '') and (reportNos != null and reportNos.size() > 0) ">
+        <if test="(statementNo != null and statementNo != '') and (reportNos != null and reportNos.size() > 0) ">
             OR
         </if>
         <if test="(statementNo == null or statementNo == '') and (reportNos != null and reportNos.size() > 0) ">
-            AND
+            OR
         </if>
         <if test="reportNos != null and reportNos.size() > 0">
             production_no IN
@@ -238,6 +238,7 @@
         AND deleted = 0
         ) AS mDeclare ON mDeclare.business_id = assets.id AND mDeclare.production_id = production.id
         WHERE production.production_type != 'STATEMENT'
+        AND assets.client_manager_id = #{managerId}
         AND production.create_production_date IS NOT NULL
         <if test="apFundSelectDTO.oderName != null and apFundSelectDTO.oderName != ''">
             AND assets.name LIKE CONCAT('%',#{apFundSelectDTO.oderName},'%')
@@ -254,6 +255,55 @@
         <if test="apFundSelectDTO.mDeclareResult != null and apFundSelectDTO.mDeclareResult != ''">
             AND mDeclare.declare_result = #{apFundSelectDTO.mDeclareResult}
         </if>
+        ORDER BY assets.created DESC
+    </select>
+
+    <!--查找实收款认领订单列表-->
+    <select id="getAssetsOrderFundVoList" resultType="com.dayou.vo.AssetsProductionFundVo">
+        SELECT (@i :=  @i + 1) AS id,
+        assets.id AS assetsId,
+        assets.name AS name,
+        assets.order_id AS orderId,
+        customer.name AS clienteleName,
+        oFund.id AS orderFundId,
+        oFund.should_amount AS orderShouldAmount,
+        oFund.real_amount AS orderRealAmount,
+        eDeclare.declare_result AS eDeclareResult,
+        mDeclare.declare_result AS mDeclareResult,
+        (SELECT user.name FROM user WHERE user.id = assets.client_manager_id) AS marketUser,
+        (SELECT user.name FROM user WHERE user.id = assets.principal_id) AS evaluateUser
+        FROM (SELECT @i := 0) AS sort,assets
+        LEFT JOIN order_fund AS oFund ON oFund.business_id = assets.id AND oFund.order_id = assets.order_id
+        LEFT JOIN customer_company AS customer ON customer.id = assets.clientele_id
+        LEFT JOIN (
+        SELECT business_id,declare_result
+        FROM commission_declare AS `declare`
+        WHERE `declare`.business_type = 'COMMISSION_DECLARE_ASSET_EVALUATE'
+        AND deleted = 0
+        ) AS eDeclare ON eDeclare.business_id = assets.id
+        LEFT JOIN (
+        SELECT business_id,declare_result
+        FROM commission_declare AS `declare`
+        WHERE `declare`.business_type = 'COMMISSION_DECLARE_ASSET_MARKET'
+        AND deleted = 0
+        ) AS mDeclare ON mDeclare.business_id = assets.id
+        <where>
+            AND assets.client_manager_id = #{managerId}
+            AND (SELECT COUNT(1) FROM assets_production WHERE assets_production.business_id = assets.id AND assets_production.deleted = 0) = 0
+            <if test="apFundSelectDTO.oderName != null and apFundSelectDTO.oderName != ''">
+                AND assets.name LIKE CONCAT('%',#{apFundSelectDTO.oderName},'%')
+            </if>
+            <if test="apFundSelectDTO.orderId != null and apFundSelectDTO.orderId != ''">
+                AND assets.order_id LIKE CONCAT('%',#{apFundSelectDTO.orderId},'%')
+            </if>
+            <if test="apFundSelectDTO.eDeclareResult != null and apFundSelectDTO.eDeclareResult != ''">
+                AND eDeclare.declare_result = #{apFundSelectDTO.eDeclareResult}
+            </if>
+            <if test="apFundSelectDTO.mDeclareResult != null and apFundSelectDTO.mDeclareResult != ''">
+                AND mDeclare.declare_result = #{apFundSelectDTO.mDeclareResult}
+            </if>
+        </where>
+        ORDER BY assets.created DESC
     </select>
 
 </mapper>

+ 8 - 9
dao/src/main/resources/mapper/CommissionDeclareMapper.xml

@@ -329,13 +329,13 @@
         SELECT
         IFNULL(
         cd.id,
-        ( SELECT id FROM commission_declare WHERE deleted = 0 AND business_id = assets.businessId AND production_id IS NULL )) id,
+        ( SELECT id FROM commission_declare WHERE deleted = 0 AND business_id = assets.businessId AND production_id IS NULL AND declare_user_id =#{evaluateUserId} )) id,
         IFNULL(
         cd.commission_rate_id,
-        ( SELECT commission_rate_id FROM commission_declare WHERE deleted = 0 AND business_id = assets.businessId AND production_id IS NULL )) commission_rate_id,
+        ( SELECT commission_rate_id FROM commission_declare WHERE deleted = 0 AND business_id = assets.businessId AND production_id IS NULL AND declare_user_id =#{evaluateUserId} )) commission_rate_id,
         IFNULL(
         cd.declare_result,
-        ( SELECT declare_result FROM commission_declare WHERE deleted = 0 AND business_id = assets.businessId AND production_id IS NULL )) declare_result,
+        ( SELECT declare_result FROM commission_declare WHERE deleted = 0 AND business_id = assets.businessId AND production_id IS NULL AND declare_user_id =#{evaluateUserId} )) declare_result,
         assets.*
         FROM
         (
@@ -364,8 +364,8 @@
         LEFT JOIN customer_company cc2 ON cc2.id = assets.clientele_sub_id
         WHERE
         assets.deleted = 0
-        AND ap.create_production_date IS NOT NULL
-        AND assets.principal_id = #{evaluateUserId}) assets
+        AND assets.principal_id = #{evaluateUserId}
+        ) assets
         LEFT JOIN (
         SELECT
         id,
@@ -384,7 +384,7 @@
                 and bus.order_id like concat ('%',#{declare.orderId},'%')
             </if>
             <if test="declare!=null and declare.name!=null and declare.name!=''">
-                and (bus.orderName like concat ('%',#{declare.name},'%') or bus.name like concat ('%',#{declare.name},'%') )
+                and (bus.orderName like concat ('%',#{declare.name},'%')
             </if>
             <if test="declare!=null and declare.reportNo!=null and declare.reportNo!=''">
                 and bus.report_no like concat ('%',#{declare.reportNo},'%')
@@ -446,7 +446,7 @@
         ap.created
         FROM
         assets
-        LEFT JOIN ( SELECT id, business_id, production_no, created FROM assets_production WHERE deleted = 0 ) ap ON assets.id = ap.business_id
+        LEFT JOIN ( SELECT id, business_id, production_no, create_production_date, created FROM assets_production WHERE production_type!='STATEMENT' AND deleted = 0 ) ap ON assets.id = ap.business_id
         LEFT JOIN USER u ON u.id = assets.client_manager_id
         LEFT JOIN USER u1 ON u1.id = assets.principal_id
         LEFT JOIN customer_company cc1 ON cc1.id = assets.clientele_id
@@ -454,7 +454,6 @@
         WHERE
         assets.deleted = 0
         AND assets.client_manager_id = #{marketUserId}
-
         ) assets
         LEFT JOIN (
         SELECT
@@ -474,7 +473,7 @@
                 and bus.order_id like concat ('%',#{declare.orderId},'%')
             </if>
             <if test="declare!=null and declare.name!=null and declare.name!=''">
-                and (bus.orderName like concat ('%',#{declare.name},'%') or bus.name like concat ('%',#{declare.name},'%') )
+                and bus.orderName like concat ('%',#{declare.name},'%')
             </if>
             <if test="declare!=null and declare.reportNo!=null and declare.reportNo!=''">
                 and bus.report_no like concat ('%',#{declare.reportNo},'%')

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

@@ -121,4 +121,11 @@ public interface IAssetsProductionService extends IService<AssetsProduction> {
          */
         Page<AssetsProductionFundVo> getAssetsProductionFundVoList(Page page, APFundSelectDTO apFundSelectDTO);
 
+        /**
+         * 查找实收款认领订单列表
+         * @param apFundSelectDTO 查询dto
+         * @return List<AssetsProductionFundVo>
+         */
+        Page<AssetsProductionFundVo> getAssetsOrderFundVoList(Page page, APFundSelectDTO apFundSelectDTO);
+
 }

+ 12 - 1
service/src/main/java/com/dayou/service/impl/AssetsProductionServiceImpl.java

@@ -8,6 +8,7 @@ import com.dayou.exception.ErrorCode;
 import com.dayou.mapper.AssetsProductionMapper;
 import com.dayou.service.*;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dayou.utils.LoginContext;
 import com.dayou.vo.AssetsProductionFundVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -329,7 +330,17 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
      */
     @Override
     public Page<AssetsProductionFundVo> getAssetsProductionFundVoList(Page page, APFundSelectDTO apFundSelectDTO) {
-        return assetsProductionMapper.getAssetsProductionFundVoList(page, apFundSelectDTO);
+        return assetsProductionMapper.getAssetsProductionFundVoList(page, apFundSelectDTO, LoginContext.getCurrentUserId());
+    }
+
+    /**
+     * 查找实收款认领订单列表
+     * @param apFundSelectDTO 查询dto
+     * @return List<AssetsProductionFundVo>
+     */
+    @Override
+    public Page<AssetsProductionFundVo> getAssetsOrderFundVoList(Page page, APFundSelectDTO apFundSelectDTO) {
+        return assetsProductionMapper.getAssetsOrderFundVoList(page, apFundSelectDTO, LoginContext.getCurrentUserId());
     }
 
     /**

+ 13 - 9
service/src/main/java/com/dayou/service/impl/AssetsServiceImpl.java

@@ -501,8 +501,6 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
     public List<AssetsBusinessMember> getAssetsBusinessMembers(AssetsBusinessMembersDTO assetsBusinessMembersDTO) throws JsonProcessingException {
         // 获取项目参与人id
         Assets businessMember = assetsMapper.getBusinessMembers(assetsBusinessMembersDTO);
-        // 获取签字师id
-        String signatorys = assetsMapper.getSignatorys(assetsBusinessMembersDTO);
 
         List<AssetsBusinessMember> assetsBusinessMemberList = new ArrayList<>();
 
@@ -515,7 +513,7 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
 
         ObjectMapper objectMapper = new ObjectMapper();
         List<Long> memberIds = objectMapper.readValue(businessMember.getMembers(), new TypeReference<List<Long>>() {});
-        List<Long> signatoryIds = objectMapper.readValue(signatorys, new TypeReference<List<Long>>() {});
+
 
         // 获取参与人信息
         for (Long userId : memberIds){
@@ -525,12 +523,18 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
             assetsBusinessMemberList.add(assetsBusinessMember);
         }
 
-        // 获取签字师信息
-        for (Long userId : signatoryIds){
-            assetsBusinessMember = assetsMapper.getAssetsBusinessMember(userId);
-            assetsBusinessMember.setBusinessId(assetsBusinessMembersDTO.getBusinessId());
-            assetsBusinessMember.setMemberType("签字师");
-            assetsBusinessMemberList.add(assetsBusinessMember);
+        // 判断报告号是否为空(为空说明没出报告,就没签字师)
+        if (ObjectUtil.isNotNull(assetsBusinessMembersDTO.getReportNo()) && ObjectUtil.isNotEmpty(assetsBusinessMembersDTO.getReportNo())){
+            // 获取签字师id
+            String signatorys = assetsMapper.getSignatorys(assetsBusinessMembersDTO);
+            List<Long> signatoryIds = objectMapper.readValue(signatorys, new TypeReference<List<Long>>() {});
+            // 获取签字师信息
+            for (Long userId : signatoryIds){
+                assetsBusinessMember = assetsMapper.getAssetsBusinessMember(userId);
+                assetsBusinessMember.setBusinessId(assetsBusinessMembersDTO.getBusinessId());
+                assetsBusinessMember.setMemberType("签字师");
+                assetsBusinessMemberList.add(assetsBusinessMember);
+            }
         }
 
         return assetsBusinessMemberList;

+ 8 - 0
sql/update_sql.sql

@@ -476,3 +476,11 @@ CREATE TABLE `order_fund_allot` (
                                     PRIMARY KEY (`id`)
 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='订单收款分配表';
 ALTER TABLE major_production ADD COLUMN delivery_date datetime(0) NULL COMMENT '送达时间';
+
+
+/**
+  日期:2024-05-29
+  修改人:苟耕铨
+ */
+# 表business_performance_distribution修改字段
+ALTER TABLE business_performance_distribution MODIFY COLUMN report_no VARCHAR(128) NULL COMMENT '报告产品号';