UAT问题清单-222条问题修改,上报库-一般导出开发。
This commit is contained in:
@@ -647,3 +647,6 @@ ALTER TABLE `project_task_planning`
|
|||||||
|
|
||||||
-- 工作流数据库-增加固定数据 2023-05-17 未同步生产环境
|
-- 工作流数据库-增加固定数据 2023-05-17 未同步生产环境
|
||||||
INSERT INTO `t_form`(`OBJECT_ID`, `CODE`, `CREATE_TIME`, `WIDGET_JSON`, `JSON`, `NAME`, `SHOW_KEY`, `IS_DELETED`, `MODEL_ID`, `JSON_EVAL`, `HTML`, `RUN_TYPE`, `CATEGORY_ID`, `HTML_READONLY`) VALUES ('xgjfwlc', '0007', '2023-05-17 13:52:26', NULL, NULL, '修改交付物流程', NULL, 0, '15007', NULL, NULL, 'json', '4bdf0b396b4aa6ea10dd5e19956a1e22', NULL);
|
INSERT INTO `t_form`(`OBJECT_ID`, `CODE`, `CREATE_TIME`, `WIDGET_JSON`, `JSON`, `NAME`, `SHOW_KEY`, `IS_DELETED`, `MODEL_ID`, `JSON_EVAL`, `HTML`, `RUN_TYPE`, `CATEGORY_ID`, `HTML_READONLY`) VALUES ('xgjfwlc', '0007', '2023-05-17 13:52:26', NULL, NULL, '修改交付物流程', NULL, 0, '15007', NULL, NULL, 'json', '4bdf0b396b4aa6ea10dd5e19956a1e22', NULL);
|
||||||
|
|
||||||
|
-- 菜单增加 上报库详情-一般导出权限 2023-06-16 未同步生产环境
|
||||||
|
INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `keep_alive`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`, `menu_en`) VALUES ('1669532516277075970', '1552487412749369345', '一般导出', NULL, NULL, NULL, NULL, 2, 'report:detail:export:general', '1', 1.00, 0, NULL, 1, 1, 0, 0, NULL, 'admin', '2023-06-16 10:29:05', NULL, NULL, 0, 0, '1', 0, 'General export');
|
||||||
|
|||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
package com.jero.common.util;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体工具类
|
||||||
|
*/
|
||||||
|
public class BeanUtils {
|
||||||
|
/**
|
||||||
|
* 实体对象转Map
|
||||||
|
* @param entity
|
||||||
|
* @param <T>
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static <T> Map<String, Object> entityToMap(T entity) {
|
||||||
|
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
List<Field> fieldList = new ArrayList<>();
|
||||||
|
|
||||||
|
Class<?> clazz = entity.getClass();
|
||||||
|
Field[] fields = clazz.getDeclaredFields();
|
||||||
|
fieldList.addAll(Arrays.asList(fields));
|
||||||
|
|
||||||
|
Field[] superFields = clazz.getSuperclass().getDeclaredFields();
|
||||||
|
fieldList.addAll(Arrays.asList(superFields));
|
||||||
|
|
||||||
|
for (Field field : fieldList) {
|
||||||
|
|
||||||
|
field.setAccessible(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
map.put(field.getName(), field.get(entity));
|
||||||
|
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -213,4 +213,13 @@ public class ParamsReportDetailEOController extends JeroController<ParamsReportD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "上报库参数项-一般导出")
|
||||||
|
@GetMapping(value = "/exportGeneral")
|
||||||
|
@RequiresPermissions("report:detail:export:general")
|
||||||
|
public void exportGeneral(ParamsReportDetailVO paramsReportDetailVO,
|
||||||
|
HttpServletResponse response,
|
||||||
|
HttpServletRequest request) {
|
||||||
|
this.paramsReportDetailEOService.exportGeneral(paramsReportDetailVO, response, request);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -7,7 +7,8 @@ import java.util.Map;
|
|||||||
|
|
||||||
public enum ExportTypeEnum {
|
public enum ExportTypeEnum {
|
||||||
NORMAL("常规导出","1","Normal export"),
|
NORMAL("常规导出","1","Normal export"),
|
||||||
CUSTOM("自定义导出","2","Custom export");
|
CUSTOM("自定义导出","2","Custom export"),
|
||||||
|
GENERAL("一般导出","3","General export");
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
String value;
|
String value;
|
||||||
|
|||||||
+6
@@ -73,4 +73,10 @@ public interface IParamsReportDetailEOService extends IService<ParamsReportDetai
|
|||||||
|
|
||||||
// 导出参数项历史Log信息
|
// 导出参数项历史Log信息
|
||||||
void exportParamsReportDetailLog(String cut, XSSFWorkbook workbook, String sheetHistoryName, List<Map<String, Object>> allParamsInfoList, XSSFCellStyle headerCellStyle,XSSFCellStyle bodyCellStyle);
|
void exportParamsReportDetailLog(String cut, XSSFWorkbook workbook, String sheetHistoryName, List<Map<String, Object>> allParamsInfoList, XSSFCellStyle headerCellStyle,XSSFCellStyle bodyCellStyle);
|
||||||
|
|
||||||
|
// 一般导出
|
||||||
|
void exportGeneral(ParamsReportDetailVO paramsReportDetailVO, HttpServletResponse response, HttpServletRequest request);
|
||||||
|
|
||||||
|
// 处理数据
|
||||||
|
void disposeData(List<ParamsReportDetailEO> prdEoList, String cut);
|
||||||
}
|
}
|
||||||
|
|||||||
+549
-1
@@ -12,6 +12,7 @@ import com.jero.common.constant.enums.CutEnum;
|
|||||||
import com.jero.common.constant.enums.ModuleEnum;
|
import com.jero.common.constant.enums.ModuleEnum;
|
||||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||||
import com.jero.common.exception.JeroBootException;
|
import com.jero.common.exception.JeroBootException;
|
||||||
|
import com.jero.common.system.query.QueryGenerator;
|
||||||
import com.jero.common.system.vo.LoginUser;
|
import com.jero.common.system.vo.LoginUser;
|
||||||
import com.jero.common.util.oss.CosBootUtil;
|
import com.jero.common.util.oss.CosBootUtil;
|
||||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||||
@@ -32,7 +33,6 @@ import com.jero.modules.cert.template.enums.ParamsIsMustEnum;
|
|||||||
import com.jero.modules.ocr.util.LineHumpUtil;
|
import com.jero.modules.ocr.util.LineHumpUtil;
|
||||||
import com.jero.modules.oss.entity.OSSFile;
|
import com.jero.modules.oss.entity.OSSFile;
|
||||||
import com.jero.modules.oss.service.IOSSFileService;
|
import com.jero.modules.oss.service.IOSSFileService;
|
||||||
import com.jero.modules.project.entity.ProjectTaskInventoryEO;
|
|
||||||
import com.jero.modules.project.util.Docx4jUtils;
|
import com.jero.modules.project.util.Docx4jUtils;
|
||||||
import com.jero.modules.project.util.ExcelUtil;
|
import com.jero.modules.project.util.ExcelUtil;
|
||||||
import com.jero.modules.project.util.WordUtil;
|
import com.jero.modules.project.util.WordUtil;
|
||||||
@@ -55,6 +55,7 @@ import org.docx4j.openpackaging.exceptions.Docx4JException;
|
|||||||
import org.docx4j.openpackaging.packages.SpreadsheetMLPackage;
|
import org.docx4j.openpackaging.packages.SpreadsheetMLPackage;
|
||||||
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
|
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
|
||||||
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
|
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.mock.web.MockMultipartFile;
|
import org.springframework.mock.web.MockMultipartFile;
|
||||||
@@ -112,6 +113,8 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IParamsReportDetailLogEOService paramsReportDetailLogEOService;
|
private IParamsReportDetailLogEOService paramsReportDetailLogEOService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IReportCertCategoryParamsInfoEOService reportCertCategoryParamsInfoEOService;
|
||||||
|
|
||||||
@Value(value = "${jero.path.upload}")
|
@Value(value = "${jero.path.upload}")
|
||||||
private String uploadpath;
|
private String uploadpath;
|
||||||
@@ -2356,4 +2359,549 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
|||||||
// }
|
// }
|
||||||
// return map;
|
// return map;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exportGeneral(ParamsReportDetailVO paramsReportDetailVO, HttpServletResponse response, HttpServletRequest request) {
|
||||||
|
OutputStream os = null;
|
||||||
|
OutputStream excelOS = null;
|
||||||
|
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||||
|
String fileOriName = "一般导出";
|
||||||
|
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
|
||||||
|
fileOriName = "general";
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(paramsReportDetailVO.getExportName())) {
|
||||||
|
fileOriName = paramsReportDetailVO.getExportName();
|
||||||
|
}
|
||||||
|
//创建临时文件夹
|
||||||
|
String fileNowPath = uploadpath + "/tempZip/" + UUID.randomUUID().toString().replace("-", "") + File.separator + fileOriName;
|
||||||
|
File nowFile = new File(fileNowPath);
|
||||||
|
if (nowFile.exists()) {
|
||||||
|
nowFile.delete();
|
||||||
|
}
|
||||||
|
nowFile.mkdirs();
|
||||||
|
try {
|
||||||
|
String fileName = fileOriName + ".xlsx";
|
||||||
|
// 设置表格相关属性
|
||||||
|
String sheetName = "参数项信息";
|
||||||
|
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
|
||||||
|
sheetName = "Params data";
|
||||||
|
}
|
||||||
|
XSSFSheet sheetItems = workbook.createSheet(sheetName);
|
||||||
|
String[] titles = this.getWorkbookTitleForExportGeneral(paramsReportDetailVO); // 获取表头
|
||||||
|
|
||||||
|
String[] headers = titles[1].split(",");
|
||||||
|
XSSFCellStyle cellStyle = workbook.createCellStyle();
|
||||||
|
cellStyle.setWrapText(true);
|
||||||
|
cellStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);
|
||||||
|
XSSFCellStyle cellStyle1 = workbook.createCellStyle();
|
||||||
|
cellStyle1.setAlignment(XSSFCellStyle.ALIGN_CENTER);
|
||||||
|
XSSFCellStyle cellStyleLink = workbook.createCellStyle();
|
||||||
|
XSSFFont font = workbook.createFont();
|
||||||
|
font.setColor(HSSFColor.LIGHT_BLUE.index);
|
||||||
|
cellStyleLink.setFont(font);
|
||||||
|
cellStyleLink.setWrapText(true);
|
||||||
|
|
||||||
|
// 查询需要导出的字段
|
||||||
|
String field = titles[0]; // 字符串形式
|
||||||
|
List<String> fieldList = Arrays.asList(field.split(",")); // list形式
|
||||||
|
|
||||||
|
// 查询导出数据
|
||||||
|
List<Map<String, Object>> allParamsInfoList = this.queryForExportGeneral(paramsReportDetailVO, request);
|
||||||
|
|
||||||
|
// 开始处理工作表
|
||||||
|
List<OSSFile> allRelevFileList = new ArrayList<>();
|
||||||
|
|
||||||
|
// 在excel表中添加表头
|
||||||
|
XSSFRow row = sheetItems.createRow(0);
|
||||||
|
for (int i = 0; i < headers.length; i++) {
|
||||||
|
XSSFCell cell = row.createCell(i);
|
||||||
|
XSSFRichTextString text = new XSSFRichTextString(headers[i]);
|
||||||
|
cell.setCellValue(text);
|
||||||
|
cell.setCellStyle(cellStyle1);
|
||||||
|
// 设置单元格宽度
|
||||||
|
String ParamsValues = "参数值";
|
||||||
|
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
|
||||||
|
ParamsValues = "Params Values";
|
||||||
|
}
|
||||||
|
if (ParamsValues.equals(headers[i])) {
|
||||||
|
sheetItems.setColumnWidth(i, 80 * 256);
|
||||||
|
} else {
|
||||||
|
sheetItems.setColumnWidth(i, 20 * 256);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//放文字内容
|
||||||
|
int allRow = 0;
|
||||||
|
for (int rowNum = 0; rowNum < allParamsInfoList.size(); rowNum++) {
|
||||||
|
Map<String, Object> exportDto = allParamsInfoList.get(rowNum);
|
||||||
|
|
||||||
|
// 处理文件
|
||||||
|
List<OSSFile> fileList = (List<OSSFile>) exportDto.get("fileList");
|
||||||
|
if (CollectionUtil.isNotEmpty(fileList)) {
|
||||||
|
allRelevFileList.addAll(fileList);
|
||||||
|
}
|
||||||
|
|
||||||
|
allRow++;
|
||||||
|
XSSFRow row1 = sheetItems.createRow(allRow);
|
||||||
|
for (int cellNum = 0; cellNum < fieldList.size(); cellNum++) {
|
||||||
|
if (ObjectUtils.isNotEmpty(exportDto.get(fieldList.get(cellNum)))) {
|
||||||
|
row1.createCell(cellNum).setCellValue(exportDto.get(fieldList.get(cellNum)).toString());
|
||||||
|
row1.getCell(cellNum).setCellStyle(cellStyle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//下载关联文件内容
|
||||||
|
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
|
||||||
|
allRelevFileList = allRelevFileList.stream().distinct().collect(Collectors.toList());
|
||||||
|
String exportFile = "导出文件";
|
||||||
|
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
|
||||||
|
exportFile = "Export file";
|
||||||
|
}
|
||||||
|
this.downLoadFileList(allRelevFileList, fileNowPath + File.separator + exportFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
String repFileName = fileName.replaceAll("/", "_");
|
||||||
|
excelOS = new FileOutputStream(fileNowPath + File.separator + repFileName);
|
||||||
|
response.setHeader("Content-Disposition",
|
||||||
|
"attachment; filename=\"" + ReadExcel.encodeFileName(fileOriName + ".zip", request) + "\"");
|
||||||
|
response.setContentType("application/force-download");
|
||||||
|
response.flushBuffer();
|
||||||
|
os = response.getOutputStream();
|
||||||
|
workbook.write(excelOS);
|
||||||
|
excelOS.flush();
|
||||||
|
excelOS.close();
|
||||||
|
ZipUtil.zip(fileNowPath, fileNowPath + ".zip");
|
||||||
|
FileInputStream fis = new FileInputStream(fileNowPath + ".zip");
|
||||||
|
int len = 0;
|
||||||
|
while ((len = fis.read()) != -1) {
|
||||||
|
os.write(len);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加导出历史
|
||||||
|
String uploadFileName = fileOriName + ".zip";
|
||||||
|
InputStream uploadFileio = new FileInputStream(new File(fileNowPath + ".zip"));
|
||||||
|
MultipartFile mFile = new MockMultipartFile(uploadFileName, uploadFileName, "text/plain", uploadFileio); // 用于上传
|
||||||
|
OSSFile ossFile = ossFileService.uploadLocalOfCos(mFile, "/report", "", CutEnum.CN.getValue()); // 上传导出的压缩包
|
||||||
|
ParamsReportExportHistoryEO paramsReportExportHistoryEO = new ParamsReportExportHistoryEO();
|
||||||
|
paramsReportExportHistoryEO.setExportType(ExportTypeEnum.GENERAL.getValue());
|
||||||
|
paramsReportExportHistoryEO.setExportFileId(ossFile.getId());
|
||||||
|
paramsReportExportHistoryEO.setParamsManifestId(paramsReportDetailVO.getParamsManifestId());
|
||||||
|
paramsReportExportHistoryEO.setExportTime(new Date());
|
||||||
|
paramsReportExportHistoryEOService.add(paramsReportExportHistoryEO);
|
||||||
|
|
||||||
|
uploadFileio.close();
|
||||||
|
os.flush();
|
||||||
|
os.close(); // 后开先关
|
||||||
|
fis.close(); // 先开后关
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
|
||||||
|
throw new JeroBootException("Failed to download file, please try again");
|
||||||
|
} else {
|
||||||
|
throw new JeroBootException("下载文件失败,请重试");
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeQuietly(os);
|
||||||
|
IOUtils.closeQuietly(excelOS);
|
||||||
|
File tempZipFile = new File(uploadpath + "/tempZip");
|
||||||
|
FileUtil.deleteContents(tempZipFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disposeData(List<ParamsReportDetailEO> datas, String cut) {
|
||||||
|
if (CollectionUtils.isNotEmpty(datas)) {
|
||||||
|
// 普通数据字典
|
||||||
|
List<SysDictItem> dictItemList = new ArrayList<>();
|
||||||
|
List<String> dictCodeList = new ArrayList<>();
|
||||||
|
dictCodeList.add("duty_territory");
|
||||||
|
dictCodeList.add("cert_category");
|
||||||
|
for (String dictCode : dictCodeList) {
|
||||||
|
List<SysDictItem> dictItems = sysDictItemService.selectItemsByDictCode(dictCode);
|
||||||
|
dictItemList.addAll(dictItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ParamsReportDetailEO data : datas) {
|
||||||
|
// 处理数据字典字段 中英文切换 认证类型,责任领域
|
||||||
|
List<String> certCategory = Arrays.asList(data.getCertCategory().split(","));
|
||||||
|
List<String> dutyTerritory = Arrays.asList(data.getDutyTerritory().split(","));
|
||||||
|
String certCategoryName = "";
|
||||||
|
String dutyTerritoryName = "";
|
||||||
|
if (CutEnum.CN.getValue().equals(cut)) {
|
||||||
|
certCategoryName = dictItemList.stream()
|
||||||
|
.filter(e -> certCategory.contains(e.getItemValue()))
|
||||||
|
.map(SysDictItem::getItemText)
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
|
||||||
|
dutyTerritoryName = dictItemList.stream()
|
||||||
|
.filter(e -> dutyTerritory.contains(e.getItemValue()))
|
||||||
|
.map(SysDictItem::getItemText)
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
|
||||||
|
} else if (CutEnum.EN.getValue().equals(cut)) {
|
||||||
|
certCategoryName = dictItemList.stream()
|
||||||
|
.filter(e -> certCategory.contains(e.getItemValue()))
|
||||||
|
.map(SysDictItem::getEnName)
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
|
||||||
|
dutyTerritoryName = dictItemList.stream()
|
||||||
|
.filter(e -> dutyTerritory.contains(e.getItemValue()))
|
||||||
|
.map(SysDictItem::getEnName)
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
|
||||||
|
}
|
||||||
|
data.setCertCategory(certCategoryName);
|
||||||
|
data.setDutyTerritory(dutyTerritoryName);
|
||||||
|
|
||||||
|
data.setIsMust(ParamsIsMustEnum.getTextByValue(data.getIsMust(),cut));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Map<String, Object>> queryForExportGeneral(ParamsReportDetailVO paramsReportDetailVO,HttpServletRequest req) throws IOException {
|
||||||
|
List<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
|
||||||
|
ParamsReportDetailEO paramsReportDetailEO = new ParamsReportDetailEO();
|
||||||
|
BeanUtils.copyProperties(paramsReportDetailVO, paramsReportDetailEO);
|
||||||
|
String certCategorys = paramsReportDetailEO.getCertCategory();
|
||||||
|
if (StringUtils.isNotEmpty(paramsReportDetailEO.getCertCategory())) {
|
||||||
|
paramsReportDetailEO.setCertCategory(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
QueryWrapper<ParamsReportDetailEO> queryWrapper = QueryGenerator.initQueryWrapper(paramsReportDetailEO, req.getParameterMap());
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(certCategorys)) {
|
||||||
|
queryWrapper.and(query -> {
|
||||||
|
query.lambda().like(ParamsReportDetailEO::getCertCategory, certCategorys);
|
||||||
|
if (StringUtils.contains(certCategorys, ",")) {
|
||||||
|
String[] certCategoryArr = certCategorys.split(",");
|
||||||
|
for (String certCategory : certCategoryArr) {
|
||||||
|
query.or().lambda().like(ParamsReportDetailEO::getCertCategory, certCategory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(paramsReportDetailVO.getAllNumber())) {
|
||||||
|
QueryWrapper<ReportCertCategoryParamsInfoEO> rccpiQueryWrap = new QueryWrapper<>();
|
||||||
|
rccpiQueryWrap.lambda().eq(ReportCertCategoryParamsInfoEO::getParamsNumber, paramsReportDetailVO.getAllNumber());
|
||||||
|
List<ReportCertCategoryParamsInfoEO> rccpiEoList = this.reportCertCategoryParamsInfoEOService.list(rccpiQueryWrap);
|
||||||
|
queryWrapper.and(query -> {
|
||||||
|
query.lambda().eq(ParamsReportDetailEO::getNioNumber, paramsReportDetailVO.getAllNumber());
|
||||||
|
if (CollectionUtils.isNotEmpty(rccpiEoList)) {
|
||||||
|
List<String> nioNumbers = rccpiEoList.stream().map(ReportCertCategoryParamsInfoEO::getNioNumber).distinct().collect(Collectors.toList());
|
||||||
|
query.or().lambda().in(ParamsReportDetailEO::getNioNumber, nioNumbers);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(paramsReportDetailVO.getIds())) {
|
||||||
|
queryWrapper.lambda().in(ParamsReportDetailEO::getId, Arrays.asList(paramsReportDetailVO.getIds().split(",")));
|
||||||
|
}
|
||||||
|
queryWrapper.orderByDesc("sync_time").orderByAsc("nio_number");
|
||||||
|
|
||||||
|
List<ParamsReportDetailEO> prdEoList = this.list(queryWrapper);
|
||||||
|
this.disposeData(prdEoList, paramsReportDetailVO.getCut());
|
||||||
|
|
||||||
|
List<ParamsReportDetailEO> exportDataList = new ArrayList<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(prdEoList)) {
|
||||||
|
QueryWrapper<ParamsReportConfigEO> prcQueryWrap = new QueryWrapper<>();
|
||||||
|
prcQueryWrap.lambda().eq(ParamsReportConfigEO::getParamsManifestId, paramsReportDetailVO.getParamsManifestId());
|
||||||
|
List<ParamsReportConfigEO> prcEoList = this.paramsReportConfigEOService.list(prcQueryWrap);
|
||||||
|
|
||||||
|
List<String> prcIdList = prcEoList.stream().map(ParamsReportConfigEO::getId).distinct().collect(Collectors.toList());
|
||||||
|
List<ParamsReportConfigDataEO> prcdEoList = this.paramsReportConfigDataEOService.queryListByConfigIdList(prcIdList);
|
||||||
|
|
||||||
|
for (ParamsReportDetailEO prdEo : prdEoList) {
|
||||||
|
// 配置列多行数据处理
|
||||||
|
String id = prdEo.getId();
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(prcdEoList)) {
|
||||||
|
Map<String, List<ParamsReportConfigDataEO>> paramsConfigDataMap = prcdEoList.stream().filter(configDataEO -> {
|
||||||
|
boolean flag = false;
|
||||||
|
if (StringUtils.equals(configDataEO.getParamsCollectManifestId(), id)) {
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}).collect(Collectors.groupingBy(configDataEO -> configDataEO.getParamsConfigId()));
|
||||||
|
|
||||||
|
List<Map<String, Object>> paramsConfigDataCountList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Map.Entry<String, List<ParamsReportConfigDataEO>> map : paramsConfigDataMap.entrySet()) {
|
||||||
|
Map<String, Object> paramsConfigDataCountMap = new HashMap<>();
|
||||||
|
paramsConfigDataCountMap.put("key", map.getKey());
|
||||||
|
paramsConfigDataCountMap.put("paramsConfigDataCount", map.getValue().size());
|
||||||
|
paramsConfigDataCountMap.put("value", map.getValue());
|
||||||
|
paramsConfigDataCountList.add(paramsConfigDataCountMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序 配置数据总数倒序排序
|
||||||
|
Collections.sort(paramsConfigDataCountList, new Comparator<Map<String, Object>>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
|
||||||
|
return o2.get("paramsConfigDataCount").toString().compareTo(o1.get("paramsConfigDataCount").toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取出最多行的配置列。
|
||||||
|
if (!paramsConfigDataCountList.isEmpty()) {
|
||||||
|
Map<String, Object> paramsConfigDataMaxCountMap = paramsConfigDataCountList.get(0);
|
||||||
|
String key = (String) paramsConfigDataMaxCountMap.get("key");
|
||||||
|
List<ParamsReportConfigDataEO> paramsConfigDataEOs = paramsConfigDataMap.get(key);
|
||||||
|
for (ParamsReportConfigDataEO paramsConfigDataEO : paramsConfigDataEOs) {
|
||||||
|
ParamsReportDetailEO ParamsReportDetailEO = new ParamsReportDetailEO();
|
||||||
|
BeanUtils.copyProperties(prdEo, ParamsReportDetailEO);
|
||||||
|
exportDataList.add(ParamsReportDetailEO);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
exportDataList.add(prdEo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(exportDataList)) {
|
||||||
|
// 排除的数据数组 等于将数组中的数据逻辑删除。
|
||||||
|
List<String> excludePrcdIdList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (ParamsReportDetailEO prdEo : exportDataList) {
|
||||||
|
Map<String, Object> prdEoMap = com.jero.common.util.BeanUtils.entityToMap(prdEo);
|
||||||
|
String paramsCollectManifestId = prdEo.getId();
|
||||||
|
String controlType = prdEo.getControlType();
|
||||||
|
String nioNumber = prdEo.getNioNumber();
|
||||||
|
|
||||||
|
// 配置列
|
||||||
|
if (CollectionUtil.isNotEmpty(prcEoList)) {
|
||||||
|
List<OSSFile> fileList = new ArrayList<>();
|
||||||
|
|
||||||
|
prcEoList.forEach(prcEo -> { // 参数配置
|
||||||
|
|
||||||
|
String prcEoId = prcEo.getId();
|
||||||
|
// 参数配置数据
|
||||||
|
List<ParamsReportConfigDataEO> prcdEos = prcdEoList.stream().filter(e -> {
|
||||||
|
boolean flag = false;
|
||||||
|
if (StringUtils.equals(prcEoId, e.getParamsConfigId()) && paramsCollectManifestId.equals(e.getParamsCollectManifestId())) {
|
||||||
|
if (!excludePrcdIdList.contains(e.getId())) {
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
StringBuilder configDataBuilder = new StringBuilder(); // 重新组合配置数据
|
||||||
|
if (CollectionUtil.isNotEmpty(prcdEos)) {
|
||||||
|
ParamsReportConfigDataEO prcdEo = prcdEos.get(0);
|
||||||
|
|
||||||
|
if (ControlTypeEnum.TEXT.getValue().equals(controlType)) {
|
||||||
|
if (StringUtils.isNotEmpty(prcdEo.getTextData())) {
|
||||||
|
configDataBuilder.append(prcdEo.getTextData());
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ControlTypeEnum.PULL_SINGLE.getValue().equals(controlType)
|
||||||
|
|| ControlTypeEnum.PULL_MORE.getValue().equals(controlType)) {
|
||||||
|
if (StringUtils.isNotEmpty(prcdEo.getPullData())) {
|
||||||
|
configDataBuilder.append(prcdEo.getPullData().replaceAll(",", "!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ControlTypeEnum.FILE.getValue().equals(controlType)) {
|
||||||
|
if (StringUtils.isNotEmpty(prcdEo.getFileConnectId())) {
|
||||||
|
List<OSSFile> ossFileList = ossFileService.getFileInfosByConnectId(prcdEo.getFileConnectId());
|
||||||
|
if (CollectionUtil.isNotEmpty(ossFileList)) {
|
||||||
|
configDataBuilder.append(nioNumber).append("/").append(ossFileList.get(0).getFileName());
|
||||||
|
|
||||||
|
fileList.addAll(ossFileList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ControlTypeEnum.TEXT_PULL_SINGLE.getValue().equals(controlType)
|
||||||
|
|| ControlTypeEnum.TEXT_PULL_MORE.getValue().equals(controlType)) {
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(prcdEo.getTextData())) {
|
||||||
|
configDataBuilder.append(prcdEo.getTextData());
|
||||||
|
}
|
||||||
|
|
||||||
|
configDataBuilder.append("#");
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(prcdEo.getPullData())) {
|
||||||
|
configDataBuilder.append(prcdEo.getPullData().replaceAll(",", "!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ControlTypeEnum.TEXT_FILE.getValue().equals(controlType)) {
|
||||||
|
if (StringUtils.isNotEmpty(prcdEo.getTextData())) {
|
||||||
|
configDataBuilder.append(prcdEo.getTextData());
|
||||||
|
}
|
||||||
|
|
||||||
|
configDataBuilder.append("#");
|
||||||
|
if (StringUtils.isNotEmpty(prcdEo.getFileConnectId())) {
|
||||||
|
List<OSSFile> ossFileList = ossFileService.getFileInfosByConnectId(prcdEo.getFileConnectId());
|
||||||
|
if (CollectionUtil.isNotEmpty(ossFileList)) {
|
||||||
|
configDataBuilder.append(nioNumber).append("/").append(ossFileList.get(0).getFileName());
|
||||||
|
|
||||||
|
fileList.addAll(ossFileList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ControlTypeEnum.PULL_SINGLE_FILE.getValue().equals(controlType)
|
||||||
|
|| ControlTypeEnum.PULL_MORE_FILE.getValue().equals(controlType)) {
|
||||||
|
if (StringUtils.isNotEmpty(prcdEo.getPullData())) {
|
||||||
|
configDataBuilder.append(prcdEo.getPullData().replaceAll(",", "!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
configDataBuilder.append("#");
|
||||||
|
if (StringUtils.isNotEmpty(prcdEo.getFileConnectId())) {
|
||||||
|
List<OSSFile> ossFileList = ossFileService.getFileInfosByConnectId(prcdEo.getFileConnectId());
|
||||||
|
if (CollectionUtil.isNotEmpty(ossFileList)) {
|
||||||
|
configDataBuilder.append(nioNumber).append("/").append(ossFileList.get(0).getFileName());
|
||||||
|
|
||||||
|
fileList.addAll(ossFileList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ControlTypeEnum.TEXT_PULL_SINGLE_FILE.getValue().equals(controlType)) {
|
||||||
|
if (StringUtils.isNotEmpty(prcdEo.getTextData())) {
|
||||||
|
configDataBuilder.append(prcdEo.getTextData());
|
||||||
|
}
|
||||||
|
configDataBuilder.append("#");
|
||||||
|
if (StringUtils.isNotEmpty(prcdEo.getPullData())) {
|
||||||
|
configDataBuilder.append(prcdEo.getPullData().replaceAll(",", "!"));
|
||||||
|
}
|
||||||
|
configDataBuilder.append("#");
|
||||||
|
if (StringUtils.isNotEmpty(prcdEo.getFileConnectId())) {
|
||||||
|
List<OSSFile> ossFileList = ossFileService.getFileInfosByConnectId(prcdEo.getFileConnectId());
|
||||||
|
if (CollectionUtil.isNotEmpty(ossFileList)) {
|
||||||
|
configDataBuilder.append(nioNumber).append("/").append(ossFileList.get(0).getFileName());
|
||||||
|
|
||||||
|
fileList.addAll(ossFileList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// prcdEoList.remove(prcdEo);
|
||||||
|
excludePrcdIdList.add(prcdEo.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
String configData = configDataBuilder.toString();
|
||||||
|
if (StringUtils.isNotEmpty(configData) && "".equals(configData.replace("#", ""))) {
|
||||||
|
configData = configData.replace("#", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
prdEoMap.put(prcEo.getId(), configData);
|
||||||
|
});
|
||||||
|
|
||||||
|
prdEoMap.put("fileList", fileList);
|
||||||
|
}
|
||||||
|
result.add(prdEoMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String[] getWorkbookTitleForExportGeneral(ParamsReportDetailVO paramsReportDetailVO) {
|
||||||
|
String cut = paramsReportDetailVO.getCut();
|
||||||
|
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.PARAMS_REPORT_DETAIL.getValue());
|
||||||
|
|
||||||
|
List<String> dbFieldNameList = new ArrayList<>();
|
||||||
|
List<String> dbFieldList = new ArrayList<>();
|
||||||
|
|
||||||
|
if (fieldList.size() != 0) {
|
||||||
|
//过滤列表字段(is_show_list-->列表是否显示0否 1是)
|
||||||
|
fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))).collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 设置排序字段,将字段重新排序
|
||||||
|
for (OnlCgformField onlCgformField : fieldList) {
|
||||||
|
String dbFieldName = this.fieldConvert(onlCgformField.getDbFieldName());
|
||||||
|
if (StringUtils.isNotEmpty(dbFieldName)) {
|
||||||
|
Integer fieldIndex = this.getFieldIndex(dbFieldName);
|
||||||
|
|
||||||
|
onlCgformField.setOrderNum(fieldIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重新排序
|
||||||
|
fieldList = fieldList.stream().sorted(Comparator.comparingInt(o -> o.getOrderNum())).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 固定列
|
||||||
|
for (int i = 0; i < fieldList.size(); i++) {
|
||||||
|
OnlCgformField onlCgformField = fieldList.get(i);
|
||||||
|
String dbFieldName = this.fieldConvert(onlCgformField.getDbFieldName());
|
||||||
|
if (StringUtils.isNotEmpty(dbFieldName)) {
|
||||||
|
dbFieldList.add(dbFieldName);
|
||||||
|
if (CutEnum.CN.getValue().equals(cut)) {
|
||||||
|
dbFieldNameList.add(onlCgformField.getDbFieldTxt()); // 字段中文名
|
||||||
|
} else {
|
||||||
|
dbFieldNameList.add(onlCgformField.getDbFieldEnName()); // 字段英文名
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 配置列
|
||||||
|
QueryWrapper<ParamsReportConfigEO> queryWrap = new QueryWrapper<>();
|
||||||
|
queryWrap.lambda().in(ParamsReportConfigEO::getParamsManifestId, paramsReportDetailVO.getParamsManifestId());
|
||||||
|
queryWrap.lambda().orderByAsc(ParamsReportConfigEO::getDisplaySeq);
|
||||||
|
List<ParamsReportConfigEO> paramsReportConfigEOList = this.paramsReportConfigEOService.list(queryWrap);
|
||||||
|
if (CollectionUtil.isNotEmpty(paramsReportConfigEOList)) {
|
||||||
|
for (ParamsReportConfigEO paramsReportConfigEO : paramsReportConfigEOList) {
|
||||||
|
dbFieldList.add(paramsReportConfigEO.getId());
|
||||||
|
dbFieldNameList.add(paramsReportConfigEO.getConfigName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] title = new String[2];
|
||||||
|
String dbFieldStr = StringUtils.join(dbFieldList, ",");
|
||||||
|
String dbFieldNameStr = StringUtils.join(dbFieldNameList, ",");
|
||||||
|
|
||||||
|
title[0] = dbFieldStr;
|
||||||
|
title[1] = dbFieldNameStr;
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String fieldConvert(String field) {
|
||||||
|
if (field == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
switch (field) {
|
||||||
|
case "nio_number":
|
||||||
|
return "nioNumber";
|
||||||
|
case "params_name":
|
||||||
|
return "paramsName";
|
||||||
|
case "cert_category":
|
||||||
|
return "certCategory";
|
||||||
|
case "is_must":
|
||||||
|
return "isMust";
|
||||||
|
case "description":
|
||||||
|
return "description";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字段的下标,字段在excel表格中占据第几列
|
||||||
|
* @param field
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Integer getFieldIndex(String field) {
|
||||||
|
if (field == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
switch (field) {
|
||||||
|
case "nioNumber":
|
||||||
|
return 1;
|
||||||
|
case "paramsName":
|
||||||
|
return 2;
|
||||||
|
case "certCategory":
|
||||||
|
return 3;
|
||||||
|
case "isMust":
|
||||||
|
return 4;
|
||||||
|
case "description":
|
||||||
|
return 5;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+16
@@ -1,6 +1,7 @@
|
|||||||
package com.jero.modules.cert.template.enums;
|
package com.jero.modules.cert.template.enums;
|
||||||
|
|
||||||
import com.jero.common.constant.enums.CutEnum;
|
import com.jero.common.constant.enums.CutEnum;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -76,4 +77,19 @@ public enum ParamsIsMustEnum {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getTextByValue(String value,String cut){
|
||||||
|
String result = "";
|
||||||
|
ParamsIsMustEnum[] paramsIsMustEnums = ParamsIsMustEnum.values();
|
||||||
|
for (ParamsIsMustEnum paramsIsMustEnum : paramsIsMustEnums) {
|
||||||
|
if(StringUtils.equals(value,paramsIsMustEnum.value)){
|
||||||
|
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
|
||||||
|
result = paramsIsMustEnum.name;
|
||||||
|
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
|
||||||
|
result = paramsIsMustEnum.enName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
{{$t('preservation')}}
|
{{$t('preservation')}}
|
||||||
</div>
|
</div>
|
||||||
<!-- 导出-->
|
<!-- 导出-->
|
||||||
<div @click="handleExport" class="operator-text" v-has="'report:detail:export:normal'">
|
<div @click="handleExport" class="operator-text" v-has="'report:detail:export:general'">
|
||||||
<a-icon type="export"/>
|
<a-icon type="export"/>
|
||||||
{{$t('dataExport')}}
|
{{$t('dataExport')}}
|
||||||
</div>
|
</div>
|
||||||
@@ -683,16 +683,17 @@ import { downloadFile, getAction, postAction } from '../../../api/manage'
|
|||||||
} else if (long && long === 'en-us') {
|
} else if (long && long === 'en-us') {
|
||||||
this.cut = 'en'
|
this.cut = 'en'
|
||||||
}
|
}
|
||||||
|
console.log(this.selectedRowKeys)
|
||||||
let query = {
|
let query = {
|
||||||
paramsManifestId: this.paramsManifest.id,
|
paramsManifestId: this.$route.query.id,
|
||||||
paramsTemplateId: this.$route.query.paramsTemplateId,
|
|
||||||
paramsTemplatePublishVersion: 1,
|
|
||||||
cut: this.cut,
|
cut: this.cut,
|
||||||
userTypes: this.currentPersonRole,
|
// userTypes: this.currentPersonRole,
|
||||||
|
ids:this.selectedRowKeys.join(','),
|
||||||
|
...this.formInline,
|
||||||
exportName: this.$route.query.projectName + '(' + this.$route.query.title + ')'
|
exportName: this.$route.query.projectName + '(' + this.$route.query.title + ')'
|
||||||
}
|
}
|
||||||
let name = this.$route.query.projectName + '(' + this.$route.query.title + ')' + '.zip'
|
let name = this.$route.query.projectName + '(' + this.$route.query.title + ')' + '.zip'
|
||||||
downloadFile('/params/collectManifest/exportAll', name, query, this.selectClear)
|
downloadFile('/report/detail/exportGeneral', name, query, this.selectClear)
|
||||||
},
|
},
|
||||||
ConventionalExport() {
|
ConventionalExport() {
|
||||||
this.$refs.conventionalModel.addModel()
|
this.$refs.conventionalModel.addModel()
|
||||||
|
|||||||
Reference in New Issue
Block a user