|
|
@@ -275,9 +275,6 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
if (goods.getCurrencyName() == null) {
|
|
|
throw new IllegalOperatorException("必须选择一种币别");
|
|
|
}
|
|
|
- if (NumberUtil.compare(goods.getReserve(), DoubleConstant.zero) < 0 || NumberUtil.compare(goods.getReserve(), DoubleConstant.maxReserve) > 0) {
|
|
|
- throw new IllegalOperatorException("库存数量必须在1~99999999之间");
|
|
|
- }
|
|
|
if ((NumberUtil.compare(goods.getMinPackQty(), DoubleConstant.minReserve) < 0) || NumberUtil.compare(goods.getMinPackQty(), DoubleConstant.maxMinPackageQty) > 0) {
|
|
|
throw new IllegalOperatorException("最小包装量必须在1~999999之间");
|
|
|
}
|
|
|
@@ -333,7 +330,6 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
}
|
|
|
}
|
|
|
end = price.getEnd();
|
|
|
-
|
|
|
}
|
|
|
return ResultMap.success(null);
|
|
|
}
|
|
|
@@ -1599,15 +1595,9 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
}
|
|
|
|
|
|
nowGoods.setUpdateDate(new Date());
|
|
|
- nowGoods.setImg(oldGoods.getImg());
|
|
|
nowGoods.setMinBuyQty(oldGoods.getMinBuyQty());
|
|
|
- nowGoods.setMinPackQty(oldGoods.getMinPackQty());
|
|
|
nowGoods.setBreakUp(oldGoods.getBreakUp());
|
|
|
nowGoods.setPerQty();
|
|
|
- nowGoods.setReserve(oldGoods);
|
|
|
- nowGoods.setSpec(oldGoods.getSpec());
|
|
|
- nowGoods.setPackaging(oldGoods.getPackaging());
|
|
|
- nowGoods.setProduceDate(oldGoods.getProduceDate());
|
|
|
// 用含税单价同步未含税单价
|
|
|
oldGoods.setWithOutTaxRMBPrice();
|
|
|
oldGoods.setWithOutTaxUSDPrice();
|
|
|
@@ -1615,24 +1605,9 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
oldGoods.setSixFraction();
|
|
|
nowGoods.setQtyPrice(oldGoods.getQtyPrice());
|
|
|
// 更新本批次最小最大价格信息
|
|
|
- nowGoods.setMinPriceRMB(GoodsUtil.getMinPriceRMB(nowGoods.getPrices()));
|
|
|
- nowGoods.setMaxPriceRMB(GoodsUtil.getMaxPriceRMB(nowGoods.getPrices()));
|
|
|
- nowGoods.setMinPriceUSD(GoodsUtil.getMinPriceUSD(nowGoods.getPrices()));
|
|
|
- nowGoods.setMaxPriceUSD(GoodsUtil.getMaxPriceUSD(nowGoods.getPrices()));
|
|
|
+ nowGoods.setMaxAndMinPrice();
|
|
|
nowGoods.setAutoPublish(oldGoods.getAutoPublish());
|
|
|
- if (nowGoods.getAutoPublish()) {
|
|
|
- if (StringUtils.isEmpty(nowGoods.getPackaging()) || StringUtils.isEmpty(nowGoods.getProduceDate()) || (nowGoods.getMinBuyQty() == null) || (nowGoods.getMinPackQty() == null) || (nowGoods.getB2cMinDelivery() == null) || (nowGoods.getB2cMaxDelivery() == null) || StringUtils.isEmpty(nowGoods.getQtyPrice())) {
|
|
|
- //做未上架处理
|
|
|
- nowGoods.setStatus(Status.NO_SHELVE.value());
|
|
|
- } else {
|
|
|
- //如果信息填写全,默认上架
|
|
|
- nowGoods.setStatus((NumberUtil.compare(nowGoods.getReserve(), nowGoods.getMinBuyQty()) > -1) ? Status.AVAILABLE.value() : Status.UNAVAILABLE.value());
|
|
|
- }
|
|
|
- } else {
|
|
|
- nowGoods.setAutoPublish(Boolean.FALSE);
|
|
|
- nowGoods.setStatus(Status.NO_SHELVE.value());
|
|
|
- }
|
|
|
-
|
|
|
+ nowGoods.setStatus();
|
|
|
ResultMap resultMap = checkGoods(nowGoods);
|
|
|
if (resultMap.getCode() != CodeType.OK.code()) {
|
|
|
return null;
|
|
|
@@ -1640,24 +1615,27 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
GoodsHistory history = goodsHistoryService.converTGoodsHist(nowGoods,
|
|
|
OperateType.Update.getPhrase(), false);
|
|
|
// 修改上下架状态并产生上下架历史
|
|
|
- GoodsHistory goodsHistory = null;
|
|
|
+ goodsHistoryService.save(history);
|
|
|
if (!nowGoods.getStatus().equals(oldGoods.getStatus())) {
|
|
|
+ GoodsHistory goodsHistory = null;
|
|
|
// 如果是下架
|
|
|
if (oldGoods.getStatus().equals(Status.REMOVED.value())) {
|
|
|
goodsHistory = goodsHistoryService.converTGoodsHist(nowGoods, OperateType.Down.getPhrase(), false);
|
|
|
} else if (oldGoods.getStatus().equals(Status.AVAILABLE.value())) {
|
|
|
goodsHistory = goodsHistoryService.converTGoodsHist(nowGoods, OperateType.Publish.getPhrase(), false);
|
|
|
}
|
|
|
+ if (null != goodsHistory) {
|
|
|
+ goodsHistoryService.save(goodsHistory);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
List<Order> orders = detailService.updateOrderDetailsByGoods(nowGoods);
|
|
|
//更新购物车信息
|
|
|
List<Cart> cartList = cartService.updateCartByGoods(nowGoods);
|
|
|
//更新浏览历史
|
|
|
List<GoodsBrowsingHistory> browsingHistories = browsingHistoryService.updateGoodsBrowsingHistoryByGoods(nowGoods);
|
|
|
- updateGoodsRelateInfo(orders, cartList, browsingHistories, null, null, history, nowGoods);
|
|
|
- if (null != goodsHistory) {
|
|
|
- goodsHistoryService.save(goodsHistory);
|
|
|
- }
|
|
|
+ updateGoodsRelateInfo(orders, cartList, browsingHistories, null, null, history, nowGoods);
|
|
|
+
|
|
|
//更新店铺推荐的信息
|
|
|
if(isChangeSaleType) { // 如果切换了销售方式
|
|
|
Set<String> uuids = new HashSet<>();
|