Browse Source

1.优化查询资产台账
2.新增功能评估部/评估人员绩效扣分的相关接口

GouGengquan 11 months ago
parent
commit
76e56d87db

+ 71 - 0
biz-base/src/main/java/com/dayou/controller/AssetsStatisticalStatementController.java

@@ -5,6 +5,8 @@ import com.dayou.common.RestResponse;
 import com.dayou.dto.AssetsStatisticalSelectDTO;
 import com.dayou.service.IAssetsStatisticalStatementService;
 import com.dayou.vo.AssetsLedgerVO;
+import com.dayou.vo.AssetsPerformanceDeductionDetailVO;
+import com.dayou.vo.AssetsPerformanceDeductionVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -43,4 +45,73 @@ public class AssetsStatisticalStatementController extends BaseController{
         exportPlus(response,"资产台账列表",result, AssetsLedgerVO.class);
     }
 
+    /**
+     * 评估部绩效扣分查询
+     * @param dto 查询dto
+     * @return List<AssetsPerformanceDeductionVO>
+     */
+    @GetMapping("/department/getAssetsPerformanceDeductionVO")
+    public RestResponse<List<AssetsPerformanceDeductionVO>> getAssetsPerformanceDeductionVO(AssetsStatisticalSelectDTO dto) {
+        return RestResponse.data(assetsStatisticalStatementService.getAssetsPerformanceDeductionVO(dto));
+    }
+
+    /**
+     * 评估部绩效扣分导出
+     * @param dto 查询dto
+     */
+    @GetMapping("/department/getAssetsPerformanceDeductionVO/export")
+    public void assetsPerformanceDeductionVOExport(AssetsStatisticalSelectDTO dto, HttpServletResponse response) throws IOException {
+        List<AssetsPerformanceDeductionVO> result = assetsStatisticalStatementService.assetsPerformanceDeductionVOExport(dto);
+        exportPlus(response, "资产评估部绩效扣分", result, AssetsPerformanceDeductionVO.class);
+    }
+
+    /**
+     * 查询错误详情列表
+     * @param page 分页
+     * @param dto 查询dto
+     * @return Page<AssetsPerformanceDeductionDetailVO>
+     */
+    @GetMapping("/department/getAssetsPerformanceDeductionDetail")
+    public RestResponse<Page<AssetsPerformanceDeductionDetailVO>> getAssetsPerformanceDeductionDetail(Page page, AssetsStatisticalSelectDTO dto) {
+        return RestResponse.data(assetsStatisticalStatementService.getAssetsPerformanceDeductionDetail(page, dto));
+    }
+
+    /**
+     * 错误详情列表导出
+     * @param dto 查询dto
+     */
+    @GetMapping("/department/getAssetsPerformanceDeductionDetail/export")
+    public void assetsPerformanceDeductionDetailExport(AssetsStatisticalSelectDTO dto, HttpServletResponse response) throws IOException {
+        List<AssetsPerformanceDeductionDetailVO> result = assetsStatisticalStatementService.assetsPerformanceDeductionDetailExport(dto);
+        String fileName = "资产评估部绩效扣分详情_" + dto.getCheckLoop();
+        if (dto.getMistakeType().equals("normal")){
+            fileName += "_" + "一般错误";
+        } else if (dto.getMistakeType().equals("hard")) {
+            fileName += "_" + "较大错误";
+        }else {
+            fileName += "_" + "重大错误";
+        }
+        exportPlus(response, fileName, result, AssetsPerformanceDeductionDetailVO.class);
+    }
+
+    /**
+     * 评估人员绩效扣分查询
+     * @param dto 查询dto
+     * @return List<AssetsPerformanceDeductionVO>
+     */
+    @GetMapping("/evaluator/getAssetsPerformanceDeductionVO")
+    public RestResponse<List<AssetsPerformanceDeductionVO>> getAssetsPerformanceDeductionVOByEvaluator(AssetsStatisticalSelectDTO dto) {
+        return RestResponse.data(assetsStatisticalStatementService.getAssetsPerformanceDeductionVOByEvaluator(dto));
+    }
+
+    /**
+     * 评估人员绩效扣分导出
+     * @param dto 查询dto
+     */
+    @GetMapping("/evaluator/getAssetsPerformanceDeductionVO/export")
+    public void assetsPerformanceDeductionVOByEvaluatorExport(AssetsStatisticalSelectDTO dto, HttpServletResponse response) throws IOException {
+        List<AssetsPerformanceDeductionVO> result = assetsStatisticalStatementService.assetsPerformanceDeductionVOByEvaluatorExport(dto);
+        exportPlus(response, "评估人员绩效扣分", result, AssetsPerformanceDeductionVO.class);
+    }
+
 }

+ 5 - 5
biz-base/src/main/resources/application-local.yml

@@ -39,12 +39,12 @@ spring:
 
 
 dfs:
-  path: /Users/wuwei/opt
-  domain: /dfs
+  path: E:\upload
+  domain: E:\upload
   domainName: https://kps.scdayou.com/dfs
-  code: /code
-  domainRoot: https://kps.scdayou.com/admin
-  luceneDir: /Users/wuwei/luceneDir
+  code: \code
+  domainRoot: localhost
+  luceneDir: E:\luceneIndex
 
 advice:
   file:

+ 45 - 0
dao/src/main/java/com/dayou/mapper/AssetsStatisticalStatementMapper.java

@@ -3,6 +3,8 @@ package com.dayou.mapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.dayou.dto.AssetsStatisticalSelectDTO;
 import com.dayou.vo.AssetsLedgerVO;
