From fc73e6bbfa2e294297164ab10f5ef09bec4bafc1 Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Wed, 7 Aug 2024 18:10:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=85=E9=81=93bug=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SltAgreementInfoServiceImpl.java | 98 ++++++++++--------- .../material/SltAgreementInfoMapper.xml | 7 +- 2 files changed, 54 insertions(+), 51 deletions(-) diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/SltAgreementInfoServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/SltAgreementInfoServiceImpl.java index 5e923164..3f7ba614 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/SltAgreementInfoServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/SltAgreementInfoServiceImpl.java @@ -35,7 +35,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService { private SltAgreementInfoMapper sltAgreementInfoMapper; @Override - public List getSltAgreementInfo(AgreementInfo bean) { + public List getSltAgreementInfo(AgreementInfo bean) { return sltAgreementInfoMapper.getSltAgreementInfo(bean); } @@ -54,7 +54,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService { sltInfoVo.setRepairList(repairList); sltInfoVo.setScrapList(scrapList); sltInfoVo.setLoseList(loseList); - List relations = getRelations(leaseList,repairList,scrapList,loseList,list); + List relations = getRelations(leaseList, repairList, scrapList, loseList, list); sltInfoVo.setRelations(relations); return sltInfoVo; } @@ -66,7 +66,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService { String cost = sltAgreementInfoMapper.getCost(apply); List relations = sltAgreementInfoMapper.getRelations(apply); sltInfoVo.setRelations(relations); - for (SltAgreementRelation relation : relations){ + for (SltAgreementRelation relation : relations) { AgreementInfo info = new AgreementInfo(); info.setAgreementId(Long.valueOf(relation.getAgreementId())); list.add(info); @@ -90,23 +90,23 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService { apply.setAuditor(String.valueOf(userid)); int i = sltAgreementInfoMapper.updateRelation(apply); int j = 0; - if (i > 0){ + if (i > 0) { List relations = sltAgreementInfoMapper.getRelations(apply); List infos = new ArrayList<>(); - for (SltAgreementRelation bean : relations){ + for (SltAgreementRelation bean : relations) { AgreementInfo info = new AgreementInfo(); info.setAgreementId(Long.valueOf(bean.getAgreementId())); infos.add(info); } List loseList = getLoseList(infos); - for (SltAgreementInfo agreementInfo : loseList){ - if (agreementInfo.getMaId() != null && agreementInfo.getMaId().isEmpty()){ + for (SltAgreementInfo agreementInfo : loseList) { + if (agreementInfo.getMaId() != null && agreementInfo.getMaId().isEmpty()) { agreementInfo.setStatus("103"); sltAgreementInfoMapper.updateMaStatus(agreementInfo); } } j = sltAgreementInfoMapper.updateApply(apply); - }else { + } else { throw new ServiceException("结算审核失败"); //throw new ServiceException(ExceptionDict.SETTLEMENT_REVIEW_ERROR_MSG,ExceptionDict.SETTLEMENT_REVIEW_ERROR); } @@ -115,14 +115,14 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService { private List getRelations(List leaseList, List repairList, List scrapList, List loseList, List list) { List relations = new ArrayList<>(); - for (AgreementInfo info : list){ + for (AgreementInfo info : list) { SltAgreementRelation relation = new SltAgreementRelation(); BigDecimal loseCost = BigDecimal.ZERO; BigDecimal leaseCost = BigDecimal.ZERO; BigDecimal scrapCost = BigDecimal.ZERO; BigDecimal repairCost = BigDecimal.ZERO; - for (SltAgreementInfo lease : leaseList){ - if (lease.getAgreementId().equals(info.getAgreementId().toString())){ + for (SltAgreementInfo lease : leaseList) { + if (lease.getAgreementId().equals(info.getAgreementId().toString())) { relation.setAgreementId(lease.getAgreementId()); relation.setProjectName(lease.getProjectName()); relation.setUnitName(lease.getUnitName()); @@ -131,20 +131,20 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService { leaseCost = leaseCost.add(cost); } } - for (SltAgreementInfo repair : repairList){ - if (repair.getAgreementId().equals(info.getAgreementId().toString())){ + for (SltAgreementInfo repair : repairList) { + if (repair.getAgreementId().equals(info.getAgreementId().toString())) { BigDecimal cost = new BigDecimal(repair.getCosts()); repairCost = repairCost.add(cost); } } - for (SltAgreementInfo scrap : scrapList){ - if (scrap.getAgreementId().equals(info.getAgreementId().toString())){ + for (SltAgreementInfo scrap : scrapList) { + if (scrap.getAgreementId().equals(info.getAgreementId().toString())) { BigDecimal cost = new BigDecimal(scrap.getCosts()); scrapCost = scrapCost.add(cost); } } - for (SltAgreementInfo lose : loseList){ - if (lose.getAgreementId().equals(info.getAgreementId().toString())){ + for (SltAgreementInfo lose : loseList) { + if (lose.getAgreementId().equals(info.getAgreementId().toString())) { //TODO 上面已经set过值,这里为什么还要set值 relation.setAgreementId(lose.getAgreementId()); relation.setProjectName(lose.getProjectName()); @@ -174,15 +174,15 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService { apply.setCode(code); apply.setCompanyId(relations.get(0).getCompanyId()); int i = sltAgreementInfoMapper.insApply(apply); - if (i > 0){ - for (SltAgreementRelation relation : relations){ + if (i > 0) { + for (SltAgreementRelation relation : relations) { AgreementInfo info = new AgreementInfo(); info.setAgreementId(Long.valueOf(relation.getAgreementId())); list.add(info); relation.setApplyId(String.valueOf(apply.getId())); sltAgreementInfoMapper.updateInfoStatus(relation.getAgreementId()); int j = sltAgreementInfoMapper.insRelation(relation); - if (j < 0){ + if (j < 0) { throw new ServiceException("新增协议结算记录失败"); //throw new ServiceException(ExceptionDict.NEW_AGREEMENT_SETTLEMENT_ERROR_MSG,ExceptionDict.NEW_AGREEMENT_SETTLEMENT_ERROR); } @@ -191,7 +191,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService { List repairList = getRepairList(list); List scrapList = getScrapList(list); List loseList = getLoseList(list); - for (SltAgreementInfo info : leaseList){ + for (SltAgreementInfo info : leaseList) { info.setSltType("1"); //info.setSltType(CostTypeEnum.LEASE_COST.getCode()); info.setApplyId(String.valueOf(apply.getId())); @@ -199,34 +199,34 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService { //info.setPartType(PartTypeEnum.CHARGE.getCode()); sltAgreementInfoMapper.insDetails(info); } - for (SltAgreementInfo info : repairList){ + for (SltAgreementInfo info : repairList) { info.setSltType("3"); //info.setSltType(CostTypeEnum.MAINTENANCE_COST.getCode()); info.setApplyId(String.valueOf(apply.getId())); //对是否收费进行转换 //info.setPartType(PartTypeEnum.getCodeByInfo(info.getPartType())); - info.setPartType(info.getPartType()=="不收费" ? "0" : "1"); + info.setPartType(info.getPartType() == "不收费" ? "0" : "1"); sltAgreementInfoMapper.insDetails(info); } - for (SltAgreementInfo info : scrapList){ + for (SltAgreementInfo info : scrapList) { info.setSltType("4"); //info.setSltType(CostTypeEnum.SCRAP_COST.getCode()); info.setApplyId(String.valueOf(apply.getId())); //info.setPartType(info.getScrapType()); //info.setPartType(ScrapTypeEnum.getCodeByInfo(info.getScrapType())); - info.setPartType(info.getScrapType()=="自然" ? "0" : "1"); + info.setPartType(info.getScrapType() == "自然" ? "0" : "1"); sltAgreementInfoMapper.insDetails(info); } - for (SltAgreementInfo info : loseList){ + for (SltAgreementInfo info : loseList) { info.setSltType("2"); //info.setSltType(CostTypeEnum.LOSE_COST.getCode()); info.setApplyId(String.valueOf(apply.getId())); - info.setPartType("1"); + info.setPartType("1"); //info.setPartType(PartTypeEnum.CHARGE.getCode()); sltAgreementInfoMapper.insDetails(info); } - }else { + } else { throw new ServiceException("新增结算单号失败"); //throw new ServiceException(ExceptionDict.NEW_SETTLEMENT_NUMBER_ERROR_MSG,ExceptionDict.NEW_SETTLEMENT_NUMBER_ERROR); } @@ -241,15 +241,15 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService { public List getLoseList(List list) { List loseList = new ArrayList<>(); - for (AgreementInfo bean : list){ + for (AgreementInfo bean : list) { List oneOfList = sltAgreementInfoMapper.getLoseList(bean); loseList.addAll(oneOfList); } - for (SltAgreementInfo bean : loseList){ - if (bean.getBuyPrice() == null){ + for (SltAgreementInfo bean : loseList) { + if (bean.getBuyPrice() == null) { bean.setBuyPrice("0"); } - if (bean.getNum() == null){ + if (bean.getNum() == null) { bean.setNum("0"); } BigDecimal buyPrice = new BigDecimal(bean.getBuyPrice()); @@ -272,20 +272,20 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService { List scrapList = new ArrayList<>(); String taskType = "57"; //String taskType = TaskTypeEnum.SCRAP_TASK.getCode(); - for (AgreementInfo bean : list){ - List taskList = sltAgreementInfoMapper.getTaskList(bean,taskType); - if (taskList != null && taskList.size() > 0){ + for (AgreementInfo bean : list) { + List taskList = sltAgreementInfoMapper.getTaskList(bean, taskType); + if (taskList != null && taskList.size() > 0) { List scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskList); scrapList.addAll(scrapDetailsList); } } - if (scrapList != null && scrapList.size() > 0){ - for (SltAgreementInfo bean : scrapList){ + if (scrapList != null && scrapList.size() > 0) { + for (SltAgreementInfo bean : scrapList) { - if (bean.getBuyPrice() == null){ + if (bean.getBuyPrice() == null) { bean.setBuyPrice("0"); } - if (bean.getNum() == null){ + if (bean.getNum() == null) { bean.setNum("0"); } BigDecimal buyPrice = new BigDecimal(bean.getBuyPrice()); @@ -309,9 +309,9 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService { List repairList = new ArrayList<>(); String taskType = "41"; //String taskType = TaskTypeEnum.MAINTENANCE_TASK.getCode(); - for (AgreementInfo bean : list){ - List taskList = sltAgreementInfoMapper.getTaskList(bean,taskType); - if (taskList != null && taskList.size() > 0){ + for (AgreementInfo bean : list) { + List taskList = sltAgreementInfoMapper.getTaskList(bean, taskType); + if (taskList != null && taskList.size() > 0) { List repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList); repairList.addAll(repairDetailsList); } @@ -321,18 +321,18 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService { public List getLeaseList(List list) { List leaseList = new ArrayList<>(); - for (AgreementInfo bean : list){ + for (AgreementInfo bean : list) { List oneOfList = sltAgreementInfoMapper.getLeaseList(bean); leaseList.addAll(oneOfList); } - for (SltAgreementInfo bean : leaseList){ - if (bean.getLeasePrice() == null){ + for (SltAgreementInfo bean : leaseList) { + if (bean.getLeasePrice() == null) { bean.setLeasePrice("0"); } - if (bean.getNum() == null){ + if (bean.getNum() == null) { bean.setNum("0"); } - if (bean.getLeaseDays() == null){ + if (bean.getLeaseDays() == null) { bean.setLeaseDays("0"); } BigDecimal leasePrice = new BigDecimal(bean.getLeasePrice()); @@ -344,7 +344,9 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService { return leaseList; } - /**结算单号编码生成规则*/ + /** + * 结算单号编码生成规则 + */ private String sltCodeRule(String code) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); Date nowDate = DateUtils.getNowDate(); diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SltAgreementInfoMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SltAgreementInfoMapper.xml index 5e807611..c38ee983 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SltAgreementInfoMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SltAgreementInfoMapper.xml @@ -92,14 +92,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and type_id = #{typeId}