Browse Source

1.资产业务-资产列表可根据报告名称模糊查询、部门待办查询效率优化、修复资产列表会有看不见未分单流程的情况
2.资产业务收款预警与罚款记录新增时排除已通过产品申请的产品
3.大中型业务下单时保存下单人员的部门id
4.资产撰写产品时更改了委托人信息后同步到订单信息中
5.大中型-我的订单页面委托人显示不一致的问题修复
6.资产-评估人员绩效申报点击报错修复

GouGengquan 3 months ago
parent
commit
760774d1ef

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

@@ -138,13 +138,6 @@ public interface AssetsMapper extends CustomBaseMapper<Assets> {
     AssetsBusinessMember getAssetsBusinessMember(@Param("userId") Long userId);
 
     /**
-     * 通过客户经理id获取下单部门
-     * @param managerId 客户经理id
-     * @return Long 下单部门id
-     */
-    Long getManagerDepId(@Param("managerId") Long managerId);
-
-    /**
      * 获取资产下单部门
      * @return List<Department> 下单部门id
      */

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

@@ -42,4 +42,11 @@ public interface DepartmentMapper extends CustomBaseMapper<Department> {
      * @return List<Long>
      */
     List<Long> getDepIdList(@Param("depId") Long depId);
+
+    /**
+     * 通过客户经理id获取下单部门
+     * @param managerId 客户经理id
+     * @return Long 下单部门id
+     */
+    Long getManagerDepId(@Param("managerId") Long managerId);
 }

+ 9 - 22
dao/src/main/resources/mapper/AssetsMapper.xml

@@ -49,7 +49,6 @@
     <!--条件查询资产任务列表-->
     <select id="selectPage" resultType="com.dayou.vo.AssetsVO">
         SELECT DISTINCT
-#             (@i :=  @i + 1) AS id,
         nodeInfo.recordId AS id,
         assets.id AS assetsId,
         assets.name,
@@ -115,8 +114,7 @@
             user,
             post,
             department,
-            user_post ,
-            work_task_record AS record
+            user_post
             WHERE
             user.id = user_post.user_id
             AND user_post.post_id = post.id
@@ -151,34 +149,35 @@
                 #{item}
             </foreach>
             )
-            AND (department.userId = assets.principal_id OR department.userId = assets.client_manager_id)
+            AND (department.userId = assets.principal_id OR department.userId = assets.client_manager_id OR department.userId = nodeInfo.handlerId)
         </if>
         WHERE assets.deleted = 0
         AND nodeInfo.state = 'PENDING'
-        #评估业务类别(业务类型)查询
         <if test="assetsSelectDTO != null and assetsSelectDTO.assetsBusinessGener != null and assetsSelectDTO.assetsBusinessGener != '' ">
+            # 评估业务类别(业务类型)查询
             AND assets.assets_business_gener = #{assetsSelectDTO.assetsBusinessGener}
         </if>
-        #项目负责人查询
         <if test="assetsSelectDTO != null and assetsSelectDTO.principalId != null">
+            # 项目负责人查询
             AND assets.principal_id = #{assetsSelectDTO.principalId}
         </if>
-        #客户经理查询
         <if test="assetsSelectDTO != null and assetsSelectDTO.clientManagerId != null">
+            #客户经理查询
             AND assets.client_manager_id = #{assetsSelectDTO.clientManagerId}
         </if>
-        #关键字模糊查询
         <if test="assetsSelectDTO != null and assetsSelectDTO.keyWord != null and assetsSelectDTO.keyWord != '' ">