+import com.dayou.vo.AssetsPerformanceDeductionDetailVO;
+import com.dayou.vo.AssetsPerformanceDeductionVO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -22,4 +24,47 @@ public interface AssetsStatisticalStatementMapper {
      * @return List<AssetsLedgerVO>
      */
     List<AssetsLedgerVO> assetsLedgerVOExport(@Param("dto") AssetsStatisticalSelectDTO dto);
+
+    /**
+     * 评估部绩效扣分查询
+     * @param dto 查询dto
+     * @return List<AssetsPerformanceDeductionVO>
+     */
+    List<AssetsPerformanceDeductionVO> getAssetsPerformanceDeductionVO(@Param("dto") AssetsStatisticalSelectDTO dto);
+
+    /**
+     * 评估部绩效扣分导出
+     * @param dto 查询dto
+     * @return Page<AssetsPerformanceDeductionVO>
+     */
+    List<AssetsPerformanceDeductionVO> assetsPerformanceDeductionVOExport(@Param("dto") AssetsStatisticalSelectDTO dto);
+
+    /**
+     * 查询错误详情列表
+     * @param page 分页
+     * @param dto 查询dto
+     * @return Page<AssetsPerformanceDeductionDetailVO>
+     */
+    Page<AssetsPerformanceDeductionDetailVO> getAssetsPerformanceDeductionDetail(@Param("page") Page page, @Param("dto") AssetsStatisticalSelectDTO dto);
+
+    /**
+     * 错误详情列表导出
+     * @param dto 查询dto
+     * @return Page<AssetsPerformanceDeductionDetailVO>
+     */
+    List<AssetsPerformanceDeductionDetailVO> assetsPerformanceDeductionDetailExport(@Param("dto") AssetsStatisticalSelectDTO dto);
+
+    /**
+     * 评估人员绩效扣分查询
+     * @param dto 查询dto
+     * @return List<AssetsPerformanceDeductionVO>
+     */
+    List<AssetsPerformanceDeductionVO> getAssetsPerformanceDeductionVOByEvaluator(@Param("dto") AssetsStatisticalSelectDTO dto);
+
+    /**
+     * 评估人员绩效扣分导出
+     * @param dto 查询dto
+     * @return List<AssetsPerformanceDeductionVO>
+     */
+    List<AssetsPerformanceDeductionVO> assetsPerformanceDeductionVOByEvaluatorExport(@Param("dto") AssetsStatisticalSelectDTO dto);
 }

+ 244 - 24
dao/src/main/resources/mapper/AssetsStatisticalStatementMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.dayou.mapper.AssetsStatisticalStatementMapper">
 
-    <!--资产太差查询SQL-->
+    <!--资产台账查询SQL-->
     <sql id="assetsLedgerQuery">
         SELECT (@i :=  @i + 1) AS id,
                assets.id                                                             AS assetsId,
@@ -13,20 +13,7 @@
                report.valuation_basis_date                                           AS valuationBasisDate,
                report.create_production_date                                         AS createReportDate,
                COALESCE(report.assets_name, statement.assets_name, assets.name)      AS projectName,
-               IFNULL((SELECT node.`name`
-                       FROM work_flow_node_instance AS instance,
-                            work_node AS node
-                       WHERE instance.node_id = node.id
-                         AND node.deleted = 0
-                         AND instance.deleted = 0
-                         AND instance.business_id = assets.id
-                         AND (IF(statement.production_no IS NULL, instance.business_sub_id IS NULL,
-                                 statement.production_no = instance.business_sub_id))
-                         AND (IF(report.production_no IS NULL, instance.business_min_id IS NULL,
-                                 report.production_no = instance.business_min_id))
-                         AND (instance.state = 'PENDING' OR
-                              (instance.state = 'FINISHED' AND node.`code` = 'BUSINESS_ARCHIVING'))),
-                      IF(statement.production_no IS NULL, '撰写意见书', '撰写报告')) AS currentNodeName,
+               IF(nodeInfo.state = 'CLOSED','项目终止',IF(nodeInfo.name IS NULL,IF(statement.production_no IS NULL, '撰写意见书', '撰写报告'),nodeInfo.name)) AS currentNodeName,
                assets.security AS security,
                assets.significant_assets_reorganization AS significantAssetsReorganization,
                assets.state_assets AS stateAssets,
@@ -120,9 +107,10 @@
                      AND instance.business_id = assets.id
                      AND instance.business_min_id = report.production_no
                      AND node.code = 'FOURTH_CHECK_REPORT'
+                     AND instance.deleted = 0
                ) AS reportFourthCheckerName
         FROM (SELECT @i := 0) AS sort,assets
