|
@@ -51,7 +51,7 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
protected void cycleExcel(){
|
|
|
log.info("begin InstallPlanResolverExcelTemplate");
|
|
|
try {
|
|
@@ -59,7 +59,7 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
|
|
|
} catch (InterruptedException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- String executeSheetName = "装表计划模板";
|
|
|
+ String executeSheetName = "安装计划模板";
|
|
|
//InstallListDTO dto = new InstallListDTO();
|
|
|
//dto.setSiteId(record.getSiteId());
|
|
|
//dto.setInstallTime(LocalDateTime.now());
|
|
@@ -74,12 +74,14 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
|
|
|
}
|
|
|
invalidTemplate = true;
|
|
|
// 1,处理表头,解析客户、小区、户数
|
|
|
- Cell comapnyNameCell = hssfSheet.getRow(0).getCell(4);
|
|
|
- Cell departmentNameCell = hssfSheet.getRow(1).getCell(4);
|
|
|
- Cell communityNameCell = hssfSheet.getRow(2).getCell(4);
|
|
|
- Cell numberCell = hssfSheet.getRow(3).getCell(4);// 安装数字,只处理指定安装户数的数据
|
|
|
- Cell installGroupNameCell = hssfSheet.getRow(4).getCell(4);
|
|
|
- Cell phoneCell = hssfSheet.getRow(5).getCell(4);
|
|
|
+ Cell planCell=hssfSheet.getRow(1).getCell(3);
|
|
|
+ Cell comapnyNameCell = hssfSheet.getRow(2).getCell(3);
|
|
|
+ Cell communityNameCell = hssfSheet.getRow(3).getCell(3);
|
|
|
+ Cell productCell = hssfSheet.getRow(4).getCell(3);
|
|
|
+ Cell numberCell=hssfSheet.getRow(5).getCell(3);
|
|
|
+ Cell installGroupNameCell = hssfSheet.getRow(6).getCell(3);
|
|
|
+
|
|
|
+ Cell phoneCell = hssfSheet.getRow(7).getCell(3);
|
|
|
comapnyNameCell.setCellType(CellType.STRING);
|
|
|
installGroupNameCell.setCellType(CellType.STRING);
|
|
|
phoneCell.setCellType(CellType.STRING);
|
|
@@ -105,26 +107,10 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
|
|
|
messageContent.append(ResultStatus.COMMUNITY_IS_NOT_EXISTED.getMessage());
|
|
|
continue;
|
|
|
}
|
|
|
- Integer departId=null;
|
|
|
- String departName = departmentNameCell.getStringCellValue().trim();
|
|
|
- if(!StringUtils.equals("", departName)) {
|
|
|
- orgDto.setOrgName(departName);
|
|
|
- departId = syncDataClient.getOrgId(orgDto);
|
|
|
- }
|
|
|
- Community community = communityDtos.get(0);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- numberCell.setCellType(CellType.NUMERIC);
|
|
|
|
|
|
- int number = ((Double)numberCell.getNumericCellValue()).intValue();
|
|
|
- if(number < 0 || number > 5000) {
|
|
|
- messageContent.append("导入失败,");
|
|
|
- messageContent.append(ResultStatus.NUMBER_IS_OUT_RANGE.getMessage());
|
|
|
- continue;
|
|
|
- }
|
|
|
+ Community community = communityDtos.get(0);
|
|
|
|
|
|
- log.info("info = {},{},{},{},{}",companyName,community.getName(),number,installGroupNameCell.getStringCellValue(),phoneCell.getStringCellValue());
|
|
|
+ log.info("info = {},{},{},{}",companyName,community.getName(),installGroupNameCell.getStringCellValue(),phoneCell.getStringCellValue());
|
|
|
|
|
|
Integer enableUnit = 0;
|
|
|
Integer buildingNum = 0;
|
|
@@ -136,13 +122,18 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
|
|
|
|
|
|
InstallPlanInputDTO installPlanInput = new InstallPlanInputDTO();
|
|
|
installPlanInput.setCompanyOrgId(orgId);
|
|
|
- installPlanInput.setDeptOrgId(departId);
|
|
|
+ numberCell.setCellType(CellType.NUMERIC);
|
|
|
+
|
|
|
+ int number = ((Double)numberCell.getNumericCellValue()).intValue();
|
|
|
+
|
|
|
installPlanInput.setInstallPlanDataList(new ArrayList<>());
|
|
|
installPlanInput.setTenantId(record.getLoginUser().getTenantId());
|
|
|
installPlanInput.setPreInstallNumber(number); //报装客户数
|
|
|
installPlanInput.setCommunityId(community.getId());
|
|
|
+ String[] deviceType = StringUtils.split(productCell.getStringCellValue(),"/");
|
|
|
+ Integer productId = syncDataClient.getProductId(deviceType[1], deviceType[2]);
|
|
|
// 2,处理明细行数据
|
|
|
- for (int rowNum = 9; rowNum < 9+number ; rowNum++) {
|
|
|
+ for (int rowNum = 10; rowNum <=number+10 ; rowNum++) {
|
|
|
Row row = hssfSheet.getRow(rowNum);
|
|
|
if (row != null) {
|
|
|
|
|
@@ -150,18 +141,18 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
|
|
|
Cell unitCell = row.getCell(1);
|
|
|
Cell floorCell = row.getCell(2);
|
|
|
Cell doorNoCell = row.getCell(3);
|
|
|
- Cell deviceTypeCell = row.getCell(4);
|
|
|
- Cell fileNoCell = row.getCell(5);
|
|
|
- Cell userNameCell = row.getCell(6);
|
|
|
- Cell userPhoneCell = row.getCell(7);
|
|
|
- Cell idCardCell = row.getCell(8);
|
|
|
- Cell remarkCell = row.getCell(9);
|
|
|
+
|
|
|
+ Cell fileNoCell = row.getCell(4);
|
|
|
+ Cell userNameCell = row.getCell(5);
|
|
|
+ Cell userPhoneCell = row.getCell(6);
|
|
|
+ Cell idCardCell = row.getCell(7);
|
|
|
+ Cell remarkCell = row.getCell(8);
|
|
|
|
|
|
buildingCell.setCellType(CellType.STRING);
|
|
|
unitCell.setCellType(CellType.STRING);
|
|
|
floorCell.setCellType(CellType.STRING);
|
|
|
doorNoCell.setCellType(CellType.STRING);
|
|
|
- deviceTypeCell.setCellType(CellType.STRING);
|
|
|
+
|
|
|
fileNoCell.setCellType(CellType.STRING);
|
|
|
userNameCell.setCellType(CellType.STRING);
|
|
|
userPhoneCell.setCellType(CellType.STRING);
|
|
@@ -170,15 +161,15 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
|
|
|
|
|
|
if (StringUtils.equals("", buildingCell.getStringCellValue().trim()) &&
|
|
|
StringUtils.equals("", floorCell.getStringCellValue().trim()) &&
|
|
|
- StringUtils.equals("", doorNoCell.getStringCellValue()) &&
|
|
|
- StringUtils.equals("", deviceTypeCell.getStringCellValue().trim())
|
|
|
+ StringUtils.equals("", doorNoCell.getStringCellValue())
|
|
|
+
|
|
|
) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
log.info("Row info = building={},unit={},floor={},doorNo={},deviceType={}",buildingCell.getStringCellValue(),unitCell.getStringCellValue(),floorCell.getStringCellValue(),
|
|
|
- doorNoCell.getStringCellValue(),deviceTypeCell.getStringCellValue());
|
|
|
- //deviceTypeSet.add(deviceTypeCell.getStringCellValue().trim());
|
|
|
+ doorNoCell.getStringCellValue(),productCell.getStringCellValue());
|
|
|
+
|
|
|
|
|
|
|
|
|
installPlanInput.setCustomerId(customerId);
|
|
@@ -191,17 +182,10 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
|
|
|
installPlanInput.setCommunityName(communityNameCell.getStringCellValue());//小区
|
|
|
|
|
|
//设备类型
|
|
|
- String str = deviceTypeCell.getStringCellValue().trim();
|
|
|
- String[] deviceType = StringUtils.split(str,"/");
|
|
|
+
|
|
|
+
|
|
|
List<Integer> devieTypeId = new ArrayList();
|
|
|
- List<DeviceTypeDto> deviceTypeDtos = deviceMapper.findDeivceType();
|
|
|
- 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;
|
|
|
- }
|
|
|
- }
|
|
|
+ devieTypeId.add(productId);
|
|
|
installPlanInput.setDeviceTypeIds(devieTypeId);
|
|
|
|
|
|
//地址
|