|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.ImmutableBiMap;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.kmall.admin.dao.*;
|
|
|
+import com.kmall.admin.dao.alarm.Mall2LowPriceWarningDao;
|
|
|
import com.kmall.admin.dao.mk.Mk2GoodsTopicPriceDao;
|
|
|
import com.kmall.admin.dao.mk.Mk2MemberBirthdayDao;
|
|
|
import com.kmall.admin.dao.mk.store.MkStorePromOrderRealDao;
|
|
@@ -16,6 +17,7 @@ import com.kmall.admin.dto.OrderExpressDto;
|
|
|
import com.kmall.admin.dto.OrderRecognitionDto;
|
|
|
import com.kmall.admin.entity.*;
|
|
|
import com.kmall.admin.entity.OrderProcessRecordEntity;
|
|
|
+import com.kmall.admin.entity.alarm.Mall2LowPriceWarningEntity;
|
|
|
import com.kmall.admin.entity.mk.Mk2GoodsTopicPriceEntity;
|
|
|
import com.kmall.admin.entity.mk.store.*;
|
|
|
import com.kmall.admin.entity.vip.Mall2MemberConsumptionRecordsEntity;
|
|
@@ -150,6 +152,8 @@ public class OrderServiceImpl implements OrderService {
|
|
|
private Mk2MemberBirthdayDao memberBirthdayDao; // 生日优惠
|
|
|
@Autowired
|
|
|
private MerchUserDao merchUserDao;
|
|
|
+ @Autowired
|
|
|
+ private Mall2LowPriceWarningDao lowPriceWarningDao;
|
|
|
|
|
|
@Override
|
|
|
public OrderEntity queryObject(Long id) {
|
|
@@ -1691,7 +1695,25 @@ public class OrderServiceImpl implements OrderService {
|
|
|
return resultObj;
|
|
|
} else {
|
|
|
|
|
|
- // TODO 判断销售价是否低于底线价
|
|
|
+ // 判断销售价是否低于底线价
|
|
|
+ BigDecimal bottomLinePrice = new BigDecimal(productInfo.getBottomLinePrice());
|
|
|
+ if (goodsEntity.getStoreRetailPrice().compareTo(bottomLinePrice) <= -1) {
|
|
|
+ LOGGER.error("销售价格小于底线价格");
|
|
|
+
|
|
|
+ // 记录该信息,到价格过低日志表中,这里没有活动id
|
|
|
+ Mall2LowPriceWarningEntity lowPriceWarningEntity = new Mall2LowPriceWarningEntity();
|
|
|
+ lowPriceWarningEntity.setSalePrice(goodsEntity.getStoreRetailPrice());
|
|
|
+ lowPriceWarningEntity.setWarningPrice(bottomLinePrice);
|
|
|
+ lowPriceWarningEntity.setSku(goodsEntity.getGoodsSn());
|
|
|
+ lowPriceWarningEntity.setWarningType("00");
|
|
|
+ lowPriceWarningEntity.setStoreId(storeId+"");
|
|
|
+ lowPriceWarningEntity.setCreateTime(new Date());
|
|
|
+
|
|
|
+ lowPriceWarningDao.save(lowPriceWarningEntity);
|
|
|
+ resultObj.put("errno", 400);
|
|
|
+ resultObj.put("errmsg", "商品"+goodsEntity.getName()+"的销售价格小于底线价格");
|
|
|
+ return resultObj;
|
|
|
+ }
|
|
|
|
|
|
productInfo.setStockNum(productInfo.getStockNum() - sellVolume);
|
|
|
productInfo.setStoreId(Long.valueOf(storeId));
|
|
@@ -1703,12 +1725,15 @@ public class OrderServiceImpl implements OrderService {
|
|
|
goodsDao.update(goodsEntity);
|
|
|
}
|
|
|
}
|
|
|
+ // 实际取的是门店商品的价格,所以借这个字段来存储销售价
|
|
|
+ goodsEntity.setStoreRetailPrice(productInfo.getRetailPrice());
|
|
|
// 借用这个字段来存储购买数
|
|
|
goodsEntity.setGoodsNumber(sellVolume);
|
|
|
goodsEntities.add(goodsEntity);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
UserEntity userEntity = userDao.queryByMobile((String) userInfo.get("customPhone"));
|
|
|
if(userEntity == null) {
|
|
|
// 保存用户信息
|
|
@@ -1751,7 +1776,21 @@ public class OrderServiceImpl implements OrderService {
|
|
|
mk2GoodsTopicPriceDao.queryByTopicIdAndGoodsId(storeTopic.getId(),goodsEntity.getSku());
|
|
|
if (goodsEntity.getStoreRetailPrice().compareTo(goodsTopicPriceEntity.getTopicPrice()) <= -1) {
|
|
|
LOGGER.error("销售价格小于活动价格");
|
|
|
- throw new RuntimeException("商品"+goodsEntity.getName()+"的销售价格小于活动价格");
|
|
|
+
|
|
|
+ // 记录该信息,到价格过低日志表中,这里有活动id
|
|
|
+ Mall2LowPriceWarningEntity lowPriceWarningEntity = new Mall2LowPriceWarningEntity();
|
|
|
+ lowPriceWarningEntity.setSalePrice(goodsEntity.getStoreRetailPrice());
|
|
|
+ lowPriceWarningEntity.setWarningPrice(goodsTopicPriceEntity.getTopicPrice());
|
|
|
+ lowPriceWarningEntity.setActivityId(goodsTopicPriceEntity.getTopicId());
|
|
|
+ lowPriceWarningEntity.setSku(goodsEntity.getGoodsSn());
|
|
|
+ lowPriceWarningEntity.setWarningType("00");
|
|
|
+ lowPriceWarningEntity.setStoreId(storeId+"");
|
|
|
+ lowPriceWarningEntity.setCreateTime(new Date());
|
|
|
+
|
|
|
+ lowPriceWarningDao.save(lowPriceWarningEntity);
|
|
|
+ resultObj.put("errno", 400);
|
|
|
+ resultObj.put("errmsg", "商品"+goodsEntity.getName()+"的销售价格小于活动价格");
|
|
|
+ return resultObj;
|
|
|
}
|
|
|
goodsEntity.setStoreRetailPrice(goodsTopicPriceEntity.getTopicPrice());
|
|
|
}
|
|
@@ -1851,7 +1890,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
SaleRecordEntity saleRecordEntity = new SaleRecordEntity();
|
|
|
|
|
|
// 根据收银机机器码,查询收银机
|
|
|
- CashierEntity cashierEntity = cashierDao.queryByMachineCode(machineCode);
|
|
|
+ CashierEntity cashierEntity = cashierDao.queryByMachineCode(machineCode,storeId+"");
|
|
|
if(cashierEntity != null){
|
|
|
saleRecordEntity.setCashierSn(cashierEntity.getCashierSn());
|
|
|
saleRecordEntity.setOrderSn(order.getOrder_sn());
|