Merge remote-tracking branch 'origin/master'

This commit is contained in:
mashuai 2025-11-06 12:17:02 +08:00
commit 78322f8e31
5 changed files with 294 additions and 7 deletions

View File

@ -1123,4 +1123,287 @@ public class ClzSltAgreementInfoController extends BaseController {
}
/**
* 导出租赁明细
*/
@ApiOperation(value = "导出材料站结算信息列表")
@PreventRepeatSubmit
@SysLog(title = "结算审核", businessType = OperaType.EXPORT, logType = 1,module = "结算管理->导出材料站租赁明细")
@PostMapping("/exportLeaseReview")
public void exportLeaseReview(HttpServletResponse response, @RequestParam("params") String params) {
try {
// 1. 修正先将 params 解析为 JSON 对象而非数组
JSONObject paramObj = JSONObject.parseObject(params);
String sltApplyCode = paramObj.getString("sltApplyCode");
// 2. 根据实际需求从 JSON 对象中提取数据示例提取 unitIds projectId
Long unitId = paramObj.getLong("unitId");
Long projectId = paramObj.getLong("projectId");
List<Integer> unitIds = Arrays.asList(Math.toIntExact(unitId));
List<MaterialSltAgreementInfo> leaseListAll = new ArrayList<>();
BigDecimal totalCost = BigDecimal.valueOf(0.00);
List<String> projectNames = new ArrayList<>();
List<String> unitNames = new ArrayList<>();
List<String> actualTimeAndNames = new ArrayList<>();
// 查询协议号
List<AgreementVo> agreementInfos = clzSltAgreementInfoMapper.getAgreementInfoById(unitIds, Math.toIntExact(projectId));
// 过滤异常数据
agreementInfos.removeIf(Objects::isNull);
// 查询每个协议的待结算明细
if (CollectionUtils.isNotEmpty(agreementInfos)) {
for (AgreementVo agreementInfo : agreementInfos) {
// 数据检查
if (agreementInfo.getAgreementId() == null || agreementInfo.getAgreementId() <= 0) {
throw new ServiceException("协议ID为空请反馈至管理员");
}
if (org.apache.commons.lang3.StringUtils.isBlank(agreementInfo.getAgreementCode())) {
throw new ServiceException("协议号为空,请检查!");
}
// 进行Bean的类型转换使其适配Mapper
MaterialSltAgreementInfo sltAgreementInfo = new MaterialSltAgreementInfo();
BeanUtil.copyProperties(agreementInfo, sltAgreementInfo, true);
sltAgreementInfo.setSltApplyCode(sltApplyCode);
List<MaterialSltAgreementInfo> oneOfList = clzSltAgreementInfoMapper.getSltLeaseList(sltAgreementInfo);
if(!oneOfList.isEmpty()){
actualTimeAndNames.add(oneOfList.get(0).getUnitName() + "(" + oneOfList.get(0).getActualExitTime()+")");
projectNames.add(oneOfList.get(0).getProjectName());
unitNames.add(oneOfList.get(0).getUnitName());
}
List<MaterialSltAgreementInfo> leaseList = new ArrayList<>(oneOfList);
for (MaterialSltAgreementInfo bean : leaseList) {
// 数据安全检查
if (null == bean.getLeasePrice()) {
bean.setLeasePrice(BigDecimal.ZERO);
} else {
bean.setLeasePrice(bean.getLeasePrice().setScale(GlobalConstants.INT_2, RoundingMode.HALF_UP));
}
if (Objects.isNull(bean.getNum())) {
bean.setNum(BigDecimal.ZERO);
}
if (Objects.isNull(bean.getLeaseDays())) {
bean.setLeaseDay(0L);
}
totalCost = totalCost.add(bean.getCosts());
leaseListAll.add(bean);
}
}
}
String fileName = "租赁(超期)费用明细表";
String projectName = handleData(projectNames);
String unitName = handleData(unitNames);
String actualTimeAndName = handleData(actualTimeAndNames);
expOutExcel(response,leaseListAll,fileName,projectName,unitName,actualTimeAndName,totalCost,1);
} catch (Exception e) {
log.error(e.toString(), e);
}
}
/**
* 导出丢失明细
*/
@ApiOperation(value = "导出材料站结算信息列表")
@PreventRepeatSubmit
@SysLog(title = "结算审核", businessType = OperaType.EXPORT, logType = 1,module = "结算管理->导出材料站丢失明细")
@PostMapping("/exportLoseReview")
public void exportLoseReview(HttpServletResponse response, @RequestParam("params") String params) {
try {
// 1. 修正先将 params 解析为 JSON 对象而非数组
JSONObject paramObj = JSONObject.parseObject(params);
String sltApplyCode = paramObj.getString("sltApplyCode");
// 2. 根据实际需求从 JSON 对象中提取数据示例提取 unitIds projectId
Long unitId = paramObj.getLong("unitId");
Long projectId = paramObj.getLong("projectId");
List<Integer> unitIds = Arrays.asList(Math.toIntExact(unitId));
List<MaterialSltAgreementInfo> loseListAll = new ArrayList<>();
BigDecimal totalCost = BigDecimal.valueOf(0.00);
List<String> projectNames = new ArrayList<>();
List<String> unitNames = new ArrayList<>();
List<String> actualTimeAndNames = new ArrayList<>();
// 查询协议号
List<AgreementVo> agreementInfos = clzSltAgreementInfoMapper.getAgreementInfoById(unitIds, Math.toIntExact(projectId));
// 过滤异常数据
agreementInfos.removeIf(Objects::isNull);
// 查询每个协议的待结算明细
if (CollectionUtils.isNotEmpty(agreementInfos)) {
for (AgreementVo agreementInfo : agreementInfos) {
// 数据检查
if (agreementInfo.getAgreementId() == null || agreementInfo.getAgreementId() <= 0) {
throw new ServiceException("协议ID为空请反馈至管理员");
}
if (org.apache.commons.lang3.StringUtils.isBlank(agreementInfo.getAgreementCode())) {
throw new ServiceException("协议号为空,请检查!");
}
// 进行Bean的类型转换使其适配Mapper
MaterialSltAgreementInfo sltAgreementInfo = new MaterialSltAgreementInfo();
BeanUtil.copyProperties(agreementInfo, sltAgreementInfo, true);
sltAgreementInfo.setSltApplyCode(sltApplyCode);
// 获取未退还的物资原有逻辑
List<MaterialSltAgreementInfo> loseList = clzSltAgreementInfoMapper.getSltLoseList(sltAgreementInfo);
if(!loseList.isEmpty()){
actualTimeAndNames.add(loseList.get(0).getUnitName() + "(" + loseList.get(0).getActualExitTime()+")");
projectNames.add(loseList.get(0).getProjectName());
unitNames.add(loseList.get(0).getUnitName());
}
for (MaterialSltAgreementInfo bean : loseList) {
if (Objects.isNull(bean.getBuyPrice())) {
bean.setBuyPrice(BigDecimal.ZERO);
}
if (Objects.isNull(bean.getNum())) {
bean.setNum(BigDecimal.ZERO);
}
totalCost = totalCost.add(bean.getCosts());
loseListAll.add(bean);
}
}
}
String fileName = "未归还费用明细表";
String projectName = handleData(projectNames);
String unitName = handleData(unitNames);
String actualTimeAndName = handleData(actualTimeAndNames);
expOutExcel(response,loseListAll,fileName,projectName,unitName,actualTimeAndName,totalCost,2);
} catch (Exception e) {
log.error(e.toString(), e);
}
}
/**
* 导出结算信息列表--all
*/
@ApiOperation(value = "导出结算信息列表")
@PreventRepeatSubmit
// @RequiresPermissions("settlement:info:export")
@SysLog(title = "结算审核", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出全部费用明细")
@PostMapping("/exportAllReview")
public void exportAllReview(HttpServletResponse response, @RequestParam("params") String params) {
try {
String fileName = "结算费用明细";
JSONObject paramObj = JSONObject.parseObject(params);
String sltApplyCode = paramObj.getString("sltApplyCode");
Long unitId = paramObj.getLong("unitId");
Long projectId = paramObj.getLong("projectId");
List<Integer> unitIds = Arrays.asList(Math.toIntExact(unitId));
List<MaterialSltAgreementInfo> leaseListAll = new ArrayList<>();
List<MaterialSltAgreementInfo> loseListAll = new ArrayList<>();
List<MaterialSltAgreementInfo> repairListAll = new ArrayList<>();
List<MaterialSltAgreementInfo> scrapListAll = new ArrayList<>();
List<MaterialSltAgreementInfo> reductionListAll = new ArrayList<>();
List<MaterialSltAgreementInfo> listAll = new ArrayList<>();
BigDecimal totalCost = BigDecimal.valueOf(0.00);
List<String> projectNames = new ArrayList<>();
List<String> unitNames = new ArrayList<>();
List<String> actualTimeAndNames = new ArrayList<>();
//各费用明细
BigDecimal totalCostLease = BigDecimal.valueOf(0.00);
BigDecimal totalCostLose = BigDecimal.valueOf(0.00);
BigDecimal totalCostRepair = BigDecimal.valueOf(0.00);
BigDecimal totalCostScrap = BigDecimal.valueOf(0.00);
BigDecimal totalCostReduction = BigDecimal.valueOf(0.00);
// 查询协议号
List<AgreementVo> agreementInfos = clzSltAgreementInfoMapper.getAgreementInfoById(unitIds, Math.toIntExact(projectId));
// 过滤异常数据
agreementInfos.removeIf(Objects::isNull);
// 查询每个协议的待结算明细
if (CollectionUtils.isNotEmpty(agreementInfos)) {
for (AgreementVo agreementInfo : agreementInfos) {
// 数据检查
if (agreementInfo.getAgreementId() == null || agreementInfo.getAgreementId() <= 0) {
throw new ServiceException("协议ID为空请反馈至管理员");
}
if (org.apache.commons.lang3.StringUtils.isBlank(agreementInfo.getAgreementCode())) {
throw new ServiceException("协议号为空,请检查!");
}
//租赁
// 进行Bean的类型转换使其适配Mapper
MaterialSltAgreementInfo sltAgreementInfoLease = new MaterialSltAgreementInfo();
BeanUtil.copyProperties(agreementInfo, sltAgreementInfoLease, true);
sltAgreementInfoLease.setSltApplyCode(sltApplyCode);
List<MaterialSltAgreementInfo> oneOfListLease = clzSltAgreementInfoMapper.getSltLeaseList(sltAgreementInfoLease);
if(!oneOfListLease.isEmpty()){
actualTimeAndNames.add(oneOfListLease.get(0).getUnitName() + "(" + oneOfListLease.get(0).getActualExitTime()+")");
projectNames.add(oneOfListLease.get(0).getProjectName());
unitNames.add(oneOfListLease.get(0).getUnitName());
}
List<MaterialSltAgreementInfo> leaseList = new ArrayList<>(oneOfListLease);
for (MaterialSltAgreementInfo bean : leaseList) {
// 数据安全检查
if (null == bean.getLeasePrice()) {
bean.setLeasePrice(BigDecimal.ZERO);
} else {
bean.setLeasePrice(bean.getLeasePrice().setScale(GlobalConstants.INT_2, RoundingMode.HALF_UP));
}
if (Objects.isNull(bean.getNum())) {
bean.setNum(BigDecimal.ZERO);
}
if (Objects.isNull(bean.getLeaseDays())) {
bean.setLeaseDay(0L);
}
totalCostLease = totalCostLease.add(bean.getCosts());
leaseListAll.add(bean);
listAll.add(bean);
}
//丢失
// 进行Bean的类型转换使其适配Mapper
MaterialSltAgreementInfo sltAgreementInfoLose = new MaterialSltAgreementInfo();
BeanUtil.copyProperties(agreementInfo, sltAgreementInfoLose, true);
sltAgreementInfoLose.setSltApplyCode(sltApplyCode);
// 获取未退还的物资原有逻辑
List<MaterialSltAgreementInfo> oneOfListLose = clzSltAgreementInfoMapper.getSltLoseList(sltAgreementInfoLose);
List<MaterialSltAgreementInfo> loseList = new ArrayList<>(oneOfListLose);
for (MaterialSltAgreementInfo bean : loseList) {
if (Objects.isNull(bean.getBuyPrice())) {
bean.setBuyPrice(BigDecimal.ZERO);
}
if (Objects.isNull(bean.getNum())) {
bean.setNum(BigDecimal.ZERO);
}
totalCostLose = totalCostLose.add(bean.getCosts());
loseListAll.add(bean);
listAll.add(bean);
}
}
}
String projectName = handleData(projectNames);
String unitName = handleData(unitNames);
String actualTimeAndName = handleData(actualTimeAndNames);
expOutExcelAll(response,leaseListAll,loseListAll,repairListAll,scrapListAll,reductionListAll,fileName,projectName,unitName,actualTimeAndName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap,totalCostReduction);
} catch (Exception e) {
log.error(e.toString(), e);
}
}
}

