|
@@ -58,8 +58,10 @@ public class SopWarnMonitorServiceImpl extends ServiceImpl<SopWarnMonitorMapper,
|
|
result.setSupplierId(Long.parseLong(leadList.get(0).toString()));
|
|
result.setSupplierId(Long.parseLong(leadList.get(0).toString()));
|
|
result.setSupplierName(leadList.get(1).toString());
|
|
result.setSupplierName(leadList.get(1).toString());
|
|
} else {
|
|
} else {
|
|
- result.setCoordinatorId(Long.parseLong(leadList.get(0).toString()));
|
|
|
|
- result.setCoordinatorName(leadList.get(1).toString());
|
|
|
|
|
|
+ if (leadList.get(0) != null) {
|
|
|
|
+ result.setCoordinatorId(Long.parseLong(leadList.get(0).toString()));
|
|
|
|
+ result.setCoordinatorName(leadList.get(1).toString());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
result.setTotal(detailList.size());
|
|
result.setTotal(detailList.size());
|
|
@@ -68,7 +70,7 @@ public class SopWarnMonitorServiceImpl extends ServiceImpl<SopWarnMonitorMapper,
|
|
|
|
|
|
//设置预警数量和占比
|
|
//设置预警数量和占比
|
|
for (SopWarnMonitorResult result : resultList) {
|
|
for (SopWarnMonitorResult result : resultList) {
|
|
- List<SopWarnMonitorDetailResult> filterWarnList;
|
|
|
|
|
|
+ List<SopWarnMonitorDetailResult> filterWarnList = new ArrayList<>();
|
|
|
|
|
|
if (type.equals(CrmProgressMonitorEnum.BY_LEAD)) {
|
|
if (type.equals(CrmProgressMonitorEnum.BY_LEAD)) {
|
|
filterWarnList = warnDetailList.stream()
|
|
filterWarnList = warnDetailList.stream()
|
|
@@ -79,9 +81,11 @@ public class SopWarnMonitorServiceImpl extends ServiceImpl<SopWarnMonitorMapper,
|
|
.filter(item -> item.getSupplierId().equals(result.getSupplierId()))
|
|
.filter(item -> item.getSupplierId().equals(result.getSupplierId()))
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
} else {
|
|
} else {
|
|
- filterWarnList = warnDetailList.stream()
|
|
|
|
- .filter(item -> item.getCoordinatorId().equals(result.getCoordinatorId()))
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
|
+ if(result.getCoordinatorId() != null) {
|
|
|
|
+ filterWarnList = warnDetailList.stream()
|
|
|
|
+ .filter(item -> item.getCoordinatorId().equals(result.getCoordinatorId()))
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
getWarnFieldNum(result, filterWarnList);
|
|
getWarnFieldNum(result, filterWarnList);
|
|
}
|
|
}
|
|
@@ -125,6 +129,8 @@ public class SopWarnMonitorServiceImpl extends ServiceImpl<SopWarnMonitorMapper,
|
|
}
|
|
}
|
|
|
|
|
|
private void getWarnFieldNum(SopWarnMonitorResult result, List<SopWarnMonitorDetailResult> filterWarnList) {
|
|
private void getWarnFieldNum(SopWarnMonitorResult result, List<SopWarnMonitorDetailResult> filterWarnList) {
|
|
|
|
+ if (CollectionUtils.isEmpty(filterWarnList))
|
|
|
|
+ return;
|
|
//按照预警字段分组,统计数量
|
|
//按照预警字段分组,统计数量
|
|
Map<String, List<SopWarnMonitorDetailResult>> map = filterWarnList.stream().collect(Collectors.groupingBy(SopWarnMonitorDetailResult::getFieldObj));
|
|
Map<String, List<SopWarnMonitorDetailResult>> map = filterWarnList.stream().collect(Collectors.groupingBy(SopWarnMonitorDetailResult::getFieldObj));
|
|
for (WarnFieldEnum field : WarnFieldEnum.values()) {
|
|
for (WarnFieldEnum field : WarnFieldEnum.values()) {
|
|
@@ -161,7 +167,7 @@ public class SopWarnMonitorServiceImpl extends ServiceImpl<SopWarnMonitorMapper,
|
|
}
|
|
}
|
|
|
|
|
|
private String getRatio(BigDecimal total, BigDecimal num) {
|
|
private String getRatio(BigDecimal total, BigDecimal num) {
|
|
- String ratio = "";
|
|
|
|
|
|
+ String ratio = "0.00%";
|
|
//计算占比
|
|
//计算占比
|
|
if (total.intValue() != 0 && num.intValue() != 0) {
|
|
if (total.intValue() != 0 && num.intValue() != 0) {
|
|
num = num.divide(total, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
|
|
num = num.divide(total, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
|