parent
37dc169607
commit
fece3c274e
|
|
@ -3,6 +3,7 @@ package cn.ysk.cashier.controller;
|
|||
import cn.ysk.cashier.annotation.AnonymousAccess;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||
import cn.ysk.cashier.service.order.TbOrderInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
|
@ -19,10 +20,24 @@ import java.util.Map;
|
|||
@RequestMapping("/notify")
|
||||
public class NotifyController {
|
||||
|
||||
private final TbOrderInfoService orderInfoService;
|
||||
|
||||
public NotifyController(TbOrderInfoService orderInfoService) {
|
||||
this.orderInfoService = orderInfoService;
|
||||
}
|
||||
|
||||
@AnonymousAccess
|
||||
@RequestMapping("/fstPay")
|
||||
public Object fstPay(@RequestBody Map<String, Object> req) {
|
||||
log.info("信息回调回调回调回调回调--------------------------------------------------------------------------{}", req);
|
||||
public Object fstPay(@RequestBody Map<String, String> req) {
|
||||
log.info("接收到福商通支付回调: {}", req);
|
||||
orderInfoService.successPay(req);
|
||||
return null;
|
||||
}
|
||||
|
||||
@AnonymousAccess
|
||||
@RequestMapping("/fstReturn")
|
||||
public Object fstReturn(@RequestBody Map<String, String> req) {
|
||||
log.info("接收到福商通退款回调: {}", req);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,8 +107,9 @@ public class TbPlaceController {
|
|||
@ApiOperation("代客下单 ")
|
||||
public ResponseEntity<Object> getMasterId(@RequestParam Integer shopId,
|
||||
@RequestParam String tableId,
|
||||
@RequestParam(required = false) Integer orderId,
|
||||
@RequestParam(defaultValue = "") String useType) {
|
||||
return ResponseEntity.ok(tbShopTableService.getMasterId(shopId, tableId, useType));
|
||||
return ResponseEntity.ok(tbShopTableService.getMasterId(shopId, tableId, useType, orderId));
|
||||
}
|
||||
|
||||
@PostMapping("/order")
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class PayServiceImpl implements PayService {
|
|||
private String gateWayUrl;
|
||||
@Value("${thirdPay.url}")
|
||||
private String url;
|
||||
@Value("${thirdPay.callBack}")
|
||||
@Value("${thirdPay.notify.fstReturn}")
|
||||
private String callBack;
|
||||
|
||||
private final RestTemplate restTemplate;
|
||||
|
|
|
|||
|
|
@ -571,4 +571,11 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||
rabbitMsgUtils.addBalanceRecord(baObj);
|
||||
// producer.balance(baObj.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void successPay(Map<String, String> req) {
|
||||
if ("000000".equals(req.get("code"))) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -981,7 +981,15 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
private final StringRedisTemplate redisTemplate;
|
||||
|
||||
@Override
|
||||
public JSONObject getMasterId(Integer shopId, String tableId, String useType) {
|
||||
public JSONObject getMasterId(Integer shopId, String tableId, String useType, Integer orderId) {
|
||||
if (orderId != null) {
|
||||
TbOrderInfo orderInfo = orderInfoMapper.selectById(orderId);
|
||||
if (orderInfo != null) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("masterId", orderInfo.getMasterId());
|
||||
return jsonObject;
|
||||
}
|
||||
}
|
||||
String account = tokenProvider.getSubject();
|
||||
if (account == null) {
|
||||
throw new BadRequestException("token解析失败");
|
||||
|
|
@ -1656,7 +1664,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
|
||||
@Override
|
||||
public Object choseTable(ChoseTableDTO choseTableDTO) {
|
||||
String masterId = getMasterId(choseTableDTO.getShopId(), choseTableDTO.getNewTableId(), null).getString("masterId");
|
||||
String masterId = getMasterId(choseTableDTO.getShopId(), choseTableDTO.getNewTableId(), null, null).getString("masterId");
|
||||
|
||||
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getQrcode, choseTableDTO.getNewTableId())
|
||||
|
|
@ -2036,6 +2044,9 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
orderInfoService.depositReturn(Integer.valueOf(orderInfo.getUserId()), Integer.valueOf(orderInfo.getShopId()), returnOrderInfo.getRefundAmount());
|
||||
}
|
||||
|
||||
orderInfo.setStatus("refund");
|
||||
orderInfoMapper.updateById(orderInfo);
|
||||
|
||||
// 打印退款小票
|
||||
// producer.printMechine(newOrderInfo.getId().toString());
|
||||
|
||||
|
|
|
|||
|
|
@ -97,4 +97,9 @@ public interface TbOrderInfoService {
|
|||
*/
|
||||
void depositReturn(Integer userId, Integer shopId, BigDecimal returnAmount);
|
||||
|
||||
/**
|
||||
* 支付回调
|
||||
* @param req
|
||||
*/
|
||||
void successPay(Map<String, String> req);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public interface TbShopTableService {
|
|||
|
||||
Object createOrder(CreateOrderDTO createOrderDTO, boolean addMasterId, boolean isPrint);
|
||||
|
||||
JSONObject getMasterId(Integer shopId, String tableId, String useType);
|
||||
JSONObject getMasterId(Integer shopId, String tableId, String useType, Integer orderId);
|
||||
|
||||
Object pending(PendingDTO pendingDTO);
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ thirdPay:
|
|||
url: https://paymentapi.sxczgkj.cn
|
||||
notify:
|
||||
fstPay: https://admintestpapi.sxczgkj.cn/notify/fstPay
|
||||
fstReturn: https://admintestpapi.sxczgkj.cn/notify/fstReturn
|
||||
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:/cn/ysk/cashier/mybatis/mapper/*Mapper.xml
|
||||
|
|
|
|||
Loading…
Reference in New Issue