Merge remote-tracking branch 'origin/master'

This commit is contained in:
liang.chao 2025-09-04 20:57:12 +08:00
commit 6ba1e886f3
5 changed files with 64 additions and 24 deletions

View File

@ -59,6 +59,9 @@ public class PeriodCostResultVo {
@ApiModelProperty(value = "采购单价 原值") @ApiModelProperty(value = "采购单价 原值")
private BigDecimal buyPrice; private BigDecimal buyPrice;
@ApiModelProperty(value = "冲账日期,必须区间计算开始日期与冲账日期一致才冲账")
private Date markTime;
@ApiModelProperty(value = "计算开始时间") @ApiModelProperty(value = "计算开始时间")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date calcStartTime; private Date calcStartTime;

View File

@ -281,4 +281,11 @@ public interface SltAgreementInfoMapper {
* @return 区间费用计算结果列表 * @return 区间费用计算结果列表
*/ */
List<PeriodCostResultVo> selectLeasePeriodCostList(PeriodCostQueryDto queryDto); List<PeriodCostResultVo> selectLeasePeriodCostList(PeriodCostQueryDto queryDto);
/**
* 查询区间费用-- 冲账记录表
* @param queryDto 查询条件
* @return 冲账记录
*/
List<PeriodCostResultVo> selectPeriodCostListForCharge(PeriodCostQueryDto queryDto);
} }

View File

@ -1148,11 +1148,20 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
// 从数据库查询基础数据 // 从数据库查询基础数据
List<PeriodCostResultVo> rawResults = sltAgreementInfoMapper.selectLeasePeriodCostList(queryDto); List<PeriodCostResultVo> rawResults = sltAgreementInfoMapper.selectLeasePeriodCostList(queryDto);
// 从数据库查询冲账数据,冲账查询的时候直接过滤了协议和限制具体日期所以不需要再进行范围过滤
List<PeriodCostResultVo> markResults = sltAgreementInfoMapper.selectPeriodCostListForCharge(queryDto);
// 先过滤掉不在查询范围内的数据 // 先过滤掉不在查询范围内的数据
List<PeriodCostResultVo> filteredResults = filterDataInRange(rawResults, queryDto.getStartDate(), queryDto.getEndDate()); List<PeriodCostResultVo> filteredResults = filterDataInRange(rawResults, queryDto.getStartDate(), queryDto.getEndDate());
// 进行时间及费用计算统计 // 进行时间及费用计算统计
return calculatePeriodCosts(filteredResults, queryDto.getStartDate(), queryDto.getEndDate()); List<PeriodCostResultVo> periodCostResultVos = calculatePeriodCosts(filteredResults, queryDto.getStartDate(), queryDto.getEndDate());
// 添加冲账数据
periodCostResultVos.addAll(markResults);
// 返回结果
return periodCostResultVos;
} catch (Exception e) { } catch (Exception e) {
throw new ServiceException("查询区间费用失败:" + e.getMessage()); throw new ServiceException("查询区间费用失败:" + e.getMessage());
} }
@ -1447,6 +1456,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
// 按协议ID分组汇总 // 按协议ID分组汇总
return aggregateByAgreement(detailList, queryDto.getStartDate(), queryDto.getEndDate()); return aggregateByAgreement(detailList, queryDto.getStartDate(), queryDto.getEndDate());
} catch (Exception e) { } catch (Exception e) {
System.err.println(e);
throw new ServiceException("查询区间费用汇总失败:" + e.getMessage()); throw new ServiceException("查询区间费用汇总失败:" + e.getMessage());
} }
} }
@ -1546,6 +1556,13 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
summaryList.add(summary); summaryList.add(summary);
} }
if (!summaryList.isEmpty()) {
List<PeriodCostSummaryVo> collect = summaryList.stream().filter(item -> Objects.isNull(item.getAgreementCode())).collect(Collectors.toList());
if (!collect.isEmpty()) {
throw new ServiceException("存在未填写协议编号的协议");
}
}
// 按协议编号排序 // 按协议编号排序
summaryList.sort(Comparator.comparing(PeriodCostSummaryVo::getAgreementCode)); summaryList.sort(Comparator.comparing(PeriodCostSummaryVo::getAgreementCode));

View File

