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 da716705..1f6d388e 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 @@ -754,10 +754,10 @@ public class SltAgreementInfoController extends BaseController { } String projectName = handleData(projectNames); String unitName = handleData(unitNames); - BigDecimal totalCost = BigDecimal.valueOf(0.00); + BigDecimal totalCost = BigDecimal.ZERO; for (SltAgreementInfo bean : leaseList) { if (null == bean.getLeasePrice()) { - bean.setLeasePrice(BigDecimal.valueOf(0.00)); + bean.setLeasePrice(BigDecimal.ZERO); }else{ bean.setLeasePrice(bean.getLeasePrice().setScale(3, RoundingMode.DOWN)); } @@ -802,16 +802,15 @@ public class SltAgreementInfoController extends BaseController { for (SltAgreementInfo info : sltAgreementInfo) { projectNames.add(info.getProjectName()); unitNames.add(info.getUnitName()); - List oneOfList =new ArrayList<>(); - - if ( info.getEnableQuerySltData()) { + List oneOfList; + if (info.getEnableQuerySltData()) { oneOfList = sltAgreementInfoMapper.getSltLoseList(info); - }else{ + } else { oneOfList = sltAgreementInfoMapper.getLoseList(info); } - loseList.addAll(oneOfList); } + String projectName = handleData(projectNames); String unitName = handleData(unitNames); BigDecimal totalCost = BigDecimal.ZERO; @@ -847,21 +846,18 @@ public class SltAgreementInfoController extends BaseController { @PostMapping("/exportRepair") public void exportRepair(HttpServletResponse response, @RequestParam("params") String params) { try { - String fileName = "维修费用明细表"; List sltAgreementInfo = JSONObject.parseArray(params,SltAgreementInfo.class); List projectNames = new ArrayList<>(); List unitNames = new ArrayList<>(); - BigDecimal totalCost = BigDecimal.valueOf(0.00); + BigDecimal totalCost = BigDecimal.ZERO; List repairList = new ArrayList<>(); for (SltAgreementInfo info : sltAgreementInfo) { projectNames.add(info.getProjectName()); unitNames.add(info.getUnitName()); List taskList = taskMapper.getTaskIdList(info); - - List taskList2 = new ArrayList<>(); + List taskList2; taskList2 = checkTeamAgreementInfo(info); - if (null != taskList && !taskList.isEmpty()) { if (null != taskList2 && !taskList2.isEmpty()) { taskList.addAll(taskList2); @@ -885,6 +881,7 @@ public class SltAgreementInfoController extends BaseController { List repair = Convert.toList(SltLeaseInfo.class, repairList); expOutExcel(response,repair,fileName,projectName,unitName,totalCost,3); } catch (Exception e) { + System.err.println(e.getMessage()); log.error(e.toString(), e); } } @@ -897,12 +894,10 @@ public class SltAgreementInfoController extends BaseController { if (null != agreementInfoList && !agreementInfoList.isEmpty()) { teamTaskList = taskMapper.getTaskIdListByAgreementList(agreementInfoList); } - }catch (Exception e){ + } catch (Exception e){ + System.err.println(e.getMessage()); e.printStackTrace(); } - - - return teamTaskList; } @@ -920,7 +915,7 @@ public class SltAgreementInfoController extends BaseController { List sltAgreementInfo = JSONObject.parseArray(params,SltAgreementInfo.class); List projectNames = new ArrayList<>(); List unitNames = new ArrayList<>(); - BigDecimal reductionCost = BigDecimal.valueOf(0.00); + BigDecimal reductionCost = BigDecimal.ZERO; List reductionList = new ArrayList<>(); for (SltAgreementInfo info : sltAgreementInfo) { projectNames.add(info.getProjectName()); @@ -966,7 +961,7 @@ public class SltAgreementInfoController extends BaseController { List sltAgreementInfo = JSONObject.parseArray(params,SltAgreementInfo.class); List projectNames = new ArrayList<>(); List unitNames = new ArrayList<>(); - BigDecimal totalCost = BigDecimal.valueOf(0.00); + BigDecimal totalCost = BigDecimal.ZERO; List scrapList = new ArrayList<>(); for (SltAgreementInfo info : sltAgreementInfo) { @@ -1060,13 +1055,13 @@ public class SltAgreementInfoController extends BaseController { projectNames.add(info.getProjectName()); unitNames.add(info.getUnitName()); //租赁费用明细 - BigDecimal totalCostLease = BigDecimal.valueOf(0.00); + BigDecimal totalCostLease = BigDecimal.ZERO; List leaseList = new ArrayList<>(); List oneOfList = sltAgreementInfoMapper.getLeaseList(info); leaseList.addAll(oneOfList); for (SltAgreementInfo bean : leaseList) { if (null == bean.getLeasePrice()) { - bean.setLeasePrice(BigDecimal.valueOf(0.00)); + bean.setLeasePrice(BigDecimal.ZERO); } if (null == bean.getNum()) { bean.setNum(BigDecimal.valueOf(0L)); @@ -1086,13 +1081,13 @@ public class SltAgreementInfoController extends BaseController { List lease = Convert.toList(SltLeaseInfo.class, leaseList); //丢失费用明细 - BigDecimal totalCostLose = BigDecimal.valueOf(0.00); + BigDecimal totalCostLose = BigDecimal.ZERO; List loseList = new ArrayList<>(); List oneOfListLose = sltAgreementInfoMapper.getLoseList(info); loseList.addAll(oneOfListLose); for (SltAgreementInfo bean : loseList) { if (null == bean.getBuyPrice()) { - bean.setBuyPrice(BigDecimal.valueOf(0.00)); + bean.setBuyPrice(BigDecimal.ZERO); } if (null == bean.getNum()) { bean.setNum(BigDecimal.valueOf(0L)); @@ -1111,7 +1106,7 @@ public class SltAgreementInfoController extends BaseController { //维修费用明细 - BigDecimal totalCostRepair = BigDecimal.valueOf(0.00); + BigDecimal totalCostRepair = BigDecimal.ZERO; List repairList = new ArrayList<>(); List taskList = taskMapper.getTaskIdList(info); @@ -1136,7 +1131,7 @@ public class SltAgreementInfoController extends BaseController { //报废费用明细 - BigDecimal totalCostScrap = BigDecimal.valueOf(0.00); + BigDecimal totalCostScrap = BigDecimal.ZERO; List scrapList = new ArrayList<>(); List taskListScrap = taskMapper.getTaskIdList(info); @@ -1160,7 +1155,7 @@ public class SltAgreementInfoController extends BaseController { //减免费用明细 - BigDecimal totalCostReduction = BigDecimal.valueOf(0.00); + BigDecimal totalCostReduction = BigDecimal.ZERO; List reductionList = new ArrayList<>(); if (info.getAgreementId() != null){ @@ -1270,27 +1265,26 @@ public class SltAgreementInfoController extends BaseController { // String unitName = sltAgreementInfo.getUnitName(); //租赁费用明细 - BigDecimal totalCostLease = BigDecimal.valueOf(0.00); + BigDecimal totalCostLease = BigDecimal.ZERO; List leaseList = new ArrayList<>(); for (SltAgreementInfo info : sltAgreementInfo) { projectNames.add(info.getProjectName()); unitNames.add(info.getUnitName()); - List oneOfList = new ArrayList<>(); - if (info != null && info.getEnableQuerySltData() != null && info.getEnableQuerySltData()) { + List oneOfList; + if (info.getEnableQuerySltData() != null && info.getEnableQuerySltData()) { oneOfList = sltAgreementInfoMapper.getLeaseSltDetails(info); } else { oneOfList = sltAgreementInfoMapper.getLeaseList(info); } - - leaseList.addAll(oneOfList); } + for (SltAgreementInfo bean : leaseList) { if (null == bean.getLeasePrice()) { - bean.setLeasePrice(BigDecimal.valueOf(0.00)); + bean.setLeasePrice(BigDecimal.ZERO); } if (null == bean.getNum()) { - bean.setNum(BigDecimal.valueOf(0L)); + bean.setNum(BigDecimal.ZERO); } if (null == bean.getLeaseDays()) { bean.setLeaseDay(0L); @@ -1300,32 +1294,28 @@ public class SltAgreementInfoController extends BaseController { BigDecimal leaseDays = new BigDecimal(bean.getLeaseDays()); // BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays); BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays).setScale(GlobalConstants.INT_2, RoundingMode.HALF_UP); - if(costs!=null){ - totalCostLease = totalCostLease.add(costs); - } + totalCostLease = totalCostLease.add(costs); bean.setCosts(costs); } List lease = Convert.toList(SltLeaseInfo.class, leaseList); //丢失费用明细 - BigDecimal totalCostLose = BigDecimal.valueOf(0.00); + BigDecimal totalCostLose = BigDecimal.ZERO; List loseList = new ArrayList<>(); for (SltAgreementInfo info : sltAgreementInfo) { - List oneOfList = new ArrayList<>(); - if ( info.getEnableQuerySltData()) { + List oneOfList; + if (info.getEnableQuerySltData()) { oneOfList = sltAgreementInfoMapper.getSltLoseList(info); - }else{ + } else { oneOfList = sltAgreementInfoMapper.getLoseList(info); } - - loseList.addAll(oneOfList); } for (SltAgreementInfo bean : loseList) { if (null == bean.getBuyPrice()) { - bean.setBuyPrice(BigDecimal.valueOf(0.00)); + bean.setBuyPrice(BigDecimal.ZERO); } if (null == bean.getNum()) { bean.setNum(BigDecimal.valueOf(0L)); @@ -1334,26 +1324,21 @@ public class SltAgreementInfoController extends BaseController { BigDecimal num = bean.getNum(); // 原价 x 数量 BigDecimal costs = buyPrice.multiply(num); - if(costs!=null){ - totalCostLose = totalCostLose.add(costs); - } + totalCostLose = totalCostLose.add(costs); //计算租赁费用 bean.setCosts(costs); } List lose = Convert.toList(SltLeaseInfo.class, loseList); //维修费用明细 - BigDecimal totalCostRepair = BigDecimal.valueOf(0.00); + BigDecimal totalCostRepair = BigDecimal.ZERO; List repairList = new ArrayList<>(); for (SltAgreementInfo info : sltAgreementInfo) { List taskList = taskMapper.getTaskIdList(info); - - List taskList2 = new ArrayList<>(); + List taskList2; taskList2 = checkTeamAgreementInfo(info); - if (null != taskList && !taskList.isEmpty()) { - if (null != taskList2 && !taskList2.isEmpty()) { taskList.addAll(taskList2); } @@ -1361,6 +1346,7 @@ public class SltAgreementInfoController extends BaseController { repairList.addAll(repairDetailsList); } } + for (SltAgreementInfo bean : repairList) { if (bean.getCosts()!=null && (bean.getPartType().equals("收费"))) { totalCostRepair = totalCostRepair.add(bean.getCosts()); @@ -1369,11 +1355,11 @@ public class SltAgreementInfoController extends BaseController { List repair = Convert.toList(SltLeaseInfo.class, repairList); //报废费用明细 - BigDecimal totalCostScrap = BigDecimal.valueOf(0.00); + BigDecimal totalCostScrap = BigDecimal.ZERO; List scrapList = new ArrayList<>(); for (SltAgreementInfo info : sltAgreementInfo) { List taskList = taskMapper.getTaskIdList(info); - List taskList2 = new ArrayList<>(); + List taskList2; taskList2 = checkTeamAgreementInfo(info); if (null != taskList && !taskList.isEmpty()) { if (null != taskList2 && !taskList2.isEmpty()) { @@ -1389,10 +1375,11 @@ public class SltAgreementInfoController extends BaseController { totalCostScrap = totalCostScrap.add(bean.getCosts()); } } + List scrap = Convert.toList(SltLeaseInfo.class, scrapList); //减免费用明细 - BigDecimal totalCostReduction = BigDecimal.valueOf(0.00); + BigDecimal totalCostReduction = BigDecimal.ZERO; List reductionList = new ArrayList<>(); // if (sltAgreementInfo.getAgreementId()!=null){ // SltAgreementReduce bean =new SltAgreementReduce(); @@ -1407,7 +1394,7 @@ public class SltAgreementInfoController extends BaseController { for (SltAgreementInfo info : sltAgreementInfo) { if (info.getAgreementId() != null){ - SltAgreementReduce bean =new SltAgreementReduce(); + SltAgreementReduce bean = new SltAgreementReduce(); bean.setAgreementId(info.getAgreementId()); List oneOfList = sltAgreementRecudceMapper.getReductionList(bean); reductionList.addAll(oneOfList); @@ -1424,7 +1411,9 @@ public class SltAgreementInfoController extends BaseController { String unitName = handleData(unitNames); expOutExcelAll(response,lease,lose,repair,scrap,reduction,fileName,projectName,unitName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap,totalCostReduction); } catch (Exception e) { + System.err.println(e.getMessage()); log.error(e.toString(), e); + throw new ServiceException("导出异常, 请联系系统管理员"); } } @@ -1467,13 +1456,13 @@ public class SltAgreementInfoController extends BaseController { List lease = Convert.toList(SltLeaseInfo.class, leaseList); //丢失费用明细 - BigDecimal totalCostLose = BigDecimal.valueOf(0.00); + BigDecimal totalCostLose = BigDecimal.ZERO; List oneOfListLose = sltAgreementInfoMapper.getLoseList(sltAgreementInfo); List loseList = new ArrayList<>(oneOfListLose); for (SltAgreementInfo bean : loseList) { if (null == bean.getBuyPrice()) { - bean.setBuyPrice(BigDecimal.valueOf(0.00)); + bean.setBuyPrice(BigDecimal.ZERO); } if (null == bean.getNum()) { bean.setNum(BigDecimal.valueOf(0L)); @@ -1533,7 +1522,7 @@ public class SltAgreementInfoController extends BaseController { List scrap = Convert.toList(SltLeaseInfo.class, scrapList); //减免费用明细 - BigDecimal totalCostReduction = BigDecimal.valueOf(0.00); + BigDecimal totalCostReduction = BigDecimal.ZERO; List reductionList = new ArrayList<>(); if (sltAgreementInfo.getAgreementId()!=null){ SltAgreementReduce bean =new SltAgreementReduce(); @@ -2143,13 +2132,13 @@ public class SltAgreementInfoController extends BaseController { rawFileName.substring(0, 150) + ".xls" : rawFileName; //租赁费用明细 - BigDecimal totalCostLease = BigDecimal.valueOf(0.00); + BigDecimal totalCostLease = BigDecimal.ZERO; List leaseList = new ArrayList<>(); leaseList = sltAgreementInfoMapper.getLeaseList(info); for (SltAgreementInfo bean : leaseList) { if (null == bean.getLeasePrice()) { - bean.setLeasePrice(BigDecimal.valueOf(0.00)); + bean.setLeasePrice(BigDecimal.ZERO); } if (null == bean.getNum()) { bean.setNum(BigDecimal.valueOf(0L)); @@ -2169,14 +2158,14 @@ public class SltAgreementInfoController extends BaseController { List lease = Convert.toList(SltLeaseInfo.class, leaseList); //丢失费用明细 - BigDecimal totalCostLose = BigDecimal.valueOf(0.00); + BigDecimal totalCostLose = BigDecimal.ZERO; List loseList = new ArrayList<>(); loseList = sltAgreementInfoMapper.getLoseList(info); for (SltAgreementInfo bean : loseList) { if (null == bean.getBuyPrice()) { - bean.setBuyPrice(BigDecimal.valueOf(0.00)); + bean.setBuyPrice(BigDecimal.ZERO); } if (null == bean.getNum()) { bean.setNum(BigDecimal.valueOf(0L)); @@ -2194,12 +2183,12 @@ public class SltAgreementInfoController extends BaseController { List lose = Convert.toList(SltLeaseInfo.class, loseList); //维修费用明细 - BigDecimal totalCostRepair = BigDecimal.valueOf(0.00); + BigDecimal totalCostRepair = BigDecimal.ZERO; List repairList = new ArrayList<>(); List taskRepairList = taskMapper.getTaskIdList(info); - List taskRepairList2 = new ArrayList<>(); + List taskRepairList2; taskRepairList2 = checkTeamAgreementInfo(info); if (null != taskRepairList && !taskRepairList.isEmpty()) { if (null != taskRepairList2 && !taskRepairList2.isEmpty()) { @@ -2216,7 +2205,7 @@ public class SltAgreementInfoController extends BaseController { List repair = Convert.toList(SltLeaseInfo.class, repairList); //报废费用明细 - BigDecimal totalCostScrap = BigDecimal.valueOf(0.00); + BigDecimal totalCostScrap = BigDecimal.ZERO; List scrapList = new ArrayList<>(); List taskScrapList = taskMapper.getTaskIdList(info); @@ -2241,7 +2230,7 @@ public class SltAgreementInfoController extends BaseController { List scrap = Convert.toList(SltLeaseInfo.class, scrapList); //减免费用明细 - BigDecimal totalCostReduction = BigDecimal.valueOf(0.00); + BigDecimal totalCostReduction = BigDecimal.ZERO; List reductionList = new ArrayList<>(); if (info.getAgreementId() != null){ @@ -2399,13 +2388,13 @@ public class SltAgreementInfoController extends BaseController { rawFileName.substring(0, 150) + ".xls" : rawFileName; //租赁费用明细 - BigDecimal totalCostLease = BigDecimal.valueOf(0.00); + BigDecimal totalCostLease = BigDecimal.ZERO; List leaseList = new ArrayList<>(); leaseList = sltAgreementInfoMapper.getLeaseList(info); for (SltAgreementInfo bean : leaseList) { if (null == bean.getLeasePrice()) { - bean.setLeasePrice(BigDecimal.valueOf(0.00)); + bean.setLeasePrice(BigDecimal.ZERO); } if (null == bean.getNum()) { bean.setNum(BigDecimal.valueOf(0L)); @@ -2425,14 +2414,14 @@ public class SltAgreementInfoController extends BaseController { List lease = Convert.toList(SltLeaseInfo.class, leaseList); //丢失费用明细 - BigDecimal totalCostLose = BigDecimal.valueOf(0.00); + BigDecimal totalCostLose = BigDecimal.ZERO; List loseList = new ArrayList<>(); loseList = sltAgreementInfoMapper.getLoseList(info); for (SltAgreementInfo bean : loseList) { if (null == bean.getBuyPrice()) { - bean.setBuyPrice(BigDecimal.valueOf(0.00)); + bean.setBuyPrice(BigDecimal.ZERO); } if (null == bean.getNum()) { bean.setNum(BigDecimal.valueOf(0L)); @@ -2450,7 +2439,7 @@ public class SltAgreementInfoController extends BaseController { List lose = Convert.toList(SltLeaseInfo.class, loseList); //维修费用明细 - BigDecimal totalCostRepair = BigDecimal.valueOf(0.00); + BigDecimal totalCostRepair = BigDecimal.ZERO; List repairList = new ArrayList<>(); @@ -2472,7 +2461,7 @@ public class SltAgreementInfoController extends BaseController { List repair = Convert.toList(SltLeaseInfo.class, repairList); //报废费用明细 - BigDecimal totalCostScrap = BigDecimal.valueOf(0.00); + BigDecimal totalCostScrap = BigDecimal.ZERO; List scrapList = new ArrayList<>(); List taskScrapList = taskMapper.getTaskIdList(info); @@ -2497,7 +2486,7 @@ public class SltAgreementInfoController extends BaseController { List scrap = Convert.toList(SltLeaseInfo.class, scrapList); //减免费用明细 - BigDecimal totalCostReduction = BigDecimal.valueOf(0.00); + BigDecimal totalCostReduction = BigDecimal.ZERO; List reductionList = new ArrayList<>(); if (info.getAgreementId() != null){ diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml index bd6c33a1..f83562ac 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml @@ -396,7 +396,12 @@ left join ma_type mt1 on mt.parent_id = mt1.type_id where rc.status in ('0','1') and rc.repair_type in ('1','2') - and mt.jiju_type = #{info.settlementType} + + and mt.jiju_type = #{info.settlementType} + + + and mt.jiju_type in (1,2) + and rc.task_id in @@ -434,7 +439,12 @@ left join ma_type mt1 on mt.parent_id = mt1.type_id where rc.status in ('0','1') and rc.repair_type = '3' - and mt.jiju_type = #{info.settlementType} + + and mt.jiju_type = #{info.settlementType} + + + and mt.jiju_type in (1,2) + and rc.task_id in @@ -1195,7 +1205,12 @@ and bai.company_id = #{info.companyId} - and mt.jiju_type = #{info.settlementType} + + and mt.jiju_type = #{info.settlementType} + + + and mt.jiju_type in (1,2) + @@ -1263,7 +1278,12 @@ and rc.repair_type in ('1','2') and bai.company_id = #{info.companyId} - and mt.jiju_type = #{info.settlementType} + + and mt.jiju_type = #{info.settlementType} + + + and mt.jiju_type in (1,2) + and tta.agreement_id in @@ -1326,7 +1346,12 @@ and rc.repair_type = '3' and bai.company_id =#{info.companyId} - and mt.jiju_type = #{info.settlementType} + + and mt.jiju_type = #{info.settlementType} + + + and mt.jiju_type in (1,2) + @@ -1394,7 +1419,12 @@ and rc.repair_type = '3' and bai.company_id = #{info.companyId} - and mt.jiju_type = #{info.settlementType} + + and mt.jiju_type = #{info.settlementType} + + + and mt.jiju_type in (1,2) + and tt.create_time between #{info.startTime} and #{info.endTime}