| | |
| | |
|
| | | import com.yeshi.fanli.dto.mq.user.body.IntegralTaskMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.InterTokenMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.InviteCodeActiveMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserAccountBindingMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInfoUpdateMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInviteMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserRedPackGiftMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserRegisterMQMsg;
|
| | |
| | | userRegister(UserRegisterMQMsg.class),//注册
|
| | | tokenOutOfDate(InterTokenMQMsg.class),//口令过期
|
| | | redPackGiftDrawback(UserRedPackGiftMQMsg.class),// 红包赠送退回
|
| | | userInfoUpdate(null); //用户信息修改
|
| | | inviteCodeActive(InviteCodeActiveMQMsg.class),//邀请码激活
|
| | | userInfoUpdate(UserInfoUpdateMQMsg.class); //用户信息修改
|
| | |
|
| | | private final Class<?> clazz;
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.dto.mq.user.body;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | |
|
| | | /**
|
| | | * 用户信息修改
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class InviteCodeActiveMQMsg extends BaseMQMsgBody {
|
| | | private Long uid;// 用户ID
|
| | | private Date createTime;// 时间
|
| | |
|
| | | public InviteCodeActiveMQMsg(Long uid, Date createTime) {
|
| | | this.uid = uid;
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public InviteCodeActiveMQMsg() {
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | private UserInfoUpdateTypeEnum type;// 类型
|
| | | private String value;// 值
|
| | | private Date createTime;//时间
|
| | |
|
| | | public UserInfoUpdateMQMsg(Long uid, UserInfoUpdateTypeEnum type, String value, Date createTime) {
|
| | | super();
|
| | | this.uid = uid;
|
| | | this.type = type;
|
| | | this.value = value;
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public UserInfoUpdateMQMsg() {
|
| | | super();
|
| | |
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | |
| | | private Date createTime;
|
| | | @Column(name = "eo_update_time")
|
| | | private Date updateTime;
|
| | | @Column(name = "eo_state")
|
| | | private Integer state;//0-失效 1-有效
|
| | |
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | private Long uid;
|
| | | private BigDecimal hongbao;
|
| | | private Integer hbState;
|
| | |
| | | new BigDecimal(100)));
|
| | | if (elmeOrder.getIsSettle() == true)
|
| | | hongBao.setPreGetTime(new Date(elmeOrder.getOrderDate().getTime() + 1000 * 60 * 60 * 24 * 15L));
|
| | | if (elmeOrder.getPayMoney().compareTo(new BigDecimal(0)) <= 0)
|
| | | if (elmeOrder.getPayMoney().compareTo(new BigDecimal(0)) <= 0||(elmeOrder.getState()!=null&&elmeOrder.getState()==0))
|
| | | hongBao.setState(HongBaoV2.STATE_SHIXIAO);
|
| | | else {
|
| | | if (elmeOrder.getIsSettle() == true) {
|
| | |
| | | elmeOrder.setIsSettle(true);
|
| | | else
|
| | | elmeOrder.setIsSettle(false);
|
| | |
|
| | | if (!taoBaoOrder.getOrderState().equalsIgnoreCase("订单失效"))
|
| | | elmeOrder.setState(1);
|
| | | else {
|
| | | elmeOrder.setState(0);
|
| | | elmeOrder.setPayMoney(new BigDecimal(0));
|
| | | }
|
| | | elmeOrder.setTrackPid(
|
| | | String.format("mm_124933865_%s_%s", taoBaoOrder.getSourceMediaId(), taoBaoOrder.getAdPositionId()));
|
| | | if (!StringUtil.isNullOrEmpty(taoBaoOrder.getRelationId())) {
|
| | |
| | | @Resource
|
| | | private ElmeOrderService elmeOrderService;
|
| | |
|
| | | |
| | | @Resource
|
| | | private ElmeOrderProcessService elmeOrderProcessService;
|
| | |
|
| | | /**
|
| | | * 获取饿了么可以返利的红包
|
| | | *
|
| | |
| | | // (维权金额/结算金额) * 返利金额
|
| | | BigDecimal wqmoney = weiQuanOrder.getMoney();
|
| | | money = wqmoney.multiply(hongBaoV2.getMoney()).divide(hongBaoV2.getSettlement(), 2,
|
| | | BigDecimal.ROUND_DOWN);
|
| | | BigDecimal.ROUND_UP);
|
| | |
|
| | | // 大于返利金额 则等于返利金额
|
| | | if (money.compareTo(hongBaoV2.getMoney()) > 0)
|
| | |
| | | rootPath = rootPath.substring(1,rootPath.indexOf("WEB-INF"));
|
| | | return rootPath;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | import org.yeshi.utils.entity.FileUploadResult;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.Producer;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserInfoExtraMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserRankRecordMapper;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.InviteCodeActiveMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInfoUpdateMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInfoUpdateMQMsg.UserInfoUpdateTypeEnum;
|
| | | import com.yeshi.fanli.dto.wx.WXAccountInfoDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | |
| | | import com.yeshi.fanli.util.InviteCodeFilterUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | | import com.yeshi.fanli.vo.user.UserInfoExtraVO;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private UserInviteRecordService userInviteRecordService;
|
| | |
|
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | |
|
| | | @Override
|
| | | public UserInfoExtraVO getRankInfo(Long uid) throws UserInfoExtraException, Exception {
|
| | |
| | | userInfoExtraMapper.insertSelective(userInfoExtra);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public UserInfoExtra saveUserInfoExtra(UserInfoExtra userInfoExtra) throws UserInfoExtraException {
|
| | |
|
| | |
| | | userInfoExtra.setCreateTime(new Date());
|
| | | userInfoExtraMapper.insertSelective(userInfoExtra);
|
| | | }
|
| | |
|
| | | // 发送激活成功消息
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.inviteCodeActive,
|
| | | new Gson().toJson(new InviteCodeActiveMQMsg(uid, new Date())));
|
| | | producer.send(message);
|
| | |
|
| | | return mycode;
|
| | | }
|
| | |
|
| | |
| | | userInfoExtra.setCreateTime(new Date());
|
| | | userInfoExtraMapper.insertSelective(userInfoExtra);
|
| | | }
|
| | | // 发送激活成功消息
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.inviteCodeActive,
|
| | | new Gson().toJson(new InviteCodeActiveMQMsg(uid, new Date())));
|
| | | producer.send(message);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | }
|
| | |
|
| | | // 生成邀请码
|
| | | String inviteCode = createInviteCode(uid);;
|
| | | String inviteCode = createInviteCode(uid);
|
| | | ;
|
| | | if (StringUtil.isNullOrEmpty(inviteCode))
|
| | | throw new UserInfoExtraException(1, "激活码生成失败");
|
| | |
|
| | |
| | |
|
| | | /**
|
| | | * 生产邀请码
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | |
| | | }
|
| | | return inviteCode;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public long countByRankId(Long rankId) {
|
| | |
| | | update.setInviteCodeVip(inviteCodeVip);
|
| | | update.setUpdateTime(new Date());
|
| | | userInfoExtraMapper.updateByPrimaryKeySelective(update);
|
| | | //发送邀请码更改成功的消息
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userInfoUpdate,
|
| | | new Gson().toJson(new UserInfoUpdateMQMsg(uid, UserInfoUpdateTypeEnum.inviteCode, inviteCodeVip, new Date())));
|
| | | producer.send(message);
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.user.UserInfoModifyRecordMapper;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserAccountBindingMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInfoUpdateMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInfoUpdateMQMsg.UserInfoUpdateTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | Message message =MQMsgBodyFactory.create(MQTopicName.TOPIC_USER,
|
| | | UserTopicTagEnum.userAccountBinding,mqMsg);
|
| | | producer.send(message);
|
| | | } else {// 修改
|
| | | if (type == ModifyTypeEnum.portrait) {
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER,
|
| | | UserTopicTagEnum.userInfoUpdate, new Gson().toJson(new UserInfoUpdateMQMsg(uid,
|
| | | UserInfoUpdateTypeEnum.portrait, value, new Date())));
|
| | | producer.send(message);
|
| | | }
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | |
| | |
|
| | | /**
|
| | | * 用户分享图的数量
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 根据图片画二维码
|
| | | * |
| | | * @param uid
|
| | | * @param bgImg
|
| | | * @param inviteCode
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | String drawInviteQrCodeNew(String bgImg, Long uid, String portrait, Integer pX, Integer pY, Integer size, String inviteCode) throws Exception;
|
| | | String drawInviteQrCodeNew(String bgImg, Long uid, String portrait, Integer pX, Integer pY, Integer size,
|
| | | String inviteCode) throws Exception;
|
| | |
|
| | | /**
|
| | | * 邀请图片 问候
|
| | | * |
| | | * @param bgImg
|
| | | * @param uid
|
| | | * @param portrait
|
| | |
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public String getInviteImgToGreet(String bgImg, Long uid, String portrait, String inviteCode, String content, Date date)
|
| | | throws Exception;
|
| | |
|
| | | public String getInviteImgToGreet(String bgImg, Long uid, String portrait, String inviteCode, String content,
|
| | | Date date) throws Exception;
|
| | |
|
| | | /**
|
| | | * 获取用户要求图列表
|
| | | * |
| | | * @param uid
|
| | | * @param page
|
| | | * @param count
|
| | |
| | | * @return
|
| | | */
|
| | | public List<String> getUserSpreadImgToPage(Long uid, int page, int count, HttpServletRequest request);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.rocketmq.consumer.user;
|
| | |
|
| | | 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.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.InviteCodeActiveMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInfoUpdateMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInfoUpdateMQMsg.UserInfoUpdateTypeEnum;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | /**
|
| | | * 用户邀请图改变
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class InvitePictureChangeMessageListener implements MessageListener {
|
| | |
|
| | | @Resource
|
| | | private SpreadUserImgService spreadUserImgService;
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | LogHelper.mqInfo("consumer-InvitePictureChangeMessageListener", message.getMsgID(), message.getTopic(),
|
| | | message.getTag(), new String(message.getBody()));
|
| | | String tag = message.getTag();
|
| | | if (tag == null)
|
| | | tag = "";
|
| | |
|
| | | if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (tag.equalsIgnoreCase(UserTopicTagEnum.inviteCodeActive.name())) {// 邀请码激活
|
| | | InviteCodeActiveMQMsg inviteCodeActiveMQMsg = new Gson().fromJson(new String(message.getBody()),
|
| | | InviteCodeActiveMQMsg.class);
|
| | | if (inviteCodeActiveMQMsg != null && inviteCodeActiveMQMsg.getUid() != null)
|
| | | spreadUserImgService.deleteImgUrl(inviteCodeActiveMQMsg.getUid());
|
| | |
|
| | | return Action.CommitMessage;
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.userInfoUpdate.name())) {// 订单统计
|
| | | UserInfoUpdateMQMsg userInfoUpdateMQMsg = new Gson().fromJson(new String(message.getBody()),
|
| | | UserInfoUpdateMQMsg.class);
|
| | | if (userInfoUpdateMQMsg != null && (userInfoUpdateMQMsg.getType() == UserInfoUpdateTypeEnum.portrait
|
| | | || userInfoUpdateMQMsg.getType() == UserInfoUpdateTypeEnum.inviteCode)) {
|
| | | if (userInfoUpdateMQMsg.getUid() != null)
|
| | | spreadUserImgService.deleteImgUrl(userInfoUpdateMQMsg.getUid());
|
| | | }
|
| | |
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | |
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="orderStatistic||orderFanLiActual||orderStatisticDelay||orderFanLiSeparateByOrderNo" />
|
| | | <property name="expression"
|
| | | value="orderStatistic||orderFanLiActual||orderStatisticDelay||orderFanLiSeparateByOrderNo" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | </property>
|
| | | </bean>
|
| | |
|
| | | <!-- 邀请图修改消息订阅 -->
|
| | | <bean id="invitePictureChangeMessageListener"
|
| | | class="com.yeshi.fanli.util.rocketmq.consumer.user.InvitePictureChangeMessageListener"></bean>
|
| | | <!-- Group ID 订阅同一个 Topic,可以创建多个 ConsumerBean -->
|
| | | <bean id="invitePictureChangeConsumer" class="com.aliyun.openservices.ons.api.bean.ConsumerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | | <property name="properties"> <!--消费者配置信息 -->
|
| | | <props>
|
| | | <prop key="AccessKey">${rocketmq.AccessKey}</prop>
|
| | | <prop key="SecretKey">${rocketmq.SecretKey}</prop>
|
| | | <prop key="GROUP_ID">GID_INVITE_PICTURE</prop>
|
| | | <prop key="NAMESRV_ADDR">${rocketmq.NAMESRV_ADDR}</prop>
|
| | | <prop key="ConsumeThreadNums">50</prop>
|
| | | </props>
|
| | | </property>
|
| | | <property name="subscriptionTable">
|
| | | <map>
|
| | | <!-- 邀请码激活,用户信息修改 -->
|
| | | <entry value-ref="invitePictureChangeMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_USER" />
|
| | | <property name="expression" value="inviteCodeActive||userInfoUpdate" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | </map>
|
| | | </property>
|
| | | </bean>
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | </beans> |