fix: 标准化发起流程导入功能字段完善
This commit is contained in:
+1
-1
@@ -153,7 +153,7 @@ public class ESAnnualInitController {
|
||||
@PostMapping("/importExcel")
|
||||
@ApiOperation(value = "企标年度制修订标准化发起流程-导入", notes = "企标年度制修订标准化发起流程-导入")
|
||||
@AutoLog(value = "企标年度制修订标准化发起流程-导入")
|
||||
@DictPoint
|
||||
@Translation
|
||||
public Result<?> importExcel(@ApiParam(value = "要上传的文件", required = true) @RequestParam("file") MultipartFile file) {
|
||||
Map<String, Object> resultMap = annualInitService.importData(file);
|
||||
Object flag = resultMap.get("flag");
|
||||
|
||||
+45
-37
@@ -130,25 +130,18 @@ public class ProcessEsAnnualInit implements Serializable {
|
||||
@ApiModelProperty(value = "企标英文名称")
|
||||
private String enStandardEnglishName;
|
||||
|
||||
/**
|
||||
* 企标体系
|
||||
*/
|
||||
@Excel(name = "*标准体系", width = 25, orderNum = "5")
|
||||
@Dict(dictTable = "laws_tree_node", dicCode = "id", dicText = "node_name")
|
||||
@ApiModelProperty(value = "企标体系")
|
||||
private String enStandardSystem;
|
||||
|
||||
/**
|
||||
* 企业标准代号
|
||||
*/
|
||||
@Excel(name = "企业标准代号", width = 15, orderNum = "6")
|
||||
@Excel(name = "企业标准代号", width = 15, orderNum = "4")
|
||||
@ApiModelProperty(value = "企业标准代号")
|
||||
@Dict(dicCode = "enterprise_standard_code")
|
||||
private String enStandardCode;
|
||||
|
||||
/**
|
||||
* 企业名称代号
|
||||
*/
|
||||
@Excel(name = "企业名称代号", width = 15, orderNum = "7")
|
||||
@Excel(name = "企业名称代号", width = 15, orderNum = "5")
|
||||
@Dict(dicCode = "enterprise_name_code")
|
||||
@ApiModelProperty(value = "企业名称代号")
|
||||
private String enNameCode;
|
||||
@@ -156,11 +149,19 @@ public class ProcessEsAnnualInit implements Serializable {
|
||||
/**
|
||||
* 标准类别代号
|
||||
*/
|
||||
@Excel(name = "标准类别代号", width = 15, orderNum = "8")
|
||||
@Excel(name = "标准类别代号", width = 15, orderNum = "6")
|
||||
@Dict(dicCode = "standard_category_code")
|
||||
@ApiModelProperty(value = "标准类别代号")
|
||||
private String standardCategoryCode;
|
||||
|
||||
/**
|
||||
* 企标体系
|
||||
*/
|
||||
@Excel(name = "*标准体系", width = 25, orderNum = "7")
|
||||
@Dict(dictTable = "laws_tree_node", dicCode = "id", dicText = "node_name")
|
||||
@ApiModelProperty(value = "企标体系")
|
||||
private String enStandardSystem;
|
||||
|
||||
/**
|
||||
* 年代号
|
||||
*/
|
||||
@@ -170,7 +171,7 @@ public class ProcessEsAnnualInit implements Serializable {
|
||||
/**
|
||||
* 标准类型
|
||||
*/
|
||||
@Excel(name = "*标准类型", width = 15, orderNum = "13")
|
||||
@Excel(name = "标准类型", width = 15, orderNum = "8")
|
||||
@Dict(dicCode = "esp_standard_type")
|
||||
@ApiModelProperty(value = "标准类型")
|
||||
private String standardType;
|
||||
@@ -178,7 +179,7 @@ public class ProcessEsAnnualInit implements Serializable {
|
||||
/**
|
||||
* 企标等级分类
|
||||
*/
|
||||
@Excel(name = "*标准等级分类", width = 15, orderNum = "14")
|
||||
@Excel(name = "标准等级分类", width = 15, orderNum = "9")
|
||||
@Dict(dicCode = "standard_grade_classify")
|
||||
@ApiModelProperty(value = "企标等级分类")
|
||||
private String enStandardClassification;
|
||||
@@ -186,30 +187,36 @@ public class ProcessEsAnnualInit implements Serializable {
|
||||
/**
|
||||
* 草稿计划完成日期
|
||||
*/
|
||||
@Excel(name = "草稿计划完成日期", width = 20, orderNum = "17")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "草稿计划完成日期")
|
||||
private Date draftPlannedCompleteDate;
|
||||
|
||||
@Excel(name = "草稿计划完成日期", width = 20, orderNum = "10")
|
||||
private String draftPlannedCompleteDateString;
|
||||
|
||||
/**
|
||||
* 征求意见稿计划完成日期
|
||||
*/
|
||||
@Excel(name = "征求意见稿计划完成日期", width = 24, orderNum = "18")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "征求意见稿计划完成日期")
|
||||
private Date solicitationDraftPlanCompleteDate;
|
||||
|
||||
@Excel(name = "征求意见稿计划完成日期", width = 24, orderNum = "11")
|
||||
private String solicitationDraftPlanCompleteDateString;
|
||||
|
||||
/**
|
||||
* 计划报批日期
|
||||
*/
|
||||
@Excel(name = "计划报批日期", width = 15, orderNum = "19")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "计划报批日期")
|
||||
private Date planApprovalDate;
|
||||
|
||||
@Excel(name = "计划报批日期", width = 15, orderNum = "12")
|
||||
private String planApprovalDateString;
|
||||
|
||||
/**
|
||||
* 项目状态
|
||||
*/
|
||||
@@ -225,21 +232,31 @@ public class ProcessEsAnnualInit implements Serializable {
|
||||
/**
|
||||
* 零部件名称
|
||||
*/
|
||||
@Excel(name = "*零部件名称", width = 15, orderNum = "13")
|
||||
@Dict(dicCode = "part_name")
|
||||
@ApiModelProperty(value = "零部件名称")
|
||||
private String componentName;
|
||||
|
||||
/**
|
||||
* 授权部门
|
||||
*/
|
||||
@Excel(name = "*授权部门", width = 15, orderNum = "14")
|
||||
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
||||
@ApiModelProperty(value = "授权部门")
|
||||
private String authDept;
|
||||
|
||||
/**
|
||||
* 主起草人
|
||||
*/
|
||||
@Excel(name = "*主起草人", width = 15, orderNum = "10")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
@Excel(name = "*主起草人", width = 15, orderNum = "15")
|
||||
@Dict(dicCode = "id", dictTable = "sys_user", dicText = "CONCAT(realname, '(', username, ')')")
|
||||
@ApiModelProperty(value = "主起草人")
|
||||
private String mainDraftingUser;
|
||||
|
||||
/**
|
||||
* 主起草单位
|
||||
*/
|
||||
@Excel(name = "*主起草单位", width = 15, orderNum = "11")
|
||||
@Excel(name = "*主起草单位", width = 15, orderNum = "16")
|
||||
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
||||
@ApiModelProperty(value = "主起草单位")
|
||||
private String mainDraftingUnit;
|
||||
@@ -247,16 +264,16 @@ public class ProcessEsAnnualInit implements Serializable {
|
||||
/**
|
||||
* 主起草单位责任人
|
||||
*/
|
||||
@Excel(name = "*主起草单位责任人", width = 20, orderNum = "12")
|
||||
@Dict(dicCode = "id", dictTable = "sys_user", dicText = "realname")
|
||||
@Excel(name = "*主起草单位责任人", width = 20, orderNum = "17")
|
||||
@Dict(dicCode = "id", dictTable = "sys_user", dicText = "CONCAT(realname, '(', username, ')')")
|
||||
@ApiModelProperty(value = "主起草单位责任人")
|
||||
private String mainDraftingUnitResponsiblePerson;
|
||||
|
||||
/**
|
||||
* 标准推进人
|
||||
*/
|
||||
@Excel(name = "*标准推进人", width = 15, orderNum = "16")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
@Excel(name = "*标准推进人", width = 15, orderNum = "18")
|
||||
@Dict(dicCode = "id", dictTable = "sys_user", dicText = "CONCAT(realname, '(', username, ')')")
|
||||
@ApiModelProperty(value = "标准推进人")
|
||||
private String standardPromoter;
|
||||
|
||||
@@ -278,7 +295,6 @@ public class ProcessEsAnnualInit implements Serializable {
|
||||
/**
|
||||
* 上传附件
|
||||
*/
|
||||
@Dict(dictTable = "oss_file", dicCode = "id", dicText = "file_name")
|
||||
@ApiModelProperty(value = "上传附件")
|
||||
private String uploadAttachment;
|
||||
|
||||
@@ -288,18 +304,10 @@ public class ProcessEsAnnualInit implements Serializable {
|
||||
@ApiModelProperty(value = "变更原因")
|
||||
private String changeReason;
|
||||
|
||||
/**
|
||||
* 授权部门
|
||||
*/
|
||||
@Excel(name = "*授权部门", width = 15, orderNum = "4")
|
||||
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
||||
@ApiModelProperty(value = "授权部门")
|
||||
private String authDept;
|
||||
|
||||
/**
|
||||
* 配合单位
|
||||
*/
|
||||
@Excel(name = "*配合单位", width = 15, orderNum = "9")
|
||||
@Excel(name = "*配合单位", width = 15, orderNum = "19")
|
||||
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
||||
@ApiModelProperty(value = "配合单位")
|
||||
private String cooperationUnit;
|
||||
@@ -307,15 +315,15 @@ public class ProcessEsAnnualInit implements Serializable {
|
||||
/**
|
||||
* 联络人
|
||||
*/
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
@Excel(name = "*联络人", width = 15, orderNum = "15")
|
||||
@Excel(name = "*联络人", width = 15, orderNum = "20")
|
||||
@Dict(dicCode = "id", dictTable = "sys_user", dicText = "CONCAT(realname, '(', username, ')')")
|
||||
@ApiModelProperty(value = "联络人")
|
||||
private String contactUser;
|
||||
|
||||
/**
|
||||
* 流程中的主起草人
|
||||
*/
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
@Dict(dicCode = "id", dictTable = "sys_user", dicText = "CONCAT(realname, '(', username, ')')")
|
||||
@ApiModelProperty(value = "流程中的主起草人")
|
||||
private String prcMainDraftUser;
|
||||
|
||||
@@ -335,7 +343,7 @@ public class ProcessEsAnnualInit implements Serializable {
|
||||
/**
|
||||
* 审批人
|
||||
*/
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
@Dict(dicCode = "id", dictTable = "sys_user", dicText = "CONCAT(realname, '(', username, ')')")
|
||||
@ApiModelProperty(value = "审批人")
|
||||
private String approvalUser;
|
||||
|
||||
|
||||
+31
-10
@@ -22,9 +22,12 @@ import com.jero.modules.activiti.service.ProcessAllService;
|
||||
import com.jero.modules.activiti.service.ProcessNodeLinkService;
|
||||
import com.jero.modules.activiti.service.ProcessNodeService;
|
||||
import com.jero.modules.activiti.util.ExcelUtils;
|
||||
import com.jero.modules.laws.common.util.ImportUtil;
|
||||
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
|
||||
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
|
||||
import com.jero.modules.sys.utils.UserUtils;
|
||||
import lombok.Cleanup;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.TaskService;
|
||||
@@ -38,6 +41,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -81,6 +85,9 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
@Resource
|
||||
private TaskService taskService;
|
||||
|
||||
@Resource
|
||||
private ImportUtil importUtil;
|
||||
|
||||
@Override
|
||||
public void startProcess(AnnualInitDataVO annualInitData) {
|
||||
// 执行流程发起前的操作
|
||||
@@ -324,6 +331,7 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
}
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public Map<String, Object> importData(MultipartFile file) {
|
||||
List<SysDictItemCore> listDict = commonAPI.getDictItemAll();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
@@ -356,7 +364,9 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
params.setNeedSave(true);
|
||||
|
||||
try {
|
||||
List<ProcessEsAnnualInit> list = ExcelImportUtil.importExcel(file.getInputStream(), ProcessEsAnnualInit.class, params);
|
||||
@Cleanup
|
||||
InputStream inputStream = file.getInputStream();
|
||||
List<ProcessEsAnnualInit> list = ExcelImportUtil.importExcel(inputStream, ProcessEsAnnualInit.class, params);
|
||||
list.remove(0);
|
||||
list.remove(0);
|
||||
if (list.isEmpty()) {
|
||||
@@ -367,7 +377,7 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
}
|
||||
// 批量检查数据是否有效
|
||||
errorMsgs = this.validationList(list, listDict);
|
||||
if (errorMsgs.size() > 0) {
|
||||
if (!errorMsgs.isEmpty()) {
|
||||
resultMap.put("msg", errorMsgs);
|
||||
resultMap.put("flag", YesOrNoEnum.NO.getValue());
|
||||
} else {
|
||||
@@ -383,12 +393,6 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
resultMap.put("msg", errorMsgs);
|
||||
resultMap.put("flag", YesOrNoEnum.NO.getValue());
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
@@ -421,15 +425,22 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
|
||||
private void transToDictValue(List<ProcessEsAnnualInit> list, List<SysDictItemCore> listDict) {
|
||||
list.forEach(item -> {
|
||||
item.setProjectType(excelUtils.translateDictValue("esp_revision_type", item.getProjectType(), listDict));
|
||||
item.setAuthDept(excelUtils.translateDictValue("depart_name", "id", "sys_depart", item.getAuthDept(), listDict));
|
||||
item.setEnStandardCode(excelUtils.translateDictValue("enterprise_standard_code", item.getEnStandardCode(), listDict));
|
||||
item.setCooperationUnit(excelUtils.translateDictValue("depart_name", "id", "sys_depart", item.getCooperationUnit(), listDict));
|
||||
item.setMainDraftingUser(excelUtils.translateDictValue("CONCAT(realname, '(', username, ')')", "id", "sys_user", item.getMainDraftingUser(), listDict));
|
||||
item.setMainDraftingUnit(excelUtils.translateDictValue("depart_name", "id", "sys_depart", item.getMainDraftingUnit(), listDict));
|
||||
item.setMainDraftingUnitResponsiblePerson(excelUtils.translateDictValue("CONCAT(realname, '(', username, ')')", "id", "sys_user", item.getMainDraftingUnitResponsiblePerson(), listDict));
|
||||
item.setStandardPromoter(excelUtils.translateDictValue("CONCAT(realname, '(', username, ')')", "id", "sys_user", item.getStandardPromoter(), listDict));
|
||||
item.setEnStandardSystem(excelUtils.translateDictValue("node_name", "id", "laws_tree_node", item.getEnStandardSystem(), listDict));
|
||||
item.setContactUser(excelUtils.translateDictValue("CONCAT(realname, '(', username, ')')", "id", "sys_user", item.getContactUser(), listDict));
|
||||
item.setStandardType(excelUtils.translateDictValue("esp_standard_type", item.getStandardType(), listDict));
|
||||
item.setEnStandardCode(excelUtils.translateDictValue("enterprise_standard_code", item.getEnStandardCode(), listDict));
|
||||
item.setEnStandardClassification(excelUtils.translateDictValue("standard_category_code", item.getEnStandardClassification(), listDict));
|
||||
item.setComponentName(excelUtils.translateDictValue("part_name", item.getComponentName(), listDict));
|
||||
item.setProjectType(excelUtils.translateDictValue("esp_revision_type", item.getProjectType(), listDict));
|
||||
item.setDraftPlannedCompleteDate(importUtil.convertDate(item.getDraftPlannedCompleteDateString()));
|
||||
item.setSolicitationDraftPlanCompleteDate(importUtil.convertDate(item.getSolicitationDraftPlanCompleteDateString()));
|
||||
item.setPlanApprovalDate(importUtil.convertDate(item.getPlanApprovalDateString()));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -459,6 +470,11 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
String standardSystem = plan.getEnStandardSystem();
|
||||
String standardType = plan.getStandardType();
|
||||
String enStandardClassification = plan.getEnStandardClassification();
|
||||
String enStandardCode = plan.getEnStandardCode();
|
||||
String partName = plan.getComponentName();
|
||||
String draftPlannedCompleteDateString = plan.getDraftPlannedCompleteDateString();
|
||||
String solicitationDraftPlanCompleteDateString = plan.getSolicitationDraftPlanCompleteDateString();
|
||||
String planApprovalDateString = plan.getPlanApprovalDateString();
|
||||
|
||||
StringBuilder errMsgHeader = new StringBuilder();
|
||||
StringBuilder errMsg = new StringBuilder();
|
||||
@@ -476,7 +492,12 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
|
||||
errMsg.append(excelUtils.validStandardSystem(standardSystem, listDict));
|
||||
errMsg.append(excelUtils.validContactUser(contactUser, listDict));
|
||||
errMsg.append(excelUtils.validStandardType(standardType, listDict));
|
||||
errMsg.append(excelUtils.validStandardCode(enStandardCode, listDict));
|
||||
errMsg.append(excelUtils.validStandardClassification(enStandardClassification, listDict));
|
||||
errMsg.append(excelUtils.validPartName(partName, listDict));
|
||||
errMsg.append(excelUtils.validSingleDate(draftPlannedCompleteDateString, "草稿计划完成日期"));
|
||||
errMsg.append(excelUtils.validSingleDate(solicitationDraftPlanCompleteDateString, "征求意见稿计划完成日期"));
|
||||
errMsg.append(excelUtils.validSingleDate(planApprovalDateString, "计划报批日期"));
|
||||
// 如果数据有问题,则将提示信息添加到 errorMsgs 中
|
||||
if (errMsg.length() > 0) {
|
||||
errorMsgs.add(errMsgHeader.append(errMsg).toString());
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ public class ESAnnualReportController {
|
||||
@PostMapping("/importExcel")
|
||||
@ApiOperation(value = "企标年度制修订主动上报流程-导入", notes = "企标年度制修订主动上报流程-导入")
|
||||
@AutoLog(value = "企标年度制修订主动上报流程-导入")
|
||||
@DictPoint
|
||||
@Translation
|
||||
public Result<?> importExcel(@ApiParam(value = "要上传的文件", required = true) @RequestParam("file") MultipartFile file) {
|
||||
Map<String, Object> resultMap = annualReportService.importData(file);
|
||||
Object flag = resultMap.get("flag");
|
||||
|
||||
-6
@@ -356,12 +356,6 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
resultMap.put("msg", errorMsgs);
|
||||
resultMap.put("flag", YesOrNoEnum.NO.getValue());
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -109,13 +109,10 @@ public class ExcelUtils {
|
||||
}
|
||||
|
||||
// 根据orderNum正序排序
|
||||
annotatedFields.sort(new Comparator<Field>() {
|
||||
@Override
|
||||
public int compare(Field o1, Field o2) {
|
||||
Excel excel1 = o1.getAnnotation(Excel.class);
|
||||
Excel excel2 = o2.getAnnotation(Excel.class);
|
||||
return Integer.compare(Integer.parseInt(excel1.orderNum()), Integer.parseInt(excel2.orderNum()));
|
||||
}
|
||||
annotatedFields.sort((o1, o2) -> {
|
||||
Excel excel1 = o1.getAnnotation(Excel.class);
|
||||
Excel excel2 = o2.getAnnotation(Excel.class);
|
||||
return Integer.compare(Integer.parseInt(excel1.orderNum()), Integer.parseInt(excel2.orderNum()));
|
||||
});
|
||||
|
||||
// 提取排序后字段的name属性值
|
||||
@@ -375,4 +372,26 @@ public class ExcelUtils {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String validPartName(String value, List<SysDictItemCore> listDict) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
return "零部件名称不能为空";
|
||||
}
|
||||
// 检查工作组
|
||||
if (!excelUtils.validDict("part_name", value, null, null, true, listDict)) {
|
||||
return "'零部件名称'无效。";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String validStandardCode(String value, List<SysDictItemCore> listDict) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
return "";
|
||||
}
|
||||
// 检查工作组
|
||||
if (!excelUtils.validDict("enterprise_standard_code", value, null, null, true, listDict)) {
|
||||
return "'企业标准代号'无效。";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user