|
|
@@ -2,11 +2,14 @@ package com.hz.pm.api.projectlib.manage; |
|
|
|
|
|
|
|
import cn.hutool.core.util.NumberUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.poi.excel.ExcelUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.hz.pm.api.common.exception.ReturnException; |
|
|
|
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; |
|
|
|
import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoDTO; |
|
|
|
import com.hz.pm.api.projectlib.model.entity.Project; |
|
|
|
import com.hz.pm.api.projectlib.model.enumeration.GovSystemReplaceTypeEnum; |
|
|
|
import com.hz.pm.api.projectlib.model.vo.SystemReplaceInfoVO; |
|
|
|
import com.hz.pm.api.projectlib.model.vo.UnitProjectGovSystemReplaceVO; |
|
|
|
import com.hz.pm.api.projectlib.model.vo.UnitProjectGovSystemReplaceVO.ProjectGovSystemReplaceVO; |
|
|
@@ -18,10 +21,9 @@ import com.ningdatech.basic.util.CollUtils; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@@ -112,4 +114,34 @@ public class ProjectGovSystemReplaceInfoManage { |
|
|
|
return retDetail; |
|
|
|
} |
|
|
|
|
|
|
|
public void downTmp(HttpServletResponse response) { |
|
|
|
List<ProjectGovSystemReplaceInfos> replaceInfos = systemReplaceInfosService.list(); |
|
|
|
replaceInfos.removeIf(w -> StrUtil.isNotBlank(w.getSourceSystemId())); |
|
|
|
if (replaceInfos.isEmpty()) { |
|
|
|
throw ReturnException.wrap("暂无数据可供导出"); |
|
|
|
} |
|
|
|
for (ProjectGovSystemReplaceInfos replaceInfo : replaceInfos) { |
|
|
|
if (StrUtil.isNotBlank(replaceInfo.getReplaceType())) { |
|
|
|
String replaceType = replaceInfo.getReplaceType(); |
|
|
|
String[] split = replaceType.split(","); |
|
|
|
String replaceTypeStr = Arrays.stream(split) |
|
|
|
.filter(NumberUtil::isNumber) |
|
|
|
.map(w -> GovSystemReplaceTypeEnum.getVal(Integer.parseInt(w))) |
|
|
|
.collect(Collectors.joining(",")); |
|
|
|
replaceInfo.setReplaceType(replaceTypeStr); |
|
|
|
} else { |
|
|
|
replaceInfo.setReplaceType(StrUtil.EMPTY); |
|
|
|
} |
|
|
|
} |
|
|
|
try (ServletOutputStream sos = response.getOutputStream()) { |
|
|
|
response.setContentType("application/vnd.ms-excel"); |
|
|
|
ExcelUtil.getWriter() |
|
|
|
.write(replaceInfos) |
|
|
|
.flush(sos) |
|
|
|
.close(); |
|
|
|
} catch (Exception e) { |
|
|
|
throw ReturnException.wrap("导出失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |