删除类

This commit is contained in:
chuhang
2021-05-06 14:46:16 +08:00
parent d5bc2ec5a7
commit ec40ae4825

View File

@ -1,138 +0,0 @@
package com.chinaunicom.mall.ebtp.extend.export.service.impl;
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl;
import com.chinaunicom.mall.ebtp.common.constant.CommonConstants;
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
import com.chinaunicom.mall.ebtp.extend.export.bean.*;
import com.chinaunicom.mall.ebtp.extend.export.dao.BizExportDictMapper;
import com.chinaunicom.mall.ebtp.extend.export.feign.ProcessFeignClient;
import com.chinaunicom.mall.ebtp.extend.export.feign.ProjectFeignService;
import com.chinaunicom.mall.ebtp.extend.export.feign.RsmsFeignService;
import com.chinaunicom.mall.ebtp.extend.export.service.IBizExportDictService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* 对数据表 biz_export_dict 操作的 serviceImpl
*
* @author Auto create
*/
@Service
@Slf4j
public class BizExportDictServiceImpl extends BaseServiceImpl<BizExportDictMapper, BizExportDict> implements IBizExportDictService {
@Autowired
private ProcessFeignClient processFeignClient;
@Autowired
private ProjectFeignService projectFeignService;
@Autowired
private RsmsFeignService rsmsFeignService;
/**
* 查询list
*
* @param roomId
*/
@Override
public Map<String, List<BizExportDict>> getList(String roomId) {
BizAssessRoom room = processFeignClient.getById(roomId).getData();
//查询项目名称
ProjectRecordVO proj = projectFeignService.getProjById(room.getTpId()).getData();
//包
ProjectSectionVO projectSectionVO = new ProjectSectionVO();
projectSectionVO.setId(room.getSectionId());
ProjectSectionVO section = projectFeignService.selectById(projectSectionVO).getData();
List<BizExportDict> list = baseMapper.selectDictList(proj.getBidMethodDict());
List<BizExportDict> level1 = list.stream().filter(f -> f.getLevel().equals(1)).sorted(Comparator.comparing(BizExportDict::getId))
.collect(Collectors.toList());
List<BizExportDict> level2 = list.stream().filter(f -> f.getLevel().equals(2)).sorted(Comparator.comparing(BizExportDict::getId))
.collect(Collectors.toList());
Map<String, List<BizExportDict>> resultsMap = new HashMap<>();
//是否包含开标阶段
boolean toInitialOpenRoom = room.getRoomType().equals(CommonConstants.ROOM_TYPE_2);
for (BizExportDict bizExportDict : level1) {
//不含开标阶段 100 = 开标阶段
if (!toInitialOpenRoom && bizExportDict.getId().equals(100)) {
continue;
}
// 评审室未结束 不拼接评审打分等数据表
if (room.getStatus() < 3 && !bizExportDict.getId().equals(100)) {
continue;
}
resultsMap.put(
bizExportDict.getDicName(),
level2.stream()
.filter(f -> f.getPath().equals(String.valueOf(bizExportDict.getId())))
.collect(Collectors.toList())
);
}
//初审数据url
String isReviewMethod = room.getRoomType().equals(CommonConstants.ROOM_TYPE_1) ? "1" : "0";
List<ArchiveLink> archiveLinks = getFirstArchiveLinks();
Map<String, List<ArchiveFileReturnVO>> firstRvwMap = rsmsFeignService.findEarlyArchiveList(room.getSectionId(), isReviewMethod, archiveLinks).getData();
//详审数据url
archiveLinks = getDetailArchiveLinks();
Map<String, List<ArchiveFileReturnVO>> detailRvwMap = rsmsFeignService.findDetailArchiveList(room.getSectionId(), isReviewMethod, archiveLinks).getData();
resultsMap.forEach((key, value) -> {
value.forEach(bizExportDict -> {
if ("1".equals(bizExportDict.getUrl())) {
//查询初审报表
Optional<ArchiveFileReturnVO> opt = firstRvwMap.get(bizExportDict.getUrl()).stream().filter(f -> f.getAssessRoomId().equals(roomId)).findFirst();
opt.ifPresent(o -> bizExportDict.setUrl(o.getArchiveFileUrl()));
} else if (bizExportDict.getUrl().length() < 5) {
//查询详审报表
Optional<ArchiveFileReturnVO> opt = detailRvwMap.get(bizExportDict.getUrl()).stream().filter(f -> f.getAssessRoomId().equals(roomId)).findFirst();
opt.ifPresent(o -> bizExportDict.setUrl(o.getArchiveFileUrl()));
} else {
String sbl = bizExportDict.getUrl() +
"?assessRoomId=" + roomId +
// "&reviewTurnId=" + v.getReviewTurnId() +
"&projectId=" + proj.getId() +
"&sectionId=" + section.getId();
bizExportDict.setUrl(sbl);
}
});
//如果没进行初审或详审 则删除相关报表 length < 5 为虚数
value.removeIf(bizExportDict -> bizExportDict.getUrl().length() < 5);
});
//删除value为空的key
resultsMap.values().removeIf(List::isEmpty);
return resultsMap;
}
private List<ArchiveLink> getFirstArchiveLinks() {
List<ArchiveLink> archiveLinks = new ArrayList<>();
//初步评审表URL
archiveLinks.add(new ArchiveLink().setId("1").setArchiveDirectory("1"));
return archiveLinks;
}
private List<ArchiveLink> getDetailArchiveLinks() {
List<ArchiveLink> archiveLinks = new ArrayList<>();
//详细评审表URL
// archiveLinks.add(new ArchiveLink().setId("2").setArchiveDirectory("2"));
//专家打分表URL
archiveLinks.add(new ArchiveLink().setId("3").setArchiveDirectory("3"));
//价格打分表URL
archiveLinks.add(new ArchiveLink().setId("4").setArchiveDirectory("4"));
//打分汇总表URL
archiveLinks.add(new ArchiveLink().setId("5").setArchiveDirectory("5"));
//评审报告URL
// archiveLinks.add(new ArchiveLink().setId("6").setArchiveDirectory("6"));
return archiveLinks;
}
}