| | |
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.IntegralTaskMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserAccountBindingMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInviteMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserRedPackGiftMQMsg;
|
| | |
| | | tag = "";
|
| | |
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name())) {// 返利到账
|
| | | OrderMoneyRecievedMQMsg orderMoneyRecievedMQMsg = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | // 分享订单奖励
|
| | | if (orderMoneyRecievedMQMsg.getType() == OrderMoneyRecievedMQMsg.TYPE_SHARE) {
|
| | | // try {
|
| | | // redPackWinInviteService.orderArriveReward(orderMoneyRecievedMQMsg.getUid(),
|
| | | // orderMoneyRecievedMQMsg.getSourceType(),
|
| | | // orderMoneyRecievedMQMsg.getOrderId());
|
| | | // } catch (Exception e) {
|
| | | // e.printStackTrace();
|
| | | // }
|
| | | }
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderStatistic.name())) {// 订单统计
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderStatistic.name())) {// 订单统计
|
| | | OrderMQMsg orderMQMsg = new Gson().fromJson(new String(message.getBody()), OrderMQMsg.class);
|
| | | if (orderMQMsg.isValid()) {
|
| | | try {// 邀请奖励
|
| | | redPackWinInviteService.inviteSucceedReward(orderMQMsg.getUid());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | // 发送24小时延时消息
|
| | | // 测试时发送
|
| | | int hour = 24;
|
| | |
| | | producer.send(msg);
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderStatisticDelay.name())) {// 订单统计
|
| | | OrderMQMsg orderMQMsg = new Gson().fromJson(new String(message.getBody()), OrderMQMsg.class);
|
| | | int hour = 24;
|
| | |
| | | }
|
| | |
|
| | | if (orderMQMsg.getDelayHour() == hour) {
|
| | | // TODO 处理延时消息
|
| | | try {// 邀请奖励
|
| | | redPackWinInviteService.inviteSucceedReward(orderMQMsg.getUid());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiSeparateByOrderNo.name())) {// 订单到账(按订单号处理)
|
| | |
| | | || orderMoneyRecievedMQMsg.getType() == OrderMoneyRecievedMQMsg.TYPE_SHARE) {
|
| | | if (!StringUtil.isNullOrEmpty(orderMoneyRecievedMQMsg.getOrderId())
|
| | | && orderMoneyRecievedMQMsg.getUid() != null) {
|
| | | // TODO 自购与分享订单到账处理
|
| | | try {
|
| | | redPackWinInviteService.orderArriveReward(orderMoneyRecievedMQMsg.getUid(), orderMoneyRecievedMQMsg.getSourceType(), orderMoneyRecievedMQMsg.getOrderId());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return Action.CommitMessage;
|
| | | } else if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | boolean inviteSucceedReward = false;
|
| | |
| | | UserAccountBindingMQMsg userAccountBindingMQMsg = new Gson().fromJson(new String(message.getBody()),
|
| | | UserAccountBindingMQMsg.class);
|
| | | Integer type = userAccountBindingMQMsg.getType();
|
| | | if (type == UserAccountBindingMQMsg.TYPE_PHONE || type == UserAccountBindingMQMsg.TYPE_TAOBAO) {
|
| | | if (type == UserAccountBindingMQMsg.TYPE_PHONE || type == UserAccountBindingMQMsg.TYPE_WX
|
| | | || type == UserAccountBindingMQMsg.TYPE_TAOBAO) {
|
| | | inviteSucceedReward = true;
|
| | | uid = userAccountBindingMQMsg.getUid();
|
| | | }
|
| | |
| | | UserInviteMQMsg.class);
|
| | | inviteSucceedReward = true;
|
| | | uid = userInviteMQMsg.getWorkerId();
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.integralTaskFinish.name())) {// 金币任务完成
|
| | | IntegralTaskMQMsg integralTaskMQMsg = new Gson().fromJson(new String(message.getBody()),
|
| | | IntegralTaskMQMsg.class);
|
| | | inviteSucceedReward = true;
|
| | | uid = integralTaskMQMsg.getUid();
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.redPackGiftDrawback.name())) {// 红包赠送
|
| | | UserRedPackGiftMQMsg userRedPackGiftMQMsg = new Gson().fromJson(new String(message.getBody()),
|
| | | UserRedPackGiftMQMsg.class);
|
| | | // 红包赠送到期未领取
|
| | | try {
|
| | | try { // 红包赠送到期未领取
|
| | | redPackGiveRecordService.overdueByPrimaryKey(userRedPackGiftMQMsg.getId());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | |
| | |
|
| | | if (inviteSucceedReward) {
|
| | | try {// 邀请奖励
|
| | | if (uid == 6269748) {
|
| | | System.out.println(uid);
|
| | | }
|
| | | // redPackWinInviteService.inviteSucceedReward(uid);
|
| | | redPackWinInviteService.inviteSucceedReward(uid);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|