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