|
@@ -190,7 +190,7 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
if (headerRow != null) {
|
|
if (headerRow != null) {
|
|
|
for (int r = 3; r <= rowNum; r++) {
|
|
for (int r = 3; r <= rowNum; r++) {
|
|
|
Row row = sheet.getRow(r);
|
|
Row row = sheet.getRow(r);
|
|
|
- if (row != null) {
|
|
|
|
|
|
|
+ if (row != null && row.getCell(1) != null && row.getCell(1).getCellType() != Cell.CELL_TYPE_BLANK) {
|
|
|
total++;
|
|
total++;
|
|
|
ProductTemp temp = new ProductTemp();
|
|
ProductTemp temp = new ProductTemp();
|
|
|
temp.setPr_import_id(importId);
|
|
temp.setPr_import_id(importId);
|
|
@@ -200,7 +200,7 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
temp.setPr_ispurchase(isPurchase);
|
|
temp.setPr_ispurchase(isPurchase);
|
|
|
temp.setPr_sourceapp("B2B");
|
|
temp.setPr_sourceapp("B2B");
|
|
|
// 物料编号
|
|
// 物料编号
|
|
|
- if (row.getCell(0) != null) {
|
|
|
|
|
|
|
+ if (row.getCell(0) != null && row.getCell(0).getCellType() != Cell.CELL_TYPE_BLANK) {
|
|
|
row.getCell(0).setCellType(Cell.CELL_TYPE_STRING);
|
|
row.getCell(0).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
temp.setPr_code(row.getCell(0).getStringCellValue().trim());
|
|
temp.setPr_code(row.getCell(0).getStringCellValue().trim());
|
|
|
} else {
|
|
} else {
|
|
@@ -341,20 +341,25 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
System.out.println("取匹配后结果:" + (System.currentTimeMillis() - start));
|
|
System.out.println("取匹配后结果:" + (System.currentTimeMillis() - start));
|
|
|
start = System.currentTimeMillis();
|
|
start = System.currentTimeMillis();
|
|
|
try {
|
|
try {
|
|
|
- // 更新物料
|
|
|
|
|
- List<Long> idList = ProductUtils.paginationUpdate(products);
|
|
|
|
|
|
|
+ // 更新物料并插入个人物料
|
|
|
|
|
+ ModelMap map = ProductUtils.updateProdInfoAndAddToProductUser(products);
|
|
|
System.out.println("更新物料:" + (System.currentTimeMillis() - start));
|
|
System.out.println("更新物料:" + (System.currentTimeMillis() - start));
|
|
|
- start = System.currentTimeMillis();
|
|
|
|
|
- if (!CollectionUtils.isEmpty(idList)) {
|
|
|
|
|
- // 更新个人物料
|
|
|
|
|
- List<ProductUsers> productUsersList = productTempDao.getNotMatchedProductUsers(importId,
|
|
|
|
|
- temps.get(0).getPr_enuu(), temps.get(0).getPr_useruu(), idList);
|
|
|
|
|
- if (!CollectionUtils.isEmpty(productUsersList)) {
|
|
|
|
|
- ProductUtils.updateProductUsersByBatch(productUsersList);
|
|
|
|
|
- modelMap.put("success", productUsersList.size());
|
|
|
|
|
- System.out.println("更新个人物料:" + (System.currentTimeMillis() - start));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if ("true".equals(map.get("success"))) {
|
|
|
|
|
+ modelMap.put("success", null != map.get("result") ? map.get("result") : 0);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ modelMap.put("error", "物料添加失败(" + null != map.get("message") ? map.get("message") : "" + ")");
|
|
|
}
|
|
}
|
|
|
|
|
+// start = System.currentTimeMillis();
|
|
|
|
|
+// if (!CollectionUtils.isEmpty(idList)) {
|
|
|
|
|
+// // 更新个人物料
|
|
|
|
|
+// List<ProductUsers> productUsersList = productTempDao.getNotMatchedProductUsers(importId,
|
|
|
|
|
+// temps.get(0).getPr_enuu(), temps.get(0).getPr_useruu(), idList);
|
|
|
|
|
+// if (!CollectionUtils.isEmpty(productUsersList)) {
|
|
|
|
|
+// ProductUtils.updateProductUsersByBatch(productUsersList);
|
|
|
|
|
+// modelMap.put("success", productUsersList.size());
|
|
|
|
|
+// System.out.println("更新个人物料:" + (System.currentTimeMillis() - start));
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
modelMap.put("error", "物料添加失败(" + e.getMessage() + ")");
|
|
modelMap.put("error", "物料添加失败(" + e.getMessage() + ")");
|
|
|
}
|
|
}
|