-                                          LEFT JOIN (
+        LEFT JOIN (
             SELECT target.id,
                    target.assets_id,
                    purpose_name,
@@ -142,11 +130,25 @@
                      LEFT JOIN assets_evaluation_target_type AS secType ON evaluation_type_sec_id = type.id
                      LEFT JOIN assets_value_type AS vType ON assets_value_id = vType.id
         ) AS target ON assets.id = target.assets_id
-                                          LEFT JOIN assets_production AS report ON report_no = report.production_no
-                                          LEFT JOIN assets_production AS statement ON statement_no = statement.production_no
-                                          LEFT JOIN user AS manager ON manager.id = assets.client_manager_id
-                                          LEFT JOIN user AS principal ON principal.id = assets.principal_id
-                                          LEFT JOIN order_fund AS fund ON fund.business_id = assets.id AND fund.business_type = 'ASSET_BUSINESS'
+        LEFT JOIN assets_production AS report ON report_no = report.production_no
+        LEFT JOIN assets_production AS statement ON statement_no = statement.production_no
+        LEFT JOIN user AS manager ON manager.id = assets.client_manager_id
+        LEFT JOIN user AS principal ON principal.id = assets.principal_id
+        LEFT JOIN order_fund AS fund ON fund.business_id = assets.id AND fund.business_type = 'ASSET_BUSINESS'
+        LEFT JOIN (
+            SELECT node.`name`,instance.business_id,instance.business_sub_id,instance.business_min_id,instance.state
+            FROM work_flow_node_instance AS instance,
+            work_node AS node
+            WHERE instance.node_id = node.id
+            AND node.deleted = 0
+            AND instance.deleted = 0
+            AND (instance.state = 'PENDING' OR instance.state = 'CLOSED' OR
+            (instance.state = 'FINISHED' AND node.`code` = 'BUSINESS_ARCHIVING'))
+        ) AS nodeInfo ON nodeInfo.business_id = assets.id
+        AND (IF(statement.production_no IS NULL, nodeInfo.business_sub_id IS NULL,
+        statement.production_no = nodeInfo.business_sub_id))
+        AND (IF(report.production_no IS NULL, nodeInfo.business_min_id IS NULL,
+        report.production_no = nodeInfo.business_min_id))
         WHERE assets.deleted = 0
         <if test="dto != null and dto.keyWord != null and dto.keyWord != '' ">
             AND (
@@ -161,7 +163,7 @@
         <if test="dto != null and dto.principalId">
             AND assets.principal_id = #{dto.principalId}
         </if>
-        <if test="dto != null and dto.departmentId">
+        <if test="dto != null and dto.departmentId != null">
             AND assets.principal_id = #{dto.departmentId}
         </if>
         <if test="dto != null and dto.startTime != null and dto.endTime!= null">
@@ -170,8 +172,8 @@
         <if test="dto != null and dto.assetsBusinessGener">
             AND assets.assets_business_gener = #{dto.assetsBusinessGener}
         </if>
-        GROUP BY statementNo,
-        reportNo
+        GROUP BY statementNo,reportNo,assets.id
+        ORDER BY assets.created DESC
     </sql>
 
     <!--获取资产台账-->
@@ -183,4 +185,222 @@
     <select id="assetsLedgerVOExport" resultType="com.dayou.vo.AssetsLedgerVO">
         <include refid="assetsLedgerQuery" />
     </select>
+
+    <sql id="assetsPerformanceDeductionQuery">
+        SELECT
+        department.id AS departmentId,
+        department.name AS departmentName,
+        COALESCE ( SUM( checkPer.normal_mistake ), 0 ) AS checkNormalMistakeScore,
+        COALESCE ( SUM( checkPer.hard_mistake ), 0 ) AS checkHardMistakeScore,
+        COALESCE ( SUM( checkPer.fatal_mistake ), 0 ) AS checkFatalMistakeScore,
+        COALESCE ( SUM( reCheckPer.normal_mistake ), 0 ) AS reCheckNormalMistakeScore,
+        COALESCE ( SUM( reCheckPer.hard_mistake ), 0 ) AS reCheckHardMistakeScore,
+        COALESCE ( SUM( reCheckPer.fatal_mistake ), 0 ) AS reCheckFatalMistakeScore,
+        COALESCE ( SUM( fourthCheckPer.normal_mistake ), 0 ) AS fourthCheckNormalMistakeScore,
+        COALESCE ( SUM( fourthCheckPer.hard_mistake ), 0 ) AS fourthCheckHardMistakeScore,
+        COALESCE ( SUM( fourthCheckPer.fatal_mistake ), 0 ) AS fourthCheckFatalMistakeScore,
+        COALESCE (
+        COALESCE ( SUM( checkPer.normal_mistake ), 0 ) + COALESCE ( SUM( checkPer.hard_mistake ), 0 ) + COALESCE ( SUM( checkPer.fatal_mistake ), 0 ) + COALESCE ( SUM( reCheckPer.normal_mistake ), 0 ) + COALESCE ( SUM( reCheckPer.hard_mistake ), 0 ) + COALESCE ( SUM( reCheckPer.fatal_mistake ), 0 ) + COALESCE ( SUM( fourthCheckPer.normal_mistake ), 0 ) + COALESCE ( SUM( fourthCheckPer.hard_mistake ), 0 ) + COALESCE ( SUM( fourthCheckPer.fatal_mistake ), 0 ),
+        0
+        ) AS allMistakeScore
+        FROM
+        (
+            SELECT
+                department.id,
+                department.name
+            FROM
+                department,
+                sorted_department
+            WHERE
+                department.id = sorted_department.department_id
+                AND department.deleted = 0
+                AND sorted_department.business_type = 'ASSET_BUSINESS'
+        ) AS department
+        LEFT JOIN (
+        SELECT
+        department_id,
+        assets.created,
+        assets_production.id AS production_id
+        FROM
+        assets
+        LEFT JOIN assets_production ON assets_production.business_id = assets.id
+        AND assets_production.deleted = 0
+        ) AS orderInfo ON department.id = orderInfo.department_id
+        LEFT JOIN ( SELECT production_id, fatal_mistake, hard_mistake, normal_mistake FROM
+        business_production_performance WHERE business_type = 'ASSET_BUSINESS' AND check_loop = '初审'
+        <if test="dto != null and dto.startTime != null and dto.endTime!= null">
+            AND (business_production_performance.modified BETWEEN #{dto.startTime} AND #{dto.endTime})
+        </if>
+        ) AS checkPer ON checkPer.production_id = orderInfo.production_id
+        LEFT JOIN ( SELECT production_id, fatal_mistake, hard_mistake, normal_mistake FROM
+        business_production_performance WHERE business_type = 'ASSET_BUSINESS' AND check_loop = '复审'
+        <if test="dto != null and dto.startTime != null and dto.endTime!= null">
+            AND (business_production_performance.modified BETWEEN #{dto.startTime} AND #{dto.endTime})
+        </if>
+        ) AS reCheckPer ON reCheckPer.production_id = orderInfo.production_id
+        LEFT JOIN ( SELECT production_id, fatal_mistake, hard_mistake, normal_mistake FROM
+        business_production_performance WHERE business_type = 'ASSET_BUSINESS' AND check_loop = '四审'
+        <if test="dto != null and dto.startTime != null and dto.endTime!= null">
+            AND (business_production_performance.modified BETWEEN #{dto.startTime} AND #{dto.endTime})
+        </if>
+        ) AS fourthCheckPer ON fourthCheckPer.production_id = orderInfo.production_id
+        <where>
+            <if test="dto != null and dto.departmentId != null">
+                AND department.id = #{dto.departmentId}
+            </if>
+        </where>
+        GROUP BY department.id
+    </sql>
+
+    <!--评估部绩效扣分查询-->
+    <select id="getAssetsPerformanceDeductionVO" resultType="com.dayou.vo.AssetsPerformanceDeductionVO">
+        <include refid="assetsPerformanceDeductionQuery" />
+    </select>
+
+    <!--评估部绩效扣分导出-->
+    <select id="assetsPerformanceDeductionVOExport" resultType="com.dayou.vo.AssetsPerformanceDeductionVO">
+        <include refid="assetsPerformanceDeductionQuery" />
+    </select>
+
+    <!--查询错误详情SQL-->
+    <sql id="assetsPerformanceDeductionDetailQuery">
+        SELECT performance.id,
+               assets.order_id            AS orderId,
+               assets.members             AS members,
+               production.assets_name     AS projectName,
+               customer.name              AS customerName,
+               production.production_no   AS productionNo,
+               (CASE production.production_type
+                    WHEN 'STATEMENT' THEN '意见书'
+                    WHEN 'LETTER' THEN '意见函'
+                    WHEN 'CONSULT' THEN '咨询报告'
+                    WHEN 'REPORT' THEN '评估报告'
+                    END)                  AS productionType,
+               principal.name             AS principalName,
+               checker.name               AS checkerName,
+               (CASE #{dto.mistakeType}
+                    WHEN 'normal' THEN performance.normal_mistake
+                    WHEN 'hard' THEN performance.hard_mistake
+                    WHEN 'fatal' THEN performance.fatal_mistake
+                    ELSE '-'
+                    END)                  AS mistakeCount,
+               production.evaluate_amount AS evaluateAmount,
+               performance.modified       AS checkTime,
+               performance.reason         AS reason
+        FROM assets
+                 LEFT JOIN assets_production AS production ON assets.id = production.business_id
+                 LEFT JOIN business_production_performance AS performance ON production.id = performance.production_id
+                 LEFT JOIN customer_company AS customer ON customer.id = assets.clientele_id
+                 LEFT JOIN user AS principal ON principal.id = assets.principal_id
+                 LEFT JOIN user AS checker ON checker.id = performance.check_id
+        WHERE assets.department_id = #{dto.departmentId}
+          AND performance.check_loop = #{dto.checkLoop}
+          AND (performance.modified BETWEEN #{dto.startTime} AND #{dto.endTime})
+          <if test="dto.principalId != null">
+              AND assets.principal_id = #{dto.principalId}
+          </if>
+          <if test="dto.mistakeType == 'normal' ">
+            AND performance.normal_mistake > 0
+          </if>
+          <if test="dto.mistakeType == 'hard' ">
+            AND performance.hard_mistake > 0
+          </if>
+          <if test="dto.mistakeType == 'fatal' ">
+            AND performance.fatal_mistake > 0
+          </if>
+    </sql>
+
+    <!--查询错误详情列表-->
+    <select id="getAssetsPerformanceDeductionDetail" resultType="com.dayou.vo.AssetsPerformanceDeductionDetailVO">
+        <include refid="assetsPerformanceDeductionDetailQuery" />
+    </select>
+
+    <!--错误详情列表导出-->
+    <select id="assetsPerformanceDeductionDetailExport" resultType="com.dayou.vo.AssetsPerformanceDeductionDetailVO">
+        <include refid="assetsPerformanceDeductionDetailQuery" />
+    </select>
+
+    <!--评估人员绩效扣分查询SQL-->
+    <sql id="assetsPerformanceDeductionByUserQuery">
+        SELECT user.id AS userId,
+               user.userName,
+               user.departmentId,
+               user.departmentName,
+               COALESCE ( SUM( checkPer.normal_mistake ), 0 ) AS checkNormalMistakeScore,
+               COALESCE ( SUM( checkPer.hard_mistake ), 0 ) AS checkHardMistakeScore,
+               COALESCE ( SUM( checkPer.fatal_mistake ), 0 ) AS checkFatalMistakeScore,
+               COALESCE ( SUM( reCheckPer.normal_mistake ), 0 ) AS reCheckNormalMistakeScore,
+               COALESCE ( SUM( reCheckPer.hard_mistake ), 0 ) AS reCheckHardMistakeScore,
+               COALESCE ( SUM( reCheckPer.fatal_mistake ), 0 ) AS reCheckFatalMistakeScore,
+               COALESCE ( SUM( fourthCheckPer.normal_mistake ), 0 ) AS fourthCheckNormalMistakeScore,
+               COALESCE ( SUM( fourthCheckPer.hard_mistake ), 0 ) AS fourthCheckHardMistakeScore,
+               COALESCE ( SUM( fourthCheckPer.fatal_mistake ), 0 ) AS fourthCheckFatalMistakeScore,
+               COALESCE (
+               COALESCE ( SUM( checkPer.normal_mistake ), 0 ) + COALESCE ( SUM( checkPer.hard_mistake ), 0 ) + COALESCE ( SUM( checkPer.fatal_mistake ), 0 ) + COALESCE ( SUM( reCheckPer.normal_mistake ), 0 ) + COALESCE ( SUM( reCheckPer.hard_mistake ), 0 ) + COALESCE ( SUM( reCheckPer.fatal_mistake ), 0 ) + COALESCE ( SUM( fourthCheckPer.normal_mistake ), 0 ) + COALESCE ( SUM( fourthCheckPer.hard_mistake ), 0 ) + COALESCE ( SUM( fourthCheckPer.fatal_mistake ), 0 ),
+                0
+                ) AS allMistakeScore
+        FROM (SELECT user.id AS id,
+                     user.`name` AS userName,
+                     department.name AS departmentName,
+                     department.id AS departmentId
+              FROM user,post,user_post,sorted_department,department
+              WHERE `user`.id = user_post.user_id
+                AND user_post.post_id = post.id
+                AND post.department_id = sorted_department.department_id
+                AND sorted_department.department_id = department.id
+                AND sorted_department.deleted = 0
+                AND user_post.deleted = 0
+                AND sorted_department.business_type = 'ASSET_BUSINESS'
+              GROUP BY user.id
+             ) AS user
+        LEFT JOIN (
+            SELECT
+            principal_id,
+            assets.created,
+            assets_production.id AS production_id
+            FROM
+            assets
+            LEFT JOIN assets_production ON assets_production.business_id = assets.id
+            AND assets_production.deleted = 0
+        ) AS orderInfo ON user.id = orderInfo.principal_id
+        LEFT JOIN ( SELECT production_id, fatal_mistake, hard_mistake, normal_mistake FROM
+        business_production_performance WHERE business_type = 'ASSET_BUSINESS' AND check_loop = '初审'
+        <if test="dto != null and dto.startTime != null and dto.endTime!= null">
+            AND (business_production_performance.modified BETWEEN #{dto.startTime} AND #{dto.endTime})
+        </if>
+        ) AS checkPer ON checkPer.production_id = orderInfo.production_id
+        LEFT JOIN ( SELECT production_id, fatal_mistake, hard_mistake, normal_mistake FROM
+        business_production_performance WHERE business_type = 'ASSET_BUSINESS' AND check_loop = '复审'
+        <if test="dto != null and dto.startTime != null and dto.endTime!= null">
+            AND (business_production_performance.modified BETWEEN #{dto.startTime} AND #{dto.endTime})
+        </if>
+        ) AS reCheckPer ON reCheckPer.production_id = orderInfo.production_id
+        LEFT JOIN ( SELECT production_id, fatal_mistake, hard_mistake, normal_mistake FROM
+        business_production_performance WHERE business_type = 'ASSET_BUSINESS' AND check_loop = '四审'
+        <if test="dto != null and dto.startTime != null and dto.endTime!= null">
+            AND (business_production_performance.modified BETWEEN #{dto.startTime} AND #{dto.endTime})
+        </if>
+        ) AS fourthCheckPer ON fourthCheckPer.production_id = orderInfo.production_id
+        <where>
+            <if test="dto != null and dto.departmentId != null">
+                AND user.departmentId = #{dto.departmentId}
+            </if>
+            <if test="dto != null and dto.userName != null">
+                AND user.userName LIKE CONCAT('%',#{dto.userName},'%')
+            </if>
+        </where>
+        GROUP BY user.id
+    </sql>
+
+    <!--评估人员绩效扣分查询-->
+    <select id="getAssetsPerformanceDeductionVOByEvaluator" resultType="com.dayou.vo.AssetsPerformanceDeductionVO">
+        <include refid="assetsPerformanceDeductionByUserQuery" />
+    </select>
+
+    <!--评估人员绩效扣分导出-->
+    <select id="assetsPerformanceDeductionVOByEvaluatorExport" resultType="com.dayou.vo.AssetsPerformanceDeductionVO">
+        <include refid="assetsPerformanceDeductionByUserQuery" />
+    </select>
+
+
 </mapper>

+ 15 - 0
domain/src/main/java/com/dayou/dto/AssetsStatisticalSelectDTO.java

@@ -14,6 +14,11 @@ public class AssetsStatisticalSelectDTO {
     private String keyWord;
 
     /**
+     * 用户名
+     */
+    private String userName;
+
+    /**
      * 客户经理id(user_id)
      */
     private Long clientManagerId;
@@ -45,4 +50,14 @@ public class AssetsStatisticalSelectDTO {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date endTime;
 
+    /**
+     * 审核轮次
+     */
+    private String checkLoop;
+
+    /**
+     * 错误类型(normal、hard、fatal)
+     */
+    private String mistakeType;
+
 }

+ 2 - 2
domain/src/main/java/com/dayou/vo/AssetsLedgerVO.java

@@ -98,13 +98,13 @@ public class AssetsLedgerVO {
     /**
      * 客户经理名
      */
-    @Excel(name = "客户经理")
+    @Excel(name = "客户经理")
     private String clientManagerName;
 
     /**
      * 项目负责人名
      */
-    @Excel(name = "项目负责人")
+    @Excel(name = "项目负责人")
     private String principalName;
 
     /**

+ 89 - 0
domain/src/main/java/com/dayou/vo/AssetsPerformanceDeductionDetailVO.java

@@ -0,0 +1,89 @@
+package com.dayou.vo;
+
+import com.dayou.annotation.Excel;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Date;
+
+@Data
+public class AssetsPerformanceDeductionDetailVO {
+
+    private Integer id;
+
+    /**
+     * 项目编号
+     */
+    @Excel(name = "项目编号")
+    private String orderId;
+
+    /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称")
+    private String projectName;
+
+    /**
+     * 客户名称
+     */
+    @Excel(name = "客户名称")
+    private String customerName;
+
+    /**
+     * 产品类型
+     */
+    @Excel(name = "产品类型")
+    private String productionType;
+
+    /**
+     * 产品号
+     */
+    @Excel(name = "产品号")
+    private String productionNo;
+
+
+    /**
+     * 项目负责人
+     */
+    @Excel(name = "项目负责人")
+    private String principalName;
+
+    /**
+     * 参与人
+     */
+    @Excel(name = "参与人")
+    private String members;
+
+    /**
+     * 评估金额(万元)
+     */
+    @Excel(name = "评估金额(万元)")
+    private BigDecimal evaluateAmount;
+
+    /**
+     * 扣分人
+     */
+    @Excel(name = "扣分人")
+    private String checkerName;
+
+    /**
+     * 错误个数
+     */
+    @Excel(name = "错误个数")
+    private Integer mistakeCount;
+
+    /**
+     * 扣分时间
+     */
+    @Excel(name = "扣分时间")
+    private LocalDate checkTime;
+
+    /**
+     * 扣分原因
+     */
+    @Excel(name = "扣分原因")
+    private String reason;
+
+}

+ 132 - 0
domain/src/main/java/com/dayou/vo/AssetsPerformanceDeductionVO.java

@@ -0,0 +1,132 @@
+package com.dayou.vo;
+
+import com.dayou.annotation.Excel;
+import lombok.Data;
+
+@Data
+public class AssetsPerformanceDeductionVO {
+
+    /**
+     * 部门id
+     */
+    private Long departmentId;
+
+    /**
+     * 用户id
+     */
+    private Long userId;
+
+    /**
+     * 员工姓名
+     */
+    @Excel(name = "员工姓名")
+    private String userName;
+
+    /**
+     * 部门名称
+     */
+    @Excel(name = "部门名称")
+    private String departmentName;
+
+    /**
+     * 审核一般错误扣分
+     */
+    @Excel(name = "审核一般错误")
+    private Integer checkNormalMistakeScore;
+
+    /**
+     * 审核较大错误扣分
+     */
+    @Excel(name = "审核较大错误")
+    private Integer checkHardMistakeScore;
+
+    /**
+     * 审核严重错误扣分
+     */
+    @Excel(name = "审核严重错误")
+    private Integer checkFatalMistakeScore;
+
+    /**
+     * 复审一般错误扣分
+     */
+    @Excel(name = "复审一般错误")
+    private Integer reCheckNormalMistakeScore;
+
+    /**
+     * 复审较大错误扣分
+     */
+    @Excel(name = "复审较大错误")
+    private Integer reCheckHardMistakeScore;
+
+    /**
+     * 复审严重错误扣分
+     */
+    @Excel(name = "复审严重错误")
+    private Integer reCheckFatalMistakeScore;
+
+    /**
+     * 四审一般错误扣分
+     */
+    @Excel(name = "四审一般错误")
+    private Integer fourthCheckNormalMistakeScore;
+
+    /**
+     * 四审较大错误扣分
+     */
+    @Excel(name = "四审较大错误")
+    private Integer fourthCheckHardMistakeScore;
+
+    /**
+     * 四审严重错误扣分
+     */
+    @Excel(name = "四审严重错误")
+    private Integer fourthCheckFatalMistakeScore;
+
+    /**
+     * 外部投诉一般错误扣分
+     */
+    @Excel(name = "外部投诉一般错误")
+    private Integer externalComplaintNormalMistakeScore;
+
+    /**
+     * 外部投诉较大错误扣分
+     */
+    @Excel(name = "外部投诉较大错误")
+    private Integer externalComplaintHardMistakeScore;
+
+    /**
+     * 外部投诉严重错误扣分
+     */
+    @Excel(name = "外部投诉严重错误")
+    private Integer externalComplaintFatalMistakeScore;
+
+    /**
+     * 外部投诉服务态度恶劣
+     */
+    @Excel(name = "服务态度恶劣")
+    private Integer badServiceAttitude;
+
+    /**
+     * 内部投诉一般错误扣分
+     */
+    @Excel(name = "内部投诉一般错误")
+    private Integer internalComplaintNormalMistakeScore;
+
+    /**
+     * 内部投诉较大错误扣分
+     */
+    @Excel(name = "内部投诉较大错误")
+    private Integer internalComplaintHardMistakeScore;
+
+    /**
+     * 内部投诉严重错误扣分
+     */
+    @Excel(name = "内部投诉严重错误")
+    private Integer internalComplaintFatalMistakeScore;
+
+    /**
+     * 扣分合计
+     */
+    @Excel(name = "扣分合计")
+    private Integer allMistakeScore;
+}

+ 45 - 0
service/src/main/java/com/dayou/service/IAssetsStatisticalStatementService.java

@@ -3,6 +3,8 @@ package com.dayou.service;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.dayou.dto.AssetsStatisticalSelectDTO;
 import com.dayou.vo.AssetsLedgerVO;
+import com.dayou.vo.AssetsPerformanceDeductionDetailVO;
+import com.dayou.vo.AssetsPerformanceDeductionVO;
 
 import java.util.List;
 
@@ -29,4 +31,47 @@ public interface IAssetsStatisticalStatementService {
      * @return Page<AssetsLedgerVO>
      */
     List<AssetsLedgerVO> assetsLedgerVOExport(AssetsStatisticalSelectDTO dto);
+
+    /**
+     * 评估部绩效扣分查询
+     * @param dto 查询dto
+     * @return List<AssetsPerformanceDeductionVO>
+     */
+    List<AssetsPerformanceDeductionVO> getAssetsPerformanceDeductionVO(AssetsStatisticalSelectDTO dto);
+
+    /**
+     * 评估部绩效扣分导出
+     * @param dto 查询dto
+     * @return List<AssetsPerformanceDeductionVO>
+     */
+    List<AssetsPerformanceDeductionVO> assetsPerformanceDeductionVOExport(AssetsStatisticalSelectDTO dto);
+
+    /**
+     * 查询错误详情列表
+     * @param page 分页
+     * @param dto 查询dto
+     * @return Page<AssetsPerformanceDeductionDetailVO>
+     */
+    Page<AssetsPerformanceDeductionDetailVO> getAssetsPerformanceDeductionDetail(Page page, AssetsStatisticalSelectDTO dto);
+
+    /**
+     * 错误详情列表导出
+     * @param dto 查询dto
+     * @return Page<AssetsPerformanceDeductionDetailVO>
+     */
+    List<AssetsPerformanceDeductionDetailVO> assetsPerformanceDeductionDetailExport(AssetsStatisticalSelectDTO dto);
+
+    /**
+     * 评估人员绩效扣分查询
+     * @param dto 查询dto
+     * @return List<AssetsPerformanceDeductionVO>
+     */
+    List<AssetsPerformanceDeductionVO> getAssetsPerformanceDeductionVOByEvaluator(AssetsStatisticalSelectDTO dto);
+
+    /**
+     * 评估人员绩效扣分导出
+     * @param dto 查询dto
+     * @return List<AssetsPerformanceDeductionVO>
+     */
+    List<AssetsPerformanceDeductionVO> assetsPerformanceDeductionVOByEvaluatorExport(AssetsStatisticalSelectDTO dto);
 }

+ 125 - 28
service/src/main/java/com/dayou/service/impl/AssetsStatisticalStatementServiceImpl.java

@@ -12,6 +12,8 @@ import com.dayou.mapper.AssetsStatisticalStatementMapper;
 import com.dayou.service.IAssetsStatisticalStatementService;
 import com.dayou.service.IUserService;
 import com.dayou.vo.AssetsLedgerVO;
+import com.dayou.vo.AssetsPerformanceDeductionDetailVO;
+import com.dayou.vo.AssetsPerformanceDeductionVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -46,9 +48,9 @@ public class AssetsStatisticalStatementServiceImpl implements IAssetsStatistical
         List<AssetsEvaluationMethod> evaluationMethodList = assetsEvaluationMethodMapper.getAssetsEvaluationMethod();
         // 获取用户信息
         LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper<User>()
-                .select(User::getId,User::getName)
-                .eq(User::getDeleted,false);
-        List<User> userList= userService.list(lambdaQueryWrapper);
+                .select(User::getId, User::getName)
+                .eq(User::getDeleted, false);
+        List<User> userList = userService.list(lambdaQueryWrapper);
         // 设置评估方法与签字人等信息
         for (AssetsLedgerVO assetsLedgerVO : assetsLedgerVOPage.getRecords()) {
             assetsLedgerVO = setVOJSONInfo(assetsLedgerVO, evaluationMethodList, userList);
@@ -58,6 +60,7 @@ public class AssetsStatisticalStatementServiceImpl implements IAssetsStatistical
 
     /**
      * 资产台账导出
+     *
      * @param dto 查询dto
      * @return Page<AssetsLedgerVO>
      */
@@ -68,9 +71,9 @@ public class AssetsStatisticalStatementServiceImpl implements IAssetsStatistical
         List<AssetsEvaluationMethod> evaluationMethodList = assetsEvaluationMethodMapper.getAssetsEvaluationMethod();
         // 获取用户信息
         LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper<User>()
-                .select(User::getId,User::getName)
-                .eq(User::getDeleted,false);
-        List<User> userList= userService.list(lambdaQueryWrapper);
+                .select(User::getId, User::getName)
+                .eq(User::getDeleted, false);
+        List<User> userList = userService.list(lambdaQueryWrapper);
         // 设置评估方法与签字人等信息
         for (AssetsLedgerVO assetsLedgerVO : assetsLedgerVOList) {
             assetsLedgerVO = setVOJSONInfo(assetsLedgerVO, evaluationMethodList, userList);
@@ -79,18 +82,88 @@ public class AssetsStatisticalStatementServiceImpl implements IAssetsStatistical
     }
 
     /**
+     * 评估部绩效扣分查询
+     *
+     * @param dto 查询dto
+     * @return Page<AssetsPerformanceDeductionVO>
+     */
+    @Override
+    public List<AssetsPerformanceDeductionVO> getAssetsPerformanceDeductionVO(AssetsStatisticalSelectDTO dto) {
+        return assetsStatisticalStatementMapper.getAssetsPerformanceDeductionVO(dto);
+    }
+
+    /**
+     * 评估部绩效扣分导出
+     *
+     * @param dto 查询dto
+     * @return Page<AssetsPerformanceDeductionVO>
+     */
+    @Override
+    public List<AssetsPerformanceDeductionVO> assetsPerformanceDeductionVOExport(AssetsStatisticalSelectDTO dto) {
+        return assetsStatisticalStatementMapper.assetsPerformanceDeductionVOExport(dto);
+    }
+
+    /**
+     * 查询错误详情列表
+     *
+     * @param page 分页
+     * @param dto  查询dto
+     * @return Page<AssetsPerformanceDeductionDetailVO>
+     */
+    @Override
+    public Page<AssetsPerformanceDeductionDetailVO> getAssetsPerformanceDeductionDetail(Page page, AssetsStatisticalSelectDTO dto) {
+        Page<AssetsPerformanceDeductionDetailVO> detailVOPage = assetsStatisticalStatementMapper.getAssetsPerformanceDeductionDetail(page, dto);
+        detailVOPage.setRecords(setDetailVOJSONInfo(detailVOPage.getRecords()));
+        return detailVOPage;
+    }
+
+    /**
+     * 错误详情列表导出
+     *
+     * @param dto 查询dto
+     * @return Page<AssetsPerformanceDeductionDetailVO>
+     */
+    @Override
+    public List<AssetsPerformanceDeductionDetailVO> assetsPerformanceDeductionDetailExport(AssetsStatisticalSelectDTO dto) {
+        List<AssetsPerformanceDeductionDetailVO> detailVOList = assetsStatisticalStatementMapper.assetsPerformanceDeductionDetailExport(dto);
+        detailVOList = setDetailVOJSONInfo(detailVOList);
+        return detailVOList;
+    }
+
+    /**
+     * 评估人员绩效扣分查询
+     * @param dto 查询dto
+     * @return List<AssetsPerformanceDeductionVO>
+     */
+    @Override
+    public List<AssetsPerformanceDeductionVO> getAssetsPerformanceDeductionVOByEvaluator(AssetsStatisticalSelectDTO dto) {
+        return assetsStatisticalStatementMapper.getAssetsPerformanceDeductionVOByEvaluator(dto);
+    }
+
+    /**
+     * 评估人员绩效扣分导出
+     * @param dto 查询dto
+     * @return List<AssetsPerformanceDeductionVO>
+     */
+    @Override
+    public List<AssetsPerformanceDeductionVO> assetsPerformanceDeductionVOByEvaluatorExport(AssetsStatisticalSelectDTO dto) {
+        return assetsStatisticalStatementMapper.assetsPerformanceDeductionVOByEvaluatorExport(dto);
+    }
+
+    /**
      * 设置评估方法与签字人等信息
-     * @param assetsLedgerVO 查询出来的VO信息
+     *
+     * @param assetsLedgerVO       查询出来的VO信息
      * @param evaluationMethodList 评估方法信息
-     * @param userList 用户信息
+     * @param userList             用户信息
      * @return AssetsLedgerVO
      */
-    public AssetsLedgerVO setVOJSONInfo(AssetsLedgerVO assetsLedgerVO, List<AssetsEvaluationMethod> evaluationMethodList, List<User> userList){
+    public AssetsLedgerVO setVOJSONInfo(AssetsLedgerVO assetsLedgerVO, List<AssetsEvaluationMethod> evaluationMethodList, List<User> userList) {
         // 正则表达式匹配任何在[]内的值
         Pattern pattern = Pattern.compile("\\[(.*?)\\]");
 
         // 获取评估方法
-        if (ObjectUtil.isNotNull(assetsLedgerVO.getEvaluationMethods())){
+        if (ObjectUtil.isNotNull(assetsLedgerVO.getEvaluationMethods())) {
             Matcher matcher = pattern.matcher(assetsLedgerVO.getEvaluationMethods());
             List<String> methodIdsList = new ArrayList<>();
             while (matcher.find()) {
@@ -107,17 +180,17 @@ public class AssetsStatisticalStatementServiceImpl implements IAssetsStatistical
                 // 通过id进行匹配并返回方法名
                 int index = 0;
                 for (AssetsEvaluationMethod evaluationMethod : evaluationMethodList) {
-                    if (idList.contains(evaluationMethod.getId())){
-                        if (ObjectUtil.isNotNull(evaluationMethodNames)){
+                    if (idList.contains(evaluationMethod.getId())) {
+                        if (ObjectUtil.isNotNull(evaluationMethodNames)) {
                             evaluationMethodNames += evaluationMethod.getMethodName();
                             index++;
-                        }else {
+                        } else {
                             evaluationMethodNames = evaluationMethod.getMethodName();
                             index++;
                         }
-                        if (index < idList.size()){
+                        if (index < idList.size()) {
                             evaluationMethodNames += ',';
-                        }else {
+                        } else {
                             evaluationMethodNames += ';';
                         }
                     }
@@ -127,7 +200,7 @@ public class AssetsStatisticalStatementServiceImpl implements IAssetsStatistical
         }
 
         // 获取最终选择的评估方法
-        if (ObjectUtil.isNotNull(assetsLedgerVO.getChoiceEvaluationMethods())){
+        if (ObjectUtil.isNotNull(assetsLedgerVO.getChoiceEvaluationMethods())) {
             Matcher choiceMatcher = pattern.matcher(assetsLedgerVO.getChoiceEvaluationMethods());
             List<String> choiceMethodIdsList = new ArrayList<>();
             while (choiceMatcher.find()) {
@@ -144,17 +217,17 @@ public class AssetsStatisticalStatementServiceImpl implements IAssetsStatistical
                 // 通过id进行匹配并返回方法名
                 int index = 0;
                 for (AssetsEvaluationMethod evaluationMethod : evaluationMethodList) {
-                    if (idList.contains(evaluationMethod.getId())){
-                        if (ObjectUtil.isNotNull(choiceEvaluationMethodNames)){
+                    if (idList.contains(evaluationMethod.getId())) {
+                        if (ObjectUtil.isNotNull(choiceEvaluationMethodNames)) {
                             choiceEvaluationMethodNames += evaluationMethod.getMethodName();
                             index++;
-                        }else {
+                        } else {
                             choiceEvaluationMethodNames = evaluationMethod.getMethodName();
                             index++;
                         }
-                        if (index < idList.size()){
+                        if (index < idList.size()) {
                             choiceEvaluationMethodNames += ',';
-                        }else {
+                        } else {
                             choiceEvaluationMethodNames += ';';
                         }
                     }
@@ -164,23 +237,23 @@ public class AssetsStatisticalStatementServiceImpl implements IAssetsStatistical
         }
 
         // 获取签字人
-        if (ObjectUtil.isNotNull(assetsLedgerVO.getSignatory())){
+        if (ObjectUtil.isNotNull(assetsLedgerVO.getSignatory())) {
             String signatoryNames = null;
             JSONArray jsonArray = JSONArray.parseArray(assetsLedgerVO.getSignatory());
             List<Long> signatoryIdList = jsonArray.toJavaList(Long.class);
             int index = 0;
-            for (User user : userList){
-                if (signatoryIdList.contains(user.getId())){
-                    if (ObjectUtil.isNotNull(signatoryNames)){
+            for (User user : userList) {
+                if (signatoryIdList.contains(user.getId())) {
+                    if (ObjectUtil.isNotNull(signatoryNames)) {
                         signatoryNames += user.getName();
                         index++;
-                    }else {
+                    } else {
                         signatoryNames = user.getName();
                         index++;
                     }
-                    if (index < signatoryIdList.size()){
+                    if (index < signatoryIdList.size()) {
                         signatoryNames += ',';
-                    }else {
+                    } else {
                         signatoryNames += ';';
                     }
                 }
@@ -190,4 +263,28 @@ public class AssetsStatisticalStatementServiceImpl implements IAssetsStatistical
 
         return assetsLedgerVO;
     }
+
+    /**
+     * 设置参与人信息
+     * @param detailVOList 查询出来的VO信息
+     * @return List<AssetsPerformanceDeductionDetailVO>
+     */
+    public List<AssetsPerformanceDeductionDetailVO> setDetailVOJSONInfo(List<AssetsPerformanceDeductionDetailVO> detailVOList){
+        for (AssetsPerformanceDeductionDetailVO detailVO : detailVOList) {
+            if (ObjectUtil.isNotNull(detailVO.getMembers())) {
+                JSONArray jsonArray = JSONArray.parseArray(detailVO.getMembers());
+                List<Long> membersId = jsonArray.toJavaList(Long.class);
+                String names = null;
+                for (Long id : membersId) {
+                    if (ObjectUtil.isNull(names)) {
+                        names = userService.getById(id).getName() + ';';
+                    } else {
+                        names += userService.getById(id).getName() + ';';
+                    }
+                }
+                detailVO.setMembers(names);
+            }
+        }
+        return detailVOList;
+    }
 }