Commit 75837549 authored by gaoyingwei's avatar gaoyingwei

修改 订单添加金币相关代码

parent b8b90cfe
...@@ -87,4 +87,15 @@ public class AppOrderController extends CyPaginationController<CmsOrder> { ...@@ -87,4 +87,15 @@ public class AppOrderController extends CyPaginationController<CmsOrder> {
} }
@PreAuthorize("@cyPerm.hasPerm('app:order:add')")
@CyOpeLogAnno(title = "system-订单信息表管理-充值金币", businessType = CyLogTypeEnum.INSERT)
@Operation(summary="充值金币", description="充值金币")
@PostMapping(value = "/order/addGold")
public CyResult addGold(@Valid @RequestBody CmsOrder cmsOrder, BindingResult bindingResult) {
CyPersistModel data = cmsOrderServiceImpl.addGold(cmsOrder);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
cmsOrder);
}
} }
...@@ -42,7 +42,7 @@ public class WxPayController { ...@@ -42,7 +42,7 @@ public class WxPayController {
*/ */
@PostMapping("/pay") @PostMapping("/pay")
public Map<String, Object> pay(HttpServletRequest request,@RequestBody OrderActivityDto orderActivityDto) throws IOException, JDOMException { public Map<String, Object> pay(HttpServletRequest request,@RequestBody OrderActivityDto orderActivityDto) throws IOException, JDOMException {
return wxPayService.wxPay(orderActivityDto.getOrderId(), orderActivityDto.getActivityId(), request); return wxPayService.wxPay(orderActivityDto.getOrderId(), orderActivityDto.getActivityId(), orderActivityDto.getType(), request);
} }
/** /**
...@@ -52,7 +52,7 @@ public class WxPayController { ...@@ -52,7 +52,7 @@ public class WxPayController {
*/ */
@PostMapping("/updateOrderStatus") @PostMapping("/updateOrderStatus")
public CyResult updateOrderStatus(@RequestBody OrderActivityDto orderActivityDto) { public CyResult updateOrderStatus(@RequestBody OrderActivityDto orderActivityDto) {
CyPersistModel data = wxPayService.updateOrderStatus(orderActivityDto.getOrderId(), orderActivityDto.getActivityId()); CyPersistModel data = wxPayService.updateOrderStatus(orderActivityDto.getOrderId(), orderActivityDto.getActivityId(), orderActivityDto.getType());
return CyResultGenUtil.builder(data, return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS, CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
......
...@@ -19,7 +19,7 @@ import java.io.IOException; ...@@ -19,7 +19,7 @@ import java.io.IOException;
public interface WxPayService { public interface WxPayService {
JSONObject wxPay(Long orderId, Long activityId, HttpServletRequest request) throws IOException, JDOMException; JSONObject wxPay(Long orderId, Long activityId, Integer type, HttpServletRequest request) throws IOException, JDOMException;
void wxNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, JDOMException; void wxNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, JDOMException;
...@@ -27,12 +27,13 @@ public interface WxPayService { ...@@ -27,12 +27,13 @@ public interface WxPayService {
/** /**
* 小程序调用wx.requestPayment(OBJECT)发起微信支付成功后更新订单状态 * 小程序调用wx.requestPayment(OBJECT)发起微信支付成功后更新订单状态
* @param request
* @param orderId * @param orderId
* @param activityId * @param activityId
* @param request * @param type
* @return * @return
*/ */
CyPersistModel updateOrderStatus(Long orderId, Long activityId); CyPersistModel updateOrderStatus(Long orderId, Long activityId, Integer type);
//主动查询微信订单状态 //主动查询微信订单状态
String selectWxOrderStatus(String orderNo) throws IOException, JDOMException; String selectWxOrderStatus(String orderNo) throws IOException, JDOMException;
......
...@@ -12,4 +12,7 @@ public class OrderActivityDto { ...@@ -12,4 +12,7 @@ public class OrderActivityDto {
/** 活动id */ /** 活动id */
private Long activityId; private Long activityId;
/** 订单类型 0活动 1金币 */
private Integer type;
} }
...@@ -209,5 +209,9 @@ public class CmsOrder extends CyIdSnowflakeEntity<CmsOrder> { ...@@ -209,5 +209,9 @@ public class CmsOrder extends CyIdSnowflakeEntity<CmsOrder> {
@Transient @Transient
@TableField(exist = false) @TableField(exist = false)
private String applicationStatus; private String applicationStatus;
//现在的余额
@TableField(exist = false)
private Integer balance;
} }
...@@ -128,4 +128,11 @@ public interface CmsOrderService { ...@@ -128,4 +128,11 @@ public interface CmsOrderService {
* @return * @return
*/ */
int manualCompensateOrder(CmsOrder dto); int manualCompensateOrder(CmsOrder dto);
/**
* 充值金币
* @param cmsOrder
* @return
*/
CyPersistModel addGold(CmsOrder cmsOrder);
} }
...@@ -165,7 +165,10 @@ public class AsyncFactory ...@@ -165,7 +165,10 @@ public class AsyncFactory
} }
orderInfo.setApplicationStatus("1"); orderInfo.setApplicationStatus("1");
//redis key: 【order:activity:${aid}:${oid}】 value 【hash】;ttl:-1;hash state-> 【未同步】,status -> 退款中 (2 3) //redis key: 【order:activity:${aid}:${oid}】 value 【hash】;ttl:-1;hash state-> 【未同步】,status -> 退款中 (2 3)
CySpringBeanComp.getBean(CyRedisServiceImpl.class).set(RedisCons.ORDER_ACTIVITY +":"+ orderInfo.getGoodsId() + ":" + orderInfo.getBusinessId(),orderInfo); if (orderInfo.getType().equals(0))
CySpringBeanComp.getBean(CyRedisServiceImpl.class).set(RedisCons.ORDER_ACTIVITY +":"+ orderInfo.getGoodsId() + ":" + orderInfo.getBusinessId(),orderInfo);
else if (orderInfo.getType().equals(1))
CySpringBeanComp.getBean(CyRedisServiceImpl.class).set(RedisCons.ORDER_GOLD +":"+ orderInfo.getGoodsId() + ":" + orderInfo.getBusinessId(),orderInfo);
//发送 mq,exchange:`order_activity` route-key:`order_activity_status` value 【订单】 //发送 mq,exchange:`order_activity` route-key:`order_activity_status` value 【订单】
// CySpringBeanComp.getBean(RabbitClusterUtil.class).sendMsg(orderInfo, // CySpringBeanComp.getBean(RabbitClusterUtil.class).sendMsg(orderInfo,
// CySpringBeanComp.getBean(RabbitMQConfigBean.class).ORDER_EXCHANGE_NAME, // CySpringBeanComp.getBean(RabbitMQConfigBean.class).ORDER_EXCHANGE_NAME,
......
...@@ -24,6 +24,8 @@ public class RedisCons { ...@@ -24,6 +24,8 @@ public class RedisCons {
//订单活动信息 //订单活动信息
public static final String ORDER_ACTIVITY = "order:activity"; public static final String ORDER_ACTIVITY = "order:activity";
//订单金币信息
public static final String ORDER_GOLD = "order:gold";
//订单数据库锁 //订单数据库锁
public static final String ORDER_DB = "order:db:"; public static final String ORDER_DB = "order:db:";
//订单redis锁 //订单redis锁
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment