Merge remote-tracking branch 'origin/div' into div
| | |
| | | try {
|
| | | if (!StringUtil.isNullOrEmpty(jedis.set(key, "1", new SetParams().nx().ex(Constant.IS_TEST?10:300)))) {
|
| | | try {
|
| | | Long uid = Long.parseLong(uidStr);
|
| | | // Long uid = Long.parseLong(uidStr);
|
| | | // if (!Constant.IS_TEST) { // 活跃通知
|
| | | UserActiveMQMsg msg = new UserActiveMQMsg(uid, new Date());
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userActve, msg);
|
| | | producer.send(message);
|
| | | // UserActiveMQMsg msg = new UserActiveMQMsg(uid, new Date());
|
| | | // Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userActve, msg);
|
| | | // message.setStartDeliverTime(System.currentTimeMillis()+1000*10L);//10s后发送活跃消息
|
| | | // producer.send(message);
|
| | | // }
|
| | | } catch (Exception e) {
|
| | |
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.json.JSONArray;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | |
| | | data.put("taoBaoCart", source);
|
| | |
|
| | | if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | // IOS正在上线版本
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
|
| | | data.put("banner", new JSONArray());
|
| | | } else {
|
| | | // 我的界面banner
|
| | | List<SwiperPicture> banner = swiperPictureService.getByBannerCardAndVersion("my_interface_banner",
|
| | | acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
|
| | | if (banner == null)
|
| | | banner = new ArrayList<SwiperPicture>();
|
| | | data.put("banner", JsonUtil.getApiCommonGson().toJson(banner));
|
| | | }
|
| | | }
|
| | |
|
| | | if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | // IOS正在上线
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
|
| | | } else
|
| | | data.put("vip", inner);
|
| | | // 平台规则
|
| | | String platformRuleLink = configService.get(ConfigKeyEnum.platformRule.getKey());
|
| | |
| | |
|
| | | if (taoBaoLink == null) {
|
| | | taoBaoLink = shareGoodsService.getTaoBaoLinkForBuyWithSpecial(uid, specialId, auctionId);
|
| | | if(taoBaoLink!=null)
|
| | | clientTBPid=null;
|
| | | }
|
| | |
|
| | | data.put("native", true);
|
| | |
| | |
|
| | | // 大淘客商品过滤
|
| | | try {
|
| | | goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
|
| | | goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods).getGoods();
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
| | | package com.yeshi.fanli.controller.client.v2;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.lang.reflect.InvocationTargetException;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.json.simple.JSONArray;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
|
| | | import com.yeshi.fanli.dto.pdd.PDDPromotionUrl;
|
| | | import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
|
| | | import com.yeshi.fanli.dto.taobao.DaTaoKeFilterResult;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.ShamUser;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | import com.yeshi.fanli.util.cache.JDGoodsCacheUtil;
|
| | | import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil;
|
| | | import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
|
| | | import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.factory.goods.ShopInfoVOFactory;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | |
| | | if (level == null)
|
| | | level = UserLevelEnum.daRen;
|
| | | return orderHongBaoMoneyComputeService.getShowComputeRate(platform, version, level);
|
| | | }
|
| | |
|
| | | private TaoBaoGoodsBrief filterDaTaoKeGoodsInfo(TaoBaoGoodsBrief goods) {
|
| | | try {
|
| | | DaTaoKeFilterResult result = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
|
| | | if (result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_COUPON
|
| | | || result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_PRICE_AND_COUPON) {
|
| | | // 缓存基础链接
|
| | | String dpid = null;
|
| | | if (TaoBaoUtil.isSpecialGoods(goods.getMaterialLibType())) {
|
| | | dpid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT;
|
| | | } else {
|
| | | dpid = TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID;
|
| | | }
|
| | | String link = taoBaoGoodsCacheUtil.getBaseConvertLink(goods.getAuctionId(), dpid);
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | // result.getGoods().setCouponLink(link);
|
| | | return result.getGoods();
|
| | | } else {
|
| | | link = DaTaoKeApiUtil.convertLink(goods.getAuctionId(), dpid);
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | // result.getGoods().setCouponLink(link);
|
| | | taoBaoGoodsCacheUtil.cacheBaseConvertLink(goods.getAuctionId(), dpid, link);
|
| | | }
|
| | | return result.getGoods();
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
|
| | | return goods;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | // 大淘客商品过滤
|
| | | try {
|
| | | goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods, acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | |
|
| | | // goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
|
| | |
|
| | | goods = filterDaTaoKeGoodsInfo(goods);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
| | |
|
| | | String h5Url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePath(), "", id + "");
|
| | | try {
|
| | | extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | } catch (Exception e) {
|
| | |
|
| | | extraVO.setH5Url(h5Url);
|
| | | }
|
| | |
|
| | | String helpLink = null;
|
| | | boolean fanliValid = true;
|
| | |
| | | // 设置couponList
|
| | | List<CouponInfoVO> couponInfoList = new ArrayList<>();
|
| | | couponInfoList.add(goodsDetail.getCouponInfo());
|
| | | if (Constant.IS_TEST) {
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | try {
|
| | | PropertyUtils.copyProperties(coupon, goodsDetail.getCouponInfo());
|
| | | } catch (IllegalAccessException e) {
|
| | | e.printStackTrace();
|
| | | } catch (InvocationTargetException e) {
|
| | | e.printStackTrace();
|
| | | } catch (NoSuchMethodException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | coupon.setShopCoupon(true);
|
| | | coupon.setLink(
|
| | | "https://uland.taobao.com/quan/detail?sellerId=725677994&activityId=d03aa6d23a5a4040afb3942e7ea9a007");
|
| | | couponInfoList.add(coupon);
|
| | | }
|
| | | goodsDetail.setCouponInfoList(couponInfoList);
|
| | | }
|
| | | JSONObject object = new JSONObject();
|
| | |
| | | data.put("selfMoney", selfMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("shareMoney", shareMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | |
|
| | | |
| | | BigDecimal teamMoney = new BigDecimal(0);
|
| | | if (!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | teamMoney = hongBaoV2CountService.getRewardMoneyToCount(uid, dateType, 3, null);
|
| | | } else {
|
| | | BigDecimal bonus = null;
|
| | | BigDecimal dividend = null; // TODO 分红统计
|
| | | if (dateType == 4) { // 已到账
|
| | | dividend = new BigDecimal(0);
|
| | | bonus = hongBaoV2CountService.geBonusByuid(uid, dateType, 3, 2);
|
| | | } else { // 未失效
|
| | | bonus = hongBaoV2CountService.geBonusByuid(uid, dateType, 3, 4);
|
| | | }
|
| | |
|
| | | dividend = new BigDecimal(0);
|
| | | // 总团队奖励
|
| | | teamMoney = bonus.add(dividend);
|
| | | }
|
| | | data.put("inviteMoney", teamMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
| | |
|
| | | if (TaoBaoUtil.canAddToTLJBuyGoods(goods)) {
|
| | | count++;
|
| | | goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
|
| | | goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods).getGoods();
|
| | | shareHotGoodsService.addShareHotGoods(new ShareHotGoods(null, day, new Date(), goods));
|
| | | }
|
| | | }
|
| | |
| | | if (TaoBaoUtil.getAfterUseCouplePrice(goods).multiply(goods.getTkRate())
|
| | | .compareTo(new BigDecimal("143")) >= 0) {
|
| | | count++;
|
| | | goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
|
| | | goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods).getGoods();
|
| | | int totalHongBaoCount = 2000 + (int) (Math.random() * 8000);
|
| | | int leftHongBaoCount = 200 + (int) (Math.random() * 2000);
|
| | | tljBuyGoodsService.addTLJBuyGoods(
|
| | |
| | | userActiveLog.setDeviceType("wxmp");
|
| | | userActiveLog.setDevice(acceptData.getDevice());
|
| | | userActiveLogService.addUserActiveLog(userActiveLog);
|
| | | |
| | |
|
| | | // 处理用户信息
|
| | | outUserInfoHandle(userInfo);
|
| | |
| | | package com.yeshi.fanli.dto.mq.user;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.user.body.BeComeValidUserMQMsg;
|
| | | 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.TaoBaoBindSuccessMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.ThreeSaleSeparateMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserAccountBindingMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserActiveMQMsg;
|
| | |
| | | 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.UserLevelChangedMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserMoneyChangeMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserRedPackGiftMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserRegisterMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserSystemCouponUseMQMsg;
|
| | |
| | | forbiddenUser(UserForbiddenMQMsg.class), // 封禁用户
|
| | | userInfoUpdate(UserInfoUpdateMQMsg.class), // 用户信息修改
|
| | | userLevelChanged(UserLevelChangedMQMsg.class), // 用户等级变化
|
| | | userMoneyAdd(UserMoneyChangeMQMsg.class), // 用户资金增加
|
| | | taobaoBindSuccess(TaoBaoBindSuccessMQMsg.class),
|
| | | becomeValidUser(BeComeValidUserMQMsg.class), // 成为有效用户
|
| | | threeSaleSeparate(ThreeSaleSeparateMQMsg.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 BeComeValidUserMQMsg extends BaseMQMsgBody {
|
| | | private Long uid;
|
| | | private Date createTime;
|
| | |
|
| | | public BeComeValidUserMQMsg(Long uid, Date createTime) {
|
| | | super();
|
| | | this.uid = uid;
|
| | | this.setCreateTime(createTime);
|
| | | }
|
| | |
|
| | | 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;
|
| | | }
|
| | |
|
| | | }
|
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 TaoBaoBindSuccessMQMsg extends BaseMQMsgBody {
|
| | | private Long uid;// 用户ID
|
| | | private Long fromUid;// 淘宝绑定的原用户ID
|
| | | private Long taoBaoUid;// 淘宝ID
|
| | | private Date createTime;// 发生时间
|
| | |
|
| | | public TaoBaoBindSuccessMQMsg(Long uid, Long fromUid, Long taoBaoUid, Date createTime) {
|
| | | super();
|
| | | this.uid = uid;
|
| | | this.fromUid = fromUid;
|
| | | this.taoBaoUid = taoBaoUid;
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public Long getFromUid() {
|
| | | return fromUid;
|
| | | }
|
| | |
|
| | | public void setFromUid(Long fromUid) {
|
| | | this.fromUid = fromUid;
|
| | | }
|
| | |
|
| | | public Long getTaoBaoUid() {
|
| | | return taoBaoUid;
|
| | | }
|
| | |
|
| | | public void setTaoBaoUid(Long taoBaoUid) {
|
| | | this.taoBaoUid = taoBaoUid;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dto.mq.user.body;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | |
|
| | | /**
|
| | | * 邀请信息
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class UserMoneyChangeMQMsg extends BaseMQMsgBody {
|
| | | private Long uid;
|
| | | private BigDecimal changeMoney;// 改变的金额
|
| | | private Date createTime;// 发生时间
|
| | |
|
| | | public UserMoneyChangeMQMsg(Long uid, BigDecimal changeMoney, Date createTime) {
|
| | | super();
|
| | | this.uid = uid;
|
| | | this.changeMoney = changeMoney;
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public BigDecimal getChangeMoney() {
|
| | | return changeMoney;
|
| | | }
|
| | |
|
| | | public void setChangeMoney(BigDecimal changeMoney) {
|
| | | this.changeMoney = changeMoney;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dto.taobao;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | /**
|
| | | * 大淘客过滤结果
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class DaTaoKeFilterResult {
|
| | | public final static int FILTER_TYPE_NONE = 0;// 没有过滤
|
| | |
|
| | | public final static int FILTER_TYPE_PRICE = 1;// 过滤了价格
|
| | |
|
| | | public final static int FILTER_TYPE_COUPON = 2;// 过滤了券
|
| | |
|
| | | public final static int FILTER_TYPE_PRICE_AND_COUPON = 12;// 过滤了券和价格
|
| | |
|
| | | private TaoBaoGoodsBrief goods;
|
| | | private int filterType;
|
| | |
|
| | | public DaTaoKeFilterResult(TaoBaoGoodsBrief goods, int filterType) {
|
| | | super();
|
| | | this.goods = goods;
|
| | | this.filterType = filterType;
|
| | | }
|
| | |
|
| | | public TaoBaoGoodsBrief getGoods() {
|
| | | return goods;
|
| | | }
|
| | |
|
| | | public void setGoods(TaoBaoGoodsBrief goods) {
|
| | | this.goods = goods;
|
| | | }
|
| | |
|
| | | public int getFilterType() {
|
| | | return filterType;
|
| | | }
|
| | |
|
| | | public void setFilterType(int filterType) {
|
| | | this.filterType = filterType;
|
| | | }
|
| | | }
|
| | |
| | | public static int PROCESS_3 = 10;// 会员第三阶段
|
| | | public static int PROCESS_4 = 11;// 会员第四阶段
|
| | |
|
| | | public final static int SOURCE_TYPE_ORDER = 1;// 订单型
|
| | |
|
| | | public final static int SOURCE_TYPE_TEAM = 2;// 团队型
|
| | |
|
| | | @Column(name = "vpi_id")
|
| | | private Long id;
|
| | | @Column(name = "vpi_uid")
|
| | |
| | | private Date createTime;
|
| | | @Column(name = "vpi_update_time")
|
| | | private Date updateTime;
|
| | | @Column(name = "vpi_source_type")
|
| | | private Integer sourceType;// 来源类型
|
| | |
|
| | | public Integer getSourceType() {
|
| | | return sourceType;
|
| | | }
|
| | |
|
| | | public void setSourceType(Integer sourceType) {
|
| | | this.sourceType = sourceType;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | |
| | | @Column(name = "co_urank")
|
| | | private Integer urank;// 用户等级 100-为超级会员
|
| | |
|
| | | @Column(name = "co_child_source_type")
|
| | | private String childSourceType;// 子来源类型
|
| | |
|
| | | public String getChildSourceType() {
|
| | | return childSourceType;
|
| | | }
|
| | |
|
| | | public void setChildSourceType(String childSourceType) {
|
| | | this.childSourceType = childSourceType;
|
| | | }
|
| | |
|
| | | public Integer getUrank() {
|
| | | return urank;
|
| | | }
|
| | |
| | | && TaoBaoUtil.getAfterUseCouplePrice(goods).multiply(goods.getTkRate())
|
| | | .compareTo(new BigDecimal("1430")) <= 0
|
| | | && goods.getUserType() == 1) {
|
| | | goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
|
| | | goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods).getGoods();
|
| | | int totalHongBaoCount = 2000 + (int) (Math.random() * 8000);
|
| | | int leftHongBaoCount = 200 + (int) (Math.random() * 2000);
|
| | | tljBuyGoodsService.addTLJBuyGoods(
|
| | |
| | | && goods.getCouponAmount().compareTo(new BigDecimal(0)) > 0) {
|
| | | if (TaoBaoUtil.canAddToTLJBuyGoods(goods)) {
|
| | | count++;
|
| | | goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
|
| | | goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods).getGoods();
|
| | | shareHotGoodsService.addShareHotGoods(new ShareHotGoods(null, day, new Date(), goods));
|
| | | }
|
| | | }
|
| | |
| | | <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> |
| | | <result column="co_state_desc" property="stateDesc" jdbcType="VARCHAR" /> |
| | | <result column="co_urank" property="urank" jdbcType="INTEGER" /> |
| | | <result column="co_child_source_type" property="childSourceType" |
| | | jdbcType="VARCHAR" /> |
| | | <association property="userInfo" column="co_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="co_uid" property="id" jdbcType="BIGINT" /> |
| | |
| | | <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> |
| | | <result column="co_state_desc" property="stateDesc" jdbcType="VARCHAR" /> |
| | | <result column="co_urank" property="urank" jdbcType="INTEGER" /> |
| | | <result column="co_child_source_type" property="childSourceType" |
| | | jdbcType="VARCHAR" /> |
| | | <association property="userInfo" column="co_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="co_uid" property="id" jdbcType="BIGINT" /> |
| | |
| | | <result column="shared" property="shared" jdbcType="BIGINT" /> |
| | | <result column="invite" property="invite" jdbcType="BIGINT" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_state_whole_order,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_order_by,co_create_time,co_update_time,co_trade_id,co_state_desc,co_urank |
| | | <sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_state_whole_order,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_order_by,co_create_time,co_update_time,co_trade_id,co_state_desc,co_urank,co_child_source_type |
| | | </sql> |
| | | <sql id="Order_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position, |
| | | co_order_goods_id,co_count,co_state,co_state_whole_order, |
| | |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.CommonOrder" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order |
| | | (co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_create_time,co_update_time,co_state_whole_order,co_order_by,co_trade_id,co_state_desc,co_urank) |
| | | (co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_create_time,co_update_time,co_state_whole_order,co_order_by,co_trade_id,co_state_desc,co_urank,co_child_source_type) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{sourcePosition,jdbcType=VARCHAR},#{commonOrderGoods.id,jdbcType=BIGINT},#{count,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{estimate,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{thirdCreateTime,jdbcType=TIMESTAMP},#{settleTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{stateWholeOrder,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{tradeId,jdbcType=VARCHAR},#{stateDesc,jdbcType=VARCHAR},#{urank,jdbcType=INTEGER}) |
| | | (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{sourcePosition,jdbcType=VARCHAR},#{commonOrderGoods.id,jdbcType=BIGINT},#{count,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{estimate,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{thirdCreateTime,jdbcType=TIMESTAMP},#{settleTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{stateWholeOrder,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{tradeId,jdbcType=VARCHAR},#{stateDesc,jdbcType=VARCHAR},#{urank,jdbcType=INTEGER},#{childSourceType,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="tradeId != null">co_trade_id,</if> |
| | | <if test="stateDesc != null">co_state_desc,</if> |
| | | <if test="urank != null">co_urank,</if> |
| | | <if test="childSourceType != null">co_child_source_type,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="tradeId != null">#{tradeId,jdbcType=VARCHAR},</if> |
| | | <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR},</if> |
| | | <if test="urank != null">#{urank,jdbcType=INTEGER}</if> |
| | | <if test="urank != null">#{urank,jdbcType=INTEGER},</if> |
| | | <if test="childSourceType != null">#{childSourceType,jdbcType=VARCHAR},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.CommonOrder">update |
| | |
| | | #{updateTime,jdbcType=TIMESTAMP} ,co_trade_id |
| | | =#{tradeId,jdbcType=VARCHAR},co_state_desc |
| | | =#{stateDesc,jdbcType=VARCHAR} ,co_urank =#{urank,jdbcType=INTEGER} |
| | | where co_id = #{id,jdbcType=BIGINT} |
| | | ,co_child_source_type =#{childSourceType,jdbcType=VARCHAR} where co_id |
| | | = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder"> |
| | | update yeshi_ec_common_order |
| | |
| | | <if test="orderBy != null">co_order_by=#{orderBy,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">co_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">co_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="id !=null">co_id =#{id,jdbcType=BIGINT},</if> |
| | | <if test="tradeId !=null">co_trade_id =#{tradeId,jdbcType=VARCHAR},</if> |
| | | <if test="stateDesc !=null">co_state_desc =#{stateDesc,jdbcType=VARCHAR},</if> |
| | | <if test="urank !=null">co_urank =#{urank,jdbcType=INTEGER},</if> |
| | | <if test="childSourceType !=null">co_child_source_type=#{childSourceType,jdbcType=VARCHAR}, |
| | | </if> |
| | | </set> |
| | | where co_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | | <!-- 订单号查询 --> |
| | | <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> |
| | | <!-- 订单来源 --> |
| | | <if test="listSource != null and listSource.size() > 0"> |
| | | <foreach collection="listSource" item="item" open="AND (" close=")" separator="or"> |
| | | co.co_source_type = #{item} |
| | | </foreach> |
| | | <if test="listSource != null and listSource.size() > 0"> |
| | | <foreach collection="listSource" item="item" open="AND (" |
| | | close=")" separator="or">co.co_source_type = #{item}</foreach> |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` ORDER BY |
| | | co.co_third_create_time DESC LIMIT ${start},${count} |
| | |
| | | <!-- 订单号查询 --> |
| | | <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> |
| | | <!-- 订单来源 --> |
| | | <if test="listSource != null and listSource.size() > 0"> |
| | | <foreach collection="listSource" item="item" open="AND (" close=")" separator="or"> |
| | | co.co_source_type = #{item} |
| | | </foreach> |
| | | <if test="listSource != null and listSource.size() > 0"> |
| | | <foreach collection="listSource" item="item" open="AND (" |
| | | close=")" separator="or">co.co_source_type = #{item}</foreach> |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` )A |
| | | </select> |
| | |
| | | '%Y%m'),DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1 |
| | | </if> |
| | | <!-- 订单来源 --> |
| | | <if test="listSource != null and listSource.size() > 0"> |
| | | <foreach collection="listSource" item="item" open="AND (" close=")" separator="or"> |
| | | co.co_source_type = #{item} |
| | | </foreach> |
| | | <if test="listSource != null and listSource.size() > 0"> |
| | | <foreach collection="listSource" item="item" open="AND (" |
| | | close=")" separator="or">co.co_source_type = #{item}</foreach> |
| | | </if> |
| | | </sql> |
| | | <select id="getOrderCount" resultMap="OrderCountMap"> |
| | |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> |
| | | <!-- 订单时间 --> |
| | | <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> |
| | | |
| | | <if test="payment != null"> |
| | | AND co.co_payment <![CDATA[<]]> #{payment} |
| | | <if test="payment != null">AND |
| | | co.co_payment <![CDATA[<]]> |
| | | #{payment} |
| | | </if> |
| | | |
| | | ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} |
| | | </select> |
| | | <select id="countQueryByUid" resultType="java.lang.Long"> |
| | |
| | | </if> |
| | | <!-- 订单来源 --> |
| | | <if test="source != null">AND co.co_source_type = #{source}</if> |
| | | <if test="payment != null"> |
| | | AND co.co_payment <![CDATA[<]]> #{payment} |
| | | <if test="payment != null">AND |
| | | co.co_payment <![CDATA[<]]> |
| | | #{payment} |
| | | </if> |
| | | ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} ) A LEFT |
| | | JOIN yeshi_ec_user u ON u.id = A.hb_uid |
| | |
| | | <foreach collection="listShopId" item="shopId" open=" and (" |
| | | separator=" or " close=")">g.`cog_shop_id` =#{shopId}</foreach> |
| | | </if> |
| | | <if test="payment != null"> |
| | | AND co.co_payment <![CDATA[<]]> #{payment} |
| | | <if test="payment != null">AND |
| | | co.co_payment <![CDATA[<]]> |
| | | #{payment} |
| | | </if> |
| | | <if test="minTime != null"> |
| | | <!-- 高风险订单 --> |
| | |
| | | <if test="keyType == 1 ">AND co.co_order_no = '${key}'</if> |
| | | <if test="keyType == 2 ">AND hb.hb_uid = ${key}</if> |
| | | </if> |
| | | <if test="payment != null"> |
| | | AND co.co_payment <![CDATA[<]]> #{payment} |
| | | <if test="payment != null">AND |
| | | co.co_payment <![CDATA[<]]> |
| | | #{payment} |
| | | </if> |
| | | <!-- 订单来源 --> |
| | | <if test="source != null">AND co.co_source_type = #{source}</if> |
| | |
| | | DATE_SUB(NOW(), INTERVAL 1 DAY) GROUP BY |
| | | co.`co_order_no`,co.`co_source_type`)A |
| | | </select> |
| | | |
| | | <select id="searchOrderByUid" resultMap="ResultMap"> |
| | | SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalMoney, hb.hb_state AS hongBaoState, hb.`hb_type` AS hongBaoType, |
| | | MAX(hb.`hb_get_time`) AS accountTime, MAX(hb.`hb_pre_get_time`) AS preAccountTime, <include refid="Order_Column_List" /> |
| | | FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN (SELECT <include refid="Hongbao_Column_List" /> FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<>10]]>)hb |
| | | ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <foreach collection="list" item="esOrder" open=" and (" close=")" separator=" or "> |
| | | (co.co_trade_id=#{esOrder.tradeId} AND co.co_source_type = #{esOrder.platform}) |
| | | SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalMoney, hb.hb_state AS |
| | | hongBaoState, hb.`hb_type` AS hongBaoType, MAX(hb.`hb_get_time`) AS |
| | | accountTime, MAX(hb.`hb_pre_get_time`) AS preAccountTime, |
| | | <include refid="Order_Column_List" /> |
| | | FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT |
| | | <include refid="Hongbao_Column_List" /> |
| | | FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<>10]]>)hb |
| | | ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` LEFT |
| | | JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE |
| | | hb.hb_id IS NOT NULL |
| | | <foreach collection="list" item="esOrder" open=" and (" close=")" |
| | | separator=" or ">(co.co_trade_id=#{esOrder.tradeId} AND co.co_source_type = |
| | | #{esOrder.platform}) |
| | | </foreach> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` |
| | | ORDER BY co.co_third_create_time DESC |
| | | LIMIT ${start},${count} |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` ORDER BY |
| | | co.co_third_create_time DESC LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="countSearchOrderByUid" resultType="java.lang.Long"> |
| | | SELECT IFNULL(COUNT(ho_id),0) FROM (SELECT ho.ho_id FROM |
| | | yeshi_ec_hongbao_order ho LEFT JOIN (SELECT <include refid="Hongbao_Column_List" /> |
| | | yeshi_ec_hongbao_order ho LEFT JOIN (SELECT |
| | | <include refid="Hongbao_Column_List" /> |
| | | FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]> |
| | | )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <foreach collection="list" item="esOrder" open=" and (" close=")" separator=" or "> |
| | | (co.co_trade_id=#{esOrder.tradeId} AND co.co_source_type = #{esOrder.platform}) |
| | | <foreach collection="list" item="esOrder" open=" and (" close=")" |
| | | separator=" or ">(co.co_trade_id=#{esOrder.tradeId} AND co.co_source_type = |
| | | #{esOrder.platform}) |
| | | </foreach> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` )A |
| | | </select> |
| | | |
| | | <select id="getMinSettleTimeAndUid" resultMap="BaseResultMap"> |
| | | SELECT d.`co_uid`,MAX(d.`co_settle_time`) AS co_settle_time FROM `yeshi_ec_common_order` d |
| | | WHERE d.`co_settle_time` IS NOT NULL AND d.`co_payment` > 1 |
| | | GROUP BY d.`co_uid` |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="getMinSettleTimeAndUid" resultMap="BaseResultMap">SELECT |
| | | d.`co_uid`,MAX(d.`co_settle_time`) AS co_settle_time FROM |
| | | `yeshi_ec_common_order` d WHERE d.`co_settle_time` IS NOT NULL AND |
| | | d.`co_payment` > 1 GROUP BY d.`co_uid`</select> |
| | | <select id="getOrderList" resultMap="ResultMap"> |
| | | SELECT hb.`hb_type` AS hongBaoType, MAX(hb.`hb_get_time`) AS |
| | | accountTime, MAX(hb.`hb_pre_get_time`) AS preAccountTime, |
| | |
| | | <!-- 订单号查询 --> |
| | | <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> |
| | | <!-- 订单来源 --> |
| | | <if test="listSource != null and listSource.size() > 0"> |
| | | <foreach collection="listSource" item="item" open="AND (" close=")" separator="or"> |
| | | co.co_source_type = #{item} |
| | | </foreach> |
| | | <if test="listSource != null and listSource.size() > 0"> |
| | | <foreach collection="listSource" item="item" open="AND (" |
| | | close=")" separator="or">co.co_source_type = #{item}</foreach> |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` ORDER BY |
| | | co.co_third_create_time DESC LIMIT ${start},${count} |
| | |
| | | <!-- 订单号查询 --> |
| | | <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> |
| | | <!-- 订单来源 --> |
| | | <if test="listSource != null and listSource.size() > 0"> |
| | | <foreach collection="listSource" item="item" open="AND (" close=")" separator="or"> |
| | | co.co_source_type = #{item} |
| | | </foreach> |
| | | <if test="listSource != null and listSource.size() > 0"> |
| | | <foreach collection="listSource" item="item" open="AND (" |
| | | close=")" separator="or">co.co_source_type = #{item}</foreach> |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` )A |
| | | </select> |
| | | |
| | | <select id="countOrderByUidAndSettled" resultType="Long"> |
| | | SELECT COUNT(d.`co_id`) FROM `yeshi_ec_common_order` d |
| | | WHERE d.`co_uid` = #{uid} AND d.`co_settle_time` IS NOT NULL AND d.`co_payment` >= #{payment} |
| | | <select id="countOrderByUidAndSettled" resultType="Long">SELECT |
| | | COUNT(d.`co_id`) FROM `yeshi_ec_common_order` d WHERE d.`co_uid` = |
| | | #{uid} AND d.`co_settle_time` IS NOT NULL AND d.`co_payment` >= |
| | | #{payment} |
| | | </select> |
| | | </mapper> |
| | |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="vpi_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="vpi_source_type" property="sourceType" |
| | | jdbcType="INTEGER" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">vpi_id,vpi_uid,vpi_process,vpi_beizhu,vpi_create_time,vpi_update_time |
| | | <sql id="Base_Column_List">vpi_id,vpi_uid,vpi_process,vpi_beizhu,vpi_create_time,vpi_update_time,vpi_source_type |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_user_vip_pre_info |
| | | (vpi_id,vpi_uid,vpi_process,vpi_beizhu,vpi_create_time,vpi_update_time) |
| | | (vpi_id,vpi_uid,vpi_process,vpi_beizhu,vpi_create_time,vpi_update_time,vpi_source_type) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{process,jdbcType=INTEGER},#{beizhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{process,jdbcType=INTEGER},#{beizhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{sourceType,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="beizhu != null">vpi_beizhu,</if> |
| | | <if test="createTime != null">vpi_create_time,</if> |
| | | <if test="updateTime != null">vpi_update_time,</if> |
| | | <if test="sourceType != null">vpi_source_type,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="beizhu != null">#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="sourceType != null">#{sourceType,jdbcType=INTEGER},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo">update |
| | |
| | | #{process,jdbcType=INTEGER},vpi_beizhu = |
| | | #{beizhu,jdbcType=VARCHAR},vpi_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},vpi_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where vpi_id = #{id,jdbcType=BIGINT} |
| | | #{updateTime,jdbcType=TIMESTAMP} ,vpi_source_type |
| | | =#{sourceType,jdbcType=INTEGER} where vpi_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo"> |
| | | update yeshi_ec_user_vip_pre_info |
| | |
| | | <if test="beizhu != null">vpi_beizhu=#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">vpi_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">vpi_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="id !=null">vpi_id =#{id,jdbcType=BIGINT},</if> |
| | | <if test="sourceType !=null">vpi_source_type =#{sourceType,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where vpi_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | |
| | | <select id="selectByUidAndProcess" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_vip_pre_info where vpi_uid = #{uid} and |
| | | vpi_process=#{process} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="listByUid" resultMap="BaseResultMap" parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_vip_pre_info where vpi_uid = #{uid} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserShareGoodsHistoryMapper;
|
| | | import com.yeshi.fanli.dto.taobao.DaTaoKeFilterResult;
|
| | | import com.yeshi.fanli.dto.taobao.TaoLiJinDTO;
|
| | | import com.yeshi.fanli.entity.bus.share.UserShareGoodsHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.entity.taobao.UserTLJBuyHistory;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.exception.share.ShareGoodsException;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | |
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.taobao.UserTLJBuyHistoryService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserAccountService;
|
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
|
| | | import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | @Service
|
| | | public class ShareGoodsServiceImpl implements ShareGoodsService {
|
| | |
|
| | |
|
| | |
|
| | | @Resource
|
| | | private TBPidService tbPidService;
|
| | |
|
| | | @Resource
|
| | | private UserShareGoodsHistoryMapper userShareGoodsHistoryMapper;
|
| | |
|
| | |
|
| | | @Resource
|
| | | private UserInfoMapper userinfoMapper;
|
| | |
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | |
|
| | | @Resource
|
| | | private UserTLJBuyHistoryService userTLJBuyHistoryService;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private ConvertLinkManager convertLinkManager;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsCacheUtil taoBaoGoodsCacheUtil;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
|
| | |
|
| | | @Override
|
| | | public void addShareGoodsHistory(UserShareGoodsHistory history) {
|
| | |
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(goods.getCouponLink()) && !goods.getAuctionUrl().contains("s.click.taobao.com")) {
|
| | |
|
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCoupon(auctionId, info);
|
| | | if (taoBaoLink == null) {
|
| | | throw new ShareGoodsException(201, "商品转链失败");
|
| | | }
|
| | | goods.setCouponLink(taoBaoLink.getCouponLink());
|
| | | goods.setAuctionUrl(taoBaoLink.getAuctionUrl());
|
| | | }
|
| | |
|
| | | String link = taoBaoGoodsCacheUtil.getBaseConvertLink(auctionId, info.getPid());
|
| | | if (link != null) {
|
| | | goods.setCouponLink(link);
|
| | | } else {// 缓存
|
| | | DaTaoKeFilterResult result = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
|
| | | if (result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_COUPON
|
| | | || result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_PRICE_AND_COUPON) {
|
| | | link = DaTaoKeApiUtil.convertLink(auctionId, info.getPid());
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | goods.setCouponLink(link);
|
| | | taoBaoGoodsCacheUtil.cacheBaseConvertLink(auctionId, info.getPid(), link);
|
| | | }
|
| | | }
|
| | | if (StringUtil.isNullOrEmpty(link)) {
|
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCoupon(auctionId, info);
|
| | | if (taoBaoLink == null) {
|
| | | throw new ShareGoodsException(201, "商品转链失败");
|
| | | }
|
| | | goods.setCouponLink(taoBaoLink.getCouponLink());
|
| | | goods.setAuctionUrl(taoBaoLink.getAuctionUrl());
|
| | | }
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(relationId)) {
|
| | |
| | | tbLink.setCouponLink(goods.getCouponLink());
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(tbLink.getCouponLink())) {// 通过立即推广方式获取淘口令成功
|
| | | String quanToken = convertLinkManager.createTaoBaoToken(uid, goods.getPictUrl(), goods.getTitle(), tbLink.getCouponLink());
|
| | | String quanToken = convertLinkManager.createTaoBaoToken(uid, goods.getPictUrl(), goods.getTitle(),
|
| | | tbLink.getCouponLink());
|
| | | if (!StringUtil.isNullOrEmpty(quanToken)) {
|
| | | tbLink.setTaoToken(quanToken);
|
| | | }
|
| | | } else if (!StringUtil.isNullOrEmpty(tbLink.getClickUrl())) {
|
| | | String quanToken = convertLinkManager.createTaoBaoToken(uid,goods.getPictUrl(), goods.getTitle(), tbLink.getClickUrl());
|
| | | String quanToken = convertLinkManager.createTaoBaoToken(uid, goods.getPictUrl(), goods.getTitle(),
|
| | | tbLink.getClickUrl());
|
| | | if (!StringUtil.isNullOrEmpty(quanToken)) {
|
| | | tbLink.setTaoToken(quanToken);
|
| | | }
|
| | |
| | | public String createTaoBaoToken(Long uid, TaoBaoGoodsBrief goods) {
|
| | | String quanToken = "";
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponLink())) {// 通过立即推广方式获取淘口令成功
|
| | | quanToken = convertLinkManager.createTaoBaoToken(uid, goods.getPictUrl(), goods.getTitle(), goods.getCouponLink());
|
| | | quanToken = convertLinkManager.createTaoBaoToken(uid, goods.getPictUrl(), goods.getTitle(),
|
| | | goods.getCouponLink());
|
| | | } else if (!StringUtil.isNullOrEmpty(goods.getAuctionUrl())) {
|
| | | quanToken = convertLinkManager.createTaoBaoToken(uid,goods.getPictUrl(), goods.getTitle(), goods.getAuctionUrl());
|
| | | quanToken = convertLinkManager.createTaoBaoToken(uid, goods.getPictUrl(), goods.getTitle(),
|
| | | goods.getAuctionUrl());
|
| | | }
|
| | | return quanToken;
|
| | | }
|
| | |
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
|
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | app.setPid(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT);
|
| | |
|
| | | TaoBaoLink taoBaoLink = new TaoBaoLink();
|
| | | taoBaoLink.setAuctionId(auctionId);
|
| | |
|
| | | String baseUrl = taoBaoGoodsCacheUtil.getBaseConvertLink(auctionId, app.getPid());
|
| | | if (!StringUtil.isNullOrEmpty(baseUrl)) {
|
| | | taoBaoLink.setClickUrl(baseUrl);
|
| | | taoBaoLink.setCouponLink(baseUrl);
|
| | | return taoBaoLink;
|
| | | }
|
| | |
|
| | | // 查询是否为大淘客商品
|
| | |
|
| | | String link = null;
|
| | | DaTaoKeDetailV2 v2 = daTaoKeGoodsDetailV2Service.selectByAuctionId(auctionId);
|
| | | if (v2 != null) {
|
| | | try {
|
| | | TaoBaoGoodsBrief goods = redisManager.getTaoBaoGoodsBrief(auctionId);
|
| | | if (goods != null) {
|
| | | if (DaTaoKeUtil.canFilterCouponInfo(goods, v2)) {
|
| | | link = DaTaoKeApiUtil.convertLink(auctionId, app.getPid());
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | taoBaoGoodsCacheUtil.cacheBaseConvertLink(auctionId, app.getPid(), link);
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | throw new ShareGoodsException(4, "商品ID不能为空");
|
| | | }
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | taoBaoLink.setCouponLink(link);
|
| | | return taoBaoLink;
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId, app);
|
| | | if (goods == null) {
|
| | | throw new ShareGoodsException(1, "");
|
| | | }
|
| | |
|
| | | TaoBaoLink taoBaoLink = new TaoBaoLink();
|
| | | taoBaoLink.setAuctionId(auctionId);
|
| | | taoBaoLink.setClickUrl(goods.getAuctionUrl());
|
| | | taoBaoLink.setCouponLink(goods.getCouponLink());
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(goods.getYsylClickUrl()))
|
| | | taoBaoLink.setCouponLink(goods.getYsylClickUrl());
|
| | | taoBaoLink.setGoods(goods);
|
| | |
| | | goods.setAuctionUrl(taoBaoLink.getAuctionUrl());
|
| | | }
|
| | |
|
| | | String link = taoBaoGoodsCacheUtil.getBaseConvertLink(auctionId, info.getPid());
|
| | | if (link != null) {
|
| | | goods.setCouponLink(link);
|
| | | } else {// 缓存
|
| | | DaTaoKeFilterResult result = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
|
| | | if (result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_COUPON
|
| | | || result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_PRICE_AND_COUPON) {
|
| | | link = DaTaoKeApiUtil.convertLink(auctionId, info.getPid());
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | goods.setCouponLink(link);
|
| | | taoBaoGoodsCacheUtil.cacheBaseConvertLink(auctionId, info.getPid(), link);
|
| | | }
|
| | | }
|
| | | if (StringUtil.isNullOrEmpty(link)) {
|
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCoupon(auctionId, info);
|
| | | if (taoBaoLink == null) {
|
| | | throw new ShareGoodsException(201, "商品转链失败");
|
| | | }
|
| | | goods.setCouponLink(taoBaoLink.getCouponLink());
|
| | | goods.setAuctionUrl(taoBaoLink.getAuctionUrl());
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | if (!StringUtil.isNullOrEmpty(relationId)) {
|
| | | if (!StringUtil.isNullOrEmpty(goods.getAuctionUrl()))
|
| | | goods.setAuctionUrl(goods.getAuctionUrl() + "&relationId=" + relationId);
|
| | |
| | | import com.yeshi.fanli.dao.goods.taobao.dataoke.DaTaoKeGoodsDetailV2Dao;
|
| | | import com.yeshi.fanli.dto.dataoke.DaTaoKeGoodsResult;
|
| | | import com.yeshi.fanli.dto.dataoke.DingDongQiangDTO;
|
| | | import com.yeshi.fanli.dto.taobao.DaTaoKeFilterResult;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
| | | return goodsList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TaoBaoGoodsBrief filterTaoBaoGoods(TaoBaoGoodsBrief goods) {
|
| | |
|
| | | return filterTaoBaoGoods(goods, null, null);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<DaTaoKeDetailV2> listByIds(List<Long> idsList) {
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public TaoBaoGoodsBrief filterTaoBaoGoods(TaoBaoGoodsBrief goods, String platform, String version) {
|
| | | public DaTaoKeFilterResult filterTaoBaoGoods(TaoBaoGoodsBrief goods) {
|
| | | List<Long> goodsIdList = new ArrayList<>();
|
| | | goodsIdList.add(goods.getAuctionId());
|
| | |
|
| | | List<DaTaoKeDetailV2> daTaoKeList = listByGoodsIds(goodsIdList);
|
| | | if (daTaoKeList == null || daTaoKeList.size() == 0)
|
| | | return goods;
|
| | |
|
| | | if (platform != null && version != null && VersionUtil.greaterThan_2_1(platform, version)) {
|
| | | return new DaTaoKeFilterResult(goods, DaTaoKeFilterResult.FILTER_TYPE_NONE);
|
| | | // 重新设置标题与券价格
|
| | | goods = DaTaoKeUtil.filterTaoBaoGoods(goods, daTaoKeList.get(0), true);
|
| | | } else
|
| | | goods = DaTaoKeUtil.filterTaoBaoGoods(goods, daTaoKeList.get(0), false);
|
| | |
|
| | | return goods;
|
| | | return DaTaoKeUtil.filterTaoBaoGoods(goods, daTaoKeList.get(0), true);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.Producer;
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserActiveLogMapper;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserActiveMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoRegister;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoRegisterService;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | @Service
|
| | | public class UserActiveLogServiceImpl implements UserActiveLogService {
|
| | |
| | | @Resource
|
| | | private UserInfoRegisterService userInfoRegisterService;
|
| | |
|
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | |
|
| | | @Override
|
| | | public void addUserActiveLog(UserActiveLog userActiveLog) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | // 间隔5分钟以上再记录
|
| | | if (latestLog == null || System.currentTimeMillis() - latestLog.getCreateTime().getTime() > 1000 * 60 * 5L) {
|
| | | userActiveLog.setCreateTime(new Date());
|
| | |
| | | userActiveLogMapper.insertSelective(userActiveLog);
|
| | | // 更新最新活跃时间
|
| | | userInfoExtraService.updateActiveTime(userActiveLog.getUid() , new Date());
|
| | | addMQMsg(userActiveLog.getUid());
|
| | | } else if (latestLog != null) {
|
| | | // 如果设备 ,版本,渠道有变化则需要更改
|
| | | String oldIdentify = latestLog.getDevice() + "#" + latestLog.getVersionCode() + "#"
|
| | |
| | | userActiveLogMapper.insertSelective(userActiveLog);
|
| | | // 更新最新活跃时间
|
| | | userInfoExtraService.updateActiveTime(userActiveLog.getUid() , new Date());
|
| | | addMQMsg(userActiveLog.getUid());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | //添加活跃消息
|
| | | private void addMQMsg(Long uid) {
|
| | | UserActiveMQMsg msg = new UserActiveMQMsg(uid, new Date());
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userActve, msg);
|
| | | message.setStartDeliverTime(System.currentTimeMillis() + 1000 * 5L);// 5s后发送活跃消息
|
| | | producer.send(message);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | public UserActiveLog getFirstActiveInfo(Long uid) {
|
| | | return userActiveLogMapper.selectFirstActiveInfo(uid);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public long count90DaysLaterActiveNum(String preDay){
|
| | |
| | | update.setLevel(level);
|
| | | update.setUpdateTime(new Date());
|
| | | teamUserLevelStatisticMapper.updateByPrimaryKeySelective(update);
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelUpgradedNotify;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.entity.common.Config;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPPreInfoException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.email.MailSenderUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | |
| | |
|
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | | throw new UserVIPInfoException(1, "请先升级为高级会员");
|
| | | }
|
| | |
|
| | | if (!verifyVip(uid))
|
| | | int verifyResult = verifyVip(uid);
|
| | | if (verifyResult <= 0)
|
| | | throw new UserVIPInfoException(1, "不满足升级条件");
|
| | |
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | |
| | | info.setState(UserVIPInfo.STATE_VERIFING);
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | | // 发送邮件通知
|
| | | try {
|
| | | Config config = configService.getConfig(ConfigKeyEnum.extractCodeEmailFrom.getKey());
|
| | | String[] sts = config.getValue().split(",");
|
| | | String account = sts[0];
|
| | | String pwd = sts[1];
|
| | |
|
| | | String msg = String.format("用户ID:%s 申请超级会员", uid + "");
|
| | | String email = userVipConfigService.getValueByKey("apply_vip_email");
|
| | | String[] emails = email.split(",");
|
| | | for (String e : emails) {
|
| | | MailSenderUtil.sendEmail(e, account, pwd, msg, msg);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | | throw new UserVIPInfoException(1, "该用户还不是高级会员");
|
| | | }
|
| | |
|
| | | if (!verifyVip(uid))
|
| | | int verifyVipResult = verifyVip(uid);
|
| | |
|
| | | if (verifyVipResult <= 0)
|
| | | throw new UserVIPInfoException(1, "系统验证:不满足升级条件");
|
| | |
|
| | | Date upgradeTime = new Date();
|
| | |
| | | UserVIPPreInfo preInfo = new UserVIPPreInfo();
|
| | | preInfo.setCreateTime(new Date());
|
| | | preInfo.setProcess(UserLevelEnum.superVIP.getLevel());
|
| | | preInfo.setSourceType(verifyVipResult);
|
| | | preInfo.setUid(uid);
|
| | |
|
| | | try {
|
| | |
| | |
|
| | | /**
|
| | | * 验证是否符合VIP
|
| | | * @Title: verifyVip
|
| | | * @Description: |
| | | * @param uid
|
| | | * @return
|
| | | * @return 0-不符合 1-订单 2-团队
|
| | | * int 返回类型
|
| | | * @throws
|
| | | */
|
| | | private boolean verifyVip(Long uid) {
|
| | | private int verifyVip(Long uid) {
|
| | | // 自购 + 分享订单
|
| | | long doneOrder = hongBaoV2CountService.countMyDirectOrderByCashArrival(uid, Constant.VIP_ORDER_PAY);
|
| | | // 有效粉丝
|
| | |
| | | limitSecond = Long.parseLong(second);
|
| | | }
|
| | |
|
| | | if (doneOrder >= limitOrder || (doneFirst >= limitFirst && doneSecond >= limitSecond)) {
|
| | | return true;
|
| | | if (doneOrder >= limitOrder) {
|
| | | return UserVIPPreInfo.SOURCE_TYPE_ORDER;
|
| | | }
|
| | | return false;
|
| | |
|
| | | if ((doneFirst >= limitFirst && doneSecond >= limitSecond))
|
| | |
|
| | | return UserVIPPreInfo.SOURCE_TYPE_TEAM;
|
| | | return 0;
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
|
| | | import com.yeshi.fanli.service.inter.user.msg.UserAccountMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserLevelUpgradedNotifyService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | |
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.util.user.UserLevelUtil;
|
| | |
|
| | | @Service
|
| | | public class UserVIPPreInfoServiceImpl implements UserVIPPreInfoService {
|
| | |
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | |
|
| | | @Resource
|
| | | private TeamUserLevelStatisticService teamUserLevelStatisticService;
|
| | |
|
| | | @Override
|
| | | public void addUserVIPPreInfo(UserVIPPreInfo info) throws UserVIPPreInfoException {
|
| | | if (info == null || info.getUid() == null || info.getProcess() == null)
|
| | | if (info == null || info.getUid() == null || info.getProcess() == null || info.getSourceType() == null)
|
| | | throw new UserVIPPreInfoException(1, "信息不完整");
|
| | | for (Long fuid : Constant.NO_UPGRADE_UIDS) {// 禁止不能升级的用户升级
|
| | | if (info.getUid().longValue() == fuid)
|
| | | return;
|
| | | }
|
| | |
|
| | | UserVIPPreInfo oldInfo = userVIPPreInfoMapper.selectByUidAndProcess(info.getUid(), info.getProcess());
|
| | | if (oldInfo != null)
|
| | |
| | | if (info.getCreateTime() == null)
|
| | | info.setCreateTime(new Date());
|
| | | userVIPPreInfoMapper.insertSelective(info);
|
| | | // 设置统计数据
|
| | | teamUserLevelStatisticService.setUserLevel(info.getUid(), UserLevelUtil.getByLevel(info.getProcess()));
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | info.setProcess(UserVIPPreInfo.PROCESS_2);
|
| | | info.setCreateTime(upgradeTime);
|
| | | info.setUpdateTime(upgradeTime);
|
| | | if (teamPass)
|
| | | info.setSourceType(UserVIPPreInfo.SOURCE_TYPE_TEAM);
|
| | | else
|
| | | info.setSourceType(UserVIPPreInfo.SOURCE_TYPE_ORDER);
|
| | | |
| | | addUserVIPPreInfo(info);
|
| | |
|
| | | // 升级弹框提示
|
| | |
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.dao.goods.taobao.dataoke.DaTaoKeGoodsDetailV2Dao;
|
| | | import com.yeshi.fanli.dto.dataoke.DingDongQiangDTO;
|
| | | import com.yeshi.fanli.dto.taobao.DaTaoKeFilterResult;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | |
|
| | |
| | | * @param goods
|
| | | * @return
|
| | | */
|
| | | public TaoBaoGoodsBrief filterTaoBaoGoods(TaoBaoGoodsBrief goods);
|
| | |
|
| | | |
| | | public TaoBaoGoodsBrief filterTaoBaoGoods(TaoBaoGoodsBrief goods,String platform,String version);
|
| | | public DaTaoKeFilterResult filterTaoBaoGoods(TaoBaoGoodsBrief goods);
|
| | |
|
| | | /**
|
| | | * 根据主键查询
|
| | |
| | | throw new HongBaoException(1, "订单信息不完整");
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId());
|
| | | if (hongBaoOrder == null) {
|
| | | miandan = saveHongBao(commonOrder, type, notificationMap, userLevel, placeOrderDate);
|
| | | hasAdd = true;
|
| | | HongBaoSaveResult result = saveHongBao(commonOrder, type, notificationMap, userLevel,
|
| | | placeOrderDate);
|
| | | miandan = result.isMiandan();
|
| | | hasAdd = result.isAdd();
|
| | | } else {
|
| | | boolean update = updateHongBao(hongBaoOrder, commonOrder, type, notificationMap, placeOrderDate);
|
| | | if (update) {
|
| | |
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private boolean saveHongBao(CommonOrder commonOrder, int type, Map<Integer, HongBaoOrder> notificationMap,
|
| | | private HongBaoSaveResult saveHongBao(CommonOrder commonOrder, int type, Map<Integer, HongBaoOrder> notificationMap,
|
| | | UserLevelEnum buyerLevel, Date placeOrderDate) throws HongBaoException, UserAccountException {
|
| | |
|
| | | if (type == HongBaoV2.TYPE_ZIGOU) {
|
| | |
| | | orderHongBaoMoneyComputeService.computeFanliMoney(commonOrder, buyerLevel), mianDanMoney,
|
| | | buyerLevel);
|
| | | if (hongBao == null)
|
| | | return mianDanMoney != null;
|
| | | return new HongBaoSaveResult(false, mianDanMoney != null);
|
| | | addFanLiOrShareHongBao(hongBao, commonOrder, notificationMap);
|
| | | UserInfo boss = threeSaleSerivce.getBoss(hongBao.getUserInfo().getId());
|
| | | if (boss != null && hongBao.getState() != HongBaoV2.STATE_SHIXIAO && mianDanMoney == null) {// 1级BOSS存在且红包未失效,免单不支持多级分销
|
| | |
| | | BigDecimal money = orderHongBaoMoneyComputeService.computeFirstInviteMoney(commonOrder, buyerLevel,
|
| | | bossList);
|
| | | if (money == null)// 返利资金为空不参与分成
|
| | | return mianDanMoney != null;
|
| | | return new HongBaoSaveResult(true, mianDanMoney != null);
|
| | |
|
| | | UserLevelEnum bossLevel = userLevelManager.getUserLevel(boss.getId());
|
| | |
|
| | |
| | | money = orderHongBaoMoneyComputeService.computeSecondInviteMoney(commonOrder, buyerLevel, bossList);
|
| | | bossLevel = userLevelManager.getUserLevel(boss.getId());
|
| | | if (money == null)
|
| | | return mianDanMoney != null;
|
| | | return new HongBaoSaveResult(true, mianDanMoney != null);
|
| | | HongBaoV2 secondHongbao = createInviteHongBao(boss.getId(), hongBao, commonOrder,
|
| | | HongBaoV2.TYPE_ERJI, money, bossLevel);
|
| | | addInviteHongBao(secondHongbao, null, notificationMap, commonOrder);
|
| | |
| | | } else if (type == HongBaoV2.TYPE_SHARE_GOODS) {
|
| | | // 分享赚不加入失效的订单
|
| | | if (commonOrder.getState() == CommonOrder.STATE_SX || commonOrder.getState() == CommonOrder.STATE_WQ)
|
| | | return false;
|
| | | return new HongBaoSaveResult(false, false);
|
| | | // 分享赚
|
| | | BigDecimal money = null;
|
| | | if (commonOrder.getSourceType() == Constant.SOURCE_TYPE_TAOBAO
|
| | |
| | | money = orderHongBaoMoneyComputeService.computeShareMoney(commonOrder, buyerLevel);
|
| | |
|
| | | if (money == null || money.compareTo(new BigDecimal(0)) <= 0)
|
| | | return false;
|
| | | return new HongBaoSaveResult(false, false);
|
| | | HongBaoV2 hongBao = createShareHongBao(commonOrder, money, buyerLevel);
|
| | | if (hongBao == null)
|
| | | return false;
|
| | | return new HongBaoSaveResult(false, false);
|
| | | addFanLiOrShareHongBao(hongBao, commonOrder, notificationMap);
|
| | | // 4月17日后才有一级分享赚
|
| | | if (placeOrderDate.getTime() > TimeUtil.convertToTimeTemp("2019-04-17", "yyyy-MM-dd")) {
|
| | |
| | |
|
| | | money = orderHongBaoMoneyComputeService.computeFirstInviteMoney(commonOrder, buyerLevel, bossList);
|
| | | if (money == null)
|
| | | return false;
|
| | | return new HongBaoSaveResult(true, false);
|
| | | UserLevelEnum bossLevel = userLevelManager.getUserLevel(boss.getId());
|
| | | HongBaoV2 firstHongbao = createInviteHongBao(boss.getId(), hongBao, commonOrder,
|
| | | HongBaoV2.TYPE_SHARE_YIJI, money, bossLevel);
|
| | |
| | | money = orderHongBaoMoneyComputeService.computeSecondInviteMoney(commonOrder, buyerLevel,
|
| | | bossList);
|
| | | if (money == null)// 返利比例为0就不统计
|
| | | return false;
|
| | | return new HongBaoSaveResult(true, false);
|
| | | bossLevel = userLevelManager.getUserLevel(boss.getId());
|
| | | HongBaoV2 secondChild = createInviteHongBao(boss.getId(), hongBao, commonOrder,
|
| | | HongBaoV2.TYPE_SHARE_ERJI, money, bossLevel);
|
| | |
| | | } else
|
| | | throw new HongBaoException(2, "type错误");
|
| | |
|
| | | return false;
|
| | | return new HongBaoSaveResult(true, false);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | private void addInviteHongBao(HongBaoV2 child, String parentHongBaoUserName,
|
| | | Map<Integer, HongBaoOrder> notificationMap, CommonOrder commonOrder) {
|
| | | if (child != null) {
|
| | | // 老版本资金为0的红包不加入邀请订单
|
| | | if (child.getMoney() == null || (child.getMoney().compareTo(new BigDecimal(0)) == 0
|
| | | && commonOrder.getThirdCreateTime().getTime() < Constant.NEW_ORDER_FANLI_RULE_TIME))
|
| | | return;
|
| | |
|
| | | hongBaoV2Mapper.insertSelective(child);
|
| | | // 用户通知
|
| | | if (notificationMap.get(child.getType()) == null) {
|
| | |
| | | return hongBao;
|
| | | }
|
| | |
|
| | | class HongBaoSaveResult {
|
| | | boolean add;
|
| | | boolean miandan;
|
| | |
|
| | | public void setMiandan(boolean miandan) {
|
| | | this.miandan = miandan;
|
| | | }
|
| | |
|
| | | public HongBaoSaveResult(boolean add, boolean miandan) {
|
| | | super();
|
| | | this.add = add;
|
| | | this.miandan = miandan;
|
| | | }
|
| | |
|
| | | public boolean isAdd() {
|
| | | return add;
|
| | | }
|
| | |
|
| | | public void setAdd(boolean add) {
|
| | | this.add = add;
|
| | | }
|
| | |
|
| | | public boolean isMiandan() {
|
| | | return miandan;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | info.setCreateTime(date);
|
| | | info.setProcess(level.getLevel());
|
| | | info.setUid(uid);
|
| | | //默认为订单型
|
| | | info.setSourceType(UserVIPPreInfo.SOURCE_TYPE_ORDER);
|
| | | try {
|
| | | userVIPPreInfoService.addUserVIPPreInfo(info);
|
| | | } catch (UserVIPPreInfoException e) {
|
| | |
| | | public static final BigDecimal REWARD_COUPON_LIMIT_MONEY = new BigDecimal("10");
|
| | |
|
| | |
|
| | | public static final Long[] NO_UPGRADE_UIDS=new Long[]{1700696L};
|
| | | |
| | | |
| | |
|
| | |
|
| | | // 线程等待数量
|
| | |
| | | taobaoQueue("tb-u-q-", "淘宝商品队列"),
|
| | | taobaoCode("taobao-code-", "淘宝code"),
|
| | | taobaoTokenGoodsMap("tb-t-g_m-","淘宝口令对应商品的映射关系保存"),
|
| | | taobaoBaseLink("tb-b-l-", "淘客商品转链结果缓存"),
|
| | | JDGoods("JD-goods-", "京东商品"),
|
| | | JDShortUrl("jd-link-to-goods-", "京东短链"),
|
| | | jingDongGoods("jingdong-goods-", "京东商品"),
|
| | | PDDGoods("PDD-goods-", "拼多多商品"),
|
| | | pinDuoDuoGoods("pinduoduo-goods-", "拼多多商品"),
|
| | | |
| | |
|
| | | bindAlipay("bindalipay-", "绑定支付宝"),
|
| | | seacrhGoods("integral-seacrh-goods-", "商品搜索"),
|
| | |
| | | public String getKey() {
|
| | | return key;
|
| | | }
|
| | | |
| | |
|
| | | public static String getRedisKey(RedisKeyEnum keyEnum, String value) {
|
| | | return keyEnum.getKey() + value;
|
| | |
| | | package com.yeshi.fanli.util.cache;
|
| | |
|
| | | import java.util.Calendar;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Component
|
| | | public class TaoBaoGoodsCacheUtil {
|
| | |
| | | return Long.parseLong(goodsId);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 缓存转链结果
|
| | | * @Title: cacheBaseConvertLink
|
| | | * @Description: |
| | | * @param auctionId
|
| | | * @param pid
|
| | | * @param link |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void cacheBaseConvertLink(Long auctionId, String pid, String link) {
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoBaseLink, StringUtil.Md5(auctionId + "#" + pid));
|
| | | //
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | long now = calendar.getTimeInMillis();
|
| | | calendar.add(Calendar.HOUR, 1);
|
| | |
|
| | | Long time = TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(calendar.getTimeInMillis(), "yyyy-MM-dd HH"),
|
| | | "yyyy-MM-dd HH");
|
| | |
|
| | | int second = (int) ((time - now) / 1000);
|
| | | if (second <= 0)
|
| | | second = 1;
|
| | |
|
| | | redisManager.cacheCommonString(key, link, second);// 有效期30分钟
|
| | | }
|
| | |
|
| | | public String getBaseConvertLink(Long auctionId, String pid) {
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoBaseLink, StringUtil.Md5(auctionId + "#" + pid));
|
| | | String url = redisManager.getCommonString(key);
|
| | |
|
| | | return StringUtil.isNullOrEmpty(url) ? null : url;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return result;
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | /**
|
| | | * 获取大淘客品牌优选 品牌id
|
| | | *
|
| | |
| | | }
|
| | | return hotWords;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 高效转链
|
| | | * @Title: convertLink
|
| | | * @Description: |
| | | * @param auctionId
|
| | | * @param pid |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public static String convertLink(Long auctionId, String pid) {
|
| | | TaoKeAppInfo app = APP_KEYS[1];
|
| | | Map<String, String> params = new TreeMap<>();
|
| | | params.put("version", "v1.1.1");
|
| | | params.put("goodsId", auctionId + "");
|
| | | params.put("pid", pid);
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("sign", getSign(params, app.getAppSecret()));
|
| | |
|
| | | String result = null;
|
| | | try {
|
| | | result = HttpUtil.get("https://openapi.dataoke.com/api/tb-service/get-privilege-link", params,
|
| | | new HashMap<>());
|
| | | } catch (Exception e) {
|
| | | result = HttpUtil.get("https://openapi.dataoke.com/api/tb-service/get-privilege-link", params,
|
| | | new HashMap<>());
|
| | | }
|
| | | |
| | | System.out.println(result);
|
| | |
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | | if (json != null) {
|
| | | json = json.getJSONObject("data");
|
| | | if (json != null) {
|
| | | return json.optString("couponClickUrl");
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | | }
|
| | |
| | | new Date(TimeUtil.convertToTimeTemp(taoBaoOrder.getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | commonOrder.setUpdateTime(new Date());
|
| | | commonOrder.setTradeId(taoBaoOrder.getTradeId());
|
| | | commonOrder.setChildSourceType(taoBaoOrder.getOrderType());
|
| | |
|
| | | return commonOrder;
|
| | | }
|
| | |
| | |
|
| | | Message message = null; // 做循环传来的key
|
| | | Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).payload(payload)
|
| | | .notifyId((int) (Math.random() * Integer.MAX_VALUE))
|
| | | .description(description).passThrough(0) // 设置消息是否通过透传方式至App,
|
| | | // 1表示透传,0表示通知栏消息(默认)
|
| | | .notifyType(1); // 设置通知类型, type类型(1-默认提示音, 2-使用默认震动提示,
|
| | |
| | |
|
| | | Message message = null; // 做循环传来的key
|
| | | Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).payload(payload)
|
| | | .notifyId((int) (Math.random() * Integer.MAX_VALUE))
|
| | | .description(description).passThrough(0) // 设置消息是否通过透传方式至App,
|
| | | // 1表示透传,0表示通知栏消息(默认)
|
| | | .notifyType(1); // 设置通知类型, type类型(1-默认提示音, 2-使用默认震动提示,
|
| | |
| | | Message message = null; // 做循环传来的key
|
| | | Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).description(content)
|
| | | .passThrough(0) // 设置消息是否通过透传方式至App, 1表示透传,0表示通知栏消息(默认)
|
| | | .notifyType(1); // 设置通知类型, type类型(1-默认提示音, 2-使用默认震动提示,
|
| | | .notifyId((int) (Math.random() * Integer.MAX_VALUE)).notifyType(1); // 设置通知类型,
|
| | | // type类型(1-默认提示音,
|
| | | // 2-使用默认震动提示,
|
| | | // 3-使用默认led灯光提示)
|
| | | // 将extra放入MessageInfo对象中, 循环遍历extra中的key 和 value
|
| | | if (map != null) {
|
| | |
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserActiveMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoRegister;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoModifyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoRegisterService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | |
|
| | |
| | | if (tag.equalsIgnoreCase(UserTopicTagEnum.userActve.name())) {
|
| | | UserActiveMQMsg msg = new Gson().fromJson(new String(message.getBody()), UserActiveMQMsg.class);
|
| | | Long uid = msg.getUid();
|
| | |
|
| | | // 老用户同步绑定信息
|
| | | userInfoModifyRecordService.syncBeforeInfo(uid);
|
| | |
|
| | | userInfoModifyRecordService.syncBeforeInfo(uid);
|
| | | // 低版本全部升级普通会员
|
| | |
|
| | | List<ThreeSale> threeSaleList = threeSaleSerivce.getMyBossDeepList(uid, 2);
|
| | | List<Long> uidList = new ArrayList<>();
|
| | | uidList.add(uid);
|
| | |
|
| | | if (threeSaleList != null) {
|
| | | for (ThreeSale ts : threeSaleList) {
|
| | | uidList.add(ts.getBoss().getId());
|
| | | }
|
| | | }
|
| | | upgradeOldUser(uidList);
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
|
| | | private void upgradeOldUser(List<Long> uidList) {
|
| | | for (Long uid : uidList) {
|
| | | // 同步老用户等级
|
| | | UserActiveLog log = userActiveLogService.getUserLatestActiveInfo(uid);
|
| | |
|
| | | // 低版本全部升级普通会员
|
| | | if (log != null && !VersionUtil.greaterThan_2_1(
|
| | | "appstore".equalsIgnoreCase(log.getChannel()) ? "ios" : "android", log.getVersionCode())) {
|
| | | if (log != null
|
| | | && !VersionUtil.greaterThan_2_1("appstore".equalsIgnoreCase(log.getChannel()) ? "ios" : "android",
|
| | | log.getVersionCode())) {
|
| | | UserVIPPreInfo vipInfo = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (vipInfo == null) {
|
| | | vipInfo = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | |
| | | vip.setCreateTime(new Date());
|
| | | vip.setProcess(UserVIPPreInfo.PROCESS_1);
|
| | | vip.setUid(uid);
|
| | | vip.setSourceType(UserVIPPreInfo.SOURCE_TYPE_ORDER);
|
| | | try {
|
| | | userVIPPreInfoService.addUserVIPPreInfo(vip);
|
| | | } catch (UserVIPPreInfoException e) {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | } else if (log != null && VersionUtil.greaterThan_2_1(
|
| | | "appstore".equalsIgnoreCase(log.getChannel()) ? "ios" : "android", log.getVersionCode())) {// 2.1后升级其他等级
|
| | | // 线上老用户升级到2.1,自动计算等级
|
| | |
| | | vip.setCreateTime(new Date());
|
| | | vip.setProcess(UserVIPPreInfo.PROCESS_1);
|
| | | vip.setUid(uid);
|
| | | vip.setSourceType(UserVIPPreInfo.SOURCE_TYPE_ORDER);
|
| | | try {
|
| | | userVIPPreInfoService.addUserVIPPreInfo(vip);
|
| | | } catch (UserVIPPreInfoException e) {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | } else {//之前老版本处理为普通会员的用户升级新版本
|
| | | if (vipInfo.getProcess() == UserVIPPreInfo.PROCESS_1
|
| | | && vipInfo.getCreateTime().getTime() < TimeUtil
|
| | | .convertToTimeTemp("2020-04-30 14:10:00", "yyyy-MM-dd HH:mm:ss")) {
|
| | | // 计算等级
|
| | | userVIPPreInfoService.upgradeVipByMyOrder(uid);
|
| | | userVIPPreInfoService.upgradeVipByTeamNum(uid);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.rocketmq.consumer.user;
|
| | |
|
| | | 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.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | /**
|
| | | * 用户粉丝消息
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class UserTeamMessageListener implements MessageListener {
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | |
|
| | | LogHelper.mqInfo("consumer-UserTeamMessageListener", 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.userActve.name())) {// 用户活跃
|
| | | // TODO 更改用户活跃时间
|
| | |
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.userInfoUpdate.name())) {// 用户信息更新
|
| | |
|
| | | // TODO 更改微信号绑定
|
| | |
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.taobaoBindSuccess.name())) {// 淘宝绑定成功
|
| | |
|
| | | // TODO 更改淘宝绑定状态与原用户淘宝绑定状态
|
| | |
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.inviteSuccess.name())) {// 邀请成功
|
| | |
|
| | | // TODO 更新粉丝数量
|
| | |
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.userMoneyAdd.name())) {// 资金到账
|
| | |
|
| | | // TODO 更新近60天到账
|
| | |
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.becomeValidUser.name())) {// 成为有效用户
|
| | |
|
| | | // TODO 有效用户标识
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.ThreeSaleSeparateMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserLevelChangedMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | /**
|
| | |
| | | @Resource
|
| | | private UserInviteValidNumService userInviteValidNumService;
|
| | |
|
| | | @Resource
|
| | | private UserActiveLogService userActiveLogService;
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | |
|
| | |
| | | if (tag.equalsIgnoreCase(UserTopicTagEnum.userLevelChanged.name())) {// 用户等级发生变化
|
| | | UserLevelChangedMQMsg msg = new Gson().fromJson(new String(message.getBody()),
|
| | | UserLevelChangedMQMsg.class);
|
| | |
|
| | | for (Long fuid : Constant.NO_UPGRADE_UIDS) {// 禁止不能升级的用户升级
|
| | | if (msg.getUid().longValue() == fuid)
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
|
| | | // 更新上2级的邀请统计
|
| | | teamUserLevelStatisticService.updateUserLevel(msg.getUid());
|
| | | UserInfo boss = threeSaleSerivce.getBoss(msg.getUid());
|
| | |
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.threeSaleSeparate.name())) {// 邀请关系脱离
|
| | | ThreeSaleSeparateMQMsg msg = new Gson().fromJson(new String(message.getBody()),
|
| | | ThreeSaleSeparateMQMsg.class);
|
| | |
|
| | | // 更新上两级邀请统计
|
| | | teamUserLevelStatisticService.initData(msg.getBossUid());
|
| | | UserInfo boss = threeSaleSerivce.getBoss(msg.getBossUid());
|
| | |
| | | OrderMoneyRecievedMQMsg dto = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (dto != null) {
|
| | | for (Long fuid : Constant.NO_UPGRADE_UIDS) {// 禁止不能升级的用户升级
|
| | | if (dto.getUid().longValue() == fuid)
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | // 判断版本
|
| | | UserActiveLog log = userActiveLogService.getUserLatestActiveInfo(dto.getUid());
|
| | |
|
| | | if (log == null || !VersionUtil.greaterThan_2_1(
|
| | | "appstore".equalsIgnoreCase(log.getChannel()) ? "ios" : "android", log.getVersionCode())) {
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {// 自购到账
|
| | | // 会员升级-自购订单数量验证
|
| | | userVIPPreInfoService.upgradeVipByMyOrder(dto.getUid());
|
| | |
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderConfirm.name())) {
|
| | | OrderConfirmMQMsg dto = new Gson().fromJson(new String(message.getBody()),OrderConfirmMQMsg.class);
|
| | | if (dto != null) {
|
| | | for (Long fuid : Constant.NO_UPGRADE_UIDS) {// 禁止不能升级的用户升级
|
| | | if (dto.getSourceUid().longValue() == fuid)
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
|
| | | // 会员等级升级-粉丝数量验证
|
| | | userVIPPreInfoService.upgradeVipByTeamNum(dto.getSourceUid());
|
| | | userInviteValidNumService.addValidTeamNum(dto.getSourceUid(), dto.getSettleMent(), dto.getPlaceOrderTime());
|
| | | userInviteValidNumService.addValidTeamNum(dto.getSourceUid(), dto.getSettleMent(),
|
| | | dto.getPlaceOrderTime());
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.rocketmq.producer;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.bean.ProducerBean;
|
| | |
|
| | | @Component
|
| | | public class UserRocketMsgProducer extends ProducerBean {
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import com.yeshi.fanli.dto.dataoke.DingDongQiangDTO;
|
| | | import com.yeshi.fanli.dto.dataoke.DingDongTime;
|
| | | import com.yeshi.fanli.dto.taobao.DaTaoKeFilterResult;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoCoupon;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
| | | return desc;
|
| | | }
|
| | |
|
| | | public static TaoBaoGoodsBrief filterTaoBaoGoods(TaoBaoGoodsBrief goods, DaTaoKeDetailV2 v2,
|
| | | public static DaTaoKeFilterResult filterTaoBaoGoods(TaoBaoGoodsBrief goods, DaTaoKeDetailV2 v2,
|
| | | boolean filterCouponInfo) {
|
| | | if (v2 != null && goods != null) {
|
| | | // 重新设置标题与券价格
|
| | | goods.setTitle(v2.getDtitle());
|
| | | if (!StringUtil.isNullOrEmpty(v2.getMainPic()))
|
| | | goods.setPictUrlWhite(v2.getMainPic());
|
| | | // 设置简介
|
| | |
|
| | | goods.setDescription(v2.getDesc());
|
| | | // 如果没有券信息,则提供券信息
|
| | | if (StringUtil.isNullOrEmpty(goods.getCouponInfo()) && v2 != null
|
| | | && !StringUtil.isNullOrEmpty(v2.getCouponLink())) {
|
| | | if (canFilterCouponInfo(goods, v2)) {
|
| | | try {
|
| | | long time = System.currentTimeMillis();
|
| | | // 券在有效期内并且还有剩余券
|
| | |
| | | goods.setCouponLeftCount(v2.getCouponTotalNum() - v2.getCouponReceiveNum());
|
| | | goods.setCouponLink(v2.getCouponLink());
|
| | | goods.setCouponTotalCount(v2.getCouponTotalNum());
|
| | | goods.setShopCoupon(true);
|
| | | goods.setShopCoupon(false);
|
| | | goods.setZkPrice(v2.getOriginalPrice());
|
| | | return new DaTaoKeFilterResult(goods, DaTaoKeFilterResult.FILTER_TYPE_PRICE_AND_COUPON);
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | |
|
| | | if (goods.getZkPrice().compareTo(v2.getOriginalPrice()) > 0) {
|
| | | goods.setZkPrice(v2.getOriginalPrice());
|
| | | return new DaTaoKeFilterResult(goods, DaTaoKeFilterResult.FILTER_TYPE_PRICE);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | return goods;
|
| | | return new DaTaoKeFilterResult(goods, DaTaoKeFilterResult.FILTER_TYPE_NONE);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 是否可以过滤掉券信息
|
| | | * @Title: filterCouponInfo
|
| | | * @Description: |
| | | * @param goods
|
| | | * @param v2 |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public static boolean canFilterCouponInfo(TaoBaoGoodsBrief goods, DaTaoKeDetailV2 v2) {
|
| | | if (StringUtil.isNullOrEmpty(goods.getCouponInfo()) && v2 != null
|
| | | && !StringUtil.isNullOrEmpty(v2.getCouponLink())) {
|
| | | try {
|
| | | long time = System.currentTimeMillis();
|
| | | // 券在有效期内并且还有剩余券
|
| | | if (time >= TimeUtil.convertToTimeTemp(v2.getCouponStartTime(), "yyyy-MM-dd HH:mm:ss")
|
| | | && time <= TimeUtil.convertToTimeTemp(v2.getCouponEndTime(), "yyyy-MM-dd HH:mm:ss")
|
| | | && (v2.getCouponTotalNum() - v2.getCouponReceiveNum()) > 0) {
|
| | | return true;
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | return false;
|
| | | }
|
| | |
|
| | | public static TaoBaoGoodsBrief filterTaoBaoGoods(TaoBaoGoodsBrief goods, DaTaoKeDetailV2 v2) {
|
| | | return filterTaoBaoGoods(goods, v2, false);
|
| | | return filterTaoBaoGoods(goods, v2, false).getGoods();
|
| | | }
|
| | |
|
| | | public static DaTaoKeDetailV2 filterDaTaoKe(TaoBaoGoodsBrief goods, DaTaoKeDetailV2 detail) {
|
| | |
| | | </property>
|
| | | </bean>
|
| | |
|
| | | <!-- 红包消息订阅 -->
|
| | | <bean id="redPackMessageListener"
|
| | | class="com.yeshi.fanli.util.rocketmq.consumer.redpack.RedPackMessageListener"></bean>
|
| | | <!-- Group ID 订阅同一个 Topic,可以创建多个 ConsumerBean -->
|
| | | <bean id="redPackConsumer" 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_RED_PACK</prop>
|
| | | <prop key="NAMESRV_ADDR">${rocketmq.NAMESRV_ADDR}</prop>
|
| | | <prop key="ConsumeThreadNums">50</prop>
|
| | | </props>
|
| | | </property>
|
| | | <property name="subscriptionTable">
|
| | | <map>
|
| | | <!-- 产生订单/延时,订单到账 -->
|
| | | <entry value-ref="redPackMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression"
|
| | | value="orderStatistic||orderFanLiActual||orderStatisticDelay||orderFanLiSeparateByOrderNo" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
|
| | | <!-- 用户注册,账号绑定,邀请好友 ,完成金币任务,红包赠送到期 -->
|
| | | <entry value-ref="redPackMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_USER" />
|
| | | <property name="expression"
|
| | | value="inviteSuccess||userAccountBinding||integralTaskFinish||redPackGift||redPackGiftDrawback" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | </map>
|
| | | </property>
|
| | | </bean>
|
| | |
|
| | |
|
| | | <!-- 金币消息订阅 -->
|
| | | <bean id="integralMessageListener"
|
| | | class="com.yeshi.fanli.util.rocketmq.consumer.integral.IntegralMessageListener"></bean>
|