feat: 年段制修订主动上报导入

This commit is contained in:
2023-10-20 11:40:40 +08:00
parent 6b65a6a492
commit ed67c445d1
6 changed files with 324 additions and 171 deletions
@@ -18,10 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.jero.common.system.base.controller.JeroController.*;
@@ -43,19 +40,19 @@ public class ESAnnualInitController {
* 导入模板下载
*/
@GetMapping("/templateDownload")
@ApiOperation(value = "企标年度制修订标准化发起流程-导入模板下载", notes = "企标年度制修订标准化发起流程-导入模板下载",
@ApiOperation(value = "企标年度制修订标准化发起流程-模板下载", notes = "企标年度制修订标准化发起流程-模板下载",
produces = "application/octet-stream")
@AutoLog(value = "企标年度制修订标准化发起流程-导入模板下载")
@AutoLog(value = "企标年度制修订标准化发起流程-模板下载")
public ModelAndView templateDownload() {
// AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
String title = "标准化发起导入模板";
mv.addObject(FILE_NAME, title);
mv.addObject(CLASS, ProcessEsAnnualInit.class);
ExportParams exportParams=new ExportParams(title, title);
ExportParams exportParams = new ExportParams(title, title);
// 导出xlsx
exportParams.setType(ExcelType.XSSF);
mv.addObject(PARAMS,exportParams);
mv.addObject(PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, new ArrayList<T>());
return mv;
}
@@ -72,7 +69,7 @@ public class ESAnnualInitController {
public Result<?> importExcel(@ApiParam(value = "要上传的文件", required = true) @RequestParam("file") MultipartFile file) {
Map<String, Object> resultMap = annualInitService.importData(file);
Object flag = resultMap.get("flag");
if (flag == YesOrNoEnum.YES.getValue()) {
if (flag == YesOrNoEnum.YES.getValue()) {
return Result.OK(resultMap.get("dataList"));
} else {
return Result.error("导入失败", resultMap.get("msg"));
@@ -1,145 +0,0 @@
package com.jero.modules.activiti.process.esAnnualInit.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 企标-年度制修订计划-标准化发起
* @TableName process_es_annual_init
*/
@Data
@Accessors(chain = true)
public class EsAnnualInitImportDTO implements Serializable {
/**
* 制修订类型
*/
@Excel(name = "制修订类型", width = 15, orderNum = "1")
@ApiModelProperty(value = "制修订类型")
private String projectType;
/**
* 原企标编号
*/
@Excel(name = "原企标编号", width = 15, orderNum = "2")
@ApiModelProperty(value = "原企标编号")
private String originEnStandardNo;
/**
* 新企标编号
*/
@Excel(name = "新企标编号", width = 15, orderNum = "3")
@ApiModelProperty(value = "新企标编号")
private String newEnStandardNo;
/**
* 原企标名称
*/
@Excel(name = "原企标名称", width = 15, orderNum = "4")
@ApiModelProperty(value = "原企标名称")
private String originEnStandardName;
/**
* 新企标名称
*/
@Excel(name = "新企标名称", width = 15, orderNum = "5")
@ApiModelProperty(value = "新企标名称")
private String newEnStandardName;
/**
* 授权部门
*/
@Excel(name = "授权部门", width = 15, orderNum = "6")
@ApiModelProperty(value = "授权部门")
private String authDept;
/**
* 企业标准代号
*/
@Excel(name = "企业标准代号", width = 15, orderNum = "7")
@ApiModelProperty(value = "企业标准代号")
private String enStandardCode;
/**
* 配合单位
*/
@Excel(name = "配合单位", width = 15, orderNum = "8")
@ApiModelProperty(value = "配合单位")
private String cooperationUnit;
/**
* 主起草人
*/
@Excel(name = "主起草人", width = 15, orderNum = "9")
@ApiModelProperty(value = "主起草人")
private String mainDraftingUser;
/**
* 主起草单位
*/
@Excel(name = "主起草单位", width = 15, orderNum = "10")
@ApiModelProperty(value = "主起草单位")
private String mainDraftingUnit;
/**
* 主起草单位责任人
*/
@Excel(name = "主起草单位责任人", width = 20, orderNum = "11")
@ApiModelProperty(value = "主起草单位责任人")
private String mainDraftingUnitResponsiblePerson;
@Excel(name = "标准推进人", width = 15, orderNum = "12")
@ApiModelProperty(value = "标准推进人")
private String standardPromoter;
/**
* 草稿计划完成日期
*/
@Excel(name = "草稿计划完成日期", width = 20, orderNum = "13")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "草稿计划完成日期")
private Date draftPlannedCompleteDate;
/**
* 征求意见稿计划完成日期
*/
@Excel(name = "征求意见稿计划完成日期", width = 24, orderNum = "14")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "征求意见稿计划完成日期")
private Date solicitationDraftPlanCompleteDate;
/**
* 计划报批日期
*/
@Excel(name = "计划报批日期", width = 15, orderNum = "15")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "计划报批日期")
private Date planApprovalDate;
/**
* 变更状态
*/
@Excel(name = "变更状态", width = 15, orderNum = "16")
@ApiModelProperty(value = "变更状态")
private String changeStatus;
/**
* 联络人
*/
@Excel(name = "联络人", width = 15, orderNum = "17")
@ApiModelProperty(value = "联络人")
private String contactUser;
@ApiModelProperty(value = "序号")
private String sort;
}
@@ -1,21 +1,27 @@
package com.jero.modules.activiti.process.esAnnualReport.controller;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.aspect.annotation.Translation;
import com.jero.common.constant.enums.YesOrNoEnum;
import com.jero.modules.activiti.process.esAnnualReport.entity.ProcessEsAnnualReport;
import com.jero.modules.activiti.process.esAnnualReport.service.ProcessEsAnnualReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Map;
import static com.jero.common.system.base.controller.JeroController.*;
@@ -29,6 +35,9 @@ import static com.jero.common.system.base.controller.JeroController.*;
@RequestMapping("/process/es/annualReport")
public class ESAnnualReportController {
@Resource
private ProcessEsAnnualReportService annualReportService;
/**
* 导入模板下载
*/
@@ -42,12 +51,31 @@ public class ESAnnualReportController {
String title = "各部门主动上报导入模板";
mv.addObject(FILE_NAME, title);
mv.addObject(CLASS, ProcessEsAnnualReport.class);
ExportParams exportParams=new ExportParams(title, title);
ExportParams exportParams = new ExportParams(title, title);
// 导出xlsx
exportParams.setType(ExcelType.XSSF);
mv.addObject(PARAMS,exportParams);
mv.addObject(PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, new ArrayList<T>());
return mv;
}
/**
* 通过excel导入数据
*
* @return
*/
@PostMapping("/importExcel")
@ApiOperation(value = "企标年度制修订主动上报流程-导入", notes = "企标年度制修订主动上报流程-导入")
@AutoLog(value = "企标年度制修订主动上报流程-导入")
@Translation
public Result<?> importExcel(@ApiParam(value = "要上传的文件", required = true) @RequestParam("file") MultipartFile file) {
Map<String, Object> resultMap = annualReportService.importData(file);
Object flag = resultMap.get("flag");
if (flag == YesOrNoEnum.YES.getValue()) {
return Result.OK(resultMap.get("dataList"));
} else {
return Result.error("导入失败", resultMap.get("msg"));
}
}
}
@@ -8,7 +8,6 @@ import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -109,7 +108,6 @@ public class ProcessEsAnnualReport implements Serializable {
/**
* 新企标编号
*/
@Excel(name = "新企标编号", width = 15, orderNum = "3")
@ApiModelProperty(value = "新企标编号")
private String newEnStandardNo;
@@ -142,7 +140,7 @@ public class ProcessEsAnnualReport implements Serializable {
/**
* 企业标准代号
*/
@Excel(name = "企业标准代号", width = 15, orderNum = "7", dicCode = "enterprise_standard_code")
@Excel(name = "企业标准代号", width = 15, orderNum = "7")
@Dict(dicCode = "enterprise_standard_code")
@ApiModelProperty(value = "企业标准代号")
private String enStandardCode;
@@ -231,14 +229,14 @@ public class ProcessEsAnnualReport implements Serializable {
/**
* 主起草单位
*/
@Excel(name = "主起草单位", width = 15, orderNum = "9", dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
@Excel(name = "主起草单位", width = 15, orderNum = "9")
@ApiModelProperty(value = "主起草单位")
private String mainDraftingUnit;
/**
* 主起草单位责任人
*/
@Excel(name = "主起草单位责任人", width = 20, orderNum = "10", dictTable = "sys_user", dicCode = "id", dicText = "username")
@Excel(name = "主起草单位责任人", width = 20, orderNum = "10")
@Dict(dicCode = "id", dictTable = "sys_user", dicText = "username")
@ApiModelProperty(value = "主起草单位责任人")
private String mainDraftingUnitResponsiblePerson;
@@ -246,7 +244,7 @@ public class ProcessEsAnnualReport implements Serializable {
/**
* 标准推进人
*/
@Excel(name = "标准推进人", width = 15, orderNum = "12", dicCode = "id", dictTable = "sys_user", dicText = "username")
@Excel(name = "标准推进人", width = 15, orderNum = "12")
@Dict(dicCode = "id", dictTable = "sys_user", dicText = "username")
@ApiModelProperty(value = "标准推进人")
private String standardPromoter;
@@ -284,7 +282,6 @@ public class ProcessEsAnnualReport implements Serializable {
/**
* 变更状态
*/
@Excel(name = "变更状态", width = 15, orderNum = "16")
@Dict(dicCode = "esp_change_status")
@ApiModelProperty(value = "变更状态")
private String changeStatus;
@@ -304,7 +301,7 @@ public class ProcessEsAnnualReport implements Serializable {
/**
* 授权部门
*/
@Excel(name = "授权部门", width = 15, orderNum = "6", dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
@Excel(name = "授权部门", width = 15, orderNum = "6")
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
@ApiModelProperty(value = "授权部门")
private String authDept;
@@ -312,7 +309,7 @@ public class ProcessEsAnnualReport implements Serializable {
/**
* 配合单位
*/
@Excel(name = "配合单位", width = 15, orderNum = "8", dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
@Excel(name = "配合单位", width = 15, orderNum = "8")
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
@ApiModelProperty(value = "配合单位")
private String cooperationUnit;
@@ -320,11 +317,15 @@ public class ProcessEsAnnualReport implements Serializable {
/**
* 隶属工作组
*/
@Excel(name = "隶属工作组", width = 15, orderNum = "11", dictTable = "laws_working_group", dicCode = "id", dicText = "name")
@Excel(name = "隶属工作组", width = 15, orderNum = "11")
@Dict(dictTable = "laws_working_group", dicCode = "id", dicText = "name")
@ApiModelProperty(value = "隶属工作组")
private String workGroup;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@TableField(exist = false)
private String sort;
}
@@ -2,6 +2,9 @@ package com.jero.modules.activiti.process.esAnnualReport.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.activiti.process.esAnnualReport.entity.ProcessEsAnnualReport;
import org.springframework.web.multipart.MultipartFile;
import java.util.Map;
/**
* @author ThinkBook
@@ -10,4 +13,5 @@ import com.jero.modules.activiti.process.esAnnualReport.entity.ProcessEsAnnualRe
*/
public interface ProcessEsAnnualReportService extends IService<ProcessEsAnnualReport> {
Map<String, Object> importData(MultipartFile file);
}
@@ -1,13 +1,28 @@
package com.jero.modules.activiti.process.esAnnualReport.service.impl;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.api.CommonAPI;
import com.jero.common.constant.enums.YesOrNoEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.SysDictItemCore;
import com.jero.modules.activiti.process.esAnnualReport.entity.ProcessEsAnnualReport;
import com.jero.modules.activiti.process.esAnnualReport.mapper.ProcessEsAnnualReportMapper;
import com.jero.modules.activiti.process.esAnnualReport.service.ProcessEsAnnualReportService;
import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPProjectType;
import com.jero.modules.activiti.util.ExcelUtils;
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ThinkBook
@@ -17,8 +32,261 @@ import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional(rollbackFor = JeroBootException.class)
public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnualReportMapper, ProcessEsAnnualReport>
implements IService<ProcessEsAnnualReport> {
implements ProcessEsAnnualReportService {
@Resource
private CommonAPI commonAPI;
@Resource
private ExcelUtils excelUtils;
@Resource
private ILawsEnterpriseStandardService enterpriseStandardService;
@Override
public Map<String, Object> importData(MultipartFile file) {
List<SysDictItemCore> listDict = commonAPI.getDictItemAll();
Map<String, Object> resultMap = new HashMap<>();
List<String> errorMsgs = new ArrayList<>();
// 获取Excel的header
List<String> headers;
try {
headers = ExcelUtils.getHeaderFromExcel(file.getInputStream());
} catch (Exception e) {
errorMsgs.add("上传模板错误,请检查后重试。");
resultMap.put("msg", errorMsgs);
resultMap.put("flag", YesOrNoEnum.NO.getValue());
log.error(e.getMessage(), e);
return resultMap; // 返回错误信息
}
// 使用静态方法验证header
boolean isMatched = headers.equals(ExcelUtils.getSortedHeadersFromClass(ProcessEsAnnualReport.class));
if (!isMatched) {
errorMsgs.add("上传模板错误,请检查后重试。");
resultMap.put("msg", errorMsgs);
resultMap.put("flag", YesOrNoEnum.NO.getValue());
return resultMap; // 返回错误信息
}
ImportParams params = new ImportParams();
params.setTitleRows(1);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<ProcessEsAnnualReport> list = ExcelImportUtil.importExcel(file.getInputStream(), ProcessEsAnnualReport.class, params);
if (list.isEmpty()) {
errorMsgs.add("文件暂无数据,请检查后重试。");
resultMap.put("msg", errorMsgs);
resultMap.put("flag", YesOrNoEnum.NO.getValue());
return resultMap; // 返回错误信息
}
// 批量检查数据是否有效
errorMsgs = this.validationList(list, listDict);
if (errorMsgs.size() > 0) {
resultMap.put("msg", errorMsgs);
resultMap.put("flag", YesOrNoEnum.NO.getValue());
} else {
resultMap.put("flag", YesOrNoEnum.YES.getValue());
// 转换为字典值
this.transToDictValue(list, listDict);
// 清洗
this.cleanData(list);
resultMap.put("dataList", list);
}
} catch (Exception e) {
errorMsgs.add("文件导入异常:" + e.getMessage());
resultMap.put("msg", errorMsgs);
resultMap.put("flag", YesOrNoEnum.NO.getValue());
log.error(e.getMessage(), e);
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
return resultMap;
}
private void cleanData(List<ProcessEsAnnualReport> list) {
list.forEach(item-> {
// 如果是制定则去除掉所有的原企标名称 原企标编号
if (ESPProjectType.ENACT.getValue().equals(item.getProjectType())) {
item.setOriginEnStandardName(null);
item.setOriginEnStandardNo(null);
}
// 设置变更状态 制定是新增 修订是变更
if (item.getProjectType().equals("制定")) {
item.setChangeStatus("新增");
} else {
item.setChangeStatus("变更");
}
});
}
private void transToDictValue(List<ProcessEsAnnualReport> list, List<SysDictItemCore> listDict) {
list.forEach(item -> {
item.setProjectType(excelUtils.translateDictValue("esp_revision_type", item.getProjectType(), listDict));
item.setAuthDept(excelUtils.translateDictValue("depart_name", "id", "sys_depart", item.getAuthDept(), listDict));
item.setEnStandardCode(excelUtils.translateDictValue("enterprise_standard_code", item.getEnStandardCode(), listDict));
item.setCooperationUnit(excelUtils.translateDictValue("depart_name", "id", "sys_depart", item.getCooperationUnit(), listDict));
item.setMainDraftingUser(excelUtils.translateDictValue("username", "id", "sys_user", item.getMainDraftingUser(), listDict));
item.setMainDraftingUnit(excelUtils.translateDictValue("depart_name", "id", "sys_depart", item.getMainDraftingUnit(), listDict));
item.setMainDraftingUnitResponsiblePerson(excelUtils.translateDictValue("username", "id", "sys_user", item.getMainDraftingUnitResponsiblePerson(), listDict));
item.setStandardPromoter(excelUtils.translateDictValue("username", "id", "sys_user", item.getStandardPromoter(), listDict));
item.setWorkGroup(excelUtils.translateDictValue("name", "id", "laws_working_group", item.getWorkGroup(), listDict));
});
}
private List<String> validationList(List<ProcessEsAnnualReport> list, List<SysDictItemCore> listDict) {
List<LawsEnterpriseStandard> esList = enterpriseStandardService.list();
List<String> errorMsgs = new ArrayList<>();
int i = 3;
Iterator<ProcessEsAnnualReport> iterator = list.iterator();
while (iterator.hasNext()) {
ProcessEsAnnualReport plan = iterator.next();
if (ExcelUtils.isEmptyRow(plan)) {
iterator.remove();
continue;
}
plan.setSort(String.valueOf(i++));
String enStandardCode = plan.getProjectType();
String authDept = plan.getProjectType();
String cooperationUnit = plan.getCooperationUnit();
String mainDraftingUnit = plan.getMainDraftingUnit();
String mainDraftingUser = plan.getProjectType();
String mainDraftingUnitResponsiblePerson = plan.getMainDraftingUnitResponsiblePerson();
String standardPromoter = plan.getStandardPromoter();
String workGroup = plan.getWorkGroup();
StringBuilder errMsgHeader = new StringBuilder();
StringBuilder errMsg = new StringBuilder();
errMsgHeader.append("").append(plan.getSort()).append("");
// 检查制修订类型 编号 名称
errMsg.append(validProjectType(plan, listDict, esList));
// 检查所有数据字典校验的字段
errMsg.append(validAuthDept(authDept, listDict));
errMsg.append(validStandardCode(enStandardCode, listDict));
errMsg.append(validCooperateUnit(cooperationUnit, listDict));
errMsg.append(validMainDraftingUser(mainDraftingUser, listDict));
errMsg.append(validMainDraftingUnit(mainDraftingUnit, listDict));
errMsg.append(validMainDraftingUnitResponsiblePerson(mainDraftingUnitResponsiblePerson, listDict));
errMsg.append(validStandardPromoter(standardPromoter, listDict));
errMsg.append(validWorkGroup(workGroup, listDict));
// 如果数据有问题,则将提示信息添加到 errorMsgs 中
if (errMsg.length() > 0) {
errorMsgs.add(errMsgHeader.append(errMsg).toString());
}
}
return errorMsgs;
}
private String validAuthDept(String value, List<SysDictItemCore> listDict) {
// 非空检查
if (StrUtil.isBlank(value)) {
return "'授权部门'不能为空。";
}
// 检查授权部门
if (!excelUtils.validDict("depart_name", value, "sys_depart", "id", false, listDict)) {
return "'授权部门'无效。";
}
return "";
}
private String validStandardCode(String value, List<SysDictItemCore> listDict) {
// 检查企业标准代号
if (!excelUtils.validDict("enterprise_standard_code", value, null, null, true, listDict)) {
return "'企业标准代号'无效。";
}
return "";
}
private String validCooperateUnit(String value, List<SysDictItemCore> listDict) { // 非空检查
if (StrUtil.isBlank(value)) {
return "'配合单位'不能为空。";
}
// 检查配合单位
if (!excelUtils.validDict("depart_name", value, "sys_depart", "id", false, listDict)) {
return "'配合单位'无效。";
}
return "";
}
private String validMainDraftingUser(String value, List<SysDictItemCore> listDict) {
if (StrUtil.isBlank(value)) {
return "'主起草人'不能为空。";
}
// 检查主起草人
if (!excelUtils.validDict("username", value, "sys_user", "id", true, listDict)) {
return "'主起草人'无效。";
}
return "";
}
private String validMainDraftingUnit(String value, List<SysDictItemCore> listDict) {
if (StrUtil.isBlank(value)) {
return "'主起草单位'不能为空。";
}
// 检查主起草单位
if (!excelUtils.validDict("depart_name", value, "sys_depart", "id", true, listDict)) {
return "'主起草单位'无效。";
}
return "";
}
private String validMainDraftingUnitResponsiblePerson(String value, List<SysDictItemCore> listDict) {
if (StrUtil.isBlank(value)) {
return "'主起草单位负责人'不能为空。";
}
// 检查主起草单位负责人
if (!excelUtils.validDict("username", value, "sys_user", "id", true, listDict)) {
return "'主起草单位负责人'无效。";
}
return "";
}
private String validStandardPromoter(String value, List<SysDictItemCore> listDict) {
if (StrUtil.isBlank(value)) {
return "'标准推进人'不能为空。";
}
// 检查标准推进人
if (!excelUtils.validDict("username", value, "sys_user", "id", true, listDict)) {
return "'标准推进人'无效。";
}
return "";
}
private String validWorkGroup(String value, List<SysDictItemCore> listDict) {
// 检查工作组
if (!excelUtils.validDict("name", value, "laws_working_group", "id", true, listDict)) {
return "'工作组'无效。";
}
return "";
}
private String validProjectType(ProcessEsAnnualReport plan, List<SysDictItemCore> listDict, List<LawsEnterpriseStandard> esList) {
String projectType = plan.getProjectType();
String originEnStandardNo = plan.getProjectType();
String newEnStandardName = plan.getNewEnStandardName();
if (StrUtil.isBlank(projectType)) {
return "'制修订类型'不能为空。";
}
if (!excelUtils.validDict("esp_revision_type", projectType, null, null, true, listDict)) {
return "'制修订类型'无效。";
}
// 修订
if (projectType.equals(ESPProjectType.MODIFY.getValue())) {
// 检查企标编号是否有效
if (StrUtil.isBlank(originEnStandardNo)) {
return "'原企标编号'不能为空。";
}
if (!esList.stream().map(LawsEnterpriseStandard::getStandardNumber).collect(Collectors.toList()).contains(originEnStandardNo)) {
return "'原企标编号'无效。";
}
}
if (newEnStandardName.length() > 50) {
return "'新企标名称'过长(最多50字)。";
}
return "";
}
}