|
@@ -234,10 +234,13 @@ public class BaseFieldAtomicService {
|
|
.filter(e -> e.getEndMonth() != null &&
|
|
.filter(e -> e.getEndMonth() != null &&
|
|
DateUtils.getSpaceByUnit(DateUtils.convertStrToDate(e.getEndMonth(), DateUtils.YYYY_MM), currtDate, DateUtils.UNIT_MOUTHS) <= 12)
|
|
DateUtils.getSpaceByUnit(DateUtils.convertStrToDate(e.getEndMonth(), DateUtils.YYYY_MM), currtDate, DateUtils.UNIT_MOUTHS) <= 12)
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
- BigDecimal last1YearHousingFundAvg = last1YearHousingList.stream()
|
|
|
|
|
|
+ BigDecimal last1YearHousingFund = last1YearHousingList.stream()
|
|
.map(e -> e.getMonthMoney() == null ? BigDecimal.ZERO : e.getMonthMoney())
|
|
.map(e -> e.getMonthMoney() == null ? BigDecimal.ZERO : e.getMonthMoney())
|
|
- .reduce(BigDecimal.ZERO, BigDecimal::add)
|
|
|
|
- .divide(BigDecimal.valueOf(last1YearHousingList.size()), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ BigDecimal last1YearHousingFundAvg = new BigDecimal("0.00");
|
|
|
|
+ if (last1YearHousingFund.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
+ last1YearHousingFundAvg = last1YearHousingFund.divide(BigDecimal.valueOf(last1YearHousingList.size()), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ }
|
|
jsonResultMap.put(last1YearHousingFundAvgKey, last1YearHousingFundAvg);
|
|
jsonResultMap.put(last1YearHousingFundAvgKey, last1YearHousingFundAvg);
|
|
//住房公积金-最近3年公积金平均值
|
|
//住房公积金-最近3年公积金平均值
|
|
String last3YearHousingFundAvgKey = fieldDefineCount.stream()
|
|
String last3YearHousingFundAvgKey = fieldDefineCount.stream()
|
|
@@ -249,10 +252,14 @@ public class BaseFieldAtomicService {
|
|
.filter(e -> e.getEndMonth() != null &&
|
|
.filter(e -> e.getEndMonth() != null &&
|
|
DateUtils.getSpaceByUnit(DateUtils.convertStrToDate(e.getEndMonth(), DateUtils.YYYY_MM), currtDate, DateUtils.UNIT_MOUTHS) <= 36)
|
|
DateUtils.getSpaceByUnit(DateUtils.convertStrToDate(e.getEndMonth(), DateUtils.YYYY_MM), currtDate, DateUtils.UNIT_MOUTHS) <= 36)
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
- BigDecimal last3YearHousingFundAvg = last3YearHousingList.stream()
|
|
|
|
|
|
+ BigDecimal last3YearHousingFund = last3YearHousingList.stream()
|
|
.map(e -> e.getMonthMoney() == null ? BigDecimal.ZERO : e.getMonthMoney())
|
|
.map(e -> e.getMonthMoney() == null ? BigDecimal.ZERO : e.getMonthMoney())
|
|
- .reduce(BigDecimal.ZERO, BigDecimal::add)
|
|
|
|
- .divide(BigDecimal.valueOf(last3YearHousingList.size()), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ BigDecimal last3YearHousingFundAvg = new BigDecimal("0.00");
|
|
|
|
+
|
|
|
|
+ if (last3YearHousingFund.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
+ last3YearHousingFundAvg = last3YearHousingFund.divide(BigDecimal.valueOf(last3YearHousingList.size()), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ }
|
|
jsonResultMap.put(last3YearHousingFundAvgKey, last3YearHousingFundAvg);
|
|
jsonResultMap.put(last3YearHousingFundAvgKey, last3YearHousingFundAvg);
|
|
|
|
|
|
List<Map> trsInfoList = new ArrayList<>();
|
|
List<Map> trsInfoList = new ArrayList<>();
|
|
@@ -1176,19 +1183,30 @@ public class BaseFieldAtomicService {
|
|
public Map<String, String> relRepayInfoCalculate(JSONObject jsonObject, List<FieldDefineEntity> defineEntityList) {
|
|
public Map<String, String> relRepayInfoCalculate(JSONObject jsonObject, List<FieldDefineEntity> defineEntityList) {
|
|
Map<String, String> jsonResultMap = new HashMap<>();
|
|
Map<String, String> jsonResultMap = new HashMap<>();
|
|
SmryRepay smryRepay = jsonObject.toJavaObject(SmryRepay.class);
|
|
SmryRepay smryRepay = jsonObject.toJavaObject(SmryRepay.class);
|
|
- List<SmryRepayInfo> smryRepayInfoList = smryRepay.getSmryRepayInfoList();
|
|
|
|
|
|
+ List<SmryRepayInfo> smryRepayInfoList = Optional.ofNullable(smryRepay.getSmryRepayInfoList()).orElse(new ArrayList<SmryRepayInfo>());
|
|
//按照借款人身份类别进行分组
|
|
//按照借款人身份类别进行分组
|
|
- Map<String, List<SmryRepayInfo>> repayInfoMap = smryRepayInfoList.stream().collect(Collectors.groupingBy(e -> e.getBoTypeCode()));
|
|
|
|
-
|
|
|
|
- Map<String, List<FieldDefineEntity>> fieldDefineMap = defineEntityList.stream().collect(Collectors.groupingBy(e -> e.getParam()));
|
|
|
|
|
|
+ Map<String, List<SmryRepayInfo>> repayInfoMap = smryRepayInfoList.
|
|
|
|
+ stream()
|
|
|
|
+ .filter((e) -> e.getBoTypeCode() != null)
|
|
|
|
+ .collect(Collectors.groupingBy(e -> e.getBoTypeCode()));
|
|
|
|
+
|
|
|
|
+ Map<String, List<FieldDefineEntity>> fieldDefineMap = defineEntityList.stream()
|
|
|
|
+ .filter((e) -> e.getParam() != null)
|
|
|
|
+ .collect(Collectors.groupingBy(e -> e.getParam()));
|
|
//个人
|
|
//个人
|
|
List<FieldDefineEntity> perFieldDefineEntities = fieldDefineMap.get("1");
|
|
List<FieldDefineEntity> perFieldDefineEntities = fieldDefineMap.get("1");
|
|
//个人
|
|
//个人
|
|
List<SmryRepayInfo> perSmryRepayInfos = repayInfoMap.get("1");
|
|
List<SmryRepayInfo> perSmryRepayInfos = repayInfoMap.get("1");
|
|
- //按类别进行分组
|
|
|
|
- Map<String, List<SmryRepayInfo>> perRespCodeMap = perSmryRepayInfos.stream().collect(Collectors.groupingBy(e -> e.getRelPayRespDesc()));
|
|
|
|
- List<SmryRepayInfo> perGuaranteeList = perRespCodeMap.get("担保责任");
|
|
|
|
- List<SmryRepayInfo> perOtherList = perRespCodeMap.get("其他相关还款责任");
|
|
|
|
|
|
+ List<SmryRepayInfo> perGuaranteeList = null;
|
|
|
|
+ List<SmryRepayInfo> perOtherList = null;
|
|
|
|
+ if (perSmryRepayInfos != null) {
|
|
|
|
+ //按类别进行分组
|
|
|
|
+ Map<String, List<SmryRepayInfo>> perRespCodeMap = perSmryRepayInfos.stream()
|
|
|
|
+ .filter((e) -> e.getRelPayRespDesc() != null)
|
|
|
|
+ .collect(Collectors.groupingBy(e -> e.getRelPayRespDesc()));
|
|
|
|
+ perGuaranteeList = perRespCodeMap.get("担保责任");
|
|
|
|
+ perOtherList = perRespCodeMap.get("其他相关还款责任");
|
|
|
|
+ }
|
|
for (FieldDefineEntity perFieldDefineEntity : perFieldDefineEntities) {
|
|
for (FieldDefineEntity perFieldDefineEntity : perFieldDefineEntities) {
|
|
String path = perFieldDefineEntity.getPath();
|
|
String path = perFieldDefineEntity.getPath();
|
|
String name = perFieldDefineEntity.getName();
|
|
String name = perFieldDefineEntity.getName();
|
|
@@ -1207,9 +1225,15 @@ public class BaseFieldAtomicService {
|
|
}
|
|
}
|
|
//企业
|
|
//企业
|
|
List<SmryRepayInfo> entSmryRepayInfos = repayInfoMap.get("2");
|
|
List<SmryRepayInfo> entSmryRepayInfos = repayInfoMap.get("2");
|
|
- Map<String, List<SmryRepayInfo>> entRespCodeMap = entSmryRepayInfos.stream().collect(Collectors.groupingBy(e -> e.getRelPayRespDesc()));
|
|
|
|
- List<SmryRepayInfo> entGuaranteeList = entRespCodeMap.get("担保责任");
|
|
|
|
- List<SmryRepayInfo> entOtherList = entRespCodeMap.get("其他相关还款责任");
|
|
|
|
|
|
+ List<SmryRepayInfo> entGuaranteeList = null;
|
|
|
|
+ List<SmryRepayInfo> entOtherList = null;
|
|
|
|
+ if (entSmryRepayInfos != null) {
|
|
|
|
+ Map<String, List<SmryRepayInfo>> entRespCodeMap = entSmryRepayInfos.stream()
|
|
|
|
+ .filter((e) -> e.getRelPayRespDesc() != null)
|
|
|
|
+ .collect(Collectors.groupingBy(e -> e.getRelPayRespDesc()));
|
|
|
|
+ entGuaranteeList = entRespCodeMap.get("担保责任");
|
|
|
|
+ entOtherList = entRespCodeMap.get("其他相关还款责任");
|
|
|
|
+ }
|
|
List<FieldDefineEntity> entFieldDefineEntities = fieldDefineMap.get("2");
|
|
List<FieldDefineEntity> entFieldDefineEntities = fieldDefineMap.get("2");
|
|
for (FieldDefineEntity entFieldDefineEntity : entFieldDefineEntities) {
|
|
for (FieldDefineEntity entFieldDefineEntity : entFieldDefineEntities) {
|
|
String path = entFieldDefineEntity.getPath();
|
|
String path = entFieldDefineEntity.getPath();
|