浏览代码

Merge remote-tracking branch 'origin/V0.0.5' into V0.0.5

jingyuanchao 1 年之前
父节点
当前提交
d3cf869ac6

+ 47 - 43
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/service/impl/CockpitServiceImpl.java

@@ -59,42 +59,42 @@ public class CockpitServiceImpl implements CockpitService {
         List<SysDictData> dicts = remoteDictDataService.selectDictByeType("check_type", SecurityConstants.INNER);
         dicts.sort(Comparator.comparing(SysDictData::getDictSort));
         List<WebSafetyCheckVo> r = dicts.stream()
-                .filter(d->ObjectUtil.notEqual(d.getDictValue(),"1") && ObjectUtil.notEqual(d.getDictValue(),"2") )
+                .filter(d -> ObjectUtil.notEqual(d.getDictValue(), "1") && ObjectUtil.notEqual(d.getDictValue(), "2"))
                 .map(d -> {
-            Optional<WebSafetyCheckVo> voOpt = list.stream().filter(i -> ObjectUtil.equal(i.getType(), d.getDictValue())).findFirst();
-            WebSafetyCheckVo vo;
-            if (voOpt.isPresent()) {
-                vo = voOpt.get();
-            } else {
-                vo = new WebSafetyCheckVo();
-            }
-            String label = d.getDictLabel();
-            switch (d.getDictValue()) {
-                case "1":
-                    label = "省联社检查";
-                    break;
-                case "2":
-                    label = "办事处检查";
-                    break;
-                case "3":
-                    label = "网点自查";
-                    break;
-                case "4":
-                    label = "全面检查";
-                    break;
-                case "5":
-                    label = "阶段性检查";
-                    break;
-                case "6":
-                    label = "专项检查";
-                    break;
-                case "7":
-                    label = "其它检查";
-                    break;
-            }
-            vo.setType(label);
-            return vo;
-        }).collect(Collectors.toList());
+                    Optional<WebSafetyCheckVo> voOpt = list.stream().filter(i -> ObjectUtil.equal(i.getType(), d.getDictValue())).findFirst();
+                    WebSafetyCheckVo vo;
+                    if (voOpt.isPresent()) {
+                        vo = voOpt.get();
+                    } else {
+                        vo = new WebSafetyCheckVo();
+                    }
+                    String label = d.getDictLabel();
+                    switch (d.getDictValue()) {
+                        case "1":
+                            label = "省联社检查";
+                            break;
+                        case "2":
+                            label = "办事处检查";
+                            break;
+                        case "3":
+                            label = "网点自查";
+                            break;
+                        case "4":
+                            label = "全面检查";
+                            break;
+                        case "5":
+                            label = "阶段性检查";
+                            break;
+                        case "6":
+                            label = "专项检查";
+                            break;
+                        case "7":
+                            label = "其它检查";
+                            break;
+                    }
+                    vo.setType(label);
+                    return vo;
+                }).collect(Collectors.toList());
 
         return r;
     }
@@ -115,7 +115,7 @@ public class CockpitServiceImpl implements CockpitService {
         SysOrg org = getOrgThrowIfNull(dto.getOrgId());
         String orgPath = org.getPath();
         List<TaskStatisticVo> list = cockpitMapper.edu(date, DateUtil.endOfDay(new Date()), orgPath);
-        list= taskStatistic(list, dto.getOrgId());
+        list = taskStatistic(list, dto.getOrgId());
 
         list.sort(Comparator.comparing(TaskStatisticVo::getCompletedRate));
         Collections.reverse(list);
@@ -203,8 +203,14 @@ public class CockpitServiceImpl implements CockpitService {
     public OrgSecurityInfoVo orgSecurityInfo(Long orgId) {
         SysOrg org = getOrgThrowIfNull(orgId);
         OrgSecurityInfoVo vo = cockpitMapper.orgSecurityInfo(org.getPath());
-        vo.setEquippedRate(NumberUtils.computeRate(vo.getEquippedCount() + vo.getUnequippedCount(), vo.getEquippedCount()));
-        vo.setUnequippedRate(NumberUtils.computeRate(vo.getEquippedCount() + vo.getUnequippedCount(), vo.getUnequippedCount()));
+        if (ObjectUtil.isNotNull(vo)) {
+            vo.setEquippedRate(NumberUtils.computeRate(vo.getEquippedCount() + vo.getUnequippedCount(), vo.getEquippedCount()));
+            vo.setUnequippedRate(NumberUtils.computeRate(vo.getEquippedCount() + vo.getUnequippedCount(), vo.getUnequippedCount()));
+        } else {
+            vo = new OrgSecurityInfoVo();
+            vo.setEquippedRate(1f);
+            vo.setUnequippedRate(1f);
+        }
 
         return vo;
     }
@@ -228,8 +234,6 @@ public class CockpitServiceImpl implements CockpitService {
             vo.setPaperRate(NumberUtils.computeRate(total, vo.getPaperCount()));
         }
 
-
-
         return vo;
     }
 
@@ -242,7 +246,7 @@ public class CockpitServiceImpl implements CockpitService {
         if (ObjectUtil.isNull(questionDto)) {
             questionDto = new WebSyntheticQuestionDto();
         }
-        Map<String, Object> overdueCount = cockpitMapper.selectOverDueQuestionCount(org.getPath(), range.getStartTime(),range.getEndTime());
+        Map<String, Object> overdueCount = cockpitMapper.selectOverDueQuestionCount(org.getPath(), range.getStartTime(), range.getEndTime());
 
         QuestionStatisticVo vo = new QuestionStatisticVo();
         vo.setTotal(questionDto.getTotal());
@@ -253,8 +257,8 @@ public class CockpitServiceImpl implements CockpitService {
         vo.setReformed(NumberUtils.computeRate(questionDto.getTotal(), questionDto.getReformedCount()));
 
         if (overdueCount.size() > 0) {
-            Long count =(Long) overdueCount.get("count");
-            BigDecimal overdue = (BigDecimal)overdueCount.get("overdueCount");
+            Long count = (Long) overdueCount.get("count");
+            BigDecimal overdue = (BigDecimal) overdueCount.get("overdueCount");
             vo.setOverdue(NumberUtils.computeRate(count.intValue(), overdue.intValue()));
         } else {
             vo.setOverdue(1f);