优化结算信息处理逻辑,设置不收费项目金额为0,调整日期查询范围
This commit is contained in:
parent
a74a8a099e
commit
9f6e4af5e3
|
|
@ -136,8 +136,6 @@ public interface SltAgreementInfoMapper {
|
|||
|
||||
/**
|
||||
* 退料结算信息删除
|
||||
* @param leaseOutDetails
|
||||
* @return
|
||||
*/
|
||||
int deleteSltInfo(@Param("record") LeaseOutDetails leaseOutDetails);
|
||||
|
||||
|
|
@ -174,33 +172,21 @@ public interface SltAgreementInfoMapper {
|
|||
|
||||
/**
|
||||
* 新增租赁结算明细
|
||||
* @param list
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int insertSltAgreementDetailLease(@Param("list") List<SltAgreementInfo> list,@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 新增维修结算明细
|
||||
* @param list
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int insertSltAgreementDetailRepair(@Param("list") List<SltAgreementInfo> list,@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 新增报废结算明细
|
||||
* @param list
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int insertSltAgreementDetailScrap(@Param("list") List<SltAgreementInfo> list,@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 新增丢失结算明细
|
||||
* @param list
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int insertSltAgreementDetailLose(@Param("list") List<SltAgreementInfo> list,@Param("id") Long id);
|
||||
|
||||
|
|
@ -219,8 +205,6 @@ public interface SltAgreementInfoMapper {
|
|||
|
||||
/**
|
||||
* 未结算报表查询
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<SltAgreementInfo> getSltReportList(SltAgreementInfo bean);
|
||||
|
||||
|
|
@ -283,8 +267,6 @@ public interface SltAgreementInfoMapper {
|
|||
|
||||
/**
|
||||
* 获取结算信息
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
List<SltAgreementInfo> getSltAgreementInfoById(SltAgreementInfo info);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,13 @@ package com.bonus.material.settlement.service.impl;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.bonus.common.biz.constant.GlobalConstants;
|
||||
import com.bonus.common.biz.domain.ProjectTreeBuild;
|
||||
import com.bonus.common.biz.domain.ProjectTreeNode;
|
||||
|
|
@ -169,8 +172,27 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
List<SltAgreementInfo> leaseList = getLeaseList(info);
|
||||
//维修费用列表
|
||||
List<SltAgreementInfo> repairList = getRepairList(info);
|
||||
// 增加处理,维修不收费的金额设置为0
|
||||
if (CollectionUtils.isNotEmpty(repairList)) {
|
||||
repairList.removeIf(Objects::isNull);
|
||||
for (SltAgreementInfo repairItem : repairList) {
|
||||
if (Objects.equals(repairItem.getPartType(), "不收费")) {
|
||||
repairItem.setCosts(BigDecimal.ZERO);
|
||||
}
|
||||
}
|
||||
}
|
||||
//报废费用列表
|
||||
List<SltAgreementInfo> scrapList = getScrapList(info);
|
||||
// 增加处理,报废不收费的金额设置为0
|
||||
if (CollectionUtils.isNotEmpty(scrapList)) {
|
||||
scrapList.removeIf(Objects::isNull);
|
||||
for (SltAgreementInfo scrapItem : scrapList) {
|
||||
if (Objects.equals(scrapItem.getPartType(), "不收费")) {
|
||||
scrapItem.setCosts(BigDecimal.ZERO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//丢失费用列表
|
||||
List<SltAgreementInfo> loseList = getLoseList(info);
|
||||
//费用减免列表
|
||||
|
|
@ -1149,6 +1171,9 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
throw new ServiceException("开始日期不能大于结束日期");
|
||||
}
|
||||
|
||||
// 设置当前时间为当天最后的时分秒
|
||||
queryDto.setEndDate(getEndOfDay(queryDto.getEndDate()));
|
||||
|
||||
try {
|
||||
if (queryDto.getSltManageType() == null) {
|
||||
// 查询当前登陆用户的结算管理权限
|
||||
|
|
@ -1185,6 +1210,19 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// 获取当天的结束时间 23:59:59.999
|
||||
public static Date getEndOfDay(Date date) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
cal.set(Calendar.HOUR_OF_DAY, 23);
|
||||
cal.set(Calendar.MINUTE, 59);
|
||||
cal.set(Calendar.SECOND, 59);
|
||||
cal.set(Calendar.MILLISECOND, 999);
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 过滤掉不在查询范围内的数据
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1211,7 +1211,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<!-- 数据库层面的时间范围过滤 - 修正跨区间租赁逻辑 -->
|
||||
AND (
|
||||
<!-- 已结算协议:租赁期间与查询区间有交集 -->
|
||||
(bai.is_slt = 1 AND (
|
||||
((bai.is_slt = 1 or bai.is_slt = 2) AND (
|
||||
<!-- 情况1:领料时间在查询区间内 -->
|
||||
(sai.start_time IS NOT NULL AND DATE(sai.start_time) >= #{startDate} AND DATE(sai.start_time) <= #{endDate})
|
||||
OR
|
||||
|
|
@ -1229,16 +1229,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<!-- 未结算协议:租赁期间与查询区间有交集 -->
|
||||
((bai.is_slt = 0 OR bai.is_slt IS NULL) AND (
|
||||
<!-- 情况1:领料时间在查询区间内 -->
|
||||
(sai.start_time IS NOT NULL AND DATE(sai.start_time) >= #{startDate} AND DATE(sai.start_time) <= #{endDate})
|
||||
(sai.start_time IS NOT NULL AND DATE(sai.start_time) >= #{startDate} AND DATE(sai.start_time) <= DATE(#{endDate}))
|
||||
OR
|
||||
<!-- 情况2:退料时间在查询区间内 -->
|
||||
(sai.end_time IS NOT NULL AND DATE(sai.end_time) >= #{startDate} AND DATE(sai.end_time) <= #{endDate})
|
||||
(sai.end_time IS NOT NULL AND DATE(sai.end_time) >= #{startDate} AND DATE(sai.end_time) <= DATE(#{endDate}))
|
||||
OR
|
||||
<!-- 情况3:跨区间租赁(领料在区间前,退料在区间后或未退料) -->
|
||||
(sai.start_time IS NOT NULL AND DATE(sai.start_time) < #{startDate} AND (sai.end_time IS NULL OR DATE(sai.end_time) > #{endDate}))
|
||||
(sai.start_time IS NOT NULL AND DATE(sai.start_time) < #{startDate} AND (sai.end_time IS NULL OR DATE(sai.end_time) > DATE(#{endDate})))
|
||||
OR
|
||||
<!-- 情况4:设备状态为在用(未退料)且领料时间不晚于查询结束时间 -->
|
||||
(sai.status = '0' AND sai.start_time IS NOT NULL AND DATE(sai.start_time) <= #{endDate})
|
||||
(sai.status = '0' AND sai.start_time IS NOT NULL AND DATE(sai.start_time) <= DATE(#{endDate}))
|
||||
))
|
||||
)
|
||||
</where>
|
||||
|
|
|
|||
Loading…
Reference in New Issue