认证-参数项导出中英文切换

This commit is contained in:
liyawei
2022-04-27 18:46:07 +08:00
parent 80464b97bf
commit a2c03aa59a
10 changed files with 325 additions and 100 deletions
@@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import com.jero.common.api.CommonAPI;
import com.jero.common.system.vo.DictModel;
import com.jero.common.util.oConvertUtils;
import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.dict.service.AutoPoiDictServiceI;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@@ -31,7 +32,8 @@ public class AutoPoiDictConfig implements AutoPoiDictServiceI {
/**
* 通过字典查询easypoi,所需字典文本
*
*
* 特殊说明:英文文本对应dicCode格式:dicCode_en,且dicTable为空
* @Author:scott
* @since2019-04-09
* @return
@@ -42,7 +44,11 @@ public class AutoPoiDictConfig implements AutoPoiDictServiceI {
List<DictModel> dictList = null;
// step.1 如果没有字典表则使用系统字典表
if (oConvertUtils.isEmpty(dicTable)) {
dictList = commonAPI.queryDictItemsByCode(dicCode);
if("en".equals(dicCode.substring(dicCode.lastIndexOf("_")+1))) {
dictList = commonAPI.queryDictItemsByCode(dicCode.substring(0, dicCode.lastIndexOf("_")));
} else {
dictList = commonAPI.queryDictItemsByCode(dicCode);
}
} else {
try {
dicText = oConvertUtils.getString(dicText, dicCode);
@@ -51,9 +57,21 @@ public class AutoPoiDictConfig implements AutoPoiDictServiceI {
log.error(e.getMessage(),e);
}
}
for (DictModel t : dictList) {
if(t!=null){
dictReplaces.add(t.getText() + "_" + t.getValue());
if("en".equals(dicCode.substring(dicCode.lastIndexOf("_")+1))) { // 显示英文文本
for (DictModel t : dictList) {
if (t != null) {
if(StringUtils.isBlank(t.getTextEn())){ // 字典值对应英文文本为空,则显示中文
dictReplaces.add(t.getText() + "_" + t.getValue());
} else {
dictReplaces.add(t.getTextEn() + "_" + t.getValue());
}
}
}
} else { // 显示中文文本
for (DictModel t : dictList) {
if (t != null) {
dictReplaces.add(t.getText() + "_" + t.getValue());
}
}
}
if (dictReplaces != null && dictReplaces.size() != 0) {
@@ -63,6 +63,8 @@ public class ParamsInfoEOController extends JeroController<ParamsInfoEO, IParams
.orderByDesc(ParamsInfoEO::getCreateTime);
Page<ParamsInfoEO> page = new Page<ParamsInfoEO>(pageNo, pageSize);
IPage<ParamsInfoEO> pageList = paramsInfoEOService.page(page, queryWrapper);
// List<ParamsInfoEO> rows = pageList.getRecords();
// paramsInfoEOService.getTreeDictItemText(rows, cut);
return Result.OK(cut, pageList);
}
@@ -77,8 +77,8 @@ public class ParamsInfoEO implements Serializable {
private String paramsName;
/**技术领域*/
@Excel(name = "*技术领域", width = 15, dicCode = "technology_territory")
@Dict(dicCode = "technology_territory")
@Excel(name = "*技术领域", width = 15)
// @Dict(dicCode = "technology_territory")
@ApiModelProperty(value = "技术领域")
private String technologyTerritory;
@@ -1,6 +1,7 @@
package com.jero.modules.cert.template.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jero.modules.cert.template.vo.ParamsInfoEnExport;
import com.jero.modules.cert.template.vo.ParamsInfoVO;
import com.jero.modules.cert.template.entity.ParamsInfoEO;
import org.apache.ibatis.annotations.Param;
@@ -16,4 +17,6 @@ import java.util.List;
public interface ParamsInfoEOMapper extends BaseMapper<ParamsInfoEO> {
List<ParamsInfoEO> selectListWithCert(@Param("paramsInfoVO") ParamsInfoVO paramsInfoVO);
List<ParamsInfoEnExport> selectListWithCertForEnExport(@Param("paramsInfoVO") ParamsInfoVO paramsInfoVO);
}
@@ -54,6 +54,37 @@
</collection>
</resultMap>
<resultMap id="ParamsInfoEOResultMapWithCertForEnExport" type="com.jero.modules.cert.template.vo.ParamsInfoEnExport">
<id column="id" property="id" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="sys_org_code" property="sysOrgCode" />
<result column="nio_number" property="nioNumber" />
<result column="is_must" property="isMust" />
<result column="params_name" property="paramsName" />
<result column="technology_territory" property="technologyTerritory" />
<result column="params_batch" property="paramsBatch" />
<result column="duty_territory" property="dutyTerritory" />
<result column="description" property="description" />
<result column="cert_category" property="certCategory" />
<result column="control_type" property="controlType" />
<result column="control_values" property="controlValues" />
<result column="control_verify" property="controlVerify" />
<result column="file_template_connect_id" property="fileTemplateConnectId" />
<result column="params_template_id" property="paramsTemplateId" />
<collection property="certCategoryParamsInfoEnExportList" javaType="java.util.List" ofType="com.jero.modules.cert.template.vo.CertCategoryParamsInfoEnExport">
<id column="ccpi_id" property="id" />
<result column="ccpi_params_number" property="paramsNumber" />
<result column="ccpi_params_name" property="paramsName" />
<result column="ccpi_description" property="description" />
<result column="ccpi_nio_number" property="nioNumber" />
<result column="ccpi_cert_category" property="certCategory" />
<result column="ccpi_params_template_id" property="paramsTemplateId" />
</collection>
</resultMap>
<sql id="BaseColumnList">
pi.id as id,
pi.create_by as create_by,
@@ -112,4 +143,14 @@
<include refid="BaseQuerySql"/>
</select>
<select id="selectListWithCertForEnExport" resultMap="ParamsInfoEOResultMapWithCertForEnExport" parameterType="com.jero.modules.cert.template.vo.ParamsInfoVO">
select tmp_tb.* from(
select
<include refid="BaseColumnList"/>
from params_info pi
left join cert_category_params_info ccpi on pi.nio_number = ccpi.nio_number
) tmp_tb
<include refid="BaseQuerySql"/>
</select>
</mapper>
@@ -1,8 +1,8 @@
package com.jero.modules.cert.template.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.cert.template.vo.ParamsInfoVO;
import com.jero.modules.cert.template.entity.ParamsInfoEO;
import com.jero.modules.cert.template.vo.ParamsInfoVO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -81,4 +81,6 @@ public interface IParamsInfoEOService extends IService<ParamsInfoEO> {
* @param request
*/
void exportParamsInfo(String cut, ParamsInfoVO paramsInfoVO, String exportExcelName, HttpServletResponse response, HttpServletRequest request);
void getTreeDictItemText(List<ParamsInfoEO> paramsInfoEOList, String cut);
}
@@ -20,8 +20,10 @@ import com.jero.modules.cert.template.vo.ParamsInfoVO;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.split.common.ReadExcel;
import com.jero.modules.system.entity.SysCategory;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.service.ISysDictItemService;
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.jeecgframework.poi.excel.ExcelExportUtil;
@@ -59,6 +61,9 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
@Autowired
private ISysDictItemService sysDictItemService;
@Autowired
private SysCategoryServiceImpl sysCategoryService;
@Value(value = "${jero.path.upload}")
private String uploadpath;
@@ -323,92 +328,21 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
nowFile.mkdirs();
String fileName = exportName + ".xlsx";
if (CutEnum.CN.getValue().equals(cut)) {
// 查询导出数据
List<ParamsInfoEO> paramsInfoEOList = baseMapper.selectListWithCert(paramsInfoVO); // 中文数据导出
getTreeDictItemText(paramsInfoEOList, cut);
List<Map<String, Object>> sheetsList = new ArrayList<>();
sheetsList = getCnExportSheetsList(paramsInfoEOList, fileNowPath);
workbook = ExcelExportUtil.exportExcel(sheetsList, ExcelType.XSSF);
// 查询导出数据
List<ParamsInfoEO> paramsInfoEOList = baseMapper.selectListWithCert(paramsInfoVO);
if (CollectionUtil.isEmpty(paramsInfoEOList)) {
throw new JeroBootException("没有可导出的数据");
}
List<OSSFile> fileTemplateList = new ArrayList<>();
for (ParamsInfoEO paramsInfoEO : paramsInfoEOList) {
String fileTemplateConnectId = paramsInfoEO.getFileTemplateConnectId();
if (StringUtils.isNotBlank(fileTemplateConnectId)) {
List<OSSFile> ossFileList = ossFileService.getFileInfosByConnectId(fileTemplateConnectId);
List<String> fileNameList = ossFileList.stream().map(OSSFile::getFileName).collect(Collectors.toList());
paramsInfoEO.setFileTemplateName(StringUtils.join(fileNameList, ","));
fileTemplateList.addAll(ossFileList);
}
}
// 查询导出参数项中认证类别最大级
List<String> nioNumber = paramsInfoEOList.stream().map(ParamsInfoEO::getNioNumber).collect(Collectors.toList());
List<CertCategoryParamsInfoEO> certCategoryParamsInfoEOList = certCategoryParamsInfoEOService.selectListByNioNumber(StringUtils.join(nioNumber, ","));
List<String> certCategoryNameList = new ArrayList<>();
Map<String, String> certCategoryMap = new HashMap<>();
if (CollectionUtil.isNotEmpty(certCategoryParamsInfoEOList)) {
List<String> certCategoryList = certCategoryParamsInfoEOList.stream().map(CertCategoryParamsInfoEO::getCertCategory).distinct().collect(Collectors.toList());
List<SysDictItem> sysDictItemList = sysDictItemService.selectItemsByDictCode("cert_category");
List<String> finalCertCategoryList = certCategoryList;
certCategoryNameList = sysDictItemList.stream().filter(e-> finalCertCategoryList.contains(e.getItemValue())).map(SysDictItem::getItemText).collect(Collectors.toList());
certCategoryMap = sysDictItemList.stream().filter(e-> finalCertCategoryList.contains(e.getItemValue())).collect(Collectors.toMap(c->c.getItemText(),c->c.getItemValue()));
}
//导出数据
List<Map<String, Object>> sheetsList = new ArrayList<>();
// 创建参数对象(用来设定excel得sheet得内容等信息)
ExportParams bussExportParams = new ExportParams();
// 设置sheet得名称
bussExportParams.setSheetName("企业参数表");
bussExportParams.setType(ExcelType.XSSF); // 解决HSSFRichTextString cannot cast XSSFRichTextString问题
bussExportParams.setStyle(CommonExcelExportStyler.class);
// 创建sheet1使用得map
Map<String, Object> bussExportMap = new HashMap<>();
// title的参数为ExportParams类型,目前仅仅在ExportParams中设置了sheetName
bussExportMap.put("title", bussExportParams);
// 模版导出对应得实体类型
bussExportMap.put("entity", ParamsInfoEO.class);
// sheet中要填充得数据
bussExportMap.put("data", paramsInfoEOList);
sheetsList.add(bussExportMap);
// 导出认证类别参数项
if (CollectionUtil.isNotEmpty(certCategoryNameList)) {
// 所有数据
List<CertCategoryParamsInfoEO> certCategoryParamsInfoListExport = new ArrayList<>();
for (ParamsInfoEO paramsInfoEO : paramsInfoEOList) {
List<CertCategoryParamsInfoEO> categoryParamsInfoEOList = paramsInfoEO.getCertCategoryParamsInfoEOList();
certCategoryParamsInfoListExport.addAll(categoryParamsInfoEOList);
}
if (CollectionUtil.isNotEmpty(certCategoryParamsInfoListExport)) {
for (String certCategoryName : certCategoryNameList) {
// 当前认证类别数据
Map<String, String> finalCertCategoryMap = certCategoryMap;
List<CertCategoryParamsInfoEO> certCategoryParamsInfoExport = certCategoryParamsInfoListExport.stream()
.filter(e -> finalCertCategoryMap.get(certCategoryName).equals(e.getCertCategory()))
.collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(certCategoryParamsInfoExport)) {
ExportParams certExportParams = new ExportParams();
certExportParams.setSheetName(certCategoryName);
certExportParams.setType(ExcelType.XSSF); // 解决HSSFRichTextString cannot cast XSSFRichTextString问题
certExportParams.setStyle(CommonExcelExportStyler.class);
Map<String, Object> certExportMap = new HashMap<>();
certExportMap.put("title", certExportParams);
certExportMap.put("entity", CertCategoryParamsInfoEO.class);
certExportMap.put("data", certCategoryParamsInfoExport);
sheetsList.add(certExportMap);
}
}
}
}
workbook = ExcelExportUtil.exportExcel(sheetsList, ExcelType.XSSF);
//下载附件模板对应文件
if (fileTemplateList != null && !fileTemplateList.isEmpty()) {
fileTemplateList = fileTemplateList.stream().distinct().collect(Collectors.toList());
downLoadFileList(fileTemplateList,fileNowPath);
} else if (CutEnum.EN.getValue().equals(cut)) {
// 查询导出数据
List<ParamsInfoEnExport> paramsInfoEnExportList = baseMapper.selectListWithCertForEnExport(paramsInfoVO); // 英文数据导出
getTreeDictItemTextForEnExport(paramsInfoEnExportList);
List<Map<String, Object>> sheetsList = new ArrayList<>();
sheetsList = getEnExportSheetsList(paramsInfoEnExportList, fileNowPath);
workbook = ExcelExportUtil.exportExcel(sheetsList, ExcelType.XSSF);
}
@@ -440,6 +374,180 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
}
}
private List<Map<String, Object>> getCnExportSheetsList(List<ParamsInfoEO> paramsInfoEOList, String fileNowPath) throws IOException {
if (CollectionUtil.isEmpty(paramsInfoEOList)) {
throw new JeroBootException("没有可导出的数据");
}
List<OSSFile> fileTemplateList = new ArrayList<>();
for (ParamsInfoEO paramsInfoEO : paramsInfoEOList) {
String fileTemplateConnectId = paramsInfoEO.getFileTemplateConnectId();
if (StringUtils.isNotBlank(fileTemplateConnectId)) {
List<OSSFile> ossFileList = ossFileService.getFileInfosByConnectId(fileTemplateConnectId);
List<String> fileNameList = ossFileList.stream().map(OSSFile::getFileName).collect(Collectors.toList());
paramsInfoEO.setFileTemplateName(StringUtils.join(fileNameList, ","));
fileTemplateList.addAll(ossFileList);
}
}
// 查询导出参数项中认证类别最大级
List<String> nioNumber = paramsInfoEOList.stream().map(ParamsInfoEO::getNioNumber).collect(Collectors.toList());
List<CertCategoryParamsInfoEO> certCategoryParamsInfoEOList = certCategoryParamsInfoEOService.selectListByNioNumber(StringUtils.join(nioNumber, ","));
List<String> certCategoryNameList = new ArrayList<>();
Map<String, String> certCategoryMap = new HashMap<>();
if (CollectionUtil.isNotEmpty(certCategoryParamsInfoEOList)) {
List<String> certCategoryList = certCategoryParamsInfoEOList.stream().map(CertCategoryParamsInfoEO::getCertCategory).distinct().collect(Collectors.toList());
List<SysDictItem> sysDictItemList = sysDictItemService.selectItemsByDictCode("cert_category");
List<String> finalCertCategoryList = certCategoryList;
certCategoryNameList = sysDictItemList.stream().filter(e-> finalCertCategoryList.contains(e.getItemValue())).map(SysDictItem::getItemText).collect(Collectors.toList());
certCategoryMap = sysDictItemList.stream().filter(e-> finalCertCategoryList.contains(e.getItemValue())).collect(Collectors.toMap(c->c.getItemText(),c->c.getItemValue()));
}
//导出数据
List<Map<String, Object>> sheetsList = new ArrayList<>();
// 创建参数对象(用来设定excel得sheet得内容等信息)
ExportParams bussExportParams = new ExportParams();
// 设置sheet得名称
bussExportParams.setSheetName("企业参数表");
bussExportParams.setType(ExcelType.XSSF); // 解决HSSFRichTextString cannot cast XSSFRichTextString问题
bussExportParams.setStyle(CommonExcelExportStyler.class);
// 创建sheet1使用得map
Map<String, Object> bussExportMap = new HashMap<>();
// title的参数为ExportParams类型,目前仅仅在ExportParams中设置了sheetName
bussExportMap.put("title", bussExportParams);
// 模版导出对应得实体类型
bussExportMap.put("entity", ParamsInfoEO.class);
// sheet中要填充得数据
bussExportMap.put("data", paramsInfoEOList);
sheetsList.add(bussExportMap);
// 导出认证类别参数项
if (CollectionUtil.isNotEmpty(certCategoryNameList)) {
// 所有数据
List<CertCategoryParamsInfoEO> certCategoryParamsInfoListExport = new ArrayList<>();
for (ParamsInfoEO paramsInfoEO : paramsInfoEOList) {
List<CertCategoryParamsInfoEO> categoryParamsInfoEOList = paramsInfoEO.getCertCategoryParamsInfoEOList();
certCategoryParamsInfoListExport.addAll(categoryParamsInfoEOList);
}
if (CollectionUtil.isNotEmpty(certCategoryParamsInfoListExport)) {
for (String certCategoryName : certCategoryNameList) {
// 当前认证类别数据
Map<String, String> finalCertCategoryMap = certCategoryMap;
List<CertCategoryParamsInfoEO> certCategoryParamsInfoExport = certCategoryParamsInfoListExport.stream()
.filter(e -> finalCertCategoryMap.get(certCategoryName).equals(e.getCertCategory()))
.collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(certCategoryParamsInfoExport)) {
ExportParams certExportParams = new ExportParams();
certExportParams.setSheetName(certCategoryName);
certExportParams.setType(ExcelType.XSSF); // 解决HSSFRichTextString cannot cast XSSFRichTextString问题
certExportParams.setStyle(CommonExcelExportStyler.class);
Map<String, Object> certExportMap = new HashMap<>();
certExportMap.put("title", certExportParams);
certExportMap.put("entity", CertCategoryParamsInfoEO.class);
certExportMap.put("data", certCategoryParamsInfoExport);
sheetsList.add(certExportMap);
}
}
}
}
//下载附件模板对应文件
if (fileTemplateList != null && !fileTemplateList.isEmpty()) {
fileTemplateList = fileTemplateList.stream().distinct().collect(Collectors.toList());
downLoadFileList(fileTemplateList,fileNowPath);
}
return sheetsList;
}
private List<Map<String, Object>> getEnExportSheetsList(List<ParamsInfoEnExport> paramsInfoEnExportList, String fileNowPath) throws IOException {
if (CollectionUtil.isEmpty(paramsInfoEnExportList)) {
throw new JeroBootException("没有可导出的数据");
}
List<OSSFile> fileTemplateList = new ArrayList<>();
for (ParamsInfoEnExport paramsInfoEnExport : paramsInfoEnExportList) {
String fileTemplateConnectId = paramsInfoEnExport.getFileTemplateConnectId();
if (StringUtils.isNotBlank(fileTemplateConnectId)) {
List<OSSFile> ossFileList = ossFileService.getFileInfosByConnectId(fileTemplateConnectId);
List<String> fileNameList = ossFileList.stream().map(OSSFile::getFileName).collect(Collectors.toList());
paramsInfoEnExport.setFileTemplateName(StringUtils.join(fileNameList, ","));
fileTemplateList.addAll(ossFileList);
}
}
// 查询导出参数项中认证类别最大级
List<String> nioNumber = paramsInfoEnExportList.stream().map(ParamsInfoEnExport::getNioNumber).collect(Collectors.toList());
List<CertCategoryParamsInfoEO> certCategoryParamsInfoEOList = certCategoryParamsInfoEOService.selectListByNioNumber(StringUtils.join(nioNumber, ","));
List<String> certCategoryNameList = new ArrayList<>();
Map<String, String> certCategoryMap = new HashMap<>();
if (CollectionUtil.isNotEmpty(certCategoryParamsInfoEOList)) {
List<String> certCategoryList = certCategoryParamsInfoEOList.stream().map(CertCategoryParamsInfoEO::getCertCategory).distinct().collect(Collectors.toList());
List<SysDictItem> sysDictItemList = sysDictItemService.selectItemsByDictCode("cert_category");
List<String> finalCertCategoryList = certCategoryList;
certCategoryNameList = sysDictItemList.stream().filter(e-> finalCertCategoryList.contains(e.getItemValue())).map(SysDictItem::getItemText).collect(Collectors.toList());
certCategoryMap = sysDictItemList.stream().filter(e-> finalCertCategoryList.contains(e.getItemValue())).collect(Collectors.toMap(c->c.getItemText(),c->c.getItemValue()));
}
//导出数据
List<Map<String, Object>> sheetsList = new ArrayList<>();
// 创建参数对象(用来设定excel得sheet得内容等信息)
ExportParams bussExportParams = new ExportParams();
// 设置sheet得名称
bussExportParams.setSheetName("企业参数表");
bussExportParams.setType(ExcelType.XSSF); // 解决HSSFRichTextString cannot cast XSSFRichTextString问题
bussExportParams.setStyle(CommonExcelExportStyler.class);
// 创建sheet1使用得map
Map<String, Object> bussExportMap = new HashMap<>();
// title的参数为ExportParams类型,目前仅仅在ExportParams中设置了sheetName
bussExportMap.put("title", bussExportParams);
// 模版导出对应得实体类型
bussExportMap.put("entity", ParamsInfoEnExport.class);
// sheet中要填充得数据
bussExportMap.put("data", paramsInfoEnExportList);
sheetsList.add(bussExportMap);
// 导出认证类别参数项
if (CollectionUtil.isNotEmpty(certCategoryNameList)) {
// 所有数据
List<CertCategoryParamsInfoEnExport> certCategoryParamsInfoListExport = new ArrayList<>();
for (ParamsInfoEnExport paramsInfoEnExport : paramsInfoEnExportList) {
List<CertCategoryParamsInfoEnExport> certCategoryParamsInfoEnExports = paramsInfoEnExport.getCertCategoryParamsInfoEnExportList();
certCategoryParamsInfoListExport.addAll(certCategoryParamsInfoEnExports);
}
if (CollectionUtil.isNotEmpty(certCategoryParamsInfoListExport)) {
for (String certCategoryName : certCategoryNameList) {
// 当前认证类别数据
Map<String, String> finalCertCategoryMap = certCategoryMap;
List<CertCategoryParamsInfoEnExport> certCategoryParamsInfoExport = certCategoryParamsInfoListExport.stream()
.filter(e -> finalCertCategoryMap.get(certCategoryName).equals(e.getCertCategory()))
.collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(certCategoryParamsInfoExport)) {
ExportParams certExportParams = new ExportParams();
certExportParams.setSheetName(certCategoryName);
certExportParams.setType(ExcelType.XSSF); // 解决HSSFRichTextString cannot cast XSSFRichTextString问题
certExportParams.setStyle(CommonExcelExportStyler.class);
Map<String, Object> certExportMap = new HashMap<>();
certExportMap.put("title", certExportParams);
certExportMap.put("entity", CertCategoryParamsInfoEnExport.class);
certExportMap.put("data", certCategoryParamsInfoExport);
sheetsList.add(certExportMap);
}
}
}
}
//下载附件模板对应文件
if (fileTemplateList != null && !fileTemplateList.isEmpty()) {
fileTemplateList = fileTemplateList.stream().distinct().collect(Collectors.toList());
downLoadFileList(fileTemplateList,fileNowPath);
}
return sheetsList;
}
private void downLoadFileList(List<OSSFile> fileTemplateList,String fileNowPath) throws IOException {
for(OSSFile fileExportDto : fileTemplateList){
String oldPath = fileExportDto.getUrl();
@@ -449,7 +557,6 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
copyFile(oldPath, newPath);
}
}
}
private void copyFile(String srcPath, String destPath) throws IOException {
@@ -474,4 +581,44 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
bis.close(); // 先开后关
}
/**
* 树形字典处理中文
*
* @param paramsInfoEOList 列表数据
* @param cut 需切换的语言类别
*/
public void getTreeDictItemText(List<ParamsInfoEO> paramsInfoEOList, String cut) {
//树形数据字典
List<SysCategory> categoryList = sysCategoryService.list();
for (ParamsInfoEO paramsInfoEO : paramsInfoEOList){
String value = paramsInfoEO.getTechnologyTerritory();
if (StringUtils.isNotBlank(value)) {
List<String> idList = Arrays.asList(value.split(","));
List<SysCategory> sysCategoryList = categoryList.stream().filter(e -> idList.contains(e.getId())).collect(Collectors.toList());
if (CutEnum.CN.getValue().equals(cut)) {
List<String> nameList = sysCategoryList.stream().map(SysCategory::getName).collect(Collectors.toList());
paramsInfoEO.setTechnologyTerritory(StringUtils.join(nameList, ","));
} else {
List<String> nameEnList = sysCategoryList.stream().map(SysCategory::getEnName).collect(Collectors.toList());
paramsInfoEO.setTechnologyTerritory(StringUtils.join(nameEnList, ","));
}
}
}
}
public void getTreeDictItemTextForEnExport(List<ParamsInfoEnExport> paramsInfoEnExportList) {
//树形数据字典
List<SysCategory> categoryList = sysCategoryService.list();
for (ParamsInfoEnExport paramsInfoEnExport : paramsInfoEnExportList){
String value = paramsInfoEnExport.getTechnologyTerritory();
if (StringUtils.isNotBlank(value)) {
List<String> idList = Arrays.asList(value.split(","));
List<SysCategory> sysCategoryList = categoryList.stream().filter(e -> idList.contains(e.getId())).collect(Collectors.toList());
List<String> nameEnList = sysCategoryList.stream().map(SysCategory::getEnName).collect(Collectors.toList());
paramsInfoEnExport.setTechnologyTerritory(StringUtils.join(nameEnList, ","));
}
}
}
}
@@ -8,6 +8,8 @@ import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.List;
/**
* @Author: liyawei
* @Description:
@@ -59,19 +61,19 @@ public class ParamsInfoEnExport {
private String paramsName;
/**技术领域*/
@Excel(name = "*technology territory", width = 15, dicCode = "technology_territory")
@Dict(dicCode = "technology_territory")
@Excel(name = "*technology territory", width = 15)
// @Dict(dicCode = "technology_territory")
@ApiModelProperty(value = "技术领域")
private String technologyTerritory;
/**参数批次*/
@Excel(name = "*params batch", width = 15, dicCode = "params_batch")
@Excel(name = "*params batch", width = 15, dicCode = "params_batch_en")
@Dict(dicCode = "params_batch")
@ApiModelProperty(value = "参数批次")
private String paramsBatch;
/**责任领域*/
@Excel(name = "*duty territory", width = 15, dicCode = "duty_territory")
@Excel(name = "*duty territory", width = 15, dicCode = "duty_territory_en")
@Dict(dicCode = "duty_territory")
@ApiModelProperty(value = "责任领域")
private String dutyTerritory;
@@ -82,7 +84,7 @@ public class ParamsInfoEnExport {
private String description;
/**认证类别*/
@Excel(name = "cert category", width = 15, dicCode = "cert_category")
@Excel(name = "cert category", width = 15, dicCode = "cert_category_en")
@Dict(dicCode = "cert_category")
@ApiModelProperty(value = "认证类别")
private String certCategory;
@@ -110,4 +112,12 @@ public class ParamsInfoEnExport {
@TableField(exist = false)
private String fileTemplateName; //附件模板文件名
/**参数模板id*/
@ApiModelProperty(value = "参数模板id")
private String paramsTemplateId;
@TableField(exist = false)
private List<CertCategoryParamsInfoEnExport> certCategoryParamsInfoEnExportList; // 认证类别参数列表
}
@@ -4,7 +4,7 @@
<!-- 通过字典code获取字典数据 -->
<select id="queryDictItemsByCode" parameterType="String" resultType="com.jero.common.system.vo.DictModel">
select s.item_value as "value",s.item_text as "text" from sys_dict_item s
select s.item_value as "value",s.item_text as "text", s.en_name as "textEn" from sys_dict_item s
where dict_id = (select id from sys_dict where dict_code = #{code}) and del_flag = '0'
order by s.sort_order asc
</select>
@@ -546,6 +546,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
}
String value = stringBuilder.substring(0, stringBuilder.lastIndexOf(","));
entry.setValue(value);
} else {
entry.setValue(null);
}
}
// 标准选择