|
@@ -3,8 +3,10 @@ package com.bz.smart_city.excel.resolver;
|
|
|
import com.alibaba.druid.sql.visitor.functions.Trim;
|
|
|
import com.bz.smart_city.commom.model.AjaxMessage;
|
|
|
import com.bz.smart_city.commom.model.ResultStatus;
|
|
|
+import com.bz.smart_city.commom.util.JacksonUtil;
|
|
|
import com.bz.smart_city.dao.CommunityMapper;
|
|
|
import com.bz.smart_city.dao.CustomerMapper;
|
|
|
+import com.bz.smart_city.dto.CommunityDto;
|
|
|
import com.bz.smart_city.dto.DeviceTypeDto;
|
|
|
import com.bz.smart_city.dto.pay.InstallPlanDataDTO;
|
|
|
import com.bz.smart_city.dto.pay.InstallPlanInputDTO;
|
|
@@ -80,19 +82,21 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
|
|
|
messageContent.append(ResultStatus.CUSTOMER_IS_NOT_EXISTED.getMessage());
|
|
|
continue;
|
|
|
}
|
|
|
- Customer customer = customerMapper.findByName(record.getSiteId(),customerNameCell.getStringCellValue().trim());
|
|
|
- if(customer==null){
|
|
|
+ //Customer customer = customerMapper.findByName(record.getSiteId(),customerNameCell.getStringCellValue().trim());
|
|
|
+ Customer customer = customerMapper.findById(record.getCustomerId());
|
|
|
+ if(customer==null || !customer.getCustomerName().equals(customerNameCell.getStringCellValue().trim())){
|
|
|
messageContent.append("导入失败,");
|
|
|
messageContent.append(ResultStatus.CUSTOMER_IS_NOT_EXISTED.getMessage());
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- Community community = communityMapper.findByName(record.getSiteId(),communityNameCell.getStringCellValue().trim());
|
|
|
- if (community == null) {
|
|
|
+ List<CommunityDto> communityDtos = communityMapper.getList(null,record.getCustomerId(),communityNameCell.getStringCellValue().trim(),null,null,null);
|
|
|
+ if (communityDtos == null || communityDtos.get(0) == null) {
|
|
|
messageContent.append("导入失败,");
|
|
|
messageContent.append(ResultStatus.COMMUNITY_IS_NOT_EXISTED.getMessage());
|
|
|
continue;
|
|
|
}
|
|
|
+ Community community = communityDtos.get(0);
|
|
|
|
|
|
|
|
|
Cell numberCell = hssfSheet.getRow(3).getCell(4);// 安装数字,只处理指定安装户数的数据
|
|
@@ -119,6 +123,9 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
|
|
|
messageContent.append(ResultStatus.DEVICE_TYPE_NOT_EXISTED.getMessage());
|
|
|
continue;
|
|
|
}
|
|
|
+ List<DeviceTypeDto> deviceTypeDtos = DeviceTypeAjax.getData();
|
|
|
+
|
|
|
+
|
|
|
|
|
|
// 2,处理明细行数据
|
|
|
for (int rowNum = 9; rowNum < 9+number ; rowNum++) {
|
|
@@ -189,12 +196,20 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
|
|
|
String str = deviceTypeCell.getStringCellValue().trim();
|
|
|
String[] deviceType = StringUtils.split(str,"/");
|
|
|
List<Integer> devieTypeId = new ArrayList();
|
|
|
- for (DeviceTypeDto type :DeviceTypeAjax.getData()){
|
|
|
+
|
|
|
+ for(int i=0;i<deviceTypeDtos.size();i++){
|
|
|
+ if (deviceTypeDtos.get(i).getEquipmentType().equals(deviceType[1])
|
|
|
+ && deviceTypeDtos.get(i).getModel().equals(deviceType[2])){
|
|
|
+ devieTypeId.add(deviceTypeDtos.get(i).getId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /* for (DeviceTypeDto type :deviceTypeDtos){
|
|
|
if(type.getEquipmentType().equals(deviceType[1]) && type.getModel().equals(deviceType[2])){
|
|
|
devieTypeId.add(type.getId());
|
|
|
break;
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
installPlanInput.setDeviceTypeIds(devieTypeId);
|
|
|
|
|
|
//地址
|