|
|
@@ -1567,22 +1567,21 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
if (resultMap.getCode() != CodeType.OK.code()) {
|
|
|
return null;
|
|
|
}
|
|
|
- GoodsHistory history = goodsHistoryService.converTGoodsHist(nowGoods,
|
|
|
- OperateType.Update.getPhrase(), false);
|
|
|
- // 修改上下架状态并产生上下架历史
|
|
|
- goodsHistoryService.save(history);
|
|
|
+ GoodsHistory history = null;
|
|
|
if (!nowGoods.getStatus().equals(oldStatus)) {
|
|
|
- GoodsHistory goodsHistory = null;
|
|
|
//做上下架判断
|
|
|
if ((oldStatus.equals(Status.REMOVED.value())) && (nowGoods.getStatus().equals(Status.AVAILABLE.value()) || nowGoods.getStatus().equals(Status.UNAVAILABLE.value()) || nowGoods.getStatus().equals(Status.NO_SHELVE.value()))) {
|
|
|
- goodsHistory = goodsHistoryService.converTGoodsHist(nowGoods, OperateType.Publish.getPhrase(), false);
|
|
|
+ history = goodsHistoryService.converTGoodsHist(nowGoods, OperateType.Publish.getPhrase(), false);
|
|
|
nowGoods.setPublishTime(new Date());
|
|
|
} else if ((nowGoods.getStatus().equals(Status.REMOVED.value())) && (oldStatus.equals(Status.UNAVAILABLE.value()) || oldStatus.equals(Status.AVAILABLE.value()) || oldStatus.equals(Status.NO_SHELVE.value()))) {
|
|
|
- goodsHistory = goodsHistoryService.converTGoodsHist(nowGoods, OperateType.Down.getPhrase(), false);
|
|
|
- }
|
|
|
- if (null != goodsHistory) {
|
|
|
- goodsHistoryService.save(goodsHistory);
|
|
|
+ history = goodsHistoryService.converTGoodsHist(nowGoods, OperateType.Down.getPhrase(), false);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ history = goodsHistoryService.converTGoodsHist(nowGoods,
|
|
|
+ OperateType.Update.getPhrase(), false);
|
|
|
+ }
|
|
|
+ if (null != history) {
|
|
|
+ goodsHistoryService.save(history);
|
|
|
}
|
|
|
|
|
|
List<Order> orders = detailService.updateOrderDetailsByGoods(nowGoods);
|
|
|
@@ -3880,9 +3879,10 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
goods.adjustFragmentPrice();
|
|
|
Integer status = goods.getStatus();
|
|
|
goods.setStatus();
|
|
|
- if ((Status.AVAILABLE.value() == goods.getStatus()) || (Status.UNAVAILABLE.value() == goods.getStatus() || Status.NO_SHELVE.value() == goods.getStatus()) && (Status.REMOVED.value() == status)) {
|
|
|
+ if ((Status.AVAILABLE.value() == goods.getStatus()) || (Status.UNAVAILABLE.value() == goods.getStatus() || Status.NO_SHELVE.value() == goods.getStatus()) && (Status.REMOVED.value() == status || status == null)) {
|
|
|
//如果现在是已上架,原先是未上架或者已下架,则做上架处理。否则做更新处理
|
|
|
list.add(goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Publish.getPhrase(), false));
|
|
|
+ goods.setPublishTime(new Date());
|
|
|
} else {
|
|
|
list.add(goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Update.getPhrase(), false));
|
|
|
}
|