From 71093a08998b7e642ec859fa3ed45f75b4f92893 Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: 星期三, 24 八月 2022 19:02:28 +0800
Subject: [PATCH] fix

---
 goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/ExamineMngServiceImpl.java |   64 ++++++++++++++++---------------
 1 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/ExamineMngServiceImpl.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/ExamineMngServiceImpl.java
index d4b353d..69fca26 100644
--- a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/ExamineMngServiceImpl.java
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/ExamineMngServiceImpl.java
@@ -16,7 +16,6 @@
 import com.gkhy.safePlatform.targetDuty.service.CommonService;
 import com.gkhy.safePlatform.targetDuty.service.ExamineMngService;
 import com.gkhy.safePlatform.targetDuty.service.ExamineTemplateService;
-import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import com.gkhy.safePlatform.commons.enums.ResultCodes;
@@ -58,7 +57,7 @@
     private CommonService commonService;
 
 
-	@Override
+    @Override
     public ResultVO queryAll(PageQuery<ExamineMngQueryCriteria> pageQuery) {
         Long pageIndex = pageQuery.getPageIndex();
         Long pageSize = pageQuery.getPageSize();
@@ -71,32 +70,32 @@
         // --------------------------- 获取部门信息-----------------------
         //收集所用到的部门ID
         Set<Long> collectDepIdSet = new HashSet();
-        respList.forEach(f->{
+        respList.forEach(f -> {
             collectDepIdSet.add(f.getExamineDepartmentId());
             collectDepIdSet.add(f.getBeExaminedDepartmentId());
         });
         //获取部门名集合
-        Map<Long,String> depNameMap = commonService.getDepName(collectDepIdSet);
+        Map<Long, String> depNameMap = commonService.getDepName(collectDepIdSet);
 
-        respList.forEach(f->{
+        respList.forEach(f -> {
             f.setExamineDepartmentName(depNameMap.get(f.getExamineDepartmentId()));
             f.setBeExaminedDepartmentName(depNameMap.get(f.getBeExaminedDepartmentId()));
         });
 
         //获取打分明细
-        respList.forEach(dto->{
-            List<CurrentExamineDto> list = JSONObject.parseArray( dto.getNumberDetailJson(), CurrentExamineDto.class);
+        respList.forEach(dto -> {
+            List<CurrentExamineDto> list = JSONObject.parseArray(dto.getNumberDetailJson(), CurrentExamineDto.class);
             List<Long> idList = list.stream().map(CurrentExamineDto::getId).collect(Collectors.toList());
 
-            if (!idList.isEmpty()){
+            if (!idList.isEmpty()) {
                 List<ExamineItem> itemList = examineItemRepository.selectBatchIds(idList);
-                Map<Long,ExamineItem> itemMap = itemList.stream().collect(
-                        Collectors.toMap(ExamineItem::getId, Function.identity(),(k1, k2)->k1));
+                Map<Long, ExamineItem> itemMap = itemList.stream().collect(
+                        Collectors.toMap(ExamineItem::getId, Function.identity(), (k1, k2) -> k1));
 
-                if(itemMap != null){
-                    list.forEach(f->{
+                if (itemMap != null) {
+                    list.forEach(f -> {
                         ExamineItem item = itemMap.get(f.getId());
-                        if(item != null){
+                        if (item != null) {
                             f.setItemDetail(item.getItemDetail());
                             f.setContent(item.getContent());
                             f.setJudgeStandard(item.getJudgeStandard());
@@ -110,7 +109,7 @@
         return new SearchResultVO<>(
                 true,
                 pageIndex,
-                pageSize,page.getPages(),
+                pageSize, page.getPages(),
                 page.getTotal(),
                 respList,
                 ResultCodes.OK
@@ -126,38 +125,41 @@
     @Override
     public ExamineMngDto selectOne(Serializable id) {
         ExamineMng examineMng = this.getById(id);
-        if(examineMng == null){
+        if (examineMng == null) {
             return null;
         }
 
         ExamineMngDto dto = BeanCopyUtils.copyBean(examineMng, ExamineMngDto.class);
-        if(!StringUtils.hasText(examineMng.getNumberDetailJson())){
+        if (!StringUtils.hasText(examineMng.getNumberDetailJson())) {
             return dto;
         }
 
         //获取打分明细
-        List<CurrentExamineDto> list = JSONObject.parseArray( examineMng.getNumberDetailJson(), CurrentExamineDto.class);
+        List<CurrentExamineDto> list = JSONObject.parseArray(examineMng.getNumberDetailJson(), CurrentExamineDto.class);
         List<Long> idList = list.stream().map(CurrentExamineDto::getId).collect(Collectors.toList());
 
-        List<ExamineItem> itemList = examineItemRepository.selectBatchIds(idList);
-        Map<Long,ExamineItem> itemMap = itemList.stream().collect(
-                Collectors.toMap(ExamineItem::getId, Function.identity(),(k1, k2)->k1));
 
-        if(itemMap != null){
-            list.forEach(f->{
-                ExamineItem item = itemMap.get(f.getId());
-                if(item != null){
-                    f.setItemDetail(item.getItemDetail());
-                    f.setContent(item.getContent());
-                    f.setJudgeStandard(item.getJudgeStandard());
-                }
-            });
+        if (!idList.isEmpty()) {
+            List<ExamineItem> itemList = examineItemRepository.selectBatchIds(idList);
+            Map<Long, ExamineItem> itemMap = itemList.stream().collect(
+                    Collectors.toMap(ExamineItem::getId, Function.identity(), (k1, k2) -> k1));
+
+            if (itemMap != null) {
+                list.forEach(f -> {
+                    ExamineItem item = itemMap.get(f.getId());
+                    if (item != null) {
+                        f.setItemDetail(item.getItemDetail());
+                        f.setContent(item.getContent());
+                        f.setJudgeStandard(item.getJudgeStandard());
+                    }
+                });
+            }
         }
         dto.setCurrentExamineDtoList(list);
 
         //获取合格分数
-        ExamineTemplate examineTemplate = examineTemplateRepository.selectOne(new QueryWrapper<ExamineTemplate>().eq("id",examineMng.getExamineTemplateId()));
-        if(examineTemplate != null){
+        ExamineTemplate examineTemplate = examineTemplateRepository.selectOne(new QueryWrapper<ExamineTemplate>().eq("id", examineMng.getExamineTemplateId()));
+        if (examineTemplate != null) {
             dto.setAcceptanceNumber(examineTemplate.getAcceptanceNumber());
             dto.setExamineTemplateName(examineTemplate.getTitle());
         }

--
Gitblit v1.9.2