diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java index 18bf5b9b..39625cf6 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java @@ -24,6 +24,8 @@ public interface RepairAuditDetailsMapper { List getPartDetailsByTaskId(RepairAuditDetails repairAuditDetails); + List getPartRecordNum(RepairAuditDetails repairAuditDetails); + List getRepairRecord(RepairAuditDetails repairAuditDetails); /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java index 43992b2e..1a855783 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java @@ -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 repairPartList = repairAuditDetailsMapper.getPartDetailsByTaskId(new RepairAuditDetails().setTaskId(taskId)); repairPartList = mergePartsNum(repairPartList); + List 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); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java index b05698f1..e4ecd664 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java @@ -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 = JSONObject.parseArray(params,SltAgreementInfo.class); + List projectNames = new ArrayList<>(); + List unitNames = new ArrayList<>(); List loseList = new ArrayList<>(); - - List oneOfList = sltAgreementInfoMapper.getLoseList(sltAgreementInfo); - loseList.addAll(oneOfList); + for (SltAgreementInfo info : sltAgreementInfo) { + projectNames.add(info.getProjectName()); + unitNames.add(info.getUnitName()); + List 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 = JSONObject.parseArray(params,SltAgreementInfo.class); + List projectNames = new ArrayList<>(); + List unitNames = new ArrayList<>(); BigDecimal totalCost = BigDecimal.valueOf(0.00); List repairList = new ArrayList<>(); - - List taskList = taskMapper.getTaskIdList(sltAgreementInfo); - if (null != taskList && !taskList.isEmpty()) { - List repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList); - repairList.addAll(repairDetailsList); + for (SltAgreementInfo info : sltAgreementInfo) { + projectNames.add(info.getProjectName()); + unitNames.add(info.getUnitName()); + List taskList = taskMapper.getTaskIdList(info); + if (null != taskList && !taskList.isEmpty()) { + List repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList); + repairList.addAll(repairDetailsList); + } } +// List taskList = taskMapper.getTaskIdList(sltAgreementInfo); +// if (null != taskList && !taskList.isEmpty()) { +// List 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 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 = JSONObject.parseArray(params,SltAgreementInfo.class); + List projectNames = new ArrayList<>(); + List unitNames = new ArrayList<>(); BigDecimal reductionCost = BigDecimal.valueOf(0.00); List 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 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 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 = JSONObject.parseArray(params,SltAgreementInfo.class); + List projectNames = new ArrayList<>(); + List unitNames = new ArrayList<>(); BigDecimal totalCost = BigDecimal.valueOf(0.00); List scrapList = new ArrayList<>(); - List taskList = taskMapper.getTaskIdList(sltAgreementInfo); - if (null != taskList && !taskList.isEmpty()) { - List scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskList); - scrapList.addAll(scrapDetailsList); + for (SltAgreementInfo info : sltAgreementInfo) { + projectNames.add(info.getProjectName()); + unitNames.add(info.getUnitName()); + List taskList = taskMapper.getTaskIdList(info); + if (null != taskList && !taskList.isEmpty()) { + List scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskList); + scrapList.addAll(scrapDetailsList); + } } + +// List taskList = taskMapper.getTaskIdList(sltAgreementInfo); +// if (null != taskList && !taskList.isEmpty()) { +// List 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 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 = JSONObject.parseArray(params,SltAgreementInfo.class); + List projectNames = new ArrayList<>(); + List unitNames = new ArrayList<>(); +// String projectName = sltAgreementInfo.getProjectName(); +// String unitName = sltAgreementInfo.getUnitName(); //租赁费用明细 BigDecimal totalCostLease = BigDecimal.valueOf(0.00); List leaseList = new ArrayList<>(); - List oneOfListLease = sltAgreementInfoMapper.getLeaseList(sltAgreementInfo); - leaseList.addAll(oneOfListLease); + for (SltAgreementInfo info : sltAgreementInfo) { + projectNames.add(info.getProjectName()); + unitNames.add(info.getUnitName()); + List 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 loseList = new ArrayList<>(); - List oneOfListLose = sltAgreementInfoMapper.getLoseList(sltAgreementInfo); - loseList.addAll(oneOfListLose); + for (SltAgreementInfo info : sltAgreementInfo) { + List 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 repairList = new ArrayList<>(); - List taskListRepair = taskMapper.getTaskIdList(sltAgreementInfo); - if (null != taskListRepair && !taskListRepair.isEmpty()) { - List repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskListRepair); - repairList.addAll(repairDetailsList); + + for (SltAgreementInfo info : sltAgreementInfo) { + List taskList = taskMapper.getTaskIdList(info); + if (null != taskList && !taskList.isEmpty()) { + List 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 scrapList = new ArrayList<>(); - List taskListScrap = taskMapper.getTaskIdList(sltAgreementInfo); - if (null != taskListScrap && !taskListScrap.isEmpty()) { - List scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskListScrap); - scrapList.addAll(scrapDetailsList); + for (SltAgreementInfo info : sltAgreementInfo) { + List taskList = taskMapper.getTaskIdList(info); + if (null != taskList && !taskList.isEmpty()) { + List 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 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 oneOfList = sltAgreementRecudceMapper.getReductionList(bean); + reductionList.addAll(oneOfList); + } + + } + for (SltAgreementReduce reduction : reductionList) { + if(reduction.getLeaseMoney()!=null){ + totalCostReduction = totalCostReduction.add(reduction.getLeaseMoney()); } } List 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); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml index f3c49312..ed1a0097 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml @@ -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" + +