|
@@ -330,6 +330,9 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
|
|
SettleAmountMonitorInput deptMonitorInput = SettleAmountMonitorInput.fromUserId(userIds, ids, input.getSubType());
|
|
SettleAmountMonitorInput deptMonitorInput = SettleAmountMonitorInput.fromUserId(userIds, ids, input.getSubType());
|
|
List<SettleAmountMonitorOutput> deptAmountMonitor = sysDeptSubService.getDeptAmountMonitor(deptMonitorInput);
|
|
List<SettleAmountMonitorOutput> deptAmountMonitor = sysDeptSubService.getDeptAmountMonitor(deptMonitorInput);
|
|
|
|
|
|
|
|
+ SettleAmountMonitorInput yaoyiMonitorInput = SettleAmountMonitorInput.fromIdCard(idCard, ids, input.getSubType());
|
|
|
|
+ List<SettleAmountMonitorOutput> yaoyiAmountMonitor = sysDeptSubService.getYaoyiAmountMonitor(yaoyiMonitorInput);
|
|
|
|
+
|
|
// 结算渠道
|
|
// 结算渠道
|
|
SysDeptSub condition = new SysDeptSub();
|
|
SysDeptSub condition = new SysDeptSub();
|
|
condition.setDeptId(SecurityUtils.getUser().getDeptId());
|
|
condition.setDeptId(SecurityUtils.getUser().getDeptId());
|
|
@@ -345,6 +348,7 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
|
|
|
|
|
|
BigDecimal deptLimit = sysDeptSub.getLimitAmount();
|
|
BigDecimal deptLimit = sysDeptSub.getLimitAmount();
|
|
BigDecimal monitoringLimit = monitoringIndicator.getLimitAmount();
|
|
BigDecimal monitoringLimit = monitoringIndicator.getLimitAmount();
|
|
|
|
+ BigDecimal yaoyiLimitAmount = monitoringIndicator.getYaoyiLimitAmount();
|
|
|
|
|
|
BigDecimal total = new BigDecimal(0);
|
|
BigDecimal total = new BigDecimal(0);
|
|
LocalDateTime now = LocalDateTime.now();
|
|
LocalDateTime now = LocalDateTime.now();
|
|
@@ -352,18 +356,25 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
|
|
total = total.add(note.getSettleAmount());
|
|
total = total.add(note.getSettleAmount());
|
|
BigDecimal monitorAmount = note.getSettleAmount();
|
|
BigDecimal monitorAmount = note.getSettleAmount();
|
|
BigDecimal deptMonitorAmount = note.getSettleAmount();
|
|
BigDecimal deptMonitorAmount = note.getSettleAmount();
|
|
|
|
+ BigDecimal yaoyiMonitorAmount = note.getSettleAmount();
|
|
SettleAmountMonitorOutput monitorOutput = monitorOutputList.stream().filter(item -> item.getIdCardNumber()
|
|
SettleAmountMonitorOutput monitorOutput = monitorOutputList.stream().filter(item -> item.getIdCardNumber()
|
|
.equals(note.getIdCardNumber())).findFirst().orElse(null);
|
|
.equals(note.getIdCardNumber())).findFirst().orElse(null);
|
|
|
|
|
|
SettleAmountMonitorOutput deptMonitorOutput = deptAmountMonitor.stream().filter(item -> item.getUserId()
|
|
SettleAmountMonitorOutput deptMonitorOutput = deptAmountMonitor.stream().filter(item -> item.getUserId()
|
|
.equals(note.getUserId())).findFirst().orElse(null);
|
|
.equals(note.getUserId())).findFirst().orElse(null);
|
|
|
|
|
|
|
|
+ SettleAmountMonitorOutput yaoyiMonitorOutput = yaoyiAmountMonitor.stream().filter(item -> item.getIdCardNumber()
|
|
|
|
+ .equals(note.getIdCardNumber())).findFirst().orElse(null);
|
|
|
|
+
|
|
if (null != monitorOutput) {
|
|
if (null != monitorOutput) {
|
|
monitorAmount = monitorAmount.add(monitorOutput.getTotalAmount());
|
|
monitorAmount = monitorAmount.add(monitorOutput.getTotalAmount());
|
|
}
|
|
}
|
|
if (null != deptMonitorOutput) {
|
|
if (null != deptMonitorOutput) {
|
|
deptMonitorAmount = deptMonitorAmount.add(deptMonitorOutput.getTotalAmount());
|
|
deptMonitorAmount = deptMonitorAmount.add(deptMonitorOutput.getTotalAmount());
|
|
}
|
|
}
|
|
|
|
+ if (null != yaoyiMonitorOutput) {
|
|
|
|
+ yaoyiMonitorAmount = yaoyiMonitorAmount.add(yaoyiMonitorOutput.getTotalAmount());
|
|
|
|
+ }
|
|
if (null != deptLimit) {
|
|
if (null != deptLimit) {
|
|
if (deptMonitorAmount.compareTo(deptLimit) > 0) {
|
|
if (deptMonitorAmount.compareTo(deptLimit) > 0) {
|
|
return R.failed(note.getRealName() + ":超过当月限额");
|
|
return R.failed(note.getRealName() + ":超过当月限额");
|
|
@@ -374,6 +385,11 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
|
|
return R.failed(note.getRealName() + ":超过结算渠道限额");
|
|
return R.failed(note.getRealName() + ":超过结算渠道限额");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (null != yaoyiLimitAmount) {
|
|
|
|
+ if (yaoyiMonitorAmount.compareTo(yaoyiLimitAmount) > 0) {
|
|
|
|
+ return R.failed(note.getRealName() + ":超过平台限额");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
note.setUpdateTime(now);
|
|
note.setUpdateTime(now);
|
|
note.setSubTime(now);
|
|
note.setSubTime(now);
|
|
@@ -466,38 +482,51 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
|
|
SettleAmountMonitorInput deptMonitorInput = SettleAmountMonitorInput.fromUserId(userIds, ids, input.getSubType());
|
|
SettleAmountMonitorInput deptMonitorInput = SettleAmountMonitorInput.fromUserId(userIds, ids, input.getSubType());
|
|
List<SettleAmountMonitorOutput> deptAmountMonitor = sysDeptSubService.getDeptAmountMonitor(deptMonitorInput);
|
|
List<SettleAmountMonitorOutput> deptAmountMonitor = sysDeptSubService.getDeptAmountMonitor(deptMonitorInput);
|
|
|
|
|
|
|
|
+ SettleAmountMonitorInput yaoyiMonitorInput = SettleAmountMonitorInput.fromIdCard(idCard, ids, input.getSubType());
|
|
|
|
+ List<SettleAmountMonitorOutput> yaoyiAmountMonitor = sysDeptSubService.getYaoyiAmountMonitor(yaoyiMonitorInput);
|
|
|
|
+
|
|
|
|
+ // 结算渠道
|
|
SysDeptSub condition = new SysDeptSub();
|
|
SysDeptSub condition = new SysDeptSub();
|
|
condition.setDeptId(SecurityUtils.getUser().getDeptId());
|
|
condition.setDeptId(SecurityUtils.getUser().getDeptId());
|
|
condition.setSubjectType(input.getSubType());
|
|
condition.setSubjectType(input.getSubType());
|
|
condition.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
condition.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
SysDeptSub sysDeptSub = sysDeptSubService.getOne(Wrappers.query(condition));
|
|
SysDeptSub sysDeptSub = sysDeptSubService.getOne(Wrappers.query(condition));
|
|
-
|
|
|
|
if (null == sysDeptSub || StringUtils.isBlank(sysDeptSub.getAppId())) {
|
|
if (null == sysDeptSub || StringUtils.isBlank(sysDeptSub.getAppId())) {
|
|
return R.failed("人员所在机构未配置结算信息");
|
|
return R.failed("人员所在机构未配置结算信息");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 限额
|
|
MonitoringIndicator monitoringIndicator = monitoringIndicatorService.getBySubType(input.getSubType());
|
|
MonitoringIndicator monitoringIndicator = monitoringIndicatorService.getBySubType(input.getSubType());
|
|
|
|
|
|
BigDecimal deptLimit = sysDeptSub.getLimitAmount();
|
|
BigDecimal deptLimit = sysDeptSub.getLimitAmount();
|
|
BigDecimal monitoringLimit = monitoringIndicator.getLimitAmount();
|
|
BigDecimal monitoringLimit = monitoringIndicator.getLimitAmount();
|
|
|
|
+ BigDecimal yaoyiLimitAmount = monitoringIndicator.getYaoyiLimitAmount();
|
|
|
|
|
|
BigDecimal total = new BigDecimal(0);
|
|
BigDecimal total = new BigDecimal(0);
|
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
for (WmScorePackageSettleNote note : notes) {
|
|
for (WmScorePackageSettleNote note : notes) {
|
|
total = total.add(note.getSettleAmount());
|
|
total = total.add(note.getSettleAmount());
|
|
BigDecimal monitorAmount = note.getSettleAmount();
|
|
BigDecimal monitorAmount = note.getSettleAmount();
|
|
BigDecimal deptMonitorAmount = note.getSettleAmount();
|
|
BigDecimal deptMonitorAmount = note.getSettleAmount();
|
|
|
|
+ BigDecimal yaoyiMonitorAmount = note.getSettleAmount();
|
|
SettleAmountMonitorOutput monitorOutput = monitorOutputList.stream().filter(item -> item.getIdCardNumber()
|
|
SettleAmountMonitorOutput monitorOutput = monitorOutputList.stream().filter(item -> item.getIdCardNumber()
|
|
.equals(note.getIdCardNumber())).findFirst().orElse(null);
|
|
.equals(note.getIdCardNumber())).findFirst().orElse(null);
|
|
|
|
|
|
SettleAmountMonitorOutput deptMonitorOutput = deptAmountMonitor.stream().filter(item -> item.getUserId()
|
|
SettleAmountMonitorOutput deptMonitorOutput = deptAmountMonitor.stream().filter(item -> item.getUserId()
|
|
.equals(note.getUserId())).findFirst().orElse(null);
|
|
.equals(note.getUserId())).findFirst().orElse(null);
|
|
|
|
|
|
|
|
+ SettleAmountMonitorOutput yaoyiMonitorOutput = yaoyiAmountMonitor.stream().filter(item -> item.getIdCardNumber()
|
|
|
|
+ .equals(note.getIdCardNumber())).findFirst().orElse(null);
|
|
|
|
+
|
|
if (null != monitorOutput) {
|
|
if (null != monitorOutput) {
|
|
monitorAmount = monitorAmount.add(monitorOutput.getTotalAmount());
|
|
monitorAmount = monitorAmount.add(monitorOutput.getTotalAmount());
|
|
}
|
|
}
|
|
if (null != deptMonitorOutput) {
|
|
if (null != deptMonitorOutput) {
|
|
deptMonitorAmount = deptMonitorAmount.add(deptMonitorOutput.getTotalAmount());
|
|
deptMonitorAmount = deptMonitorAmount.add(deptMonitorOutput.getTotalAmount());
|
|
}
|
|
}
|
|
|
|
+ if (null != yaoyiMonitorOutput) {
|
|
|
|
+ yaoyiMonitorAmount = yaoyiMonitorAmount.add(yaoyiMonitorOutput.getTotalAmount());
|
|
|
|
+ }
|
|
if (null != deptLimit) {
|
|
if (null != deptLimit) {
|
|
if (deptMonitorAmount.compareTo(deptLimit) > 0) {
|
|
if (deptMonitorAmount.compareTo(deptLimit) > 0) {
|
|
return R.failed(note.getRealName() + ":超过当月限额");
|
|
return R.failed(note.getRealName() + ":超过当月限额");
|
|
@@ -508,16 +537,20 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
|
|
return R.failed(note.getRealName() + ":超过结算渠道限额");
|
|
return R.failed(note.getRealName() + ":超过结算渠道限额");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (null != yaoyiLimitAmount) {
|
|
|
|
+ if (yaoyiMonitorAmount.compareTo(yaoyiLimitAmount) > 0) {
|
|
|
|
+ return R.failed(note.getRealName() + ":超过平台限额");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- note.setInvoiceType(input.getInvoiceCategory());
|
|
|
|
- note.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
|
+ note.setUpdateTime(now);
|
|
|
|
+ note.setSubTime(now);
|
|
note.setSubType(input.getSubType());
|
|
note.setSubType(input.getSubType());
|
|
note.setInvoiceType(input.getInvoiceCategory());
|
|
note.setInvoiceType(input.getInvoiceCategory());
|
|
note.setCategoryName(input.toCategoryName());
|
|
note.setCategoryName(input.toCategoryName());
|
|
if (null == note.getId()) {
|
|
if (null == note.getId()) {
|
|
note.setCreateTime(LocalDateTime.now());
|
|
note.setCreateTime(LocalDateTime.now());
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
WmScorePackage updateEntity = new WmScorePackage();
|
|
WmScorePackage updateEntity = new WmScorePackage();
|
|
updateEntity.setInvoiceCategory(input.getInvoiceCategory());
|
|
updateEntity.setInvoiceCategory(input.getInvoiceCategory());
|