+            # 关键字模糊查询
             AND (
             assets.order_id LIKE CONCAT('%',#{assetsSelectDTO.keyWord},'%') OR
             assets.name LIKE CONCAT('%',#{assetsSelectDTO.keyWord},'%') OR
             nodeInfo.business_sub_id LIKE CONCAT('%',#{assetsSelectDTO.keyWord},'%') OR
             nodeInfo.business_min_id LIKE CONCAT('%',#{assetsSelectDTO.keyWord},'%') OR
-            customer.name LIKE CONCAT('%',#{assetsSelectDTO.keyWord},'%')
+            customer.name LIKE CONCAT('%',#{assetsSelectDTO.keyWord},'%') OR
+            (SELECT assets_name FROM assets_production WHERE assets_production.production_no = nodeInfo.business_min_id AND business_id = nodeInfo.businessId) LIKE CONCAT('%',#{assetsSelectDTO.keyWord},'%')
             )
         </if>
-        # 根据处理节点查询(节点code)
         <if test="assetsSelectDTO != null and assetsSelectDTO.nodeCode != null and assetsSelectDTO.nodeCode != '' ">
+            # 根据处理节点查询(节点code)
             AND nodeInfo.currentNodeCode = #{assetsSelectDTO.nodeCode}
         </if>
         <if test="assetsSelectDTO != null and assetsSelectDTO.handlerId != null ">
@@ -765,18 +764,6 @@
         AND id = #{userId}
     </select>
 
-    <!--通过客户经理id获取下单部门-->
-    <select id="getManagerDepId" resultType="java.lang.Long">
-        SELECT post.department_id
-        FROM user,user_post,post
-        WHERE user.id = user_post.user_id
-        AND user_post.post_id = post.id
-        AND user_post.deleted = 0
-        AND post.deleted = 0
-        AND user.id = #{managerId}
-        LIMIT 1
-    </select>
-
     <!--获取资产下单部门-->
     <select id="getMarkeDepartment" resultType="com.dayou.entity.Department">
         SELECT department.id,department.name

+ 13 - 0
dao/src/main/resources/mapper/DepartmentMapper.xml

@@ -83,4 +83,17 @@
                     ( FIND_IN_SET( parent_id, @id ) > 0 OR FIND_IN_SET( id, @id ) > 0 )
                         AND @id := CONCAT( @id, ',', id )) AS depId ON depId.id = department.id
     </select>
+
+
+    <!--通过客户经理id获取下单部门-->
+    <select id="getManagerDepId" resultType="java.lang.Long">
+        SELECT post.department_id
+        FROM user,user_post,post
+        WHERE user.id = user_post.user_id
+          AND user_post.post_id = post.id
+          AND user_post.deleted = 0
+          AND post.deleted = 0
+          AND user.id = #{managerId}
+        LIMIT 1
+    </select>
 </mapper>

+ 3 - 0
dao/src/main/resources/mapper/FinanceFineMapper.xml

@@ -167,10 +167,13 @@
                 LEFT JOIN ( SELECT id, business_id, should_amount FROM order_fund WHERE business_type = 'ASSET_BUSINESS' AND deleted = 0 ) AS `of` ON `of`.business_id = ap.business_id
                 LEFT JOIN assets AS a ON a.id = ap.business_id
                 LEFT JOIN finance_fine AS ff ON ff.deleted = 0 AND `of`.id = ff.order_fund_id AND pf.id = ff.production_fund_id
+                LEFT JOIN production_return AS `return` ON `return`.deleted = 0 AND `return`.status = 'APPROVE' AND `return`.business_id = ap.business_id AND `return`.production_id = ap.id AND `return`.production_no = ap.production_no
         WHERE ( pf.production_no IS NULL OR pf.real_amount IS NULL )
           AND ap.repertory_out_time > '2024-01-01 00:00:00'
           AND DATEDIFF(CURDATE(), DATE( ap.repertory_out_time )) >= 90
           AND ff.id IS NULL
+          # 退产品后不添加到罚款表中,所以审核通过的退产品记录必须为null
+          AND `return`.id IS NULL
     </select>
 
     <!--获取逾期个贷产品款项信息-->

+ 5 - 2
dao/src/main/resources/mapper/FinanceRealFundMapper.xml

@@ -1709,17 +1709,20 @@
         AND repertory_out_time IS NOT NULL
         AND production_type != 'STATEMENT'
         ) ap
-        LEFT JOIN ( SELECT business_id, production_no, production_should_amount, real_amount, standard_amount FROM production_fund WHERE business_type = 'ASSET_BUSINESS' AND deleted = 0 ) pf
+        LEFT JOIN ( SELECT id, business_id, production_no, production_should_amount, real_amount, standard_amount FROM production_fund WHERE business_type = 'ASSET_BUSINESS' AND deleted = 0 ) pf
         ON ( ap.business_id = pf.business_id AND ap.production_no = pf.production_no )
-        LEFT JOIN ( SELECT business_id,should_amount FROM order_fund WHERE business_type = 'ASSET_BUSINESS' AND deleted = 0 ) `of` ON `of`.business_id = ap.business_id
+        LEFT JOIN ( SELECT id, business_id,should_amount FROM order_fund WHERE business_type = 'ASSET_BUSINESS' AND deleted = 0 ) `of` ON `of`.business_id = ap.business_id
         LEFT JOIN assets a ON a.id = ap.business_id
         LEFT JOIN user u ON u.id = a.client_manager_id
         LEFT JOIN user u1 ON u1.id = a.principal_id
         LEFT JOIN customer_company cc1 ON cc1.id = a.clientele_id
         LEFT JOIN customer_company cc2 ON cc2.id = a.clientele_sub_id
+        LEFT JOIN production_return AS `return` ON `return`.deleted = 0 AND `return`.status = 'APPROVE' AND `return`.business_id = ap.business_id AND `return`.production_id = ap.id AND `return`.production_no = ap.production_no
         WHERE
         ap.productionType != 'STATEMENT'
         AND ( pf.production_no IS NULL OR pf.real_amount IS NULL )
+        # 退产品后超期也不预警,所以审核通过的退产品记录必须为null
+        AND `return`.id IS NULL
         and ap.repertory_out_time>'2024-01-01 00:00:00'
             <if test="overdueVO!=null and overdueVO.overdueMin!=null">
                 AND DATEDIFF(CURDATE(),DATE( ap.repertory_out_time )) &gt;= #{overdueVO.overdueMin}

+ 2 - 2
dao/src/main/resources/mapper/MajorProductionMapper.xml

@@ -362,7 +362,7 @@
             cc.name as clienteleName,
             cc1.name as clienteleSubName,
             cl.name as clienteleContactName,
-            m.bailor,
+            IF(mp.client_name IS NULL, m.bailor, mp.client_name) AS bailor,
             m.owner,
             m.created,
             orf.id as orderFundId,
@@ -379,7 +379,7 @@
             ( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id IS NOT NULL AND business_type = 'COMMISSION_DECLARE_MAJOR_EVALUATE' AND deleted = 0 order by created desc limit 1) as eDeclareResult
         FROM
             major m
-                left join (select id,name,major_id,report_no,evaluate_amount,production,if_save_file,delivery,repertory_state from major_production where deleted = 0 ) mp on mp.major_id = m.id
+                left join (select id,name,major_id,report_no,evaluate_amount,production,if_save_file,delivery,repertory_state, client_name from major_production where deleted = 0 ) mp on mp.major_id = m.id
                 left join user u on u.id = m.principal_id
                 left join user u1 on u1.id = m.client_manager_id
                 left join customer_company cc on cc.id = m.clientele_id

+ 2 - 1
dao/src/main/resources/mapper/MajorStatisticalStatementMapper.xml

@@ -1265,7 +1265,6 @@
         customer.name AS customerName,
         (SELECT customer_company.name FROM customer_company WHERE customer_company.id = clientele_sub_id) AS customerSubName,
         (SELECT name FROM customer_linkman WHERE id = major.clientele_contact_id) AS linkmanName,
-        major.bailor,
         major.owner,
         (SELECT name FROM user WHERE id = major.principal_id) AS principalName,
         members,
@@ -1273,12 +1272,14 @@
         evaluate_aim,
         <if test="dto != null and dto.efficiencyType == 'statement'">
             statement.production_time AS writeStatementDate,
+            IF(statement.client_name IS NULL, major.bailor, statement.client_name) AS bailor,
         </if>
         <if test="dto != null and dto.efficiencyType != 'statement'">
             (SELECT SUM(check_value) FROM major_target WHERE report_no = report.report_no AND deleted = 0) AS checkValueSum,
             (SELECT SUM(build_acreage) FROM major_target WHERE report_no = report.report_no AND deleted = 0) AS buildAcreageSum,
             report.report_no AS reportNo,
             report.production_time AS writeReportDate,
+            IF(report.client_name IS NULL, major.bailor, report.client_name) AS bailor,
         </if>
         order_fund.should_amount AS shouldAmount,
         order_fund.real_amount AS realAmount

+ 8 - 0
service/src/main/java/com/dayou/service/IDepartmentService.java

@@ -49,4 +49,12 @@ public interface IDepartmentService extends IService<Department> {
      */
     List<Department> getAllotDepartmentByBusiness(String businessCode);
 
+
+    /**
+     * 通过客户经理id获取下单部门
+     * @param managerId 客户经理id
+     * @return Long 下单部门id
+     */
+    Long getManagerDepId(Long managerId);
+
 }

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

@@ -202,6 +202,13 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
         if (count > 0) {
             return null;
         }
+        // 产品如果填了新的委托人信息就将订单的委托人信息一起更新
+        if (ObjectUtil.isNotNull(assetsProduction.getClientName())) {
+            Assets assets = new Assets();
+            assets.setId(assetsProduction.getBusinessId());
+            assets.setBailor(assetsProduction.getClientName());
+            assetsService.updateById(assets);
+        }
         // 生成产品二维码
         assetsProduction.setQrCode(businessProductionService.doCreateNormalCode(assetsProduction.getProductionType(), assetsProduction.getProductionNo()));
         // 新增产品收款信息

+ 16 - 10
service/src/main/java/com/dayou/service/impl/AssetsServiceImpl.java

@@ -92,6 +92,9 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
     @Autowired
     private DepartmentMapper departmentMapper;
 
+    @Autowired
+    private IDepartmentService departmentService;
+
     /**
      * 条件查询资产任务列表
      *
@@ -232,7 +235,7 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
         //获取项目编号
         assets.setOrderId(businessNumberService.takeAssetsOrderNumber());
         //获取下单部门id
-        assets.setMarketDepartmentId(assetsMapper.getManagerDepId(assets.getClientManagerId()));
+        assets.setMarketDepartmentId(departmentService.getManagerDepId(assets.getClientManagerId()));
         // 判断分单类型
         if (BY_TURNS.equals(assets.getAllotType())) {
             //获取轮单部门
@@ -608,18 +611,21 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
             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);
+            // 判断签字师是否为空(部分报告类型无需签字人)
+            if (ObjectUtil.isNotNull(signatorys)) {
+                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);
+                }
             }
         }
 

+ 10 - 0
service/src/main/java/com/dayou/service/impl/DepartmentServiceImpl.java

@@ -166,4 +166,14 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
         return departmentMapper.getAllotDepartmentByBusiness(businessCode);
     }
 
+    /**
+     * 通过客户经理id获取下单部门
+     * @param managerId 客户经理id
+     * @return Long 下单部门id
+     */
+    @Override
+    public Long getManagerDepId(Long managerId) {
+        return departmentMapper.getManagerDepId(managerId);
+    }
+
 }

+ 4 - 0
service/src/main/java/com/dayou/service/impl/MajorServiceImpl.java

@@ -71,6 +71,9 @@ public class MajorServiceImpl extends ServiceImpl<MajorMapper, Major> implements
     @Autowired
     private IOrderFundService orderFundService;
 
+    @Autowired
+    private IDepartmentService departmentService;
+
     @Override
     @SuppressWarnings("unchecked")
     public Page<MajorVO> selectPage(Page page, MajorVO major,String keyword){
@@ -111,6 +114,7 @@ public class MajorServiceImpl extends ServiceImpl<MajorMapper, Major> implements
             major.setDepartmentId(allotDepartmentId);
         }
         major.setOrderId(businessNumberService.takeOrderNumber());
+        major.setMarketDepartmentId(departmentService.getManagerDepId(major.getClientManagerId()));
         //保存业务数据
         this.save(major);
         //业务下单

+ 2 - 0
service/src/main/java/com/dayou/workflow/config/WorkNodeProcessable.java

@@ -169,6 +169,7 @@ public class WorkNodeProcessable {
         return Boolean.TRUE;
     }
 
+    @Transactional(rollbackFor = Exception.class)
     public void afterForward(WorkFlowNodeInstance currentInstanceNode) {
         //终止前节点控制前置处理。
         MainBusinessEnum mainBusinessEnum = MainBusinessEnum.valueOf(currentInstanceNode.getBusinessType());
@@ -196,6 +197,7 @@ public class WorkNodeProcessable {
                         .eq(ProductionFund::getBusinessType, productionReturn.getBusinessType())
                         .eq(ProductionFund::getBusinessId, productionReturn.getBusinessId())
                         .eq(ProductionFund::getProductionNo, productionReturn.getProductionNo())
+                        .eq(ProductionFund::getProductionType, productionReturn.getProductionType())
                         .eq(ProductionFund::getOrderFundId, orderFund.getId()));
                 // 新增罚款后退款记录
                 FinanceFine financeFine = financeFineService.getFineByFundInfo(orderFund.getId(), productionFund.getId() != null ? productionFund.getId() : null);