|
|
@@ -11,6 +11,7 @@ import com.uas.platform.b2c.advertise.ad.service.RecommendProductService;
|
|
|
import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
|
|
|
import com.uas.platform.b2c.common.account.model.Enterprise;
|
|
|
import com.uas.platform.b2c.common.account.model.User;
|
|
|
+import com.uas.platform.b2c.common.account.service.EnterpriseService;
|
|
|
import com.uas.platform.b2c.common.search.service.SearcherService;
|
|
|
import com.uas.platform.b2c.core.config.SysConf;
|
|
|
import com.uas.platform.b2c.core.constant.ShortConstant;
|
|
|
@@ -241,6 +242,9 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
@Autowired
|
|
|
private V_ProductPrivateService v_productPrivateService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private EnterpriseService enterpriseService;
|
|
|
+
|
|
|
private final Logger logger = Logger.getLogger(getClass());
|
|
|
|
|
|
@Autowired
|
|
|
@@ -281,7 +285,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
if (!goods.getBreakUp()) {
|
|
|
if (goods.getMinPackQty() != null) {
|
|
|
if (goods.getMinBuyQty() % goods.getMinPackQty() != 0) {
|
|
|
- throw new IllegalOperatorException("最小起订量必须为最小包装量的整数倍");
|
|
|
+ goods.setMinBuyQtyByMinPackQty(goods.getMinBuyQty());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -538,6 +542,12 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
createNumberService.getTimeNumber("product$goods", 8));
|
|
|
goods.setBatchCode(batchCode);
|
|
|
}
|
|
|
+ ResultMap resultMap = enterpriseService.getCurrencyByRegisterAddress();
|
|
|
+ if (resultMap.getCode() == IntegerConstant.YES_INT.intValue()) {
|
|
|
+ goods.setCurrencyName(resultMap.getData().toString());
|
|
|
+ } else {
|
|
|
+ throw new IllegalOperatorException(resultMap.getMessage());
|
|
|
+ }
|
|
|
goods.setCreatedDate(new Date());
|
|
|
goods.setUpdateDate(goods.getCreatedDate());
|
|
|
goods.setEnUU(SystemSession.getUser().getEnterprise().getUu());
|
|
|
@@ -1286,7 +1296,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
}
|
|
|
if (nowGoods == null) {
|
|
|
//根据物料信息,生成在售产品
|
|
|
- publish(goods, "NORMAL");
|
|
|
+ resultGoods = publish(goods, "NORMAL");
|
|
|
} else {
|
|
|
// 检查身份
|
|
|
if (!nowGoods.getEnUU().equals(enUU)) {
|
|
|
@@ -1359,12 +1369,12 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
ModifyInfo info = new ModifyInfo(ModifyConstant.MODIFY_MIN_DELIVERY.getPhrase(), beforeGoods.getBatchCode(), StringUtilB2C.valueOf(beforeMinDelivery), StringUtilB2C.valueOf(afterMinDelivery), ModifyInfo.TYPE_SALE);
|
|
|
infoList.add(info);
|
|
|
}
|
|
|
- Integer beforeGoodsStatus = beforeGoods.getStatus();
|
|
|
- Integer afterGoodsStatus = afterGoods.getStatus();
|
|
|
- if (!beforeGoodsStatus.equals(afterGoodsStatus)) {
|
|
|
- ModifyInfo info = new ModifyInfo(ModifyConstant.MODIFY_GOODS_STATUS.getPhrase(), beforeGoods.getBatchCode(), Status.valueStringOf(beforeGoodsStatus), Status.valueStringOf(afterGoodsStatus), ModifyInfo.TYPE_SALE);
|
|
|
- infoList.add(info);
|
|
|
- }
|
|
|
+// Integer beforeGoodsStatus = beforeGoods.getStatus();
|
|
|
+// Integer afterGoodsStatus = afterGoods.getStatus();
|
|
|
+// if (!beforeGoodsStatus.equals(afterGoodsStatus)) {
|
|
|
+// ModifyInfo info = new ModifyInfo(ModifyConstant.MODIFY_GOODS_STATUS.getPhrase(), beforeGoods.getBatchCode(), Status.valueStringOf(beforeGoodsStatus), Status.valueStringOf(afterGoodsStatus), ModifyInfo.TYPE_SALE);
|
|
|
+// infoList.add(info);
|
|
|
+// }
|
|
|
Short beforeMaxDelivery = beforeGoods.getMaxDelivery();
|
|
|
Short afterMaxDelivery = afterGoods.getMaxDelivery();
|
|
|
if (!StringUtilB2C.equals(StringUtilB2C.valueOf(beforeMaxDelivery), StringUtilB2C.valueOf(afterMaxDelivery))) {
|
|
|
@@ -1556,10 +1566,11 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
public Goods updateGoods(Goods nowGoods, Goods oldGoods) {
|
|
|
nowGoods.setMaxDelivery(oldGoods.getMaxDelivery());
|
|
|
nowGoods.setMinDelivery(oldGoods.getMinDelivery());
|
|
|
- nowGoods.setTag(oldGoods.getTag());
|
|
|
+ nowGoods.setB2cMaxDelivery(null);
|
|
|
+ nowGoods.setB2cMinDelivery(null);
|
|
|
//判断是否切换了销售方式
|
|
|
Boolean isChangeSaleType = false;
|
|
|
- String storeuuid = oldGoods.getStoreid();
|
|
|
+ String storeuuid = nowGoods.getStoreid();
|
|
|
isChangeSaleType = setStoreName(nowGoods, oldGoods);
|
|
|
|
|
|
if(nowGoods.getProductid() != null) {
|
|
|
@@ -1578,23 +1589,26 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
}
|
|
|
|
|
|
// 设置货到香港,货到大陆的延长时间
|
|
|
- if (nowGoods.getMaxDelivery() != null) {
|
|
|
+ if (nowGoods.getMaxDelivery() != null || nowGoods.getMinDelivery() != null) {
|
|
|
setB2CDelayTime(nowGoods);
|
|
|
}
|
|
|
|
|
|
nowGoods.setUpdateDate(new Date());
|
|
|
- nowGoods.setMinBuyQty(oldGoods.getMinBuyQty());
|
|
|
nowGoods.setBreakUp(oldGoods.getBreakUp());
|
|
|
+ nowGoods.setMinBuyQtyByMinPackQty(oldGoods.getMinBuyQty());
|
|
|
nowGoods.setPerQty();
|
|
|
+ oldGoods.setCurrencyName(nowGoods.getCurrencyName());
|
|
|
// 用含税单价同步未含税单价
|
|
|
oldGoods.setWithOutTaxRMBPrice();
|
|
|
oldGoods.setWithOutTaxUSDPrice();
|
|
|
//保留六位有效数字
|
|
|
oldGoods.setSixFraction();
|
|
|
nowGoods.setQtyPrice(oldGoods.getQtyPrice());
|
|
|
+ nowGoods.adjustFragmentPrice();
|
|
|
// 更新本批次最小最大价格信息
|
|
|
nowGoods.setMaxAndMinPrice();
|
|
|
nowGoods.setAutoPublish(oldGoods.getAutoPublish());
|
|
|
+ Integer oldStatus = nowGoods.getStatus();
|
|
|
nowGoods.setStatus();
|
|
|
ResultMap resultMap = checkGoods(nowGoods);
|
|
|
if (resultMap.getCode() != CodeType.OK.code()) {
|
|
|
@@ -1604,13 +1618,13 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
OperateType.Update.getPhrase(), false);
|
|
|
// 修改上下架状态并产生上下架历史
|
|
|
goodsHistoryService.save(history);
|
|
|
- if (!nowGoods.getStatus().equals(oldGoods.getStatus())) {
|
|
|
+ if (!nowGoods.getStatus().equals(oldStatus)) {
|
|
|
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())) {
|
|
|
+ //做上下架判断
|
|
|
+ if ((oldStatus.equals(Status.NO_SHELVE.value()) || oldStatus.equals(Status.REMOVED.value())) && (nowGoods.getStatus().equals(Status.AVAILABLE.value()) || nowGoods.getStatus().equals(Status.UNAVAILABLE.value()))) {
|
|
|
goodsHistory = goodsHistoryService.converTGoodsHist(nowGoods, OperateType.Publish.getPhrase(), false);
|
|
|
+ } else if ((nowGoods.getStatus().equals(Status.NO_SHELVE) || nowGoods.getStatus().equals(Status.REMOVED.value())) && (oldStatus.equals(Status.UNAVAILABLE.value()) || oldStatus.equals(Status.AVAILABLE.value()))) {
|
|
|
+ goodsHistory = goodsHistoryService.converTGoodsHist(nowGoods, OperateType.Down.getPhrase(), false);
|
|
|
}
|
|
|
if (null != goodsHistory) {
|
|
|
goodsHistoryService.save(goodsHistory);
|