结算审批
This commit is contained in:
parent
ac92f47acb
commit
2c7d7b1da1
|
|
@ -203,7 +203,7 @@ public class PoiOutPage {
|
|||
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();
|
||||
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,
|
||||
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) {
|
||||
// 创建工作簿和工作表
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
|
|
|
|||
|
|
@ -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<SltAgreementInfo> 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<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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<SltAgreementInfo> getSltAgreementInfo4Project(SltAgreementInfo bean);
|
||||
|
||||
public SltInfoVo getSltInfo(List<SltAgreementInfo> list);
|
||||
public SltInfoVo getSltInfo(SltAgreementInfo info);
|
||||
|
||||
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 结果
|
||||
*/
|
||||
public int submitCosts(SltInfoVo sltInfoVo);
|
||||
|
||||
/**
|
||||
* 结算审批列表
|
||||
*
|
||||
* @param bean 结算信息
|
||||
* @return 结果
|
||||
*/
|
||||
List<SltAgreementInfo> getSltList(SltAgreementInfo bean);
|
||||
|
||||
/**
|
||||
* 进行结算审批
|
||||
*
|
||||
* @param sltAgreementApply 进行结算审批
|
||||
* @return 结果
|
||||
*/
|
||||
AjaxResult costExamine(SltAgreementApply sltAgreementApply);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<SltAgreementInfo> 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<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.setRepairList(repairList);
|
||||
sltInfoVo.setScrapList(scrapList);
|
||||
|
|
@ -109,7 +113,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
sltInfoVo.setRepairCost(repairCost);
|
||||
sltInfoVo.setScrapCost(scrapCost);
|
||||
sltInfoVo.setLoseCost(loseCost);
|
||||
List<SltAgreementRelation> relations = getRelations(leaseList, repairList, scrapList, loseList, list);
|
||||
List<SltAgreementRelation> 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<SltAgreementInfo> list = new ArrayList<>();
|
||||
String cost = sltAgreementInfoMapper.getCost(apply);
|
||||
List<SltAgreementRelation> 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<SltAgreementInfo> leaseList = getLeaseList(list);
|
||||
List<SltAgreementInfo> repairList = getRepairList(list);
|
||||
List<SltAgreementInfo> scrapList = getScrapList(list);
|
||||
List<SltAgreementInfo> 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<SltAgreementInfo> list = new ArrayList<>();
|
||||
// String cost = sltAgreementInfoMapper.getCost(apply);
|
||||
// List<SltAgreementRelation> 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<SltAgreementInfo> leaseList = getLeaseList(list);
|
||||
// List<SltAgreementInfo> repairList = getRepairList(list);
|
||||
// List<SltAgreementInfo> scrapList = getScrapList(list);
|
||||
// List<SltAgreementInfo> 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<SltAgreementRelation> relations = sltAgreementInfoMapper.getRelations(apply);
|
||||
List<SltAgreementInfo> infos = new ArrayList<>();
|
||||
for (SltAgreementRelation bean : relations) {
|
||||
SltAgreementInfo info = new SltAgreementInfo();
|
||||
info.setAgreementId(Long.valueOf(bean.getAgreementId()));
|
||||
infos.add(info);
|
||||
}
|
||||
List<SltAgreementInfo> 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<SltAgreementRelation> relations = sltAgreementInfoMapper.getRelations(apply);
|
||||
// List<SltAgreementInfo> infos = new ArrayList<>();
|
||||
// for (SltAgreementRelation bean : relations) {
|
||||
// SltAgreementInfo info = new SltAgreementInfo();
|
||||
// info.setAgreementId(Long.valueOf(bean.getAgreementId()));
|
||||
// infos.add(info);
|
||||
// }
|
||||
// List<SltAgreementInfo> 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<SltAgreementInfo> getLeaseList(List<SltAgreementInfo> list) {
|
||||
public List<SltAgreementInfo> getLeaseList(SltAgreementInfo info) {
|
||||
List<SltAgreementInfo> leaseList = new ArrayList<>();
|
||||
for (SltAgreementInfo bean : list) {
|
||||
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseList(bean);
|
||||
|
||||
List<SltAgreementInfo> 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<SltAgreementInfo> getRepairList(List<SltAgreementInfo> list) {
|
||||
public List<SltAgreementInfo> getRepairList(SltAgreementInfo info) {
|
||||
List<SltAgreementInfo> 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<TmTask> taskList = taskMapper.getTaskIdList(bean);
|
||||
|
||||
List<TmTask> taskList = taskMapper.getTaskIdList(info);
|
||||
if (null!= taskList &&!taskList.isEmpty()) {
|
||||
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList);
|
||||
repairList.addAll(repairDetailsList);
|
||||
}
|
||||
}
|
||||
|
||||
return repairList;
|
||||
}
|
||||
|
||||
public List<SltAgreementInfo> getScrapList(List<SltAgreementInfo> list) {
|
||||
public List<SltAgreementInfo> getScrapList(SltAgreementInfo info) {
|
||||
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()) {
|
||||
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskList);
|
||||
scrapList.addAll(scrapDetailsList);
|
||||
}
|
||||
}
|
||||
|
||||
return scrapList;
|
||||
}
|
||||
|
||||
public List<SltAgreementInfo> getLoseList(List<SltAgreementInfo> list) {
|
||||
public List<SltAgreementInfo> getLoseList(SltAgreementInfo info) {
|
||||
List<SltAgreementInfo> loseList = new ArrayList<>();
|
||||
for (SltAgreementInfo bean : list) {
|
||||
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLoseList(bean);
|
||||
|
||||
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLoseList(info);
|
||||
loseList.addAll(oneOfList);
|
||||
}
|
||||
|
||||
for (SltAgreementInfo bean : loseList) {
|
||||
if (null == bean.getBuyPrice()) {
|
||||
bean.setBuyPrice(BigDecimal.valueOf(0.00));
|
||||
|
|
@ -318,16 +322,16 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
|
||||
private List<SltAgreementRelation> getRelations(List<SltAgreementInfo> leaseList, List<SltAgreementInfo> repairList,
|
||||
List<SltAgreementInfo> scrapList, List<SltAgreementInfo> loseList,
|
||||
List<SltAgreementInfo> list) {
|
||||
SltAgreementInfo sltInfo) {
|
||||
List<SltAgreementRelation> relations = new ArrayList<>();
|
||||
for (SltAgreementInfo info : list) {
|
||||
// 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())) {
|
||||
if (lease.getAgreementId().equals(sltInfo.getAgreementId().toString())) {
|
||||
relation.setAgreementId(String.valueOf(lease.getAgreementId()));
|
||||
relation.setProjectName(lease.getProjectName());
|
||||
relation.setUnitName(lease.getUnitName());
|
||||
|
|
@ -337,19 +341,19 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
}
|
||||
}
|
||||
for (SltAgreementInfo repair : repairList) {
|
||||
if (repair.getAgreementId().equals(info.getAgreementId().toString())) {
|
||||
if (repair.getAgreementId().equals(sltInfo.getAgreementId().toString())) {
|
||||
BigDecimal cost = repair.getCosts();
|
||||
repairCost = repairCost.add(cost);
|
||||
}
|
||||
}
|
||||
for (SltAgreementInfo scrap : scrapList) {
|
||||
if (scrap.getAgreementId().equals(info.getAgreementId().toString())) {
|
||||
if (scrap.getAgreementId().equals(sltInfo.getAgreementId().toString())) {
|
||||
BigDecimal cost = scrap.getCosts();
|
||||
scrapCost = scrapCost.add(cost);
|
||||
}
|
||||
}
|
||||
for (SltAgreementInfo lose : loseList) {
|
||||
if (lose.getAgreementId().equals(info.getAgreementId().toString())) {
|
||||
if (lose.getAgreementId().equals(sltInfo.getAgreementId().toString())) {
|
||||
//TODO 上面已经set过值,这里为什么还要set值
|
||||
relation.setAgreementId(String.valueOf(lose.getAgreementId()));
|
||||
relation.setProjectName(lose.getProjectName());
|
||||
|
|
@ -364,7 +368,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
relation.setScrapCost(scrapCost);
|
||||
relation.setLoseCost(loseCost);
|
||||
relations.add(relation);
|
||||
}
|
||||
// }
|
||||
return relations;
|
||||
}
|
||||
|
||||
|
|
@ -376,19 +380,51 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
*/
|
||||
@Override
|
||||
public int submitCosts(SltInfoVo sltInfoVo) {
|
||||
try {
|
||||
//查找是否驳回
|
||||
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()));
|
||||
try {
|
||||
//新增
|
||||
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);
|
||||
}
|
||||
|
|
@ -401,10 +437,64 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
if(sltInfoVo.getLoseList().size()>0){
|
||||
sltAgreementInfoMapper.insertSltAgreementDetailLose(sltInfoVo.getLoseList(),newId);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
} catch (Exception e) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,15 +176,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<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,
|
||||
plan_start_time,lease_day,auth_person,phone,saa.remark,bai.protocol,sar.cost as cost,sar.is_commit as isCommit,
|
||||
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
|
||||
saa.remark,bai.protocol,saa.cost as costs,
|
||||
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
|
||||
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_relation sar on bai.agreement_id = sar.agreement_id
|
||||
LEFT JOIN slt_agreement_apply saa on saa.id = sar.apply_id
|
||||
LEFT JOIN slt_agreement_apply saa on saa.agreement_id = bai.agreement_id
|
||||
where bai.status = '1'
|
||||
<if test="unitId != null and unitId != ''">
|
||||
and bui.unit_id = #{unitId}
|
||||
|
|
@ -193,20 +192,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and bp.pro_id = #{projectId}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="sltStatus == '0'.toString()">
|
||||
and saa.id is null
|
||||
</when>
|
||||
<when test="sltStatus == '1'.toString()">
|
||||
and sar.id is null
|
||||
and saa.status = '1'
|
||||
</when>
|
||||
<when test="sltStatus == '2'.toString()">
|
||||
and sar.status = '0'
|
||||
and saa.status = '2'
|
||||
</when>
|
||||
<when test="sltStatus == '3'.toString()">
|
||||
and sar.status = '1'
|
||||
</when>
|
||||
<when test="sltStatus == '4'.toString()">
|
||||
and sar.status = '2'
|
||||
and saa.status = '3'
|
||||
</when>
|
||||
</choose>
|
||||
ORDER BY sltStatus,bai.agreement_id desc
|
||||
ORDER BY bai.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getSltExam" resultType="com.bonus.material.settlement.domain.SltAgreementApply">
|
||||
|
|
@ -417,11 +416,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
join
|
||||
back_apply_info bai on sai.back_id = bai.id
|
||||
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
|
||||
bai.task_id = #{backTaskId} and sai.status = '1'
|
||||
</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 into slt_agreement_apply
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -437,7 +443,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="agreementCode != null">#{agreementCode},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
0,
|
||||
1,
|
||||
<if test="totalCostAll != null">#{totalCostAll},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
|
@ -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}
|
||||
</update>
|
||||
|
||||
<!-- 循环插入lease -->
|
||||
<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
|
||||
<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>
|
||||
</insert>
|
||||
|
||||
<!-- 循环插入repair -->
|
||||
<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
|
||||
<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>
|
||||
<when test="item.partType == '收费'">1</when>
|
||||
<otherwise>0</otherwise>
|
||||
|
|
@ -475,10 +481,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<!-- 循环插入scrap -->
|
||||
<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
|
||||
<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>
|
||||
<when test="item.partType == '收费'">1</when>
|
||||
<otherwise>0</otherwise>
|
||||
|
|
@ -488,10 +494,84 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<!-- 循环插入lose -->
|
||||
<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
|
||||
<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>
|
||||
</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>
|
||||
Loading…
Reference in New Issue