结算审批

This commit is contained in:
hongchao 2025-01-20 17:14:23 +08:00
parent ac92f47acb
commit 2c7d7b1da1
8 changed files with 481 additions and 202 deletions

View File

@ -203,7 +203,7 @@ public class PoiOutPage {
return workbook; return workbook;
} }
public static HSSFWorkbook excelForcheckTwo(List<Map<String, Object>> result, List<String> list, String filename, String unit, String projectName, BigDecimal totalCost) { public static HSSFWorkbook excelForcheckTwo(List<Map<String, Object>> result, List<String> list, String filename, String projectName, String unit, BigDecimal totalCost) {
// 创建工作簿和工作表 // 创建工作簿和工作表
HSSFWorkbook workbook = new HSSFWorkbook(); HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet(); HSSFSheet sheet = workbook.createSheet();
@ -237,7 +237,7 @@ public class PoiOutPage {
} }
public static HSSFWorkbook excelForcheckAll(List<Map<String, Object>> resultLease,List<Map<String, Object>> resultLose,List<Map<String, Object>> resultRepair,List<Map<String, Object>> resultScrap, public static HSSFWorkbook excelForcheckAll(List<Map<String, Object>> resultLease,List<Map<String, Object>> resultLose,List<Map<String, Object>> resultRepair,List<Map<String, Object>> resultScrap,
List<String> listLease,List<String> listLose,List<String> listRepair,List<String> listScrap, String filename, String unit, String projectName, List<String> listLease,List<String> listLose,List<String> listRepair,List<String> listScrap, String filename, String projectName, String unit,
BigDecimal totalCostLease, BigDecimal totalCostLose, BigDecimal totalCostRepair, BigDecimal totalCostScrap) { BigDecimal totalCostLease, BigDecimal totalCostLose, BigDecimal totalCostRepair, BigDecimal totalCostScrap) {
// 创建工作簿和工作表 // 创建工作簿和工作表
HSSFWorkbook workbook = new HSSFWorkbook(); HSSFWorkbook workbook = new HSSFWorkbook();

View File

@ -16,6 +16,7 @@ import com.bonus.common.biz.config.PoiOutPage;
import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.biz.enums.TmTaskTypeEnum;
import com.bonus.common.log.enums.OperaType; import com.bonus.common.log.enums.OperaType;
import com.bonus.material.common.annotation.PreventRepeatSubmit; 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.lease.domain.vo.LeaseOutVo;
import com.bonus.material.settlement.domain.SltAgreementApply; import com.bonus.material.settlement.domain.SltAgreementApply;
import com.bonus.material.settlement.domain.vo.SltInfoVo; import com.bonus.material.settlement.domain.vo.SltInfoVo;
@ -91,8 +92,8 @@ public class SltAgreementInfoController extends BaseController {
@ApiOperation(value = "根据协议获取结算清单") @ApiOperation(value = "根据协议获取结算清单")
@PostMapping("/getSltInfo") @PostMapping("/getSltInfo")
public AjaxResult getSltInfo(@RequestBody List<SltAgreementInfo> list) { public AjaxResult getSltInfo(@RequestBody SltAgreementInfo info) {
SltInfoVo bean = sltAgreementInfoService.getSltInfo(list); SltInfoVo bean = sltAgreementInfoService.getSltInfo(info);
return AjaxResult.success(bean); return AjaxResult.success(bean);
} }
@ -107,24 +108,24 @@ public class SltAgreementInfoController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/** // /**
* 获取结算审核清单 // * 获取结算审核清单
*/ // */
@ApiOperation(value = "获取结算审核清单") // @ApiOperation(value = "获取结算审核清单")
@GetMapping("/getSltExamInfo") // @GetMapping("/getSltExamInfo")
public AjaxResult getSltExamInfo(SltAgreementApply apply) { // public AjaxResult getSltExamInfo(SltAgreementApply apply) {
SltInfoVo bean = sltAgreementInfoService.getSltExamInfo(apply); // SltInfoVo bean = sltAgreementInfoService.getSltExamInfo(apply);
return AjaxResult.success(bean); // return AjaxResult.success(bean);
} // }
/** // /**
* 结算审核 // * 结算审核
*/ // */
@ApiOperation(value = "结算审核") // @ApiOperation(value = "结算审核")
@GetMapping("/settlementReview") // @GetMapping("/settlementReview")
public AjaxResult settlementReview(SltAgreementApply apply) { // public AjaxResult settlementReview(SltAgreementApply apply) {
return toAjax(sltAgreementInfoService.settlementReview(apply)); // return toAjax(sltAgreementInfoService.settlementReview(apply));
} // }
/** /**
* 导出结算信息列表 * 导出结算信息列表
@ -719,7 +720,9 @@ public class SltAgreementInfoController extends BaseController {
return toAjax(sltAgreementInfoService.deleteSltAgreementInfoByIds(ids)); return toAjax(sltAgreementInfoService.deleteSltAgreementInfoByIds(ids));
} }
/**
* 提交结算清单
*/
@ApiOperation(value = "提交结算清单") @ApiOperation(value = "提交结算清单")
@PostMapping("/submitCosts") @PostMapping("/submitCosts")
public AjaxResult submitCosts(@RequestBody SltInfoVo sltInfoVo) { public AjaxResult submitCosts(@RequestBody SltInfoVo sltInfoVo) {
@ -729,4 +732,28 @@ public class SltAgreementInfoController extends BaseController {
return error("系统错误, " + e.getMessage()); return error("系统错误, " + e.getMessage());
} }
} }
/**
* 结算审批列表
*/
@ApiOperation(value = "结算审批列表")
@GetMapping("/getSltList")
public TableDataInfo getSltList(SltAgreementInfo bean) {
startPage();
List<SltAgreementInfo> 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());
}
}
} }

