|
@@ -1,5 +1,6 @@
|
|
package com.zcxk.rmcp.web.service.install.impl;
|
|
package com.zcxk.rmcp.web.service.install.impl;
|
|
|
|
|
|
|
|
+import com.alibaba.excel.exception.ExcelAnalysisException;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.zcxk.core.common.enums.StatusEnum;
|
|
import com.zcxk.core.common.enums.StatusEnum;
|
|
@@ -347,30 +348,30 @@ public class InstallPlanServiceImpl implements InstallPlanService {
|
|
public InstallPlan createPlanExcel(ExcelData excelData) {
|
|
public InstallPlan createPlanExcel(ExcelData excelData) {
|
|
InstallPlanInfoData infoData = excelData.getInstallPlanInfoData();
|
|
InstallPlanInfoData infoData = excelData.getInstallPlanInfoData();
|
|
if(installPlanMapper.findByNameUnique(excelData.getImportFile().getTenantId(),infoData.getInstallPlanName()) > 0){
|
|
if(installPlanMapper.findByNameUnique(excelData.getImportFile().getTenantId(),infoData.getInstallPlanName()) > 0){
|
|
- throw BusinessException.builder(RmcpErrorEnum.RMCP_PLAN_NAME_UNIQUE_ERROR);
|
|
|
|
|
|
+ throw new ExcelAnalysisException(RmcpErrorEnum.RMCP_PLAN_NAME_UNIQUE_ERROR.getMessage());
|
|
}
|
|
}
|
|
// 2、小区查询
|
|
// 2、小区查询
|
|
Community community = null;
|
|
Community community = null;
|
|
if(StringUtils.isNotEmpty(infoData.getCommunityName())){
|
|
if(StringUtils.isNotEmpty(infoData.getCommunityName())){
|
|
community = communityService.findByName(excelData.getImportFile().getTenantId(),infoData.getCommunityName());
|
|
community = communityService.findByName(excelData.getImportFile().getTenantId(),infoData.getCommunityName());
|
|
- if (community == null) throw BusinessException.builder("小区不存在");
|
|
|
|
|
|
+ if (community == null) throw new ExcelAnalysisException("小区不存在");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
// 3、公司部门查询
|
|
// 3、公司部门查询
|
|
Org companyOrg = orgService.findByName(excelData.getImportFile().getTenantId(),infoData.getCompanyName());
|
|
Org companyOrg = orgService.findByName(excelData.getImportFile().getTenantId(),infoData.getCompanyName());
|
|
- if (companyOrg == null) throw BusinessException.builder("公司不存在");
|
|
|
|
|
|
+ if (companyOrg == null) throw new ExcelAnalysisException("公司不存在");
|
|
|
|
|
|
Org deptOrg = null;
|
|
Org deptOrg = null;
|
|
if(StringUtils.isNotEmpty(infoData.getDeptName())){
|
|
if(StringUtils.isNotEmpty(infoData.getDeptName())){
|
|
deptOrg = orgService.findByParentIdAndName(companyOrg.getId(),infoData.getDeptName());
|
|
deptOrg = orgService.findByParentIdAndName(companyOrg.getId(),infoData.getDeptName());
|
|
- if (deptOrg == null) throw BusinessException.builder("部门不存在");
|
|
|
|
|
|
+ if (deptOrg == null) throw new ExcelAnalysisException("部门不存在");
|
|
}
|
|
}
|
|
|
|
|
|
// 4、产品(设备类型)查询
|
|
// 4、产品(设备类型)查询
|
|
String[] deviceType = StringUtils.split(infoData.getDeviceTypeName(),"/");
|
|
String[] deviceType = StringUtils.split(infoData.getDeviceTypeName(),"/");
|
|
Product product = productService.getByName(deviceType[1],deviceType[2]);
|
|
Product product = productService.getByName(deviceType[1],deviceType[2]);
|
|
- if (product == null) throw BusinessException.builder("设备型号不存在");
|
|
|
|
|
|
+ if (product == null) throw new ExcelAnalysisException("设备型号不存在");
|
|
|
|
|
|
InstallPlan installPlan = new InstallPlan();
|
|
InstallPlan installPlan = new InstallPlan();
|
|
installPlan.setPlanName(infoData.getInstallPlanName());
|
|
installPlan.setPlanName(infoData.getInstallPlanName());
|