对欠款进行校验

This commit is contained in:
季圣华
2021-07-11 23:46:14 +08:00
parent b2603aec6b
commit f7e1fb5c60
2 changed files with 17 additions and 0 deletions

View File

@@ -629,6 +629,13 @@ public class DepotHeadService {
String.format(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_MSG));
}
}
//欠款校验
if("采购退货".equals(subType) || "销售退货".equals(subType)) {
if(depotHead.getChangeAmount().abs().compareTo(depotHead.getDiscountLastMoney().add(depotHead.getOtherMoney()))!=0) {
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BACK_BILL_DEBT_FAILED_CODE,
String.format(ExceptionConstants.DEPOT_HEAD_BACK_BILL_DEBT_FAILED_MSG));
}
}
//判断用户是否已经登录过,登录过不再处理
User userInfo=userService.getCurrentUser();
depotHead.setCreator(userInfo==null?null:userInfo.getId());
@@ -708,6 +715,13 @@ public class DepotHeadService {
String.format(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_MSG));
}
}
//欠款校验
if("采购退货".equals(subType) || "销售退货".equals(subType)) {
if(depotHead.getChangeAmount().abs().compareTo(depotHead.getDiscountLastMoney().add(depotHead.getOtherMoney()))!=0) {
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BACK_BILL_DEBT_FAILED_CODE,
String.format(ExceptionConstants.DEPOT_HEAD_BACK_BILL_DEBT_FAILED_MSG));
}
}
if(StringUtil.isNotEmpty(depotHead.getAccountIdList())){
depotHead.setAccountIdList(depotHead.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", ""));
}