退款订单添加退款备注

This commit is contained in:
2024-10-11 10:54:17 +08:00
parent 504fec5011
commit 4cd6d6742c
5 changed files with 34 additions and 5 deletions

View File

@@ -31,13 +31,14 @@ public class NotifyController {
public Object fstPay(@RequestBody Map<String, String> req) {
log.info("接收到福商通支付回调: {}", req);
orderInfoService.successPay(req);
return null;
return "ok";
}
@AnonymousAccess
@RequestMapping("/fstReturn")
public Object fstReturn(@RequestBody Map<String, String> req) {
log.info("接收到福商通退款回调: {}", req);
return null;
orderInfoService.successReturn(req);
return "ok";
}
}

View File

@@ -237,6 +237,9 @@ public class TbOrderInfo implements Serializable {
@Column(name = "`seat_count`")
private Integer seatCount;
@Column(name = "`refund_remark`")
private String refundRemark;
public void copy(TbOrderInfo source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}

View File

@@ -597,4 +597,21 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
payService.checkPayState(orderInfo);
}
}
@Override
public void successReturn(Map<String, String> req) {
JSONObject bizData = JSONObject.parseObject(req.get("bizData"));
if ("000000".equals(req.get("code")) &&
"SUCCESS".equals(bizData.getString("state"))) {
String payOrderId = bizData.get("payOrderId").toString();
TbOrderInfo orderInfo = orderInfoMapper.selectOne(new LambdaQueryWrapper<TbOrderInfo>()
.eq(TbOrderInfo::getPayOrderNo, payOrderId));
if (orderInfo == null) {
log.warn("订单信息不存在: {}", payOrderId);
return;
}
orderInfo.setStatus("refund");
orderInfoMapper.updateById(orderInfo);
}
}
}

View File

@@ -1980,6 +1980,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
returnOrder.setCreatedAt(DateUtil.current());
returnOrder.setPayOrderNo(null);
returnOrder.setSource(oldOrderInfo.getId());
returnOrder.setRefundRemark(returnOrderDTO.getNote());
orderInfoMapper.insert(returnOrder);
updateStockAndRecord(detailList);
@@ -2047,16 +2048,17 @@ public class TbShopTableServiceImpl implements TbShopTableService {
String payType = orderInfo.getPayType();
// // 线上退款
orderInfo.setRefundAmount(returnOrderInfo.getRefundAmount());
orderInfo.setRefundRemark(returnOrderDTO.getNote());
if ("scanCode".equals(payType) || "wx_lite".equals(payType)) {
payService.returnOrder(Integer.valueOf(shopId), orderInfo, returnOrderInfo);
orderInfo.setStatus("refunding");
// 储值卡支付退款
} else if ("deposit".equals(payType)) {
orderInfoService.depositReturn(Integer.valueOf(orderInfo.getUserId()), Integer.valueOf(orderInfo.getShopId()), returnOrderInfo.getRefundAmount());
orderInfo.setStatus("refund");
}
orderInfo.setStatus("refund");
orderInfoMapper.updateById(orderInfo);
// 打印退款小票
// producer.printMechine(newOrderInfo.getId().toString());

View File

@@ -102,4 +102,10 @@ public interface TbOrderInfoService {
* @param req
*/
void successPay(Map<String, String> req);
/**
* 退款成功回调
* @param req
*/
void successReturn(Map<String, String> req);
}