View File

@ -25,6 +25,10 @@ public class SltAgreementApply extends BaseEntity {
/** $column.columnComment */ /** $column.columnComment */
private Long id; private Long id;
/** 协议id */
@ApiModelProperty(value = "协议id")
private Long agreementId;
/** 结算单号例如JS202402-1 */ /** 结算单号例如JS202402-1 */
@Excel(name = "结算单号", readConverterExp = "例=如JS202402-1") @Excel(name = "结算单号", readConverterExp = "例=如JS202402-1")
private String code; private String code;
@ -45,9 +49,9 @@ public class SltAgreementApply extends BaseEntity {
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date auditTime; private Date auditTime;
/** 状态0待审核1审核通过2审核驳回 */ /** 状态0未结算1待审核2审核通过3审核驳回 */
@Excel(name = "状态0待审核1审核通过2审核驳回") @Excel(name = "状态0未结算1待审核2审核通过3审核驳回")
@ApiModelProperty(value = "状态0待审核1审核通过2审核驳回") @ApiModelProperty(value = "状态0未结算1待审核2审核通过3审核驳回")
private String status; private String status;
/** 数据所属 */ /** 数据所属 */
@ -60,5 +64,6 @@ public class SltAgreementApply extends BaseEntity {
@ApiModelProperty(value = "结算总费用") @ApiModelProperty(value = "结算总费用")
private BigDecimal cost; private BigDecimal cost;
@ApiModelProperty(value = "原因")
private String remark;
} }

View File

@ -197,4 +197,13 @@ public class SltAgreementInfo extends BaseEntity {
private String keyWord; private String keyWord;
/** 审核人 */
@ApiModelProperty(value = "审核人")
private String auditor;
/** 审核时间 */
@ApiModelProperty(value = "审核时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date auditTime;
} }

View File

@ -106,6 +106,14 @@ public interface SltAgreementInfoMapper {
*/ */
int deleteSltInfo(@Param("record") LeaseOutDetails leaseOutDetails); int deleteSltInfo(@Param("record") LeaseOutDetails leaseOutDetails);
/**
* 查找是否驳回
*
* @param sltInfoVo 结算信息
* @return 结果
*/
public int getRejectCount(SltInfoVo sltInfoVo);
/** /**
* 新增结算审核信息 * 新增结算审核信息
* *
@ -153,4 +161,46 @@ public interface SltAgreementInfoMapper {
* @return * @return
*/ */
int insertSltAgreementDetailLose(@Param("list") List<SltAgreementInfo> list,@Param("id") Long id); int insertSltAgreementDetailLose(@Param("list") List<SltAgreementInfo> list,@Param("id") Long id);
/**
* 结算审批列表
*
* @param bean 结算信息
* @return 结果
*/
List<SltAgreementInfo> 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);
} }

View File

@ -2,6 +2,8 @@ package com.bonus.material.settlement.service;
import java.util.List; 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.SltAgreementApply;
import com.bonus.material.settlement.domain.SltAgreementInfo; import com.bonus.material.settlement.domain.SltAgreementInfo;
import com.bonus.material.settlement.domain.vo.SltInfoVo; import com.bonus.material.settlement.domain.vo.SltInfoVo;
@ -31,13 +33,13 @@ public interface ISltAgreementInfoService {
public List<SltAgreementInfo> getSltAgreementInfo4Project(SltAgreementInfo bean); public List<SltAgreementInfo> getSltAgreementInfo4Project(SltAgreementInfo bean);
public SltInfoVo getSltInfo(List<SltAgreementInfo> list); public SltInfoVo getSltInfo(SltAgreementInfo info);
List<SltAgreementApply> getSltExam(SltAgreementInfo bean); List<SltAgreementApply> 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 结果 * @return 结果
*/ */
public int submitCosts(SltInfoVo sltInfoVo); public int submitCosts(SltInfoVo sltInfoVo);
/**
* 结算审批列表
*
* @param bean 结算信息
* @return 结果
*/
List<SltAgreementInfo> getSltList(SltAgreementInfo bean);
/**
* 进行结算审批
*
* @param sltAgreementApply 进行结算审批
* @return 结果
*/
AjaxResult costExamine(SltAgreementApply sltAgreementApply);
} }

View File

