|
|
@@ -190,6 +190,7 @@ public class SupplierCreditLineController extends BaseController {
|
|
|
//查询核心企业授信额度ID下的供应商授信额度总和
|
|
|
QueryWrapper<ZcFinanceSupplierQuota> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("zfsq_core_quota_id",zfsqCoreQuotaId);
|
|
|
+ queryWrapper.eq("zfsq_status","00");
|
|
|
queryWrapper.select("IFNULL(CAST(ROUND(SUM(zfsq_amount),2)AS CHAR),'0') AS zfsqAmount");
|
|
|
ZcFinanceSupplierQuota supplierQuota = iZcFinanceSupplierQuotaService.getOne(queryWrapper);
|
|
|
String totalAmount = supplierQuota.getZfsqAmount();
|
|
|
@@ -338,6 +339,8 @@ public class SupplierCreditLineController extends BaseController {
|
|
|
{
|
|
|
//授信id
|
|
|
String zfsqId = zcFinanceSupplierQuota.getZfsqId();
|
|
|
+ //授信额度
|
|
|
+ String zfsqAmount = zcFinanceSupplierQuota.getZfsqAmount();
|
|
|
//授信状态
|
|
|
String zfsqStatus = zcFinanceSupplierQuota.getZfsqStatus();
|
|
|
LambdaQueryWrapper<ZcFinanceInf> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
@@ -348,6 +351,20 @@ public class SupplierCreditLineController extends BaseController {
|
|
|
zfiAmount = list.get(0).getZfiAmount();
|
|
|
}
|
|
|
int result = CommonUtil.compare("0",zfiAmount);
|
|
|
+ //查询核心企业授信额度ID下的供应商授信额度总和
|
|
|
+ QueryWrapper<ZcFinanceSupplierQuota> supplierWrapper = new QueryWrapper<>();
|
|
|
+ supplierWrapper.eq("zfsq_core_quota_id",zfsqId);
|
|
|
+ supplierWrapper.eq("zfsq_status","00");
|
|
|
+ supplierWrapper.select("IFNULL(CAST(ROUND(SUM(zfsq_amount),2)AS CHAR),'0') AS zfsqAmount");
|
|
|
+ ZcFinanceSupplierQuota supplierQuota = iZcFinanceSupplierQuotaService.getOne(supplierWrapper);
|
|
|
+ String totalAmount = supplierQuota.getZfsqAmount();
|
|
|
+ //额度总和 + 本次授信额度
|
|
|
+ totalAmount = AmtUtil.add(totalAmount,zfsqAmount,2);
|
|
|
+ //查询核心企业的授信额度
|
|
|
+ ZcFinanceProComRel zcFinanceProComRel = iZcFinanceProComRelService.getById(zfsqId);
|
|
|
+ String zfpcrAmount = zcFinanceProComRel.getZfpcrAmount();
|
|
|
+ //此核心企业下的供应商授信额度 > 核心企业的授信额度 => 授信额度已超额
|
|
|
+ int results = CommonUtil.compare(totalAmount,zfpcrAmount);
|
|
|
//判断状态(如果是冻结操作判断是否符合冻结条件
|
|
|
if ("00".equals(zfsqStatus)) {
|
|
|
if (result == 0) {
|
|
|
@@ -357,8 +374,12 @@ public class SupplierCreditLineController extends BaseController {
|
|
|
throw new Exception("此授信正在使用无法冻结");
|
|
|
}
|
|
|
}else {
|
|
|
- zcFinanceSupplierQuota.setZfsqStatus("00");
|
|
|
- iZcFinanceSupplierQuotaService.updateZcFinanceSupplierQuota(zcFinanceSupplierQuota);
|
|
|
+ if (results == 1){
|
|
|
+ throw new Exception("授信额度已超额无法解冻");
|
|
|
+ }else {
|
|
|
+ zcFinanceSupplierQuota.setZfsqStatus("00");
|
|
|
+ iZcFinanceSupplierQuotaService.updateZcFinanceSupplierQuota(zcFinanceSupplierQuota);
|
|
|
+ }
|
|
|
}
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
@@ -524,7 +545,7 @@ public class SupplierCreditLineController extends BaseController {
|
|
|
supplierWrapper.ne(ZcFinanceSupplierQuota::getZfsqStatus,"99");
|
|
|
int count = iZcFinanceSupplierQuotaService.count(supplierWrapper);
|
|
|
if (count > 0){
|
|
|
- throw new Exception("<br/>第" + (i+1) + "行企业重复");
|
|
|
+ throw new Exception("<br/>第" + (i+1) + "行此企业已授信");
|
|
|
}
|
|
|
//查询核心企业授信额度ID下的供应商授信额度总和
|
|
|
QueryWrapper<ZcFinanceSupplierQuota> quotaWrapper = new QueryWrapper<>();
|