结算异常处理
This commit is contained in:
parent
d33c3610c3
commit
b4d0d2d08d
|
|
@ -44,9 +44,7 @@ public class BmReportServiceImpl implements BmReportService {
|
|||
@Override
|
||||
public List<PurChaseReportInfo> getPurChaseReportList(PurChaseReportInfo bean) {
|
||||
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
|
||||
/**
|
||||
* jsk
|
||||
*/
|
||||
// jsk
|
||||
Long companyId=iTypeService.getUserDeptId();
|
||||
bean.setCompanyId(companyId);
|
||||
BigDecimal totalPurchaseNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
|
|
@ -169,6 +167,7 @@ public class BmReportServiceImpl implements BmReportService {
|
|||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private boolean containsKeyword(LeaseOutInfo item, String keyWord) {
|
||||
return (item.getTypeName() != null && item.getTypeName().contains(keyWord)) ||
|
||||
(item.getTypeModelName() != null && item.getTypeModelName().contains(keyWord)) ||
|
||||
|
|
|
|||
|
|
@ -2037,11 +2037,7 @@ public class SltAgreementInfoController extends BaseController {
|
|||
@ApiOperation(value = "进行结算审批")
|
||||
@PostMapping("/costExamine")
|
||||
public AjaxResult costExamine(@RequestBody SltAgreementApply apply) {
|
||||
try {
|
||||
return sltAgreementInfoService.costExamine(apply);
|
||||
} catch (Exception e) {
|
||||
return error("系统错误, " + e.getMessage());
|
||||
}
|
||||
return sltAgreementInfoService.costExamine(apply);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1180,165 +1180,169 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
return AjaxResult.error("结算信息为空,请刷新后重试!");
|
||||
}
|
||||
|
||||
Long deptId = typeService.getUserDeptId();
|
||||
sltAgreementApply.setCompanyId(deptId);
|
||||
Long deptId = null;
|
||||
try {
|
||||
deptId = typeService.getUserDeptId();
|
||||
sltAgreementApply.setCompanyId(deptId);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("结算权限校验不通过!");
|
||||
}
|
||||
|
||||
Integer settlementType = sltAgreementApply.getSettlementType();
|
||||
String sltTask = sltAgreementApply.getSltTask();
|
||||
String userId = String.valueOf(SecurityUtils.getLoginUser().getUserid());
|
||||
|
||||
sltAgreementApply.setAuditor(userId);
|
||||
sltAgreementApply.setAuditTime(DateUtils.getNowDate());
|
||||
sltAgreementApply.setUpdateTime(DateUtils.getNowDate());
|
||||
|
||||
boolean sltSwitch = false;
|
||||
Integer sltType = this.checkLoginUserHasSettlementPermission();
|
||||
sltAgreementApply.setSettlementType(sltType);
|
||||
SltAgreementApply checkSltPer = sltAgreementInfoMapper.getSltPermission(sltAgreementApply);
|
||||
|
||||
Integer checkSettlementType = null;
|
||||
try {
|
||||
String userId = String.valueOf(SecurityUtils.getLoginUser().getUserid());
|
||||
checkSettlementType = checkSltPer.getSettlementType();
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("结算权限校验不通过!");
|
||||
}
|
||||
|
||||
sltAgreementApply.setAuditor(userId);
|
||||
sltAgreementApply.setAuditTime(DateUtils.getNowDate());
|
||||
sltAgreementApply.setUpdateTime(DateUtils.getNowDate());
|
||||
|
||||
boolean sltSwitch = false;
|
||||
Integer sltType = this.checkLoginUserHasSettlementPermission();
|
||||
sltAgreementApply.setSettlementType(sltType);
|
||||
SltAgreementApply checkSltPer = sltAgreementInfoMapper.getSltPermission(sltAgreementApply);
|
||||
|
||||
Integer checkSettlementType = checkSltPer.getSettlementType();
|
||||
|
||||
if(GlobalConstants.LONG_JJ.equals(deptId)){
|
||||
if(checkSettlementType == 1 && "73".equals(userId)){
|
||||
sltSwitch = true;
|
||||
}
|
||||
|
||||
if(checkSettlementType == 2 && "1549".equals(userId)){
|
||||
sltSwitch = true;
|
||||
}
|
||||
}else if(GlobalConstants.LONG_HY.equals(deptId)){
|
||||
//顾国强
|
||||
if("193".equals(userId)){
|
||||
sltSwitch = true;
|
||||
}
|
||||
//王文斌
|
||||
if("124".equals(userId)){
|
||||
sltSwitch = true;
|
||||
}
|
||||
if(GlobalConstants.LONG_JJ.equals(deptId)){
|
||||
if(checkSettlementType == 1 && "73".equals(userId)){
|
||||
sltSwitch = true;
|
||||
}
|
||||
if(checkSettlementType == 2 && "1549".equals(userId)){
|
||||
sltSwitch = true;
|
||||
}
|
||||
}else if(GlobalConstants.LONG_HY.equals(deptId)){
|
||||
//顾国强
|
||||
if("193".equals(userId)){
|
||||
sltSwitch = true;
|
||||
}
|
||||
//王文斌
|
||||
if("124".equals(userId)){
|
||||
sltSwitch = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(sltSwitch){
|
||||
if (Objects.equals(REVIEW_REJECT, sltAgreementApply.getStatus())) {
|
||||
if (sltSwitch) {
|
||||
if (Objects.equals(REVIEW_REJECT, sltAgreementApply.getStatus())) {
|
||||
|
||||
// if (settlementType == 3 ) {
|
||||
// return AjaxResult.error("结算类型错误,合并协议暂不支持驳回!");
|
||||
// }
|
||||
|
||||
//修改审核表驳回
|
||||
String sltAuditor = "已驳回";
|
||||
String sltStatus = "3";
|
||||
//修改审核表驳回
|
||||
String sltAuditor = "已驳回";
|
||||
String sltStatus = "3";
|
||||
sltAgreementInfoMapper.updateSltStatus(sltAuditor,sltTask,sltStatus);
|
||||
|
||||
List<SltAgreementApply> rejectList = sltAgreementInfoMapper.getSltRejectList(sltAgreementApply);
|
||||
|
||||
int updateNum = 0;
|
||||
for (SltAgreementApply bean : rejectList) {
|
||||
bean.setAuditor(userId);
|
||||
bean.setAuditTime(DateUtils.getNowDate());
|
||||
bean.setUpdateTime(DateUtils.getNowDate());
|
||||
bean.setStatus("3");
|
||||
// 驳回,更新slt_apply协议审批状态
|
||||
updateNum = sltAgreementInfoMapper.costExame(bean);
|
||||
// 删除结算详情
|
||||
sltAgreementInfoMapper.costDeleteDetail(bean);
|
||||
}
|
||||
|
||||
if (updateNum != GlobalConstants.INT_1) {
|
||||
return AjaxResult.error("结算审批失败");
|
||||
} else {
|
||||
// 获取已审核和待审核的条数
|
||||
int beforeSettlementCount = sltAgreementInfoMapper.getBeforeSettlementCount(new SltInfoVo().setAgreementId(sltAgreementApply.getAgreementId()));
|
||||
// 根据待审核+已审核的数量来决定更新到哪种状态
|
||||
sltAgreementApply.setIsSlt(beforeSettlementCount > GlobalConstants.INT_0 ? GlobalConstants.INT_2 : GlobalConstants.INT_0);
|
||||
int countTwo = sltAgreementInfoMapper.updateBmAgreementReject(sltAgreementApply);
|
||||
if (countTwo != GlobalConstants.INT_1) {
|
||||
return AjaxResult.error("bm_agreement_info修改失败");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
} else if (Objects.equals(REVIEW_PASS, sltAgreementApply.getStatus())) {
|
||||
// 根据ID查询settlement_type
|
||||
|
||||
if (sltType == null ) {
|
||||
return AjaxResult.error("结算类型错误,结算权限码为空");
|
||||
}
|
||||
|
||||
sltAgreementApply.setSettlementType(sltType);
|
||||
|
||||
// 通过,更新slt_apply协议审批状态
|
||||
int examNum = sltAgreementInfoMapper.costExame(sltAgreementApply);
|
||||
|
||||
List<SltAgreementApply> sltAuditList = sltAgreementInfoMapper.getSltAuditList(sltAgreementApply);
|
||||
|
||||
if(sltAuditList != null && !sltAuditList.isEmpty()){
|
||||
int sltSettmentType = sltAuditList.get(0).getSettlementType();
|
||||
if(sltSettmentType == 2){
|
||||
//修改审核表待刘春杰审核
|
||||
String sltAuditor = "待刘春杰审核";
|
||||
String sltStatus = "1";
|
||||
sltAgreementInfoMapper.updateSltStatus(sltAuditor,sltTask,sltStatus);
|
||||
}
|
||||
if(sltSettmentType == 1){
|
||||
//修改审核表待张志峰审核
|
||||
String sltAuditor = "待张志峰审核";
|
||||
String sltStatus = "1";
|
||||
sltAgreementInfoMapper.updateSltStatus(sltAuditor,sltTask,sltStatus);
|
||||
}
|
||||
}else{
|
||||
//修改审核表已通过
|
||||
String sltAuditor = "已审核";
|
||||
String sltStatus = "2";
|
||||
sltAgreementInfoMapper.updateSltStatus(sltAuditor,sltTask,sltStatus);
|
||||
|
||||
List<SltAgreementApply> rejectList = sltAgreementInfoMapper.getSltRejectList(sltAgreementApply);
|
||||
|
||||
int updateNum = 0;
|
||||
for (SltAgreementApply bean : rejectList) {
|
||||
bean.setAuditor(userId);
|
||||
bean.setAuditTime(DateUtils.getNowDate());
|
||||
bean.setUpdateTime(DateUtils.getNowDate());
|
||||
bean.setStatus("3");
|
||||
// 驳回,更新slt_apply协议审批状态
|
||||
updateNum = sltAgreementInfoMapper.costExame(bean);
|
||||
// 删除结算详情
|
||||
sltAgreementInfoMapper.costDeleteDetail(bean);
|
||||
}
|
||||
|
||||
if (updateNum != GlobalConstants.INT_1) {
|
||||
return AjaxResult.error("结算审批失败");
|
||||
} else {
|
||||
// 获取已审核和待审核的条数
|
||||
int beforeSettlementCount = sltAgreementInfoMapper.getBeforeSettlementCount(new SltInfoVo().setAgreementId(sltAgreementApply.getAgreementId()));
|
||||
// 根据待审核+已审核的数量来决定更新到哪种状态
|
||||
sltAgreementApply.setIsSlt(beforeSettlementCount > GlobalConstants.INT_0 ? GlobalConstants.INT_2 : GlobalConstants.INT_0);
|
||||
int countTwo = sltAgreementInfoMapper.updateBmAgreementReject(sltAgreementApply);
|
||||
if (countTwo != GlobalConstants.INT_1) {
|
||||
return AjaxResult.error("bm_agreement_info修改失败");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
} else if (Objects.equals(REVIEW_PASS, sltAgreementApply.getStatus())) {
|
||||
// 根据ID查询settlement_type
|
||||
|
||||
if (sltType == null ) {
|
||||
return AjaxResult.error("结算类型错误,结算权限码为空");
|
||||
}
|
||||
|
||||
sltAgreementApply.setSettlementType(sltType);
|
||||
|
||||
// 通过,更新slt_apply协议审批状态
|
||||
int examNum = sltAgreementInfoMapper.costExame(sltAgreementApply);
|
||||
|
||||
List<SltAgreementApply> sltAuditList = sltAgreementInfoMapper.getSltAuditList(sltAgreementApply);
|
||||
|
||||
if(sltAuditList != null && !sltAuditList.isEmpty()){
|
||||
int sltSettmentType = sltAuditList.get(0).getSettlementType();
|
||||
if(sltSettmentType == 2){
|
||||
//修改审核表待刘春杰审核
|
||||
String sltAuditor = "待刘春杰审核";
|
||||
String sltStatus = "1";
|
||||
sltAgreementInfoMapper.updateSltStatus(sltAuditor,sltTask,sltStatus);
|
||||
}
|
||||
if(sltSettmentType == 1){
|
||||
//修改审核表待张志峰审核
|
||||
String sltAuditor = "待张志峰审核";
|
||||
String sltStatus = "1";
|
||||
sltAgreementInfoMapper.updateSltStatus(sltAuditor,sltTask,sltStatus);
|
||||
}
|
||||
}else{
|
||||
//修改审核表已通过
|
||||
String sltAuditor = "已审核";
|
||||
String sltStatus = "2";
|
||||
sltAgreementInfoMapper.updateSltStatus(sltAuditor,sltTask,sltStatus);
|
||||
|
||||
}
|
||||
|
||||
// 更新bm_agreement_info结算状态
|
||||
int beforeCount = sltAgreementInfoMapper.getBeforeSettlementCount(new SltInfoVo().setAgreementId(sltAgreementApply.getAgreementId()));
|
||||
sltAgreementApply.setIsSlt(beforeCount == 0 ? GlobalConstants.INT_1 : GlobalConstants.INT_2);
|
||||
int countTwo = bmAgreementInfoMapper.updateBmAgreementInfo(new BmAgreementInfo().setIsSlt(Long.valueOf(sltAgreementApply.getIsSlt()))
|
||||
.setAgreementId(sltAgreementApply.getAgreementId())
|
||||
);
|
||||
if (countTwo != GlobalConstants.INT_1) {
|
||||
log.error("bm_agreement_info修改失败," + "协议ID:" + sltAgreementApply.getAgreementId() + "," + "结算状态:" + sltAgreementApply.getIsSlt());
|
||||
throw new ServiceException("bm_agreement_info修改失败");
|
||||
}
|
||||
|
||||
// 修改slt_agreement_info的结算状态
|
||||
int countThree = sltAgreementInfoMapper.updateSltInfoByAgreementIdType(new SltAgreementInfo()
|
||||
.setAgreementId(sltAgreementApply.getAgreementId())
|
||||
.setSettlementType(sltType)
|
||||
);
|
||||
/* if (countThree == 0) {
|
||||
log.error("slt_agreement_info修改失败," + "协议ID:" + sltAgreementApply.getAgreementId() + "," + "结算类型:" + sltAgreementApplyFromDb.getSettlementType());
|
||||
throw new ServiceException("slt_agreement_info修改失败");
|
||||
}
|
||||
*/
|
||||
// 修改未退还设备状态为丢失
|
||||
int countFour = sltAgreementInfoMapper.updateMaStatusLoseByAgreementIdType(new SltAgreementInfo()
|
||||
.setAgreementId(sltAgreementApply.getAgreementId())
|
||||
.setSettlementType(sltType)
|
||||
);
|
||||
if (countFour == 0) {
|
||||
log.warn("协议ID:" + sltAgreementApply.getAgreementId() + ",结算类型:" + sltType + ",无未归还设备,无需更新为丢失状态");
|
||||
}
|
||||
|
||||
if (examNum == GlobalConstants.INT_0) {
|
||||
return AjaxResult.error("结算审批失败");
|
||||
} else {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error("审批错误,状态码错误");
|
||||
// 更新bm_agreement_info结算状态
|
||||
int beforeCount = sltAgreementInfoMapper.getBeforeSettlementCount(new SltInfoVo().setAgreementId(sltAgreementApply.getAgreementId()));
|
||||
sltAgreementApply.setIsSlt(beforeCount == 0 ? GlobalConstants.INT_1 : GlobalConstants.INT_2);
|
||||
int countTwo = bmAgreementInfoMapper.updateBmAgreementInfo(new BmAgreementInfo().setIsSlt(Long.valueOf(sltAgreementApply.getIsSlt()))
|
||||
.setAgreementId(sltAgreementApply.getAgreementId())
|
||||
);
|
||||
if (countTwo != GlobalConstants.INT_1) {
|
||||
log.error("bm_agreement_info修改失败," + "协议ID:" + sltAgreementApply.getAgreementId() + "," + "结算状态:" + sltAgreementApply.getIsSlt());
|
||||
throw new ServiceException("bm_agreement_info修改失败");
|
||||
}
|
||||
}else {
|
||||
return AjaxResult.error("审批错误,账号没有审批权限");
|
||||
|
||||
// 修改slt_agreement_info的结算状态
|
||||
int countThree = sltAgreementInfoMapper.updateSltInfoByAgreementIdType(new SltAgreementInfo()
|
||||
.setAgreementId(sltAgreementApply.getAgreementId())
|
||||
.setSettlementType(sltType)
|
||||
);
|
||||
/* if (countThree == 0) {
|
||||
log.error("slt_agreement_info修改失败," + "协议ID:" + sltAgreementApply.getAgreementId() + "," + "结算类型:" + sltAgreementApplyFromDb.getSettlementType());
|
||||
throw new ServiceException("slt_agreement_info修改失败");
|
||||
}
|
||||
*/
|
||||
// 修改未退还设备状态为丢失
|
||||
int countFour = sltAgreementInfoMapper.updateMaStatusLoseByAgreementIdType(new SltAgreementInfo()
|
||||
.setAgreementId(sltAgreementApply.getAgreementId())
|
||||
.setSettlementType(sltType)
|
||||
);
|
||||
if (countFour == 0) {
|
||||
log.warn("协议ID:" + sltAgreementApply.getAgreementId() + ",结算类型:" + sltType + ",无未归还设备,无需更新为丢失状态");
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
if (examNum == GlobalConstants.INT_0) {
|
||||
return AjaxResult.error("结算审批失败");
|
||||
} else {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error("审批错误,状态码错误");
|
||||
}
|
||||
}else {
|
||||
return AjaxResult.error("审批错误,账号没有审批权限");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue