|
|
@@ -527,7 +527,6 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
// 检查是否小于最小发货量
|
|
|
if (reserve.doubleValue() < goods.getMinBuyQty().doubleValue()) {
|
|
|
goods.setStatus(Status.UNAVAILABLE.value());
|
|
|
- floorsService.updateHomeInfo(goods.getBatchCode());
|
|
|
}
|
|
|
goodsDao.modifyReserve(goods.getBatchCode(), goods.getUuid(), goods.getReserve(), goods.getStatus().intValue());
|
|
|
// 每次批次保存同时保存一遍历史信息
|
|
|
@@ -2720,8 +2719,6 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
|
|
|
@Override
|
|
|
public ResultMap offShelfGoodsByProvider(String batchCodes, String downMsg, Boolean isERP) {
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- logger.info(String.format("%s 商城测试下架时间记录1", dateFormat.format(new Date())));
|
|
|
if (StringUtils.isEmpty(batchCodes)) {
|
|
|
return new ResultMap(CodeType.NO_INFO.code(), "待下架批次号字符串不能为空");
|
|
|
}
|
|
|
@@ -2732,36 +2729,19 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
Set<String> uuids = new HashSet<>();
|
|
|
List<String> batchCodeList = new ArrayList<>();
|
|
|
|
|
|
- String storeUuid = "";
|
|
|
- logger.info(String.format("%s 商城测试下架时间记录2", dateFormat.format(new Date())));
|
|
|
+ List<Goods> list = new ArrayList<>();
|
|
|
for (String batchCode : batchCodeArr) {
|
|
|
- logger.info(String.format("%s 商城测试下架时间记录 调用下架方法开始", dateFormat.format(new Date())));
|
|
|
ResultMap resultMap = offShelfOneGoodsByProvider(batchCode, downMsg, isERP);
|
|
|
- logger.info(String.format("%s 商城测试下架时间记录 调用下架方法结束", dateFormat.format(new Date())));
|
|
|
if (resultMap.isSuccess()) {
|
|
|
Goods goods = (Goods) resultMap.getData();
|
|
|
if (goods.getUuid() != null) {
|
|
|
uuids.add(goods.getUuid());
|
|
|
}
|
|
|
batchCodeList.add(goods.getBatchCode());
|
|
|
-
|
|
|
- storeUuid = goods.getStoreid();
|
|
|
+ list.add(goods);
|
|
|
}
|
|
|
}
|
|
|
- for (String uuid : uuids) {
|
|
|
- logger.info(String.format("%s 商城测试下架时间记录 更新器件库存信息 开始", dateFormat.format(new Date())));
|
|
|
- updateComponentTradeInfos(uuid);
|
|
|
- logger.info(String.format("%s 商城测试下架时间记录 更新器件库存信息 结束", dateFormat.format(new Date())));
|
|
|
- }
|
|
|
-
|
|
|
- if (!StringUtils.isEmpty(storeUuid)) {
|
|
|
- logger.info(String.format("%s 商城测试下架时间记录 更新推荐库存信息开始", dateFormat.format(new Date())));
|
|
|
- List<String> list = Arrays.asList(batchCodeArr);
|
|
|
- Set<String> batchCodeSet = new HashSet<>(list);
|
|
|
- recommendProductService.deleteProductsWhenSellerUpdateReserve(storeUuid, batchCodeSet);
|
|
|
- logger.info(String.format("%s 商城测试下架时间记录 更新推荐库存信息结束", dateFormat.format(new Date())));
|
|
|
- }
|
|
|
-
|
|
|
+ afterDownGoodsDo(list);
|
|
|
if (batchCodeList.size() == 0) {
|
|
|
return new ResultMap(CodeType.ERROR_STATE.code(), "下架商品失败");
|
|
|
} else {
|
|
|
@@ -2769,6 +2749,48 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 在售产品下架之后,需要做的一系列动作,放到这里
|
|
|
+ * 1,修改推荐产品、2、首页推荐、3、统计在售产品
|
|
|
+ * @param list
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void afterDownGoodsDo(List<Goods> list) {
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ final Map<String, Set<String>> map = new HashedMap();
|
|
|
+ final Set<String> uids = new HashSet<>();
|
|
|
+ for (Goods goods : list) {
|
|
|
+ Set<String> list1 = map.get(goods.getStoreid());
|
|
|
+ if (list1 == null) {
|
|
|
+ list1 = new HashSet<>();
|
|
|
+ }
|
|
|
+ list1.add(goods.getBatchCode());
|
|
|
+ map.put(goods.getStoreid(), list1);
|
|
|
+ uids.add(goods.getUuid());
|
|
|
+ }
|
|
|
+ final Runnable afterDownGoodsDo = new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ Set<String> stores = map.keySet();
|
|
|
+ for (String store : stores) {
|
|
|
+ recommendProductService.deleteProductsWhenSellerUpdateReserve(store, map.get(store));
|
|
|
+ }
|
|
|
+
|
|
|
+ for (String uid : uids) {
|
|
|
+ updateComponentTradeInfos(uid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ try {
|
|
|
+ executor.submitTask(afterDownGoodsDo);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 下架单个批次商品
|
|
|
*
|
|
|
@@ -2820,7 +2842,6 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
//下架对应的批次 目前确定下架之后不做删除动作。
|
|
|
// goodsDao.deleteByBatchCode(goods.getBatchCode());
|
|
|
// 需要替换首页的信息。
|
|
|
- floorsService.updateHomeInfo(updateGoods.getBatchCode());
|
|
|
return ResultMap.success(updateGoods);
|
|
|
}
|
|
|
|
|
|
@@ -3205,7 +3226,6 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
|
|
|
GoodsHistory goodsHistory = goodsHistoryService.converTGoodsHist(goods, "批量下架公司产品",false);
|
|
|
goodsHistory.setMessage(goodsHistory.getMessage() + "该批次下架");
|
|
|
- goodsHistoryService.save(goodsHistory);
|
|
|
histories.add(goodsHistory);
|
|
|
goodsUpdate.add(goods);
|
|
|
|
|
|
@@ -3213,10 +3233,8 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
}
|
|
|
|
|
|
goodsDao.save(goodsUpdate);
|
|
|
- goodsHistoryDao.save(histories);
|
|
|
- for (String uuid : uuids) {
|
|
|
- updateComponentTradeInfos(uuid);
|
|
|
- }
|
|
|
+ goodsHistoryService.save(histories);
|
|
|
+ afterDownGoodsDo(goodsUpdate);
|
|
|
return ResultMap.success(goodsUpdate.size());
|
|
|
}
|
|
|
|
|
|
@@ -3241,7 +3259,6 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
List<Order> orders = detailService.updateOrderDetailsByGoods(goods);
|
|
|
orderService.save(orders);
|
|
|
|
|
|
- Boolean aBoolean = floorsService.updateHomeInfo(goods.getBatchCode());
|
|
|
List<GoodsHistory> histories = new ArrayList<>();
|
|
|
if (goods.getStatus().equals(Status.AVAILABLE.value()) || goods.getStatus().equals(Status.UNAVAILABLE.value())) {
|
|
|
//先做下架记录
|
|
|
@@ -3538,7 +3555,6 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
List<Order> orders = detailService.updateOrderDetailsByGoods(goods);
|
|
|
orderService.save(orders);
|
|
|
|
|
|
- Boolean aBoolean = floorsService.updateHomeInfo(goods.getBatchCode());
|
|
|
List<GoodsHistory> histories = new ArrayList<>();
|
|
|
if (goods.getStatus().equals(Status.AVAILABLE.value()) || goods.getStatus().equals(Status.UNAVAILABLE.value())) {
|
|
|
//先做下架记录
|
|
|
@@ -3624,19 +3640,12 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
|
|
|
orders.addAll(detailService.updateOrderDetailsByGoods(goods));
|
|
|
|
|
|
-
|
|
|
- Boolean aBoolean = floorsService.updateHomeInfo(goods.getBatchCode());
|
|
|
-
|
|
|
if (goods.getStatus().equals(Status.AVAILABLE.value()) || goods.getStatus().equals(Status.UNAVAILABLE.value())) {
|
|
|
goods.setStatus(Status.REMOVED.value());
|
|
|
- GoodsHistory goodsHistoryRemoved = goodsHistoryService.converTGoodsHist(goods, OperateType.Down.getPhrase(),false);
|
|
|
+ GoodsHistory goodsHistoryRemoved = goodsHistoryService.converTGoodsHist(goods, OperateType.Down.getPhrase(), false);
|
|
|
histories.add(goodsHistoryRemoved);
|
|
|
}
|
|
|
//删除库存信息
|
|
|
- goods.setStatus(Status.REMOVED.value());
|
|
|
- GoodsHistory goodsHistoryDown = goodsHistoryService.converTGoodsHist(goods, OperateType.Down.getPhrase(),false);
|
|
|
- histories.add(goodsHistoryDown);
|
|
|
- //删除库存信息
|
|
|
goods.setStatus(Status.DELETED.value());
|
|
|
GoodsHistory goodsHistoryDelete = goodsHistoryService.converTGoodsHist(goods, OperateType.DELETE.getPhrase(),false);
|
|
|
histories.add(goodsHistoryDelete);
|