@ -7,7 +7,9 @@ import java.util.List;
import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.biz.enums.TmTaskTypeEnum;
import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils; 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.common.security.utils.SecurityUtils;
import com.bonus.material.countersign.domain.SignConfigVo;
import com.bonus.material.settlement.domain.SltAgreementApply; import com.bonus.material.settlement.domain.SltAgreementApply;
import com.bonus.material.settlement.domain.SltAgreementRelation; import com.bonus.material.settlement.domain.SltAgreementRelation;
import com.bonus.material.settlement.domain.vo.SltInfoVo; import com.bonus.material.settlement.domain.vo.SltInfoVo;
@ -64,22 +66,24 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
} }
@Override @Override
public SltInfoVo getSltInfo(List<SltAgreementInfo> list) { public SltInfoVo getSltInfo(SltAgreementInfo info) {
SltInfoVo sltInfoVo = new SltInfoVo(); SltInfoVo sltInfoVo = new SltInfoVo();
sltInfoVo.setUnitName(list.get(0).getUnitName()); sltInfoVo.setUnitName(info.getUnitName());
sltInfoVo.setProjectName(list.get(0).getProjectName()); sltInfoVo.setProjectName(info.getProjectName());
// sltInfoVo.setUnitName(list.get(0).getUnitName());
// sltInfoVo.setProjectName(list.get(0).getProjectName());
BigDecimal leaseCost = BigDecimal.valueOf(0.00); BigDecimal leaseCost = BigDecimal.valueOf(0.00);
BigDecimal repairCost = BigDecimal.valueOf(0.00); BigDecimal repairCost = BigDecimal.valueOf(0.00);
BigDecimal scrapCost = BigDecimal.valueOf(0.00); BigDecimal scrapCost = BigDecimal.valueOf(0.00);
BigDecimal loseCost = BigDecimal.valueOf(0.00); BigDecimal loseCost = BigDecimal.valueOf(0.00);
//租赁费用列表 //租赁费用列表
List<SltAgreementInfo> leaseList = getLeaseList(list); List<SltAgreementInfo> leaseList = getLeaseList(info);
//维修费用列表 //维修费用列表
List<SltAgreementInfo> repairList = getRepairList(list); List<SltAgreementInfo> repairList = getRepairList(info);
//报废费用列表 //报废费用列表
List<SltAgreementInfo> scrapList = getScrapList(list); List<SltAgreementInfo> scrapList = getScrapList(info);
//丢失费用列表 //丢失费用列表
List<SltAgreementInfo> loseList = getLoseList(list); List<SltAgreementInfo> loseList = getLoseList(info);
sltInfoVo.setLeaseList(leaseList); sltInfoVo.setLeaseList(leaseList);
sltInfoVo.setRepairList(repairList); sltInfoVo.setRepairList(repairList);
sltInfoVo.setScrapList(scrapList); sltInfoVo.setScrapList(scrapList);
@ -109,7 +113,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
sltInfoVo.setRepairCost(repairCost); sltInfoVo.setRepairCost(repairCost);
sltInfoVo.setScrapCost(scrapCost); sltInfoVo.setScrapCost(scrapCost);
sltInfoVo.setLoseCost(loseCost); sltInfoVo.setLoseCost(loseCost);
List<SltAgreementRelation> relations = getRelations(leaseList, repairList, scrapList, loseList, list); List<SltAgreementRelation> relations = getRelations(leaseList, repairList, scrapList, loseList, info);
sltInfoVo.setRelations(relations); sltInfoVo.setRelations(relations);
return sltInfoVo; return sltInfoVo;
} }
@ -119,66 +123,66 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
return sltAgreementInfoMapper.getSltExam(bean); return sltAgreementInfoMapper.getSltExam(bean);
} }
@Override // @Override
public SltInfoVo getSltExamInfo(SltAgreementApply apply) { // public SltInfoVo getSltExamInfo(SltAgreementApply apply) {
SltInfoVo sltInfoVo = new SltInfoVo(); // SltInfoVo sltInfoVo = new SltInfoVo();
List<SltAgreementInfo> list = new ArrayList<>(); // List<SltAgreementInfo> list = new ArrayList<>();
String cost = sltAgreementInfoMapper.getCost(apply); // String cost = sltAgreementInfoMapper.getCost(apply);
List<SltAgreementRelation> relations = sltAgreementInfoMapper.getRelations(apply); // List<SltAgreementRelation> relations = sltAgreementInfoMapper.getRelations(apply);
sltInfoVo.setRelations(relations); // sltInfoVo.setRelations(relations);
for (SltAgreementRelation relation : relations) { // for (SltAgreementRelation relation : relations) {
SltAgreementInfo info = new SltAgreementInfo(); // SltAgreementInfo info = new SltAgreementInfo();
info.setAgreementId(Long.valueOf(relation.getAgreementId())); // info.setAgreementId(Long.valueOf(relation.getAgreementId()));
list.add(info); // list.add(info);
} // }
List<SltAgreementInfo> leaseList = getLeaseList(list); // List<SltAgreementInfo> leaseList = getLeaseList(list);
List<SltAgreementInfo> repairList = getRepairList(list); // List<SltAgreementInfo> repairList = getRepairList(list);
List<SltAgreementInfo> scrapList = getScrapList(list); // List<SltAgreementInfo> scrapList = getScrapList(list);
List<SltAgreementInfo> loseList = getLoseList(list); // List<SltAgreementInfo> loseList = getLoseList(list);
sltInfoVo.setLeaseList(leaseList); // sltInfoVo.setLeaseList(leaseList);
sltInfoVo.setRepairList(repairList); // sltInfoVo.setRepairList(repairList);
sltInfoVo.setScrapList(scrapList); // sltInfoVo.setScrapList(scrapList);
sltInfoVo.setLoseList(loseList); // sltInfoVo.setLoseList(loseList);
sltInfoVo.setCost(cost); // sltInfoVo.setCost(cost);
return sltInfoVo; // return sltInfoVo;
} // }
@Override // @Override
@Transactional // @Transactional
public int settlementReview(SltAgreementApply apply) { // public int settlementReview(SltAgreementApply apply) {
Long userid = SecurityUtils.getLoginUser().getUserid(); // Long userid = SecurityUtils.getLoginUser().getUserid();
apply.setAuditor(String.valueOf(userid)); // apply.setAuditor(String.valueOf(userid));
int j; // int j;
if ("2".equals(apply.getStatus())) { // if ("2".equals(apply.getStatus())) {
// 驳回 // // 驳回
int i = sltAgreementInfoMapper.updateRelation(apply); // int i = sltAgreementInfoMapper.updateRelation(apply);
j = sltAgreementInfoMapper.updateApply(apply); // j = sltAgreementInfoMapper.updateApply(apply);
} else { // } else {
// 通过 // // 通过
int i = sltAgreementInfoMapper.updateRelation(apply); // int i = sltAgreementInfoMapper.updateRelation(apply);
if (i > 0) { // if (i > 0) {
List<SltAgreementRelation> relations = sltAgreementInfoMapper.getRelations(apply); // List<SltAgreementRelation> relations = sltAgreementInfoMapper.getRelations(apply);
List<SltAgreementInfo> infos = new ArrayList<>(); // List<SltAgreementInfo> infos = new ArrayList<>();
for (SltAgreementRelation bean : relations) { // for (SltAgreementRelation bean : relations) {
SltAgreementInfo info = new SltAgreementInfo(); // SltAgreementInfo info = new SltAgreementInfo();
info.setAgreementId(Long.valueOf(bean.getAgreementId())); // info.setAgreementId(Long.valueOf(bean.getAgreementId()));
infos.add(info); // infos.add(info);
} // }
List<SltAgreementInfo> loseList = getLoseList(infos); // List<SltAgreementInfo> loseList = getLoseList(infos);
for (SltAgreementInfo agreementInfo : loseList) { // for (SltAgreementInfo agreementInfo : loseList) {
if (agreementInfo.getMaId() != null) { // if (agreementInfo.getMaId() != null) {
agreementInfo.setStatus("103"); // agreementInfo.setStatus("103");
sltAgreementInfoMapper.updateMaStatus(agreementInfo); // sltAgreementInfoMapper.updateMaStatus(agreementInfo);
} // }
} // }
j = sltAgreementInfoMapper.updateApply(apply); // j = sltAgreementInfoMapper.updateApply(apply);
} else { // } else {
throw new ServiceException("结算审核失败"); // throw new ServiceException("结算审核失败");
//throw new ServiceException(ExceptionDict.SETTLEMENT_REVIEW_ERROR_MSG,ExceptionDict.SETTLEMENT_REVIEW_ERROR); // //throw new ServiceException(ExceptionDict.SETTLEMENT_REVIEW_ERROR_MSG,ExceptionDict.SETTLEMENT_REVIEW_ERROR);
} // }
} // }
return j; // return j;
} // }
/** /**
* 新增结算信息 * 新增结算信息
@ -234,12 +238,12 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
return sltAgreementInfoMapper.deleteSltAgreementInfoById(id); return sltAgreementInfoMapper.deleteSltAgreementInfoById(id);
} }
public List<SltAgreementInfo> getLeaseList(List<SltAgreementInfo> list) { public List<SltAgreementInfo> getLeaseList(SltAgreementInfo info) {
List<SltAgreementInfo> leaseList = new ArrayList<>(); List<SltAgreementInfo> leaseList = new ArrayList<>();
for (SltAgreementInfo bean : list) {
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseList(bean); List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseList(info);
leaseList.addAll(oneOfList); leaseList.addAll(oneOfList);
}
for (SltAgreementInfo bean : leaseList) { for (SltAgreementInfo bean : leaseList) {
if (null == bean.getLeasePrice()) { if (null == bean.getLeasePrice()) {
bean.setLeasePrice(BigDecimal.valueOf(0.00)); bean.setLeasePrice(BigDecimal.valueOf(0.00));
@ -261,7 +265,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
return leaseList; return leaseList;
} }
public List<SltAgreementInfo> getRepairList(List<SltAgreementInfo> list) { public List<SltAgreementInfo> getRepairList(SltAgreementInfo info) {
List<SltAgreementInfo> repairList = new ArrayList<>(); List<SltAgreementInfo> repairList = new ArrayList<>();
// Integer taskType = TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId(); // Integer taskType = TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId();
// for (SltAgreementInfo bean : list) { // for (SltAgreementInfo bean : list) {
@ -271,34 +275,34 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
// repairList.addAll(repairDetailsList); // repairList.addAll(repairDetailsList);
// } // }
// } // }
for(SltAgreementInfo bean : list){
List<TmTask> taskList = taskMapper.getTaskIdList(bean); List<TmTask> taskList = taskMapper.getTaskIdList(info);
if (null!= taskList &&!taskList.isEmpty()) { if (null!= taskList &&!taskList.isEmpty()) {
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList); List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList);
repairList.addAll(repairDetailsList); repairList.addAll(repairDetailsList);
} }
}
return repairList; return repairList;
} }
public List<SltAgreementInfo> getScrapList(List<SltAgreementInfo> list) { public List<SltAgreementInfo> getScrapList(SltAgreementInfo info) {
List<SltAgreementInfo> scrapList = new ArrayList<>(); List<SltAgreementInfo> scrapList = new ArrayList<>();
for (SltAgreementInfo bean : list) {
List<TmTask> taskList = taskMapper.getTaskIdList(bean); List<TmTask> taskList = taskMapper.getTaskIdList(info);
if (null != taskList && !taskList.isEmpty()) { if (null != taskList && !taskList.isEmpty()) {
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskList); List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskList);
scrapList.addAll(scrapDetailsList); scrapList.addAll(scrapDetailsList);
} }
}
return scrapList; return scrapList;
} }
public List<SltAgreementInfo> getLoseList(List<SltAgreementInfo> list) { public List<SltAgreementInfo> getLoseList(SltAgreementInfo info) {
List<SltAgreementInfo> loseList = new ArrayList<>(); List<SltAgreementInfo> loseList = new ArrayList<>();
for (SltAgreementInfo bean : list) {
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLoseList(bean); List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLoseList(info);
loseList.addAll(oneOfList); loseList.addAll(oneOfList);
}
for (SltAgreementInfo bean : loseList) { for (SltAgreementInfo bean : loseList) {
if (null == bean.getBuyPrice()) { if (null == bean.getBuyPrice()) {
bean.setBuyPrice(BigDecimal.valueOf(0.00)); bean.setBuyPrice(BigDecimal.valueOf(0.00));
@ -318,53 +322,53 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
private List<SltAgreementRelation> getRelations(List<SltAgreementInfo> leaseList, List<SltAgreementInfo> repairList, private List<SltAgreementRelation> getRelations(List<SltAgreementInfo> leaseList, List<SltAgreementInfo> repairList,
List<SltAgreementInfo> scrapList, List<SltAgreementInfo> loseList, List<SltAgreementInfo> scrapList, List<SltAgreementInfo> loseList,
List<SltAgreementInfo> list) { SltAgreementInfo sltInfo) {
List<SltAgreementRelation> relations = new ArrayList<>(); List<SltAgreementRelation> relations = new ArrayList<>();
for (SltAgreementInfo info : list) { // for (SltAgreementInfo info : list) {
SltAgreementRelation relation = new SltAgreementRelation(); SltAgreementRelation relation = new SltAgreementRelation();
BigDecimal loseCost = BigDecimal.ZERO; BigDecimal loseCost = BigDecimal.ZERO;
BigDecimal leaseCost = BigDecimal.ZERO; BigDecimal leaseCost = BigDecimal.ZERO;
BigDecimal scrapCost = BigDecimal.ZERO; BigDecimal scrapCost = BigDecimal.ZERO;
BigDecimal repairCost = BigDecimal.ZERO; BigDecimal repairCost = BigDecimal.ZERO;
for (SltAgreementInfo lease : leaseList) { for (SltAgreementInfo lease : leaseList) {
if (lease.getAgreementId().equals(info.getAgreementId().toString())) { if (lease.getAgreementId().equals(sltInfo.getAgreementId().toString())) {
relation.setAgreementId(String.valueOf(lease.getAgreementId())); relation.setAgreementId(String.valueOf(lease.getAgreementId()));
relation.setProjectName(lease.getProjectName()); relation.setProjectName(lease.getProjectName());
relation.setUnitName(lease.getUnitName()); relation.setUnitName(lease.getUnitName());
relation.setCompanyId(lease.getCompanyId()); relation.setCompanyId(lease.getCompanyId());
BigDecimal cost = lease.getCosts(); BigDecimal cost = lease.getCosts();
leaseCost = leaseCost.add(cost); 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; return relations;
} }
@ -376,35 +380,121 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
*/ */
@Override @Override
public int submitCosts(SltInfoVo sltInfoVo) { public int submitCosts(SltInfoVo sltInfoVo) {
sltInfoVo.setCreateTime(DateUtils.getNowDate());
sltInfoVo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
try { try {
int countOne = sltAgreementInfoMapper.insertSltAgreementApply(sltInfoVo); //查找是否驳回
if(countOne!=1){ int countReject = sltAgreementInfoMapper.getRejectCount(sltInfoVo);
throw new ServiceException("slt_agreement_apply新增失败"); if(countReject>0){
} Long id = sltAgreementInfoMapper.getRejectId(sltInfoVo);
// 插入成功后sltInfoVo id 属性将被自动设置为新生成的主键值 //修改
Long newId = sltInfoVo.getId(); int countAgain = sltAgreementInfoMapper.updateRejectCount(sltInfoVo);
int countTwo = sltAgreementInfoMapper.updateBmAgreementStatus(sltInfoVo); if(countAgain==0){
if(countTwo!=1){ throw new ServiceException("slt_agreement_apply修改失败");
throw new ServiceException("bm_agreement_info修改失败"); }
} sltInfoVo.setUpdateTime(DateUtils.getNowDate());
if(sltInfoVo.getLeaseList().size()>0){ sltInfoVo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
sltAgreementInfoMapper.insertSltAgreementDetailLease(sltInfoVo.getLeaseList(),newId); int countTwo = sltAgreementInfoMapper.updateBmAgreementStatus(sltInfoVo);
} if(countTwo!=1){
if(sltInfoVo.getRepairList().size()>0){ throw new ServiceException("bm_agreement_info修改失败");
sltAgreementInfoMapper.insertSltAgreementDetailRepair(sltInfoVo.getRepairList(),newId); }
}
if(sltInfoVo.getScrapList().size()>0){ if(sltInfoVo.getLeaseList().size()>0){
sltAgreementInfoMapper.insertSltAgreementDetailScrap(sltInfoVo.getScrapList(),newId); sltAgreementInfoMapper.insertSltAgreementDetailLease(sltInfoVo.getLeaseList(),id);
} }
if(sltInfoVo.getLoseList().size()>0){ if(sltInfoVo.getRepairList().size()>0){
sltAgreementInfoMapper.insertSltAgreementDetailLose(sltInfoVo.getLoseList(),newId); 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; return 1;
} catch (Exception e) { } catch (Exception e) {
throw new ServiceException("错误信息描述"); throw new ServiceException("错误信息描述");
} }
} }
/**
* 结算审批列表
*
* @param bean 结算信息
* @return 结果
*/
@Override
public List<SltAgreementInfo> 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();
}
}
} }

View File

@ -176,15 +176,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="getSltAgreementInfo4Project" resultType="com.bonus.material.settlement.domain.SltAgreementInfo"> <select id="getSltAgreementInfo4Project" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
SELECT bai.agreement_id as agreementId, bai.agreement_code as agreementCode, contract_code,file_url ,file_name,sign_time, SELECT bai.agreement_id as agreementId, bai.agreement_code as agreementCode,
bui.unit_id as unitId,bui.unit_name as unitName, bp.pro_id as projectId , bp.pro_name as projectName, bui.unit_id as unitId,bui.unit_name as unitName, bp.pro_id as projectId , bp.pro_name as projectName,
plan_start_time,lease_day,auth_person,phone,saa.remark,bai.protocol,sar.cost as cost,sar.is_commit as isCommit, saa.remark,bai.protocol,saa.cost as costs,
case when sar.id is null then '1' when sar.status = '0' then '2' when sar.status = '1' then '3' when sar.status = '2' then '4' end as sltStatus case when (saa.id is null or saa.status = '0') then '0' when saa.status = '1' then '1' when saa.status = '2' then '2' when saa.status = '3' then '3' end as sltStatus
FROM bm_agreement_info bai FROM bm_agreement_info bai
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
LEFT JOIN slt_agreement_relation sar on bai.agreement_id = sar.agreement_id LEFT JOIN slt_agreement_apply saa on saa.agreement_id = bai.agreement_id
LEFT JOIN slt_agreement_apply saa on saa.id = sar.apply_id
where bai.status = '1' where bai.status = '1'
<if test="unitId != null and unitId != ''"> <if test="unitId != null and unitId != ''">
and bui.unit_id = #{unitId} and bui.unit_id = #{unitId}
@ -193,20 +192,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and bp.pro_id = #{projectId} and bp.pro_id = #{projectId}
</if> </if>
<choose> <choose>
<when test="sltStatus == '0'.toString()">
and saa.id is null
</when>
<when test="sltStatus == '1'.toString()"> <when test="sltStatus == '1'.toString()">
and sar.id is null and saa.status = '1'
</when> </when>
<when test="sltStatus == '2'.toString()"> <when test="sltStatus == '2'.toString()">
and sar.status = '0' and saa.status = '2'
</when> </when>
<when test="sltStatus == '3'.toString()"> <when test="sltStatus == '3'.toString()">
and sar.status = '1' and saa.status = '3'
</when>
<when test="sltStatus == '4'.toString()">
and sar.status = '2'
</when> </when>
</choose> </choose>
ORDER BY sltStatus,bai.agreement_id desc ORDER BY bai.create_time desc
</select> </select>
<select id="getSltExam" resultType="com.bonus.material.settlement.domain.SltAgreementApply"> <select id="getSltExam" resultType="com.bonus.material.settlement.domain.SltAgreementApply">
@ -417,11 +416,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
join join
back_apply_info bai on sai.back_id = bai.id back_apply_info bai on sai.back_id = bai.id
set set
sai.end_time = null, sai.back_id = null, sai.status = '0', sai.update_time = now() sai.end_time = null, sai.back_id = null, sai.status = '0', sai.update_time = CURRENT_TIMESTAMP
where where
bai.task_id = #{backTaskId} and sai.status = '1' bai.task_id = #{backTaskId} and sai.status = '1'
</update> </update>
<select id="getRejectCount" resultType="int">
select
count(id)
from slt_agreement_apply saa
where saa.agreement_id = #{agreementId}
</select>
<insert id="insertSltAgreementApply" parameterType="com.bonus.material.settlement.domain.vo.SltInfoVo" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSltAgreementApply" parameterType="com.bonus.material.settlement.domain.vo.SltInfoVo" useGeneratedKeys="true" keyProperty="id">
insert into slt_agreement_apply insert into slt_agreement_apply
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -437,7 +443,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="agreementCode != null">#{agreementCode},</if> <if test="agreementCode != null">#{agreementCode},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
0, 1,
<if test="totalCostAll != null">#{totalCostAll},</if> <if test="totalCostAll != null">#{totalCostAll},</if>
</trim> </trim>
</insert> </insert>
@ -446,26 +452,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update update
bm_agreement_info bai bm_agreement_info bai
set 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 where
bai.agreement_id = #{agreementId} bai.agreement_id = #{agreementId}
</update> </update>
<!-- 循环插入lease --> <!-- 循环插入lease -->
<insert id="insertSltAgreementDetailLease" parameterType="com.bonus.material.settlement.domain.SltAgreementInfo"> <insert id="insertSltAgreementDetailLease" parameterType="com.bonus.material.settlement.domain.SltAgreementInfo">
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 values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{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})
</foreach> </foreach>
</insert> </insert>
<!-- 循环插入repair --> <!-- 循环插入repair -->
<insert id="insertSltAgreementDetailRepair" parameterType="com.bonus.material.settlement.domain.SltAgreementInfo"> <insert id="insertSltAgreementDetailRepair" parameterType="com.bonus.material.settlement.domain.SltAgreementInfo">
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 values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{id}, #{item.typeId}, #{item.maId},3, #{item.mtUnitName},#{item.num},#{item.costs}, (#{id}, #{item.typeId}, #{item.maId},3,#{item.num},#{item.costs},
<choose> <choose>
<when test="item.partType == '收费'">1</when> <when test="item.partType == '收费'">1</when>
<otherwise>0</otherwise> <otherwise>0</otherwise>
@ -475,10 +481,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 循环插入scrap --> <!-- 循环插入scrap -->
<insert id="insertSltAgreementDetailScrap" parameterType="com.bonus.material.settlement.domain.SltAgreementInfo"> <insert id="insertSltAgreementDetailScrap" parameterType="com.bonus.material.settlement.domain.SltAgreementInfo">
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 values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{id}, #{item.typeId}, #{item.maId},4, #{item.mtUnitName},#{item.num},#{item.costs}, (#{id}, #{item.typeId}, #{item.maId},4,#{item.num},#{item.costs},
<choose> <choose>
<when test="item.partType == '收费'">1</when> <when test="item.partType == '收费'">1</when>
<otherwise>0</otherwise> <otherwise>0</otherwise>
@ -488,10 +494,84 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 循环插入lose --> <!-- 循环插入lose -->
<insert id="insertSltAgreementDetailLose" parameterType="com.bonus.material.settlement.domain.SltAgreementInfo"> <insert id="insertSltAgreementDetailLose" parameterType="com.bonus.material.settlement.domain.SltAgreementInfo">
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 values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{id}, #{item.typeId}, #{item.maId},2, #{item.mtUnitName},#{item.num},#{item.costs}) (#{id}, #{item.typeId}, #{item.maId},2,#{item.num},#{item.costs})
</foreach> </foreach>
</insert> </insert>
<select id="getSltList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
SELECT saa.id as id, bai.agreement_id as agreementId, bai.agreement_code as agreementCode,
bui.unit_id as unitId,bui.unit_name as unitName, bp.pro_id as projectId , bp.pro_name as projectName,
saa.remark,bai.protocol,saa.cost as costs,su.nick_name as auditor,saa.audit_time as auditTime,
case when saa.status = '1' then '1' when saa.status = '2' then '2' when saa.status = '3' then '3' end as sltStatus
FROM bm_agreement_info bai
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
LEFT JOIN slt_agreement_apply saa on saa.agreement_id = bai.agreement_id
LEFT JOIN sys_user su ON saa.auditor = su.user_id and su.del_flag = 0
where bai.status = '1' and saa.status in ('1','2','3')
<if test="unitId != null and unitId != ''">
and bui.unit_id = #{unitId}
</if>
<if test="projectId != null and projectId != ''">
and bp.pro_id = #{projectId}
</if>
<choose>
<when test="sltStatus == '1'.toString()">
and saa.status = '1'
</when>
<when test="sltStatus == '2'.toString()">
and saa.status = '2'
</when>
<when test="sltStatus == '3'.toString()">
and saa.status = '3'
</when>
</choose>
ORDER BY bai.create_time desc
</select>
<select id="getRejectId" resultType="Long">
select
id
from slt_agreement_apply saa
where saa.agreement_id = #{agreementId}
</select>
<update id="updateRejectCount">
update slt_agreement_apply
set status = '1',
update_time = now(),
audit_Time = null,
auditor = null,
remark = null,
cost = #{totalCostAll}
where agreement_id = #{agreementId}
</update>
<update id="costExame">
update slt_agreement_apply
<set>
<if test="status != null and status!=''">status = #{status},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="auditTime != null">audit_time = #{auditTime},</if>
<if test="auditor != null and auditor!=''">auditor = #{auditor},</if>
<if test="remark != null and remark!=''">remark = #{remark}</if>
</set>
where id = #{id}
</update>
<delete id="costDeleteDetail">
delete from slt_agreement_details where apply_id = #{id}
</delete>
<update id="updateBmAgreementReject">
update
bm_agreement_info bai
set
bai.is_slt = 0, bai.update_by = #{auditor}, bai.update_time = #{auditTime}
where
bai.agreement_id = #{agreementId}
</update>
</mapper> </mapper>