Commit ead13b20 authored by wangqiang's avatar wangqiang

IED计划导入添加项目id

parent a4ec1f62
......@@ -40,8 +40,8 @@ public class ExtIEDPlanController<V extends ExtIEDPlanVO, S extends ExtIEDPlanSe
*/
@ApiOperation("导入IED计划")
@PostMapping(value = "/importIEDPlan")
public ApiResult importPlan(@RequestParam("file") MultipartFile uploadFile) throws IOException {
return ApiResult.ok(extIEDPlanService. importIEDPlan(uploadFile.getInputStream()),"IED计划导入成功");
public ApiResult importPlan(@RequestParam("file") MultipartFile uploadFile,@RequestParam("projectId") String projectId) throws IOException {
return ApiResult.ok(extIEDPlanService. importIEDPlan(uploadFile.getInputStream(),projectId),"IED计划导入成功");
}
/**
......
......@@ -56,14 +56,21 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
*/
List<StringBuffer> errorList = new ArrayList<>();
/**
* 项目id
*/
private String projectId;
/**
* excel操作符集合
*/
List<String> operationList = Arrays.asList(Constants.EXCEL_ADD, Constants.EXCEL_UPDATE, Constants.EXCEL_DELETE);
public IEDPlanExcelListenner() {}
public IEDPlanExcelListenner() {
public IEDPlanExcelListenner(String projectId) {
this.extIEDPlanService = ApplicationContextUtil.getBean(ExtIEDPlanService.class);
this.projectId = projectId;
}
@Override
......@@ -74,8 +81,6 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
log.info("解析到一条数据:{}", extIEDPlanExcelVO);
//检查excel数据合法性
checkDataForExcel(extIEDPlanExcelVO);
}else {
log.info("解析到数据第{}行是空白数据请检查数据!",excelDataRow);
}
......@@ -188,6 +193,7 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
//获取密级code
String secretCode = CommonUtils.searchDictDataByDictCode(Constants.SECRET_CODE, extIEDPlanExcelVO.getSecretCode());
extIEDPlanVO.setSecretCode(secretCode);
extIEDPlanVO.setDxContextId(Long.parseLong(projectId));
}
......
......@@ -65,11 +65,8 @@ public class PurchasePlanExcelReadListenner extends AnalysisEventListener<ExtPuc
log.info("解析到一条数据:{}", extPuchasePlanExcelVO);
if(!CommonUtils.checkAllPropertiesIsEmpty(extPuchasePlanExcelVO)){
cachedDataList.add(extPuchasePlanExcelVO);
}else {
log.info("解析到数据第{}行是空白数据请检查数据!",excelDataRow);
}
}
@Override
......
......@@ -16,6 +16,6 @@ import java.util.List;
**/
public interface ExtIEDPlanService<V extends ExtIEDPlanVO> extends ExtIEDPlanServiceShadow<V> {
String importIEDPlan(InputStream inputStream);
String importIEDPlan(InputStream inputStream,String projectId);
String exportIEDPlan(HttpServletResponse response, List<String> ids) throws IOException;
}
......@@ -63,9 +63,9 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
private FileManagerFeignService fileManagerFeignService;
@Override
public String importIEDPlan(InputStream inputStream) {
public String importIEDPlan(InputStream inputStream,String projectId) {
EasyExcel.read(inputStream, ExtIEDPlanExcelVO.class,
new IEDPlanExcelListenner())
new IEDPlanExcelListenner(projectId))
.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