增加历史报表查询功能及相关服务实现
This commit is contained in:
parent
955c20af02
commit
c0664919d0
|
|
@ -16,23 +16,24 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.common.biz.config.ListPagingUtil;
|
||||
import com.bonus.common.biz.config.PoiOutPage;
|
||||
import com.bonus.common.biz.utils.RequestContext;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.ServletUtils;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.log.enums.OperatorType;
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.common.domain.dto.SelectDto;
|
||||
import com.bonus.material.settlement.domain.SltAgreementApply;
|
||||
import com.bonus.material.settlement.domain.SltAgreementReduce;
|
||||
import com.bonus.material.settlement.domain.SltAgreementRelation;
|
||||
import com.bonus.material.settlement.domain.*;
|
||||
import com.bonus.material.settlement.domain.vo.SltInfoVo;
|
||||
import com.bonus.material.settlement.domain.vo.SltLeaseInfo;
|
||||
import com.bonus.material.settlement.mapper.SltAgreementInfoMapper;
|
||||
import com.bonus.material.settlement.mapper.SltAgreementReduceMapper;
|
||||
import com.bonus.material.settlement.service.SltHistoryReportService;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||
import com.google.common.math.BigDecimalMath;
|
||||
|
|
@ -48,7 +49,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||
import com.bonus.material.settlement.domain.dto.PeriodCostQueryDto;
|
||||
import com.bonus.material.settlement.domain.vo.PeriodCostResultVo;
|
||||
import com.bonus.material.settlement.domain.vo.PeriodCostSummaryVo;
|
||||
|
|
@ -77,6 +77,8 @@ public class SltAgreementInfoController extends BaseController {
|
|||
@Resource
|
||||
private ISltAgreementInfoService sltAgreementInfoService;
|
||||
|
||||
private SltHistoryReportService sltHistoryReportService;
|
||||
|
||||
@Resource
|
||||
private SltAgreementInfoMapper sltAgreementInfoMapper;
|
||||
|
||||
|
|
@ -1580,6 +1582,128 @@ public class SltAgreementInfoController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询历史报表列表(按年月)
|
||||
*
|
||||
* @param yearMonth 年月 (格式: 2025-06)
|
||||
* @return 历史报表列表
|
||||
*/
|
||||
@GetMapping("/getHistoryReportList")
|
||||
public TableDataInfo getHistoryReportList(@RequestParam String yearMonth, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
// 参数验证
|
||||
if (StrUtil.isBlank(yearMonth)) {
|
||||
throw new ServiceException("年月参数不能为空");
|
||||
}
|
||||
|
||||
// 验证年月格式 (yyyy-MM)
|
||||
if (!yearMonth.matches("\\d{4}-\\d{2}")) {
|
||||
throw new ServiceException("年月格式错误,应为 yyyy-MM");
|
||||
}
|
||||
|
||||
startPage();
|
||||
|
||||
SltHistoryReport query = new SltHistoryReport();
|
||||
query.setYearMonth(yearMonth);
|
||||
List<SltHistoryReport> list = sltHistoryReportService.selectHistoryReportList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询历史租赁费用详情
|
||||
*
|
||||
* @param agreementId 协议ID
|
||||
* @param yearMonth 年月 (格式: 2025-06)
|
||||
* @return 历史租赁费用详情列表
|
||||
*/
|
||||
@GetMapping("/getHistoryLeaseCostDetails")
|
||||
public TableDataInfo getHistoryLeaseCostDetails(@RequestParam String agreementId, @RequestParam String yearMonth) {
|
||||
// 参数验证
|
||||
if (StrUtil.isBlank(agreementId)) {
|
||||
throw new ServiceException("协议ID不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(yearMonth)) {
|
||||
throw new ServiceException("年月参数不能为空");
|
||||
}
|
||||
|
||||
SltHistoryReportDetail query = new SltHistoryReportDetail();
|
||||
query.setAgreementId(agreementId);
|
||||
query.setYearMonth(yearMonth);
|
||||
|
||||
List<SltHistoryReportDetail> list = sltHistoryReportService.selectHistoryLeaseCostDetails(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询历史维修费用详情
|
||||
*
|
||||
* @param agreementId 协议ID
|
||||
* @param yearMonth 年月 (格式: 2025-06)
|
||||
* @return 历史维修费用详情列表
|
||||
*/
|
||||
@GetMapping("/getHistoryRepairCostDetails")
|
||||
public TableDataInfo getHistoryRepairCostDetails(@RequestParam String agreementId, @RequestParam String yearMonth) {
|
||||
// 参数验证
|
||||
if (StrUtil.isBlank(agreementId)) {
|
||||
throw new ServiceException("协议ID不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(yearMonth)) {
|
||||
throw new ServiceException("年月参数不能为空");
|
||||
}
|
||||
|
||||
SltHistoryReportDetail query = new SltHistoryReportDetail();
|
||||
query.setAgreementId(agreementId);
|
||||
query.setYearMonth(yearMonth);
|
||||
|
||||
List<SltHistoryReportDetail> list = sltHistoryReportService.selectHistoryRepairCostDetails(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询历史丢失费用详情
|
||||
*
|
||||
* @return 历史丢失费用详情列表
|
||||
*/
|
||||
@GetMapping("/getHistoryLoseCostDetails")
|
||||
public TableDataInfo getHistoryLoseCostDetails(SltHistoryReportDetail query) {
|
||||
// 参数验证
|
||||
if (query.getAgreementId() == null || query.getAgreementId().trim().isEmpty()) {
|
||||
throw new ServiceException("协议ID不能为空");
|
||||
}
|
||||
if (query.getYearMonth() == null || query.getYearMonth().trim().isEmpty()) {
|
||||
throw new ServiceException("年月参数不能为空");
|
||||
}
|
||||
|
||||
List<SltHistoryReportDetail> list = sltHistoryReportService.selectHistoryLoseCostDetails(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询历史报废费用详情
|
||||
*
|
||||
* @param agreementId 协议ID
|
||||
* @param yearMonth 年月 (格式: 2025-06)
|
||||
* @return 历史报废费用详情列表
|
||||
*/
|
||||
@GetMapping("/getHistoryScrapCostDetails")
|
||||
public TableDataInfo getHistoryScrapCostDetails(@RequestParam String agreementId, @RequestParam String yearMonth) {
|
||||
if (StrUtil.isBlank(agreementId)) {
|
||||
throw new ServiceException("协议ID不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(yearMonth)) {
|
||||
throw new ServiceException("年月参数不能为空");
|
||||
}
|
||||
|
||||
SltHistoryReportDetail query = new SltHistoryReportDetail();
|
||||
query.setAgreementId(agreementId);
|
||||
query.setYearMonth(yearMonth);
|
||||
|
||||
List<SltHistoryReportDetail> list = sltHistoryReportService.selectHistoryScrapCostDetails(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 进行结算审批
|
||||
*/
|
||||
|
|
@ -1870,4 +1994,6 @@ public class SltAgreementInfoController extends BaseController {
|
|||
FileUtils.deleteDirectory(new File(tempDir));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
package com.bonus.material.settlement.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 结算历史报表对象 slt_history_report
|
||||
*
|
||||
* @author syruan
|
||||
*/
|
||||
@Data
|
||||
public class SltHistoryReport {
|
||||
|
||||
private String id;
|
||||
private String agreementId;
|
||||
private String agreementCode;
|
||||
private String unitId;
|
||||
private String unitName;
|
||||
private String projectId;
|
||||
private String projectName;
|
||||
private Integer settlementType;
|
||||
private BigDecimal leaseCost;
|
||||
private BigDecimal repairCost;
|
||||
private BigDecimal loseCost;
|
||||
private BigDecimal scrapCost;
|
||||
private BigDecimal reductionCost;
|
||||
private String yearMonth;
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.bonus.material.settlement.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 结算历史报表明细对象 slt_history_report_detail
|
||||
*/
|
||||
@Data
|
||||
public class SltHistoryReportDetail {
|
||||
|
||||
private String id;
|
||||
private String agreementId;
|
||||
private String typeName;
|
||||
private String modelName;
|
||||
private String mtUnitName;
|
||||
private BigDecimal leasePrice;
|
||||
private Integer num;
|
||||
private Integer backNum;
|
||||
private LocalDate startTime;
|
||||
private LocalDate endTime;
|
||||
private Integer leaseDays;
|
||||
private String partType;
|
||||
private Integer costType;
|
||||
private BigDecimal costs;
|
||||
private String yearMonth;
|
||||
|
||||
}
|
||||
|
|
@ -7,9 +7,7 @@ import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
|||
import com.bonus.material.common.domain.vo.AgreementVo;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.repair.domain.RepairApplyDetails;
|
||||
import com.bonus.material.settlement.domain.SltAgreementApply;
|
||||
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||
import com.bonus.material.settlement.domain.SltAgreementRelation;
|
||||
import com.bonus.material.settlement.domain.*;
|
||||
import com.bonus.material.settlement.domain.vo.SltInfoVo;
|
||||
import com.bonus.material.settlement.domain.dto.PeriodCostQueryDto;
|
||||
import com.bonus.material.settlement.domain.vo.PeriodCostResultVo;
|
||||
|
|
@ -19,11 +17,20 @@ import org.apache.ibatis.annotations.Param;
|
|||
/**
|
||||
* 结算信息Mapper接口
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-10-16
|
||||
* @author syruan
|
||||
*/
|
||||
public interface SltAgreementInfoMapper {
|
||||
|
||||
List<SltHistoryReport> selectSltHistoryReportList(SltHistoryReport sltHistoryReport);
|
||||
|
||||
List<SltHistoryReportDetail> selectSltHistoryLeaseDetail(SltHistoryReportDetail sltHistoryReportDetail);
|
||||
|
||||
List<SltHistoryReportDetail> selectSltHistoryScrapDetail(SltHistoryReportDetail sltHistoryReportDetail);
|
||||
|
||||
List<SltHistoryReportDetail> selectSltHistoryLoseDetail(SltHistoryReportDetail sltHistoryReportDetail);
|
||||
|
||||
List<SltHistoryReportDetail> selectSltHistoryRepairDetail(SltHistoryReportDetail sltHistoryReportDetail);
|
||||
|
||||
/**
|
||||
* 根据协议ID+结算类型去更新对应的费用明细
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.bonus.material.settlement.service;
|
||||
|
||||
import com.bonus.material.settlement.domain.SltHistoryReport;
|
||||
import com.bonus.material.settlement.domain.SltHistoryReportDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SltHistoryReportService {
|
||||
|
||||
/**
|
||||
* 查询历史报表列表
|
||||
*/
|
||||
List<SltHistoryReport> selectHistoryReportList(SltHistoryReport report);
|
||||
|
||||
/**
|
||||
* 查询历史租赁费用详情
|
||||
*/
|
||||
List<SltHistoryReportDetail> selectHistoryLeaseCostDetails(SltHistoryReportDetail record);
|
||||
|
||||
/**
|
||||
* 查询历史维修费用详情
|
||||
*/
|
||||
List<SltHistoryReportDetail> selectHistoryRepairCostDetails(SltHistoryReportDetail record);
|
||||
|
||||
/**
|
||||
* 查询历史丢失费用详情
|
||||
*/
|
||||
List<SltHistoryReportDetail> selectHistoryLoseCostDetails(SltHistoryReportDetail record);
|
||||
|
||||
/**
|
||||
* 查询历史报废费用详情
|
||||
*/
|
||||
List<SltHistoryReportDetail> selectHistoryScrapCostDetails(SltHistoryReportDetail record);
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.bonus.material.settlement.service.impl;
|
||||
|
||||
import com.bonus.material.settlement.domain.SltHistoryReport;
|
||||
import com.bonus.material.settlement.domain.SltHistoryReportDetail;
|
||||
import com.bonus.material.settlement.mapper.SltAgreementInfoMapper;
|
||||
import com.bonus.material.settlement.service.SltHistoryReportService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SltHistoryReportServiceImpl implements SltHistoryReportService {
|
||||
|
||||
@Autowired
|
||||
private SltAgreementInfoMapper sltAgreementInfoMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<SltHistoryReport> selectHistoryReportList(SltHistoryReport report) {
|
||||
return sltAgreementInfoMapper.selectSltHistoryReportList(report);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SltHistoryReportDetail> selectHistoryLeaseCostDetails(SltHistoryReportDetail record) {
|
||||
return sltAgreementInfoMapper.selectSltHistoryLeaseDetail(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SltHistoryReportDetail> selectHistoryRepairCostDetails(SltHistoryReportDetail record) {
|
||||
return sltAgreementInfoMapper.selectSltHistoryRepairDetail(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SltHistoryReportDetail> selectHistoryLoseCostDetails(SltHistoryReportDetail record) {
|
||||
return sltAgreementInfoMapper.selectSltHistoryLoseDetail(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SltHistoryReportDetail> selectHistoryScrapCostDetails(SltHistoryReportDetail record) {
|
||||
return sltAgreementInfoMapper.selectSltHistoryScrapDetail(record);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1470,4 +1470,123 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN bm_project bp on bp.pro_id = bai.project_id
|
||||
where bai.agreement_id = #{agreementId}
|
||||
</select>
|
||||
|
||||
<select id="selectSltHistoryLeaseDetail" resultType="com.bonus.material.settlement.domain.SltHistoryReportDetail">
|
||||
SELECT
|
||||
id,
|
||||
agreement_id as agreementId,
|
||||
type_name as typeName,
|
||||
model_name as modelName,
|
||||
mt_unit_name as mtUnitName,
|
||||
lease_price as leasePrice,
|
||||
num,
|
||||
back_num as backNum,
|
||||
start_time as startTime,
|
||||
end_time as endTime,
|
||||
lease_days as leaseDays,
|
||||
part_type as partType,
|
||||
cost_type as costType,
|
||||
costs,
|
||||
`year_month`
|
||||
FROM
|
||||
slt_history_report_detail
|
||||
WHERE
|
||||
agreement_id = #{agreementId} AND `year_month` = #{yearMonth} and cost_type = 1
|
||||
ORDER BY id
|
||||
</select>
|
||||
|
||||
<select id="selectSltHistoryScrapDetail" resultType="com.bonus.material.settlement.domain.SltHistoryReportDetail">
|
||||
SELECT
|
||||
id,
|
||||
agreement_id as agreementId,
|
||||
type_name as typeName,
|
||||
model_name as modelName,
|
||||
mt_unit_name as mtUnitName,
|
||||
lease_price as leasePrice,
|
||||
num,
|
||||
back_num as backNum,
|
||||
start_time as startTime,
|
||||
end_time as endTime,
|
||||
lease_days as leaseDays,
|
||||
part_type as partType,
|
||||
cost_type as costType,
|
||||
costs,
|
||||
`year_month`
|
||||
FROM
|
||||
slt_history_report_detail
|
||||
WHERE
|
||||
agreement_id = #{agreementId} AND `year_month` = #{yearMonth} and cost_type = 4
|
||||
ORDER BY id
|
||||
</select>
|
||||
|
||||
<select id="selectSltHistoryLoseDetail" resultType="com.bonus.material.settlement.domain.SltHistoryReportDetail">
|
||||
SELECT
|
||||
id,
|
||||
agreement_id as agreementId,
|
||||
type_name as typeName,
|
||||
model_name as modelName,
|
||||
mt_unit_name as mtUnitName,
|
||||
lease_price as leasePrice,
|
||||
num,
|
||||
back_num as backNum,
|
||||
start_time as startTime,
|
||||
end_time as endTime,
|
||||
lease_days as leaseDays,
|
||||
part_type as partType,
|
||||
cost_type as costType,
|
||||
costs,
|
||||
`year_month`
|
||||
FROM
|
||||
slt_history_report_detail
|
||||
WHERE
|
||||
agreement_id = #{agreementId} AND `year_month` = #{yearMonth} and cost_type = 3
|
||||
ORDER BY id
|
||||
</select>
|
||||
|
||||
<select id="selectSltHistoryRepairDetail" resultType="com.bonus.material.settlement.domain.SltHistoryReportDetail">
|
||||
SELECT
|
||||
id,
|
||||
agreement_id as agreementId,
|
||||
type_name as typeName,
|
||||
model_name as modelName,
|
||||
mt_unit_name as mtUnitName,
|
||||
lease_price as leasePrice,
|
||||
num,
|
||||
back_num as backNum,
|
||||
start_time as startTime,
|
||||
end_time as endTime,
|
||||
lease_days as leaseDays,
|
||||
part_type as partType,
|
||||
cost_type as costType,
|
||||
costs,
|
||||
`year_month`
|
||||
FROM
|
||||
slt_history_report_detail
|
||||
WHERE
|
||||
agreement_id = #{agreementId} AND `year_month` = #{yearMonth} and cost_type = 2
|
||||
ORDER BY id
|
||||
</select>
|
||||
|
||||
<select id="selectSltHistoryReportList" resultType="com.bonus.material.settlement.domain.SltHistoryReport">
|
||||
SELECT
|
||||
id,
|
||||
agreement_id as agreementId,
|
||||
agreement_code as agreementCode,
|
||||
unit_id as unitId,
|
||||
unit_name as unitName,
|
||||
project_id as projectId,
|
||||
project_name as projectName,
|
||||
settlement_type as settlementType,
|
||||
lease_cost as leaseCost,
|
||||
repair_cost as repairCost,
|
||||
lose_cost as loseCost,
|
||||
scrap_cost as scrapCost,
|
||||
reduction_cost as reductionCost,
|
||||
`year_month` as yearMonth,
|
||||
create_time as createTime
|
||||
FROM slt_history_report
|
||||
WHERE `year_month` = #{yearMonth}
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{pageNum}, #{pageSize}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue