|
@@ -11,6 +11,7 @@ import com.platform.dao.entity.sqarepartmanage.SparePartInfo;
|
|
|
import com.platform.dao.entity.store.SpareStore;
|
|
|
import com.platform.dao.vo.export.sb.ExportSbInfoVO;
|
|
|
import com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO;
|
|
|
+import com.platform.dao.vo.sb.SbInfoVO;
|
|
|
import com.platform.office.poi.excel.ExcelImportUtil;
|
|
|
import com.platform.office.poi.excel.entity.ImportParams;
|
|
|
import com.platform.office.poi.excel.imports.CellValueServer;
|
|
@@ -626,6 +627,8 @@ public class CustomExcelImportUtil {
|
|
|
return 7;
|
|
|
} else if ("维修中".equals(stringCellValue) || "待修".equals(stringCellValue)) {
|
|
|
return 8;
|
|
|
+ } else if ("在库".equals(stringCellValue)) {
|
|
|
+ return 1;
|
|
|
} else {
|
|
|
return 2;
|
|
|
}
|
|
@@ -822,7 +825,7 @@ public class CustomExcelImportUtil {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public static List<SbInfo> importSbInfoList(InputStream inputstream) throws IOException, InvalidFormatException {
|
|
|
+ public static List<SbInfoVO> importSbInfoList(InputStream inputstream) throws IOException, InvalidFormatException {
|
|
|
if (inputstream == null) {
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
@@ -837,56 +840,52 @@ public class CustomExcelImportUtil {
|
|
|
}
|
|
|
Sheet sheet = book.getSheetAt(0);
|
|
|
int rowCounts = sheet.getLastRowNum();
|
|
|
- List<SbInfo> result = new ArrayList<>(rowCounts);
|
|
|
- SbInfo record = null;
|
|
|
+ List<SbInfoVO> result = new ArrayList<>(rowCounts);
|
|
|
+ SbInfoVO record = null;
|
|
|
|
|
|
StringBuffer error = new StringBuffer();
|
|
|
- for (int i = 1; i <= rowCounts; i++) {
|
|
|
- record = new SbInfo();
|
|
|
+ for (int i = 2; i <= rowCounts; i++) {
|
|
|
+ record = new SbInfoVO();
|
|
|
Row row = sheet.getRow(i);
|
|
|
String index = row.getCell(0).getStringCellValue() + "";
|
|
|
try {
|
|
|
//i,j i:行 j:列
|
|
|
- record.setSaveUser(row.getCell(4).getStringCellValue());
|
|
|
- record.setRepairUser(row.getCell(5).getStringCellValue());
|
|
|
- record.setName(row.getCell(8).getStringCellValue().trim().replace("'", ""));
|
|
|
- record.setModel(getCellValue(row.getCell(9)).trim());
|
|
|
- record.setNo(row.getCell(11).getStringCellValue().trim());
|
|
|
- record.setZbh(getCellValue(row.getCell(12)));
|
|
|
- record.setCardNo(getCellValue(row.getCell(13)).trim());
|
|
|
- record.setFinancingNo(row.getCell(14).getStringCellValue().trim());
|
|
|
- record.setCph(getCellValue(row.getCell(15)));
|
|
|
- record.setFdjxh(getCellValue(row.getCell(16)));
|
|
|
- record.setFdjh(getCellValue(row.getCell(17)));
|
|
|
- record.setDph(getCellValue(row.getCell(18)));
|
|
|
- record.setZz(getCellValue(row.getCell(19)));
|
|
|
- record.setZaiz(getCellValue(row.getCell(20)));
|
|
|
- record.setInitialValue(new Double(getCellValue(row.getCell(21))));
|
|
|
- record.setCurrentValue(new Double(getCellValue(row.getCell(22))));
|
|
|
-
|
|
|
- if (StringUtils.isBlank(getCellValue(row.getCell(23)))) {
|
|
|
+ record.setNo(row.getCell(1).getStringCellValue().trim());
|
|
|
+ record.setZbh(getCellValue(row.getCell(2)));
|
|
|
+ record.setName(row.getCell(3).getStringCellValue().trim().replace("'", ""));
|
|
|
+ record.setModel(getCellValue(row.getCell(4)).trim());
|
|
|
+ record.setLevel(getLevel(row.getCell(5).getStringCellValue()));
|
|
|
+ record.setInitialValue(new Double(getCellValue(row.getCell(6))));
|
|
|
+ record.setTypeId(row.getCell(7).getStringCellValue().trim());
|
|
|
+ record.setUseType(getUseType(row.getCell(8).getStringCellValue().trim()));
|
|
|
+ record.setZz(getCellValue(row.getCell(9)));
|
|
|
+ record.setCph(getCellValue(row.getCell(10)));
|
|
|
+ record.setZzh(getCellValue(row.getCell(11)));
|
|
|
+ record.setProducerId(row.getCell(12).getStringCellValue().trim());
|
|
|
+ record.setSaveUserName(row.getCell(13).getStringCellValue().trim());
|
|
|
+ record.setRepairUserName(row.getCell(14).getStringCellValue().trim());
|
|
|
+ record.setRepairUserNameSecond(row.getCell(15).getStringCellValue().trim());
|
|
|
+ if (StringUtils.isBlank(getCellValue(row.getCell(16)))) {
|
|
|
record.setBuyDate(DateUtils.strToLocalDate("2014-01-01", DateUtils.PATTERN_YMD));
|
|
|
} else {
|
|
|
- record.setBuyDate(DateUtils.strToLocalDate((getCellValue(row.getCell(23)).substring(0, 4) + "-01-01"), DateUtils.PATTERN_YMD));
|
|
|
+ record.setBuyDate(DateUtils.strToLocalDate((getCellValue(row.getCell(16)).substring(0, 4) + "-01-01"), DateUtils.PATTERN_YMD));
|
|
|
}
|
|
|
-
|
|
|
- //record.setStartDate(DateUtils.strToLocalDate( "2019-01-01", DateUtils.PATTERN_YMD));
|
|
|
- if (StringUtils.isBlank(getCellValue(row.getCell(24)))) {
|
|
|
+ if (StringUtils.isBlank(getCellValue(row.getCell(17)))) {
|
|
|
record.setStartDate(DateUtils.strToLocalDate("2019-01-01", DateUtils.PATTERN_YMD));
|
|
|
} else {
|
|
|
- if (getCellValue(row.getCell(24)).contains(".")) {
|
|
|
- if (getCellValue(row.getCell(24)).contains("E7")) {
|
|
|
- record.setStartDate(DateUtils.strToLocalDate(getCellValue(row.getCell(24)).replace(".", "").replace("E7", ""), DateUtils.PATTERNYMD));
|
|
|
- } else if (getCellValue(row.getCell(24)).endsWith(".0")) {
|
|
|
- record.setStartDate(DateUtils.strToLocalDate(ExcelDoubleToDate(getCellValue(row.getCell(24))), DateUtils.PATTERN_YMD));
|
|
|
+ if (getCellValue(row.getCell(17)).contains(".")) {
|
|
|
+ if (getCellValue(row.getCell(17)).contains("E7")) {
|
|
|
+ record.setStartDate(DateUtils.strToLocalDate(getCellValue(row.getCell(17)).replace(".", "").replace("E7", ""), DateUtils.PATTERNYMD));
|
|
|
+ } else if (getCellValue(row.getCell(17)).endsWith(".0")) {
|
|
|
+ record.setStartDate(DateUtils.strToLocalDate(ExcelDoubleToDate(getCellValue(row.getCell(17))), DateUtils.PATTERN_YMD));
|
|
|
} else {
|
|
|
- record.setStartDate(DateUtils.strToLocalDate(getCellValue(row.getCell(24)), DateUtils.PATTERN_YMD_DOT));
|
|
|
+ record.setStartDate(DateUtils.strToLocalDate(getCellValue(row.getCell(17)), DateUtils.PATTERN_YMD_DOT));
|
|
|
}
|
|
|
- } else if (getCellValue(row.getCell(24)).contains("-")) {
|
|
|
- record.setStartDate(DateUtils.strToLocalDate(getCellValue(row.getCell(24)), DateUtils.PATTERN_YMD));
|
|
|
+ } else if (getCellValue(row.getCell(17)).contains("-")) {
|
|
|
+ record.setStartDate(DateUtils.strToLocalDate(getCellValue(row.getCell(17)), DateUtils.PATTERN_YMD));
|
|
|
} else {
|
|
|
- if(getCellValue(row.getCell(24)).contains("/")){
|
|
|
- String[] strList = getCellValue(row.getCell(24)).split("/");
|
|
|
+ if(getCellValue(row.getCell(17)).contains("/")){
|
|
|
+ String[] strList = getCellValue(row.getCell(17)).split("/");
|
|
|
if(strList.length == 3){
|
|
|
if(strList[1].length() == 1){
|
|
|
strList[1] = "0" + strList[1];
|
|
@@ -898,18 +897,12 @@ public class CustomExcelImportUtil {
|
|
|
String newDate = strList[0] + "-" + strList[1] + "-" + strList[2];
|
|
|
record.setStartDate(DateUtils.strToLocalDate(newDate, DateUtils.PATTERN_YMD));
|
|
|
}else{
|
|
|
- record.setStartDate(DateUtils.strToLocalDate(getCellValue(row.getCell(24)), DateUtils.PATTERNYMD));
|
|
|
+ record.setStartDate(DateUtils.strToLocalDate(getCellValue(row.getCell(17)), DateUtils.PATTERNYMD));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- record.setStatus(getSbInfoStatus(row.getCell(26).getStringCellValue()));
|
|
|
-
|
|
|
- //if(StringUtils.isBlank(getCellValue(row.getCell(27)))) {
|
|
|
- // throw new BusinessException("请在备注一栏填写分公司简码");
|
|
|
- // }else{
|
|
|
- // record.setNo(row.getCell(27).getStringCellValue().trim() + '-' + row.getCell(11).getStringCellValue().trim());
|
|
|
- //}
|
|
|
- record.setUseArea("5e64ac691c527828b2114da0");
|
|
|
+ record.setStatus(getSbInfoStatus(row.getCell(18).getStringCellValue()));
|
|
|
+ record.setRemark(row.getCell(19).getStringCellValue().trim());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
error.append(index).append(",");
|