|
@@ -1698,6 +1698,9 @@ public class OrderServiceImpl implements OrderService {
|
|
Integer storeId = user.getStoreId();
|
|
Integer storeId = user.getStoreId();
|
|
|
|
|
|
List<GoodsEntity> goodsEntities = new ArrayList<>();
|
|
List<GoodsEntity> goodsEntities = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ BigDecimal totalTax = new BigDecimal(0);
|
|
|
|
+
|
|
// 检查库存和更新库存
|
|
// 检查库存和更新库存
|
|
for (LinkedHashMap goodsDto : goodsList) {
|
|
for (LinkedHashMap goodsDto : goodsList) {
|
|
//
|
|
//
|
|
@@ -1737,26 +1740,26 @@ public class OrderServiceImpl implements OrderService {
|
|
return resultObj;
|
|
return resultObj;
|
|
} else {
|
|
} else {
|
|
// 判断销售价是否低于底线价
|
|
// 判断销售价是否低于底线价
|
|
- if(productInfo.getBottomLinePrice() != null){
|
|
|
|
- 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;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+// if(productInfo.getBottomLinePrice() != null){
|
|
|
|
+// 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.setStockNum(productInfo.getStockNum() - sellVolume);
|
|
@@ -1812,6 +1815,16 @@ public class OrderServiceImpl implements OrderService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ if(goodsDto.get("goodstaxes") instanceof Double){
|
|
|
|
+ totalTax = totalTax.add(new BigDecimal((Double)goodsDto.get("goodstaxes"))); // 实际支付价格
|
|
|
|
+ }else if(goodsDto.get("goodstaxes") instanceof Integer){
|
|
|
|
+ totalTax = totalTax.add(new BigDecimal((Integer)goodsDto.get("goodstaxes")));
|
|
|
|
+ }else if(goodsDto.get("goodstaxes") instanceof Float){
|
|
|
|
+ totalTax = totalTax.add(new BigDecimal((Float)goodsDto.get("goodstaxes")));
|
|
|
|
+ }else if(goodsDto.get("goodstaxes") instanceof String){
|
|
|
|
+ totalTax = totalTax.add(new BigDecimal((String) goodsDto.get("goodstaxes")));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
// goodsEntity.setStoreRetailPrice(productInfo.getRetailPrice());
|
|
// goodsEntity.setStoreRetailPrice(productInfo.getRetailPrice());
|
|
@@ -1879,7 +1892,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
|
|
|
// 生成订单
|
|
// 生成订单
|
|
String merchOrderSn = "EMATO" + CommonUtil.generateOrderNumber();
|
|
String merchOrderSn = "EMATO" + CommonUtil.generateOrderNumber();
|
|
- OrderVo order = setOrderVo(goodsEntities, userEntity,storeId.longValue(), user.getMerchSn(),disCountAmount);
|
|
|
|
|
|
+ OrderVo order = setOrderVo(goodsEntities, userEntity,storeId.longValue(), user.getMerchSn(),disCountAmount,totalTax);
|
|
order.setStore_id(storeId.longValue());
|
|
order.setStore_id(storeId.longValue());
|
|
// if(storeTopic != null){
|
|
// if(storeTopic != null){
|
|
// order.setActivity_id(storeTopic.getId().longValue());
|
|
// order.setActivity_id(storeTopic.getId().longValue());
|
|
@@ -1932,10 +1945,10 @@ public class OrderServiceImpl implements OrderService {
|
|
// 支付宝支付
|
|
// 支付宝支付
|
|
// AliPay(user, parCode , order, processRecordEntity, orderWXPayRecordCurrent, store);
|
|
// AliPay(user, parCode , order, processRecordEntity, orderWXPayRecordCurrent, store);
|
|
OrderEntity orderEntity = queryObject(order.getId());
|
|
OrderEntity orderEntity = queryObject(order.getId());
|
|
- orderEntity.setOrderStatus(Integer.parseInt(Dict.orderStatus.item_201.getItem()));
|
|
|
|
- orderEntity.setPayStatus(Integer.parseInt(Dict.payStatus.item_2.getItem()));
|
|
|
|
|
|
+// orderEntity.setOrderStatus(Integer.parseInt(Dict.orderStatus.item_201.getItem()));
|
|
|
|
+// orderEntity.setPayStatus(Integer.parseInt(Dict.payStatus.item_2.getItem()));
|
|
// orderEntity.setPayFlag(payFlag);
|
|
// orderEntity.setPayFlag(payFlag);
|
|
- orderEntity.setPayTime(new Date());
|
|
|
|
|
|
+// orderEntity.setPayTime(new Date());
|
|
orderDao.update(orderEntity);
|
|
orderDao.update(orderEntity);
|
|
resultObj.put("shopName",store.getStoreName()); // 根据门店编号查询
|
|
resultObj.put("shopName",store.getStoreName()); // 根据门店编号查询
|
|
resultObj.put("userName",user.getUsername());
|
|
resultObj.put("userName",user.getUsername());
|
|
@@ -2379,7 +2392,7 @@ public class OrderServiceImpl implements OrderService {
|
|
* 设置订单数据
|
|
* 设置订单数据
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public OrderVo setOrderVo(List<GoodsEntity> goodsList, UserEntity loginUser,Long storeId, String merchSn, BigDecimal disCountAmount){
|
|
|
|
|
|
+ public OrderVo setOrderVo(List<GoodsEntity> goodsList, UserEntity loginUser, Long storeId, String merchSn, BigDecimal disCountAmount, BigDecimal totalTax){
|
|
OrderVo orderInfo = new OrderVo();
|
|
OrderVo orderInfo = new OrderVo();
|
|
|
|
|
|
BigDecimal goodsTotalPrice = new BigDecimal(0.00);
|
|
BigDecimal goodsTotalPrice = new BigDecimal(0.00);
|
|
@@ -2397,10 +2410,18 @@ public class OrderServiceImpl implements OrderService {
|
|
.add(goodsEntity.getActualPaymentAmount().multiply(new BigDecimal(goodsEntity.getGoodsNumber()))).setScale(2,RoundingMode.HALF_UP);
|
|
.add(goodsEntity.getActualPaymentAmount().multiply(new BigDecimal(goodsEntity.getGoodsNumber()))).setScale(2,RoundingMode.HALF_UP);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
BigDecimal orderTotalPrice = goodsTotalPrice.add(new BigDecimal(0));
|
|
BigDecimal orderTotalPrice = goodsTotalPrice.add(new BigDecimal(0));
|
|
fullCutCouponDec = fullCutCouponDec.add(couponPrice).setScale(2,RoundingMode.HALF_UP);
|
|
fullCutCouponDec = fullCutCouponDec.add(couponPrice).setScale(2,RoundingMode.HALF_UP);
|
|
|
|
|
|
- String orderSn = "CW" + CommonUtil.generateOrderNumber();
|
|
|
|
|
|
+ // 加上税额
|
|
|
|
+ goodsTotalPrice = goodsTotalPrice.add(totalTax).setScale(2,RoundingMode.HALF_UP);
|
|
|
|
+ orderTotalPrice = orderTotalPrice.add(totalTax).setScale(2,RoundingMode.HALF_UP);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ String orderSn = "ZWCW" + CommonUtil.generateOrderNumber();
|
|
orderInfo.setOrder_sn(orderSn);
|
|
orderInfo.setOrder_sn(orderSn);
|
|
orderInfo.setMerchSn(merchSn);
|
|
orderInfo.setMerchSn(merchSn);
|
|
orderInfo.setUser_id(loginUser.getId().longValue());
|
|
orderInfo.setUser_id(loginUser.getId().longValue());
|