1个文件已删除
2 文件已重命名
31个文件已修改
3个文件已添加
| | |
| | | package com.yeshi.fanli.dto.mq.order;
|
| | |
|
| | | import com.yeshi.fanli.util.annotation.UserActive;
|
| | |
|
| | | public enum OrderTopicTagEnum {
|
| | | orderStatistic(UserActive.class), // 订单统计
|
| | | orderUpdate(UserActive.class), // 订单修改
|
| | | orderFanLiActual(UserActive.class), // 订单实时到账
|
| | | orderFanLiDelay(UserActive.class), // 订单到账延时消息
|
| | | banLiShopOrderDelay(UserActive.class);// 板栗商城下单
|
| | |
|
| | | private final Class<?> clazz;
|
| | |
|
| | | private OrderTopicTagEnum(Class<?> clazz) {
|
| | | this.clazz = clazz;
|
| | | }
|
| | |
|
| | | public Class<?> getClazz() {
|
| | | return this.clazz;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dto.mq.order.body;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | |
|
| | | public class BanLiShopOrderMQMsg extends BaseMQMsgBody {
|
| | | private Long orderId;// 订单ID
|
| | | private Long uid;// 用户ID
|
| | |
|
| | | public BanLiShopOrderMQMsg(Long orderId, Long uid) {
|
| | | super();
|
| | | this.orderId = orderId;
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public BanLiShopOrderMQMsg() {
|
| | | super();
|
| | | }
|
| | |
|
| | | public Long getOrderId() {
|
| | | return orderId;
|
| | | }
|
| | |
|
| | | public void setOrderId(Long orderId) {
|
| | | this.orderId = orderId;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | }
|
File was renamed from fanli/src/main/java/com/yeshi/fanli/dto/order/OrderMQMsgDTO.java |
| | |
| | | package com.yeshi.fanli.dto.order;
|
| | | package com.yeshi.fanli.dto.mq.order.body;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | |
|
| | | /**
|
| | | * 红包MQ消息
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class OrderMQMsgDTO {
|
| | | public class OrderMQMsg extends BaseMQMsgBody{
|
| | | private String orderId;
|
| | | private Integer type;
|
| | | private Long uid;
|
| | |
|
| | | public OrderMQMsgDTO(String orderId, Integer type, Long uid) {
|
| | | public OrderMQMsg(String orderId, Integer type, Long uid) {
|
| | | super();
|
| | | this.orderId = orderId;
|
| | | this.type = type;
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public OrderMQMsgDTO() {
|
| | | |
| | | public OrderMQMsg() {
|
| | | super();
|
| | | }
|
| | |
|
| | |
|
File was renamed from fanli/src/main/java/com/yeshi/fanli/dto/order/OrderMoneyRecievedMQMsgDTO.java |
| | |
| | | package com.yeshi.fanli.dto.order;
|
| | | package com.yeshi.fanli.dto.mq.order.body;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | |
|
| | | /**
|
| | | * 订单到账MQ消息
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class OrderMoneyRecievedMQMsgDTO {
|
| | | public class OrderMoneyRecievedMQMsg extends BaseMQMsgBody {
|
| | | public static final int TYPE_ZIGOU = 1;// 自购到账
|
| | | public static final int TYPE_SHARE = 2;// 分享到账
|
| | | public static final int TYPE_INVITE = 3;// 邀请到账
|
| | |
| | | this.orderFirst = orderFirst;
|
| | | }
|
| | |
|
| | | public OrderMoneyRecievedMQMsgDTO() {
|
| | |
|
| | | public OrderMoneyRecievedMQMsg() {
|
| | | super();
|
| | | }
|
| | |
|
| | | public OrderMoneyRecievedMQMsgDTO(int type, Long uid, Integer sourceType, String orderId, BigDecimal money,
|
| | | public OrderMoneyRecievedMQMsg(int type, Long uid, Integer sourceType, String orderId, BigDecimal money,
|
| | | Date date) {
|
| | | super();
|
| | | this.type = type;
|
| | | this.uid = uid;
|
| | | this.sourceType = sourceType;
|
| | |
| | | import com.yeshi.fanli.util.annotation.UserActive;
|
| | |
|
| | | public enum UserTopicTagEnum {
|
| | | userAccount(UserActive.class);
|
| | | userAccountBinding(UserActive.class), // 用户账号绑定
|
| | | userActve(UserActive.class), // 用户活跃
|
| | | useSystemCoupon(UserActive.class), // 系统券使用
|
| | | inviteSuccess(UserActive.class), // 邀请成功
|
| | | integralTaskFinish(UserActive.class);// 完成金币任务
|
| | |
|
| | | private final Class<?> clazz;
|
| | |
|
| | | private UserTopicTagEnum(Class<?> clazz) {
|
New file |
| | |
| | | package com.yeshi.fanli.dto.mq.user.body;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | |
|
| | | /**
|
| | | * 用券的mq消息实体
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class UserSystemCouponUseMQMsg extends BaseMQMsgBody {
|
| | | private Long userSystemCouponId;// 用户的券ID
|
| | | private String orderId;// 订单号
|
| | | private Integer sourceType;// 订单来源
|
| | | private String couponType;// 券类型
|
| | |
|
| | | public UserSystemCouponUseMQMsg(Long userSystemCouponId, String orderId, Integer sourceType, String couponType) {
|
| | | super();
|
| | | this.userSystemCouponId = userSystemCouponId;
|
| | | this.orderId = orderId;
|
| | | this.sourceType = sourceType;
|
| | | this.couponType = couponType;
|
| | | }
|
| | |
|
| | | public String getCouponType() {
|
| | | return couponType;
|
| | | }
|
| | |
|
| | | public void setCouponType(String couponType) {
|
| | | this.couponType = couponType;
|
| | | }
|
| | |
|
| | | public UserSystemCouponUseMQMsg() {
|
| | | super();
|
| | | }
|
| | |
|
| | | public Long getUserSystemCouponId() {
|
| | | return userSystemCouponId;
|
| | | }
|
| | |
|
| | | public void setUserSystemCouponId(Long userSystemCouponId) {
|
| | | this.userSystemCouponId = userSystemCouponId;
|
| | | }
|
| | |
|
| | | public String getOrderId() {
|
| | | return orderId;
|
| | | }
|
| | |
|
| | | public void setOrderId(String orderId) {
|
| | | this.orderId = orderId;
|
| | | }
|
| | |
|
| | | public Integer getSourceType() {
|
| | | return sourceType;
|
| | | }
|
| | |
|
| | | public void setSourceType(Integer sourceType) {
|
| | | this.sourceType = sourceType;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | seriesReward("连续奖励", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | refund("红包退回", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | useByShopOrder("商城订单使用", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | shopOrderDrawBack("商城订单退回", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | violation("红包涉嫌违规", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | giveOthers("红包赠送待领取中", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | giveOthersSucceed("红包赠送领取成功", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | |
| | |
|
| | | public final static int STATE_INVALID = -1;// 失效
|
| | | public final static int STATE_NO_PAY = 0;// 未支付
|
| | | public final static int STATE_PAID = 1;// 已支付,待审核
|
| | | public final static int STATE_PART_PAY = 1;// 部分支付
|
| | | public final static int STATE_PAID = 5;// 已支付,待审核
|
| | | public final static int STATE_REJECT = 10;// 审核拒绝
|
| | | public final static int STATE_SUCCESS = 20;// 交易成功
|
| | |
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.order.HongBaoOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | import com.yeshi.fanli.dto.HongBao;
|
| | | import com.yeshi.fanli.dto.order.OrderMoneyRecievedMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | |
| | | }
|
| | |
|
| | | // 邀请赚到账事务消息
|
| | | OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_INVITE, uid,
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_INVITE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(),
|
| | | new Gson().toJson(mqMsg).getBytes());
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | }
|
| | |
|
| | | // 邀请赚到账事务消息
|
| | | OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_INVITE, uid,
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_INVITE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | }
|
| | |
|
| | | // 邀请赚到账事务消息
|
| | | OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_INVITE, uid,
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_INVITE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | hongBaoList.addAll(tempHongBaoList);
|
| | | }
|
| | |
|
| | | OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_SHARE, uid,
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(),OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | hongBaoList.addAll(tempHongBaoList);
|
| | | }
|
| | |
|
| | | OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_SHARE, uid,
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | hongBaoList.addAll(tempHongBaoList);
|
| | | }
|
| | |
|
| | | OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_SHARE, uid,
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.order.HongBaoOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.dto.order.CommonOrderAddResultDTO;
|
| | | import com.yeshi.fanli.dto.order.OrderMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.order.OrderMoneyRecievedMQMsgDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | |
| | | }
|
| | |
|
| | | // 自购到账事务消息
|
| | | OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_ZIGOU,
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_ZIGOU,
|
| | | mainUser.getId(), hongBaoOrder.getCommonOrder().getSourceType(),
|
| | | hongBaoOrder.getCommonOrder().getOrderNo(), null, new Date());
|
| | | mqMsg.setOrderFirst(first);
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(),
|
| | | new Gson().toJson(mqMsg).getBytes());
|
| | | String key = mainUser.getId() + "-" + UUID.randomUUID().toString();
|
| | | msg.setKey(key);
|
| | | try {
|
| | |
| | | */
|
| | | private void addHongBaoWithMQ(List<CommonOrderAddResultDTO> commonOrderList, String orderId, Long uid,
|
| | | int sourceType, int hongBaoType) {
|
| | | // TODO 区分添加与修改
|
| | | final List<CommonOrder> coList = convertCommonOrder(commonOrderList);
|
| | | OrderMQMsgDTO mqMsg = new OrderMQMsgDTO(orderId, sourceType, uid);
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(),
|
| | | String.format(MQTagConstant.TAG_ORDER_STATISTIC_PREFIX + "%s-%s", sourceType, hongBaoType),
|
| | | OrderMQMsg mqMsg = new OrderMQMsg(orderId, sourceType, uid);
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderStatistic.name(),
|
| | | new Gson().toJson(mqMsg).getBytes());
|
| | | SendResult result = orderTransactionProducer.send(msg, new LocalTransactionExecuter() {
|
| | | @Override
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.redpack.RedPackDetailMapper;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackDetailService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.redpack.RedPackDetailVO;
|
| | | import com.yeshi.fanli.vo.redpack.RedPackMonthVO;
|
| | |
| | | public void insertSelective(RedPackDetail record) {
|
| | | redPackDetailMapper.insertSelective(record);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void updateByPrimaryKeySelective(RedPackDetail record) {
|
| | | redPackDetailMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public RedPackDetail getByIdentifyCode(String identifyCode) {
|
| | | return redPackDetailMapper.getByIdentifyCode(identifyCode);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public BigDecimal countAddMoneyByDate(long uid, int dateType) {
|
| | | return redPackDetailMapper.countAddMoneyByDate(uid, dateType);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public BigDecimal countUseMoneyByDate(long uid, int dateType) {
|
| | | return redPackDetailMapper.countUseMoneyByDate(uid, dateType);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public List<RedPackDetailVO> listUserMoneyDetailForClient(Long uid, Long detailId, Date maxTime) {
|
| | | List<RedPackDetailVO> finalList = new ArrayList<>();
|
| | |
| | | keys = monthMap.keySet().iterator();
|
| | | while (keys.hasNext()) {
|
| | | Integer key = keys.next();
|
| | | |
| | |
|
| | | BigDecimal expend = new BigDecimal(voList.get(p).getExpend());
|
| | | BigDecimal income = new BigDecimal(voList.get(p).getIncome());
|
| | | |
| | |
|
| | | // 去除支出负号
|
| | | finalList.get(key).getMonth().setExpend(expend.setScale(2).toString().replace("-", ""));
|
| | | finalList.get(key).getMonth().setIncome(income.setScale(2).toString());
|
| | |
| | | return finalList;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public long countUserMoneyDetailForClient(Long uid, Long detailId, Date maxTime) {
|
| | | long monthCount = 0L;
|
| | |
| | | if (maxTime == null) {
|
| | | detailCount = redPackDetailMapper.selectCountByUid(uid);
|
| | | // 用于表示当前所有
|
| | | monthCount = redPackDetailMapper.selectMonthCountByUid(uid, new Date(System.currentTimeMillis() + 1000 * 60 * 60L));
|
| | | monthCount = redPackDetailMapper.selectMonthCountByUid(uid,
|
| | | new Date(System.currentTimeMillis() + 1000 * 60 * 60L));
|
| | | } else {// 通过时间筛选了的,需要查询所有
|
| | | detailCount = redPackDetailMapper.selectCountByUidAndMaxCreateTime(uid, maxTime);
|
| | | monthCount = redPackDetailMapper.selectMonthCountByUid(uid, maxTime);
|
| | |
| | |
|
| | | return monthCount + detailCount;
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void changeDisplayByIdentifyCode(String code, boolean disPlay) {
|
| | | if (StringUtil.isNullOrEmpty(code))
|
| | | return;
|
| | | RedPackDetail oldDetail = getByIdentifyCode(code);
|
| | | if (oldDetail != null) {// 外显红包详情
|
| | | RedPackDetail update = new RedPackDetail();
|
| | | update.setId(oldDetail.getId());
|
| | | update.setDisplay(true);
|
| | | redPackDetailMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | if (detail != null) {
|
| | | RedPackDetail oldDetail = redPackDetailService.getByIdentifyCode(detail.getIdentifyCode());
|
| | | if (oldDetail != null) {// 外显红包详情
|
| | | RedPackDetail update = new RedPackDetail();
|
| | | update.setId(oldDetail.getId());
|
| | | update.setDisplay(true);
|
| | | redPackDetailService.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | redPackDetailService.changeDisplayByIdentifyCode(detail.getIdentifyCode(), true);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.Producer;
|
| | | import com.aliyun.openservices.ons.api.SendResult;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.shop.BanLiShopOrderMapper;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.BanLiShopOrderMQMsg;
|
| | | import com.yeshi.fanli.entity.mq.MQUnSendInfo;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoods;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsClass;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSets;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.exception.mq.MQUnSendInfoException;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackDetailException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopOrderException;
|
| | | import com.yeshi.fanli.service.inter.mq.MQUnSendInfoService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.factory.RedPackDetailFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.util.shop.BanLiShopUtil;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private RedPackBalanceService redPackBalanceService;
|
| | |
|
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | |
|
| | | @Resource
|
| | | private MQUnSendInfoService mqUnSendInfoService;
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | |
| | | update.setId(order.getId());
|
| | | update.setOrderNo(orderNo);
|
| | | banLiShopOrderMapper.updateByPrimaryKeySelective(update);
|
| | |
|
| | | // 订单添加成功 ,延时通知后续
|
| | | sendPlaceOrderMsg(order.getId(), order.getUid());
|
| | | }
|
| | |
|
| | | private void sendPlaceOrderMsg(Long orderId, Long uid) {
|
| | |
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.banLiShopOrderDelay.name(),
|
| | | new Gson().toJson(new BanLiShopOrderMQMsg(orderId, uid)).getBytes());
|
| | | msg.setKey(orderId + "");
|
| | | long delayTime = System.currentTimeMillis() + (Constant.IS_TEST ? 1000 * 30L : 1000 * 60 * 10);// 10分钟后通知
|
| | | msg.setStartDeliverTime(delayTime);
|
| | | SendResult sendResult = producer.send(msg);
|
| | | if (sendResult == null) {
|
| | | MQUnSendInfo info = new MQUnSendInfo();
|
| | | info.setBody(new String(msg.getBody()));
|
| | | if (msg.getStartDeliverTime() > 0)
|
| | | info.setDeliverTime(new Date(msg.getStartDeliverTime()));
|
| | | info.setKey(msg.getKey());
|
| | | info.setTag(msg.getTag());
|
| | | info.setTopic(msg.getTopic());
|
| | | try {
|
| | | mqUnSendInfoService.addMQUnSendInfo(info);
|
| | | } catch (MQUnSendInfoException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | update.setHongBaoPaymentState(BanLiShopOrder.PAY_STATE_PAID);
|
| | | // 判断其他待支付项是否已经支付
|
| | | update.setUpdateTime(new Date());
|
| | | if (order.getState() == BanLiShopOrder.PAY_STATE_NOPAY)
|
| | | if ((order.getBalancePaymentState() == null
|
| | | || order.getBalancePaymentState() == BanLiShopOrder.PAY_STATE_PAID)
|
| | | && (order.getMoneyPaymentState() == null
|
| | | || order.getMoneyPaymentState() == BanLiShopOrder.PAY_STATE_PAID))// 其他待支付项已经支付
|
| | | update.setState(BanLiShopOrder.PAY_STATE_PAID);
|
| | | order.setHongBaoPaymentState(update.getHongBaoPaymentState());
|
| | | update.setState(getOrderPayState(order));
|
| | | banLiShopOrderMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | private int getOrderPayState(BanLiShopOrder order) {
|
| | | int needPayCount = 0;
|
| | | int paidCount = 0;
|
| | | // 获取订单付款状态
|
| | | if (order.getHongBaoPayment() != null) {
|
| | | needPayCount++;
|
| | | if (order.getHongBaoPaymentState() != null
|
| | | && order.getHongBaoPaymentState() == BanLiShopOrder.PAY_STATE_PAID)
|
| | | paidCount++;
|
| | | }
|
| | |
|
| | | if (order.getBalancePayment() != null) {
|
| | | needPayCount++;
|
| | | if (order.getBalancePaymentState() != null
|
| | | && order.getBalancePaymentState() == BanLiShopOrder.PAY_STATE_PAID)
|
| | | paidCount++;
|
| | | }
|
| | |
|
| | | if (order.getMoneyPayment() != null) {
|
| | | needPayCount++;
|
| | | if (order.getMoneyPaymentState() != null && order.getMoneyPaymentState() == BanLiShopOrder.PAY_STATE_PAID)
|
| | | paidCount++;
|
| | | }
|
| | |
|
| | | if (needPayCount == paidCount)
|
| | | return BanLiShopOrder.STATE_PAID;
|
| | | else {
|
| | | if (paidCount == 0)
|
| | | return BanLiShopOrder.STATE_NO_PAY;
|
| | | else
|
| | | return BanLiShopOrder.STATE_PART_PAY;
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | update.setMoneyPaymentState(BanLiShopOrder.PAY_STATE_PAID);
|
| | | // 判断其他待支付项是否已经支付
|
| | | update.setUpdateTime(new Date());
|
| | | if (order.getState() == BanLiShopOrder.PAY_STATE_NOPAY)
|
| | | if ((order.getBalancePaymentState() == null
|
| | | || order.getBalancePaymentState() == BanLiShopOrder.PAY_STATE_PAID)
|
| | | && (order.getHongBaoPaymentState() == null
|
| | | || order.getHongBaoPaymentState() == BanLiShopOrder.PAY_STATE_PAID))// 其他待支付项已经支付
|
| | | update.setState(BanLiShopOrder.PAY_STATE_PAID);
|
| | | order.setMoneyPaymentState(update.getMoneyPaymentState());
|
| | | update.setState(getOrderPayState(order));
|
| | | banLiShopOrderMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | |
| | | return banLiShopOrderMapper.selectByPrimaryKeyForUpdate(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void invalidOrderByOrderId(Long id, String desc) {
|
| | | // 判断订单是否存在
|
| | | BanLiShopOrder order = banLiShopOrderMapper.selectByPrimaryKeyForUpdate(id);
|
| | | if (order == null)
|
| | | return;
|
| | |
|
| | | // 判断是否处于未付款
|
| | | if (order.getState() == BanLiShopOrder.STATE_NO_PAY) {
|
| | | BanLiShopOrder update = new BanLiShopOrder();
|
| | | update.setId(id);
|
| | | update.setStateDesc(desc);
|
| | | update.setState(BanLiShopOrder.STATE_INVALID);
|
| | | update.setUpdateTime(new Date());
|
| | | banLiShopOrderMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void rejectOrder(Long id, String msg) throws BanLiShopOrderException {
|
| | | // 判断订单是否处于付款状态
|
| | | BanLiShopOrder order = banLiShopOrderMapper.selectByPrimaryKeyForUpdate(id);
|
| | | if (order == null)
|
| | | throw new BanLiShopOrderException(1, "订单不存在");
|
| | |
|
| | | if (order.getState() != BanLiShopOrder.STATE_PAID)
|
| | | throw new BanLiShopOrderException(1, "订单未处于待审核状态");
|
| | |
|
| | | // TODO 订单退款
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.aliyun.openservices.ons.api.transaction.TransactionStatus;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponMapper;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserSystemCouponUseMQMsg;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
|
| | | import com.yeshi.fanli.dto.user.coupon.UserSystemCouponUseMQMsgDTO;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | |
| | |
|
| | | @Resource(name = "orderTransactionProducer")
|
| | | private TransactionProducer orderTransactionProducer;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserSystemCouponActivateService userSystemCouponActivateService;
|
| | | |
| | |
|
| | | @Override
|
| | | public int insertSelective(UserSystemCoupon record) {
|
| | |
| | | // 提成金额
|
| | | BigDecimal money = MoneyBigDecimalUtil.mul(hongBao, percent);
|
| | |
|
| | | UserSystemCouponUseMQMsgDTO mqMsg = new UserSystemCouponUseMQMsgDTO(userSystemCoupon.getId(),
|
| | | order.getOrderId(), sourceType);
|
| | | UserSystemCouponUseMQMsg mqMsg = new UserSystemCouponUseMQMsg(userSystemCoupon.getId(), order.getOrderId(),
|
| | | sourceType, systemCoupon.getType().name());
|
| | | // 事务消息
|
| | | Message msg = new Message(MQTopicName.TOPIC_SYSTEM_COUPON_USE.name(), systemCoupon.getType().name(),
|
| | | Message msg = new Message(MQTopicName.TOPIC_USER.name(), UserTopicTagEnum.useSystemCoupon.name(),
|
| | | new Gson().toJson(mqMsg).getBytes());
|
| | | try {
|
| | | SendResult result = orderTransactionProducer.send(msg, new LocalTransactionExecuter() {
|
| | |
| | | if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | int activateCount = userSystemCouponActivateService.getActivateCount(userCouponVO.getId());
|
| | | String activateNum = configService.get("free_coupon_activate_num");
|
| | | userCouponVO.setCouponEffect("(" + activateCount + "/"+ Integer.parseInt(activateNum) +")待激活");
|
| | | userCouponVO.setCouponEffect(
|
| | | "(" + activateCount + "/" + Integer.parseInt(activateNum) + ")待激活");
|
| | | }
|
| | | } else if (CouponTypeEnum.welfareFreeCoupon == type) {
|
| | | jumpBtn = new HashMap<String, Object>();
|
| | |
| | |
|
| | | return userCouponVO;
|
| | | }
|
| | |
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | |
| | | return userSystemCouponMapper.getFreeCouponByType(uid, type);
|
| | | }
|
| | |
|
| | | |
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void triggerFreeCouponActivate(Long uid) {
|
| | | UserSystemCoupon coupon = userSystemCouponMapper.getNeedActivateCouponByType(uid, CouponTypeEnum.freeCoupon.name());
|
| | | UserSystemCoupon coupon = userSystemCouponMapper.getNeedActivateCouponByType(uid,
|
| | | CouponTypeEnum.freeCoupon.name());
|
| | | if (coupon == null)
|
| | | return;
|
| | |
|
| | | Long id = coupon.getId();
|
| | | UserSystemCouponActivate couponActivate = userSystemCouponActivateService.selectForUpdate(id);
|
| | | |
| | |
|
| | | // 激活数量
|
| | | boolean result = false;
|
| | | int limitNum = Integer.parseInt(configService.get("free_coupon_activate_num"));
|
| | | |
| | |
|
| | | Integer state = couponActivate.getState();
|
| | | int count = couponActivate.getCount();
|
| | | count++;
|
| | | if(count >= limitNum) {
|
| | | if (count >= limitNum) {
|
| | | result = true;
|
| | | state = UserSystemCouponActivate.STATE_END;
|
| | | }
|
| | | |
| | |
|
| | | UserSystemCouponActivate updateActivate = new UserSystemCouponActivate();
|
| | | updateActivate.setId(id);
|
| | | updateActivate.setState(state);
|
| | | updateActivate.setCount(count);
|
| | | updateActivate.setUpdateTime(new Date());
|
| | | userSystemCouponActivateService.updateByPrimaryKeySelective(updateActivate);
|
| | | |
| | |
|
| | | // 激活奖励券
|
| | | if (result) {
|
| | | activateFreeCoupon(coupon, limitNum);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 激活券
|
| | | * |
| | | * @param coupon
|
| | | * @param activateNum
|
| | | */
|
| | |
| | | try {
|
| | | Date nowDate = new Date();
|
| | | SystemCoupon systemCoupon = coupon.getSystemCoupon();
|
| | | |
| | |
|
| | | Integer expiryDay = systemCoupon.getExpiryDay();
|
| | | String endDay = DateUtil.plusDay(expiryDay - 1, nowDate);
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | |
| | | userCoupon.setStartTime(nowDate);
|
| | | userCoupon.setUpdateTime(new Date());
|
| | | userSystemCouponMapper.updateByPrimaryKeySelective(userCoupon);
|
| | | |
| | |
|
| | | // 消息
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService.getByReceiveId(coupon.getId());
|
| | | UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService
|
| | | .getByReceiveId(coupon.getId());
|
| | | if (giveRecord == null)
|
| | | return;
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | public RedPackDetail getByIdentifyCode(String identifyCode);
|
| | | |
| | | |
| | | /**
|
| | | * 设置是否显示该条数据
|
| | | * @param code
|
| | | * @param disPlay
|
| | | */
|
| | | public void changeDisplayByIdentifyCode(String code,boolean disPlay);
|
| | |
|
| | |
|
| | |
|
| | |
| | | public void addOrder(BanLiShopOrder order) throws BanLiShopOrderException;
|
| | |
|
| | | /**
|
| | | * 使订单失效
|
| | | * |
| | | * @param id
|
| | | */
|
| | | public void invalidOrderByOrderId(Long id,String desc);
|
| | |
|
| | | /**
|
| | | * 拒绝订单
|
| | | * |
| | | * @param id
|
| | | * @param msg
|
| | | * @throws BanLiShopOrderException
|
| | | */
|
| | | public void rejectOrder(Long id, String msg) throws BanLiShopOrderException;
|
| | |
|
| | | /**
|
| | | * 订单支付(用红包)
|
| | | *
|
| | | * @param orderId
|
| | |
| | | * @param orderId
|
| | | * @throws BanLiShopOrderException
|
| | | */
|
| | | public void payOrderByMoney(Long orderId,BigDecimal money) throws BanLiShopOrderException;
|
| | | |
| | | |
| | | public void payOrderByMoney(Long orderId, BigDecimal money) throws BanLiShopOrderException;
|
| | |
|
| | | public BanLiShopOrder selectByPrimaryKeyForUpdate(Long id);
|
| | |
|
| | | /**
|
| | |
| | | detail.setDesc(setName);
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | | public static RedPackDetail createShopOrderDrawBack(Long orderId, Long uid, String title, String setName,
|
| | | BigDecimal money) throws RedPackDetailException {
|
| | | if (orderId == null)
|
| | | throw new RedPackDetailException(1, "订单ID不能为空");
|
| | | if (uid == null)
|
| | | throw new RedPackDetailException(1, "用户ID不能为空");
|
| | | RedPackDetail detail = new RedPackDetail();
|
| | | detail.setDisplay(false);
|
| | | detail.setUid(uid);
|
| | | detail.setMoney(money);
|
| | | detail.setType(RedPackDetailTypeEnum.shopOrderDrawBack);
|
| | | detail.setTitle(title);
|
| | | detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.shopOrderDrawBack.name() + "-" + orderId));
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setDesc(setName);
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.util.rocketmq;
|
| | |
|
| | | public enum MQTopicName {
|
| | | TOPIC_ORDER("订单"), TOPIC_FANLI("返利到账"), TOPIC_SYSTEM_COUPON_USE("券使用");
|
| | | TOPIC_ORDER("订单"), TOPIC_USER("用户");
|
| | | private final String desc;
|
| | |
|
| | | private MQTopicName(String desc) {
|
| | |
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.MessageListener;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.order.OrderMoneyRecievedMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | @Component
|
| | | public class SystemCouponMessageListener implements MessageListener {
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | | |
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | LogHelper.mqInfo("consumer-SystemCouponMessageListener", message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | if (MQTopicName.TOPIC_FANLI.name().equalsIgnoreCase(message.getTopic())) {
|
| | | OrderMoneyRecievedMQMsgDTO orderMoneyRecievedMQMsgDTO = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsgDTO.class);
|
| | | if (orderMoneyRecievedMQMsgDTO != null) {
|
| | | if (orderMoneyRecievedMQMsgDTO.getOrderFirst() != null
|
| | | && orderMoneyRecievedMQMsgDTO.getOrderFirst() == true) {
|
| | | // 首次到账返利
|
| | | // TODO 业务代码添加
|
| | | |
| | | // 激活免单券
|
| | | userSystemCouponService.triggerFreeCouponActivate(orderMoneyRecievedMQMsgDTO.getUid());
|
| | | |
| | | // 业务代码执行成功后返回
|
| | | return Action.CommitMessage;
|
| | | String tag = message.getTag();
|
| | | BaseMQMsgBody baseBody = new Gson().fromJson(new String(message.getBody()), BaseMQMsgBody.class);
|
| | | if (baseBody.isTest() != Constant.IS_TEST)
|
| | | return Action.ReconsumeLater;
|
| | |
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name()))// 实时到账
|
| | | {
|
| | | OrderMoneyRecievedMQMsg orderMoneyRecievedMQMsgDTO = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (orderMoneyRecievedMQMsgDTO != null) {
|
| | | if (orderMoneyRecievedMQMsgDTO.getOrderFirst() != null
|
| | | && orderMoneyRecievedMQMsgDTO.getOrderFirst() == true) {
|
| | | // 首次到账返利
|
| | | // TODO 业务代码添加
|
| | |
|
| | | // 激活免单券
|
| | | userSystemCouponService.triggerFreeCouponActivate(orderMoneyRecievedMQMsgDTO.getUid());
|
| | |
|
| | | // 业务代码执行成功后返回
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.rocketmq.consumer.order;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Action;
|
| | | import com.aliyun.openservices.ons.api.ConsumeContext;
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.MessageListener;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.BanLiShopOrderMQMsg;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | /**
|
| | | * 邀请订单补贴消息消费
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class BanLiShopOrderMessageListener implements MessageListener {
|
| | |
|
| | | @Resource
|
| | | private BanLiShopOrderService banLiShopOrderService;
|
| | |
|
| | | public BanLiShopOrderMessageListener() {
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | BaseMQMsgBody baseBody = new Gson().fromJson(new String(message.getBody()), BaseMQMsgBody.class);
|
| | | if (baseBody.isTest() != Constant.IS_TEST)
|
| | | return Action.ReconsumeLater;
|
| | | LogHelper.mqInfo("consumer:BanLiShopOrderMessageListener", message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | String tag = message.getTag();
|
| | |
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (OrderTopicTagEnum.banLiShopOrderDelay.name().equalsIgnoreCase(tag)) {
|
| | | BanLiShopOrderMQMsg banLiShopOrderMQMsg = new Gson().fromJson(new String(message.getBody()),
|
| | | BanLiShopOrderMQMsg.class);
|
| | | if (banLiShopOrderMQMsg != null)
|
| | | // 使订单失效
|
| | | banLiShopOrderService.invalidOrderByOrderId(banLiShopOrderMQMsg.getOrderId(), "订单失效-长期未付款");
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.aliyun.openservices.ons.api.Producer;
|
| | | import com.aliyun.openservices.ons.api.SendResult;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.order.OrderMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.order.OrderMoneyRecievedMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.user.coupon.UserSystemCouponUseMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | 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.UserSystemCouponUseMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | | import com.yeshi.fanli.entity.mq.MQUnSendInfo;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | |
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | |
|
| | | // if (!Constant.IS_TASK) {// 非任务服务器不能消费消息
|
| | | // return Action.ReconsumeLater;
|
| | | // }
|
| | | BaseMQMsgBody baseBody = new Gson().fromJson(new String(message.getBody()), BaseMQMsgBody.class);
|
| | | if (baseBody.isTest() != Constant.IS_TEST)
|
| | | return Action.ReconsumeLater;
|
| | | LogHelper.mqInfo("consumer:InviteOrderSubsidyMessageListener", message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | String tag = message.getTag();
|
| | |
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | // 查询上级红包
|
| | | OrderMQMsgDTO dto = new Gson().fromJson(new String(message.getBody()), OrderMQMsgDTO.class);
|
| | | if (dto != null) {
|
| | | try {
|
| | | inviteOrderSubsidyService.addOrUpdateByOrder(dto.getOrderId(), dto.getType());
|
| | | } catch (InviteOrderSubsidyException e) {
|
| | | return Action.ReconsumeLater;
|
| | | }
|
| | | }
|
| | | } else if (MQTopicName.TOPIC_FANLI.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (message.getTag().equalsIgnoreCase("actual")) {
|
| | | OrderMoneyRecievedMQMsgDTO dto = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsgDTO.class);
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderStatistic.name())
|
| | | || tag.equalsIgnoreCase(OrderTopicTagEnum.orderUpdate.name())) {
|
| | | // 查询上级红包
|
| | | OrderMQMsg dto = new Gson().fromJson(new String(message.getBody()), OrderMQMsg.class);
|
| | | if (dto != null) {
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsgDTO.TYPE_ZIGOU) {// 自购到账
|
| | | try {
|
| | | inviteOrderSubsidyService.addOrUpdateByOrder(dto.getOrderId(), dto.getType());
|
| | | } catch (InviteOrderSubsidyException e) {
|
| | | return Action.ReconsumeLater;
|
| | | }
|
| | | }
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name())) {
|
| | | OrderMoneyRecievedMQMsg dto = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (dto != null) {
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {// 自购到账
|
| | | // 判断订单号是否在补贴中
|
| | | long count = inviteOrderSubsidyService.countByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | | if (count > 0) {// 延时消息发送
|
| | | sendOrderSubsidyUpdateLater(dto, 5);
|
| | | }
|
| | | } else if (dto.getType() == OrderMoneyRecievedMQMsgDTO.TYPE_INVITE) {// 邀请到账
|
| | | } else if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_INVITE) {// 邀请到账
|
| | | // 补贴到账
|
| | | try {
|
| | | orderMoneySettleService.inviteSubsidySettle(dto.getUid(), message.getKey());
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | } else if (message.getTag().equalsIgnoreCase("delay")) {
|
| | | OrderMoneyRecievedMQMsgDTO dto = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsgDTO.class);
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiDelay.name())) {
|
| | | OrderMoneyRecievedMQMsg dto = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (dto != null) {
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsgDTO.TYPE_ZIGOU) {// 延时时间已到
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {// 延时时间已到
|
| | | // 判断订单号是否在补贴中
|
| | | long count = inviteOrderSubsidyService.countByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | } else if (MQTopicName.TOPIC_SYSTEM_COUPON_USE.name().equalsIgnoreCase(message.getTopic())) {// 奖励券使用成功
|
| | | UserSystemCouponUseMQMsgDTO dto = new Gson().fromJson(new String(message.getBody()),
|
| | | UserSystemCouponUseMQMsgDTO.class);
|
| | | if (dto != null) {
|
| | | long count = inviteOrderSubsidyService.countByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | | if (count > 0) {
|
| | | // 使相关订单失效
|
| | | inviteOrderSubsidyService.invalidByOrderIdAndSourceType(dto.getOrderId(), dto.getSourceType());
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.useSystemCoupon.name())) {
|
| | | UserSystemCouponUseMQMsg dto = new Gson().fromJson(new String(message.getBody()),
|
| | | UserSystemCouponUseMQMsg.class);
|
| | | if (dto != null && dto.getCouponType()
|
| | | .equalsIgnoreCase(SystemCoupon.CouponTypeEnum.rebatePercentCoupon.name())) {// 返利奖励券的使用
|
| | | long count = inviteOrderSubsidyService.countByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | | if (count > 0) {
|
| | | // 使相关订单失效
|
| | | inviteOrderSubsidyService.invalidByOrderIdAndSourceType(dto.getOrderId(), dto.getSourceType());
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | |
| | | *
|
| | | * @param day
|
| | | */
|
| | | private boolean sendOrderSubsidyUpdateLater(OrderMoneyRecievedMQMsgDTO dto, int day) {
|
| | | private boolean sendOrderSubsidyUpdateLater(OrderMoneyRecievedMQMsg dto, int day) {
|
| | |
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "delay", new Gson().toJson(dto).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiDelay.name(),
|
| | | new Gson().toJson(dto).getBytes());
|
| | | msg.setKey(dto.getSourceType() + "_" + dto.getOrderId());
|
| | | long delayTime = System.currentTimeMillis() + (Constant.IS_TEST ? 1000 * 30L : 1000 * 60 * 60 * 24L * day);
|
| | | msg.setStartDeliverTime(delayTime);
|
| | |
| | | import com.aliyun.openservices.ons.api.transaction.LocalTransactionChecker;
|
| | | import com.aliyun.openservices.ons.api.transaction.TransactionStatus;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.order.OrderMoneyRecievedMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyService;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTagConstant;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | @Component
|
| | |
| | | @Override
|
| | | public TransactionStatus check(Message msg) {
|
| | |
|
| | | String tag = msg.getTag();
|
| | | if (msg.getTopic().equalsIgnoreCase(MQTopicName.TOPIC_ORDER.name())) {
|
| | | if (msg.getTag().startsWith(MQTagConstant.TAG_ORDER_STATISTIC_PREFIX)) {// 订单加入红包标识
|
| | |
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderStatistic.name())) {
|
| | | // TODO 加入成功标识
|
| | | return TransactionStatus.CommitTransaction;
|
| | | }
|
| | | } else if (msg.getTopic().equalsIgnoreCase(MQTopicName.TOPIC_FANLI.name())) {
|
| | | if (msg.getTag().equalsIgnoreCase("actual")) {// 查询key值是否在
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name())) {
|
| | | if (hongBaoV2SettleTempService.countByKey(msg.getKey()) > 0)
|
| | | return TransactionStatus.CommitTransaction;
|
| | | else
|
| | | return TransactionStatus.RollbackTransaction;
|
| | | } else if (msg.getTag().equalsIgnoreCase("delay")) {
|
| | | OrderMoneyRecievedMQMsgDTO dto = new Gson().fromJson(new String(msg.getBody()),
|
| | | OrderMoneyRecievedMQMsgDTO.class);
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiDelay.name())) {
|
| | | OrderMoneyRecievedMQMsg dto = new Gson().fromJson(new String(msg.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (dto != null) {
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsgDTO.TYPE_ZIGOU) {
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {
|
| | | // TODO 尚未处理一个订单部分到账的状况
|
| | | // 返利是否到账
|
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(dto.getSourceType(),
|
| | |
| | | return TransactionStatus.RollbackTransaction;
|
| | | }
|
| | | }
|
| | |
|
| | | // 其他未知条件暂时处理为回滚
|
| | | return TransactionStatus.RollbackTransaction;
|
| | | }
|
| | | } else if (msg.getTopic().equalsIgnoreCase(MQTopicName.TOPIC_SYSTEM_COUPON_USE.name())) {
|
| | | return mqLocalUserCouponUsedTransactionChecker.check(msg);
|
| | |
|
| | | } else if (msg.getTopic().equalsIgnoreCase(MQTopicName.TOPIC_USER.name())) {
|
| | | if (tag.equalsIgnoreCase(UserTopicTagEnum.useSystemCoupon.name()))// 系统券使用
|
| | | return mqLocalUserCouponUsedTransactionChecker.check(msg);
|
| | | }
|
| | |
|
| | | return TransactionStatus.Unknow;
|
| | |
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.transaction.TransactionStatus;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.user.coupon.UserSystemCouponUseMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserSystemCouponUseMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | |
| | | }
|
| | |
|
| | | public TransactionStatus check(Message msg) {
|
| | | if (msg.getTopic().equalsIgnoreCase(MQTopicName.TOPIC_SYSTEM_COUPON_USE.name())) {
|
| | | if (msg.getTag().equalsIgnoreCase(SystemCoupon.CouponTypeEnum.rebatePercentCoupon.name())) {// 返利奖励券
|
| | | if (msg.getTopic().equalsIgnoreCase(MQTopicName.TOPIC_USER.name())) {
|
| | | if (msg.getTag().equalsIgnoreCase(UserTopicTagEnum.useSystemCoupon.name())) {// 返利奖励券
|
| | | // 查询是否使用成功
|
| | | UserSystemCouponUseMQMsgDTO dto = new Gson().fromJson(new String(msg.getBody()),
|
| | | UserSystemCouponUseMQMsgDTO.class);
|
| | | UserSystemCouponRecord record = userSystemCouponRecordService
|
| | | .getNearByUserCouponId(dto.getUserSystemCouponId());
|
| | | if (record != null) {
|
| | | if (record.getOrderNo().equalsIgnoreCase(dto.getOrderId())
|
| | | && dto.getSourceType().intValue() == record.getGoodSource()) {
|
| | | return TransactionStatus.CommitTransaction;
|
| | | UserSystemCouponUseMQMsg dto = new Gson().fromJson(new String(msg.getBody()),
|
| | | UserSystemCouponUseMQMsg.class);
|
| | |
|
| | | if (SystemCoupon.CouponTypeEnum.rebatePercentCoupon.name().equalsIgnoreCase(dto.getCouponType())) {
|
| | | UserSystemCouponRecord record = userSystemCouponRecordService
|
| | | .getNearByUserCouponId(dto.getUserSystemCouponId());
|
| | | if (record != null) {
|
| | | if (record.getOrderNo().equalsIgnoreCase(dto.getOrderId())
|
| | | && dto.getSourceType().intValue() == record.getGoodSource()) {
|
| | | return TransactionStatus.CommitTransaction;
|
| | | }
|
| | | }
|
| | | return TransactionStatus.RollbackTransaction;
|
| | | }
|
| | | return TransactionStatus.RollbackTransaction;
|
| | | }
|
| | | }
|
| | | return TransactionStatus.Unknow;
|
| | |
| | | <beans xmlns="http://www.springframework.org/schema/beans"
|
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
| | | <bean id="inviteOrderSubsidyMsgListener" class="com.yeshi.fanli.util.rocketmq.consumer.order.InviteOrderSubsidyMessageListener"></bean> <!--Listener 配置 -->
|
| | | <bean id="inviteOrderSubsidyMsgListener"
|
| | | class="com.yeshi.fanli.util.rocketmq.consumer.order.InviteOrderSubsidyMessageListener"></bean> <!--Listener 配置 -->
|
| | | <!-- Group ID 订阅同一个 Topic,可以创建多个 ConsumerBean -->
|
| | | <bean id="orderTransactionConsumer" class="com.aliyun.openservices.ons.api.bean.ConsumerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | |
| | | </property>
|
| | | <property name="subscriptionTable">
|
| | | <map>
|
| | | <!-- 订单补贴订阅 -->
|
| | | <!-- 订单补贴订阅 -->
|
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | <property name="expression"
|
| | | value="orderStatistic||orderUpdate||orderFanLiActual||orderFanLiDelay" /><!--expression |
| | | 即 Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | |
|
| | |
|
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | <property name="topic" value="TOPIC_USER" />
|
| | | <property name="expression" value="useSystemCoupon" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | | |
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_SYSTEM_COUPON_USE" />
|
| | | <property name="expression" value="rebatePercentCoupon" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | |
|
| | | </map>
|
| | | </property>
|
| | | </bean>
|
| | |
|
| | | <!-- 板栗商城订单消息订阅 -->
|
| | | <bean id="banLiShopOrderMessageListener"
|
| | | class="com.yeshi.fanli.util.rocketmq.consumer.order.BanLiShopOrderMessageListener"></bean> <!--Listener 配置 -->
|
| | | <!-- Group ID 订阅同一个 Topic,可以创建多个 ConsumerBean -->
|
| | | <bean id="orderTransactionConsumer" class="com.aliyun.openservices.ons.api.bean.ConsumerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | | <property name="properties"> <!--消费者配置信息 -->
|
| | | <props>
|
| | | <prop key="AccessKey">LTAI4FwmTxVCuzTaoZtDiV8z</prop>
|
| | | <prop key="SecretKey">ixWg90QbYFKP6ae5xpAo2P1qwIyll5</prop>
|
| | | <prop key="GROUP_ID">GID_BANLI_SHOP_ORDER</prop>
|
| | | <prop key="NAMESRV_ADDR">http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80
|
| | | </prop>
|
| | | <!--将消费者线程数固定为 50 个 <prop key="ConsumeThreadNums">50</prop> -->
|
| | | </props>
|
| | | </property>
|
| | | <property name="subscriptionTable">
|
| | | <map>
|
| | | <!-- 订阅下单延时消息 -->
|
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="banLiShopOrderDelay" /><!--expression |
| | | 即 Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | </map>
|
| | | </property>
|
| | | </bean>
|
| | |
|
| | |
|
| | | </beans> |
| | |
| | | <entry value-ref="systemCouponMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="actual" />
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="orderFanLiActual" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
| | | <!-- 事务消息生产 -->
|
| | | <bean id="localTransactionChecker" class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="localTransactionChecker"
|
| | | class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="orderTransactionProducer"
|
| | | class="com.aliyun.openservices.ons.api.bean.TransactionProducerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | |
| | | </property>
|
| | | <property name="localTransactionChecker" ref="localTransactionChecker"></property>
|
| | | </bean>
|
| | | |
| | | |
| | | |
| | |
|
| | | </beans> |
| | |
| | | </array>
|
| | | </property>
|
| | | </bean>
|
| | | |
| | | <!-- |
| | | <import resource="classpath:/rocket/consumer.xml"/>
|
| | | <import resource="classpath:/rocket/system-coupon-consumer.xml"/>
|
| | | <import resource="classpath:/rocket/producer.xml"/>
|
| | | <import resource="classpath:/rocket/transactionProducer.xml"/>
|
| | | -->
|
| | |
|
| | |
|
| | | <!-- <import resource="classpath:/rocket/consumer.xml"/> <import resource="classpath:/rocket/system-coupon-consumer.xml"/> -->
|
| | | <import resource="classpath:/rocket/producer.xml" />
|
| | | <import resource="classpath:/rocket/transactionProducer.xml" />
|
| | |
|
| | |
|
| | | <!--异步定义推荐方式 <task:executor id="executor" pool-size="15" /> <task:scheduler
|
| | | id="scheduler" pool-size="30" /> <task:annotation-driven executor="executor"
|
| | |
| | | connect-timeout="${mongo.connectTimeout}" max-wait-time="${mongo.maxWaitTime}"
|
| | | auto-connect-retry="${mongo.autoConnectRetry}" socket-keep-alive="${mongo.socketKeepAlive}"
|
| | | socket-timeout="${mongo.socketTimeout}" slave-ok="${mongo.slaveOk}"
|
| | | write-number="1" write-timeout="0" write-fsync="true" />
|
| | | write-number="1" write-timeout="0" write-fsync="true" />
|
| | | </mongo:mongo>
|
| | |
|
| | |
|
| | |
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | <property name="expression" value="orderStatistic||orderUpdate||orderFanLiActual||orderFanLiDelay" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | |
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_SYSTEM_COUPON_USE" />
|
| | | <property name="expression" value="rebatePercentCoupon" />
|
| | | <property name="topic" value="TOPIC_USER" />
|
| | | <property name="expression" value="useSystemCoupon" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | <entry value-ref="systemCouponMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="actual" />
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="orderFanLiActual" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
| | | <!-- 事务消息生产 -->
|
| | | <bean id="localTransactionChecker" class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="localTransactionChecker"
|
| | | class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="orderTransactionProducer"
|
| | | class="com.aliyun.openservices.ons.api.bean.TransactionProducerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | |
| | | </property>
|
| | | <property name="localTransactionChecker" ref="localTransactionChecker"></property>
|
| | | </bean>
|
| | | |
| | | |
| | | |
| | |
|
| | | </beans> |
| | |
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | <property name="expression" value="orderStatistic||orderUpdate||orderFanLiActual||orderFanLiDelay" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | |
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_SYSTEM_COUPON_USE" />
|
| | | <property name="expression" value="rebatePercentCoupon" />
|
| | | <property name="topic" value="TOPIC_USER" />
|
| | | <property name="expression" value="useSystemCoupon" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | <entry value-ref="systemCouponMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="actual" />
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="orderFanLiActual" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
| | | <!-- 事务消息生产 -->
|
| | | <bean id="localTransactionChecker" class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="localTransactionChecker"
|
| | | class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="orderTransactionProducer"
|
| | | class="com.aliyun.openservices.ons.api.bean.TransactionProducerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | |
| | | </property>
|
| | | <property name="localTransactionChecker" ref="localTransactionChecker"></property>
|
| | | </bean>
|
| | | |
| | | |
| | | |
| | |
|
| | | </beans> |
| | |
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | <property name="expression" value="orderStatistic||orderUpdate||orderFanLiActual||orderFanLiDelay" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | |
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_SYSTEM_COUPON_USE" />
|
| | | <property name="expression" value="rebatePercentCoupon" />
|
| | | <property name="topic" value="TOPIC_USER" />
|
| | | <property name="expression" value="useSystemCoupon" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | <entry value-ref="systemCouponMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="actual" />
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="orderFanLiActual" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
| | | <!-- 事务消息生产 -->
|
| | | <bean id="localTransactionChecker" class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="localTransactionChecker"
|
| | | class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="orderTransactionProducer"
|
| | | class="com.aliyun.openservices.ons.api.bean.TransactionProducerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | |
| | | </property>
|
| | | <property name="localTransactionChecker" ref="localTransactionChecker"></property>
|
| | | </bean>
|
| | | |
| | | |
| | | |
| | |
|
| | | </beans> |