|
@@ -84,6 +84,7 @@ import java.time.LocalDateTime;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
+import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.HashSet;
|
|
import java.util.HashSet;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -92,6 +93,7 @@ import java.util.Objects;
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -785,7 +787,7 @@ public class PartyAServiceImpl implements PartyAService {
|
|
boolean absent = redisTemplate.opsForValue()
|
|
boolean absent = redisTemplate.opsForValue()
|
|
.setIfAbsent(record.getTemp3().trim(), record.getTemp3());
|
|
.setIfAbsent(record.getTemp3().trim(), record.getTemp3());
|
|
|
|
|
|
- if (!absent){
|
|
|
|
|
|
+ if (!absent) {
|
|
log.error("证据链不能重复上传:{}", record.getTemp3());
|
|
log.error("证据链不能重复上传:{}", record.getTemp3());
|
|
errorList.add(taskSettleInfo);
|
|
errorList.add(taskSettleInfo);
|
|
continue out;
|
|
continue out;
|
|
@@ -1088,7 +1090,7 @@ public class PartyAServiceImpl implements PartyAService {
|
|
}
|
|
}
|
|
|
|
|
|
List<SettlementDTO> settlementDTOList = new ArrayList<>();
|
|
List<SettlementDTO> settlementDTOList = new ArrayList<>();
|
|
- for (ExecSettlementDTO settlementDTO : execSettlementDTOList){
|
|
|
|
|
|
+ for (ExecSettlementDTO settlementDTO : execSettlementDTOList) {
|
|
List<SettlementDTO> tempList = settlementDTO.getSettlementDTOList();
|
|
List<SettlementDTO> tempList = settlementDTO.getSettlementDTOList();
|
|
if (CollectionUtils.isEmpty(tempList)) {
|
|
if (CollectionUtils.isEmpty(tempList)) {
|
|
return getResultMap("4000", "结算内容为空");
|
|
return getResultMap("4000", "结算内容为空");
|
|
@@ -1110,6 +1112,18 @@ public class PartyAServiceImpl implements PartyAService {
|
|
return note;
|
|
return note;
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
|
|
+ // 校验限额
|
|
|
|
+ BigDecimal tmp = new BigDecimal("0.0");
|
|
|
|
+ for (WmScorePackageSettleNote note : noteList) {
|
|
|
|
+ tmp = tmp.add(note.getSettleAmount());
|
|
|
|
+ }
|
|
|
|
+ String errInfo = checkoutSettleLimit(member,noteList.stream().mapToInt(WmScorePackageSettleNote::getId).boxed()
|
|
|
|
+ .collect(Collectors.toList()), deptSub.getLimitAmount(), tmp);
|
|
|
|
+ if (StringUtils.isNotEmpty(errInfo)) {
|
|
|
|
+ log.error(errInfo);
|
|
|
|
+ return getResultMap("4000", errInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
log.info("结算渠道: {} ", execSettlementDTO.getSubjectType());
|
|
log.info("结算渠道: {} ", execSettlementDTO.getSubjectType());
|
|
Map<String, String> result = null;
|
|
Map<String, String> result = null;
|
|
if (SubjectTypeEnum.TYPE_RENLIJIA.getCode().equals(execSettlementDTO.getSubjectType())) {
|
|
if (SubjectTypeEnum.TYPE_RENLIJIA.getCode().equals(execSettlementDTO.getSubjectType())) {
|
|
@@ -1132,6 +1146,57 @@ public class PartyAServiceImpl implements PartyAService {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 校验结算限制
|
|
|
|
+ *
|
|
|
|
+ * @param user 被校验者
|
|
|
|
+ * @param noteIds 结算记录id
|
|
|
|
+ * @param limitAmount 限制金额
|
|
|
|
+ * @param settleAmount 本次上传证据链累计金额
|
|
|
|
+ * @return 校验错误信息,如果没有错误返回{@code null}
|
|
|
|
+ */
|
|
|
|
+ private String checkoutSettleLimit(SysUser user, List<Integer> noteIds ,BigDecimal limitAmount, BigDecimal settleAmount) {
|
|
|
|
+
|
|
|
|
+ String info = null;
|
|
|
|
+
|
|
|
|
+ SettleAmountMonitorInput monitorInput = SettleAmountMonitorInput.fromIdCard(Collections.singletonList(user
|
|
|
|
+ .getIdCardNumber()), noteIds, SubjectTypeEnum.TYPE_SHUIBANGYUN.getCode());
|
|
|
|
+ List<SettleAmountMonitorOutput> monitorOutputList = sysDeptSubService.getSettleAmountMonitor(monitorInput);
|
|
|
|
+
|
|
|
|
+ SettleAmountMonitorInput deptMonitorInput = SettleAmountMonitorInput.fromUserId(Collections.singletonList(String
|
|
|
|
+ .valueOf(user.getUserId())), noteIds, SubjectTypeEnum.TYPE_SHUIBANGYUN.getCode());
|
|
|
|
+ List<SettleAmountMonitorOutput> deptAmountMonitor = sysDeptSubService.getDeptAmountMonitor(deptMonitorInput);
|
|
|
|
+
|
|
|
|
+ SettleAmountMonitorOutput monitorOutput = monitorOutputList.stream().filter(item -> item.getIdCardNumber()
|
|
|
|
+ .equals(user.getIdCardNumber())).findFirst().orElse(null);
|
|
|
|
+
|
|
|
|
+ SettleAmountMonitorOutput deptMonitorOutput = deptAmountMonitor.stream().filter(item -> item.getUserId()
|
|
|
|
+ .equals(String.valueOf(user.getUserId()))).findFirst().orElse(null);
|
|
|
|
+
|
|
|
|
+ MonitoringIndicator monitoringIndicator = monitoringIndicatorService.getBySubType(SubjectTypeEnum.TYPE_SHUIBANGYUN
|
|
|
|
+ .getCode());
|
|
|
|
+ BigDecimal monitoringLimit = monitoringIndicator.getLimitAmount();
|
|
|
|
+ BigDecimal monitorAmount = settleAmount;
|
|
|
|
+ BigDecimal deptMonitorAmount = settleAmount;
|
|
|
|
+ if (null != monitorOutput) {
|
|
|
|
+ monitorAmount = monitorAmount.add(monitorOutput.getTotalAmount());
|
|
|
|
+ }
|
|
|
|
+ if (null != deptMonitorOutput) {
|
|
|
|
+ deptMonitorAmount = deptMonitorAmount.add(deptMonitorOutput.getTotalAmount());
|
|
|
|
+ }
|
|
|
|
+ if (null != limitAmount) {
|
|
|
|
+ if (deptMonitorAmount.compareTo(limitAmount) > 0) {
|
|
|
|
+ info = "超过当月限额";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (null != monitoringLimit) {
|
|
|
|
+ if (monitorAmount.compareTo(monitoringLimit) > 0) {
|
|
|
|
+ info = "超过结算渠道限额";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return info;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 税帮云结算
|
|
* 税帮云结算
|
|
*
|
|
*
|