feat: 订单增加后台修改支付状态接口

This commit is contained in:
wst 2024-12-01 10:29:23 +08:00
parent 66f8de98ca
commit 88244b7560
3 changed files with 28 additions and 5 deletions

View file

@ -185,4 +185,18 @@ public class OrderController {
public void generatePayOrderRrCode(InputObject inputObject, OutputObject outputObject) {
orderService.generatePayOrderRrCode(inputObject, outputObject);
}
/**
* 后台修改支付状态
*
* @param inputObject 入参以及用户信息等获取对象
* @param outputObject 出参以及提示信息的返回值对象
*/
@ApiOperation(id = "updateOrderToPayState", value = "后台修改支付状态", method = "POST", allUse = "1")
@ApiImplicitParams({
@ApiImplicitParam(id = "id", name = "id", value = "主键id", required = "required")})
@RequestMapping("/post/OrderController/updateOrderToPayState")
public void updateOrderToPayState(InputObject inputObject, OutputObject outputObject){
orderService.updateOrderToPayState(inputObject, outputObject);
}
}

View file

@ -33,4 +33,6 @@ public interface OrderService extends SkyeyeBusinessService<Order> {
void generatePayOrderRrCode(InputObject inputObject, OutputObject outputObject);
void changeOrderAdjustPrice(InputObject inputObject, OutputObject outputObject);
void updateOrderToPayState(InputObject inputObject, OutputObject outputObject);
}

View file

@ -337,9 +337,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
case "5":// 处理中
stateList = Arrays.asList(new Integer[]{
ShopOrderState.REFUNDING.getKey(), // 退款中
ShopOrderState.SALESRETURNING.getKey(),//退货中
ShopOrderState.EXCHANGEING.getKey()});//换货中
break;
case "6": // 申请记录
@ -387,6 +385,18 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
refreshCache(params.get("id").toString());
}
@Override
public void updateOrderToPayState(InputObject inputObject, OutputObject outputObject) {
String orderId = inputObject.getParams().get("id").toString();
if (StrUtil.isEmpty(orderId)) {
return;
}
UpdateWrapper<Order> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq(CommonConstants.ID, orderId);
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getState), ShopOrderState.UNDELIVERED.getKey());
refreshCache(orderId);
}
@Override
public void deletePostpose(List<String> ids) {
orderItemService.deleteByPerentIds(ids);
@ -465,8 +475,6 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
Map<String, Object> payRresult = iPayService.payment(BeanUtil.beanToMap(one), channelCode, "", channelExtras, payProperties.getOrderNotifyUrl()).getBean();
Map<String, Object> payChannel = JSONUtil.toBean(payRresult.get("payChannel").toString(), null);
Map<String, Object> payOrderRespDTO = JSONUtil.toBean(payRresult.get("payOrderRespDTO").toString(), null);
UpdateWrapper<Order> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq(CommonConstants.ID, id);
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getState), ShopOrderState.UNDELIVERED.getKey());
@ -477,7 +485,6 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
one.getPayPrice(), payChannel.get("feeRate").toString()));
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getExtensionId), payOrderRespDTO.get("id").toString());
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getExtensionNo), payOrderRespDTO.get("no").toString());
update(updateWrapper);
refreshCache(id);
}