Commit ad8034bf authored by wangqiang's avatar wangqiang

ICM计划导入、导出功能开发(已测试)

parent a8cacbfb
......@@ -10,10 +10,7 @@ import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.utils.SearchUtil;
import com.yonde.dcs.plan.common.vo.ExtICMExternalInterfacePlanVO;
import com.yonde.dcs.plan.common.vo.ExtICMPlanExcelVO;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanExcelVO;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO;
import com.yonde.dcs.plan.core.service.ExtICMExternalInterfacePlanService;
import com.yonde.dcs.plan.core.service.ExtIEDPlanService;
import com.yonde.dcs.plan.core.util.CommonUtils;
import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchItems;
......@@ -95,21 +92,21 @@ public class ICMPlanExcelListenner extends AnalysisEventListener<ExtICMPlanExcel
// 收尾工作,处理剩下的缓存数据。。。
log.info("sheet={} 所有数据解析完成!", analysisContext.readSheetHolder().getSheetName());
if (errorList.size() > 0) {
throw new DxBusinessException("-1", "IED计划数据有误!!" + errorList.toString());
throw new DxBusinessException("-1", "ICM计划数据有误!!" + errorList.toString());
}
//处理全部检查通过的数据
for (ExtICMPlanExcelVO extICMPlanExcelVO : cachedDataList) {
ExtICMExternalInterfacePlanVO extICMPlanVO = new ExtICMExternalInterfacePlanVO();
extICMPlanVO.setDxContextId(Long.parseLong(projectId));
//将excel对象转换为po对象
BeanUtil.copyProperties(extICMPlanExcelVO,extICMPlanVO);
if (Constants.EXCEL_ADD.equals(extICMPlanExcelVO.getOperation())) {//新增
//将excel对象转换为po对象
BeanUtil.copyProperties(extICMPlanExcelVO,extICMPlanVO);
extICMPlanVO.setOperator(OperatorType.ADD);
extICMExternalInterfacePlanService.saveRecursion(extICMPlanVO);
} else if (Constants.EXCEL_UPDATE.equals(extICMPlanExcelVO.getOperation())) {//更新
extICMPlanVO.setOperator(OperatorType.MODIFY);
ExtICMExternalInterfacePlanVO extICMPlanVOForDB = getICMPlanByPlanNumber(extICMPlanExcelVO.getPlanNumber());
BeanUtil.copyProperties(extICMPlanExcelVO,extICMPlanVOForDB);
extICMPlanVOForDB.setOperator(OperatorType.MODIFY);
transitionObject(extICMPlanVOForDB,extICMPlanExcelVO);
extICMExternalInterfacePlanService.saveRecursion(extICMPlanVOForDB);
} else { //删除
ExtICMExternalInterfacePlanVO extICMPlanVOForDB = getICMPlanByPlanNumber(extICMPlanExcelVO.getPlanNumber());
......@@ -174,7 +171,7 @@ public class ICMPlanExcelListenner extends AnalysisEventListener<ExtICMPlanExcel
public ExtICMExternalInterfacePlanVO getICMPlanByPlanNumber(String planNumber) {
//根据文件编号查询IED计划
//根据文件编号查询ICM计划
DxPageImpl<ExtICMExternalInterfacePlanVO> ICMPlanPage = extICMExternalInterfacePlanService.findRecursion(SearchUtil.buildQuery("planNumber", SearchItem.Operator.EQ, planNumber));
if (!CollectionUtils.isEmpty(ICMPlanPage.getContent())) {
ExtICMExternalInterfacePlanVO extICMPlanVOForDB = DxPageUtils.getFirst(ICMPlanPage);
......@@ -199,7 +196,7 @@ public class ICMPlanExcelListenner extends AnalysisEventListener<ExtICMPlanExcel
.build())
.build();
//根据文件编号查询IED计划
//根据文件编号查询ICM计划
DxPageImpl<ExtICMExternalInterfacePlanVO> ICMPlanPage = extICMExternalInterfacePlanService.findRecursion(condition);
if (!CollectionUtils.isEmpty(ICMPlanPage.getContent())) {
ExtICMExternalInterfacePlanVO extICMPlanVOForDB = DxPageUtils.getFirst(ICMPlanPage);
......@@ -210,4 +207,21 @@ public class ICMPlanExcelListenner extends AnalysisEventListener<ExtICMPlanExcel
return null;
}
/**
* 转换数据,将EXCEL对象转换为PO对象
*/
private void transitionObject(ExtICMExternalInterfacePlanVO extICMExternalInterfacePlanVO, ExtICMPlanExcelVO extICMPlanExcelVO) {
extICMExternalInterfacePlanVO.setPlanNumber(extICMPlanExcelVO.getPlanNumber());
extICMExternalInterfacePlanVO.setPublisher(extICMPlanExcelVO.getPublisher());
extICMExternalInterfacePlanVO.setAcceptor(extICMPlanExcelVO.getAcceptor());
extICMExternalInterfacePlanVO.setKeyInterface(extICMPlanExcelVO.getKeyInterface());
extICMExternalInterfacePlanVO.setMilestoneInterface(extICMPlanExcelVO.getMilestoneInterface());
extICMExternalInterfacePlanVO.setInterfaceType(extICMPlanExcelVO.getInterfaceType());
extICMExternalInterfacePlanVO.setPlanOpenDate(extICMPlanExcelVO.getPlanOpenDate());
extICMExternalInterfacePlanVO.setPlanCloseDate(extICMPlanExcelVO.getPlanCloseDate());
extICMExternalInterfacePlanVO.setResponsibilityPerson(extICMPlanExcelVO.getResponsibilityPerson());
extICMExternalInterfacePlanVO.setResponsibilityUnit(extICMPlanExcelVO.getResponsibilityUnit());
extICMExternalInterfacePlanVO.setInterfaceNote(extICMPlanExcelVO.getInterfaceNote());
}
}
......@@ -103,8 +103,8 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
extIEDPlanVO.setOperator(OperatorType.ADD);
extIEDPlanService.saveRecursion(extIEDPlanVO);
} else if (Constants.EXCEL_UPDATE.equals(extIEDPlanExcelVO.getOperation())) {//更新
extIEDPlanVO.setOperator(OperatorType.MODIFY);
ExtIEDPlanVO extIEDPlanVOForDB = getIEDPlanByFileNumber(extIEDPlanExcelVO.getFileNumber());
extIEDPlanVOForDB.setOperator(OperatorType.MODIFY);
transitionObject(extIEDPlanVOForDB,extIEDPlanExcelVO);
extIEDPlanService.saveRecursion(extIEDPlanVOForDB);
} else { //删除
......
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