fix
This commit is contained in:
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.starry.admin.common.aspect.CustomUserLogin;
|
import com.starry.admin.common.aspect.CustomUserLogin;
|
||||||
import com.starry.admin.common.conf.ThreadLocalRequestDetail;
|
import com.starry.admin.common.conf.ThreadLocalRequestDetail;
|
||||||
import com.starry.admin.common.exception.CustomException;
|
import com.starry.admin.common.exception.CustomException;
|
||||||
|
import com.starry.admin.common.exception.ServiceException;
|
||||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity;
|
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity;
|
||||||
import com.starry.admin.modules.clerk.service.IPlayClerkCommodityService;
|
import com.starry.admin.modules.clerk.service.IPlayClerkCommodityService;
|
||||||
import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService;
|
import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService;
|
||||||
@@ -202,7 +203,7 @@ public class WxCustomController {
|
|||||||
PlayCustomUserInfoEntity customUserInfo = customUserInfoService.selectById(userId);
|
PlayCustomUserInfoEntity customUserInfo = customUserInfoService.selectById(userId);
|
||||||
PlayClerkUserInfoEntity clerkUserInfo = clerkUserInfoService.selectById(vo.getClerkId());
|
PlayClerkUserInfoEntity clerkUserInfo = clerkUserInfoService.selectById(vo.getClerkId());
|
||||||
if (new BigDecimal(vo.getMoney()).compareTo(customUserInfo.getAccountBalance()) > 0) {
|
if (new BigDecimal(vo.getMoney()).compareTo(customUserInfo.getAccountBalance()) > 0) {
|
||||||
throw new CustomException("余额不足");
|
throw new ServiceException("余额不足", 998);
|
||||||
}
|
}
|
||||||
String orderId = IdUtils.getUuid();
|
String orderId = IdUtils.getUuid();
|
||||||
// 记录订单信息
|
// 记录订单信息
|
||||||
@@ -229,7 +230,7 @@ public class WxCustomController {
|
|||||||
PlayClerkUserInfoEntity clerkUserInfo = clerkUserInfoService.selectById(vo.getClerkId());
|
PlayClerkUserInfoEntity clerkUserInfo = clerkUserInfoService.selectById(vo.getClerkId());
|
||||||
BigDecimal money = giftInfo.getPrice().multiply(new BigDecimal(vo.getGiftQuantity()));
|
BigDecimal money = giftInfo.getPrice().multiply(new BigDecimal(vo.getGiftQuantity()));
|
||||||
if (money.compareTo(customUserInfo.getAccountBalance()) > 0) {
|
if (money.compareTo(customUserInfo.getAccountBalance()) > 0) {
|
||||||
throw new CustomException("账号余额不足");
|
throw new ServiceException("余额不足", 998);
|
||||||
}
|
}
|
||||||
String orderId = IdUtils.getUuid();
|
String orderId = IdUtils.getUuid();
|
||||||
// 记录订单信息
|
// 记录订单信息
|
||||||
@@ -298,7 +299,7 @@ public class WxCustomController {
|
|||||||
BigDecimal money = commodityInfo.getCommodityPrice().multiply(new BigDecimal(vo.getCommodityQuantity()));
|
BigDecimal money = commodityInfo.getCommodityPrice().multiply(new BigDecimal(vo.getCommodityQuantity()));
|
||||||
|
|
||||||
if (money.compareTo(customUserInfo.getAccountBalance()) > 0) {
|
if (money.compareTo(customUserInfo.getAccountBalance()) > 0) {
|
||||||
throw new CustomException("余额不足");
|
throw new ServiceException("余额不足", 998);
|
||||||
}
|
}
|
||||||
String orderId = IdUtils.getUuid();
|
String orderId = IdUtils.getUuid();
|
||||||
String orderNo = playOrderInfoService.getOrderNo();
|
String orderNo = playOrderInfoService.getOrderNo();
|
||||||
@@ -306,7 +307,7 @@ public class WxCustomController {
|
|||||||
playOrderInfoService.createOrderInfo(orderId, orderNo, "0", "2", "0", "", "1", commodityInfo.getCommodityId(), "1", commodityInfo.getCommodityPrice(), commodityInfo.getServiceDuration(), commodityInfo.getCommodityName(), String.valueOf(vo.getCommodityQuantity()), money, money, BigDecimal.ZERO, customId, clerkUserInfo.getId(), vo.getWeiChatCode(), vo.getCouponIds(), vo.getRemark());
|
playOrderInfoService.createOrderInfo(orderId, orderNo, "0", "2", "0", "", "1", commodityInfo.getCommodityId(), "1", commodityInfo.getCommodityPrice(), commodityInfo.getServiceDuration(), commodityInfo.getCommodityName(), String.valueOf(vo.getCommodityQuantity()), money, money, BigDecimal.ZERO, customId, clerkUserInfo.getId(), vo.getWeiChatCode(), vo.getCouponIds(), vo.getRemark());
|
||||||
// 顾客减少余额
|
// 顾客减少余额
|
||||||
customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance(), customUserInfo.getAccountBalance().subtract(money), "1", "下单-指定单", money, BigDecimal.ZERO, orderId);
|
customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance(), customUserInfo.getAccountBalance().subtract(money), "1", "下单-指定单", money, BigDecimal.ZERO, orderId);
|
||||||
//发送通知给店员
|
// 发送通知给店员
|
||||||
wxCustomMpService.sendCreateOrderMessage(clerkUserInfo.getTenantId(), clerkUserInfo.getOpenid(), clerkUserInfo.getNickname(), orderNo, orderId, DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"), money.toString(), commodityInfo.getCommodityName());
|
wxCustomMpService.sendCreateOrderMessage(clerkUserInfo.getTenantId(), clerkUserInfo.getOpenid(), clerkUserInfo.getNickname(), orderNo, orderId, DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"), money.toString(), commodityInfo.getCommodityName());
|
||||||
// wxCustomMpService.sendNewOrderMessageForClerk(clerkUserInfo, orderNo, commodityInfo.getCommodityName(), money);
|
// wxCustomMpService.sendNewOrderMessageForClerk(clerkUserInfo, orderNo, commodityInfo.getCommodityName(), money);
|
||||||
return R.ok("成功");
|
return R.ok("成功");
|
||||||
@@ -328,7 +329,7 @@ public class WxCustomController {
|
|||||||
PlayCommodityInfoVo commodityInfo = playCommodityInfoService.queryCommodityInfo(vo.getCommodityId());
|
PlayCommodityInfoVo commodityInfo = playCommodityInfoService.queryCommodityInfo(vo.getCommodityId());
|
||||||
BigDecimal money = commodityInfo.getCommodityPrice().multiply(new BigDecimal(vo.getCommodityQuantity()));
|
BigDecimal money = commodityInfo.getCommodityPrice().multiply(new BigDecimal(vo.getCommodityQuantity()));
|
||||||
if (money.compareTo(customUserInfo.getAccountBalance()) > 0) {
|
if (money.compareTo(customUserInfo.getAccountBalance()) > 0) {
|
||||||
throw new CustomException("余额不足");
|
throw new ServiceException("余额不足", 998);
|
||||||
}
|
}
|
||||||
String orderId = IdUtils.getUuid();
|
String orderId = IdUtils.getUuid();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user