|
|
@@ -133,6 +133,47 @@ public class ProductUtils {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 分页批量更新物料并添加到个人产品库
|
|
|
+ *
|
|
|
+ * @author dongbw
|
|
|
+ * @param products 要保存的物料信息
|
|
|
+ * @return map结果
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public static ModelMap paginationUpdateAndAddToProductUser(List<Product> products) throws Exception {
|
|
|
+ ModelMap map = new ModelMap();
|
|
|
+ int result = 0;
|
|
|
+ if (!CollectionUtils.isEmpty(products)) {
|
|
|
+ if (products.size() <= ONE_TIME_DATA_SIZE) {
|
|
|
+ map = updateProdInfoAndAddToProductUser(products);
|
|
|
+ } else {
|
|
|
+ List<Product> pageContent = new ArrayList<>();
|
|
|
+ int i = 1;
|
|
|
+ for (Product product : products) {
|
|
|
+ pageContent.add(product);
|
|
|
+ if (i++ % ONE_TIME_DATA_SIZE == 0) {
|
|
|
+ ModelMap modelMap = updateProdInfoAndAddToProductUser(pageContent);
|
|
|
+ if ("false".equals(modelMap.get("success")) && null != modelMap.get("message")) {
|
|
|
+ map.put("message", modelMap.get("message"));
|
|
|
+ }
|
|
|
+ result += (int) (null != modelMap.get("result") ? modelMap.get("result") : 0);
|
|
|
+ pageContent = new ArrayList<>();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!pageContent.isEmpty()) {
|
|
|
+ ModelMap modelMap = updateProdInfoAndAddToProductUser(pageContent);
|
|
|
+ if ("false".equals(modelMap.get("success")) && null != modelMap.get("message")) {
|
|
|
+ map.put("message", modelMap.get("message"));
|
|
|
+ }
|
|
|
+ result += (int) (null != modelMap.get("result") ? modelMap.get("result") : 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("result", result);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 批量更新个人物料
|