Commit 76dfb7cf authored by 侯彦文's avatar 侯彦文

Merge remote-tracking branch 'origin/master'

parents 95a001c6 22f9a5a5
...@@ -40,8 +40,12 @@ public class ExtIEDPlanController<V extends ExtIEDPlanVO, S extends ExtIEDPlanSe ...@@ -40,8 +40,12 @@ public class ExtIEDPlanController<V extends ExtIEDPlanVO, S extends ExtIEDPlanSe
*/ */
@ApiOperation("导入IED计划") @ApiOperation("导入IED计划")
@PostMapping(value = "/importIEDPlan") @PostMapping(value = "/importIEDPlan")
public ApiResult importPlan(@RequestParam("file") MultipartFile uploadFile,@RequestParam("projectId") String projectId) throws IOException { public ApiResult importPlan(
return ApiResult.ok(extIEDPlanService. importIEDPlan(uploadFile.getInputStream(),projectId),"IED计划导入成功"); @RequestParam("file") MultipartFile uploadFile,
@RequestParam("projectId") String projectId,
@RequestParam("projectSecret") String projectSecret
) throws IOException {
return ApiResult.ok(extIEDPlanService. importIEDPlan(uploadFile.getInputStream(),projectId,projectSecret),"IED计划导入成功");
} }
/** /**
......
...@@ -72,6 +72,8 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel ...@@ -72,6 +72,8 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
*/ */
private String projectId; private String projectId;
private String projectSecret;
/** /**
* excel操作符集合 * excel操作符集合
*/ */
...@@ -80,13 +82,14 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel ...@@ -80,13 +82,14 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
public IEDPlanExcelListenner() { public IEDPlanExcelListenner() {
} }
public IEDPlanExcelListenner(String projectId) { public IEDPlanExcelListenner(String projectId,String projectSecret) {
this.extIEDPlanService = ApplicationContextUtil.getBean(ExtIEDPlanService.class); this.extIEDPlanService = ApplicationContextUtil.getBean(ExtIEDPlanService.class);
this.extIEDPlanDocLinkService = ApplicationContextUtil.getBean(ExtIEDPlanDocLinkService.class); this.extIEDPlanDocLinkService = ApplicationContextUtil.getBean(ExtIEDPlanDocLinkService.class);
this.workFlowUtil = ApplicationContextUtil.getBean(WorkFlowUtil.class); this.workFlowUtil = ApplicationContextUtil.getBean(WorkFlowUtil.class);
this.extDxDocumentServiceFeign = ApplicationContextUtil.getBean(ExtDxDocumentServiceFeign.class); this.extDxDocumentServiceFeign = ApplicationContextUtil.getBean(ExtDxDocumentServiceFeign.class);
this.userUtils = ApplicationContextUtil.getBean(UserUtils.class); this.userUtils = ApplicationContextUtil.getBean(UserUtils.class);
this.projectId = projectId; this.projectId = projectId;
this.projectSecret = projectSecret;
} }
@Override @Override
...@@ -281,9 +284,22 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel ...@@ -281,9 +284,22 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
} }
} }
//编制
extIEDPlanVO.setEditor(extIEDPlanExcelVO.getEditor()); extIEDPlanVO.setEditor(extIEDPlanExcelVO.getEditor());
//校核
extIEDPlanVO.setChecker(extIEDPlanExcelVO.getChecker());
//审核
extIEDPlanVO.setAuditor(extIEDPlanExcelVO.getAuditor());
//审定
extIEDPlanVO.setInvestigator(extIEDPlanExcelVO.getInvestigator());
//批准
extIEDPlanVO.setRatifier(extIEDPlanExcelVO.getRatifier());
Map<String, Object> dynamicAttrs = new HashMap<>(); Map<String, Object> dynamicAttrs = new HashMap<>();
dynamicAttrs.put("editorName", userUtils.getUserById(Long.valueOf(extIEDPlanExcelVO.getEditor())).getName()); dynamicAttrs.put("editorName", userUtils.getUserById(Long.valueOf(extIEDPlanExcelVO.getEditor())).getName());
dynamicAttrs.put("checkerName", userUtils.getUserById(Long.valueOf(extIEDPlanExcelVO.getChecker())).getName());
dynamicAttrs.put("auditorName", userUtils.getUserById(Long.valueOf(extIEDPlanExcelVO.getAuditor())).getName());
dynamicAttrs.put("investigatorName", userUtils.getUserById(Long.valueOf(extIEDPlanExcelVO.getInvestigator())).getName());
dynamicAttrs.put("ratifierName", userUtils.getUserById(Long.valueOf(extIEDPlanExcelVO.getRatifier())).getName());
extIEDPlanVO.setDynamicAttrs(dynamicAttrs); extIEDPlanVO.setDynamicAttrs(dynamicAttrs);
extIEDPlanVO.setChecker(extIEDPlanExcelVO.getChecker()); extIEDPlanVO.setChecker(extIEDPlanExcelVO.getChecker());
extIEDPlanVO.setAuditor(extIEDPlanExcelVO.getAuditor()); extIEDPlanVO.setAuditor(extIEDPlanExcelVO.getAuditor());
...@@ -473,6 +489,21 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel ...@@ -473,6 +489,21 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
extIEDPlanExcelVO.setEditor(String.valueOf(dxUserInfoVO.getId())); extIEDPlanExcelVO.setEditor(String.valueOf(dxUserInfoVO.getId()));
} }
} }
//校核不能为空,判断该用户是否存在,存在的话,将用户id保存
if (StringUtils.isEmpty(extIEDPlanExcelVO.getChecker())) {
errorString.append("解析到数据第" + excelDataRow + "行文件编号为:" + extIEDPlanExcelVO.getFileNumber() + "的编写者不能为空!!");
errorList.add(errorString);
return;
} else {
DxUserInfoVO dxUserInfoVO = userUtils.getUserByName(extIEDPlanExcelVO.getChecker());
if (ObjectUtils.isEmpty(dxUserInfoVO)) {
errorString.append("解析到数据第" + excelDataRow + "行文件编号为:" + extIEDPlanExcelVO.getFileNumber() + "的校核在系统中未查到!!");
errorList.add(errorString);
return;
} else {
extIEDPlanExcelVO.setChecker(String.valueOf(dxUserInfoVO.getId()));
}
}
//审核不是空,判断该用户是否存在,存在的话,将用户id保存 //审核不是空,判断该用户是否存在,存在的话,将用户id保存
if (!StringUtils.isEmpty(extIEDPlanExcelVO.getAuditor())) { if (!StringUtils.isEmpty(extIEDPlanExcelVO.getAuditor())) {
DxUserInfoVO dxUserInfoVO = userUtils.getUserByName(extIEDPlanExcelVO.getAuditor()); DxUserInfoVO dxUserInfoVO = userUtils.getUserByName(extIEDPlanExcelVO.getAuditor());
...@@ -507,6 +538,14 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel ...@@ -507,6 +538,14 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
extIEDPlanExcelVO.setRatifier(String.valueOf(dxUserInfoVO.getId())); extIEDPlanExcelVO.setRatifier(String.valueOf(dxUserInfoVO.getId()));
} }
} }
//校验密级,计划密级不能大于项目密级
if (!StringUtils.isEmpty(extIEDPlanExcelVO.getSecretCode())) {
if(!CommonUtils.verifySecretLevel(projectSecret,extIEDPlanExcelVO.getSecretCode())){
errorString.append("解析到数据第" + excelDataRow + "行文件编号为:" + extIEDPlanExcelVO.getFileNumber() + "的密级不能大于项目密级!!");
errorList.add(errorString);
return;
}
}
} }
} }
...@@ -16,7 +16,7 @@ import java.util.List; ...@@ -16,7 +16,7 @@ import java.util.List;
**/ **/
public interface ExtIEDPlanService<V extends ExtIEDPlanVO> extends ExtIEDPlanServiceShadow<V> { public interface ExtIEDPlanService<V extends ExtIEDPlanVO> extends ExtIEDPlanServiceShadow<V> {
String importIEDPlan(InputStream inputStream,String projectId); String importIEDPlan(InputStream inputStream,String projectId,String projectSecret);
String exportIEDPlan(HttpServletResponse response, List<String> ids) throws IOException; String exportIEDPlan(HttpServletResponse response, List<String> ids) throws IOException;
String createIEDPlanTask(ExtIEDPlanVO extIEDPlanVO); String createIEDPlanTask(ExtIEDPlanVO extIEDPlanVO);
String updatePlanState(Long id,String planState); String updatePlanState(Long id,String planState);
......
...@@ -76,9 +76,9 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan ...@@ -76,9 +76,9 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
@Override @Override
public String importIEDPlan(InputStream inputStream, String projectId) { public String importIEDPlan(InputStream inputStream, String projectId,String projectSecret) {
EasyExcel.read(inputStream, ExtIEDPlanExcelVO.class, EasyExcel.read(inputStream, ExtIEDPlanExcelVO.class,
new IEDPlanExcelListenner(projectId)) new IEDPlanExcelListenner(projectId,projectSecret))
.sheet() .sheet()
.doRead(); .doRead();
return ApiResult.SUCCESS; return ApiResult.SUCCESS;
...@@ -152,11 +152,11 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan ...@@ -152,11 +152,11 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
if (!ObjectUtil.isEmpty(extIEDPlanVO.getFileSubmitTime())) { if (!ObjectUtil.isEmpty(extIEDPlanVO.getFileSubmitTime())) {
extIEDPlanExcelVO.setFileSubmitTime(extIEDPlanVO.getFileSubmitTime().format(DateTimeFormatter.ISO_DATE)); extIEDPlanExcelVO.setFileSubmitTime(extIEDPlanVO.getFileSubmitTime().format(DateTimeFormatter.ISO_DATE));
} }
extIEDPlanExcelVO.setEditor(extIEDPlanVO.getEditor()); extIEDPlanExcelVO.setEditor(extIEDPlanVO.getDynamicAttrs().get("userName").toString());
extIEDPlanExcelVO.setChecker(extIEDPlanVO.getChecker()); extIEDPlanExcelVO.setChecker(extIEDPlanVO.getDynamicAttrs().get("checkerName").toString());
extIEDPlanExcelVO.setAuditor(extIEDPlanVO.getAuditor()); extIEDPlanExcelVO.setAuditor(extIEDPlanVO.getDynamicAttrs().get("auditorName").toString());
extIEDPlanExcelVO.setInvestigator(extIEDPlanVO.getInvestigator()); extIEDPlanExcelVO.setInvestigator(extIEDPlanVO.getDynamicAttrs().get("investigatorName").toString());
extIEDPlanExcelVO.setRatifier(extIEDPlanVO.getRatifier()); extIEDPlanExcelVO.setRatifier(extIEDPlanVO.getDynamicAttrs().get("ratifierName").toString());
extIEDPlanExcelVO.setNote(extIEDPlanVO.getNote()); extIEDPlanExcelVO.setNote(extIEDPlanVO.getNote());
//获取密级code //获取密级code
String secretCode = CommonUtils.searchDictDataValueByDictCode(Constants.SECRET_CODE, extIEDPlanVO.getSecretCode()); String secretCode = CommonUtils.searchDictDataValueByDictCode(Constants.SECRET_CODE, extIEDPlanVO.getSecretCode());
...@@ -204,6 +204,14 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan ...@@ -204,6 +204,14 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
dynamicAttrs.put("phase", extIEDPlanVO.getPhase()); dynamicAttrs.put("phase", extIEDPlanVO.getPhase());
//编写者 //编写者
dynamicAttrs.put("editor", extIEDPlanVO.getEditor()); dynamicAttrs.put("editor", extIEDPlanVO.getEditor());
//校核
dynamicAttrs.put("checker", extIEDPlanVO.getChecker());
//审核
dynamicAttrs.put("auditor", extIEDPlanVO.getAuditor());
//审定
dynamicAttrs.put("investigator", extIEDPlanVO.getInvestigator());
//批准
dynamicAttrs.put("ratifier", extIEDPlanVO.getRatifier());
//设置动态属性 //设置动态属性
dxDocumentVO.setDynamicAttrs(dynamicAttrs); dxDocumentVO.setDynamicAttrs(dynamicAttrs);
//创建时间 //创建时间
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment