From cb415813de667096290d6bd0f924f5b523104117 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期一, 10 十一月 2025 17:41:04 +0800
Subject: [PATCH] 报备工单bug修改,定时任务在线问题修改新增导出扣分明细功能
---
ycl-server/src/main/resources/mapper/zgyw/CalculateReportMapper.xml | 94 +++++++++++++++++++++++++++++++++--------------
1 files changed, 66 insertions(+), 28 deletions(-)
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CalculateReportMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CalculateReportMapper.xml
index 9733db3..d331788 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CalculateReportMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CalculateReportMapper.xml
@@ -52,8 +52,11 @@
tyu.unit_name,
tc.name as contractName,
tcr.which_year,
+ tcr.which_month,
+ tcr.which_day,
+ MAX(tcr.which_day) AS latest_day,
SUM(tcr.deduct_money) AS deductMoney,
- MAX(tcr.create_time) AS latest_time,
+ MAX(tcr.which_month) AS latest_month,
(
SELECT deduct_money
FROM t_calculate_record
@@ -72,19 +75,21 @@
AND tcr.status = #{query.status}
</if>
</where>
- group by contract_id,which_year
+ group by contract_id, which_year,which_month
</select>
<resultMap id="DetailResultMap" type="com.ycl.platform.domain.vo.CalculateReportDetailVO">
<result column="id" property="id"/>
<result column="create_time" property="createTime"/>
<result column="unit_name" property="unitName"/>
+ <result column="unit_id" property="unitId"/>
<result column="name" property="contractName"/>
<result column="contract_id" property="contractId"/>
<result column="which_year" property="whichYear"/>
+ <result column="which_month" property="whichMonth"/>
<result column="status" property="status"/>
<collection property="ruleList" column="contract_id" ofType="com.ycl.platform.domain.vo.CalculateMoneyRuleVO"
select="selectRuleByContractId"/>
- <collection property="recordList" column="{contractId=contract_id, whichYear=which_year}" ofType="com.ycl.platform.domain.vo.CalculateRecordVO"
+ <collection property="recordList" column="{contractId=contract_id, whichYear=which_year,status=status,whichMonth=which_month}" ofType="com.ycl.platform.domain.vo.CalculateRecordVO"
select="selectRecordByContractId"/>
</resultMap>
@@ -99,45 +104,78 @@
<select id="selectRecordByContractId" resultType="com.ycl.platform.domain.vo.CalculateRecordVO">
SELECT
- id,
- create_time as createTime,
- score,
- deduct_money as deductMoney,
- which_year as whichYear,
- which_month as whichMonth,
- status
+ tcr.id,
+ tcr.create_time as createTime,
+ (IFNULL(-SUM(tcs.score), 0) + 100) AS score,
+ tcr.deduct_money as deductMoney,
+ tcr.which_year as whichYear,
+ tcr.which_month as whichMonth,
+ tcr.which_day as whichDay,
+ tcr.status
FROM
- t_calculate_record
- WHERE
- contract_id = #{contractId} AND which_year = #{whichYear} AND deleted = 0
+ t_calculate_record tcr
+ LEFT JOIN t_contract_score tcs
+ ON tcr.contract_id =tcs.contract_id
+ AND tcs.deleted=0
+ AND YEAR(tcs.create_time) = #{whichYear}
+ AND MONTH(tcs.create_time) = tcr.which_month
+ AND tcs.auditing_status = 'PASS'
+ <where>
+ tcr.contract_id = #{contractId} AND tcr.which_year = #{whichYear} AND tcr.deleted = 0 AND tcr.which_month=#{whichMonth}
+ <if test="status!=null">
+ AND tcr.status=#{status}
+ </if>
+ </where>
+ group by tcr.id
ORDER BY
- create_time
+ tcr.create_time
</select>
<select id="getById" resultMap="DetailResultMap">
SELECT tyu.unit_name,
- tc.name,
- tcr.id,
- tcr.contract_id,
- tcr.create_time,
- tcr.update_time,
- tcr.which_year
+ tyu.id as unit_id,
+ tc.name,
+ tcr.id,
+ tcr.contract_id,
+ tcr.create_time,
+ tcr.update_time,
+ tcr.which_year,
+ tcr.which_month,
+ #{query.status} as status
FROM t_calculate_record tcr
- INNER JOIN t_contract tc ON tcr.contract_id = tc.id
- INNER JOIN t_yw_unit tyu ON tyu.id = tc.unit_id
- WHERE tcr.contract_id = #{query.contractId} AND tcr.which_year = #{query.whichYear}
+ INNER JOIN t_contract tc ON tcr.contract_id = tc.id
+ INNER JOIN t_yw_unit tyu ON tyu.id = tc.unit_id
+ <where>
+ tcr.contract_id = #{query.contractId} AND tcr.which_year = #{query.whichYear} AND tcr.which_month = #{query.whichMonth}
+ </where>
limit 1
</select>
<select id="exportData" resultType="com.ycl.platform.domain.excel.CalculateExport">
SELECT
- a.rule_name,
- COUNT(b.id) AS num,
- IFNULL(-SUM(score), 0) AS score
+ a.rule_name as ruleName,
+ a.rule_condition as detailName,
+ COUNT(b.id) AS num,
+ a.calc_fraction as calcFraction,
+ IFNULL(-SUM(b.score), 0) AS score
FROM t_calculate_rule a
+ LEFT JOIN t_calculate_record tcr ON a.contract_id = tcr.contract_id
LEFT JOIN t_contract_score b ON b.rule_id = a.id AND auditing_status = 'PASS' AND b.deleted = 0
- WHERE a.contract_id = #{contractId} AND a.deleted = 0
- GROUP BY a.rule_name
+ AND MONTH(b.create_time) = tcr.which_month
+ AND YEAR(b.create_time) = tcr.which_year
+ <where>
+ a.deleted = 0 and a.contract_id = #{contractId}
+ <if test="whichMonth!=null">
+ and tcr.which_month = #{whichMonth}
+ </if>
+ <if test="whichYear!=null">
+ and tcr.which_year = #{whichYear}
+ </if>
+ <if test="whichDay!=null">
+ and tcr.which_day = #{whichDay}
+ </if>
+ </where>
+ GROUP BY a.id
</select>
</mapper>
--
Gitblit v1.8.0