法规清单导出压缩包中excel文件名称修改
参数导出模板管理列表添加使用地区字段
This commit is contained in:
+44
-2
@@ -5,11 +5,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.vo.DictModel;
|
||||
import com.jero.modules.cert.report.entity.ParamsExportTemplateEO;
|
||||
import com.jero.modules.cert.report.enums.ExportTemplateStateEnum;
|
||||
import com.jero.modules.cert.report.service.IParamsExportTemplateEOService;
|
||||
import com.jero.modules.ocr.util.LineHumpUtil;
|
||||
import com.jero.modules.system.enums.DicCodeEnum;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -22,9 +26,11 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -40,7 +46,9 @@ import java.util.Map;
|
||||
public class ParamsExportTemplateEOController extends JeroController<ParamsExportTemplateEO, IParamsExportTemplateEOService> {
|
||||
@Autowired
|
||||
private IParamsExportTemplateEOService paramsExportTemplateEOService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -76,13 +84,47 @@ public class ParamsExportTemplateEOController extends JeroController<ParamsExpor
|
||||
// 处理 状态 中英文
|
||||
List<ParamsExportTemplateEO> rows = pageList.getRecords();
|
||||
Map<String, String> stateMap = ExportTemplateStateEnum.toMap(cut);
|
||||
List<DictModel> regionList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode());
|
||||
rows.forEach(exportTemplateEO -> {
|
||||
exportTemplateEO.setState_dictText(stateMap.get(exportTemplateEO.getState()));
|
||||
//处理适用地区
|
||||
String region = getRegion(paramsExportTemplateEO, regionList, exportTemplateEO);
|
||||
if(StringUtils.isNotBlank(region)){
|
||||
exportTemplateEO.setRegion_dictText(region);
|
||||
}
|
||||
});
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
private String getRegion(ParamsExportTemplateEO paramsExportTemplateEO, List<DictModel> regionList, ParamsExportTemplateEO exportTemplateEO) {
|
||||
//适用地区
|
||||
List<DictModel> dictModelList = new ArrayList<>();
|
||||
String region = "";
|
||||
if(StringUtils.isNotBlank(exportTemplateEO.getRegion())){
|
||||
for (String s : exportTemplateEO.getRegion().split(",")) {
|
||||
List<DictModel> dictModelListTemp = regionList.stream()
|
||||
.filter(e -> s.equals(e.getValue())).collect(Collectors.toList());
|
||||
dictModelList.addAll(dictModelListTemp);
|
||||
}
|
||||
|
||||
if(dictModelList.size() != 0){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (DictModel dictModel : dictModelList) {
|
||||
if(CutEnum.CN.getValue().equals(paramsExportTemplateEO.getCut())){
|
||||
sb.append(dictModel.getText()+",");
|
||||
}else{
|
||||
sb.append(dictModel.getTextEn()+",");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(sb)){
|
||||
region = sb.substring(0,sb.length()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return region;
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
|
||||
+6
@@ -74,6 +74,12 @@ public class ParamsExportTemplateEO implements Serializable {
|
||||
@ApiModelProperty(value = "内容说明")
|
||||
private String description;
|
||||
|
||||
/**适用地区*/
|
||||
@ApiModelProperty(value = "适用地区")
|
||||
private String region;
|
||||
@TableField(exist = false)
|
||||
private String region_dictText;
|
||||
|
||||
/**附件上传*/
|
||||
@Excel(name = "附件上传", width = 15)
|
||||
@ApiModelProperty(value = "附件上传")
|
||||
|
||||
+4
@@ -468,4 +468,8 @@ public class ProjectLawsInventoryEO implements Serializable {
|
||||
@ApiModelProperty(value = "文档库id/标准id")
|
||||
private String standId;
|
||||
|
||||
@ApiModelProperty(value = "导出的excel的名称")
|
||||
@TableField(exist = false)
|
||||
private String excelName;
|
||||
|
||||
}
|
||||
|
||||
+7
-6
@@ -4450,12 +4450,13 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
fileTemp.mkdirs();
|
||||
//文件
|
||||
exportFile(dataList,fileInfos);
|
||||
String excelName = "";
|
||||
if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){
|
||||
excelName = "法规清单.xlsx";
|
||||
}else{
|
||||
excelName = "Regulation List.xlsx";
|
||||
}
|
||||
String excelName = projectLawsInventoryEO.getExcelName();
|
||||
// String excelName = "";
|
||||
// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){
|
||||
// excelName = "法规清单.xlsx";
|
||||
// }else{
|
||||
// excelName = "Regulation List.xlsx";
|
||||
// }
|
||||
//excel
|
||||
OutputStream excelOS = new FileOutputStream(path + File.separator + excelName);
|
||||
ExportParams exportParams = new ExportParams();
|
||||
|
||||
Reference in New Issue
Block a user