diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/config/PoiOutPage.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/config/PoiOutPage.java index 5d9e5b4e..204907ab 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/config/PoiOutPage.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/config/PoiOutPage.java @@ -203,7 +203,7 @@ public class PoiOutPage { return workbook; } - public static HSSFWorkbook excelForcheckTwo(List> result, List list, String filename, String unit, String projectName, BigDecimal totalCost) { + public static HSSFWorkbook excelForcheckTwo(List> result, List list, String filename, String projectName, String unit, BigDecimal totalCost) { // 创建工作簿和工作表 HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet(); @@ -237,7 +237,7 @@ public class PoiOutPage { } public static HSSFWorkbook excelForcheckAll(List> resultLease,List> resultLose,List> resultRepair,List> resultScrap, - List listLease,List listLose,List listRepair,List listScrap, String filename, String unit, String projectName, + List listLease,List listLose,List listRepair,List listScrap, String filename, String projectName, String unit, BigDecimal totalCostLease, BigDecimal totalCostLose, BigDecimal totalCostRepair, BigDecimal totalCostScrap) { // 创建工作簿和工作表 HSSFWorkbook workbook = new HSSFWorkbook(); 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 73f0bf1e..7d9b0d26 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 @@ -16,6 +16,7 @@ import com.bonus.common.biz.config.PoiOutPage; import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.log.enums.OperaType; import com.bonus.material.common.annotation.PreventRepeatSubmit; +import com.bonus.material.countersign.domain.SignConfigVo; import com.bonus.material.lease.domain.vo.LeaseOutVo; import com.bonus.material.settlement.domain.SltAgreementApply; import com.bonus.material.settlement.domain.vo.SltInfoVo; @@ -91,8 +92,8 @@ public class SltAgreementInfoController extends BaseController { @ApiOperation(value = "根据协议获取结算清单") @PostMapping("/getSltInfo") - public AjaxResult getSltInfo(@RequestBody List list) { - SltInfoVo bean = sltAgreementInfoService.getSltInfo(list); + public AjaxResult getSltInfo(@RequestBody SltAgreementInfo info) { + SltInfoVo bean = sltAgreementInfoService.getSltInfo(info); return AjaxResult.success(bean); } @@ -107,24 +108,24 @@ public class SltAgreementInfoController extends BaseController { return getDataTable(list); } - /** - * 获取结算审核清单 - */ - @ApiOperation(value = "获取结算审核清单") - @GetMapping("/getSltExamInfo") - public AjaxResult getSltExamInfo(SltAgreementApply apply) { - SltInfoVo bean = sltAgreementInfoService.getSltExamInfo(apply); - return AjaxResult.success(bean); - } +// /** +// * 获取结算审核清单 +// */ +// @ApiOperation(value = "获取结算审核清单") +// @GetMapping("/getSltExamInfo") +// public AjaxResult getSltExamInfo(SltAgreementApply apply) { +// SltInfoVo bean = sltAgreementInfoService.getSltExamInfo(apply); +// return AjaxResult.success(bean); +// } - /** - * 结算审核 - */ - @ApiOperation(value = "结算审核") - @GetMapping("/settlementReview") - public AjaxResult settlementReview(SltAgreementApply apply) { - return toAjax(sltAgreementInfoService.settlementReview(apply)); - } +// /** +// * 结算审核 +// */ +// @ApiOperation(value = "结算审核") +// @GetMapping("/settlementReview") +// public AjaxResult settlementReview(SltAgreementApply apply) { +// return toAjax(sltAgreementInfoService.settlementReview(apply)); +// } /** * 导出结算信息列表 @@ -719,7 +720,9 @@ public class SltAgreementInfoController extends BaseController { return toAjax(sltAgreementInfoService.deleteSltAgreementInfoByIds(ids)); } - + /** + * 提交结算清单 + */ @ApiOperation(value = "提交结算清单") @PostMapping("/submitCosts") public AjaxResult submitCosts(@RequestBody SltInfoVo sltInfoVo) { @@ -729,4 +732,28 @@ public class SltAgreementInfoController extends BaseController { return error("系统错误, " + e.getMessage()); } } + + /** + * 结算审批列表 + */ + @ApiOperation(value = "结算审批列表") + @GetMapping("/getSltList") + public TableDataInfo getSltList(SltAgreementInfo bean) { + startPage(); + List list = sltAgreementInfoService.getSltList(bean); + return getDataTable(list); + } + + /** + * 进行结算审批 + */ + @ApiOperation(value = "进行结算审批") + @PostMapping("/costExamine") + public AjaxResult costExamine(@RequestBody SltAgreementApply apply) { + try { + return sltAgreementInfoService.costExamine(apply); + } catch (Exception e) { + return error("系统错误, " + e.getMessage()); + } + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementApply.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementApply.java index 6b2b937b..0ebe2a0a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementApply.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementApply.java @@ -25,6 +25,10 @@ public class SltAgreementApply extends BaseEntity { /** $column.columnComment */ private Long id; + /** 协议id */ + @ApiModelProperty(value = "协议id") + private Long agreementId; + /** 结算单号(例如:JS202402-1) */ @Excel(name = "结算单号", readConverterExp = "例=如:JS202402-1") private String code; @@ -45,9 +49,9 @@ public class SltAgreementApply extends BaseEntity { @Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd") private Date auditTime; - /** 状态0待审核1审核通过2审核驳回 */ - @Excel(name = "状态0待审核1审核通过2审核驳回") - @ApiModelProperty(value = "状态0待审核1审核通过2审核驳回") + /** 状态0未结算1待审核2审核通过3审核驳回 */ + @Excel(name = "状态0未结算1待审核2审核通过3审核驳回") + @ApiModelProperty(value = "状态0未结算1待审核2审核通过3审核驳回") private String status; /** 数据所属 */ @@ -60,5 +64,6 @@ public class SltAgreementApply extends BaseEntity { @ApiModelProperty(value = "结算总费用") private BigDecimal cost; - + @ApiModelProperty(value = "原因") + private String remark; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java index dea65138..e1ffc846 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java @@ -197,4 +197,13 @@ public class SltAgreementInfo extends BaseEntity { private String keyWord; + /** 审核人 */ + @ApiModelProperty(value = "审核人") + private String auditor; + + /** 审核时间 */ + @ApiModelProperty(value = "审核时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date auditTime; + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java index ace92692..064558b8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java @@ -106,6 +106,14 @@ public interface SltAgreementInfoMapper { */ int deleteSltInfo(@Param("record") LeaseOutDetails leaseOutDetails); + /** + * 查找是否驳回 + * + * @param sltInfoVo 结算信息 + * @return 结果 + */ + public int getRejectCount(SltInfoVo sltInfoVo); + /** * 新增结算审核信息 * @@ -153,4 +161,46 @@ public interface SltAgreementInfoMapper { * @return */ int insertSltAgreementDetailLose(@Param("list") List list,@Param("id") Long id); + + /** + * 结算审批列表 + * + * @param bean 结算信息 + * @return 结果 + */ + List getSltList(SltAgreementInfo bean); + + /** + * 对驳回的结算信息进行重新设置为未结算 + * + * @param sltInfoVo 结算信息 + * @return 结果 + */ + int updateRejectCount(SltInfoVo sltInfoVo); + + /** + * 获取对驳回的结算信息的id + * + * @param sltInfoVo 结算信息 + * @return 结果 + */ + Long getRejectId(SltInfoVo sltInfoVo); + + /** + * 进行结算审批 + * + * @param sltAgreementApply 进行结算审批 + * @return 结果 + */ + int costExame(SltAgreementApply sltAgreementApply); + + void costDeleteDetail(SltAgreementApply sltAgreementApply); + + /** + * 审核驳回时修改是否结算 + * + * @param sltAgreementApply 结算信息 + * @return 结果 + */ + public int updateBmAgreementReject(SltAgreementApply sltAgreementApply); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java index 15db82e3..4639160b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java @@ -2,6 +2,8 @@ package com.bonus.material.settlement.service; import java.util.List; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.countersign.domain.SignConfigVo; import com.bonus.material.settlement.domain.SltAgreementApply; import com.bonus.material.settlement.domain.SltAgreementInfo; import com.bonus.material.settlement.domain.vo.SltInfoVo; @@ -31,13 +33,13 @@ public interface ISltAgreementInfoService { public List getSltAgreementInfo4Project(SltAgreementInfo bean); - public SltInfoVo getSltInfo(List list); + public SltInfoVo getSltInfo(SltAgreementInfo info); List getSltExam(SltAgreementInfo bean); - SltInfoVo getSltExamInfo(SltAgreementApply apply); +// SltInfoVo getSltExamInfo(SltAgreementApply apply); - int settlementReview(SltAgreementApply apply); +// int settlementReview(SltAgreementApply apply); /** * 新增结算信息 @@ -79,4 +81,20 @@ public interface ISltAgreementInfoService { * @return 结果 */ public int submitCosts(SltInfoVo sltInfoVo); + + /** + * 结算审批列表 + * + * @param bean 结算信息 + * @return 结果 + */ + List getSltList(SltAgreementInfo bean); + + /** + * 进行结算审批 + * + * @param sltAgreementApply 进行结算审批 + * @return 结果 + */ + AjaxResult costExamine(SltAgreementApply sltAgreementApply); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java index fd2c14f3..9899d1cc 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java @@ -7,7 +7,9 @@ import java.util.List; import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; +import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.material.countersign.domain.SignConfigVo; import com.bonus.material.settlement.domain.SltAgreementApply; import com.bonus.material.settlement.domain.SltAgreementRelation; import com.bonus.material.settlement.domain.vo.SltInfoVo; @@ -64,22 +66,24 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { } @Override - public SltInfoVo getSltInfo(List list) { + public SltInfoVo getSltInfo(SltAgreementInfo info) { SltInfoVo sltInfoVo = new SltInfoVo(); - sltInfoVo.setUnitName(list.get(0).getUnitName()); - sltInfoVo.setProjectName(list.get(0).getProjectName()); + sltInfoVo.setUnitName(info.getUnitName()); + sltInfoVo.setProjectName(info.getProjectName()); +// sltInfoVo.setUnitName(list.get(0).getUnitName()); +// sltInfoVo.setProjectName(list.get(0).getProjectName()); BigDecimal leaseCost = BigDecimal.valueOf(0.00); BigDecimal repairCost = BigDecimal.valueOf(0.00); BigDecimal scrapCost = BigDecimal.valueOf(0.00); BigDecimal loseCost = BigDecimal.valueOf(0.00); //租赁费用列表 - List leaseList = getLeaseList(list); + List leaseList = getLeaseList(info); //维修费用列表 - List repairList = getRepairList(list); + List repairList = getRepairList(info); //报废费用列表 - List scrapList = getScrapList(list); + List scrapList = getScrapList(info); //丢失费用列表 - List loseList = getLoseList(list); + List loseList = getLoseList(info); sltInfoVo.setLeaseList(leaseList); sltInfoVo.setRepairList(repairList); sltInfoVo.setScrapList(scrapList); @@ -109,7 +113,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { sltInfoVo.setRepairCost(repairCost); sltInfoVo.setScrapCost(scrapCost); sltInfoVo.setLoseCost(loseCost); - List relations = getRelations(leaseList, repairList, scrapList, loseList, list); + List relations = getRelations(leaseList, repairList, scrapList, loseList, info); sltInfoVo.setRelations(relations); return sltInfoVo; } @@ -119,66 +123,66 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { return sltAgreementInfoMapper.getSltExam(bean); } - @Override - public SltInfoVo getSltExamInfo(SltAgreementApply apply) { - SltInfoVo sltInfoVo = new SltInfoVo(); - List list = new ArrayList<>(); - String cost = sltAgreementInfoMapper.getCost(apply); - List relations = sltAgreementInfoMapper.getRelations(apply); - sltInfoVo.setRelations(relations); - for (SltAgreementRelation relation : relations) { - SltAgreementInfo info = new SltAgreementInfo(); - info.setAgreementId(Long.valueOf(relation.getAgreementId())); - list.add(info); - } - List leaseList = getLeaseList(list); - List repairList = getRepairList(list); - List scrapList = getScrapList(list); - List loseList = getLoseList(list); - sltInfoVo.setLeaseList(leaseList); - sltInfoVo.setRepairList(repairList); - sltInfoVo.setScrapList(scrapList); - sltInfoVo.setLoseList(loseList); - sltInfoVo.setCost(cost); - return sltInfoVo; - } +// @Override +// public SltInfoVo getSltExamInfo(SltAgreementApply apply) { +// SltInfoVo sltInfoVo = new SltInfoVo(); +// List list = new ArrayList<>(); +// String cost = sltAgreementInfoMapper.getCost(apply); +// List relations = sltAgreementInfoMapper.getRelations(apply); +// sltInfoVo.setRelations(relations); +// for (SltAgreementRelation relation : relations) { +// SltAgreementInfo info = new SltAgreementInfo(); +// info.setAgreementId(Long.valueOf(relation.getAgreementId())); +// list.add(info); +// } +// List leaseList = getLeaseList(list); +// List repairList = getRepairList(list); +// List scrapList = getScrapList(list); +// List loseList = getLoseList(list); +// sltInfoVo.setLeaseList(leaseList); +// sltInfoVo.setRepairList(repairList); +// sltInfoVo.setScrapList(scrapList); +// sltInfoVo.setLoseList(loseList); +// sltInfoVo.setCost(cost); +// return sltInfoVo; +// } - @Override - @Transactional - public int settlementReview(SltAgreementApply apply) { - Long userid = SecurityUtils.getLoginUser().getUserid(); - apply.setAuditor(String.valueOf(userid)); - int j; - if ("2".equals(apply.getStatus())) { - // 驳回 - int i = sltAgreementInfoMapper.updateRelation(apply); - j = sltAgreementInfoMapper.updateApply(apply); - } else { - // 通过 - int i = sltAgreementInfoMapper.updateRelation(apply); - if (i > 0) { - List relations = sltAgreementInfoMapper.getRelations(apply); - List infos = new ArrayList<>(); - for (SltAgreementRelation bean : relations) { - SltAgreementInfo info = new SltAgreementInfo(); - info.setAgreementId(Long.valueOf(bean.getAgreementId())); - infos.add(info); - } - List loseList = getLoseList(infos); - for (SltAgreementInfo agreementInfo : loseList) { - if (agreementInfo.getMaId() != null) { - agreementInfo.setStatus("103"); - sltAgreementInfoMapper.updateMaStatus(agreementInfo); - } - } - j = sltAgreementInfoMapper.updateApply(apply); - } else { - throw new ServiceException("结算审核失败"); - //throw new ServiceException(ExceptionDict.SETTLEMENT_REVIEW_ERROR_MSG,ExceptionDict.SETTLEMENT_REVIEW_ERROR); - } - } - return j; - } +// @Override +// @Transactional +// public int settlementReview(SltAgreementApply apply) { +// Long userid = SecurityUtils.getLoginUser().getUserid(); +// apply.setAuditor(String.valueOf(userid)); +// int j; +// if ("2".equals(apply.getStatus())) { +// // 驳回 +// int i = sltAgreementInfoMapper.updateRelation(apply); +// j = sltAgreementInfoMapper.updateApply(apply); +// } else { +// // 通过 +// int i = sltAgreementInfoMapper.updateRelation(apply); +// if (i > 0) { +// List relations = sltAgreementInfoMapper.getRelations(apply); +// List infos = new ArrayList<>(); +// for (SltAgreementRelation bean : relations) { +// SltAgreementInfo info = new SltAgreementInfo(); +// info.setAgreementId(Long.valueOf(bean.getAgreementId())); +// infos.add(info); +// } +// List loseList = getLoseList(infos); +// for (SltAgreementInfo agreementInfo : loseList) { +// if (agreementInfo.getMaId() != null) { +// agreementInfo.setStatus("103"); +// sltAgreementInfoMapper.updateMaStatus(agreementInfo); +// } +// } +// j = sltAgreementInfoMapper.updateApply(apply); +// } else { +// throw new ServiceException("结算审核失败"); +// //throw new ServiceException(ExceptionDict.SETTLEMENT_REVIEW_ERROR_MSG,ExceptionDict.SETTLEMENT_REVIEW_ERROR); +// } +// } +// return j; +// } /** * 新增结算信息 @@ -234,12 +238,12 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { return sltAgreementInfoMapper.deleteSltAgreementInfoById(id); } - public List getLeaseList(List list) { + public List getLeaseList(SltAgreementInfo info) { List leaseList = new ArrayList<>(); - for (SltAgreementInfo bean : list) { - List oneOfList = sltAgreementInfoMapper.getLeaseList(bean); + + List oneOfList = sltAgreementInfoMapper.getLeaseList(info); leaseList.addAll(oneOfList); - } + for (SltAgreementInfo bean : leaseList) { if (null == bean.getLeasePrice()) { bean.setLeasePrice(BigDecimal.valueOf(0.00)); @@ -261,7 +265,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { return leaseList; } - public List getRepairList(List list) { + public List getRepairList(SltAgreementInfo info) { List repairList = new ArrayList<>(); // Integer taskType = TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId(); // for (SltAgreementInfo bean : list) { @@ -271,34 +275,34 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { // repairList.addAll(repairDetailsList); // } // } - for(SltAgreementInfo bean : list){ - List taskList = taskMapper.getTaskIdList(bean); + + List taskList = taskMapper.getTaskIdList(info); if (null!= taskList &&!taskList.isEmpty()) { List repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList); repairList.addAll(repairDetailsList); } - } + return repairList; } - public List getScrapList(List list) { + public List getScrapList(SltAgreementInfo info) { List scrapList = new ArrayList<>(); - for (SltAgreementInfo bean : list) { - List taskList = taskMapper.getTaskIdList(bean); + + List taskList = taskMapper.getTaskIdList(info); if (null != taskList && !taskList.isEmpty()) { List scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskList); scrapList.addAll(scrapDetailsList); } - } + return scrapList; } - public List getLoseList(List list) { + public List getLoseList(SltAgreementInfo info) { List loseList = new ArrayList<>(); - for (SltAgreementInfo bean : list) { - List oneOfList = sltAgreementInfoMapper.getLoseList(bean); + + List oneOfList = sltAgreementInfoMapper.getLoseList(info); loseList.addAll(oneOfList); - } + for (SltAgreementInfo bean : loseList) { if (null == bean.getBuyPrice()) { bean.setBuyPrice(BigDecimal.valueOf(0.00)); @@ -318,53 +322,53 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { private List getRelations(List leaseList, List repairList, List scrapList, List loseList, - List list) { + SltAgreementInfo sltInfo) { List relations = new ArrayList<>(); - for (SltAgreementInfo 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())) { - relation.setAgreementId(String.valueOf(lease.getAgreementId())); - relation.setProjectName(lease.getProjectName()); - relation.setUnitName(lease.getUnitName()); - relation.setCompanyId(lease.getCompanyId()); - BigDecimal cost = lease.getCosts(); - leaseCost = leaseCost.add(cost); - } +// for (SltAgreementInfo 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(sltInfo.getAgreementId().toString())) { + relation.setAgreementId(String.valueOf(lease.getAgreementId())); + relation.setProjectName(lease.getProjectName()); + relation.setUnitName(lease.getUnitName()); + relation.setCompanyId(lease.getCompanyId()); + BigDecimal cost = lease.getCosts(); + leaseCost = leaseCost.add(cost); } - for (SltAgreementInfo repair : repairList) { - if (repair.getAgreementId().equals(info.getAgreementId().toString())) { - BigDecimal cost = repair.getCosts(); - repairCost = repairCost.add(cost); - } - } - for (SltAgreementInfo scrap : scrapList) { - if (scrap.getAgreementId().equals(info.getAgreementId().toString())) { - BigDecimal cost = scrap.getCosts(); - scrapCost = scrapCost.add(cost); - } - } - for (SltAgreementInfo lose : loseList) { - if (lose.getAgreementId().equals(info.getAgreementId().toString())) { - //TODO 上面已经set过值,这里为什么还要set值 - relation.setAgreementId(String.valueOf(lose.getAgreementId())); - relation.setProjectName(lose.getProjectName()); - relation.setUnitName(lose.getUnitName()); - relation.setCompanyId(lose.getCompanyId()); - BigDecimal cost = lose.getCosts(); - loseCost = loseCost.add(cost); - } - } - relation.setLeaseCost(leaseCost); - relation.setRepairCost(repairCost); - relation.setScrapCost(scrapCost); - relation.setLoseCost(loseCost); - relations.add(relation); } + for (SltAgreementInfo repair : repairList) { + if (repair.getAgreementId().equals(sltInfo.getAgreementId().toString())) { + BigDecimal cost = repair.getCosts(); + repairCost = repairCost.add(cost); + } + } + for (SltAgreementInfo scrap : scrapList) { + if (scrap.getAgreementId().equals(sltInfo.getAgreementId().toString())) { + BigDecimal cost = scrap.getCosts(); + scrapCost = scrapCost.add(cost); + } + } + for (SltAgreementInfo lose : loseList) { + if (lose.getAgreementId().equals(sltInfo.getAgreementId().toString())) { + //TODO 上面已经set过值,这里为什么还要set值 + relation.setAgreementId(String.valueOf(lose.getAgreementId())); + relation.setProjectName(lose.getProjectName()); + relation.setUnitName(lose.getUnitName()); + relation.setCompanyId(lose.getCompanyId()); + BigDecimal cost = lose.getCosts(); + loseCost = loseCost.add(cost); + } + } + relation.setLeaseCost(leaseCost); + relation.setRepairCost(repairCost); + relation.setScrapCost(scrapCost); + relation.setLoseCost(loseCost); + relations.add(relation); +// } return relations; } @@ -376,35 +380,121 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { */ @Override public int submitCosts(SltInfoVo sltInfoVo) { - sltInfoVo.setCreateTime(DateUtils.getNowDate()); - sltInfoVo.setCreateBy(String.valueOf(SecurityUtils.getUserId())); try { - int countOne = sltAgreementInfoMapper.insertSltAgreementApply(sltInfoVo); - if(countOne!=1){ - throw new ServiceException("slt_agreement_apply新增失败"); - } - // 插入成功后,sltInfoVo 的 id 属性将被自动设置为新生成的主键值 - Long newId = sltInfoVo.getId(); - int countTwo = sltAgreementInfoMapper.updateBmAgreementStatus(sltInfoVo); - if(countTwo!=1){ - throw new ServiceException("bm_agreement_info修改失败"); - } - if(sltInfoVo.getLeaseList().size()>0){ - sltAgreementInfoMapper.insertSltAgreementDetailLease(sltInfoVo.getLeaseList(),newId); - } - if(sltInfoVo.getRepairList().size()>0){ - sltAgreementInfoMapper.insertSltAgreementDetailRepair(sltInfoVo.getRepairList(),newId); - } - if(sltInfoVo.getScrapList().size()>0){ - sltAgreementInfoMapper.insertSltAgreementDetailScrap(sltInfoVo.getScrapList(),newId); - } - if(sltInfoVo.getLoseList().size()>0){ - sltAgreementInfoMapper.insertSltAgreementDetailLose(sltInfoVo.getLoseList(),newId); + //查找是否驳回 + int countReject = sltAgreementInfoMapper.getRejectCount(sltInfoVo); + if(countReject>0){ + Long id = sltAgreementInfoMapper.getRejectId(sltInfoVo); + //修改 + int countAgain = sltAgreementInfoMapper.updateRejectCount(sltInfoVo); + if(countAgain==0){ + throw new ServiceException("slt_agreement_apply修改失败"); + } + sltInfoVo.setUpdateTime(DateUtils.getNowDate()); + sltInfoVo.setCreateBy(String.valueOf(SecurityUtils.getUserId())); + int countTwo = sltAgreementInfoMapper.updateBmAgreementStatus(sltInfoVo); + if(countTwo!=1){ + throw new ServiceException("bm_agreement_info修改失败"); + } + + if(sltInfoVo.getLeaseList().size()>0){ + sltAgreementInfoMapper.insertSltAgreementDetailLease(sltInfoVo.getLeaseList(),id); + } + if(sltInfoVo.getRepairList().size()>0){ + sltAgreementInfoMapper.insertSltAgreementDetailRepair(sltInfoVo.getRepairList(),id); + } + if(sltInfoVo.getScrapList().size()>0){ + sltAgreementInfoMapper.insertSltAgreementDetailScrap(sltInfoVo.getScrapList(),id); + } + if(sltInfoVo.getLoseList().size()>0){ + sltAgreementInfoMapper.insertSltAgreementDetailLose(sltInfoVo.getLoseList(),id); + } + }else{ + sltInfoVo.setCreateTime(DateUtils.getNowDate()); + sltInfoVo.setCreateBy(String.valueOf(SecurityUtils.getUserId())); + //新增 + int countOne = sltAgreementInfoMapper.insertSltAgreementApply(sltInfoVo); + if(countOne!=1){ + throw new ServiceException("slt_agreement_apply新增失败"); + } + // 插入成功后,sltInfoVo 的 id 属性将被自动设置为新生成的主键值 + Long newId = sltInfoVo.getId(); + sltInfoVo.setUpdateTime(DateUtils.getNowDate()); + int countTwo = sltAgreementInfoMapper.updateBmAgreementStatus(sltInfoVo); + if(countTwo!=1){ + throw new ServiceException("bm_agreement_info修改失败"); + } + + if(sltInfoVo.getLeaseList().size()>0){ + sltAgreementInfoMapper.insertSltAgreementDetailLease(sltInfoVo.getLeaseList(),newId); + } + if(sltInfoVo.getRepairList().size()>0){ + sltAgreementInfoMapper.insertSltAgreementDetailRepair(sltInfoVo.getRepairList(),newId); + } + if(sltInfoVo.getScrapList().size()>0){ + sltAgreementInfoMapper.insertSltAgreementDetailScrap(sltInfoVo.getScrapList(),newId); + } + if(sltInfoVo.getLoseList().size()>0){ + sltAgreementInfoMapper.insertSltAgreementDetailLose(sltInfoVo.getLoseList(),newId); + } } + return 1; } catch (Exception e) { throw new ServiceException("错误信息描述"); } } + + /** + * 结算审批列表 + * + * @param bean 结算信息 + * @return 结果 + */ + @Override + public List getSltList(SltAgreementInfo bean) { + return sltAgreementInfoMapper.getSltList(bean); + } + + /** + * 进行结算审批 + * + * @param sltAgreementApply 进行结算审批 + * @return 结果 + */ + @Override + public AjaxResult costExamine(SltAgreementApply sltAgreementApply) + { + try { + Long userid = SecurityUtils.getLoginUser().getUserid(); + sltAgreementApply.setAuditor(String.valueOf(userid)); + sltAgreementApply.setAuditTime(DateUtils.getNowDate()); + sltAgreementApply.setUpdateTime(DateUtils.getNowDate()); + if(sltAgreementApply.getStatus().equals("3")){ + //驳回 + int count = sltAgreementInfoMapper.costExame(sltAgreementApply); + sltAgreementInfoMapper.costDeleteDetail(sltAgreementApply); + if(count!= 1){ + return AjaxResult.error("结算审批失败"); + }else{ + int countTwo = sltAgreementInfoMapper.updateBmAgreementReject(sltAgreementApply); + if(countTwo!=1){ + return AjaxResult.error("bm_agreement_info修改失败"); + } + return AjaxResult.success(); + } + }else{ + //通过 + int count = sltAgreementInfoMapper.costExame(sltAgreementApply); + if(count != 1){ + return AjaxResult.error("结算审批失败"); + }else{ + return AjaxResult.success(); + } + } + } catch (Exception e) { + return AjaxResult.error(); + } + } } 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 cdf3f721..193e3c19 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 @@ -176,15 +176,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + select + count(id) + from slt_agreement_apply saa + where saa.agreement_id = #{agreementId} + + insert into slt_agreement_apply @@ -437,7 +443,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{agreementCode}, #{createBy}, #{createTime}, - 0, + 1, #{totalCostAll}, @@ -446,26 +452,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update bm_agreement_info bai set - bai.is_slt = 1, bai.update_by = #{createBy}, bai.update_time = #{createTime} + bai.is_slt = 1, bai.update_by = #{createBy}, bai.update_time = #{updateTime} where bai.agreement_id = #{agreementId} - insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,unit_name,num,start_time,end_time,price,money) + insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,num,start_time,end_time,price,money) values - (#{id}, #{item.typeId}, #{item.maId},1, #{item.mtUnitName},#{item.num},#{item.startTime},#{item.endTime},#{item.leasePrice},#{item.costs}) + (#{id}, #{item.typeId}, #{item.maId},1,#{item.num},#{item.startTime},#{item.endTime},#{item.leasePrice},#{item.costs}) - insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,unit_name,num,money,is_charge) + insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,num,money,is_charge) values - (#{id}, #{item.typeId}, #{item.maId},3, #{item.mtUnitName},#{item.num},#{item.costs}, + (#{id}, #{item.typeId}, #{item.maId},3,#{item.num},#{item.costs}, 1 0 @@ -475,10 +481,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,unit_name,num,money,is_charge) + insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,num,money,is_charge) values - (#{id}, #{item.typeId}, #{item.maId},4, #{item.mtUnitName},#{item.num},#{item.costs}, + (#{id}, #{item.typeId}, #{item.maId},4,#{item.num},#{item.costs}, 1 0 @@ -488,10 +494,84 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,unit_name,num,money) + insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,num,money) values - (#{id}, #{item.typeId}, #{item.maId},2, #{item.mtUnitName},#{item.num},#{item.costs}) + (#{id}, #{item.typeId}, #{item.maId},2,#{item.num},#{item.costs}) + + + + + + + update slt_agreement_apply + set status = '1', + update_time = now(), + audit_Time = null, + auditor = null, + remark = null, + cost = #{totalCostAll} + where agreement_id = #{agreementId} + + + + update slt_agreement_apply + + status = #{status}, + update_time = #{updateTime}, + audit_time = #{auditTime}, + auditor = #{auditor}, + remark = #{remark} + + where id = #{id} + + + + delete from slt_agreement_details where apply_id = #{id} + + + + update + bm_agreement_info bai + set + bai.is_slt = 0, bai.update_by = #{auditor}, bai.update_time = #{auditTime} + where + bai.agreement_id = #{agreementId} + \ No newline at end of file