bug修复

This commit is contained in:
hongchao 2025-03-21 09:19:53 +08:00
parent d144384267
commit bb3428c32f
5 changed files with 168 additions and 62 deletions

View File

@ -24,6 +24,8 @@ public interface RepairAuditDetailsMapper {
List<RepairPart> getPartDetailsByTaskId(RepairAuditDetails repairAuditDetails);
List<RepairPart> getPartRecordNum(RepairAuditDetails repairAuditDetails);
List<RepairRecord> getRepairRecord(RepairAuditDetails repairAuditDetails);
/**

View File

@ -150,14 +150,15 @@ public class RepairServiceImpl implements RepairService {
.map(RepairDeviceVO::getScrapNum)
.map(num -> Optional.ofNullable(num).orElse(BigDecimal.ZERO))
.reduce(BigDecimal.ZERO, BigDecimal::add);
// BigDecimal typeCostSum = tempList.stream().map(RepairDeviceVO::getTotalCost).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal typeCostSum = tempList.stream().map(RepairDeviceVO::getTotalCost).reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setRepairDeviceList(tempList)
.setIds(ids).setTypeRepairNum(repairNumSum).setTypeRepairedNum(repairedNumSum)
.setTypeScrapNum(scrapNumSum).setTaskId(tempList.get(0).getTaskId())
.setCode(tempList.get(0).getCode()).setTypeName(tempList.get(0).getTypeName())
.setTypeId(tempList.get(0).getTypeId()).setType(tempList.get(0).getType())
.setUnitName(tempList.get(0).getUnitName()).setManageType(tempList.get(0).getManageType());
// .setTypeCost(typeCostSum);
.setUnitName(tempList.get(0).getUnitName()).setManageType(tempList.get(0).getManageType())
.setTypeCost(typeCostSum);
repairDeviceSummaryVoList.add(vo);
}
}
@ -251,6 +252,10 @@ public class RepairServiceImpl implements RepairService {
List<RepairPart> repairPartList = repairAuditDetailsMapper.getPartDetailsByTaskId(new RepairAuditDetails().setTaskId(taskId));
repairPartList = mergePartsNum(repairPartList);
List<RepairPart> repairPartList2 = repairAuditDetailsMapper.getPartRecordNum(new RepairAuditDetails().setTaskId(taskId));
if(!repairPartList2.isEmpty()){
repairPartList.addAll(repairPartList2);
}
RepairTicketVo result = new RepairTicketVo().setRepairTaskInfo(repairTaskInfo)
.setRepairDeviceSummaryList(repairDeviceSummaryList)
.setRepairPartArray(Optional.of(repairPartList).orElse(Collections.emptyList()));
@ -599,8 +604,10 @@ public class RepairServiceImpl implements RepairService {
// 新增维修记录表
repairMapper.addRecord(repairApplyRecord);
}
sfCosts = countPartCosts(partList, sfCosts);
for (int i = 0; i < partList.size(); i++) {
sfCosts = sfCosts.add(partList.get(i).getPartPrice());
}
// sfCosts = countPartCosts(partList, sfCosts);
// TODO: 判断是否是收费配件因数据存在多条可能有些是免费配件 有些收费所以这里用价格统一做处理后续讨论
// SQL: 新增维修费用记录表
repairMapper.addRepairCost(repairApplyRecord, sfCosts, sfCosts.equals(BigDecimal.ZERO) ? "0" : "1");
@ -869,7 +876,7 @@ public class RepairServiceImpl implements RepairService {
throw new ServiceException("请选择返厂厂家");
}
repairApplyRecord.setSupplierId(partList.get(0).getSupplierId());
repairApplyRecord.setPartPrice(Optional.ofNullable(partList.get(0).getPartPrice()).orElse(BigDecimal.ZERO));
repairApplyRecord.setPartPrice(Optional.ofNullable(partList.get(0).getBackCost()).orElse(BigDecimal.ZERO));
// 新增维修记录表
repairMapper.addRecord(repairApplyRecord);

View File

@ -680,16 +680,22 @@ public class SltAgreementInfoController extends BaseController {
// @RequiresPermissions("settlement:info:export")
@SysLog(title = "结算信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出丢失费用明细")
@PostMapping("/exportLose")
public void exportLose(HttpServletResponse response, SltAgreementInfo sltAgreementInfo) {
public void exportLose(HttpServletResponse response, @RequestParam("params") String params) {
try {
String fileName = "丢失费用明细表";
String projectName = sltAgreementInfo.getProjectName();
String unitName = sltAgreementInfo.getUnitName();
BigDecimal totalCost = BigDecimal.valueOf(0.00);
List<SltAgreementInfo> sltAgreementInfo = JSONObject.parseArray(params,SltAgreementInfo.class);
List<String> projectNames = new ArrayList<>();
List<String> unitNames = new ArrayList<>();
List<SltAgreementInfo> loseList = new ArrayList<>();
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLoseList(sltAgreementInfo);
loseList.addAll(oneOfList);
for (SltAgreementInfo info : sltAgreementInfo) {
projectNames.add(info.getProjectName());
unitNames.add(info.getUnitName());
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLoseList(info);
loseList.addAll(oneOfList);
}
String projectName = handleData(projectNames);
String unitName = handleData(unitNames);
BigDecimal totalCost = BigDecimal.valueOf(0.00);
for (SltAgreementInfo bean : loseList) {
if (null == bean.getBuyPrice()) {
bean.setBuyPrice(BigDecimal.valueOf(0.00));
@ -722,25 +728,36 @@ public class SltAgreementInfoController extends BaseController {
// @RequiresPermissions("settlement:info:export")
@SysLog(title = "结算信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出维修费用明细")
@PostMapping("/exportRepair")
public void exportRepair(HttpServletResponse response,SltAgreementInfo sltAgreementInfo) {
public void exportRepair(HttpServletResponse response, @RequestParam("params") String params) {
try {
String fileName = "维修费用明细表";
String projectName = sltAgreementInfo.getProjectName();
String unitName = sltAgreementInfo.getUnitName();
List<SltAgreementInfo> sltAgreementInfo = JSONObject.parseArray(params,SltAgreementInfo.class);
List<String> projectNames = new ArrayList<>();
List<String> unitNames = new ArrayList<>();
BigDecimal totalCost = BigDecimal.valueOf(0.00);
List<SltAgreementInfo> repairList = new ArrayList<>();
List<TmTask> taskList = taskMapper.getTaskIdList(sltAgreementInfo);
if (null != taskList && !taskList.isEmpty()) {
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList);
repairList.addAll(repairDetailsList);
for (SltAgreementInfo info : sltAgreementInfo) {
projectNames.add(info.getProjectName());
unitNames.add(info.getUnitName());
List<TmTask> taskList = taskMapper.getTaskIdList(info);
if (null != taskList && !taskList.isEmpty()) {
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList);
repairList.addAll(repairDetailsList);
}
}
// List<TmTask> taskList = taskMapper.getTaskIdList(sltAgreementInfo);
// if (null != taskList && !taskList.isEmpty()) {
// List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList);
// repairList.addAll(repairDetailsList);
// }
for (SltAgreementInfo bean : repairList) {
if (bean.getCosts()!=null && (bean.getPartType().equals("收费"))) {
totalCost = totalCost.add(bean.getCosts());
}
}
String projectName = handleData(projectNames);
String unitName = handleData(unitNames);
List<SltLeaseInfo> repair = Convert.toList(SltLeaseInfo.class, repairList);
expOutExcel(response,repair,fileName,projectName,unitName,totalCost,3);
} catch (Exception e) {
@ -756,23 +773,37 @@ public class SltAgreementInfoController extends BaseController {
// @RequiresPermissions("settlement:info:export")
@SysLog(title = "结算信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出减免费用明细")
@PostMapping("/exportReduction")
public void exportReduction(HttpServletResponse response, SltAgreementInfo sltAgreementInfo) {
public void exportReduction(HttpServletResponse response, @RequestParam("params") String params) {
try {
String fileName = "减免费用明细表";
String projectName = sltAgreementInfo.getProjectName();
String unitName = sltAgreementInfo.getUnitName();
List<SltAgreementInfo> sltAgreementInfo = JSONObject.parseArray(params,SltAgreementInfo.class);
List<String> projectNames = new ArrayList<>();
List<String> unitNames = new ArrayList<>();
BigDecimal reductionCost = BigDecimal.valueOf(0.00);
List<SltAgreementReduce> reductionList = new ArrayList<>();
if (sltAgreementInfo.getAgreementId() != null){
SltAgreementReduce bean =new SltAgreementReduce();
bean.setAgreementId(sltAgreementInfo.getAgreementId());
reductionList = sltAgreementRecudceMapper.getReductionList(bean);
for (SltAgreementInfo info : sltAgreementInfo) {
projectNames.add(info.getProjectName());
unitNames.add(info.getUnitName());
if (info.getAgreementId() != null){
SltAgreementReduce bean =new SltAgreementReduce();
bean.setAgreementId(info.getAgreementId());
List<SltAgreementReduce> oneOfList = sltAgreementRecudceMapper.getReductionList(bean);
reductionList.addAll(oneOfList);
}
}
// if (sltAgreementInfo.getAgreementId() != null){
// SltAgreementReduce bean =new SltAgreementReduce();
// bean.setAgreementId(sltAgreementInfo.getAgreementId());
// reductionList = sltAgreementRecudceMapper.getReductionList(bean);
// }
for (SltAgreementReduce reduction : reductionList) {
if(reduction.getLeaseMoney()!=null){
reductionCost = reductionCost.add(reduction.getLeaseMoney());
}
}
String projectName = handleData(projectNames);
String unitName = handleData(unitNames);
List<SltLeaseInfo> repair = Convert.toList(SltLeaseInfo.class, reductionList);
expOutExcel(response,repair,fileName,projectName,unitName,reductionCost,5);
} catch (Exception e) {
@ -788,24 +819,37 @@ public class SltAgreementInfoController extends BaseController {
// @RequiresPermissions("settlement:info:export")
@SysLog(title = "报废信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出报废费用明细")
@PostMapping("/exportScrap")
public void exportScrap(HttpServletResponse response, SltAgreementInfo sltAgreementInfo) {
public void exportScrap(HttpServletResponse response, @RequestParam("params") String params) {
try {
String fileName = "报废费用明细表";
String projectName = sltAgreementInfo.getProjectName();
String unitName = sltAgreementInfo.getUnitName();
List<SltAgreementInfo> sltAgreementInfo = JSONObject.parseArray(params,SltAgreementInfo.class);
List<String> projectNames = new ArrayList<>();
List<String> unitNames = new ArrayList<>();
BigDecimal totalCost = BigDecimal.valueOf(0.00);
List<SltAgreementInfo> scrapList = new ArrayList<>();
List<TmTask> taskList = taskMapper.getTaskIdList(sltAgreementInfo);
if (null != taskList && !taskList.isEmpty()) {
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskList);
scrapList.addAll(scrapDetailsList);
for (SltAgreementInfo info : sltAgreementInfo) {
projectNames.add(info.getProjectName());
unitNames.add(info.getUnitName());
List<TmTask> taskList = taskMapper.getTaskIdList(info);
if (null != taskList && !taskList.isEmpty()) {
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskList);
scrapList.addAll(scrapDetailsList);
}
}
// List<TmTask> taskList = taskMapper.getTaskIdList(sltAgreementInfo);
// if (null != taskList && !taskList.isEmpty()) {
// List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskList);
// scrapList.addAll(scrapDetailsList);
// }
for (SltAgreementInfo bean : scrapList) {
if (bean.getCosts()!=null && (bean.getPartType().equals("收费"))) {
totalCost = totalCost.add(bean.getCosts());
}
}
String projectName = handleData(projectNames);
String unitName = handleData(unitNames);
List<SltLeaseInfo> scrap = Convert.toList(SltLeaseInfo.class, scrapList);
expOutExcel(response,scrap,fileName,projectName,unitName,totalCost,4);
} catch (Exception e) {
@ -948,17 +992,24 @@ public class SltAgreementInfoController extends BaseController {
@PreventRepeatSubmit
@SysLog(title = "结算记录查询", businessType = OperaType.EXPORT, logType = 1,module = "结算记录查询->导出全部结算费用明细")
@PostMapping("/exportAlls")
public void exportAlls(HttpServletResponse response, SltAgreementInfo sltAgreementInfo) {
public void exportAlls(HttpServletResponse response, @RequestParam("params") String params) {
try {
String fileName = "结算费用明细";
String projectName = sltAgreementInfo.getProjectName();
String unitName = sltAgreementInfo.getUnitName();
List<SltAgreementInfo> sltAgreementInfo = JSONObject.parseArray(params,SltAgreementInfo.class);
List<String> projectNames = new ArrayList<>();
List<String> unitNames = new ArrayList<>();
// String projectName = sltAgreementInfo.getProjectName();
// String unitName = sltAgreementInfo.getUnitName();
//租赁费用明细
BigDecimal totalCostLease = BigDecimal.valueOf(0.00);
List<SltAgreementInfo> leaseList = new ArrayList<>();
List<SltAgreementInfo> oneOfListLease = sltAgreementInfoMapper.getLeaseList(sltAgreementInfo);
leaseList.addAll(oneOfListLease);
for (SltAgreementInfo info : sltAgreementInfo) {
projectNames.add(info.getProjectName());
unitNames.add(info.getUnitName());
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseList(info);
leaseList.addAll(oneOfList);
}
for (SltAgreementInfo bean : leaseList) {
if (null == bean.getLeasePrice()) {
bean.setLeasePrice(BigDecimal.valueOf(0.00));
@ -984,8 +1035,11 @@ public class SltAgreementInfoController extends BaseController {
BigDecimal totalCostLose = BigDecimal.valueOf(0.00);
List<SltAgreementInfo> loseList = new ArrayList<>();
List<SltAgreementInfo> oneOfListLose = sltAgreementInfoMapper.getLoseList(sltAgreementInfo);
loseList.addAll(oneOfListLose);
for (SltAgreementInfo info : sltAgreementInfo) {
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLoseList(info);
loseList.addAll(oneOfList);
}
for (SltAgreementInfo bean : loseList) {
if (null == bean.getBuyPrice()) {
bean.setBuyPrice(BigDecimal.valueOf(0.00));
@ -1008,10 +1062,13 @@ public class SltAgreementInfoController extends BaseController {
//维修费用明细
BigDecimal totalCostRepair = BigDecimal.valueOf(0.00);
List<SltAgreementInfo> repairList = new ArrayList<>();
List<TmTask> taskListRepair = taskMapper.getTaskIdList(sltAgreementInfo);
if (null != taskListRepair && !taskListRepair.isEmpty()) {
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskListRepair);
repairList.addAll(repairDetailsList);
for (SltAgreementInfo info : sltAgreementInfo) {
List<TmTask> taskList = taskMapper.getTaskIdList(info);
if (null != taskList && !taskList.isEmpty()) {
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList);
repairList.addAll(repairDetailsList);
}
}
for (SltAgreementInfo bean : repairList) {
if (bean.getCosts()!=null && (bean.getPartType().equals("收费"))) {
@ -1023,11 +1080,14 @@ public class SltAgreementInfoController extends BaseController {
//报废费用明细
BigDecimal totalCostScrap = BigDecimal.valueOf(0.00);
List<SltAgreementInfo> scrapList = new ArrayList<>();
List<TmTask> taskListScrap = taskMapper.getTaskIdList(sltAgreementInfo);
if (null != taskListScrap && !taskListScrap.isEmpty()) {
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskListScrap);
scrapList.addAll(scrapDetailsList);
for (SltAgreementInfo info : sltAgreementInfo) {
List<TmTask> taskList = taskMapper.getTaskIdList(info);
if (null != taskList && !taskList.isEmpty()) {
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskList);
scrapList.addAll(scrapDetailsList);
}
}
for (SltAgreementInfo bean : scrapList) {
if (bean.getCosts()!=null && (bean.getPartType().equals("收费"))) {
totalCostScrap = totalCostScrap.add(bean.getCosts());
@ -1038,18 +1098,34 @@ public class SltAgreementInfoController extends BaseController {
//减免费用明细
BigDecimal totalCostReduction = BigDecimal.valueOf(0.00);
List<SltAgreementReduce> reductionList = new ArrayList<>();
if (sltAgreementInfo.getAgreementId()!=null){
SltAgreementReduce bean =new SltAgreementReduce();
bean.setAgreementId(sltAgreementInfo.getAgreementId());
reductionList = sltAgreementRecudceMapper.getReductionList(bean);
for (SltAgreementReduce reduction : reductionList){
if(reduction.getLeaseMoney()!=null){
totalCostReduction = totalCostReduction.add(reduction.getLeaseMoney());
}
// if (sltAgreementInfo.getAgreementId()!=null){
// SltAgreementReduce bean =new SltAgreementReduce();
// bean.setAgreementId(sltAgreementInfo.getAgreementId());
// reductionList = sltAgreementRecudceMapper.getReductionList(bean);
// for (SltAgreementReduce reduction : reductionList){
// if(reduction.getLeaseMoney()!=null){
// totalCostReduction = totalCostReduction.add(reduction.getLeaseMoney());
// }
// }
// }
for (SltAgreementInfo info : sltAgreementInfo) {
if (info.getAgreementId() != null){
SltAgreementReduce bean =new SltAgreementReduce();
bean.setAgreementId(info.getAgreementId());
List<SltAgreementReduce> oneOfList = sltAgreementRecudceMapper.getReductionList(bean);
reductionList.addAll(oneOfList);
}
}
for (SltAgreementReduce reduction : reductionList) {
if(reduction.getLeaseMoney()!=null){
totalCostReduction = totalCostReduction.add(reduction.getLeaseMoney());
}
}
List<SltLeaseInfo> reduction = Convert.toList(SltLeaseInfo.class, reductionList);
String projectName = handleData(projectNames);
String unitName = handleData(unitNames);
expOutExcelAlls(response,lease,lose,repair,scrap,reduction,fileName,projectName,unitName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap,totalCostReduction);
} catch (Exception e) {
log.error(e.toString(), e);

View File

@ -523,13 +523,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select
mpt.pa_name as partName,
rpd.part_num as partNum,
rpd.part_cost as partPrice,
mpt.buy_price as partPrice,
rpd.part_type as partType,
rpd.type_id as typeId,
mt.type_name as typeName,
mt1.type_name as maTypeName,
rpd.remark as remark,
rpd.repair_content as repairContent
rpd.repair_content as repairContent,
ROUND(IFNULL(rpd.part_num, 0) * IFNULL(mpt.buy_price, 0), 2) as partCost
from
repair_part_details rpd
left join ma_part_type mpt on mpt.pa_id = rpd.part_id
@ -548,6 +549,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="getPartRecordNum" resultType="com.bonus.material.repair.domain.RepairPart">
select
rar.part_name as partName,
rar.part_num as partNum,
0 as partPrice,
rar.part_price as partCost,
rar.type_id as typeId,
mt.type_name as typeName,
mt1.type_name as maTypeName
from repair_apply_record rar
left join ma_type mt on rar.type_id = mt.type_id and mt.del_flag = 0
left join ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = 0
where rar.part_type = 1 and rar.part_id is null
<if test="taskId != null and taskId != ''">
and rar.task_id = #{taskId}
</if>
</select>
<select id="getDetailsList" resultType="com.bonus.material.repair.domain.RepairAuditDetails">
SELECT
mt1.type_name as typeName,

View File

@ -389,7 +389,7 @@
rad.create_time,
bai.CODE AS backCode,
( SELECT COUNT(*) FROM repair_cost rc WHERE rc.repair_id = rad.id ) AS totalCostRecords,
( SELECT SUM( IFNULL( rc.costs, 0 )) FROM repair_cost rc WHERE rc.repair_id = rad.id ) AS totalCost
( SELECT COALESCE(SUM(rc.costs), 0) FROM repair_cost rc WHERE rc.repair_id = rad.id ) AS totalCost
from
repair_apply_details rad
left join ma_type mt on rad.type_id = mt.type_id