fix
songhuangfeng123
2022-08-24 71093a08998b7e642ec859fa3ed45f75b4f92893
fix
已修改1个文件
69 ■■■■ 文件已修改
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/ExamineMngServiceImpl.java 69 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/ExamineMngServiceImpl.java
@@ -55,9 +55,9 @@
    @Resource
    private CommonService commonService;
    @Override
    @Override
    public ResultVO queryAll(PageQuery<ExamineMngQueryCriteria> pageQuery) {
        Long pageIndex = pageQuery.getPageIndex();
        Long pageSize = pageQuery.getPageSize();
@@ -70,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());
@@ -109,7 +109,7 @@
        return new SearchResultVO<>(
                true,
                pageIndex,
                pageSize,page.getPages(),
                pageSize, page.getPages(),
                page.getTotal(),
                respList,
                ResultCodes.OK
@@ -125,42 +125,45 @@
    @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());
        }
        return dto;
    }
}
}