|
|
@@ -30,6 +30,7 @@ import com.sqx.modules.app.dao.UserMoneyDao;
|
|
|
import com.sqx.modules.app.dao.UserMoneyDetailsDao;
|
|
|
import com.sqx.modules.app.entity.UserBrowse;
|
|
|
import com.sqx.modules.app.entity.UserEntity;
|
|
|
+import com.sqx.modules.app.entity.UserMoney;
|
|
|
import com.sqx.modules.app.entity.UserMoneyDetails;
|
|
|
import com.sqx.modules.app.service.UserMoneyService;
|
|
|
import com.sqx.modules.app.service.UserService;
|
|
|
@@ -584,6 +585,13 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
|
|
|
|
|
|
// 店铺信息
|
|
|
GoodsShop goodsShop = goodsShopDao.selectById(shopId);
|
|
|
+ // 查询短信发送费用
|
|
|
+ CommonInfo commonInfo = commonInfoService.findOne(421);
|
|
|
+ // 店铺钱包
|
|
|
+ UserMoney userMoney = userMoneyService.selectUserMoneyByUserId(goodsShop.getUserId());
|
|
|
+ if (userMoney.getMoney().compareTo(new BigDecimal(commonInfo.getValue())) < 0) {
|
|
|
+ throw new SqxException("当前店铺余额不够,短信发送失败!");
|
|
|
+ }
|
|
|
|
|
|
// 发送短信并记录短信发送记录
|
|
|
SmsSendResult smsSendResult = smsTemplateService.sendSms(smsTemplateId, goodsShop.getPhone(), goodsShop.getShopName(), goodsShop.getShopId(), userPhone);
|
|
|
@@ -1796,6 +1804,11 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 店铺收入
|
|
|
+ BigDecimal shopMoney = sumMoney.multiply(shopRate);
|
|
|
+ shopMoney = shopMoney.setScale(2, BigDecimal.ROUND_DOWN);
|
|
|
+ BigDecimal pingRate = sumMoney.subtract(shopMoney);
|
|
|
+
|
|
|
// 商家配送短信服务费
|
|
|
BigDecimal smsSendMoney = BigDecimal.ZERO;
|
|
|
if(tbOrder.getAutoSendOrder()!=null && tbOrder.getAutoSendOrder() == 1) {
|
|
|
@@ -1805,18 +1818,14 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
|
|
|
if (ObjectUtil.isNotNull(smsSendLog)) {
|
|
|
// 查询短信发送费用
|
|
|
CommonInfo commonInfo = commonInfoService.findOne(421);
|
|
|
-
|
|
|
smsSendMoney = new BigDecimal(commonInfo.getValue());
|
|
|
- sumMoney = sumMoney.subtract(smsSendMoney);
|
|
|
+
|
|
|
+ // 店铺收入-短信费用
|
|
|
+ shopMoney = shopMoney.subtract(smsSendMoney);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- BigDecimal shopMoney = sumMoney.multiply(shopRate);
|
|
|
-
|
|
|
- shopMoney = (shopMoney.setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
- BigDecimal pingRate = sumMoney.subtract(shopMoney);
|
|
|
-
|
|
|
//这里再判断 是否是商家优惠券 如果是商家优惠券 这笔钱商家承担
|
|
|
if (shopIds != -1 && shopIds != 0) {
|
|
|
shopMoney = shopMoney.subtract(couponMoney);
|