取餐码获取修改
退款接口完善
This commit is contained in:
@@ -3,6 +3,7 @@ package cn.ysk.cashier.controller;
|
|||||||
import cn.ysk.cashier.annotation.AnonymousAccess;
|
import cn.ysk.cashier.annotation.AnonymousAccess;
|
||||||
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
|
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
|
||||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||||
|
import cn.ysk.cashier.service.order.TbOrderInfoService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -19,10 +20,24 @@ import java.util.Map;
|
|||||||
@RequestMapping("/notify")
|
@RequestMapping("/notify")
|
||||||
public class NotifyController {
|
public class NotifyController {
|
||||||
|
|
||||||
|
private final TbOrderInfoService orderInfoService;
|
||||||
|
|
||||||
|
public NotifyController(TbOrderInfoService orderInfoService) {
|
||||||
|
this.orderInfoService = orderInfoService;
|
||||||
|
}
|
||||||
|
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
@RequestMapping("/fstPay")
|
@RequestMapping("/fstPay")
|
||||||
public Object fstPay(@RequestBody Map<String, Object> req) {
|
public Object fstPay(@RequestBody Map<String, String> req) {
|
||||||
log.info("信息回调回调回调回调回调--------------------------------------------------------------------------{}", 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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,8 +107,9 @@ public class TbPlaceController {
|
|||||||
@ApiOperation("代客下单 ")
|
@ApiOperation("代客下单 ")
|
||||||
public ResponseEntity<Object> getMasterId(@RequestParam Integer shopId,
|
public ResponseEntity<Object> getMasterId(@RequestParam Integer shopId,
|
||||||
@RequestParam String tableId,
|
@RequestParam String tableId,
|
||||||
|
@RequestParam(required = false) Integer orderId,
|
||||||
@RequestParam(defaultValue = "") String useType) {
|
@RequestParam(defaultValue = "") String useType) {
|
||||||
return ResponseEntity.ok(tbShopTableService.getMasterId(shopId, tableId, useType));
|
return ResponseEntity.ok(tbShopTableService.getMasterId(shopId, tableId, useType, orderId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/order")
|
@PostMapping("/order")
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class PayServiceImpl implements PayService {
|
|||||||
private String gateWayUrl;
|
private String gateWayUrl;
|
||||||
@Value("${thirdPay.url}")
|
@Value("${thirdPay.url}")
|
||||||
private String url;
|
private String url;
|
||||||
@Value("${thirdPay.callBack}")
|
@Value("${thirdPay.notify.fstReturn}")
|
||||||
private String callBack;
|
private String callBack;
|
||||||
|
|
||||||
private final RestTemplate restTemplate;
|
private final RestTemplate restTemplate;
|
||||||
|
|||||||
@@ -571,4 +571,11 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||||||
rabbitMsgUtils.addBalanceRecord(baObj);
|
rabbitMsgUtils.addBalanceRecord(baObj);
|
||||||
// producer.balance(baObj.toString());
|
// 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;
|
private final StringRedisTemplate redisTemplate;
|
||||||
|
|
||||||
@Override
|
@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();
|
String account = tokenProvider.getSubject();
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
throw new BadRequestException("token解析失败");
|
throw new BadRequestException("token解析失败");
|
||||||
@@ -1656,7 +1664,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object choseTable(ChoseTableDTO choseTableDTO) {
|
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>()
|
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>()
|
||||||
.eq(TbShopTable::getQrcode, choseTableDTO.getNewTableId())
|
.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());
|
orderInfoService.depositReturn(Integer.valueOf(orderInfo.getUserId()), Integer.valueOf(orderInfo.getShopId()), returnOrderInfo.getRefundAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
orderInfo.setStatus("refund");
|
||||||
|
orderInfoMapper.updateById(orderInfo);
|
||||||
|
|
||||||
// 打印退款小票
|
// 打印退款小票
|
||||||
// producer.printMechine(newOrderInfo.getId().toString());
|
// producer.printMechine(newOrderInfo.getId().toString());
|
||||||
|
|
||||||
|
|||||||
@@ -97,4 +97,9 @@ public interface TbOrderInfoService {
|
|||||||
*/
|
*/
|
||||||
void depositReturn(Integer userId, Integer shopId, BigDecimal returnAmount);
|
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);
|
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);
|
Object pending(PendingDTO pendingDTO);
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ thirdPay:
|
|||||||
url: https://paymentapi.sxczgkj.cn
|
url: https://paymentapi.sxczgkj.cn
|
||||||
notify:
|
notify:
|
||||||
fstPay: https://admintestpapi.sxczgkj.cn/notify/fstPay
|
fstPay: https://admintestpapi.sxczgkj.cn/notify/fstPay
|
||||||
|
fstReturn: https://admintestpapi.sxczgkj.cn/notify/fstReturn
|
||||||
|
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
mapper-locations: classpath:/cn/ysk/cashier/mybatis/mapper/*Mapper.xml
|
mapper-locations: classpath:/cn/ysk/cashier/mybatis/mapper/*Mapper.xml
|
||||||
|
|||||||
Reference in New Issue
Block a user