View File

@ -98,7 +98,7 @@ public class ClzDirectApplyInfo extends BaseEntity {
@Excel(name = "物资类型")
private String typeName;
@Excel(name = "状态", readConverterExp = "0=待审核1=审核中2=已完成3=已驳回4= 待提交")
@Excel(name = "状态", readConverterExp = "0=待审核,1=审核中,2=已完成,3=已驳回,4=待提交")
private Integer status;
@ApiModelProperty(value = "审核人")

View File

@ -281,12 +281,15 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
MaterialSltInfoVo sltInfoVo = new MaterialSltInfoVo();
if(!CollectionUtils.isEmpty(leaseList)){
sltInfoVo.setActualExitTime(leaseList.get(0).getActualExitTime());
}
sltInfoVo.setLeaseList(leaseList);
sltInfoVo.setRepairList(repairList);
sltInfoVo.setScrapList(scrapList);
sltInfoVo.setLoseList(loseList);
resultVoList.add(sltInfoVo);
// 给外层的单位名称/工程名称赋值
extractInnerNameToOuter(resultVoList, sltInfoVo);
// 查询各项费用列表
// List<MaterialSltAgreementInfo> sltedList = clzSltAgreementInfoMapper.getSltedList(info);
@ -345,8 +348,6 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
//
// resultVoList.add(sltInfoVo);
//
// // 给外层的单位名称/工程名称赋值
// extractInnerNameToOuter(resultVoList, sltInfoVo);
//
// });
// }

View File

@ -511,7 +511,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
saa.id as id, bai.agreement_id as agreementId, bai.agreement_code as agreementCode, saa.`code` as sltApplyCode,
bui.unit_id as unitId, bui.unit_name as unitName, bp.pro_id as projectId, bp.pro_name as projectName,
saa.remark, sad.money as costs, saa.audit_time as auditTime, sad.start_time as startTime, sad.end_time as endTime,
saa.`status` as sltStatus, sad.slt_type as sltType, sad.num, sad.price as leasePrice,
sad.out_time as actualExitTime,
saa.`status` as sltStatus, sad.slt_type as sltType, sad.num, sad.price as buyPrice,
mt1.type_name as typeName, mt.type_name as modelName, mt.unit_name as mtUnitName
FROM
clz_slt_agreement_apply saa
@ -529,6 +530,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
saa.id as id, bai.agreement_id as agreementId, bai.agreement_code as agreementCode, saa.`code` as sltApplyCode,
bui.unit_id as unitId, bui.unit_name as unitName, bp.pro_id as projectId, bp.pro_name as projectName,
saa.remark, sad.money as costs, saa.audit_time as auditTime, sad.start_time as startTime, sad.end_time as endTime,
DATEDIFF(IF(sad.end_time is null,CURDATE(),sad.end_time), sad.start_time) + 1 as leaseDays,bp.external_id as wsProId,
sad.out_time as actualExitTime,sad.over_day as overDay,DATE_ADD(sad.out_time, INTERVAL 7 DAY) as overTime,
saa.`status` as sltStatus, sad.slt_type as sltType, sad.num, sad.price as leasePrice,
mt1.type_name as typeName, mt.type_name as modelName, mt.unit_name as mtUnitName
FROM

View File

@ -1619,7 +1619,7 @@
left join bm_project bp on bp.pro_id = bai.project_id
left join ma_type mt1 on mt1.type_id = rpd.type_id
left join ma_type mt2 on mt2.type_id = mt1.parent_id
left join ma_machine mm on mm.ma_id = rpd.ma_id
left join ma_machine mm on mm.ma_id = rpd.ma_id and mt1.manage_type = 0
left join ma_part_type mpt1 on mpt1.pa_id = rpd.part_id
left join ma_part_type mpt2 on mpt2.pa_id = mpt1.parent_id
left join sys_user su on (