feat: 发起年度制修订主动上报 模板下载导入
This commit is contained in:
+56
-91
@@ -1,6 +1,7 @@
|
||||
package com.jero.modules.activiti.process.esAnnualInit.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.CommonAPI;
|
||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
@@ -51,7 +52,7 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
// 获取Excel的header
|
||||
List<String> headers;
|
||||
try {
|
||||
headers = ExcelUtils.getHeaderFromExcel(file.getInputStream());
|
||||
headers = ExcelUtils.getHeaderFromExcel(file.getInputStream(), 0);
|
||||
} catch (Exception e) {
|
||||
errorMsgs.add("上传模板错误,请检查后重试。");
|
||||
resultMap.put("msg", errorMsgs);
|
||||
@@ -111,14 +112,27 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
}
|
||||
|
||||
private void cleanData(List<ProcessEsAnnualInit> list) {
|
||||
List<String> originStandardNoList = list.stream().map(ProcessEsAnnualInit::getOriginEnStandardNo).collect(Collectors.toList());
|
||||
|
||||
LambdaQueryWrapper<LawsEnterpriseStandard> esWrapper = new LambdaQueryWrapper<>();
|
||||
esWrapper.in(LawsEnterpriseStandard::getStandardNumber, originStandardNoList);
|
||||
List<LawsEnterpriseStandard> esList = enterpriseStandardService.list(esWrapper);
|
||||
// 转换成key为企标编号的map
|
||||
Map<String, LawsEnterpriseStandard> esMap = esList.stream().collect(Collectors.toMap(LawsEnterpriseStandard::getStandardNumber, item -> item));
|
||||
|
||||
list.forEach(item-> {
|
||||
// 如果是制定则去除掉所有的原企标名称 原企标编号
|
||||
if (ESPProjectType.ENACT.getValue().equals(item.getProjectType())) {
|
||||
item.setOriginEnStandardName(null);
|
||||
item.setOriginEnStandardNo(null);
|
||||
// 设置变更状态 制定是新增 修订是变更
|
||||
item.setChangeStatus("1");
|
||||
} else {
|
||||
item.setChangeStatus("2");
|
||||
item.setOriginEnStandardNo(esMap.get(item.getOriginEnStandardNo()).getStandardName());
|
||||
item.setEnStandardCode(esMap.get(item.getOriginEnStandardNo()).getStandardCode());
|
||||
item.setEnNameCode(esMap.get(item.getOriginEnStandardNo()).getNameCode());
|
||||
item.setStandardCategoryCode(esMap.get(item.getOriginEnStandardNo()).getCategoryCode());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -141,7 +155,7 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
List<LawsEnterpriseStandard> esList = enterpriseStandardService.list();
|
||||
List<String> errorMsgs = new ArrayList<>();
|
||||
|
||||
int i = 3;
|
||||
int i = 4;
|
||||
Iterator<ProcessEsAnnualInit> iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ProcessEsAnnualInit plan = iterator.next();
|
||||
@@ -150,7 +164,6 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
continue;
|
||||
}
|
||||
plan.setSort(String.valueOf(i++));
|
||||
String enStandardCode = plan.getProjectType();
|
||||
String authDept = plan.getProjectType();
|
||||
String cooperationUnit = plan.getCooperationUnit();
|
||||
String mainDraftingUnit = plan.getMainDraftingUnit();
|
||||
@@ -158,6 +171,8 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
String mainDraftingUnitResponsiblePerson = plan.getMainDraftingUnitResponsiblePerson();
|
||||
String standardPromoter = plan.getStandardPromoter();
|
||||
String contactUser = plan.getContactUser();
|
||||
String standardType = plan.getStandardType();
|
||||
String enStandardClassification = plan.getEnStandardClassification();
|
||||
|
||||
StringBuilder errMsgHeader = new StringBuilder();
|
||||
StringBuilder errMsg = new StringBuilder();
|
||||
@@ -166,14 +181,15 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
// 检查制修订类型 编号 名称
|
||||
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(validContactUser(contactUser, listDict));
|
||||
errMsg.append(excelUtils.validAuthDept(authDept, listDict));
|
||||
errMsg.append(excelUtils.validCooperateUnit(cooperationUnit, listDict));
|
||||
errMsg.append(excelUtils.validMainDraftingUser(mainDraftingUser, listDict));
|
||||
errMsg.append(excelUtils.validMainDraftingUnit(mainDraftingUnit, listDict));
|
||||
errMsg.append(excelUtils.validMainDraftingUnitResponsiblePerson(mainDraftingUnitResponsiblePerson, listDict));
|
||||
errMsg.append(excelUtils.validStandardPromoter(standardPromoter, listDict));
|
||||
errMsg.append(excelUtils.validContactUser(contactUser, listDict));
|
||||
errMsg.append(excelUtils.validStandardType(standardType, listDict));
|
||||
errMsg.append(excelUtils.validStandardClassification(enStandardClassification, listDict));
|
||||
// 如果数据有问题,则将提示信息添加到 errorMsgs 中
|
||||
if (errMsg.length() > 0) {
|
||||
errorMsgs.add(errMsgHeader.append(errMsg).toString());
|
||||
@@ -182,85 +198,6 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
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 validContactUser(String value, List<SysDictItemCore> listDict) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
return "'联络人'不能为空。";
|
||||
}
|
||||
// 检查联络人
|
||||
if (!excelUtils.validDict("username", value, "sys_user", "id", true, listDict)) {
|
||||
return "'联络人'无效。";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String validProjectType(ProcessEsAnnualInit plan, List<SysDictItemCore> listDict, List<LawsEnterpriseStandard> esList) {
|
||||
String projectType = plan.getProjectType();
|
||||
String originEnStandardNo = plan.getProjectType();
|
||||
@@ -272,7 +209,7 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
return "'制修订类型'无效。";
|
||||
}
|
||||
// 修订
|
||||
if (projectType.equals(ESPProjectType.MODIFY.getValue())) {
|
||||
if (projectType.equals(ESPProjectType.MODIFY.getName())) {
|
||||
// 检查企标编号是否有效
|
||||
if (StrUtil.isBlank(originEnStandardNo)) {
|
||||
return "'原企标编号'不能为空。";
|
||||
@@ -280,6 +217,34 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
if (!esList.stream().map(LawsEnterpriseStandard::getStandardNumber).collect(Collectors.toList()).contains(originEnStandardNo)) {
|
||||
return "'原企标编号'无效。";
|
||||
}
|
||||
} else {
|
||||
// 制定校验三个代号
|
||||
String enStandardCode = plan.getProjectType();
|
||||
String enNameCode = plan.getEnNameCode();
|
||||
String standardCategoryCode = plan.getStandardCategoryCode();
|
||||
// 检查企标编号是否有效
|
||||
if (StrUtil.isBlank(originEnStandardNo)) {
|
||||
return "'企业标准代号'不能为空。";
|
||||
}
|
||||
// 检查企业标准代号
|
||||
if (!excelUtils.validDict("enterprise_standard_code", enStandardCode, null, null, true, listDict)) {
|
||||
return "'企业标准代号'无效。";
|
||||
}
|
||||
if (StrUtil.isBlank(originEnStandardNo)) {
|
||||
return "'企业名称代号'不能为空。";
|
||||
}
|
||||
// 检查企业标准代号
|
||||
if (!excelUtils.validDict("enterprise_name_code", enNameCode, null, null, true, listDict)) {
|
||||
return "'企业名称代号'无效。";
|
||||
}
|
||||
if (StrUtil.isBlank(originEnStandardNo)) {
|
||||
return "'标准类别代号'不能为空。";
|
||||
}
|
||||
// 检查企业标准代号
|
||||
if (!excelUtils.validDict("standard_category_code", standardCategoryCode, null, null, true, listDict)) {
|
||||
return "'标准类别代号'无效。";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
if (newEnStandardName.length() > 50) {
|
||||
return "'新企标名称'过长(最多50字)。";
|
||||
|
||||
+24
-23
@@ -10,22 +10,21 @@ 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.apache.commons.compress.utils.IOUtils;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jero.common.system.base.controller.JeroController.*;
|
||||
|
||||
/**
|
||||
* @author: Mzaxd
|
||||
* @Date: 2023/10/18 10:44
|
||||
@@ -43,21 +42,23 @@ public class ESAnnualReportController {
|
||||
* 导入模板下载
|
||||
*/
|
||||
@GetMapping("/templateDownload")
|
||||
@ApiOperation(value = "企标年度制修订主动上报流程-导入模板下载", notes = "企标年度制修订主动上报流程-导入模板下载",
|
||||
produces = "application/octet-stream")
|
||||
@ApiOperation(value = "企标年度制修订主动上报流程-导入模板下载", notes = "企标年度制修订主动上报流程-导入模板下载"
|
||||
,produces = "application/octet-stream")
|
||||
@AutoLog(value = "企标年度制修订主动上报流程-导入模板下载")
|
||||
public ModelAndView templateDownload() {
|
||||
// AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
String title = "各部门主动上报导入模板";
|
||||
mv.addObject(FILE_NAME, title);
|
||||
mv.addObject(CLASS, ProcessEsAnnualReport.class);
|
||||
ExportParams exportParams = new ExportParams(title, title);
|
||||
// 导出xlsx
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
mv.addObject(PARAMS, exportParams);
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, new ArrayList<T>());
|
||||
return mv;
|
||||
public void templateDownload(HttpServletResponse response) {
|
||||
try {
|
||||
ClassPathResource resource = new ClassPathResource("excelTemplate/es-annual-report.xlsx");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=es-annual-report.xlsx");
|
||||
|
||||
try (InputStream in = resource.getInputStream(); OutputStream out = response.getOutputStream()) {
|
||||
IOUtils.copy(in, out);
|
||||
}
|
||||
response.flushBuffer();
|
||||
} catch (Exception e) {
|
||||
// 记录错误或执行其他处理
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+19
-9
@@ -93,7 +93,7 @@ public class ProcessEsAnnualReport implements Serializable {
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
@Excel(name = "制修订类型", width = 15, orderNum = "1")
|
||||
@Excel(name = "*制修订类型", width = 15, orderNum = "1")
|
||||
@Dict(dicCode = "esp_revision_type")
|
||||
@ApiModelProperty(value = "制修订类型")
|
||||
private String projectType;
|
||||
@@ -114,14 +114,13 @@ public class ProcessEsAnnualReport implements Serializable {
|
||||
/**
|
||||
* 原企标名称
|
||||
*/
|
||||
@Excel(name = "原企标名称", width = 15, orderNum = "3")
|
||||
@ApiModelProperty(value = "原企标名称")
|
||||
private String originEnStandardName;
|
||||
|
||||
/**
|
||||
* 新企标名称
|
||||
*/
|
||||
@Excel(name = "新企标名称", width = 15, orderNum = "4")
|
||||
@Excel(name = "*新企标名称", width = 15, orderNum = "4")
|
||||
@ApiModelProperty(value = "新企标名称")
|
||||
private String newEnStandardName;
|
||||
|
||||
@@ -132,8 +131,10 @@ public class ProcessEsAnnualReport implements Serializable {
|
||||
private String enStandardEnglishName;
|
||||
|
||||
/**
|
||||
* 企标体系
|
||||
* 标准体系
|
||||
*/
|
||||
@Excel(name = "*标准体系", width = 25, orderNum = "6")
|
||||
@Dict(dictTable = "laws_tree_node", dicCode = "id", dicText = "node_name")
|
||||
@ApiModelProperty(value = "企标体系")
|
||||
private String enStandardSystem;
|
||||
|
||||
@@ -148,12 +149,16 @@ public class ProcessEsAnnualReport implements Serializable {
|
||||
/**
|
||||
* 企业名称代号
|
||||
*/
|
||||
@Excel(name = "企业名称代号", width = 15, orderNum = "6")
|
||||
@Dict(dicCode = "enterprise_name_code")
|
||||
@ApiModelProperty(value = "企业名称代号")
|
||||
private String enNameCode;
|
||||
|
||||
/**
|
||||
* 标准类别代号
|
||||
*/
|
||||
@Excel(name = "标准类别代号", width = 15, orderNum = "6")
|
||||
@Dict(dicCode = "standard_category_code")
|
||||
@ApiModelProperty(value = "标准类别代号")
|
||||
private String standardCategoryCode;
|
||||
|
||||
@@ -166,12 +171,16 @@ public class ProcessEsAnnualReport implements Serializable {
|
||||
/**
|
||||
* 标准类型
|
||||
*/
|
||||
@Excel(name = "*标准类型", width = 15, orderNum = "10")
|
||||
@Dict(dicCode = "esp_standard_type")
|
||||
@ApiModelProperty(value = "标准类型")
|
||||
private String standardType;
|
||||
|
||||
/**
|
||||
* 企标等级分类
|
||||
*/
|
||||
@Excel(name = "*标准等级分类", width = 15, orderNum = "10")
|
||||
@Dict(dicCode = "standard_grade_classify")
|
||||
@ApiModelProperty(value = "企标等级分类")
|
||||
private String enStandardClassification;
|
||||
|
||||
@@ -222,6 +231,7 @@ public class ProcessEsAnnualReport implements Serializable {
|
||||
/**
|
||||
* 主起草人
|
||||
*/
|
||||
@Excel(name = "*主起草人", width = 15, orderNum = "8")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "username")
|
||||
@ApiModelProperty(value = "主起草人")
|
||||
private String mainDraftingUser;
|
||||
@@ -229,7 +239,7 @@ public class ProcessEsAnnualReport implements Serializable {
|
||||
/**
|
||||
* 主起草单位
|
||||
*/
|
||||
@Excel(name = "主起草单位", width = 15, orderNum = "8")
|
||||
@Excel(name = "*主起草单位", width = 15, orderNum = "8")
|
||||
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
||||
@ApiModelProperty(value = "主起草单位")
|
||||
private String mainDraftingUnit;
|
||||
@@ -237,7 +247,7 @@ public class ProcessEsAnnualReport implements Serializable {
|
||||
/**
|
||||
* 主起草单位责任人
|
||||
*/
|
||||
@Excel(name = "主起草单位责任人", width = 20, orderNum = "9")
|
||||
@Excel(name = "*起草单位责任人", width = 20, orderNum = "9")
|
||||
@Dict(dicCode = "id", dictTable = "sys_user", dicText = "username")
|
||||
@ApiModelProperty(value = "主起草单位责任人")
|
||||
private String mainDraftingUnitResponsiblePerson;
|
||||
@@ -245,7 +255,7 @@ public class ProcessEsAnnualReport implements Serializable {
|
||||
/**
|
||||
* 标准推进人
|
||||
*/
|
||||
@Excel(name = "标准推进人", width = 15, orderNum = "11")
|
||||
@Excel(name = "*标准推进人", width = 15, orderNum = "11")
|
||||
@Dict(dicCode = "id", dictTable = "sys_user", dicText = "username")
|
||||
@ApiModelProperty(value = "标准推进人")
|
||||
private String standardPromoter;
|
||||
@@ -302,7 +312,7 @@ public class ProcessEsAnnualReport implements Serializable {
|
||||
/**
|
||||
* 授权部门
|
||||
*/
|
||||
@Excel(name = "授权部门", width = 15, orderNum = "5")
|
||||
@Excel(name = "*授权部门", width = 15, orderNum = "5")
|
||||
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
||||
@ApiModelProperty(value = "授权部门")
|
||||
private String authDept;
|
||||
@@ -310,7 +320,7 @@ public class ProcessEsAnnualReport implements Serializable {
|
||||
/**
|
||||
* 配合单位
|
||||
*/
|
||||
@Excel(name = "配合单位", width = 15, orderNum = "7")
|
||||
@Excel(name = "*配合单位", width = 15, orderNum = "7")
|
||||
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
||||
@ApiModelProperty(value = "配合单位")
|
||||
private String cooperationUnit;
|
||||
|
||||
+76
-108
@@ -1,11 +1,11 @@
|
||||
package com.jero.modules.activiti.process.esAnnualReport.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.api.ISysBaseAPI;
|
||||
import com.jero.common.system.vo.SysDictItemCore;
|
||||
import com.jero.modules.activiti.process.common.enums.ProcessType;
|
||||
import com.jero.modules.activiti.process.common.service.ActFlowCommonService;
|
||||
@@ -29,7 +29,6 @@ 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.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -69,9 +68,6 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
@Resource
|
||||
private TaskService taskService;
|
||||
|
||||
@Resource
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> setVariables(String processInstanceId) {
|
||||
return null;
|
||||
@@ -121,7 +117,7 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
}
|
||||
|
||||
@Override
|
||||
public void approvalProcess(String taskId, List<ProcessEsAnnualReport> esAnnualReportList, boolean b) {
|
||||
public void approvalProcess(String taskId, List<ProcessEsAnnualReport> esAnnualReportList, boolean pass) {
|
||||
String userId = UserUtils.getUserId();
|
||||
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
||||
String taskDefinitionKey = task.getTaskDefinitionKey();
|
||||
@@ -132,7 +128,6 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
actFlowCommonService.completeTask("同意", taskId, userId, null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> importData(MultipartFile file) {
|
||||
List<SysDictItemCore> listDict = commonAPI.getDictItemAll();
|
||||
@@ -142,7 +137,7 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
// 获取Excel的header
|
||||
List<String> headers;
|
||||
try {
|
||||
headers = ExcelUtils.getHeaderFromExcel(file.getInputStream());
|
||||
headers = ExcelUtils.getHeaderFromExcel(file.getInputStream(), 0);
|
||||
} catch (Exception e) {
|
||||
errorMsgs.add("上传模板错误,请检查后重试。");
|
||||
resultMap.put("msg", errorMsgs);
|
||||
@@ -161,13 +156,14 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
}
|
||||
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(1);
|
||||
params.setTitleRows(0);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
|
||||
try {
|
||||
List<ProcessEsAnnualReport> list = ExcelImportUtil.importExcel(file.getInputStream(), ProcessEsAnnualReport.class, params);
|
||||
if (list.isEmpty()) {
|
||||
list.remove(0);
|
||||
list.remove(0);
|
||||
if (list.size() == 0) {
|
||||
errorMsgs.add("文件暂无数据,请检查后重试。");
|
||||
resultMap.put("msg", errorMsgs);
|
||||
resultMap.put("flag", YesOrNoEnum.NO.getValue());
|
||||
@@ -201,7 +197,17 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void cleanData(List<ProcessEsAnnualReport> list) {
|
||||
List<String> originStandardNoList = list.stream().map(ProcessEsAnnualReport::getOriginEnStandardNo).collect(Collectors.toList());
|
||||
|
||||
LambdaQueryWrapper<LawsEnterpriseStandard> esWrapper = new LambdaQueryWrapper<>();
|
||||
esWrapper.in(LawsEnterpriseStandard::getStandardNumber, originStandardNoList);
|
||||
List<LawsEnterpriseStandard> esList = enterpriseStandardService.list(esWrapper);
|
||||
// 转换成key为企标编号的map
|
||||
Map<String, LawsEnterpriseStandard> esMap = esList.stream().collect(Collectors.toMap(LawsEnterpriseStandard::getStandardNumber, item -> item));
|
||||
|
||||
list.forEach(item-> {
|
||||
// 如果是制定则去除掉所有的原企标名称 原企标编号
|
||||
if (ESPProjectType.ENACT.getValue().equals(item.getProjectType())) {
|
||||
@@ -211,15 +217,18 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
item.setChangeStatus("1");
|
||||
} else {
|
||||
item.setChangeStatus("2");
|
||||
item.setOriginEnStandardName(esMap.get(item.getOriginEnStandardNo()).getStandardName());
|
||||
item.setEnStandardCode(esMap.get(item.getOriginEnStandardNo()).getStandardCode());
|
||||
item.setEnNameCode(esMap.get(item.getOriginEnStandardNo()).getNameCode());
|
||||
item.setStandardCategoryCode(esMap.get(item.getOriginEnStandardNo()).getCategoryCode());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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.setAuthDept(excelUtils.translateDictValue("depart_name", "id", "sys_depart", item.getAuthDept(), 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));
|
||||
@@ -228,12 +237,11 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
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;
|
||||
int i = 4;
|
||||
Iterator<ProcessEsAnnualReport> iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ProcessEsAnnualReport plan = iterator.next();
|
||||
@@ -242,14 +250,16 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
continue;
|
||||
}
|
||||
plan.setSort(String.valueOf(i++));
|
||||
String enStandardCode = plan.getProjectType();
|
||||
String authDept = plan.getProjectType();
|
||||
String authDept = plan.getAuthDept();
|
||||
String cooperationUnit = plan.getCooperationUnit();
|
||||
String mainDraftingUnit = plan.getMainDraftingUnit();
|
||||
String mainDraftingUser = plan.getProjectType();
|
||||
String mainDraftingUser = plan.getMainDraftingUser();
|
||||
String mainDraftingUnitResponsiblePerson = plan.getMainDraftingUnitResponsiblePerson();
|
||||
String standardPromoter = plan.getStandardPromoter();
|
||||
String workGroup = plan.getWorkGroup();
|
||||
String standardSystem = plan.getEnStandardSystem();
|
||||
String standardType = plan.getStandardType();
|
||||
String standardClassification = plan.getEnStandardClassification();
|
||||
|
||||
StringBuilder errMsgHeader = new StringBuilder();
|
||||
StringBuilder errMsg = new StringBuilder();
|
||||
@@ -258,14 +268,16 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
// 检查制修订类型 编号 名称
|
||||
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));
|
||||
errMsg.append(excelUtils.validAuthDept(authDept, listDict));
|
||||
errMsg.append(excelUtils.validCooperateUnit(cooperationUnit, listDict));
|
||||
errMsg.append(excelUtils.validMainDraftingUser(mainDraftingUser, listDict));
|
||||
errMsg.append(excelUtils.validMainDraftingUnit(mainDraftingUnit, listDict));
|
||||
errMsg.append(excelUtils.validMainDraftingUnitResponsiblePerson(mainDraftingUnitResponsiblePerson, listDict));
|
||||
errMsg.append(excelUtils.validStandardPromoter(standardPromoter, listDict));
|
||||
errMsg.append(excelUtils.validWorkGroup(workGroup, listDict));
|
||||
errMsg.append(excelUtils.validStandardSystem(standardSystem, listDict));
|
||||
errMsg.append(excelUtils.validStandardType(standardType, listDict));
|
||||
errMsg.append(excelUtils.validStandardClassification(standardClassification, listDict));
|
||||
// 如果数据有问题,则将提示信息添加到 errorMsgs 中
|
||||
if (errMsg.length() > 0) {
|
||||
errorMsgs.add(errMsgHeader.append(errMsg).toString());
|
||||
@@ -274,83 +286,8 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
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) {
|
||||
StringBuilder errMsg = new StringBuilder();
|
||||
String projectType = plan.getProjectType();
|
||||
String originEnStandardNo = plan.getProjectType();
|
||||
String newEnStandardName = plan.getNewEnStandardName();
|
||||
@@ -361,19 +298,50 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
return "'制修订类型'无效。";
|
||||
}
|
||||
// 修订
|
||||
if (projectType.equals(ESPProjectType.MODIFY.getValue())) {
|
||||
if (projectType.equals(ESPProjectType.MODIFY.getName())) {
|
||||
// 检查企标编号是否有效
|
||||
if (StrUtil.isBlank(originEnStandardNo)) {
|
||||
return "'原企标编号'不能为空。";
|
||||
errMsg.append("'原企标编号'不能为空。");
|
||||
} else {
|
||||
if (!esList.stream().map(LawsEnterpriseStandard::getStandardNumber).collect(Collectors.toList()).contains(originEnStandardNo)) {
|
||||
return "'原企标编号'无效。";
|
||||
}
|
||||
}
|
||||
if (!esList.stream().map(LawsEnterpriseStandard::getStandardNumber).collect(Collectors.toList()).contains(originEnStandardNo)) {
|
||||
return "'原企标编号'无效。";
|
||||
} else {
|
||||
// 制定校验三个代号
|
||||
String enStandardCode = plan.getEnStandardCode();
|
||||
String enNameCode = plan.getEnNameCode();
|
||||
String standardCategoryCode = plan.getStandardCategoryCode();
|
||||
// 检查企标编号是否有效
|
||||
if (StrUtil.isBlank(originEnStandardNo)) {
|
||||
errMsg.append("'企业标准代号'不能为空。");
|
||||
} else {
|
||||
// 检查企业标准代号
|
||||
if (!excelUtils.validDict("enterprise_standard_code", enStandardCode, null, null, true, listDict)) {
|
||||
errMsg.append("'企业标准代号'无效。");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isBlank(originEnStandardNo)) {
|
||||
errMsg.append("'企业名称代号'不能为空。");
|
||||
} else {
|
||||
// 检查企业标准代号
|
||||
if (!excelUtils.validDict("enterprise_name_code", enNameCode, null, null, true, listDict)) {
|
||||
errMsg.append("'企业名称代号'无效。");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isBlank(originEnStandardNo)) {
|
||||
errMsg.append("'标准类别代号'不能为空。");
|
||||
} else {
|
||||
// 检查企业标准代号
|
||||
if (!excelUtils.validDict("standard_category_code", standardCategoryCode, null, null, true, listDict)) {
|
||||
errMsg.append("'标准类别代号'无效。");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newEnStandardName.length() > 50) {
|
||||
return "'新企标名称'过长(最多50字)。";
|
||||
errMsg.append("'新企标名称'过长(最多50字)。");
|
||||
}
|
||||
return "";
|
||||
return errMsg.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package com.jero.modules.activiti.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.jero.common.api.CommonAPI;
|
||||
import com.jero.common.system.vo.SysDictItemCore;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.activiti.process.esAnnualInit.entity.ProcessEsAnnualInit;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPProjectType;
|
||||
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
|
||||
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
|
||||
import com.jero.modules.system.entity.SysDictItem;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
@@ -31,6 +36,12 @@ public class ExcelUtils {
|
||||
@Resource
|
||||
private CommonAPI commonAPI;
|
||||
|
||||
@Resource
|
||||
private ExcelUtils excelUtils;
|
||||
|
||||
@Resource
|
||||
private ILawsEnterpriseStandardService enterpriseStandardService;
|
||||
|
||||
public static Date excelSerialDateToJavaDate(double serialDate) {
|
||||
// 首先,我们定义数据库支持的最早和最晚的日期。
|
||||
Calendar minDate = Calendar.getInstance();
|
||||
@@ -57,17 +68,19 @@ public class ExcelUtils {
|
||||
* @return HeadRow的List
|
||||
* @throws Exception
|
||||
*/
|
||||
public static List<String> getHeaderFromExcel(InputStream is) throws Exception {
|
||||
public static List<String> getHeaderFromExcel(InputStream is, Integer index) throws Exception {
|
||||
List<String> headers = new ArrayList<>();
|
||||
|
||||
Workbook workbook = new XSSFWorkbook(is);
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
|
||||
// HeadRow在index 1
|
||||
for (int rowIndex = 1; rowIndex <= 1; rowIndex++) {
|
||||
for (int rowIndex = index; rowIndex <= index; rowIndex++) {
|
||||
Row row = sheet.getRow(rowIndex);
|
||||
for (Cell cell : row) {
|
||||
headers.add(cell.getStringCellValue());
|
||||
String cellValue = cell.getStringCellValue();
|
||||
// 否则,直接添加到列表
|
||||
headers.add(cellValue);
|
||||
}
|
||||
}
|
||||
return headers;
|
||||
@@ -141,8 +154,13 @@ public class ExcelUtils {
|
||||
return false;
|
||||
}
|
||||
int count = dictValue.split(",").length;
|
||||
String value = this.translateDictValue(dictCode, dicText, dicTable, dictValue, listDict);
|
||||
return value != null && value.split(",").length == count;
|
||||
String value;
|
||||
if (dicTable == null) {
|
||||
value = this.translateDictValue(dictCode, dictValue, listDict);
|
||||
} else {
|
||||
value = this.translateDictValue(dictCode, dicText, dicTable, dictValue, listDict);
|
||||
}
|
||||
return value != null && value.split(",").length == count && StrUtil.isNotBlank(value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,7 +173,8 @@ public class ExcelUtils {
|
||||
public String translateDictValue(String code, String text, List<SysDictItemCore> listDict) {
|
||||
StringBuilder textValue = new StringBuilder();
|
||||
String tmpValue = null;
|
||||
List<SysDictItemCore> listNew = listDict.stream().filter(o -> Objects.equals(o.getDictCode(), code) && Objects.equals(o.getItemText(), text.trim())).collect(Collectors.toList());
|
||||
List<SysDictItemCore> listNew = listDict.stream()
|
||||
.filter(o -> Objects.equals(o.getDictCode(), code) && Objects.equals(o.getItemText(), text.trim())).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(listNew)) {
|
||||
tmpValue = listNew.get(0).getItemValue();
|
||||
}
|
||||
@@ -191,7 +210,8 @@ public class ExcelUtils {
|
||||
if (!StringUtils.isEmpty(table)) {
|
||||
tmpValue = commonAPI.queryTableDictTextByKey(table, text, code, k.trim());
|
||||
} else {
|
||||
List<SysDictItemCore> listNew = listDict.stream().filter(o -> Objects.equals(o.getDictCode(), code) && Objects.equals(o.getItemValue(), k.trim())).collect(Collectors.toList());
|
||||
List<SysDictItemCore> listNew = listDict.stream()
|
||||
.filter(o -> Objects.equals(o.getDictCode(), code) && Objects.equals(o.getItemValue(), k.trim())).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(listNew)) {
|
||||
tmpValue = listNew.get(0).getItemText();
|
||||
}
|
||||
@@ -206,4 +226,128 @@ public class ExcelUtils {
|
||||
}
|
||||
return textValue.toString();
|
||||
}
|
||||
|
||||
|
||||
public String validStandardClassification(String value, List<SysDictItemCore> listDict) {
|
||||
// 非空检查
|
||||
if (StrUtil.isBlank(value)) {
|
||||
return "'标准等级分类'不能为空。";
|
||||
}
|
||||
// 检查授权部门
|
||||
if (!excelUtils.validDict("standard_grade_classify", value, null, null, true, listDict)) {
|
||||
return "'标准等级分类'无效。";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String validStandardType(String value, List<SysDictItemCore> listDict) {
|
||||
// 非空检查
|
||||
if (StrUtil.isBlank(value)) {
|
||||
return "'标准类型'不能为空。";
|
||||
}
|
||||
// 检查授权部门
|
||||
if (!excelUtils.validDict("esp_standard_type", value, null, null, true, listDict)) {
|
||||
return "'标准类型'无效。";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public 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 "";
|
||||
}
|
||||
|
||||
public 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 "";
|
||||
}
|
||||
|
||||
public String validMainDraftingUser(String value, List<SysDictItemCore> listDict) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
return "'主起草人'不能为空。";
|
||||
}
|
||||
// 检查主起草人
|
||||
if (!excelUtils.validDict("username", value, "sys_user", "id", true, listDict)) {
|
||||
return "'主起草人'无效。";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public 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 "";
|
||||
}
|
||||
|
||||
public String validMainDraftingUnitResponsiblePerson(String value, List<SysDictItemCore> listDict) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
return "'主起草单位负责人'不能为空。";
|
||||
}
|
||||
// 检查主起草单位负责人
|
||||
if (!excelUtils.validDict("username", value, "sys_user", "id", true, listDict)) {
|
||||
return "'主起草单位负责人'无效。";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String validStandardPromoter(String value, List<SysDictItemCore> listDict) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
return "'标准推进人'不能为空。";
|
||||
}
|
||||
// 检查标准推进人
|
||||
if (!excelUtils.validDict("username", value, "sys_user", "id", true, listDict)) {
|
||||
return "'标准推进人'无效。";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String validContactUser(String value, List<SysDictItemCore> listDict) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
return "'联络人'不能为空。";
|
||||
}
|
||||
// 检查联络人
|
||||
if (!excelUtils.validDict("username", value, "sys_user", "id", true, listDict)) {
|
||||
return "'联络人'无效。";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String validStandardSystem(String value, List<SysDictItemCore> listDict) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
return "'标准体系'不能为空。";
|
||||
}
|
||||
// 检查主起草人
|
||||
if (!excelUtils.validDict("node_name", value, "laws_tree_node", "id", false, listDict)) {
|
||||
return "'标准体系'无效。";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String validWorkGroup(String value, List<SysDictItemCore> listDict) {
|
||||
// 检查工作组
|
||||
if (!excelUtils.validDict("name", value, "laws_working_group", "id", true, listDict)) {
|
||||
return "'工作组'无效。";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user