feat: 霸王餐充值修改
This commit is contained in:
@@ -20,7 +20,7 @@ public class MemberInDTO {
|
|||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
private Integer orderId;
|
private Integer orderId;
|
||||||
// 使用的优惠券
|
// 使用的优惠券
|
||||||
private List<Integer> userCouponIds = new ArrayList<>();
|
private Integer userCouponId;
|
||||||
// 是否使用积分抵扣
|
// 是否使用积分抵扣
|
||||||
private Integer pointsNum ;
|
private Integer pointsNum ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1369,19 +1369,7 @@ public class CartService {
|
|||||||
|
|
||||||
private void returnCoupon(TbOrderInfo orderInfo) {
|
private void returnCoupon(TbOrderInfo orderInfo) {
|
||||||
// 返还优惠券
|
// 返还优惠券
|
||||||
if (StrUtil.isNotBlank(orderInfo.getCouponInfoList())) {
|
PayService.returnCoupon(orderInfo, shopCouponService);
|
||||||
OrderCouponInfoDTO couponInfoDTO = JSONObject.parseObject(orderInfo.getCouponInfoList(), OrderCouponInfoDTO.class);
|
|
||||||
// 券返还
|
|
||||||
if (!couponInfoDTO.getOutRecordList().isEmpty()) {
|
|
||||||
couponInfoDTO.getOutRecordList().forEach(item -> {
|
|
||||||
item.setRefNum(item.getUseNum());
|
|
||||||
});
|
|
||||||
shopCouponService.refund(couponInfoDTO.getOutRecordList());
|
|
||||||
couponInfoDTO.setOutRecordList(new ArrayList<>());
|
|
||||||
orderInfo.setCouponInfoList(JSONObject.toJSONString(couponInfoDTO));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void consumeCoupon(List<TbActivateOutRecord> outRecordList, Integer memberId, TbOrderInfo orderInfo) {
|
private void consumeCoupon(List<TbActivateOutRecord> outRecordList, Integer memberId, TbOrderInfo orderInfo) {
|
||||||
|
|||||||
@@ -236,6 +236,7 @@ public class PayService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验订单支付状态是否正常
|
* 校验订单支付状态是否正常
|
||||||
|
*
|
||||||
* @param orderInfo 订单信息
|
* @param orderInfo 订单信息
|
||||||
*/
|
*/
|
||||||
private void checkOrderPayState(TbOrderInfo orderInfo) {
|
private void checkOrderPayState(TbOrderInfo orderInfo) {
|
||||||
@@ -255,8 +256,9 @@ public class PayService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存订单支付详情
|
* 保存订单支付详情
|
||||||
|
*
|
||||||
* @param orderInfo 订单信息
|
* @param orderInfo 订单信息
|
||||||
* @param payType 支付类型
|
* @param payType 支付类型
|
||||||
* @return 订单支付
|
* @return 订单支付
|
||||||
*/
|
*/
|
||||||
private TbOrderPayment createOrderPayment(TbOrderInfo orderInfo, String payType) {
|
private TbOrderPayment createOrderPayment(TbOrderInfo orderInfo, String payType) {
|
||||||
@@ -338,7 +340,7 @@ public class PayService {
|
|||||||
String smallAppid = thirdApply.getSmallAppid();
|
String smallAppid = thirdApply.getSmallAppid();
|
||||||
String appId = thirdApply.getAppId();
|
String appId = thirdApply.getAppId();
|
||||||
String appToken = thirdApply.getAppToken();
|
String appToken = thirdApply.getAppToken();
|
||||||
if ("aliPay".equals(orderInfo.getPayType())){
|
if ("aliPay".equals(orderInfo.getPayType())) {
|
||||||
smallAppid = thirdApply.getAlipaySmallAppid();
|
smallAppid = thirdApply.getAlipaySmallAppid();
|
||||||
}
|
}
|
||||||
String convertPayType = "aliPay".equals(orderInfo.getPayType()) ? "ALIPAY" : "WECHAT";
|
String convertPayType = "aliPay".equals(orderInfo.getPayType()) ? "ALIPAY" : "WECHAT";
|
||||||
@@ -402,7 +404,7 @@ public class PayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 校验优惠券积分同享
|
// 校验优惠券积分同享
|
||||||
if (!payDTO.getUserCouponIds().isEmpty() && freeDineConfig.getWithCoupon() == 0) {
|
if (payDTO.getUserCouponId() != null && freeDineConfig.getWithCoupon() == 0) {
|
||||||
throw new MsgException("当前店铺未开启与优惠券同享");
|
throw new MsgException("当前店铺未开启与优惠券同享");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,6 +416,10 @@ public class PayService {
|
|||||||
if (!freeDineConfig.getUseType().contains(orderInfo.getEatModel())) {
|
if (!freeDineConfig.getUseType().contains(orderInfo.getEatModel())) {
|
||||||
throw new MsgException("当前店铺未开启此就餐模式霸王餐");
|
throw new MsgException("当前店铺未开启此就餐模式霸王餐");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 返还优惠券
|
||||||
|
returnCoupon(orderInfo, shopCouponService);
|
||||||
|
|
||||||
BigDecimal shouldPayAmount = orderInfo.getOriginAmount().multiply(BigDecimal.valueOf(freeDineConfig.getRechargeTimes()));
|
BigDecimal shouldPayAmount = orderInfo.getOriginAmount().multiply(BigDecimal.valueOf(freeDineConfig.getRechargeTimes()));
|
||||||
|
|
||||||
|
|
||||||
@@ -442,36 +448,32 @@ public class PayService {
|
|||||||
record.setState(TableConstant.FreeDineRecord.State.WAIT_PAY.getValue());
|
record.setState(TableConstant.FreeDineRecord.State.WAIT_PAY.getValue());
|
||||||
record.setOrderId(orderInfo.getId());
|
record.setOrderId(orderInfo.getId());
|
||||||
record.setOrderAmount(orderInfo.getOrderAmount());
|
record.setOrderAmount(orderInfo.getOrderAmount());
|
||||||
if (!payDTO.getUserCouponIds().isEmpty()) {
|
if (payDTO.getUserCouponId() != null) {
|
||||||
List<TbUserCouponVo> userCouponList = shopCouponService.getActivateCouponByAmount(Integer.valueOf(orderInfo.getShopId()), String.valueOf(payDTO.getUserId()), shouldPayAmount);
|
List<TbUserCouponVo> userCouponList = shopCouponService.getActivateCouponByAmount(Integer.valueOf(orderInfo.getShopId()), String.valueOf(payDTO.getUserId()), shouldPayAmount);
|
||||||
if (userCouponList.isEmpty()) {
|
if (userCouponList.isEmpty()) {
|
||||||
throw new MsgException("存在不可用优惠券");
|
throw new MsgException("存在不可用优惠券");
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<ActivateInInfoVO> activateInInfoVOS = new ArrayList<>();
|
TbUserCouponVo userCouponVo = userCouponList.stream().filter(item -> item.getId().equals(payDTO.getUserCouponId())).findFirst().orElse(null);
|
||||||
for (Integer userCouponId : payDTO.getUserCouponIds()) {
|
if (userCouponVo == null) {
|
||||||
TbUserCouponVo userCouponVo = userCouponList.stream().filter(item -> item.getId().equals(userCouponId)).findFirst().orElse(null);
|
throw new MsgException("存在不可用优惠券");
|
||||||
if (userCouponVo == null) {
|
}
|
||||||
throw new MsgException("存在不可用优惠券");
|
|
||||||
}
|
|
||||||
|
|
||||||
shouldPayAmount = shouldPayAmount.subtract(userCouponVo.getDiscountAmount());
|
shouldPayAmount = shouldPayAmount.subtract(userCouponVo.getDiscountAmount());
|
||||||
ActivateInInfoVO activateInInfoVO = new ActivateInInfoVO()
|
|
||||||
.setId(userCouponVo.getId())
|
|
||||||
.setCouponId(userCouponVo.getCouponId())
|
|
||||||
.setNum(1);
|
|
||||||
activateInInfoVOS.add(activateInInfoVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<TbShopCoupon> tbShopCoupons = mpShopCouponMapper.selectBatchIds(activateInInfoVOS.stream().map(ActivateInInfoVO::getCouponId).collect(Collectors.toList()));
|
TbShopCoupon tbShopCoupons = mpShopCouponMapper.selectById(userCouponVo.getCouponId());
|
||||||
if (tbShopCoupons.size() != payDTO.getUserCouponIds().size()) {
|
if (tbShopCoupons == null) {
|
||||||
throw new MsgException("存在不可用优惠券");
|
throw new MsgException("存在不可用优惠券");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置优惠券信息
|
// 设置优惠券信息
|
||||||
// orderInfo.seta(JSONObject.toJSONString(activateInInfoVOS));
|
OrderCouponInfoDTO couponInfoDTO = new OrderCouponInfoDTO();
|
||||||
orderInfo.setUserCouponAmount(BigDecimal.valueOf(tbShopCoupons.stream().map(TbShopCoupon::getDiscountAmount).reduce(0, Integer::sum)));
|
couponInfoDTO.setFullReductionCouponMap(new HashMap<Integer, TbUserCouponVo>(){{
|
||||||
record.setCouponInfo(JSONObject.toJSONString(userCouponList));
|
put(userCouponVo.getId(), userCouponVo);
|
||||||
|
}});
|
||||||
|
orderInfo.setCouponInfoList(JSONObject.toJSONString(couponInfoDTO));
|
||||||
|
orderInfo.setUserCouponAmount(userCouponVo.getDiscountAmount());
|
||||||
|
record.setCouponInfo(JSONObject.toJSONString(userCouponList));
|
||||||
}
|
}
|
||||||
|
|
||||||
record.setRechargeAmount(shouldPayAmount);
|
record.setRechargeAmount(shouldPayAmount);
|
||||||
@@ -485,6 +487,21 @@ public class PayService {
|
|||||||
return shouldPayAmount;
|
return shouldPayAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void returnCoupon(TbOrderInfo orderInfo, TbShopCouponService shopCouponService) {
|
||||||
|
if (StrUtil.isNotBlank(orderInfo.getCouponInfoList())) {
|
||||||
|
OrderCouponInfoDTO couponInfoDTO = JSONObject.parseObject(orderInfo.getCouponInfoList(), OrderCouponInfoDTO.class);
|
||||||
|
// 券返还
|
||||||
|
if (!couponInfoDTO.getOutRecordList().isEmpty()) {
|
||||||
|
couponInfoDTO.getOutRecordList().forEach(item -> {
|
||||||
|
item.setRefNum(item.getUseNum());
|
||||||
|
});
|
||||||
|
shopCouponService.refund(couponInfoDTO.getOutRecordList());
|
||||||
|
couponInfoDTO.setOutRecordList(new ArrayList<>());
|
||||||
|
orderInfo.setCouponInfoList(JSONObject.toJSONString(couponInfoDTO));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Result payOrder(String openId, OrderPayDTO payDTO, String ip) throws Exception {
|
public Result payOrder(String openId, OrderPayDTO payDTO, String ip) throws Exception {
|
||||||
@@ -660,7 +677,7 @@ public class PayService {
|
|||||||
TbShopTable shopTable = mpShopTableService.selectByQrcode(orderInfo.getTableId());
|
TbShopTable shopTable = mpShopTableService.selectByQrcode(orderInfo.getTableId());
|
||||||
if (shopTable.getAutoClear() != null && shopTable.getAutoClear() == 1) {
|
if (shopTable.getAutoClear() != null && shopTable.getAutoClear() == 1) {
|
||||||
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.IDLE);
|
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.IDLE);
|
||||||
}else {
|
} else {
|
||||||
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.CLEANING);
|
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.CLEANING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -834,7 +851,7 @@ public class PayService {
|
|||||||
String smallAppid = thirdApply.getSmallAppid();
|
String smallAppid = thirdApply.getSmallAppid();
|
||||||
String appId = thirdApply.getAppId();
|
String appId = thirdApply.getAppId();
|
||||||
String appToken = thirdApply.getAppToken();
|
String appToken = thirdApply.getAppToken();
|
||||||
if ("aliPay".equals(payType)){
|
if ("aliPay".equals(payType)) {
|
||||||
smallAppid = thirdApply.getAlipaySmallAppid();
|
smallAppid = thirdApply.getAlipaySmallAppid();
|
||||||
}
|
}
|
||||||
String convertPayType = "aliPay".equals(payType) ? "ALIPAY" : "WECHAT";
|
String convertPayType = "aliPay".equals(payType) ? "ALIPAY" : "WECHAT";
|
||||||
@@ -1045,7 +1062,7 @@ public class PayService {
|
|||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Result memberIn(MemberInDTO memberInDTO, String ip) throws JsonProcessingException {
|
public Result memberIn(MemberInDTO memberInDTO, String ip) throws JsonProcessingException {
|
||||||
|
|
||||||
TbUserInfo userInfo = tbUserInfoMapper.selectByPrimaryKey(memberInDTO.getUserId());
|
TbUserInfo userInfo = tbUserInfoMapper.selectByPrimaryKey(memberInDTO.getUserId());
|
||||||
if (ObjectUtil.isEmpty(userInfo)) {
|
if (ObjectUtil.isEmpty(userInfo)) {
|
||||||
@@ -1074,7 +1091,7 @@ public class PayService {
|
|||||||
payAmount = getFreeDineOrderInfo(memberInDTO, userInfo);
|
payAmount = getFreeDineOrderInfo(memberInDTO, userInfo);
|
||||||
memberIn.setType(TableConstant.MemberIn.Type.FREE_DINE.getValue());
|
memberIn.setType(TableConstant.MemberIn.Type.FREE_DINE.getValue());
|
||||||
// 会员充值
|
// 会员充值
|
||||||
}else {
|
} else {
|
||||||
payAmount = memberInDTO.getAmount().setScale(2, RoundingMode.DOWN);
|
payAmount = memberInDTO.getAmount().setScale(2, RoundingMode.DOWN);
|
||||||
memberIn.setType(TableConstant.MemberIn.Type.NORMAL.getValue());
|
memberIn.setType(TableConstant.MemberIn.Type.NORMAL.getValue());
|
||||||
}
|
}
|
||||||
@@ -1217,8 +1234,9 @@ public class PayService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单支付成功修改订单和子单状态
|
* 订单支付成功修改订单和子单状态
|
||||||
* @param orderInfo 订单信息
|
*
|
||||||
* @param payType 支付平台
|
* @param orderInfo 订单信息
|
||||||
|
* @param payType 支付平台
|
||||||
* @param payOrderNO 三方支付订单号
|
* @param payOrderNO 三方支付订单号
|
||||||
*/
|
*/
|
||||||
private void orderSuccessPay(TbOrderInfo orderInfo, String payType, String payOrderNO) {
|
private void orderSuccessPay(TbOrderInfo orderInfo, String payType, String payOrderNO) {
|
||||||
@@ -1237,9 +1255,9 @@ public class PayService {
|
|||||||
|
|
||||||
//修改主单状态
|
//修改主单状态
|
||||||
orderInfo.setStatus("closed");
|
orderInfo.setStatus("closed");
|
||||||
if("alipay".equalsIgnoreCase(payType)){
|
if ("alipay".equalsIgnoreCase(payType)) {
|
||||||
orderInfo.setPayType("ali_lite");
|
orderInfo.setPayType("ali_lite");
|
||||||
}else if("wechat".equalsIgnoreCase(payType)){
|
} else if ("wechat".equalsIgnoreCase(payType)) {
|
||||||
orderInfo.setPayType("wx_lite");
|
orderInfo.setPayType("wx_lite");
|
||||||
}
|
}
|
||||||
orderInfo.setPayOrderNo(payOrderNO);
|
orderInfo.setPayOrderNo(payOrderNO);
|
||||||
@@ -1289,14 +1307,14 @@ public class PayService {
|
|||||||
TbShopTable shopTable = mpShopTableService.selectByQrcode(orderInfo.getTableId());
|
TbShopTable shopTable = mpShopTableService.selectByQrcode(orderInfo.getTableId());
|
||||||
if (shopTable.getAutoClear() != null && shopTable.getAutoClear() == 1) {
|
if (shopTable.getAutoClear() != null && shopTable.getAutoClear() == 1) {
|
||||||
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.IDLE);
|
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.IDLE);
|
||||||
}else {
|
} else {
|
||||||
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.CLEANING);
|
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.CLEANING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public String callBackPayFST(String payOrderNO,String payType) {
|
public String callBackPayFST(String payOrderNO, String payType) {
|
||||||
TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPayOrderNo(payOrderNO);
|
TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPayOrderNo(payOrderNO);
|
||||||
if (ObjectUtil.isEmpty(orderInfo)) {
|
if (ObjectUtil.isEmpty(orderInfo)) {
|
||||||
return "订单信息不存在";
|
return "订单信息不存在";
|
||||||
@@ -1346,14 +1364,14 @@ public class PayService {
|
|||||||
for (TbActivate tbActivate : list) {
|
for (TbActivate tbActivate : list) {
|
||||||
if (tbActivate.getIsUseCoupon() == 1) {
|
if (tbActivate.getIsUseCoupon() == 1) {
|
||||||
TbShopCoupon coupon = couponMapper.queryById(tbActivate.getCouponId());
|
TbShopCoupon coupon = couponMapper.queryById(tbActivate.getCouponId());
|
||||||
if(coupon!=null){
|
if (coupon != null) {
|
||||||
if(coupon.getType()==1){
|
if (coupon.getType() == 1) {
|
||||||
//满减
|
//满减
|
||||||
tbActivate.setCouponDesc("满"+coupon.getFullAmount() + "减" + coupon.getDiscountAmount()+" * "+tbActivate.getNum()+"张");
|
tbActivate.setCouponDesc("满" + coupon.getFullAmount() + "减" + coupon.getDiscountAmount() + " * " + tbActivate.getNum() + "张");
|
||||||
} else if (coupon.getType() == 2) {
|
} else if (coupon.getType() == 2) {
|
||||||
//商品
|
//商品
|
||||||
tbActivate.setCouponDesc("商品券");
|
tbActivate.setCouponDesc("商品券");
|
||||||
tbActivate.setGives(couProductMapper.queryProsByActivateId(coupon.getId(),tbActivate.getNum()));
|
tbActivate.setGives(couProductMapper.queryProsByActivateId(coupon.getId(), tbActivate.getNum()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1476,7 +1494,7 @@ public class PayService {
|
|||||||
Date end = new Date();
|
Date end = new Date();
|
||||||
if ("fixed".equals(tbShopCoupon.getValidityType())) {
|
if ("fixed".equals(tbShopCoupon.getValidityType())) {
|
||||||
//固定时间
|
//固定时间
|
||||||
end = DateUtil.offsetDay(new Date(),tbShopCoupon.getValidDays());
|
end = DateUtil.offsetDay(new Date(), tbShopCoupon.getValidDays());
|
||||||
} else if ("custom".equals(tbShopCoupon.getValidityType())) {
|
} else if ("custom".equals(tbShopCoupon.getValidityType())) {
|
||||||
//自定义时间
|
//自定义时间
|
||||||
start = tbShopCoupon.getValidStartTime();
|
start = tbShopCoupon.getValidStartTime();
|
||||||
@@ -1484,7 +1502,7 @@ public class PayService {
|
|||||||
}
|
}
|
||||||
if (tbShopCoupon != null) {
|
if (tbShopCoupon != null) {
|
||||||
List<TbActivateInRecord> actGiveRecords = new ArrayList<>();
|
List<TbActivateInRecord> actGiveRecords = new ArrayList<>();
|
||||||
if(tbShopCoupon.getType() == 1) {
|
if (tbShopCoupon.getType() == 1) {
|
||||||
//满减
|
//满减
|
||||||
TbActivateInRecord record = new TbActivateInRecord();
|
TbActivateInRecord record = new TbActivateInRecord();
|
||||||
record.setVipUserId(Integer.valueOf(tbShopUser.getId()));
|
record.setVipUserId(Integer.valueOf(tbShopUser.getId()));
|
||||||
@@ -1500,7 +1518,7 @@ public class PayService {
|
|||||||
record.setSourceFlowId(flowId);
|
record.setSourceFlowId(flowId);
|
||||||
record.setUseStartTime(start);
|
record.setUseStartTime(start);
|
||||||
record.setUseEndTime(end);
|
record.setUseEndTime(end);
|
||||||
record.setCouponJson(activateInRecordService.getCouponJson(activate,tbShopCoupon,null));
|
record.setCouponJson(activateInRecordService.getCouponJson(activate, tbShopCoupon, null));
|
||||||
actGiveRecords.add(record);
|
actGiveRecords.add(record);
|
||||||
} else if (tbShopCoupon.getType() == 2) {
|
} else if (tbShopCoupon.getType() == 2) {
|
||||||
//商品卷
|
//商品卷
|
||||||
@@ -1512,19 +1530,19 @@ public class PayService {
|
|||||||
record.setName("商品卷");
|
record.setName("商品卷");
|
||||||
record.setType(2);
|
record.setType(2);
|
||||||
record.setProId(actPro.getProductId());
|
record.setProId(actPro.getProductId());
|
||||||
record.setNum(actPro.getNum()*tbShopCoupon.getNumber());
|
record.setNum(actPro.getNum() * tbShopCoupon.getNumber());
|
||||||
record.setOverNum(actPro.getNum()*tbShopCoupon.getNumber());
|
record.setOverNum(actPro.getNum() * tbShopCoupon.getNumber());
|
||||||
record.setShopId(Integer.valueOf(tbShopUser.getShopId()));
|
record.setShopId(Integer.valueOf(tbShopUser.getShopId()));
|
||||||
record.setSourceActId(activate.getId());
|
record.setSourceActId(activate.getId());
|
||||||
record.setSourceFlowId(flowId);
|
record.setSourceFlowId(flowId);
|
||||||
record.setUseStartTime(start);
|
record.setUseStartTime(start);
|
||||||
record.setUseEndTime(end);
|
record.setUseEndTime(end);
|
||||||
record.setCouponJson(activateInRecordService.getCouponJson(activate,tbShopCoupon,actPro));
|
record.setCouponJson(activateInRecordService.getCouponJson(activate, tbShopCoupon, actPro));
|
||||||
actGiveRecords.add(record);
|
actGiveRecords.add(record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
activateInRecordMapper.insertBatch(actGiveRecords);
|
activateInRecordMapper.insertBatch(actGiveRecords);
|
||||||
tbShopCoupon.setLeftNumber(tbShopCoupon.getLeftNumber()-activate.getNum());
|
tbShopCoupon.setLeftNumber(tbShopCoupon.getLeftNumber() - activate.getNum());
|
||||||
couponMapper.update(tbShopCoupon);
|
couponMapper.update(tbShopCoupon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1555,8 +1573,9 @@ public class PayService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查充值回调是否是霸王餐活动
|
* 检查充值回调是否是霸王餐活动
|
||||||
* @param memberIn 充值记录
|
*
|
||||||
* @param payType 支付平台
|
* @param memberIn 充值记录
|
||||||
|
* @param payType 支付平台
|
||||||
* @param payOrderNo 三方交易订单号
|
* @param payOrderNo 三方交易订单号
|
||||||
*/
|
*/
|
||||||
private void checkFreeDineForMemberInCallBack(TbMemberIn memberIn, String payType, String payOrderNo) {
|
private void checkFreeDineForMemberInCallBack(TbMemberIn memberIn, String payType, String payOrderNo) {
|
||||||
@@ -1573,23 +1592,22 @@ public class PayService {
|
|||||||
|
|
||||||
Integer shopId = Integer.valueOf(orderInfo.getShopId());
|
Integer shopId = Integer.valueOf(orderInfo.getShopId());
|
||||||
// 销毁使用的优惠券
|
// 销毁使用的优惠券
|
||||||
// if (StrUtil.isNotBlank(orderInfo.getActivateInInfoList())) {
|
if (StrUtil.isNotBlank(orderInfo.getCouponInfoList())) {
|
||||||
// ArrayList<TbActivateOutRecord> activateOutRecords = new ArrayList<>();
|
ArrayList<TbActivateOutRecord> activateOutRecords = new ArrayList<>();
|
||||||
// JSONArray activateInfoList = JSONObject.parseArray(orderInfo.getActivateInInfoList());
|
OrderCouponInfoDTO couponInfoDTO = JSONObject.parseObject(orderInfo.getCouponInfoList(), OrderCouponInfoDTO.class);
|
||||||
// activateInfoList.forEach(item -> {
|
couponInfoDTO.getFullReductionCouponMap().values().forEach(item -> {
|
||||||
// ActivateInInfoVO infoVO = ((JSONObject)item).toJavaObject(ActivateInInfoVO.class);
|
TbActivateOutRecord tbActivateOutRecord = new TbActivateOutRecord();
|
||||||
// TbActivateOutRecord tbActivateOutRecord = new TbActivateOutRecord();
|
tbActivateOutRecord.setShopId(shopId);
|
||||||
// tbActivateOutRecord.setShopId(shopId);
|
tbActivateOutRecord.setGiveId(item.getId());
|
||||||
// tbActivateOutRecord.setGiveId(infoVO.getId());
|
tbActivateOutRecord.setVipUserId(Integer.valueOf(orderInfo.getMemberId()));
|
||||||
// tbActivateOutRecord.setVipUserId(Integer.valueOf(orderInfo.getMemberId()));
|
tbActivateOutRecord.setType(TableConstant.ActivateOutRecord.Type.FULL_REDUCTION.getValue());
|
||||||
// tbActivateOutRecord.setType(TableConstant.ActivateOutRecord.Type.FULL_REDUCTION.getValue());
|
tbActivateOutRecord.setUseNum(item.getCurrentUseNum());
|
||||||
// tbActivateOutRecord.setUseNum(infoVO.getNum());
|
tbActivateOutRecord.setStatus(TableConstant.ActivateOutRecord.Status.CLOSED.getValue());
|
||||||
// tbActivateOutRecord.setStatus(TableConstant.ActivateOutRecord.Status.CLOSED.getValue());
|
tbActivateOutRecord.setCreateTime(DateUtil.date());
|
||||||
// tbActivateOutRecord.setCreateTime(DateUtil.date());
|
activateOutRecords.add(tbActivateOutRecord);
|
||||||
// activateOutRecords.add(tbActivateOutRecord);
|
});
|
||||||
// });
|
shopCouponService.use(shopId, orderInfo.getId(), Integer.valueOf(orderInfo.getUserId()), activateOutRecords);
|
||||||
// shopCouponService.use(shopId, orderInfo.getId(), Integer.valueOf(orderInfo.getUserId()), activateOutRecords);
|
}
|
||||||
// }
|
|
||||||
// 更改订单状态
|
// 更改订单状态
|
||||||
orderSuccessPay(orderInfo, payType, payOrderNo);
|
orderSuccessPay(orderInfo, payType, payOrderNo);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user