@ -191,13 +191,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ELSE NULL ELSE NULL
END) AS TimeoutNum END) AS TimeoutNum
FROM ma_machine mm FROM ma_machine mm
LEFT JOIN slt_agreement_info sai on sai.ma_id = mm.ma_id and mm.type_id = sai.type_id and sai.`status`='0' and sai.end_time is null LEFT JOIN slt_agreement_info sai on sai.ma_id = mm.ma_id and mm.type_id = sai.type_id
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
left join sys_dept sd ON sd.dept_id = bp.imp_unit left join sys_dept sd ON sd.dept_id = bp.imp_unit
where mm.next_check_time is not null and mt.`level` = '4' where mm.next_check_time is not null and mt.`level` = '4'
and sai.`status`='0' and sai.end_time is null
and bp.external_id is not null
and mm.ma_status = 2
<if test="deptId != null"> <if test="deptId != null">
AND sd.dept_id = #{deptId} AND sd.dept_id = #{deptId}
</if> </if>
@ -220,13 +223,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ELSE NULL ELSE NULL
END AS daysDiff END AS daysDiff
FROM ma_machine mm FROM ma_machine mm
LEFT JOIN slt_agreement_info sai on sai.ma_id = mm.ma_id and mm.type_id = sai.type_id and sai.`status`='0' and sai.end_time is null LEFT JOIN slt_agreement_info sai on sai.ma_id = mm.ma_id and mm.type_id = sai.type_id
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN sys_dept sd on bp.imp_unit = sd.dept_id LEFT JOIN sys_dept sd on bp.imp_unit = sd.dept_id
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
WHERE mm.next_check_time is not null AND mt.`level`=4 WHERE mm.next_check_time is not null AND mt.`level`=4
and bp.external_id is not null
and sai.`status`='0' and sai.end_time is null
and mm.ma_status = 2
<if test="proId != null"> <if test="proId != null">
AND bp.pro_id = #{proId} AND bp.pro_id = #{proId}
</if> </if>
@ -254,30 +260,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="proId != null"> <if test="proId != null">
GROUP BY bp.pro_id GROUP BY bp.pro_id
</if> </if>
order by mt.jiju_type desc
</select> </select>
<select id="getCompletionNotRefunded" resultType="com.bonus.material.push.domain.MachineInfoBean"> <select id="getCompletionNotRefunded" resultType="com.bonus.material.push.domain.MachineInfoBean">
select select
bp.pro_name as proName, count(bp.pro_id) as num,
count(bp.pro_id) num, sd.dept_name as deptName,
mt2.type_id as typeId, sd.dept_id as deptId
sd.dept_name as deptName, from bm_project bp
sd.dept_id as deptId left join sys_dept sd on bp.imp_unit = sd.dept_id
from slt_agreement_info sai where bp.external_id is not null
left join bm_agreement_info bai on sai.agreement_id = bai.agreement_id GROUP BY bp.imp_unit
left join bm_project bp on bai.project_id = bp.pro_id
left join sys_dept sd on bp.imp_unit = sd.dept_id
left join ma_type mt on sai.type_id = mt.type_id
left join ma_type mt2 on mt.parent_id = mt2.type_id
where sai.is_slt = 0 and sai.end_time is null and bp.actual_end_date is not null AND sd.dept_name in
('送电一分公司','送电二分公司','检修试验分公司','建筑分公司(消防分公司)','安徽宏源电力建设有限公司','变电分公司')
<if test="proId != null">
AND bp.pro_id = #{proId}
</if>
GROUP BY
<if test="proId != null">
bp.pro_id,
</if>
bp.imp_unit
</select> </select>
<select id="getCompletionNotRefundedDetails" resultType="com.bonus.material.push.domain.MachineInfoBean"> <select id="getCompletionNotRefundedDetails" resultType="com.bonus.material.push.domain.MachineInfoBean">
select select

View File

@ -49,6 +49,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark"/> <result property="remark" column="remark"/>
<result property="comsumable" column="comsumable"/> <result property="comsumable" column="comsumable"/>
<result property="buyPrice" column="buy_price"/> <result property="buyPrice" column="buy_price"/>
<result property="leaseDays" column="lease_day"/>
<result property="markTime" column="mark_time"/>
<result property="leaseCost" column="lease_cost"/>
</resultMap> </resultMap>
<sql id="selectSltAgreementInfoVo"> <sql id="selectSltAgreementInfoVo">
@ -1241,4 +1244,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
ORDER BY bai.create_time DESC ORDER BY bai.create_time DESC
</select> </select>
<select id="selectPeriodCostListForCharge" parameterType="com.bonus.material.settlement.domain.dto.PeriodCostQueryDto" resultMap="PeriodCostResultMap">
select
ptc.agreement_id, bai.agreement_code, ptc.type_id, ptc.lease_num as num, ptc.start_time, ptc.end_time, ptc.day as lease_day,
ptc.price, ptc.lease_money as lease_cost, ptc.cost_type, ptc.mark_time, mt.type_name as model_name, mt1.type_name as type_name
from project_temp_cost ptc
inner join bm_agreement_info bai on ptc.agreement_id = bai.agreement_id
LEFT JOIN ma_type mt ON ptc.type_id = mt.type_id AND mt.`level` = '4'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.`level` = '3'
where ptc.mark_time = #{startDate}
<if test="agreementId != null">
and ptc.agreement_id = #{agreementId}
</if>
<if test="agreementCode != null">
and bai.agreement_code = #{agreementCode}
</if>
</select>
</mapper> </mapper>