|
@@ -1,9 +1,11 @@
|
|
|
package com.fdage.controller.app;
|
|
|
|
|
|
import com.fdage.base.dto.WechatRefundApiResult;
|
|
|
+import com.fdage.base.entity.TmDesk;
|
|
|
import com.fdage.base.entity.TmOrder;
|
|
|
import com.fdage.base.enums.OrderPayStatusEnum;
|
|
|
import com.fdage.base.enums.OrderStatusEnum;
|
|
|
+import com.fdage.base.service.impl.TmDeskServiceImpl;
|
|
|
import com.fdage.base.service.impl.TmOrderServiceImpl;
|
|
|
import com.fdage.base.utils.DataUtils;
|
|
|
import com.fdage.base.utils.MapUtils;
|
|
@@ -11,6 +13,8 @@ import com.fdage.base.utils.WechatUtil;
|
|
|
import com.fdage.base.utils.XmlUtil;
|
|
|
import com.fdage.controller.BaseController;
|
|
|
import fdage.back.sdk.base.entity.Result;
|
|
|
+import fdage.back.sdk.base.enums.ResultCodeEnum;
|
|
|
+import fdage.back.sdk.base.exception.CommonBaseException;
|
|
|
import fdage.back.sdk.utils.ResourceUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
@@ -53,6 +57,9 @@ public class AppPayController extends BaseController {
|
|
|
@Autowired
|
|
|
private RedisTemplate redisTemplate;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TmDeskServiceImpl tmDeskService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取支付的请求参数
|
|
|
*/
|
|
@@ -241,8 +248,19 @@ public class AppPayController extends BaseController {
|
|
|
//更新订单的支付状态为已支付,同时跟新订单的状态为预定成功 TODO:这里二期需要改成:审核中
|
|
|
tmOrderService.updateOrderStatusAndPayStatus(orderDetail ,
|
|
|
OrderPayStatusEnum.PAY_SUCCESS.getStatus() , OrderStatusEnum.ORDER_SUCCESS.getStatus());
|
|
|
- //TODO:这里要翻转桌子/包厢的状态为不可预定
|
|
|
+ if(StringUtils.isNotBlank(orderDetail.getDeskId())){
|
|
|
+ TmDesk tmDesk = tmDeskService.getById(orderDetail.getDeskId());
|
|
|
+ if(null != tmDesk){
|
|
|
+ if(null != tmDesk.getStatus() && tmDesk.getStatus().compareTo(1) != 0){
|
|
|
+ tmDesk.setStatus(1);
|
|
|
+ tmDesk.setUpdateTime(LocalDateTime.now());
|
|
|
+ if(!tmDeskService.updateById(tmDesk)){
|
|
|
+ throw new CommonBaseException(ResultCodeEnum.D101 , "更细桌子/包厢状态失败");
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return Result.success("支付成功");
|
|
|
} else if ("USERPAYING".equals(trade_state)) {
|
|
|
//在途,正在支付中,则递归调用3次
|