Commit 22f9a5a5 authored by wangqiang's avatar wangqiang

IED计划导入增加 计划密级的不能高于项目密级

parent 546705a0
......@@ -40,8 +40,12 @@ public class ExtIEDPlanController<V extends ExtIEDPlanVO, S extends ExtIEDPlanSe
*/
@ApiOperation("导入IED计划")
@PostMapping(value = "/importIEDPlan")
public ApiResult importPlan(@RequestParam("file") MultipartFile uploadFile,@RequestParam("projectId") String projectId) throws IOException {
return ApiResult.ok(extIEDPlanService. importIEDPlan(uploadFile.getInputStream(),projectId),"IED计划导入成功");
public ApiResult importPlan(
@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
*/
private String projectId;
private String projectSecret;
/**
* excel操作符集合
*/
......@@ -80,13 +82,14 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
public IEDPlanExcelListenner() {
}
public IEDPlanExcelListenner(String projectId) {
public IEDPlanExcelListenner(String projectId,String projectSecret) {
this.extIEDPlanService = ApplicationContextUtil.getBean(ExtIEDPlanService.class);
this.extIEDPlanDocLinkService = ApplicationContextUtil.getBean(ExtIEDPlanDocLinkService.class);
this.workFlowUtil = ApplicationContextUtil.getBean(WorkFlowUtil.class);
this.extDxDocumentServiceFeign = ApplicationContextUtil.getBean(ExtDxDocumentServiceFeign.class);
this.userUtils = ApplicationContextUtil.getBean(UserUtils.class);
this.projectId = projectId;
this.projectSecret = projectSecret;
}
@Override
......@@ -535,6 +538,14 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
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;
**/
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 createIEDPlanTask(ExtIEDPlanVO extIEDPlanVO);
String updatePlanState(Long id,String planState);
......
......@@ -76,9 +76,9 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
@Override
public String importIEDPlan(InputStream inputStream, String projectId) {
public String importIEDPlan(InputStream inputStream, String projectId,String projectSecret) {
EasyExcel.read(inputStream, ExtIEDPlanExcelVO.class,
new IEDPlanExcelListenner(projectId))
new IEDPlanExcelListenner(projectId,projectSecret))
.sheet()
.doRead();
return ApiResult.SUCCESS;
......
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