123
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.cai.manager;
|
||||
|
||||
import com.ruoyi.cai.dto.ConsumeResp;
|
||||
import com.ruoyi.cai.dto.app.query.GiveGiftRes;
|
||||
import com.ruoyi.cai.dto.app.query.GiveGuardReq;
|
||||
import com.ruoyi.cai.mq.AmqpProducer;
|
||||
import com.ruoyi.cai.service.GuardTotalService;
|
||||
import com.ruoyi.cai.service.RechargeOrderService;
|
||||
import com.ruoyi.cai.service.UserGiftService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ConsumerManager {
|
||||
@Autowired
|
||||
private GuardTotalService guardTotalService;
|
||||
@Autowired
|
||||
private UserGiftService userGiftService;
|
||||
@Autowired
|
||||
private AmqpProducer amqpProducer;
|
||||
@Autowired
|
||||
private RechargeOrderService rechargeOrderService;
|
||||
|
||||
public ConsumeResp sendGuard(GiveGuardReq query){
|
||||
ConsumeResp resp = guardTotalService.giveGuard(query);
|
||||
if(resp.isSuccess()){
|
||||
try {
|
||||
amqpProducer.sendCalculateSales(resp.getConsumeLogId()+"");
|
||||
}catch (Exception e){
|
||||
log.error("RabbitMq 发送失败, 守护分销流程流转失败!",e);
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
public ConsumeResp sendGift(GiveGiftRes query){
|
||||
ConsumeResp resp = userGiftService.giveGift(query);
|
||||
if(resp.isSuccess()){
|
||||
try {
|
||||
amqpProducer.sendCalculateSales(resp.getConsumeLogId()+"");
|
||||
}catch (Exception e){
|
||||
log.error("RabbitMq 发送失败, 礼物分销流程流转失败!",e);
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
public ConsumeResp rechargeOrderSuccess(String tradeNo){
|
||||
ConsumeResp resp = rechargeOrderService.orderSuccess(tradeNo);
|
||||
if(resp.isSuccess()){
|
||||
try {
|
||||
amqpProducer.sendCalculateSales(resp.getConsumeLogId()+"");
|
||||
}catch (Exception e){
|
||||
log.error("RabbitMq 发送失败, 充值分销流程流转失败!",e);
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user