2个文件已删除
82个文件已修改
20个文件已添加
| | |
| | |
|
| | | import redis.clients.jedis.Jedis;
|
| | | import redis.clients.jedis.JedisPool;
|
| | | import redis.clients.jedis.params.SetParams;
|
| | |
|
| | | /**
|
| | | * 活跃用户处理
|
| | |
| | | String key = "useractive-" + uidStr;
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | try {
|
| | | if (jedis.setnx(key, "1") > 0) {
|
| | | jedis.expire(key, 60 * 5);// 5分钟内不处理
|
| | | if (!StringUtil.isNullOrEmpty(jedis.set(key, "1", new SetParams().nx().ex(300)))) {
|
| | | try {
|
| | | // TODO 用户活跃处理
|
| | | Long uid = Long.parseLong(uidStr);
|
| | |
| | | }
|
| | | }
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | | }
|
| | | });
|
| | |
| | |
|
| | | import redis.clients.jedis.Jedis;
|
| | | import redis.clients.jedis.JedisPool;
|
| | | import redis.clients.jedis.params.SetParams;
|
| | |
|
| | | @Component
|
| | | @Aspect
|
| | |
| | | // jiedis原子性做拦截
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | long threadId= Thread.currentThread().getId();
|
| | | LogHelper.test("进入拦截:"+cacheKey+"-"+threadId);
|
| | | try {
|
| | | Constant.waitingThreadSet.add(threadId);
|
| | | long result = 0;
|
| | | String result = null;
|
| | | long startTime = System.currentTimeMillis();
|
| | | // 等待响应
|
| | | while (result <= 0) {
|
| | | result = jedis.setnx(cacheKey, "1");
|
| | | LogHelper.error("触发并发锁:" + cacheAlias);
|
| | | LogHelper.error("redis键:" + cacheKey);
|
| | | if (result <= 0) {
|
| | | LogHelper.test("等待:"+threadId);
|
| | | while (StringUtil.isNullOrEmpty(result)) {
|
| | | |
| | | result = jedis.set(cacheKey, "1", new SetParams().nx().ex(30));
|
| | | if (StringUtil.isNullOrEmpty(result)) {
|
| | | try {
|
| | | Thread.sleep(50);
|
| | | } catch (InterruptedException e) {
|
| | |
| | | return null;
|
| | | }
|
| | | } else {
|
| | | // 设置30秒处理时间
|
| | | jedis.expire(cacheKey, 30);
|
| | | LogHelper.test("获取到锁:"+threadId);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | if (result > 0) {
|
| | | if (!StringUtil.isNullOrEmpty(result)) {
|
| | | try {
|
| | | return joinPoint.proceed();
|
| | | } catch (Throwable e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } finally {
|
| | | LogHelper.test("方法执行完毕:"+threadId);
|
| | | jedis.del(cacheKey);
|
| | | Constant.waitingThreadSet.remove(Thread.currentThread().getId());
|
| | | LogHelper.test("释放锁:"+threadId);
|
| | | }
|
| | | }
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {// 原子性保护出错
|
| | |
| | |
|
| | | import redis.clients.jedis.Jedis;
|
| | | import redis.clients.jedis.JedisPool;
|
| | | import redis.clients.jedis.params.SetParams;
|
| | |
|
| | | @Component
|
| | | @Aspect
|
| | |
| | | Jedis jedis = jedisPool.getResource();
|
| | | try {
|
| | | Constant.waitingThreadSet.add(Thread.currentThread().getId());
|
| | | long result = 0;
|
| | | String result = null;
|
| | | long startTime = System.currentTimeMillis();
|
| | | // 等待响应
|
| | | while (result <= 0) {
|
| | | result = jedis.setnx(cacheKey, "1");
|
| | | if (result <= 0) {
|
| | | while (StringUtil.isNullOrEmpty(result)) {
|
| | | result = jedis.set(cacheKey, "1", new SetParams().nx().ex(30));
|
| | | if (StringUtil.isNullOrEmpty(result)) {
|
| | | try {
|
| | | Thread.sleep(50);
|
| | | } catch (InterruptedException e) {
|
| | |
| | | Constant.waitingThreadSet.remove(Thread.currentThread().getId());
|
| | | return null;
|
| | | }
|
| | | } else {
|
| | | // 设置30秒处理时间
|
| | | jedis.expire(cacheKey, 30);
|
| | | }
|
| | | }
|
| | |
|
| | | if (result > 0) {
|
| | | if (!StringUtil.isNullOrEmpty(result)) {
|
| | | try {
|
| | | return joinPoint.proceed();
|
| | | } catch (Throwable e) {
|
| | |
| | | }
|
| | | }
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {// 原子性保护出错
|
| | |
| | | } finally {
|
| | | }
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | | }
|
| | | } catch (NoSuchMethodException e) {
|
| | |
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.util.shop.BanLiShopOrderUtil;
|
| | | import com.yeshi.fanli.util.wx.BanLiShopWXPayUtil;
|
| | |
| | | if (order != null) {// 支付成功消息推送
|
| | | BanLiShopOrderMQMsg msg = new BanLiShopOrderMQMsg(order.getId(), order.getUid(),
|
| | | new BigDecimal(map.get("total_fee")).multiply(new BigDecimal("0.01")));
|
| | | Message message = new Message(MQTopicName.TOPIC_ORDER.name(),
|
| | | OrderTopicTagEnum.banLiShopOrderPaid.name(), new Gson().toJson(msg).getBytes());
|
| | | Message message =MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER,
|
| | | OrderTopicTagEnum.banLiShopOrderPaid, msg);
|
| | | producer.send(message);
|
| | | Map<String, String> returnMap = new HashMap<>();
|
| | | returnMap.put("return_code", "SUCCESS");
|
| | |
| | | for (Iterator<String> its = sets.iterator(); its.hasNext();)
|
| | | array.add(its.next());
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | | out.println(array.toString());
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 6);
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(id, 6);
|
| | | if (goodsList == null)
|
| | | goodsList = new ArrayList<>();
|
| | |
|
| | |
| | |
|
| | | try {
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10);
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(id, 10);
|
| | | // 初始化
|
| | | if (goodsList == null) {
|
| | | goodsList = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
| | | }
|
| | | }
|
| | | title = title.replace("【邀请码】", inviteCode);
|
| | | title = title.replace("【邀请链接】", UserUtil.getInviteShortLink(uid));
|
| | | title = title.replace("【邀请链接】", Constant.YINGYONGBAO_LINK);
|
| | | data.put("title", title);
|
| | |
|
| | | } else { // 有图分享
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleExtraInfoSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.AESUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.GsonUtil;
|
| | |
| | | @Resource
|
| | | private UserRankService userRankService;
|
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | | private static final String PASSWORD_MAX_ERROR = "password_max_error";
|
| | | private static final String EXTRACT_MIN_MONEY = "extract_min_money";
|
| | |
| | | if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | userInfo.setWeiXinTip("添加微信号后,你的邀请人和一级队员可以通过微信与你建立联系。");
|
| | |
|
| | | // 查询是否为VIP
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | userInfo.setVip(userVIPInfoService.isVIP(uid));
|
| | | }
|
| | |
|
| | | data.put("user", JsonUtil.getConvertBigDecimalToStringBuilder(gsonBuilder).create().toJson(userInfo));
|
| | | data.put("invitCode", invitCode); // 邀请码
|
| | | if (userInfoExtra.getInviteCodeState() != null
|
| | | && userInfoExtra.getInviteCodeState() == UserInfoExtra.INVITE_CODE_SATTE_VALID_UPDATED)
|
| | | data.put("invitCodeUpdated", true);// 邀请码是否已经修改过
|
| | | else
|
| | | data.put("invitCodeUpdated", false);
|
| | | data.put("welfareCenterNews", welfareCenterNews);// 福利中心消息
|
| | | data.put("vipLink", configService.get("vip_link"));// 超级会员升级链接
|
| | |
|
| | | // 2.0.1之后绑定手机号
|
| | | if (VersionUtil.greaterThan_2_0_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | |
| | | // 2.0.2 版本
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | RedPackBalance redPackBalance = redPackBalanceService.selectByPrimaryKey(uid);
|
| | | if (redPackBalance != null && redPackBalance.getState() != null && |
| | | redPackBalance.getState() == RedPackBalance.STATE_LOCKED) {
|
| | | if (redPackBalance != null && redPackBalance.getState() != null
|
| | | && redPackBalance.getState() == RedPackBalance.STATE_LOCKED) {
|
| | | data.put("redPackLock", RedPackBalance.STATE_LOCKED);
|
| | | } else {
|
| | | data.put("redPackLock", RedPackBalance.STATE_INIT);
|
| | |
| | | */
|
| | | @RequestMapping(value = "saveInfo")
|
| | | public void saveInfo(AcceptData acceptData, String nickName, String weiXin, Integer sex, Long uid,
|
| | | PrintWriter out) {
|
| | | String inviteCode, PrintWriter out) {
|
| | | try {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | |
| | | userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.gender, sex + "");
|
| | | }
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(inviteCode)) {// 邀请码不为空
|
| | | inviteCode = inviteCode.trim();
|
| | | if (inviteCode.length() >= 6 && inviteCode.length() <= 12) {
|
| | |
|
| | | if (!userVIPInfoService.isVIP(uid)) {
|
| | | out.print(JsonUtil.loadFalseResult(20, "只有超级会员才能修改"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | userInfoExtraService.updateInviteCode(inviteCode, uid);
|
| | | out.print(JsonUtil.loadTrueResult("保存成功"));
|
| | | return;
|
| | | } catch (UserInfoExtraException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage()));
|
| | | }
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult(1, "邀请码必须为6到12位"));
|
| | | return;
|
| | | }
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (UserInfoException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("listAD", JsonUtil.getApiCommonGson().toJson(listVO));
|
| | | data.put("protocol", configService.get("user_protocol_home_data"));
|
| | |
|
| | | // 领券帮助链接,1.5.2后生效
|
| | | String couponHelp = configService.get("taobao_coupon_help");
|
| | |
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.cache.JDGoodsCacheUtil;
|
| | | import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil;
|
| | | import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
|
| | |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
|
| | | JSONObject params1 = new JSONObject();
|
| | | params1.put("url", configService.get("special_guide_reward_coupon_link"));
|
| | | rewardCoupon.setParams(params1.toString());
|
| | |
|
| | | rewardCoupon.setMaxMoney("¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate).add(MoneyBigDecimalUtil
|
| | | .mul(TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate), Constant.MAX_REWARD_RATE)));
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | rewardCoupon.setDesc("返");
|
| | | params1.put("url", configService.get("vip_link"));
|
| | | rewardCoupon.getJumpDetail().setNeedLogin(true);
|
| | | } else
|
| | | rewardCoupon.setDesc("用返利奖励券最高返");
|
| | | rewardCoupon.setParams(params1.toString());
|
| | | otherInfo.setRewardCoupon(rewardCoupon);
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | | }
|
| | |
| | | BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods, fanLiRate);
|
| | | otherInfo.setFanliMoneyPlus("京东plus会员返¥" + fanliMoneyPlus);
|
| | | // 使用奖励券最高返
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | maxMoneyPlus = "(京东plus返¥"
|
| | | + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE))
|
| | | + ")";
|
| | | } else
|
| | | maxMoneyPlus = "(京东plus会员最高返¥"
|
| | | + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE))
|
| | | + ")";
|
| | |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
|
| | | JSONObject params1 = new JSONObject();
|
| | | params1.put("url", configService.get("special_guide_reward_coupon_link"));
|
| | | rewardCoupon.setParams(params1.toString());
|
| | |
|
| | | rewardCoupon.setMaxMoney("¥" + JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate)
|
| | | .add(MoneyBigDecimalUtil.mul(JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate), Constant.MAX_REWARD_RATE)));
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | rewardCoupon.setDesc("返");
|
| | | params1.put("url", configService.get("vip_link"));
|
| | | rewardCoupon.getJumpDetail().setNeedLogin(true);
|
| | | } else {
|
| | | rewardCoupon.setDesc("用返利奖励券最高返");
|
| | | }
|
| | | rewardCoupon.setParams(params1.toString());
|
| | | otherInfo.setRewardCoupon(rewardCoupon);
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | |
|
| | |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
|
| | | JSONObject params1 = new JSONObject();
|
| | | params1.put("url", configService.get("special_guide_reward_coupon_link"));
|
| | | rewardCoupon.setParams(params1.toString());
|
| | |
|
| | | rewardCoupon.setMaxMoney("¥" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate).add(MoneyBigDecimalUtil
|
| | | .mul(PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate), Constant.MAX_REWARD_RATE)));
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | rewardCoupon.setDesc("返");
|
| | | params1.put("url", configService.get("vip_link"));
|
| | | rewardCoupon.getJumpDetail().setNeedLogin(true);
|
| | | } else
|
| | | rewardCoupon.setDesc("用返利奖励券最高返");
|
| | | rewardCoupon.setParams(params1.toString());
|
| | | otherInfo.setRewardCoupon(rewardCoupon);
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | |
|
| | |
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
|
| | | ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate,
|
| | | Constant.MAX_REWARD_RATE);
|
| | | for (PDDGoodsDetail goods : goodsList) {
|
| | | listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO));
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10);
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(id, 10);
|
| | | // 初始化
|
| | | if (goodsList == null) {
|
| | | goodsList = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
| | | }
|
| | |
|
| | | if (taoBaoGoodsBrief != null) {
|
| | | listExtra.add(
|
| | | GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO));
|
| | | listExtra.add(GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO));
|
| | | }
|
| | | }
|
| | | });
|
| | |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param id
|
| | | * @param couponUrl
|
| | | * -优惠券链接
|
| | | * @param source
|
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getJDLink")
|
| | | public void getJDLink(AcceptData acceptData, Long uid, Long id, String source, PrintWriter out) {
|
| | | public void getJDLink(AcceptData acceptData, Long uid, Long id, String couponUrl, String source, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户ID不能为空"));
|
| | | return;
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | String couponUrl = null;
|
| | | String jumpLink = null;
|
| | | String materialId = "https://item.jd.com/" + id + ".html";
|
| | | JDCouponInfo couponInfo = goods.getCouponInfo();
|
| | | if (StringUtil.isNullOrEmpty(couponUrl)) {
|
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods.getCouponInfoList(), goods.getPrice());
|
| | | if (couponInfo != null) {
|
| | | couponUrl = couponInfo.getLink();
|
| | | }
|
| | | String jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + "");
|
| | | jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + "");
|
| | | } else {
|
| | | jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + "");
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("native", true);
|
| | |
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleExtraInfoSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private ThreeSaleExtraInfoSerivce threeSaleExtraInfoSerivce;
|
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | | /**
|
| | | * 邀请码验证
|
| | |
| | |
|
| | | /**
|
| | | * 微信激活
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param key 验证返回的key
|
| | | * @param key
|
| | | * 验证返回的key
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key = "'activeInviteWX-'+#uid")
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 用户队员列表查询 1.5.3查询有效队员
|
| | | *
|
| | |
| | | count = threeSaleSerivce.countSecondTeam(uid, 1);
|
| | | }
|
| | |
|
| | | boolean needVIPInfo = false;
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | needVIPInfo = true;
|
| | |
|
| | | // 组织数据
|
| | | JSONObject resultData = organizeTeam(count, listTeam, uid, type);
|
| | | JSONObject resultData = organizeTeam(count, listTeam, uid, type,needVIPInfo);
|
| | |
|
| | | // 第一页判断是否激活 是否有队员
|
| | | if (type == 1 && page == 1) {
|
| | |
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | private JSONObject organizeTeam(long count, List<ThreeSale> list, Long uid, int type) {
|
| | | private JSONObject organizeTeam(long count, List<ThreeSale> list, Long uid, int type, boolean needVipInfo) {
|
| | | JSONObject result = new JSONObject();
|
| | | JSONArray resultArray = new JSONArray();
|
| | |
|
| | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | SimpleDateFormat formatYears = new SimpleDateFormat("yyyy");
|
| | |
|
| | | List<Long> workerIdList = new ArrayList<>();
|
| | | Map<Long, Boolean> vipMap = null;
|
| | | if (needVipInfo) {
|
| | | for (ThreeSale threeSale : list)
|
| | | workerIdList.add(threeSale.getWorker().getId());
|
| | | if (workerIdList.size() > 0)
|
| | | vipMap = userVIPInfoService.listByUids(workerIdList);
|
| | | }
|
| | | for (ThreeSale threeSale : list) {
|
| | | UserInfo worker = threeSale.getWorker();
|
| | | if (worker == null) {
|
| | |
| | |
|
| | | Date inviteTime = new Date(threeSale.getCreateTime());
|
| | | object.put("inviteTime", format.format(inviteTime) + " 加入");
|
| | | // 添加是否为VIP
|
| | | if (vipMap != null && vipMap.get(worker.getId()) != null)
|
| | | object.put("vip", vipMap.get(worker.getId()));
|
| | |
|
| | | String fontColor1 = "#888888";
|
| | | JSONArray array = new JSONArray();
|
| | |
| | | tb = TaoBaoUtil.isAlimama(id);
|
| | | if (tb == null) {
|
| | | type = 4;
|
| | | tb = TaoBaoUtil.getTmallGoodsInfo(id);
|
| | | tb = getTaoBaoGoodsBriefFromGoodsId(id);
|
| | | }
|
| | | } else if (text.contains("http://zmnxbc.com")) { // 手机端天猫APP分享
|
| | | tb = TaoBaoUtil.parsePhoneShareUrlByTM(text);
|
| | |
| | | tb = TaoBaoUtil.isAlimama(id);
|
| | | if (tb == null) {
|
| | | type = 4;
|
| | | tb = TaoBaoUtil.getTmallGoodsInfo(id);
|
| | | tb = getTaoBaoGoodsBriefFromGoodsId(id);
|
| | | }
|
| | | } else if (text.contains("v.douyin.com")) { // 抖音
|
| | | analysisDouYin(acceptData, text, out);
|
| | |
| | | if (tb == null) {
|
| | | String goodsId = TaoBaoUtil.getGoodsIdByPhoneShareUrl(text);
|
| | | if (!StringUtil.isNullOrEmpty(goodsId)) {
|
| | | tb = TaoBaoUtil.getTmallGoodsInfo(goodsId);
|
| | | tb = getTaoBaoGoodsBriefFromGoodsId(goodsId);
|
| | | if (tb != null)
|
| | | type = 4;
|
| | | }
|
| | |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | data.put("type", type);
|
| | | data.put("goods",
|
| | | gson.toJson(GoodsDetailVOFactory.convertCommonGoods(commonGoods, new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE))));
|
| | | data.put("goods", gson.toJson(GoodsDetailVOFactory.convertCommonGoods(commonGoods,
|
| | | new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE))));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
| | | root.put("type", 1);
|
| | | root.put("data", data);
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | |
|
| | | private TaoBaoGoodsBrief getTaoBaoGoodsBriefFromGoodsId(String goodsId) {
|
| | | TaoBaoGoodsBrief tb = TaoBaoUtil.getTmallGoodsInfo(goodsId);
|
| | | if (tb == null && NumberUtil.isNumeric(goodsId)) {// 是数字
|
| | | tb = TaoBaoUtil.getSimpleGoodsBrief(Long.parseLong(goodsId));
|
| | | if (tb != null) {
|
| | | tb.setPictUrl(TbImgUtil.getTBSize220Img(tb.getPictUrl()));
|
| | | }
|
| | | }
|
| | | return tb;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("type", 3);
|
| | | data.put("goods", gson
|
| | | .toJson(GoodsDetailVOFactory.convertTaoBao(goodsBrief, new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE))));
|
| | | data.put("goods", gson.toJson(GoodsDetailVOFactory.convertTaoBao(goodsBrief,
|
| | | new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE))));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return true;
|
| | | }
|
| | |
| | | // goodsId + "");
|
| | |
|
| | | String couponUrl = null;
|
| | | JDCouponInfo couponInfo = jdGoods.getCouponInfo();
|
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(jdGoods);
|
| | | if (couponInfo != null) {
|
| | | couponUrl = couponInfo.getLink();
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | String couponUrl = null;
|
| | | JDCouponInfo couponInfo = goods.getCouponInfo();
|
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods);
|
| | | if (couponInfo != null) {
|
| | | couponUrl = couponInfo.getLink();
|
| | | }
|
| | |
| | | boolean hasCoupon = false;
|
| | | String couponUrl = null;
|
| | | BigDecimal discount = new BigDecimal(0);
|
| | | JDCouponInfo couponInfo = jdGoods.getCouponInfo();
|
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo( jdGoods) ;
|
| | | if (couponInfo != null) {
|
| | | hasCoupon = true;
|
| | | discount = couponInfo.getDiscount();
|
| | |
| | | * @return |
| | | */ |
| | | long countShareOrInviteOrder(@Param("uid") Long uid); |
| | | |
| | | /** |
| | | * 统计下级产生有效分享奖金 |
| | | * @param uid |
| | | * @param teamUid 下级id |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | BigDecimal getShareRewardByTeamUid(@Param("uid") Long uid, @Param("teamUid") Long teamUid, @Param("endTime") Date endTime); |
| | | |
| | | /** |
| | | * 统计下级上个有效订单 |
| | | * @param uid |
| | | * @param teamUid 下级id |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | BigDecimal getShareRewardByTeamUidLastMonth(@Param("uid") Long uid, @Param("teamUid") Long teamUid); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.integral; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord; |
| | | |
| | | public interface UserGetIntegralFromOrderRecordMapper extends BaseMapper<UserGetIntegralFromOrderRecord> { |
| | | |
| | | /** |
| | | * 根据用户,事件类型,订单信息计数 |
| | | * |
| | | * @param eventType |
| | | * @param uid |
| | | * @param orderNo |
| | | * @param orderSourceType |
| | | * @return |
| | | */ |
| | | long countByRecordInfo(@Param("record") UserGetIntegralFromOrderRecord record); |
| | | |
| | | } |
| | |
| | | * @return
|
| | | */
|
| | | BigDecimal getTotalRewardMoneyByOrderNoAndSourceType(@Param("orderNo") String orderNo, @Param("sourceType") Integer sourceType);
|
| | | |
| | | /**
|
| | | * 统计24小时有效自购订单
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | long count24HValidOrderByUid(@Param("uid") Long uid, @Param("minTime") Date minTime);
|
| | | } |
| | |
| | | * @param type |
| | | * @return |
| | | */ |
| | | long countByUidAndTeamUidAndType(@Param("uid")Long uid,@Param("teamUid")Long teamUid, @Param("type")String type); |
| | | int countByUidAndTeamUidAndType(@Param("uid")Long uid,@Param("teamUid")Long teamUid, @Param("type")String type); |
| | | |
| | | /** |
| | | * 统计用户、下级、类型的数量 |
| | | * @param uid |
| | | * @param type |
| | | * @return |
| | | */ |
| | | RedPackWinInvite getByUidAndTeamUidAndType(@Param("uid")Long uid,@Param("teamUid")Long teamUid, @Param("type")String type); |
| | | |
| | | |
| | | /** |
| | | * 统计用户、下级、类型的数量 |
| | | * @param uid |
| | | * @param type |
| | | * @return |
| | | */ |
| | | RedPackWinInvite getByUidAndTeamUidAndTypeMonth(@Param("uid")Long uid,@Param("teamUid")Long teamUid, @Param("type")String type); |
| | | |
| | | /** |
| | | * 查询用户记录 |
| | |
| | | * @param days
|
| | | */
|
| | | void updateAutoExtract(@Param("days")Integer days);
|
| | | |
| | | |
| | | /**
|
| | | * 根据邀请码查询
|
| | | * @param inviteCode
|
| | | * @return
|
| | | */
|
| | | UserInfoExtra selectByInviteCode(String inviteCode);
|
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user.vip; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo; |
| | | |
| | | public interface UserVIPInfoMapper extends BaseMapper<UserVIPInfo> { |
| | | |
| | | |
| | | /** |
| | | * 主键查询(加锁) |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | UserVIPInfo selectByPrimaryKeyForUpdate(Long uid); |
| | | |
| | | /** |
| | | * 批量查询 |
| | | * @param uidList |
| | | * @return |
| | | */ |
| | | List<UserVIPInfo> listByUids(@Param("uidList") List<Long> uidList); |
| | | |
| | | } |
| | |
| | |
|
| | | public enum OrderTopicTagEnum {
|
| | | orderStatistic(OrderMQMsg.class), // 订单统计
|
| | | orderStatisticDelay(OrderMQMsg.class), // 订单统计延时
|
| | | orderUpdate(OrderMoneyRecievedMQMsg.class), // 订单修改
|
| | | orderFanLiActual(OrderMoneyRecievedMQMsg.class), // 订单实时到账
|
| | | orderFanLiDelay(OrderMoneyRecievedMQMsg.class), // 订单到账延时消息
|
| | | orderFanLiSeparateByOrderNo(OrderMoneyRecievedMQMsg.class),//订单实时到账,按订单号分离
|
| | | banLiShopOrderDelay(BanLiShopOrderMQMsg.class), // 板栗商城下单
|
| | | banLiShopOrderRefund(BanLiShopOrderMQMsg.class), // 板栗商城订单退款
|
| | | banLiShopOrderPaid(BanLiShopOrderMQMsg.class);// 商城订单支付成功
|
| | |
| | | package com.yeshi.fanli.dto.mq.order.body;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | |
|
| | | /**
|
| | |
| | | private Long uid;
|
| | | private int handleType; // 操作类型
|
| | | private boolean valid;
|
| | | private int delayHour;// 延时的时间(小时记)
|
| | | private Date staticticDate;// 统计到的时间
|
| | |
|
| | | public OrderMQMsg(String orderId, Integer type, Long uid, int handleType, boolean valid) {
|
| | | public OrderMQMsg(String orderId, Integer type, Long uid, int handleType, boolean valid, int delayHour,
|
| | | Date staticticDate) {
|
| | | super();
|
| | | this.orderId = orderId;
|
| | | this.type = type;
|
| | | this.uid = uid;
|
| | | this.handleType = handleType;
|
| | | this.valid = valid;
|
| | | this.delayHour = delayHour;
|
| | | this.staticticDate = staticticDate;
|
| | | }
|
| | |
|
| | | public Date getStaticticDate() {
|
| | | return staticticDate;
|
| | | }
|
| | |
|
| | | public void setStaticticDate(Date staticticDate) {
|
| | | this.staticticDate = staticticDate;
|
| | | }
|
| | |
|
| | | public int getDelayHour() {
|
| | | return delayHour;
|
| | | }
|
| | |
|
| | | public void setDelayHour(int delayHour) {
|
| | | this.delayHour = delayHour;
|
| | | }
|
| | |
|
| | | public OrderMQMsg() {
|
| | |
| | | private BigDecimal money;// 到账金额
|
| | | private Date date;// 到账时间
|
| | | private Boolean orderFirst;// 该订单是否是首次到账
|
| | | private int delayHour;// 延时的时间(以小时计算)
|
| | |
|
| | | public int getDelayHour() {
|
| | | return delayHour;
|
| | | }
|
| | |
|
| | | public void setDelayHour(int delayHour) {
|
| | | this.delayHour = delayHour;
|
| | | }
|
| | |
|
| | | public Boolean getOrderFirst() {
|
| | | return orderFirst;
|
| | |
| | | super();
|
| | | }
|
| | |
|
| | | public OrderMoneyRecievedMQMsg(int type, Long uid, Integer sourceType, String orderId, BigDecimal money,
|
| | | Date date) {
|
| | | public OrderMoneyRecievedMQMsg(int type, Long uid, Integer sourceType, String orderId, BigDecimal money, Date date,
|
| | | int delayHour) {
|
| | | super();
|
| | | this.type = type;
|
| | | this.uid = uid;
|
| | |
| | | this.orderId = orderId;
|
| | | this.money = money;
|
| | | this.date = date;
|
| | | this.delayHour = delayHour;
|
| | | }
|
| | |
|
| | | public int getType() {
|
New file |
| | |
| | | package com.yeshi.fanli.dto.msg;
|
| | |
|
| | | /**
|
| | | * 红包奖励-队友
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class MsgRedPackTeamRewardContentDTO {
|
| | | private String nickName; // 队友昵称
|
| | | private String portrait; // 队友头像
|
| | | |
| | | public String getNickName() {
|
| | | return nickName;
|
| | | }
|
| | | public void setNickName(String nickName) {
|
| | | this.nickName = nickName;
|
| | | }
|
| | | public String getPortrait() {
|
| | | return portrait;
|
| | | }
|
| | | public void setPortrait(String portrait) {
|
| | | this.portrait = portrait;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | @Table("yeshi_ec_msg_invite")
|
| | | public class MsgInviteDetail {
|
| | | public enum MsgTypeInviteTypeEnum {
|
| | | invite("邀请消息"), exchangeCode("恭喜你,邀请码兑换成功"), receiveGift("领取礼品"),inviteNew("邀请消息-新版");
|
| | | invite("邀请消息"), exchangeCode("恭喜你,邀请码兑换成功"), receiveGift("领取礼品"),inviteSucceed("邀请提醒");
|
| | | private final String desc;
|
| | |
|
| | | private MsgTypeInviteTypeEnum(String desc) {
|
| | |
| | | redPackGiveBack("红包退回"),
|
| | | redPackExchangePass("红包提现成功"),
|
| | | redPackExchangeReject("红包提现失败"),
|
| | | redPackNewUserReward("新人奖励-完成首笔订单"),
|
| | | redPackInviteSucceed("立得现金-成功邀请好友"),
|
| | | redPackFirstSharedOrder("递增奖励-好友完成订单"),
|
| | | redPackMonthSharedOrder("连续奖励-好友完成订单"),
|
| | | redPackOneStageReward("第一阶段-立得现金-成功邀请好友"),
|
| | | redPackTwoStageReward("第二阶段-递增奖励-好友完成订单"),
|
| | | redPackThreeStageReward("第三阶段-连续奖励-好友完成订单"),
|
| | | redPackUseSuccess("红包使用成功"),
|
| | | redPackUseFail("红包使用失败");
|
| | |
|
| | |
| | | @Transient
|
| | | private String taoBaoUid;// 淘宝的用户ID
|
| | |
|
| | | //是否为VIP
|
| | | @Transient
|
| | | @Expose
|
| | | private boolean vip;
|
| | | |
| | | |
| | | public boolean isVip() {
|
| | | return vip;
|
| | | }
|
| | |
|
| | | public void setVip(boolean vip) {
|
| | | this.vip = vip;
|
| | | }
|
| | |
|
| | | public String getTaoBaoUid() {
|
| | | return taoBaoUid;
|
| | | }
|
| | |
| | |
|
| | | /**
|
| | | * 用户附加信息
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_user_info_extra")
|
| | | public class UserInfoExtra {
|
| | |
|
| | | public static int INVITE_CODE_SATTE_VALID_NO_UPDATE = 1;// 正常-未修改过
|
| | | public static int INVITE_CODE_SATTE_VALID_UPDATED = 2;// 不正常-未修改过
|
| | |
|
| | | @Column(name = "uie_id")
|
| | | private Long id;
|
| | |
| | | @Column(name = "uie_active_time")
|
| | | private Date activeTime;
|
| | |
|
| | | // 邀请码状态
|
| | | @Column(name = "uie_invite_code_state")
|
| | | private Integer inviteCodeState;// 0-无效 1-未修改有效 2-修改有效
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "uie_create_time")
|
| | | private Date createTime;
|
| | |
| | | // 更新时间
|
| | | @Column(name = "uie_update_time")
|
| | | private Date updateTime;
|
| | | |
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | |
| | | this.goldCoin = goldCoin;
|
| | | }
|
| | |
|
| | |
|
| | | public Boolean getAutoExtract() {
|
| | | return autoExtract;
|
| | | }
|
| | |
| | | this.activeTime = activeTime;
|
| | | }
|
| | |
|
| | | public Integer getInviteCodeState() {
|
| | | return inviteCodeState;
|
| | | }
|
| | |
|
| | | public void setInviteCodeState(Integer inviteCodeState) {
|
| | | this.inviteCodeState = inviteCodeState;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user.vip;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 用户VIP
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_user_vip_info")
|
| | | public class UserVIPInfo {
|
| | | public final static int STATE_INVALID = 0;// 无效
|
| | | public final static int STATE_SUCCESS = 2;// 成功
|
| | | public final static int STATE_VERIFING = 1;// 正在审核
|
| | |
|
| | | @Column(name = "uvi_uid")
|
| | | private Long id;
|
| | | @Column(name = "uvi_state")
|
| | | private Integer state;
|
| | | @Column(name = "uvi_apply_time")
|
| | | private Date applyTime;
|
| | | @Column(name = "uvi_success_time")
|
| | | private Date successTime;
|
| | | @Column(name = "uvi_beizhu")
|
| | | private String beiZhu;
|
| | | @Column(name = "uvi_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "uvi_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public Date getApplyTime() {
|
| | | return applyTime;
|
| | | }
|
| | |
|
| | | public void setApplyTime(Date applyTime) {
|
| | | this.applyTime = applyTime;
|
| | | }
|
| | |
|
| | | public Date getSuccessTime() {
|
| | | return successTime;
|
| | | }
|
| | |
|
| | | public void setSuccessTime(Date successTime) {
|
| | | this.successTime = successTime;
|
| | | }
|
| | |
|
| | | public String getBeiZhu() {
|
| | | return beiZhu;
|
| | | }
|
| | |
|
| | | public void setBeiZhu(String beiZhu) {
|
| | | this.beiZhu = beiZhu;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | public enum TaskUniqueKeyEnum {
|
| | | dailySign1("第1天签到"), dailySign2("第2天签到"),dailySign3("第3天签到"),dailySign4("第4天签到"), dailySign5("第5天签到"),
|
| | | dailySign6("第6天签到"), dailySign7("第7天签到"), recommendSearch("完成搜索"), taoLiJinBuy("点击立减"),
|
| | | inviteLevelOne("直接邀请"),inviteLevelTwo("间接邀请"), buyReduce("自购立减"), shareSingleGoods("分享单个商品"), |
| | | shareMultipleGoods("分享多个商品"), shareInvite("邀请素材"), shareTLJGoods("爆款商品") , |
| | | giveRebateCoupon("返利奖励券"), giveFreeCoupon("赠送免单券"),giveTaoLiJin("赠送推广红包"),inShop("浏览店铺"),
|
| | | inShopLevelOne("一级队员浏览店铺"),inShopLevelTwo("二级队员浏览店铺"),scanPush("浏览推荐记录"),scanGoods("浏览商品详情页"),
|
| | | scanSearchResult("浏览搜索结果页"),scanHomeBanner("浏览横幅专题"),scanSpecial("浏览首页专题"),scanTBCart("浏览购物车页"),
|
| | | closeRecommendGoods("关闭推荐商品"),couponRebate("点击领券返利"),couponRebateLevelOne("浏览购物车页"),couponRebateLevelTwo("浏览购物车页"),
|
| | | rebateOrder("完成返利订单"),inviteOrderLevelOne("一级队员邀请订单"),inviteOrderLevelTwo("二级队员邀请订单"),shareOrder("分享订单"),
|
| | | bindWeiXin("微信授权"),bindPhone("绑定手机"),bindTaoBao("淘宝授权"), setWeiXinNum("添加微信号"),setGender("首次设置性别"),
|
| | | setPortrait("首次修改头像"), setNickName("修改昵称"),bindAlipay("绑定支付宝"),inviteActivate("激活邀请");
|
| | | dailySign1("第1天签到"),
|
| | | dailySign2("第2天签到"),
|
| | | dailySign3("第3天签到"),
|
| | | dailySign4("第4天签到"),
|
| | | dailySign5("第5天签到"),
|
| | | dailySign6("第6天签到"),
|
| | | dailySign7("第7天签到"),
|
| | | recommendSearch("完成搜索"),
|
| | | taoLiJinBuy("点击立减"),
|
| | | inviteLevelOne("直接邀请"),
|
| | | inviteLevelTwo("间接邀请"),
|
| | | buyReduce("自购立减"),
|
| | | shareSingleGoods("分享单个商品"),
|
| | | shareMultipleGoods("分享多个商品"),
|
| | | shareInvite("邀请素材"),
|
| | | shareTLJGoods("爆款商品"),
|
| | | giveRebateCoupon("返利奖励券"),
|
| | | giveFreeCoupon("赠送免单券"),
|
| | | giveTaoLiJin("赠送推广红包"),
|
| | | inShop("浏览店铺"),
|
| | | inShopLevelOne("一级队员浏览店铺"),
|
| | | inShopLevelTwo("二级队员浏览店铺"),
|
| | | scanPush("浏览推荐记录"),
|
| | | scanGoods("浏览商品详情页"),
|
| | | scanSearchResult("浏览搜索结果页"),
|
| | | scanHomeBanner("浏览横幅专题"),
|
| | | scanSpecial("浏览首页专题"),
|
| | | scanTBCart("浏览购物车页"),
|
| | | closeRecommendGoods("关闭推荐商品"),
|
| | | couponRebate("点击领券返利"),
|
| | | couponRebateLevelOne("浏览购物车页"),
|
| | | couponRebateLevelTwo("浏览购物车页"),
|
| | | rebateOrder("完成返利订单"),
|
| | | inviteOrderLevelOne("一级队员邀请订单"),
|
| | | inviteOrderLevelTwo("二级队员邀请订单"),
|
| | | shareOrder("分享订单"),
|
| | | bindWeiXin("微信授权"),
|
| | | bindPhone("绑定手机"),
|
| | | bindTaoBao("淘宝授权"),
|
| | | setWeiXinNum("添加微信号"),
|
| | | setGender("首次设置性别"),
|
| | | setPortrait("首次修改头像"),
|
| | | setNickName("修改昵称"),
|
| | | bindAlipay("绑定支付宝"),
|
| | | inviteActivate("激活邀请");
|
| | |
|
| | | private final String desc;
|
| | |
|
| | |
| | | return desc;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | @Column(name = "it_id")
|
| | | private Long id;
|
New file |
| | |
| | | package com.yeshi.fanli.entity.integral;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 用户因为订单获取到金币
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_integral_get_from_order")
|
| | | public class UserGetIntegralFromOrderRecord {
|
| | | public static int TYPE_PLACE_ORDER = 1;// 下单
|
| | | public static int TYPE_RECIEVE_MONEY = 2;// 到账
|
| | |
|
| | | @Column(name = "fo_id")
|
| | | private Long id;
|
| | | @Column(name = "fo_event_type")
|
| | | private Integer eventType;// 事件类型
|
| | | @Column(name = "fo_uid")
|
| | | private Long uid;// 用户ID
|
| | | @Column(name = "fo_order_no")
|
| | | private String orderNo;// 订单号
|
| | | @Column(name = "fo_order_source_type")
|
| | | private Integer orderSourceType;// 订单来源类型
|
| | | @Column(name = "fo_integral_count")
|
| | | private Integer integralCount;// 金币数量
|
| | | @Column(name = "fo_create_time")
|
| | | private Date createTime;// 创建时间
|
| | | @Column(name = "fo_update_time")
|
| | | private Date updateTime;// 更新时间
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Integer getEventType() {
|
| | | return eventType;
|
| | | }
|
| | |
|
| | | public void setEventType(Integer eventType) {
|
| | | this.eventType = eventType;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public String getOrderNo() {
|
| | | return orderNo;
|
| | | }
|
| | |
|
| | | public void setOrderNo(String orderNo) {
|
| | | this.orderNo = orderNo;
|
| | | }
|
| | |
|
| | | public Integer getOrderSourceType() {
|
| | | return orderSourceType;
|
| | | }
|
| | |
|
| | | public void setOrderSourceType(Integer orderSourceType) {
|
| | | this.orderSourceType = orderSourceType;
|
| | | }
|
| | |
|
| | | public Integer getIntegralCount() {
|
| | | return integralCount;
|
| | | }
|
| | |
|
| | | public void setIntegralCount(Integer integralCount) {
|
| | | this.integralCount = integralCount;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | | }
|
| | |
| | | private JDCategoryInfo categoryInfo;// 类目信息
|
| | | private Long comments;// 评论数
|
| | | private JDCommissionInfo commissionInfo;// 佣金信息
|
| | | private JDCouponInfo couponInfo;// 优惠券信息,返回内容为空说明该SKU无可用优惠券
|
| | | private List<JDCouponInfo> couponInfoList;// 优惠券信息,返回内容为空说明该SKU无可用优惠券
|
| | | private BigDecimal goodCommentsShare;// 商品好评率
|
| | | private List<String> imageList;// 图片信息
|
| | | private Long inOrderCount30Days;// 30天引单数量
|
| | |
| | | this.commissionInfo = commissionInfo;
|
| | | }
|
| | |
|
| | | public JDCouponInfo getCouponInfo() {
|
| | | return couponInfo;
|
| | | public List<JDCouponInfo> getCouponInfoList() {
|
| | | return couponInfoList;
|
| | | }
|
| | |
|
| | | public void setCouponInfo(JDCouponInfo couponInfo) {
|
| | | this.couponInfo = couponInfo;
|
| | | public void setCouponInfoList(List<JDCouponInfo> couponInfoList) {
|
| | | this.couponInfoList = couponInfoList;
|
| | | }
|
| | |
|
| | | public BigDecimal getGoodCommentsShare() {
|
| | |
| | | public class RedPackWinInvite {
|
| | | public enum RedPackWinInviteTypeEnum {
|
| | | newUserReward("首次使用板栗快省新人奖励"),
|
| | | inviteSucceed("成功邀请好友立得现金"), |
| | | firstSharedOrder("完成分享订单递增奖励"), |
| | | monthSharedOrder("完成分享订单连续奖励");
|
| | | oneStageReward("成功邀请好友立得现金"), |
| | | twoStageReward("完成分享订单递增奖励"), |
| | | threeStageReward("完成分享订单连续奖励");
|
| | |
|
| | | private final String desc;
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.exception.integral;
|
| | |
|
| | | import com.yeshi.fanli.exception.BaseException;
|
| | |
|
| | | public class UserGetIntegralFromOrderRecordException extends BaseException {
|
| | | |
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | public UserGetIntegralFromOrderRecordException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public UserGetIntegralFromOrderRecordException() {
|
| | | super();
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.user.vip;
|
| | |
|
| | | import com.yeshi.fanli.exception.BaseException;
|
| | |
|
| | | /**
|
| | | * 用户VIP信息异常
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class UserVIPInfoException extends BaseException {
|
| | |
|
| | |
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | public UserVIPInfoException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public UserVIPInfoException() {
|
| | | super();
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.job.order.elme;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.elme.ElmeOrder;
|
| | | import com.yeshi.fanli.exception.elme.ElmeOrderException;
|
| | | import com.yeshi.fanli.service.inter.elme.ElmeOrderProcessService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.elme.ElmeOrderUtil;
|
| | |
|
| | | //饿了么爬单,到账
|
| | | @Component
|
| | | public class UpdateElmeOrderJob {
|
| | |
|
| | | @Resource
|
| | | private ElmeOrderProcessService elmeOrderProcessService;
|
| | |
|
| | | @Resource
|
| | | private OrderProcessService orderProcessService;
|
| | |
|
| | | /**
|
| | | * 更新订单(每天早上凌晨0点,下午4点)
|
| | | */
|
| | | @Scheduled(cron = "0 0 0,16 * * ? ")
|
| | | public void updateOrder() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | try {
|
| | | List<ElmeOrder> orderList = ElmeOrderUtil.pullLatest5DayOrder();
|
| | | try {
|
| | | for (ElmeOrder order : orderList)
|
| | | elmeOrderProcessService.processOrder(order);
|
| | | } catch (ElmeOrderException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | // 每天凌晨过2分到账
|
| | | @Scheduled(cron = "0 2 0 * * ? ")
|
| | | public void fanli() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | List<HongBaoV2> hongBaoList = orderProcessService.getCanBalanceElmeFanliHongBao();
|
| | | for (HongBaoV2 v2 : hongBaoList)
|
| | | orderProcessService.elmeFanli(v2.getId());
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | public static void mqInfo(String extraInfo,String msgId, String topic, String tag, Object data) {
|
| | | String info = extraInfo+"\nmsgId"+msgId + "\ntopic:" + topic + "\ntag:" + tag + "\nbody:" + data;
|
| | | String info = extraInfo+"\nmsgId:"+msgId + "\ntopic:" + topic + "\ntag:" + tag + "\nbody:" + data;
|
| | | mqLogger.info(info);
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.manager.util;
|
| | |
|
| | | public interface AtomMethodCallInterface {
|
| | | public void excute();
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.manager.util;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import redis.clients.jedis.Jedis;
|
| | | import redis.clients.jedis.JedisPool;
|
| | | import redis.clients.jedis.params.SetParams;
|
| | |
|
| | | @Component
|
| | | public class AtomMethodCallManager {
|
| | |
|
| | | @Resource
|
| | | private JedisPool jedisPool;
|
| | |
|
| | | /**
|
| | | * 事件执行
|
| | | * |
| | | * @param key
|
| | | * 事件唯一标识,要与具体的业务逻辑相结合
|
| | | * @param call
|
| | | */
|
| | | public void excute(String key, AtomMethodCallInterface call) {
|
| | | String redisKey = "atom-" + StringUtil.Md5(key);
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | try {
|
| | | if (StringUtil.isNullOrEmpty(jedis.set(redisKey, "1", new SetParams().nx().ex(60)))) {
|
| | | System.out.println("请稍后再试");
|
| | | return;
|
| | | }
|
| | | call.excute();
|
| | | } finally {
|
| | | jedis.del(redisKey);
|
| | | jedis.close();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | AND (`hb_type` =5 OR `hb_type` =6 OR `hb_type` =7 OR `hb_type` =20 OR `hb_type`=21 OR `hb_type` =22 ) |
| | | </select> |
| | | |
| | | <select id="getShareRewardByTeamUid" resultType="BigDecimal"> |
| | | SELECT SUM(v2.`hb_money`) FROM yeshi_ec_hongbao_v2 v2 |
| | | LEFT JOIN yeshi_ec_hongbao_v2 p ON p.`hb_id` = v2.`hb_pid` |
| | | WHERE v2.`hb_type` = 21 AND v2.`hb_state` = 3 |
| | | AND v2.`hb_uid` = #{uid} AND p.`hb_uid` = #{teamUid} |
| | | AND v2.`hb_create_time`<![CDATA[<=]]> #{endTime} |
| | | </select> |
| | | |
| | | <select id="getShareRewardByTeamUidLastMonth" resultType="BigDecimal"> |
| | | SELECT SUM(v2.`hb_money`) FROM yeshi_ec_hongbao_v2 v2 |
| | | LEFT JOIN yeshi_ec_hongbao_v2 p ON p.`hb_id` = v2.`hb_pid` |
| | | WHERE v2.`hb_type` = 21 AND v2.`hb_state` = 3 |
| | | AND v2.`hb_uid` = #{uid} AND p.`hb_uid` = #{teamUid} |
| | | AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v2.`hb_create_time`, '%Y%m')) = 1 |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper |
| | | namespace="com.yeshi.fanli.dao.mybatis.integral.UserGetIntegralFromOrderRecordMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord"> |
| | | <id column="fo_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="fo_event_type" property="eventType" jdbcType="INTEGER" /> |
| | | <result column="fo_uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="fo_order_no" property="orderNo" jdbcType="VARCHAR" /> |
| | | <result column="fo_order_source_type" property="orderSourceType" |
| | | jdbcType="INTEGER" /> |
| | | <result column="fo_integral_count" property="integralCount" |
| | | jdbcType="INTEGER" /> |
| | | <result column="fo_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="fo_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">fo_id,fo_event_type,fo_uid,fo_order_no,fo_order_source_type,fo_integral_count,fo_create_time,fo_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_integral_get_from_order where fo_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_integral_get_from_order where fo_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" |
| | | parameterType="com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_integral_get_from_order |
| | | (fo_id,fo_event_type,fo_uid,fo_order_no,fo_order_source_type,fo_integral_count,fo_create_time,fo_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{eventType,jdbcType=INTEGER},#{uid,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{orderSourceType,jdbcType=INTEGER},#{integralCount,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_integral_get_from_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">fo_id,</if> |
| | | <if test="eventType != null">fo_event_type,</if> |
| | | <if test="uid != null">fo_uid,</if> |
| | | <if test="orderNo != null">fo_order_no,</if> |
| | | <if test="orderSourceType != null">fo_order_source_type,</if> |
| | | <if test="integralCount != null">fo_integral_count,</if> |
| | | <if test="createTime != null">fo_create_time,</if> |
| | | <if test="updateTime != null">fo_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="eventType != null">#{eventType,jdbcType=INTEGER},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="orderSourceType != null">#{orderSourceType,jdbcType=INTEGER},</if> |
| | | <if test="integralCount != null">#{integralCount,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord">update yeshi_ec_integral_get_from_order set |
| | | fo_event_type = #{eventType,jdbcType=INTEGER},fo_uid = |
| | | #{uid,jdbcType=BIGINT},fo_order_no = |
| | | #{orderNo,jdbcType=VARCHAR},fo_order_source_type = |
| | | #{orderSourceType,jdbcType=INTEGER},fo_integral_count = |
| | | #{integralCount,jdbcType=INTEGER},fo_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},fo_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where fo_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" |
| | | parameterType="com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord"> |
| | | update yeshi_ec_integral_get_from_order |
| | | <set> |
| | | <if test="eventType != null">fo_event_type=#{eventType,jdbcType=INTEGER},</if> |
| | | <if test="uid != null">fo_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="orderNo != null">fo_order_no=#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="orderSourceType != null">fo_order_source_type=#{orderSourceType,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="integralCount != null">fo_integral_count=#{integralCount,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">fo_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">fo_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where fo_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | |
| | | |
| | | <select id="countByRecordInfo" resultType="java.lang.Long" useCache="false" flushCache="true"> |
| | | select |
| | | count(*) |
| | | from yeshi_ec_integral_get_from_order where 1=1 |
| | | |
| | | <if test="record!=null"> |
| | | <if test="record.eventType!=null"> |
| | | and fo_event_type=#{record.eventType} |
| | | </if> |
| | | |
| | | <if test="record.uid!=null"> |
| | | and fo_uid=#{record.uid} |
| | | </if> |
| | | |
| | | <if test="record.orderNo!=null"> |
| | | and fo_order_no=#{record.orderNo} |
| | | </if> |
| | | |
| | | <if test="record.orderSourceType!=null"> |
| | | and fo_order_source_type=#{record.orderSourceType} |
| | | </if> |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | |
|
| | | <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" />
|
| | | <result column="co_state_desc" property="stateDesc" jdbcType="VARCHAR" />
|
| | | |
| | | <result column="co_uid" property="userId" jdbcType="VARCHAR" />
|
| | | |
| | | <association property="userInfo" column="co_uid"
|
| | | resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" />
|
| | |
|
| | |
| | | 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
|
| | | 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 ]]>
|
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE" />
|
| | |
| | | AND co.`co_order_no` = #{orderNo} AND co.`co_source_type`= #{sourceType})A
|
| | | </select>
|
| | |
|
| | | <select id="count24HValidOrderByUid" resultType="Long">
|
| | | SELECT IFNULL(COUNT(A.co_order_no),0) FROM (SELECT co.`co_order_no` FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.hb_id = ho.`ho_hongbao_id`
|
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE v2.`hb_type` = 1 AND co.`co_state_whole_order`<![CDATA[<>]]> 3 AND co.`co_uid` = #{uid}
|
| | | AND co.co_third_create_time <![CDATA[>]]> #{minTime} |
| | | AND co.`co_third_create_time` <![CDATA[<=]]> DATE_SUB(NOW(), INTERVAL 1 DAY)
|
| | | GROUP BY co.`co_order_no`,co.`co_source_type`)A
|
| | | </select>
|
| | |
|
| | | </mapper>
|
| | |
| | | WHERE d.`rwr_uid` = #{uid} AND d.`rwr_type` = #{type} |
| | | </select> |
| | | |
| | | <select id="countByUidAndTeamUidAndType" resultType="Long"> |
| | | <select id="countByUidAndTeamUidAndType" resultType="Integer"> |
| | | SELECT IFNULL(COUNT(d.`rwr_id`),0) FROM yeshi_ec_red_pack_win_invite d |
| | | WHERE d.`rwr_uid` = #{uid} AND d.`rwr_team_uid` = #{teamUid} AND d.`rwr_type` = #{type} |
| | | </select> |
| | | |
| | | <select id="getByUidAndTeamUidAndType" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_red_pack_win_invite d |
| | | WHERE d.`rwr_uid` = #{uid} AND d.`rwr_team_uid` = #{teamUid} AND d.`rwr_type` = #{type} |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | <select id="getByUidAndTeamUidAndTypeMonth" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_red_pack_win_invite d |
| | | WHERE d.`rwr_uid` = #{uid} AND d.`rwr_team_uid` = #{teamUid} AND d.`rwr_type` = #{type} |
| | | AND DATE_FORMAT(d.rwr_create_time,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | <select id="getRewardList" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_red_pack_win_invite d |
| | | WHERE d.`rwr_uid` = #{uid} |
| | |
| | | <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER" />
|
| | | <result column="uie_auto_extract" property="autoExtract"
|
| | | jdbcType="BOOLEAN" />
|
| | | <result column="uie_close_time_extract" property="closeTimeExtract" jdbcType="TIMESTAMP" />
|
| | | <result column="uie_active_time" property="activeTime" jdbcType="TIMESTAMP" />
|
| | | <result column="uie_close_time_extract" property="closeTimeExtract" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="uie_active_time" property="activeTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="uie_mark" property="mark" jdbcType="VARCHAR" />
|
| | | <result column="uie_invite_code_state" property="inviteCodeState" |
| | | jdbcType="INTEGER" /> |
| | | <association property="userInfo" column="uie_uid"
|
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
|
| | | <id column="uie_uid" property="id" jdbcType="BIGINT" />
|
| | | </association>
|
| | |
|
| | | <association property="userRank" column="uie_rank_id"
|
| | | javaType="com.yeshi.fanli.entity.bus.user.UserRank" select="com.yeshi.fanli.dao.mybatis.user.UserRankMapper.selectByPrimaryKey">
|
| | | </association>
|
| | | </resultMap>
|
| | | javaType="com.yeshi.fanli.entity.bus.user.UserRank" |
| | | select="com.yeshi.fanli.dao.mybatis.user.UserRankMapper.selectByPrimaryKey" /> |
| | |
|
| | | </resultMap> |
| | | <resultMap id="VOResultMap" type="com.yeshi.fanli.vo.user.UserInfoExtraVO">
|
| | | <id column="uie_id" property="id" jdbcType="BIGINT" />
|
| | | <result column="uie_rank_source" property="rankSource"
|
| | |
| | | <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER" />
|
| | | <result column="uie_auto_extract" property="autoExtract"
|
| | | jdbcType="BOOLEAN" />
|
| | | |
| | | <result column="uie_close_time_extract" property="closeTimeExtract" jdbcType="TIMESTAMP" />
|
| | | <result column="uie_active_time" property="activeTime" jdbcType="TIMESTAMP" />
|
| | | <result column="uie_close_time_extract" property="closeTimeExtract" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="uie_active_time" property="activeTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="uie_mark" property="mark" jdbcType="VARCHAR" />
|
| | | <result column="uie_invite_code_state" property="inviteCodeState" |
| | | jdbcType="INTEGER" /> |
| | | <association property="userInfo" column="uie_uid"
|
| | | resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" />
|
| | |
|
| | | <association property="userRank" column="uie_rank_id"
|
| | | resultMap="com.yeshi.fanli.dao.mybatis.user.UserRankMapper.BaseResultMap" />
|
| | |
|
| | | </resultMap>
|
| | |
|
| | | <resultMap id="AllResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfoExtra">
|
| | | <id column="uie_id" property="id" jdbcType="BIGINT" />
|
| | | <result column="uie_rank_source" property="rankSource"
|
| | |
| | | <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER" />
|
| | | <result column="uie_auto_extract" property="autoExtract"
|
| | | jdbcType="BOOLEAN" />
|
| | | |
| | | <result column="uie_close_time_extract" property="closeTimeExtract" jdbcType="TIMESTAMP" />
|
| | | <result column="uie_active_time" property="activeTime" jdbcType="TIMESTAMP" />
|
| | | <result column="uie_close_time_extract" property="closeTimeExtract" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="uie_active_time" property="activeTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="uie_mark" property="mark" jdbcType="VARCHAR" />
|
| | | |
| | | <result column="uie_invite_code_state" property="inviteCodeState" |
| | | jdbcType="INTEGER" /> |
| | | <association property="userInfo" column="uie_uid"
|
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
|
| | | <id column="uie_uid" property="id" jdbcType="BIGINT" />
|
| | | </association>
|
| | |
|
| | | <association property="userRank" column="uie_rank_id"
|
| | | resultMap="com.yeshi.fanli.dao.mybatis.user.UserRankMapper.BaseResultMap" />
|
| | | </resultMap>
|
| | |
|
| | |
|
| | |
|
| | | <sql id="Base_Column_List">uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time,uie_auto_extract,uie_close_time_extract,uie_active_time,uie_mark
|
| | | <sql id="Base_Column_List">uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time,uie_auto_extract,uie_close_time_extract,uie_active_time,uie_mark,uie_invite_code_state |
| | | </sql>
|
| | |
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | |
| | | from yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | |
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT}</delete>
|
| | | <select id="selectByInviteCode" resultMap="BaseResultMap" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_info_extra where uie_invite_code = #{0} limit 1 |
| | | </select> |
| | |
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into
|
| | | yeshi_ec_user_info_extra
|
| | | (uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time,uie_auto_extract,uie_close_time_extract,uie_active_time,uie_mark)
|
| | | (uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time,uie_auto_extract,uie_close_time_extract,uie_active_time,uie_mark,uie_invite_code_state) |
| | | values
|
| | | (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{inviteCode,jdbcType=VARCHAR},#{lotteryNewbies,jdbcType=INTEGER},#{couponNews,jdbcType=INTEGER},#{synchNavbar,jdbcType=VARCHAR},#{firstLoginTime,jdbcType=TIMESTAMP},#{sex,jdbcType=INTEGER},#{weiXin,jdbcType=VARCHAR},#{goldCoin,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{autoExtract,jdbcType=BOOLEAN},#{closeTimeExtract,jdbcType=TIMESTAMP},#{activeTime,jdbcType=TIMESTAMP},#{mark,jdbcType=VARCHAR})
|
| | | (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{inviteCode,jdbcType=VARCHAR},#{lotteryNewbies,jdbcType=INTEGER},#{couponNews,jdbcType=INTEGER},#{synchNavbar,jdbcType=VARCHAR},#{firstLoginTime,jdbcType=TIMESTAMP},#{sex,jdbcType=INTEGER},#{weiXin,jdbcType=VARCHAR},#{goldCoin,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{autoExtract,jdbcType=BOOLEAN},#{closeTimeExtract,jdbcType=TIMESTAMP},#{activeTime,jdbcType=TIMESTAMP},#{mark,jdbcType=VARCHAR},#{inviteCodeState,jdbcType=INTEGER}) |
| | | </insert>
|
| | |
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | | insert into yeshi_ec_user_info_extra
|
| | |
| | | <if test="closeTimeExtract != null">uie_close_time_extract,</if>
|
| | | <if test="activeTime != null">uie_active_time,</if>
|
| | | <if test="mark != null">uie_mark,</if>
|
| | | <if test="inviteCodeState != null">uie_invite_code_state,</if> |
| | | </trim>
|
| | | values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | |
| | | <if test="closeTimeExtract != null">#{closeTimeExtract,jdbcType=TIMESTAMP},</if>
|
| | | <if test="activeTime != null">#{activeTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="mark != null">#{mark,jdbcType=VARCHAR},</if>
|
| | | <if test="inviteCodeState != null">#{inviteCodeState,jdbcType=INTEGER}</if> |
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update
|
| | |
| | | #{updateTime,jdbcType=TIMESTAMP},uie_auto_extract =
|
| | | #{autoExtract,jdbcType=BOOLEAN},uie_close_time_extract =
|
| | | #{closeTimeExtract,jdbcType=TIMESTAMP},uie_active_time =
|
| | | #{activeTime,jdbcType=TIMESTAMP},uie_mark =
|
| | | #{mark,jdbcType=VARCHAR} where uie_id = #{id,jdbcType=BIGINT}
|
| | | #{activeTime,jdbcType=TIMESTAMP},uie_mark = #{mark,jdbcType=VARCHAR} |
| | | ,uie_invite_code_state =#{inviteCodeState,jdbcType=INTEGER} where |
| | | uie_id = #{id,jdbcType=BIGINT} |
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">
|
| | | update yeshi_ec_user_info_extra
|
| | |
| | | </if>
|
| | | <if test="couponNews != null">uie_coupon_news=#{couponNews,jdbcType=INTEGER},</if>
|
| | | <if test="synchNavbar != null">uie_synch_navbar=#{synchNavbar,jdbcType=VARCHAR},</if>
|
| | | <if test="firstLoginTime != null">uie_first_login_time=#{firstLoginTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="firstLoginTime != null">uie_first_login_time=#{firstLoginTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="sex != null">uie_sex=#{sex,jdbcType=INTEGER},</if>
|
| | | <if test="weiXin != null">uie_weixin=#{weiXin,jdbcType=VARCHAR},</if>
|
| | | <if test="goldCoin != null">uie_gold_coin=#{goldCoin,jdbcType=INTEGER},</if>
|
| | | <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="autoExtract != null">uie_auto_extract=#{autoExtract,jdbcType=BOOLEAN},</if>
|
| | | <if test="closeTimeExtract != null">uie_close_time_extract=#{closeTimeExtract,jdbcType=TIMESTAMP},</if>
|
| | | <if test="closeTimeExtract != null">uie_close_time_extract=#{closeTimeExtract,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="activeTime != null">uie_active_time=#{activeTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="mark != null">uie_mark=#{mark,jdbcType=VARCHAR},</if>
|
| | | <if test="inviteCodeState !=null">uie_invite_code_state=#{inviteCodeState,jdbcType=INTEGER}, |
| | | </if> |
| | | </set>
|
| | | where uie_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | |
| | | <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="autoExtract != null">uie_auto_extract=#{autoExtract,jdbcType=BOOLEAN},</if>
|
| | | <if test="closeTimeExtract != null">uie_close_time_extract=#{closeTimeExtract,jdbcType=TIMESTAMP},</if>
|
| | | <if test="closeTimeExtract != null">uie_close_time_extract=#{closeTimeExtract,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="activeTime != null">uie_active_time=#{activeTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="mark != null">uie_mark=#{mark,jdbcType=VARCHAR},</if>
|
| | | </set>
|
| | | where uie_uid = #{userInfo.id,jdbcType=BIGINT}
|
| | | </update>
|
| | |
|
| | | <update id="updateGoldCoin">
|
| | | UPDATE yeshi_ec_user_info_extra |
| | | SET uie_gold_coin = IF(uie_gold_coin IS NULL,${goldCoin}, uie_gold_coin + ${goldCoin}) |
| | | <update id="updateGoldCoin">UPDATE yeshi_ec_user_info_extra SET uie_gold_coin = |
| | | IF(uie_gold_coin IS NULL,${goldCoin}, uie_gold_coin + ${goldCoin}) |
| | | WHERE uie_id = #{id}
|
| | | </update>
|
| | |
|
| | | <select id="getInfoExtraByUid" resultMap="BaseResultMap">
|
| | | SELECT * FROM
|
| | | yeshi_ec_user_info_extra
|
| | | WHERE uie_uid = #{uid}
|
| | | <select id="getInfoExtraByUid" resultMap="BaseResultMap">SELECT * FROM |
| | | yeshi_ec_user_info_extra WHERE uie_uid = #{uid} |
| | | </select>
|
| | |
|
| | | <select id="getByUidForUpdate" resultMap="BaseResultMap">
|
| | | SELECT * FROM
|
| | | yeshi_ec_user_info_extra
|
| | | WHERE uie_uid = #{uid} FOR UPDATE
|
| | | <select id="getByUidForUpdate" resultMap="BaseResultMap">SELECT * FROM |
| | | yeshi_ec_user_info_extra WHERE uie_uid = #{uid} FOR UPDATE |
| | | </select>
|
| | |
|
| | | <select id="getInfoExtraVOByUid" resultMap="VOResultMap">
|
| | | SELECT
|
| | | u.`id`,u.`nick_name`,u.`portrait`,ue.*,rk.*
|
| | | FROM
|
| | | yeshi_ec_user_info_extra ue
|
| | | LEFT JOIN yeshi_ec_user u ON ue.`uie_uid` =
|
| | | u.`id`
|
| | | LEFT JOIN yeshi_ec_user_rank rk ON rk.`ur_id` = ue.`uie_rank_id`
|
| | | WHERE u.id
|
| | | = #{uid}
|
| | | <select id="getInfoExtraVOByUid" resultMap="VOResultMap">SELECT |
| | | u.`id`,u.`nick_name`,u.`portrait`,ue.*,rk.* FROM |
| | | yeshi_ec_user_info_extra ue LEFT JOIN yeshi_ec_user u ON ue.`uie_uid` |
| | | = u.`id` LEFT JOIN yeshi_ec_user_rank rk ON rk.`ur_id` = |
| | | ue.`uie_rank_id` WHERE u.id = #{uid} |
| | | </select>
|
| | |
|
| | | <select id="countByRankId" parameterType="java.lang.Long"
|
| | | resultType="java.lang.Long">
|
| | | SELECT IFNULL(COUNT(t.`uie_id`),0) FROM
|
| | | `yeshi_ec_user_info_extra` t
|
| | | WHERE t.`uie_rank_id` = #{rankId}
|
| | | resultType="java.lang.Long">SELECT IFNULL(COUNT(t.`uie_id`),0) FROM |
| | | `yeshi_ec_user_info_extra` t WHERE t.`uie_rank_id` = #{rankId} |
| | | </select>
|
| | |
|
| | | <select id="gerUserRank" resultMap="AllResultMap">
|
| | | SELECT * FROM
|
| | | yeshi_ec_user_info_extra ue
|
| | | LEFT JOIN yeshi_ec_user_rank rk ON
|
| | | rk.`ur_id` = ue.`uie_rank_id`
|
| | | WHERE ue.`uie_uid` = #{uid}
|
| | | <select id="gerUserRank" resultMap="AllResultMap">SELECT * FROM |
| | | yeshi_ec_user_info_extra ue LEFT JOIN yeshi_ec_user_rank rk ON |
| | | rk.`ur_id` = ue.`uie_rank_id` WHERE ue.`uie_uid` = #{uid} |
| | | </select>
|
| | | |
| | | <update id="updateAutoExtract">
|
| | | UPDATE yeshi_ec_user_info_extra SET uie_auto_extract = 1 |
| | | WHERE uie_auto_extract = 0 AND DATEDIFF(NOW(),uie_close_time_extract) <![CDATA[>]]> #{days}
|
| | | <update id="updateAutoExtract">UPDATE |
| | | yeshi_ec_user_info_extra SET uie_auto_extract = 1 WHERE |
| | | uie_auto_extract = 0 AND DATEDIFF(NOW(),uie_close_time_extract) <![CDATA[>]]> |
| | | #{days} |
| | | </update>
|
| | | </mapper>
|
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.user.vip.UserVIPInfoMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo"> |
| | | <id column="uvi_uid" property="id" jdbcType="BIGINT" /> |
| | | <result column="uvi_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="uvi_apply_time" property="applyTime" jdbcType="TIMESTAMP" /> |
| | | <result column="uvi_success_time" property="successTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="uvi_beizhu" property="beiZhu" jdbcType="VARCHAR" /> |
| | | <result column="uvi_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="uvi_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">uvi_uid,uvi_state,uvi_apply_time,uvi_success_time,uvi_beizhu,uvi_create_time,uvi_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_vip_info where uvi_uid = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_vip_info where uvi_uid = #{0} for update |
| | | </select> |
| | | |
| | | |
| | | <select id="listByUids" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_vip_info where |
| | | <foreach collection="uidList" separator=" or " item="uid"> |
| | | uvi_uid=#{uid} |
| | | </foreach> |
| | | |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_user_vip_info where uvi_uid = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_user_vip_info |
| | | (uvi_uid,uvi_state,uvi_apply_time,uvi_success_time,uvi_beizhu,uvi_create_time,uvi_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{state,jdbcType=INTEGER},#{applyTime,jdbcType=TIMESTAMP},#{successTime,jdbcType=TIMESTAMP},#{beiZhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_user_vip_info |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">uvi_uid,</if> |
| | | <if test="state != null">uvi_state,</if> |
| | | <if test="applyTime != null">uvi_apply_time,</if> |
| | | <if test="successTime != null">uvi_success_time,</if> |
| | | <if test="beiZhu != null">uvi_beizhu,</if> |
| | | <if test="createTime != null">uvi_create_time,</if> |
| | | <if test="updateTime != null">uvi_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="applyTime != null">#{applyTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="successTime != null">#{successTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo">update |
| | | yeshi_ec_user_vip_info set uvi_state = |
| | | #{state,jdbcType=INTEGER},uvi_apply_time = |
| | | #{applyTime,jdbcType=TIMESTAMP},uvi_success_time = |
| | | #{successTime,jdbcType=TIMESTAMP},uvi_beizhu = |
| | | #{beiZhu,jdbcType=VARCHAR},uvi_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},uvi_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where uvi_uid = |
| | | #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo"> |
| | | update yeshi_ec_user_vip_info |
| | | <set> |
| | | <if test="state != null">uvi_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="applyTime != null">uvi_apply_time=#{applyTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="successTime != null">uvi_success_time=#{successTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="beiZhu != null">uvi_beizhu=#{beiZhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">uvi_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">uvi_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where uvi_uid = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | return hongBaoV2CountMapper.countAlreadyGetMoneyByUid(uid, typeList, minGetTime, maxGetTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getShareRewardByTeamUid(Long uid, Long teamUid, Date endTime) {
|
| | | return hongBaoV2CountMapper.getShareRewardByTeamUid(uid, teamUid, endTime);
|
| | | }
|
| | | |
| | | @Override
|
| | | public BigDecimal getShareRewardByTeamUidLastMonth(Long uid, Long teamUid) {
|
| | | return hongBaoV2CountMapper.getShareRewardByTeamUidLastMonth(uid, teamUid);
|
| | | }
|
| | | }
|
| | |
| | | template = template.replace("{标题}", goods.getSkuName())
|
| | | .replace("{商品原价}", BigDecimalUtil.getWithNoZera(price).toString())
|
| | | .replace("{月销量}", JDUtil.getSaleCount(goods.getInOrderCount30Days())).replace("{短链接}", shortLink)
|
| | | .replace("{优惠券面额}", BigDecimalUtil.getWithNoZera(goods.getCouponInfo().getDiscount()).toString())
|
| | | .replace("{优惠券面额}", BigDecimalUtil.getWithNoZera(JDUtil.getShowCouponInfo( goods).getDiscount()).toString())
|
| | | .replace("{优惠券价}", BigDecimalUtil.getWithNoZera(JDUtil.getQuanPrice(goods)).toString());
|
| | | }
|
| | |
|
| | |
| | | || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackGiveBack
|
| | | || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackExchangePass
|
| | | || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackExchangeReject
|
| | | || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackNewUserReward
|
| | | || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackInviteSucceed
|
| | | || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackFirstSharedOrder
|
| | | || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackMonthSharedOrder
|
| | | || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackOneStageReward
|
| | | || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackTwoStageReward
|
| | | || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackThreeStageReward
|
| | | || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackUseFail
|
| | | || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackUseSuccess) {
|
| | | if (detail.getUser() == null)
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.config.push.PushMsgFactory;
|
| | | import com.yeshi.fanli.exception.msg.MsgMoneyDetailException;
|
| | | import com.yeshi.fanli.exception.push.PushException;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void teamRedPackRewardMsg(Long uid, MsgTypeMoneyTypeEnum type,BigDecimal money, String stateDesc, |
| | | String content) {
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setRead(false);
|
| | | detail.setMoney(money);
|
| | | detail.setMsgType(type);
|
| | | detail.setContent(content);
|
| | | detail.setStateDesc(stateDesc);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setBeiZhu("系统已下发到“我的-红包”中");
|
| | | detail.setCreateTime(new Date());
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void inviteOrderSubSidy(Long uid, Date date, String from, BigDecimal money, BigDecimal balance) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createInviteOrderSubSidyMsg(uid, date, from, money, balance,
|
| | | null);
|
| | |
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | | @Resource
|
| | | private InviteOrderSubsidyService inviteOrderSubsidyService;
|
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | | // 奖励订单图片
|
| | | public final static String PIC_REWARD = "http://img.flqapp.com/resource/order/order_state_reward.png";
|
| | |
| | | //listDataFactory(acceptData, listOrder, listGoods, uid);
|
| | | return listOrder;
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 订单: 免单标识 奖励标识
|
| | |
| | | Date thirdCreateTime = order.getThirdCreateTime();
|
| | | if (thirdCreateTime != null) {
|
| | | long downOrderTime = thirdCreateTime.getTime();
|
| | | long limitDate = Long.parseLong("1571760000000"); // TODO 日期待确定2019-11-10
|
| | | long limitDate = Long.parseLong("1571760000000"); // TODO
|
| | | // 日期待确定2019-11-10
|
| | | if (downOrderTime > limitDate) {
|
| | | newEdition = true;
|
| | | Date endDay = DateUtil.plusDayDate(4, thirdCreateTime);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 订单信息加工
|
| | | * |
| | | * @param acceptData
|
| | | * @param listOrder
|
| | | * @param listGoods
|
| | |
| | | boolean hasRewardCoupon = userSystemCouponService.getIncludeNotExchange(uid);
|
| | | boolean exchangeCoupon = userSystemCouponService.getIncludeExchange(uid);
|
| | |
|
| | | // 需要查询是否为VIP的用户ID,只有邀请订单才需要查询
|
| | | List<Long> needSelectVIPUidList = new ArrayList<>();
|
| | |
|
| | | for (CommonOrderVO order : listOrder) {
|
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI
|
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI
|
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI)
|
| | | needSelectVIPUidList.add(Long.parseLong(order.getUserId()));
|
| | | }
|
| | | Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList);
|
| | |
|
| | | // 设置是否为vip订单
|
| | | for (CommonOrderVO order : listOrder) {
|
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI
|
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI
|
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) {
|
| | | if (vipUserMap.get(Long.parseLong(order.getUserId())) != null
|
| | | && vipUserMap.get(Long.parseLong(order.getUserId())) == true)
|
| | | order.setVipOrder(true);
|
| | | else
|
| | | order.setVipOrder(false);
|
| | | } else
|
| | | order.setVipOrder(false);
|
| | | }
|
| | |
|
| | | for (CommonOrderVO order: listOrder) {
|
| | | String orderNo = order.getOrderNo();
|
| | |
| | | }
|
| | | commonGoodsVO.setActualPay("付款金额:¥" + totalSettlement);
|
| | |
|
| | | |
| | | Integer hongBaoType = order.getHongBaoType();
|
| | | // 邀请订单信息保护
|
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType
|
| | |
| | | commonGoodsVO.setTitle(null);
|
| | | commonGoodsVO.setGoodsTitle(titleMap);
|
| | | }
|
| | |
|
| | |
|
| | | // 订单类型为空时 已商品类为准
|
| | | Integer orderType = order.getOrderType();
|
| | |
| | | order.getListOrderGoods().add(commonGoodsVO);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | Date thirdCreateTime = order.getThirdCreateTime();
|
| | | if (thirdCreateTime != null) {
|
| | |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) {
|
| | | order.setOrderType(4);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /* 订单状态 转换处理 */
|
| | | String orderStateContent = "";
|
| | |
| | | orderStateContent = "维权成功";
|
| | | WeiQuanInfo weiQuanInfo = new WeiQuanInfo();
|
| | | weiQuanInfo.setOldHongBao("¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | weiQuanInfo.setWqHongBao("维权:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | weiQuanInfo
|
| | | .setWqHongBao("维权:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney);
|
| | | order.setWeiQuanInfo(weiQuanInfo);
|
| | | }
|
| | |
| | | orderStateMap.put("content", orderStateContent);
|
| | | orderStateMap.put("fontColor", "#666666");
|
| | | order.setOrderState(orderStateMap);
|
| | | |
| | | |
| | | |
| | |
|
| | | String hongbaoInfo = "";
|
| | | // 订单标识
|
| | |
| | | order.setOrderOrigin("3");
|
| | | order.setHongBaoTypePic(CommonOrder.TYPE_INVITE);
|
| | | signList.add(CommonOrder.TYPE_INVITE);
|
| | |
|
| | | } else if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType
|
| | | || HongBaoV2.TYPE_ERJI == hongBaoType) {
|
| | | // 邀请订单
|
| | |
| | |
|
| | | // 版本区分:2-0-2
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | InviteOrderSubsidy orderSubsidy = inviteOrderSubsidyService.getByOrderNoAndType(uid, order.getOrderNo(), sourceType);
|
| | | InviteOrderSubsidy orderSubsidy = inviteOrderSubsidyService.getByOrderNoAndType(uid,
|
| | | order.getOrderNo(), sourceType);
|
| | | if (orderSubsidy != null) {
|
| | | ClientTextStyleVO subsidyInfo = new ClientTextStyleVO();
|
| | | subsidyInfo.setContent("(补贴¥" + orderSubsidy.getMoney() + ")");
|
| | |
| | | order.setOrderNo(UserUtil.filterOrderId(order.getOrderNo()));
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public Long countUserOrderToApp(Long uid, Integer type, String startTime, String endTime,
|
| | | Integer day, Integer source, Integer state, Integer stateOrder) {
|
| | | public Long countUserOrderToApp(Long uid, Integer type, String startTime, String endTime, Integer day,
|
| | | Integer source, Integer state, Integer stateOrder) {
|
| | | return commonOrderMapper.countUserOrderToApp(uid, type, startTime, endTime, day, source, state, stateOrder);
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | return weiQuanMoney;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | |
| | |
|
| | | @Override
|
| | | public List<CommonOrder> listBySourceTypeAndOrderId(int sourceType, String orderId) {
|
| | |
| | | return new CommonOrderAddResultDTO(commonOrder, CommonOrderAddResultDTO.TYPE_ADD);
|
| | | } else {// 修改
|
| | | // 非京东已经结算,已经失效,状态未改变的订单不处理
|
| | | if ((oldCommonOrder.getState() == CommonOrder.STATE_JS&&oldCommonOrder.getSourceType()!=Constant.SOURCE_TYPE_JD) || oldCommonOrder.getState() == CommonOrder.STATE_SX
|
| | | if ((oldCommonOrder.getState() == CommonOrder.STATE_JS
|
| | | && oldCommonOrder.getSourceType() != Constant.SOURCE_TYPE_JD)
|
| | | || oldCommonOrder.getState() == CommonOrder.STATE_SX
|
| | | || oldCommonOrder.getState() == CommonOrder.STATE_WQ
|
| | | || (oldCommonOrder.getState().intValue() == commonOrder.getState())) {
|
| | | return new CommonOrderAddResultDTO(oldCommonOrder, CommonOrderAddResultDTO.TYPE_NOUPDATE);
|
| | |
| | | @Override
|
| | | public List<CommonOrderVO> listQuery(long start, int count, Integer keyType, String key, Integer state,
|
| | | Integer type, Integer orderState, String startTime, String endTime, Integer source,List<Long> listShopId,
|
| | | List<Long> listGoodsId, Date minTime, BigDecimal money)
|
| | | throws CommonOrderException {
|
| | | List<Long> listGoodsId, Date minTime, BigDecimal money) throws CommonOrderException {
|
| | |
|
| | | List<CommonOrderVO> list = null;
|
| | |
|
| | |
| | | return commonOrderMapper.countQueryWithNoChild(keyType, key, state, type, orderState, startTime, endTime,
|
| | | source);
|
| | | } else {
|
| | | return commonOrderMapper.countQuery(keyType, key, state, type, orderState, startTime, endTime, source, listShopId,
|
| | | listGoodsId, minTime,money);
|
| | | return commonOrderMapper.countQuery(keyType, key, state, type, orderState, startTime, endTime, source,
|
| | | listShopId, listGoodsId, minTime, money);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | return commonOrderList.get(0);
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public CommonOrderVO firstValidOrderByUid(Long uid) {
|
| | | return commonOrderMapper.firstValidOrderByUid(uid, null, null);
|
| | |
| | | public CommonOrderVO firstValidOrderByUidAndType(Long uid, Integer type) {
|
| | | return commonOrderMapper.firstValidOrderByUid(uid, type, null);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public CommonOrderVO firstValidOrderLastMonthByUidAndType(Long uid, Integer type) {
|
| | |
| | | public BigDecimal getTotalRewardMoneyByOrderNoAndSourceType(String orderNo, Integer sourceType) {
|
| | | return commonOrderMapper.getTotalRewardMoneyByOrderNoAndSourceType(orderNo, sourceType);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long count24HValidOrderByUid(Long uid, Date minTime) {
|
| | | return commonOrderMapper.count24HValidOrderByUid(uid, minTime);
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.exception.order.HongBaoException;
|
| | | import com.yeshi.fanli.exception.order.ShareGoodsActivityOrderException;
|
| | | import com.yeshi.fanli.exception.share.UserShareGoodsRecordException;
|
| | | import com.yeshi.fanli.exception.user.UserAccountException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | |
| | | return hongBaoV2Mapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public int addHongBao(List<CommonOrder> commonOrderList, int type) throws HongBaoException {
|
| | | public int addHongBao(List<CommonOrder> commonOrderList, int type) throws HongBaoException, UserAccountException {
|
| | | Set<Integer> stateSet = new HashSet<>();// 订单状态Set
|
| | | if (commonOrderList != null && commonOrderList.size() > 0) {
|
| | | int orderType = commonOrderList.get(0).getSourceType();
|
| | |
| | |
|
| | | @Transactional
|
| | | private boolean updateHongBao(HongBaoOrder hongBaoOrder, CommonOrder commonOrder, int type,
|
| | | Map<Integer, HongBaoOrder> notificationMap) throws HongBaoException {
|
| | | Map<Integer, HongBaoOrder> notificationMap) throws HongBaoException, UserAccountException {
|
| | | System.out.println(commonOrder.getOrderNo());
|
| | | // 锁行
|
| | | HongBaoV2 oldHongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBaoOrder.getHongBaoV2().getId());
|
| | |
| | | MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), fanliRate.divide(new BigDecimal(100))));
|
| | | if (mianDan)
|
| | | hongBao.setMoney(commonOrder.getPayment());
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS||commonOrder.getState() == CommonOrder.STATE_WQ) {
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS
|
| | | || commonOrder.getState() == CommonOrder.STATE_WQ) {
|
| | | hongBao.setState(HongBaoV2.STATE_KELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), fanliRate.divide(new BigDecimal(100))));
|
| | |
| | | } else if (hongBao.getState() == HongBaoV2.STATE_BUKELINGQU) {
|
| | | firstHongbao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), firstRate.divide(new BigDecimal(100))));
|
| | | } else if (hongBao.getState() == HongBaoV2.STATE_SHIXIAO) {
|
| | | firstHongbao.setMoney(new BigDecimal(0));
|
| | | }
|
| | |
|
| | | if (firstHongbao.getMoney() != null
|
| | | && firstHongbao.getMoney().compareTo(new BigDecimal(0)) > 0) {
|
| | | hongBaoV2Mapper.insertSelective(firstHongbao);
|
| | | // 用户通知
|
| | | if (notificationMap.get(HongBaoV2.TYPE_YIJI) == null) {
|
| | |
| | | tempHongBao.setMoney(firstHongbao.getMoney());
|
| | | CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
|
| | | tempCommonOrder.setPayment(commonOrder.getPayment());
|
| | | notificationMap.put(HongBaoV2.TYPE_YIJI, new HongBaoOrder(tempCommonOrder, tempHongBao));
|
| | | notificationMap.put(HongBaoV2.TYPE_YIJI,
|
| | | new HongBaoOrder(tempCommonOrder, tempHongBao));
|
| | | } else {
|
| | | // 增加付款金额与资金
|
| | | HongBaoOrder tempHongBaoOrder = notificationMap.get(HongBaoV2.TYPE_YIJI);
|
| | | tempHongBaoOrder.getCommonOrder().setPayment(
|
| | | tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
|
| | | tempHongBaoOrder.getHongBaoV2()
|
| | | .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(firstHongbao.getMoney()));
|
| | | tempHongBaoOrder.getHongBaoV2().setMoney(
|
| | | tempHongBaoOrder.getHongBaoV2().getMoney().add(firstHongbao.getMoney()));
|
| | | notificationMap.put(HongBaoV2.TYPE_YIJI, tempHongBaoOrder);
|
| | | }
|
| | | }
|
| | |
|
| | | // 插入二级子红包
|
| | |
| | | } else if (hongBao.getState() == HongBaoV2.STATE_BUKELINGQU) {
|
| | | secondHongbao.setMoney(MoneyBigDecimalUtil.mul(hongBao.getMoney(),
|
| | | secondRate.divide(new BigDecimal(100))));
|
| | | }
|
| | | } else if (hongBao.getState() == HongBaoV2.STATE_SHIXIAO)
|
| | | secondHongbao.setMoney(new BigDecimal(0));
|
| | | if (secondHongbao.getMoney() != null
|
| | | && secondHongbao.getMoney().compareTo(new BigDecimal(0)) > 0) {
|
| | | hongBaoV2Mapper.insertSelective(secondHongbao);
|
| | |
|
| | | // 用户通知
|
| | | if (notificationMap.get(HongBaoV2.TYPE_ERJI) == null) {
|
| | | HongBaoV2 tempHongBao = new HongBaoV2(secondHongbao.getId());
|
| | |
| | | } else {
|
| | | // 增加付款金额与资金
|
| | | HongBaoOrder tempHongBaoOrder = notificationMap.get(HongBaoV2.TYPE_ERJI);
|
| | | tempHongBaoOrder.getCommonOrder().setPayment(
|
| | | tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
|
| | | tempHongBaoOrder.getCommonOrder().setPayment(tempHongBaoOrder.getCommonOrder()
|
| | | .getPayment().add(commonOrder.getPayment()));
|
| | | tempHongBaoOrder.getHongBaoV2().setMoney(
|
| | | tempHongBaoOrder.getHongBaoV2().getMoney().add(secondHongbao.getMoney()));
|
| | | notificationMap.put(HongBaoV2.TYPE_ERJI, tempHongBaoOrder);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | hongBao.setState(HongBaoV2.STATE_BUKELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), fanliRate.divide(new BigDecimal(100))));
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS||commonOrder.getState() == CommonOrder.STATE_WQ) {
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS
|
| | | || commonOrder.getState() == CommonOrder.STATE_WQ) {
|
| | | hongBao.setState(HongBaoV2.STATE_KELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), fanliRate.divide(new BigDecimal(100))));
|
| | |
| | | }
|
| | |
|
| | | // 以实际收入为准计算预估收益
|
| | | if (CommonOrder.STATE_JS == commonOrder.getState()||CommonOrder.STATE_WQ == commonOrder.getState()) {
|
| | | if (CommonOrder.STATE_JS == commonOrder.getState()
|
| | | || CommonOrder.STATE_WQ == commonOrder.getState()) {
|
| | | childUpdate.setMoney(
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100))));
|
| | | if (commonOrder.getThirdCreateTime().getTime() > TimeUtil.convertToTimeTemp("2019-04-16",
|
| | |
| | |
|
| | | @Transactional
|
| | | private void saveHongBao(CommonOrder commonOrder, int type, Map<Integer, HongBaoOrder> notificationMap)
|
| | | throws HongBaoException {
|
| | | throws HongBaoException, UserAccountException {
|
| | | if (type == HongBaoV2.TYPE_ZIGOU) {// 获取自购的返利比例
|
| | | BigDecimal fanliRate = hongBaoManageService.getFanLiRate(commonOrder.getCreateTime().getTime());
|
| | | // 查询是否有免单计划
|
| | |
| | | hongBao.setState(HongBaoV2.STATE_BUKELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), fanliRate.divide(new BigDecimal(100))));
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS||CommonOrder.STATE_WQ == commonOrder.getState()) {
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS
|
| | | || CommonOrder.STATE_WQ == commonOrder.getState()) {
|
| | | hongBao.setState(HongBaoV2.STATE_KELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), fanliRate.divide(new BigDecimal(100))));
|
| | |
| | | hongBao.setMoney(mianDanMoney);
|
| | |
|
| | | UserInfo user = userInfoService.getUserById(commonOrder.getUserInfo().getId());
|
| | | if (user == null)
|
| | | throw new UserAccountException(1001, "用户不存在/被封禁");
|
| | | hongBao.setUrank(user.getRank());
|
| | | hongBao.setOrderType(commonOrder.getSourceType());
|
| | | hongBaoV2Mapper.insertSelective(hongBao);
|
| | |
| | | hongBao.setState(HongBaoV2.STATE_BUKELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), shareRate.divide(new BigDecimal(100))));
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS||commonOrder.getState() == CommonOrder.STATE_WQ) {
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS
|
| | | || commonOrder.getState() == CommonOrder.STATE_WQ) {
|
| | | hongBao.setState(HongBaoV2.STATE_KELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), shareRate.divide(new BigDecimal(100))));
|
| | |
| | | calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-25", "yyyy-M-dd")));
|
| | | }
|
| | | UserInfo user = userInfoService.getUserById(commonOrder.getUserInfo().getId());
|
| | | if (user == null)
|
| | | throw new UserAccountException(1001, "用户不存在/被封禁");
|
| | | hongBao.setUrank(user.getRank());
|
| | | hongBao.setUserInfo(user);
|
| | | hongBao.setOrderType(commonOrder.getSourceType());
|
| | |
| | | child.setState(HongBaoV2.STATE_BUKELINGQU);
|
| | | child.setMoney(MoneyBigDecimalUtil.mul(commonOrder.getEstimate(),
|
| | | firstLevelRate.divide(new BigDecimal(100))));
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS||commonOrder.getState() == CommonOrder.STATE_WQ) {
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS
|
| | | || commonOrder.getState() == CommonOrder.STATE_WQ) {
|
| | | child.setState(HongBaoV2.STATE_KELINGQU);
|
| | | child.setMoney(MoneyBigDecimalUtil.mul(commonOrder.geteIncome(),
|
| | | firstLevelRate.divide(new BigDecimal(100))));
|
| | |
| | | child.setVersion(2);
|
| | | child.setCreateTime(new Date());
|
| | | child.setOrderType(commonOrder.getSourceType());
|
| | | if (child.getMoney().compareTo(new BigDecimal(0)) > 0) {
|
| | | if (child.getMoney() != null && child.getMoney().compareTo(new BigDecimal(0)) > 0) {
|
| | | hongBaoV2Mapper.insertSelective(child);
|
| | | // 添加通知
|
| | | if (notificationMap.get(HongBaoV2.TYPE_SHARE_YIJI) == null) {
|
| | |
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | } else
|
| | | throw new HongBaoException(2, "type错误");
|
| | | }
|
| | |
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.cmq.HongBaoRecieveCMQManager;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeOrderApiUtil;
|
| | |
|
| | |
| | |
|
| | | // 邀请赚到账事务消息
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_INVITE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(),
|
| | | new Gson().toJson(mqMsg).getBytes());
|
| | | sourceType, null, null, new Date(),0);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual,
|
| | | mqMsg);
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | |
|
| | | // 邀请赚到账事务消息
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_INVITE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | sourceType, null, null, new Date(),0);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | |
|
| | | // 邀请赚到账事务消息
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_INVITE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | sourceType, null, null, new Date(),0);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | }
|
| | |
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(),OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | sourceType, null, null, new Date(),0);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER,OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | }
|
| | |
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | sourceType, null, null, new Date(),0);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | }
|
| | |
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | sourceType, null, null, new Date(),0);
|
| | | Message msg =MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | import com.yeshi.fanli.exception.order.HongBaoException;
|
| | | import com.yeshi.fanli.exception.order.OrderItemException;
|
| | | import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
|
| | | import com.yeshi.fanli.exception.user.UserAccountException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.elme.ElmeHongBaoOrderMapService;
|
| | | import com.yeshi.fanli.service.inter.elme.ElmeOrderService;
|
| | |
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTagConstant;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | |
| | | // 自购到账事务消息
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_ZIGOU,
|
| | | mainUser.getId(), hongBaoOrder.getCommonOrder().getSourceType(),
|
| | | hongBaoOrder.getCommonOrder().getOrderNo(), null, new Date());
|
| | | hongBaoOrder.getCommonOrder().getOrderNo(), null, new Date(),0);
|
| | | mqMsg.setOrderFirst(first);
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(),
|
| | | new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual,
|
| | | mqMsg);
|
| | | String key = mainUser.getId() + "-" + UUID.randomUUID().toString();
|
| | | msg.setKey(key);
|
| | | try {
|
| | |
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | } catch (UserAccountException e) {
|
| | |
|
| | | }
|
| | | if (resultCode == 1) {// 只发送新增消息
|
| | | OrderMQMsg mqMsg = new OrderMQMsg(orderId, sourceType, uid, OrderMQMsg.HANDLE_TYPE_ADD,
|
| | | isCommonOrderValid(coList));
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderStatistic.name(),
|
| | | new Gson().toJson(mqMsg).getBytes());
|
| | | isCommonOrderValid(coList),0,new Date());
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderStatistic,
|
| | | mqMsg);
|
| | | producer.send(msg);
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | import com.yeshi.fanli.util.TokenUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | | import com.yeshi.fanli.util.factory.RedPackDetailFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | @Service
|
| | |
| | | UserRedPackGiftMQMsg msg = new UserRedPackGiftMQMsg();
|
| | | msg.setId(giveRecord.getId());
|
| | | msg.setUid(uid);
|
| | | Message message = new Message(MQTopicName.TOPIC_USER.name(), UserTopicTagEnum.redPackGiftDrawback.name(),
|
| | | new Gson().toJson(msg).getBytes());
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.redPackGiftDrawback,
|
| | | msg);
|
| | | try {
|
| | | producer.send(message);
|
| | | } catch (Exception e) {
|
| | |
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.redpack.RedPackWinInviteMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgRedPackAddContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgRedPackTeamRewardContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackWinInvite;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackWinInvite.RedPackWinInviteTypeEnum;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
|
| | |
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | | import com.yeshi.fanli.util.factory.RedPackDetailFactory;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | |
|
| | | @Service
|
| | | public class RedPackWinInviteServiceImpl implements RedPackWinInviteService {
|
| | |
| | | @Resource
|
| | | private UserActiveLogService userActiveLogService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | | |
| | |
|
| | | @Override
|
| | | public List<RedPackWinInvite> getRewardList(int start, int count, Long uid) {
|
| | |
| | | return redPackWinInviteMapper.getRewardMoney(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @RequestSerializableByKeyService(key = "#teamUid")
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void inviteSucceedReward(Long teamUid) throws Exception{
|
| | | // 是否在上线之后的邀请关系
|
| | | ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(teamUid, Constant.RED_PACK_REWARD_TIME);
|
| | | if (threeSale == null)
|
| | | return;
|
| | | |
| | | // 上级id
|
| | | Long bossId = threeSale.getBoss().getId();
|
| | | UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(bossId);
|
| | | if (activeLog == null)
|
| | | return;
|
| | | |
| | | // 小于2.0.2版本不增加
|
| | | if (!VersionUtil.greaterThan_2_1("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android",
|
| | | activeLog.getVersionCode()))
|
| | | return;
|
| | |
|
| | | // 同一队员奖励一次
|
| | | int totalReward = redPackWinInviteMapper.countByUidAndTeamUidAndType(bossId, teamUid, RedPackWinInviteTypeEnum.oneStageReward.name());
|
| | | if (totalReward > 0)
|
| | | return;
|
| | | |
| | | // 建立邀请关系时间超过20天
|
| | | Long succeedTime = threeSale.getSucceedTime();
|
| | | Date endDate = DateUtil.plusDayDate(Constant.ONE_STAGE_LIMIT_DAYS, new Date(succeedTime));
|
| | | if (endDate.getTime() < java.lang.System.currentTimeMillis())
|
| | | return;
|
| | | |
| | | // 绑定电话号码和微信
|
| | | UserInfo userInfo = userInfoService.selectByPKey(teamUid);
|
| | | if (userInfo == null || StringUtil.isNullOrEmpty(userInfo.getPhone()) || StringUtil.isNullOrEmpty(userInfo.getWxOpenId())) |
| | | return;
|
| | | |
| | | // 授权淘宝
|
| | | UserExtraTaoBaoInfo taoBaoInfo = userExtraTaoBaoInfoService.getByUid(teamUid);
|
| | | if (taoBaoInfo == null || StringUtil.isNullOrEmpty(taoBaoInfo.getTaoBaoUid()))
|
| | | return;
|
| | | |
| | | // 好友产生一笔返利订单(自购)且 24 小时内不失效;
|
| | | long validOrder = commonOrderService.count24HValidOrderByUid(teamUid, new Date(succeedTime));
|
| | | if (validOrder < 1) |
| | | return;
|
| | | |
| | | // 奖励金额
|
| | | BigDecimal money = Constant.ONE_STAGE_MONEY;
|
| | | |
| | | // 获得红包
|
| | | RedPackWinInvite winInvite = new RedPackWinInvite();
|
| | | winInvite.setCreateTime(new Date());
|
| | | winInvite.setUpdateTime(new Date());
|
| | | winInvite.setType(RedPackWinInviteTypeEnum.oneStageReward);
|
| | | winInvite.setUid(bossId);
|
| | | winInvite.setTeamUid(teamUid);
|
| | | winInvite.setMoney(money);
|
| | | redPackWinInviteMapper.insertSelective(winInvite);
|
| | | |
| | | // 增加红包
|
| | | redPackBalanceService.addRedPack(bossId, money, RedPackDetailFactory.createInvite(winInvite));
|
| | | |
| | | // 消息
|
| | | MsgRedPackTeamRewardContentDTO dto = new MsgRedPackTeamRewardContentDTO();
|
| | | dto.setNickName(userInfo.getNickName());
|
| | | dto.setPortrait(userInfo.getPortrait());
|
| | | userMoneyMsgNotificationService.teamRedPackRewardMsg(bossId, MsgTypeMoneyTypeEnum.redPackOneStageReward,
|
| | | money, "队员(好友)完成第一阶段", new Gson().toJson(dto));
|
| | | }
|
| | | |
| | |
|
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | | ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(uid, Constant.RED_PACK_REWARD_TIME);
|
| | | if(threeSale == null)
|
| | | return;
|
| | | |
| | | Long bossId = threeSale.getBoss().getId();
|
| | | UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(bossId);
|
| | | if (activeLog == null) |
| | | return;
|
| | | |
| | | // 小于2.0.2版本不增加
|
| | | if (!VersionUtil.greaterThan_2_1("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android",
|
| | | activeLog.getVersionCode()))
|
| | | return;
|
| | | |
| | | // 奖励上级
|
| | | bossReward(bossId, uid, source, orderNo);
|
| | | bossReward(threeSale.getBoss().getId(), uid, source, orderNo);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | * @throws Exception
|
| | | */
|
| | | @Transactional
|
| | | private void bossReward(Long uid, Long teamUid, Integer source, String orderNo) throws Exception {
|
| | | firstSharedOrderRewardToBoss(uid, teamUid, source, orderNo);
|
| | | firstSharedOrderRewardTheMonthToBoss(uid, teamUid, source, orderNo);
|
| | | private void bossReward(Long bossId, Long teamUid, Integer source, String orderNo) throws Exception {
|
| | | UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(bossId);
|
| | | if (activeLog == null) |
| | | return;
|
| | | |
| | | // 小于2.0.2版本不增加
|
| | | if (!VersionUtil.greaterThan_2_1("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android",
|
| | | activeLog.getVersionCode()))
|
| | | return;
|
| | | |
| | | // 第一阶段(验证)
|
| | | RedPackWinInvite oneStage = redPackWinInviteMapper.getByUidAndTeamUidAndType(bossId, teamUid, RedPackWinInviteTypeEnum.oneStageReward.name());
|
| | | if (oneStage == null)
|
| | | return;
|
| | | |
| | | // 第二阶段(验证)
|
| | | RedPackWinInvite twoStage = redPackWinInviteMapper.getByUidAndTeamUidAndType(bossId, teamUid, RedPackWinInviteTypeEnum.twoStageReward.name());
|
| | | if (twoStage == null) {
|
| | | twoStageRewardToBoss(bossId, teamUid, oneStage.getCreateTime(), source, orderNo);
|
| | | return;
|
| | | } |
| | | |
| | | // 第三阶段
|
| | | threeStageRewardToBoss(bossId, teamUid, twoStage.getCreateTime(), source, orderNo);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 上级奖励:被邀请人完成首笔分享订单 (已到账) |
| | | * 上级奖励--第二阶段
|
| | | * @param uid
|
| | | * @param source
|
| | | * @param orderNo
|
| | | * @param bossId
|
| | | */
|
| | | @Transactional
|
| | | private void firstSharedOrderRewardToBoss(Long uid, Long inviteeUid, Integer source, String orderNo) throws Exception{
|
| | | // 1、同一队员奖励一次
|
| | | long totalReward = redPackWinInviteMapper.countByUidAndTeamUidAndType(uid, inviteeUid, RedPackWinInviteTypeEnum.firstSharedOrder.name());
|
| | | if (totalReward > 0)
|
| | | private void twoStageRewardToBoss(Long bossId, Long teamUid, Date oneStageTime, Integer source, String orderNo) throws Exception{
|
| | | // 第一阶段完成之后的90天内 ; 队友产生的订单中(自购+分享),邀请人累计产生≥1 元奖金 |
| | | Date endDate = DateUtil.plusDayDate(Constant.TWO_STAGE_LIMIT_DAYS, oneStageTime);
|
| | | BigDecimal rewardMoney = hongBaoV2CountService.getShareRewardByTeamUid(bossId, teamUid, endDate);
|
| | | if (rewardMoney == null || rewardMoney.compareTo(Constant.TWO_STAGE_ORDER_REWARD_MIN) < 0)
|
| | | return;
|
| | |
|
| | | // 2、是否下级的首个分享订单
|
| | | CommonOrder commonOrder = commonOrderService.getFirstShareOrderByUid(inviteeUid);
|
| | | if (commonOrder == null || !orderNo.equals(commonOrder.getOrderNo()) || source != commonOrder.getSourceType()) |
| | | return ;
|
| | | |
| | | // 3、到账奖励金额 是否大于5
|
| | | BigDecimal totalRewardMoney = commonOrderService.getTotalRewardMoneyByOrderNoAndSourceType(orderNo, source);
|
| | | if (totalRewardMoney == null || totalRewardMoney.compareTo(Constant.RED_PACK_ORDER_REWARD_MIN) < 0)
|
| | | return;
|
| | | |
| | | // 2、判断是第几个人
|
| | | long total = redPackWinInviteMapper.countByUidAndType(uid, RedPackWinInviteTypeEnum.firstSharedOrder.name());
|
| | | |
| | | // 计算应增加红包金额
|
| | | BigDecimal money = new BigDecimal(redPackConfigService.getValueByKey("first_shared_order"));
|
| | | long num = total % 9;
|
| | | if (num > 0) {
|
| | | BigDecimal addMoney = new BigDecimal(redPackConfigService.getValueByKey("first_shared_order_add"));
|
| | | money = MoneyBigDecimalUtil.add(money, MoneyBigDecimalUtil.mul(addMoney, new BigDecimal(num)));
|
| | | // 计算奖励
|
| | | BigDecimal money = Constant.TWO_STAGE_MONEY_MIN;
|
| | | long total = redPackWinInviteMapper.countByUidAndType(bossId, RedPackWinInviteTypeEnum.twoStageReward.name());
|
| | | if (total > 0 && total < Constant.TWO_STAGE_MONEY_ADD_NUM) {
|
| | | long num = total % Constant.TWO_STAGE_MONEY_ADD_NUM;
|
| | | money = MoneyBigDecimalUtil.add(money, MoneyBigDecimalUtil.mul(Constant.TWO_STAGE_MONEY_ADD, new BigDecimal(num)));
|
| | | }
|
| | |
|
| | | // 3、获得红包记录
|
| | | // 获得红包记录
|
| | | RedPackWinInvite winInvite = new RedPackWinInvite();
|
| | | winInvite.setCreateTime(new Date());
|
| | | winInvite.setUpdateTime(new Date());
|
| | | winInvite.setType(RedPackWinInviteTypeEnum.firstSharedOrder);
|
| | | winInvite.setUid(uid);
|
| | | winInvite.setTeamUid(inviteeUid);
|
| | | winInvite.setUid(bossId);
|
| | | winInvite.setTeamUid(teamUid);
|
| | | winInvite.setMoney(money);
|
| | | winInvite.setSource(source);
|
| | | winInvite.setOrderNo(orderNo);
|
| | | winInvite.setCreateTime(new Date());
|
| | | winInvite.setUpdateTime(new Date());
|
| | | winInvite.setType(RedPackWinInviteTypeEnum.twoStageReward);
|
| | | redPackWinInviteMapper.insertSelective(winInvite);
|
| | |
|
| | | // 4、增加红包
|
| | | redPackBalanceService.addRedPack(uid, money, RedPackDetailFactory.createIncreaseReward(winInvite));
|
| | | redPackBalanceService.addRedPack(bossId, money, RedPackDetailFactory.createIncreaseReward(winInvite));
|
| | |
|
| | | // 5、消息
|
| | | MsgRedPackAddContentDTO dto = new MsgRedPackAddContentDTO();
|
| | | dto.setTitle("红包增加");
|
| | | dto.setMoney("¥" + money.setScale(2));
|
| | | dto.setBalance("¥" + redPackBalanceService.getBalance(uid).setScale(2));
|
| | | userMoneyMsgNotificationService.redPackMsg(uid, MsgTypeMoneyTypeEnum.redPackFirstSharedOrder, |
| | | new Gson().toJson(dto), "请到“我的-红包”中查看");
|
| | | UserInfo userInfo = userInfoService.selectByPKey(teamUid);
|
| | | MsgRedPackTeamRewardContentDTO dto = new MsgRedPackTeamRewardContentDTO();
|
| | | dto.setNickName(userInfo.getNickName());
|
| | | dto.setPortrait(userInfo.getPortrait());
|
| | | userMoneyMsgNotificationService.teamRedPackRewardMsg(bossId, MsgTypeMoneyTypeEnum.redPackTwoStageReward,
|
| | | money, "队员(好友)完成第二阶段", new Gson().toJson(dto));
|
| | | }
|
| | |
|
| | |
|
| | |
| | | * @param bossId
|
| | | */
|
| | | @Transactional
|
| | | private void firstSharedOrderRewardTheMonthToBoss(Long uid, Long inviteeUid, Integer source, String orderNo) throws Exception{
|
| | | |
| | | // 1、判断是否是上个月首单
|
| | | CommonOrderVO order = commonOrderService.firstValidOrderLastMonthByUidAndType(inviteeUid, 2);
|
| | | if (order == null || source != order.getSourceType() || !orderNo.equals(order.getOrderNo()) ||
|
| | | order.getAccountTime() == null) |
| | | private void threeStageRewardToBoss(Long bossId, Long teamUid, Date twoStageTime, Integer source, String orderNo) throws Exception{
|
| | | // 二、三阶段不可同月
|
| | | if (DateUtil.isSameMonth(twoStageTime, new Date()))
|
| | | return;
|
| | |
|
| | | // 分享订单实付款≥10元
|
| | | if (order.getPayment() == null || order.getPayment().compareTo(Constant.RED_PACK_PAY_MIN) < 0) |
| | | // 是否已领取本月
|
| | | RedPackWinInvite threeStage = redPackWinInviteMapper.getByUidAndTeamUidAndTypeMonth(bossId, teamUid, RedPackWinInviteTypeEnum.threeStageReward.name());
|
| | | if (threeStage != null)
|
| | | return;
|
| | |
|
| | | // 2、是否下级的首个分享订单
|
| | | // CommonOrder firstorder = commonOrderService.getFirstShareOrderByUid(inviteeUid);
|
| | | // if (firstorder == null || (orderNo.equals(firstorder.getOrderNo()) && source == firstorder.getSourceType()));
|
| | | // return;
|
| | | // 已奖励次数 |
| | | int totalNum = redPackWinInviteMapper.countByUidAndTeamUidAndType(bossId, teamUid, RedPackWinInviteTypeEnum.threeStageReward.name());
|
| | | if (totalNum >= Constant.THREE_STAGE_REWARD_MONTH)
|
| | | return;
|
| | |
|
| | | // 第一次到账的次月开始连续15个月 自然月获得(已到账)
|
| | | // int monthSpace = DateUtil.getMonthSpace(order.getThirdCreateTime(), firstorder.getThirdCreateTime());
|
| | | // if (monthSpace == 0 || monthSpace > Constant.RED_PACK_REWARD_MONTH) |
| | | // return;
|
| | | // 是否已间断
|
| | | int monthSpace = DateUtil.getMonthSpace(twoStageTime, new Date());
|
| | | if (monthSpace != totalNum + 1)
|
| | | return;
|
| | |
|
| | | // 每月给你累计产生≥2 元
|
| | | BigDecimal rewardMoney = hongBaoV2CountService.getShareRewardByTeamUidLastMonth(bossId, teamUid);
|
| | | if (rewardMoney == null || rewardMoney.compareTo(Constant.THREE_STAGE_ORDER_REWARD_MIN) < 0)
|
| | | return;
|
| | |
|
| | | // 计算随机奖励
|
| | | double randomMoney = Constant.RED_PACK_RANDOM_MIN + Math.random() * (Constant.RED_PACK_RANDOM_MAX - Constant.RED_PACK_RANDOM_MIN);
|
| | | double randomMoney = Constant.THREE_STAGE_RANDOM_MIN + Math.random() * (Constant.THREE_STAGE_RANDOM_MAX - Constant.THREE_STAGE_RANDOM_MIN);
|
| | | // 保留两位小数
|
| | | BigDecimal money = new BigDecimal(randomMoney).setScale(2, BigDecimal.ROUND_HALF_UP);
|
| | |
|
| | |
| | | RedPackWinInvite winInvite = new RedPackWinInvite();
|
| | | winInvite.setCreateTime(new Date());
|
| | | winInvite.setUpdateTime(new Date());
|
| | | winInvite.setType(RedPackWinInviteTypeEnum.monthSharedOrder);
|
| | | winInvite.setUid(uid);
|
| | | winInvite.setTeamUid(inviteeUid);
|
| | | winInvite.setType(RedPackWinInviteTypeEnum.threeStageReward);
|
| | | winInvite.setUid(bossId);
|
| | | winInvite.setTeamUid(teamUid);
|
| | | winInvite.setMoney(money);
|
| | | winInvite.setSource(source);
|
| | | winInvite.setOrderNo(orderNo);
|
| | | redPackWinInviteMapper.insertSelective(winInvite);
|
| | |
|
| | | // 4、增加红包
|
| | | redPackBalanceService.addRedPack(uid, money, RedPackDetailFactory.createSeriesReward(winInvite));
|
| | | redPackBalanceService.addRedPack(bossId, money, RedPackDetailFactory.createSeriesReward(winInvite));
|
| | |
|
| | | //消息
|
| | | MsgRedPackAddContentDTO dto = new MsgRedPackAddContentDTO();
|
| | | dto.setTitle("红包增加");
|
| | | dto.setMoney("¥" + money.setScale(2));
|
| | | dto.setBalance("¥" + redPackBalanceService.getBalance(uid).setScale(2));
|
| | | userMoneyMsgNotificationService.redPackMsg(uid, MsgTypeMoneyTypeEnum.redPackMonthSharedOrder,
|
| | | new Gson().toJson(dto), "请到“我的-红包”中查看");
|
| | | UserInfo userInfo = userInfoService.selectByPKey(teamUid);
|
| | | MsgRedPackTeamRewardContentDTO dto = new MsgRedPackTeamRewardContentDTO();
|
| | | dto.setNickName(userInfo.getNickName());
|
| | | dto.setPortrait(userInfo.getPortrait());
|
| | | userMoneyMsgNotificationService.teamRedPackRewardMsg(bossId, MsgTypeMoneyTypeEnum.redPackThreeStageReward,
|
| | | money, "队员(好友)完成第三阶段连续[第"+ monthSpace + "个月]", new Gson().toJson(dto));
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void inviteSucceedReward(Long uid) throws Exception{
|
| | | // 验证是否存在上级
|
| | | ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(uid, Constant.RED_PACK_REWARD_TIME);
|
| | | if (threeSale == null)
|
| | | return;
|
| | | // 上级id
|
| | | Long bossId = threeSale.getBoss().getId();
|
| | | |
| | | UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(bossId);
|
| | | if (activeLog == null)
|
| | | return;
|
| | | |
| | | // 小于2.0.2版本不增加
|
| | | if (!VersionUtil.greaterThan_2_1("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android",
|
| | | activeLog.getVersionCode()))
|
| | | return;
|
| | |
|
| | | // 同一队员奖励一次
|
| | | long totalReward = redPackWinInviteMapper.countByUidAndTeamUidAndType(bossId, uid, RedPackWinInviteTypeEnum.inviteSucceed.name());
|
| | | if (totalReward > 0)
|
| | | return;
|
| | | |
| | | // 1、绑定电话号码
|
| | | UserInfo userInfo = userInfoService.selectByPKey(uid);
|
| | | if (userInfo == null || StringUtil.isNullOrEmpty(userInfo.getPhone())) |
| | | return;
|
| | | |
| | | // 2、授权淘宝
|
| | | UserExtraTaoBaoInfo taoBaoInfo = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | if (taoBaoInfo == null || StringUtil.isNullOrEmpty(taoBaoInfo.getTaoBaoUid()))
|
| | | return;
|
| | | |
| | | |
| | | boolean finishTask = false;
|
| | | // 3.1、产生任意有效订单(无需到账)
|
| | | CommonOrder commonOrder = commonOrderService.selectLatestValidByUid(uid);
|
| | | if (commonOrder != null) |
| | | finishTask = true;
|
| | | |
| | | // 3.2、单位时间类累计产生≥200金币
|
| | | if (!finishTask) {
|
| | | long totalGoldCoin = integralTaskRecordService.getTotalGoldCoinByUid(uid);
|
| | | if (totalGoldCoin >= Constant.RED_PACK_GOLD_COIN)
|
| | | finishTask = true;
|
| | | }
|
| | | |
| | | // 3.3、成功邀请一个好友
|
| | | if (!finishTask) {
|
| | | long countTeam = threeSaleSerivce.countSuccessFirstTeam(uid);
|
| | | if (countTeam >= 1)
|
| | | finishTask = true;
|
| | | }
|
| | | |
| | | if (finishTask) {
|
| | | // 奖励金额
|
| | | BigDecimal money = new BigDecimal(redPackConfigService.getValueByKey("invite_succeed"));
|
| | | |
| | | // 获得红包记录
|
| | | RedPackWinInvite winInvite = new RedPackWinInvite();
|
| | | winInvite.setCreateTime(new Date());
|
| | | winInvite.setUpdateTime(new Date());
|
| | | winInvite.setType(RedPackWinInviteTypeEnum.inviteSucceed);
|
| | | winInvite.setUid(bossId);
|
| | | winInvite.setTeamUid(uid);
|
| | | winInvite.setMoney(money);
|
| | | redPackWinInviteMapper.insertSelective(winInvite);
|
| | | |
| | | // 增加红包
|
| | | redPackBalanceService.addRedPack(bossId, money, RedPackDetailFactory.createInvite(winInvite));
|
| | | |
| | | // 消息
|
| | | MsgRedPackAddContentDTO dto = new MsgRedPackAddContentDTO();
|
| | | dto.setTitle("红包增加");
|
| | | dto.setMoney("¥" + money.setScale(2));
|
| | | dto.setBalance("¥" + redPackBalanceService.getBalance(bossId).setScale(2));
|
| | | userMoneyMsgNotificationService.redPackMsg(bossId, MsgTypeMoneyTypeEnum.redPackInviteSucceed,
|
| | | new Gson().toJson(dto), "请到“我的-红包”中查看");
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.charge.FuLuChargeApiUtil;
|
| | | import com.yeshi.fanli.util.factory.RedPackDetailFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.util.wx.BanLiShopWXPayUtil;
|
| | |
|
| | |
| | | order.setMoneyPaymentState(BanLiShopOrder.PAY_STATE_REFUNDING);
|
| | | // 发送退款消息
|
| | | BanLiShopOrderMQMsg msg = new BanLiShopOrderMQMsg(order.getId(), order.getUid());
|
| | | Message message = new Message(MQTopicName.TOPIC_ORDER.name(),
|
| | | OrderTopicTagEnum.banLiShopOrderRefund.name(), new Gson().toJson(msg).getBytes());
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER,
|
| | | OrderTopicTagEnum.banLiShopOrderRefund, msg);
|
| | | message.setStartDeliverTime(System.currentTimeMillis() + 1000 * 60 * 5L);// 延时24小时通知检测微信退款状态
|
| | | SendResult result = producer.send(message);
|
| | | if (result == null) {
|
| | |
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.factory.RedPackDetailFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.util.shop.BanLiShopOrderUtil;
|
| | | import com.yeshi.fanli.util.wx.BanLiShopWXPayUtil;
|
| | |
| | |
|
| | | private void sendPlaceOrderMsg(Long orderId, Long uid) {
|
| | |
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.banLiShopOrderDelay.name(),
|
| | | new Gson().toJson(new BanLiShopOrderMQMsg(orderId, uid)).getBytes());
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.banLiShopOrderDelay,
|
| | | new BanLiShopOrderMQMsg(orderId, uid));
|
| | | msg.setKey(orderId + "");
|
| | | long delayTime = System.currentTimeMillis() + (Constant.IS_TEST ? 1000 * 30L : 1000 * 60 * 10);// 10分钟后通知
|
| | | msg.setStartDeliverTime(delayTime);
|
| | |
| | | if (isS)// 支付成功,重新发送支付成功消息
|
| | | {
|
| | | BanLiShopOrderMQMsg msg = new BanLiShopOrderMQMsg(order.getId(), order.getUid());
|
| | | Message message = new Message(MQTopicName.TOPIC_ORDER.name(),
|
| | | OrderTopicTagEnum.banLiShopOrderPaid.name(), new Gson().toJson(msg).getBytes());
|
| | | Message message =MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER,
|
| | | OrderTopicTagEnum.banLiShopOrderPaid,msg);
|
| | | producer.send(message);
|
| | | return;
|
| | | }
|
| | |
| | | if (order.getState() != BanLiShopOrder.STATE_PAID)
|
| | | throw new BanLiShopOrderException(1, "订单未处于待审核状态");
|
| | |
|
| | | Message message = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.banLiShopOrderRefund.name(),
|
| | | new Gson().toJson(new BanLiShopOrderMQMsg(order.getId(), order.getUid())).getBytes());
|
| | | Message message =MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.banLiShopOrderRefund,
|
| | | new BanLiShopOrderMQMsg(order.getId(), order.getUid()));
|
| | | try {
|
| | | orderTransactionProducer.send(message, new LocalTransactionExecuter() {
|
| | | @Override
|
| | |
| | | } finally {
|
| | | jedis.del(watchKey);
|
| | | jedis.unwatch();
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | | throw new UserAccountException(10, "请稍后再试");
|
| | | }
|
| | |
| | | } finally {
|
| | | jedis.del(watchKey);
|
| | | jedis.unwatch();
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | | throw new UserAccountException(10, "请稍后再试");
|
| | | }
|
| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.DateUtil;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.entity.FileUploadResult;
|
| | |
| | | }
|
| | |
|
| | | // 获取微信信息
|
| | | WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUser(code, wxAccount.getAppId(),
|
| | | wxAccount.getAppSecret());
|
| | | WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUser(code, wxAccount.getAppId(), wxAccount.getAppSecret());
|
| | | if (weiXinUser == null) {
|
| | | throw new UserInfoExtraException(1, "微信授权失败");
|
| | | }
|
| | |
| | | if (asInputStream == null) {
|
| | | LogHelper.test("微信头像下载失败: " +weiXinUser.getUnionid()+ " " + headimgurl);
|
| | | } else {
|
| | | FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream,
|
| | | String.format("/portrait/wx/%s_%s.jpg", weiXinUser.getUnionid(), System.currentTimeMillis() + ""));
|
| | | FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream, String.format(
|
| | | "/portrait/wx/%s_%s.jpg", weiXinUser.getUnionid(), System.currentTimeMillis() + ""));
|
| | | if (result != null && !StringUtil.isNullOrEmpty(result.getUrl())) {
|
| | | headimgurl = result.getUrl();
|
| | | } else {
|
| | |
| | | userInfoExtraMapper.insertSelective(userInfoExtra);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public void activeInviteWX(Long uid, WeiXinUser weiXinUser) throws UserInfoExtraException {
|
| | |
| | | if (asInputStream == null) {
|
| | | LogHelper.test("微信头像下载失败: " +weiXinUser.getUnionid()+ " " + headimgurl);
|
| | | } else {
|
| | | FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream,
|
| | | String.format("/portrait/wx/%s_%s.jpg", weiXinUser.getUnionid(), System.currentTimeMillis() + ""));
|
| | | FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream, String.format(
|
| | | "/portrait/wx/%s_%s.jpg", weiXinUser.getUnionid(), System.currentTimeMillis() + ""));
|
| | | if (result != null && !StringUtil.isNullOrEmpty(result.getUrl())) {
|
| | | headimgurl = result.getUrl();
|
| | | } else {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void updateActiveTime(Long uid, Date date) {
|
| | | UserInfoExtra userInfoExtra = new UserInfoExtra();
|
| | |
| | | userInfoExtra.setActiveTime(date);
|
| | | userInfoExtraMapper.updateInfoExtraByUid(userInfoExtra);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public UserInfoExtra getUserInfoExtra(Long uid) {
|
| | |
| | | public UserInfoExtra getUserALLInfo(Long uid) {
|
| | | return userInfoExtraMapper.gerUserRank(uid);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public UserInfoExtra getByUidForUpdate(Long uid) {
|
| | |
| | | public void updateAutoExtract(Integer days) {
|
| | | userInfoExtraMapper.updateAutoExtract(days);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void updateInviteCode(String inviteCode, Long uid) throws UserInfoExtraException {
|
| | | if (inviteCode.length() >= 6 && inviteCode.length() <= 12) {
|
| | | UserInfoExtra extra = getUserInfoExtra(uid);
|
| | | if (extra == null) {
|
| | | throw new UserInfoExtraException(2, "用户信息不存在");
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(extra.getInviteCode())) {
|
| | | throw new UserInfoExtraException(3, "邀请码尚未激活");
|
| | | }
|
| | |
|
| | | if (extra.getInviteCodeState() == null
|
| | | || extra.getInviteCodeState() != UserInfoExtra.INVITE_CODE_SATTE_VALID_NO_UPDATE) {
|
| | | throw new UserInfoExtraException(4, "只能修改一次");
|
| | | }
|
| | |
|
| | | if (inviteCode.equalsIgnoreCase(extra.getInviteCode())) {
|
| | | throw new UserInfoExtraException(5, "不能为原邀请码");
|
| | | }
|
| | | UserInfoExtra update = new UserInfoExtra();
|
| | | update.setId(extra.getId());
|
| | |
|
| | | extra = userInfoExtraMapper.selectByInviteCode(inviteCode);
|
| | | if (extra != null) {
|
| | | throw new UserInfoExtraException(6, "邀请码已存在");
|
| | | }
|
| | |
|
| | | update.setInviteCode(inviteCode);
|
| | | update.setInviteCodeState(UserInfoExtra.INVITE_CODE_SATTE_VALID_UPDATED);
|
| | | update.setUpdateTime(new Date());
|
| | | userInfoExtraMapper.updateByPrimaryKeySelective(update);
|
| | | } else {
|
| | | throw new UserInfoExtraException(1, "邀请码必须为6到12位");
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | @Service
|
| | |
| | | mqMsg = new UserAccountBindingMQMsg(uid, UserAccountBindingMQMsg.TYPE_ALIPAY, value,
|
| | | new Date());
|
| | | }
|
| | | Message message = new Message(MQTopicName.TOPIC_USER.name(),
|
| | | UserTopicTagEnum.userAccountBinding.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | Message message =MQMsgBodyFactory.create(MQTopicName.TOPIC_USER,
|
| | | UserTopicTagEnum.userAccountBinding,mqMsg);
|
| | | producer.send(message);
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.util.factory.msg.MsgOtherSystemGiveDTOFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | |
| | | UserSystemCouponUseMQMsg mqMsg = new UserSystemCouponUseMQMsg(userSystemCoupon.getId(), order.getOrderId(),
|
| | | sourceType, systemCoupon.getType().name());
|
| | | // 事务消息
|
| | | Message msg = new Message(MQTopicName.TOPIC_USER.name(), UserTopicTagEnum.useSystemCoupon.name(),
|
| | | new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg =MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.useSystemCoupon,
|
| | | mqMsg);
|
| | | try {
|
| | | SendResult result = orderTransactionProducer.send(msg, new LocalTransactionExecuter() {
|
| | | @Override
|
| | |
| | | UserSystemCouponUseMQMsg msg = new UserSystemCouponUseMQMsg();
|
| | | msg.setUserSystemCouponId(id);
|
| | | msg.setCouponType(type.name());
|
| | | Message message = new Message(MQTopicName.TOPIC_USER.name(), UserTopicTagEnum.systemCouponDrawback.name(),
|
| | | new Gson().toJson(msg).getBytes());
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.systemCouponDrawback,
|
| | | msg);
|
| | | try {
|
| | | producer.send(message);
|
| | | } catch (Exception e) {
|
| | |
| | | import org.springframework.context.annotation.Lazy;
|
| | | import org.springframework.scheduling.annotation.Async;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.ThreeSaleMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | import com.yeshi.fanli.entity.integral.IntegralTask.TaskUniqueKeyEnum;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskRank;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
|
| | | import com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord;
|
| | | import com.yeshi.fanli.exception.integral.IntegralGetException;
|
| | | import com.yeshi.fanli.exception.integral.IntegralTaskRecordException;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralTaskRankService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralTaskRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralTaskService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.UserGetIntegralFromOrderRecordService;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | | import com.yeshi.fanli.util.annotation.integral.IntegralGetFrequencyLimit;
|
| | | import com.yeshi.fanli.util.annotation.integral.IntegralGetVersionLimit;
|
| | | import com.yeshi.fanli.util.factory.integral.UserGetIntegralFromOrderRecordFactory;
|
| | |
|
| | | @Lazy
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private IntegralTaskRankService integralTaskRankService;
|
| | |
|
| | | @Resource
|
| | | private UserGetIntegralFromOrderRecordService userGetIntegralFromOrderRecordService;
|
| | |
|
| | | private UserInfo getBossByUid(Long uid) {
|
| | | return threeSaleMapper.selectBoss(uid);
|
| | |
| | | @IntegralGetVersionLimit(uid = "#uid")
|
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | @Async()
|
| | | @Transactional
|
| | | @Override
|
| | | public void addRebateOrder(Long uid) {
|
| | | public void addRebateOrder(Long uid, String orderNo, int sourceType) {
|
| | | try {
|
| | | addEventStatistic(uid, TaskUniqueKeyEnum.rebateOrder.name());
|
| | | IntegralTaskRecord record = addEventStatistic(uid, TaskUniqueKeyEnum.rebateOrder.name());
|
| | | if (record != null) {
|
| | | userGetIntegralFromOrderRecordService.addRecord(
|
| | | UserGetIntegralFromOrderRecordFactory.create(UserGetIntegralFromOrderRecord.TYPE_RECIEVE_MONEY,
|
| | | uid, orderNo, sourceType, record.getGoldCoin()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | //LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
| | | @IntegralGetVersionLimit(uid = "#uid")
|
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | @Async()
|
| | | @Transactional
|
| | | @Override
|
| | | public void addInviteOrderLevelOne(Long uid) {
|
| | | public void addInviteOrderLevelOne(Long uid, String orderNo, int sourceType) {
|
| | | try {
|
| | | addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelOne.name());
|
| | | IntegralTaskRecord record = addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelOne.name());
|
| | | if (record != null) {
|
| | | userGetIntegralFromOrderRecordService.addRecord(
|
| | | UserGetIntegralFromOrderRecordFactory.create(UserGetIntegralFromOrderRecord.TYPE_RECIEVE_MONEY,
|
| | | uid, orderNo, sourceType, record.getGoldCoin()));
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | //LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
| | | @IntegralGetVersionLimit(uid = "#uid")
|
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | @Async()
|
| | | @Transactional
|
| | | @Override
|
| | | public void addInviteOrderLevelTwo(Long uid) {
|
| | | public void addInviteOrderLevelTwo(Long uid, String orderNo, int sourceType) {
|
| | | try {
|
| | | addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelTwo.name());
|
| | | IntegralTaskRecord record = addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelTwo.name());
|
| | | if (record != null) {
|
| | | userGetIntegralFromOrderRecordService.addRecord(
|
| | | UserGetIntegralFromOrderRecordFactory.create(UserGetIntegralFromOrderRecord.TYPE_RECIEVE_MONEY,
|
| | | uid, orderNo, sourceType, record.getGoldCoin()));
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | //LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
| | | @IntegralGetVersionLimit(uid = "#uid")
|
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | @Async()
|
| | | @Transactional
|
| | | @Override
|
| | | public void addShareOrder(Long uid) {
|
| | | public void addShareOrder(Long uid, String orderNo, int sourceType) {
|
| | | try {
|
| | | addEventStatistic(uid, TaskUniqueKeyEnum.shareOrder.name());
|
| | | IntegralTaskRecord record = addEventStatistic(uid, TaskUniqueKeyEnum.shareOrder.name());
|
| | | if (record != null) {
|
| | | userGetIntegralFromOrderRecordService.addRecord(
|
| | | UserGetIntegralFromOrderRecordFactory.create(UserGetIntegralFromOrderRecord.TYPE_RECIEVE_MONEY,
|
| | | uid, orderNo, sourceType, record.getGoldCoin()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | //LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralTaskService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | @Service
|
| | |
| | | long count = integralTaskRecordMapper.getTotalGoldCoinByUid(record.getUid());
|
| | | if (count >= 200) {// 大于200发送消息
|
| | | IntegralTaskMQMsg msg = new IntegralTaskMQMsg(record.getUid(), count, new Date());
|
| | | Message message = new Message(MQTopicName.TOPIC_USER.name(), UserTopicTagEnum.integralTaskFinish.name(),
|
| | | new Gson().toJson(msg).getBytes());
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.integralTaskFinish,
|
| | | msg);
|
| | | producer.send(message);
|
| | | }
|
| | |
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
| | | private void inviteSuccess(Long bossId, Long workerId, ThreeSale threeSale) {
|
| | | // 邀请消息
|
| | | UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(bossId);
|
| | | if (activeLog != null) {
|
| | | if (VersionUtil.greaterThan_2_1("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android",
|
| | | activeLog.getVersionCode())) { // 2.0.2版本以上
|
| | | userInviteMsgNotificationService.inviteSuccess2_0_2(bossId, threeSale);
|
| | | } else { // 最初消息
|
| | | userInviteMsgNotificationService.inviteSuccess(threeSale.getBoss().getId(), threeSale);
|
| | | }
|
| | | if (activeLog != null && VersionUtil.greaterThan_2_1("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android",
|
| | | activeLog.getVersionCode())) { // 2.1版本以上
|
| | | userInviteMsgNotificationService.inviteSuccess2_1(bossId, threeSale);
|
| | | } else { // 最初消息
|
| | | userInviteMsgNotificationService.inviteSuccess(threeSale.getBoss().getId(), threeSale);
|
| | | }
|
| | |
| | | }
|
| | | });
|
| | | UserInviteMQMsg msg = new UserInviteMQMsg(bossId, workerId, null, new Date(), UserInviteMQMsg.STATE_SUCCESS);
|
| | | Message message = new Message(MQTopicName.TOPIC_USER.name(), UserTopicTagEnum.inviteSuccess.name(),
|
| | | new Gson().toJson(msg).getBytes());
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.inviteSuccess,
|
| | | msg);
|
| | | producer.send(message);
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user.invite;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.integral.UserGetIntegralFromOrderRecordMapper;
|
| | | import com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord;
|
| | | import com.yeshi.fanli.exception.integral.UserGetIntegralFromOrderRecordException;
|
| | | import com.yeshi.fanli.manager.util.AtomMethodCallInterface;
|
| | | import com.yeshi.fanli.manager.util.AtomMethodCallManager;
|
| | | import com.yeshi.fanli.service.inter.user.integral.UserGetIntegralFromOrderRecordService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import redis.clients.jedis.Jedis;
|
| | | import redis.clients.jedis.JedisPool;
|
| | |
|
| | | @Service
|
| | | public class UserGetIntegralFromOrderRecordServiceImpl implements UserGetIntegralFromOrderRecordService {
|
| | |
|
| | | @Resource
|
| | | private UserGetIntegralFromOrderRecordMapper userGetIntegralFromOrderRecordMapper;
|
| | |
|
| | | @Resource
|
| | | private AtomMethodCallManager atomMethodCallManager;
|
| | |
|
| | | @Override
|
| | | public long countByEventTypeAndUidAndOrderInfo(int eventType, Long uid, String orderNo, int orderSourceType) {
|
| | | UserGetIntegralFromOrderRecord record = new UserGetIntegralFromOrderRecord();
|
| | | record.setEventType(eventType);
|
| | | record.setOrderNo(orderNo);
|
| | | record.setOrderSourceType(orderSourceType);
|
| | | record.setUid(uid);
|
| | | return userGetIntegralFromOrderRecordMapper.countByRecordInfo(record);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void addRecord(UserGetIntegralFromOrderRecord record) throws UserGetIntegralFromOrderRecordException {
|
| | | if (record == null || record.getUid() == null || record.getEventType() == null
|
| | | || StringUtil.isNullOrEmpty(record.getOrderNo()) || record.getOrderSourceType() == null)
|
| | | throw new UserGetIntegralFromOrderRecordException(1, "信息不完整");
|
| | |
|
| | | String key = String.format("rs-%s",
|
| | | StringUtil.Md5(String.format("UserGetIntegralFromOrderRecord-addRecord-%s-%s-%s-%s", record.getUid(),
|
| | | record.getEventType(), record.getOrderNo(), record.getOrderSourceType())));
|
| | |
|
| | | atomMethodCallManager.excute(key, new AtomMethodCallInterface() {
|
| | |
|
| | | @Override
|
| | | public void excute() {
|
| | | long count = countByEventTypeAndUidAndOrderInfo(record.getEventType(), record.getUid(),
|
| | | record.getOrderNo(), record.getOrderSourceType());
|
| | | if (count > 0)
|
| | | return;
|
| | | if (record.getCreateTime() == null)
|
| | | record.setCreateTime(new Date());
|
| | | userGetIntegralFromOrderRecordMapper.insertSelective(record);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | public void inviteSuccess2_0_2(Long uid, ThreeSale sale) {
|
| | | MsgInviteDetail detail = MsgInviteDetailFactory.createInviteSuccess2_0_2(uid, sale);
|
| | | public void inviteSuccess2_1(Long uid, ThreeSale sale) {
|
| | | MsgInviteDetail detail = MsgInviteDetailFactory.createInviteSuccess2_1(uid, sale);
|
| | | msgInviteDetailService.insertSelective(detail);
|
| | | PushContentDTO dto = PushMsgFactory.createInviteTeamSuccess(new Date(), sale.getWorker().getNickName());
|
| | | try {
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user.vip;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPInfoMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | |
|
| | | @Service
|
| | | public class UserVIPInfoServiceImpl implements UserVIPInfoService {
|
| | |
|
| | | @Resource
|
| | | private UserVIPInfoMapper userVIPInfoMapper;
|
| | |
|
| | | @Override
|
| | | public void addUserVIPInfo(UserVIPInfo info) throws UserVIPInfoException {
|
| | | if (info.getId() == null) {
|
| | | throw new UserVIPInfoException(1, "信息不完整");
|
| | | }
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKey(info.getId());
|
| | | if (userInfo != null) {
|
| | | throw new UserVIPInfoException(1, "信息已存在");
|
| | | }
|
| | | // 初始化状态
|
| | | info.setState(UserVIPInfo.STATE_INVALID);
|
| | | info.setCreateTime(new Date());
|
| | | userVIPInfoMapper.insert(info);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void passVIPApply(Long uid) throws UserVIPInfoException {
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo == null) {
|
| | | throw new UserVIPInfoException(1, "用户信息不存在");
|
| | | }
|
| | | if (userInfo.getState() != UserVIPInfo.STATE_VERIFING) {
|
| | | throw new UserVIPInfoException(2, "申请未处于审核状态");
|
| | | }
|
| | |
|
| | | UserVIPInfo info = new UserVIPInfo();
|
| | | info.setId(userInfo.getId());
|
| | | info.setSuccessTime(new Date());
|
| | | info.setState(UserVIPInfo.STATE_SUCCESS);
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void rejectVIPApply(Long uid, String reason) throws UserVIPInfoException {
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo == null) {
|
| | | throw new UserVIPInfoException(1, "用户信息不存在");
|
| | | }
|
| | | if (userInfo.getState() != UserVIPInfo.STATE_VERIFING) {
|
| | | throw new UserVIPInfoException(2, "申请未处于审核状态");
|
| | | }
|
| | |
|
| | | UserVIPInfo info = new UserVIPInfo();
|
| | | info.setId(userInfo.getId());
|
| | | info.setState(UserVIPInfo.STATE_INVALID);
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void applyVIP(Long uid) throws UserVIPInfoException {
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo == null) {
|
| | | throw new UserVIPInfoException(1, "用户信息不存在");
|
| | | }
|
| | |
|
| | | if (userInfo.getState() != UserVIPInfo.STATE_INVALID) {
|
| | | throw new UserVIPInfoException(2, "已经申请过");
|
| | | }
|
| | |
|
| | | UserVIPInfo info = new UserVIPInfo();
|
| | | info.setId(userInfo.getId());
|
| | | info.setApplyTime(new Date());
|
| | | info.setState(UserVIPInfo.STATE_VERIFING);
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean isVIP(Long uid) {
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKey(uid);
|
| | | if (userInfo != null && userInfo.getState() == UserVIPInfo.STATE_SUCCESS)
|
| | | return true;
|
| | | else
|
| | | return false;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserVIPInfo selectByUid(Long uid) {
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKey(uid);
|
| | | return userInfo;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Map<Long, Boolean> listByUids(List<Long> uids) {
|
| | | if (uids == null || uids.size() == 0)
|
| | | return new HashMap<>();
|
| | | List<UserVIPInfo> infoList = userVIPInfoMapper.listByUids(uids);
|
| | | // 整理数据
|
| | | Map<Long, Boolean> map = new HashMap<>();
|
| | | if (infoList != null)
|
| | | for (UserVIPInfo info : infoList)
|
| | | if (info != null && info.getState() == UserVIPInfo.STATE_SUCCESS)
|
| | | map.put(info.getId(), true);
|
| | | else
|
| | | map.put(info.getId(), false);
|
| | | for (Long uid : uids) {
|
| | | if (map.get(uid) == null)
|
| | | map.put(uid, false);
|
| | | }
|
| | | return map;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | public long countAlreadyGetMoneyByUid(Long uid, List<Integer> typeList, Date minGetTime, Date maxGetTime);
|
| | |
|
| | | /**
|
| | | * 查询来源该下级成功分享奖金活动
|
| | | * @param uid
|
| | | * @param teamUid
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public BigDecimal getShareRewardByTeamUid(Long uid, Long teamUid, Date endTime);
|
| | |
|
| | | /**
|
| | | * 统计下级上个有效订单
|
| | | * @param uid
|
| | | * @param teamUid 下级id
|
| | | * @return
|
| | | */
|
| | | public BigDecimal getShareRewardByTeamUidLastMonth(Long uid, Long teamUid);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public void extractAuto(ExtractWeiXinRecord extractRecord, String stateDesc, String desc, String beiZhu);
|
| | |
|
| | | /**
|
| | | * 红包消息
|
| | | */
|
| | | public void redPackMsg(Long uid, MsgTypeMoneyTypeEnum type, String content, String beiZhu);
|
| | |
|
| | | /**
|
| | | * 补贴消息
|
| | |
| | | */
|
| | | public void inviteOrderSubSidy(Long uid, Date date, String from, BigDecimal money, BigDecimal balance);
|
| | |
|
| | | /**
|
| | | * 红包消息
|
| | | */
|
| | | public void redPackMsg(Long uid, MsgTypeMoneyTypeEnum type, String content, String beiZhu);
|
| | |
|
| | | /**
|
| | | * 红包消息-队友奖励
|
| | | */
|
| | | public void teamRedPackRewardMsg(Long uid, MsgTypeMoneyTypeEnum type, BigDecimal money, String stateDesc,String content);
|
| | | |
| | | }
|
| | |
| | | */
|
| | | public BigDecimal getTotalRewardMoneyByOrderNoAndSourceType(String orderNo, Integer sourceType);
|
| | |
|
| | | /**
|
| | | * 统计24小时有效自购订单
|
| | | * @param uid
|
| | | * @param minTime
|
| | | * @return
|
| | | */
|
| | | public long count24HValidOrderByUid(Long uid, Date minTime);
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.exception.order.HongBaoException;
|
| | | import com.yeshi.fanli.exception.user.UserAccountException;
|
| | |
|
| | | public interface HongBaoV2Service {
|
| | |
|
| | |
| | | * @return 0-未添加也未更新 1-只添加 2-只更新 12-有添加也有更新
|
| | | * @throws HongBaoException
|
| | | */
|
| | | public int addHongBao(List<CommonOrder> commonOrder, int type) throws HongBaoException;
|
| | | public int addHongBao(List<CommonOrder> commonOrder, int type) throws HongBaoException,UserAccountException ;
|
| | |
|
| | | /**
|
| | | * 奖金列表(1.4.9之前的版本)
|
| | |
| | |
|
| | | /**
|
| | | * 获取用户等级一级其他附加信息
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | * @throws UserInfoExtraException
|
| | |
| | |
|
| | | /**
|
| | | * 保存用户额外信息-新增或更新
|
| | | * |
| | | * @param userInfoExtra
|
| | | * @throws UserInfoExtraException
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 更新用户等级
|
| | | * @param uid 用户id
|
| | | * |
| | | * @param uid
|
| | | * 用户id
|
| | | * @return
|
| | | * @throws UserInfoExtraException
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 根据订单更新
|
| | | * |
| | | * @param userInfoExtra
|
| | | * @return
|
| | | * @throws UserInfoExtraException
|
| | |
| | |
|
| | | /**
|
| | | * 用户激活邀请码
|
| | | * |
| | | * @param uid
|
| | | * @param inviteCode
|
| | | * @return
|
| | |
| | |
|
| | | /**
|
| | | * 获取用户附加信息
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 获取用户邀请码,若没有且存在队员关系 那么自动生成邀请码
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | * @throws UserInfoExtraException
|
| | |
| | |
|
| | | /**
|
| | | * 获取用户额外信息全部衍生信息
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 微信邀请激活上级关系 1.5.3
|
| | | * |
| | | * @param uid
|
| | | * @param code
|
| | | * @throws UserInfoExtraException
|
| | |
| | |
|
| | | /**
|
| | | * 判断是否是新用户
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 创建额外信息
|
| | | * |
| | | * @param uid
|
| | | * @throws UserInfoExtraException
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 获取用户等级
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 根据邀请码查询用户
|
| | | * |
| | | * @param inviteCode
|
| | | * @return
|
| | | * @throws UserInfoExtraException
|
| | |
| | |
|
| | | /**
|
| | | * 获取邀请人关系信息
|
| | | * |
| | | * @param uid
|
| | | * @param code
|
| | | * @return
|
| | |
| | |
|
| | | /**
|
| | | * 更新信息 + 加锁
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 更新用户金币
|
| | | * |
| | | * @param id
|
| | | * @param goldCoin
|
| | | * @return
|
| | |
| | |
|
| | | /**
|
| | | * 新版邀请激活
|
| | | * |
| | | * @param uid
|
| | | * @param weiXinUser
|
| | | * @throws UserInfoExtraException
|
| | |
| | |
|
| | | /**
|
| | | * 根据用户id更新信息
|
| | | * |
| | | * @param userInfoExtra
|
| | | */
|
| | | public void updateActiveTime(Long uid, Date date);
|
| | |
|
| | | /**
|
| | | *开启自动提现: 更新超过期限的
|
| | | * |
| | | * @param days
|
| | | */
|
| | | public void updateAutoExtract(@Param("days")Integer days);
|
| | |
|
| | | /**
|
| | | * 返回用户所有相关额外信息
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public UserInfoExtra getUserALLInfo(Long uid);
|
| | |
|
| | | /**
|
| | | * 修改邀请码
|
| | | * |
| | | * @param inviteCode
|
| | | * @param uid
|
| | | * @throws UserInfoExtraException
|
| | | */
|
| | | public void updateInviteCode(String inviteCode, Long uid) throws UserInfoExtraException;
|
| | |
|
| | | }
|
| | |
| | | * 返利订单
|
| | | * @param uid
|
| | | */
|
| | | public void addRebateOrder(Long uid);
|
| | | public void addRebateOrder(Long uid,String orderNo,int sourceType);
|
| | |
|
| | | /**
|
| | | * 一级邀请订单
|
| | | * @param uid
|
| | | */
|
| | | public void addInviteOrderLevelOne(Long uid);
|
| | | public void addInviteOrderLevelOne(Long uid,String orderNo,int sourceType);
|
| | |
|
| | | /**
|
| | | * 二级邀请订单
|
| | | * @param uid
|
| | | */
|
| | | public void addInviteOrderLevelTwo(Long uid);
|
| | | public void addInviteOrderLevelTwo(Long uid,String orderNo,int sourceType);
|
| | |
|
| | |
|
| | | /**
|
| | | * 分享订单
|
| | | * @param uid
|
| | | */
|
| | | public void addShareOrder(Long uid);
|
| | | public void addShareOrder(Long uid,String orderNo,int sourceType);
|
| | |
|
| | | /**
|
| | | * 微信授权
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user.integral;
|
| | |
|
| | | import com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord;
|
| | | import com.yeshi.fanli.exception.integral.UserGetIntegralFromOrderRecordException;
|
| | |
|
| | | public interface UserGetIntegralFromOrderRecordService {
|
| | |
|
| | | /**
|
| | | * 根据事件类型,用户,订单信息检索
|
| | | * @param eventType
|
| | | * @param uid
|
| | | * @param orderNo
|
| | | * @param orderSourceType
|
| | | * @return
|
| | | */
|
| | | public long countByEventTypeAndUidAndOrderInfo(int eventType, Long uid, String orderNo, int orderSourceType);
|
| | |
|
| | | /**
|
| | | * |
| | | * @param record
|
| | | */
|
| | | public void addRecord(UserGetIntegralFromOrderRecord record) throws UserGetIntegralFromOrderRecordException;
|
| | |
|
| | | }
|
| | |
| | | * @param uid
|
| | | * @param sale
|
| | | */
|
| | | public void inviteSuccess2_0_2(Long uid, ThreeSale sale);
|
| | | public void inviteSuccess2_1(Long uid, ThreeSale sale);
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user.vip;
|
| | |
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
|
| | |
|
| | | /**
|
| | | * VIP用户服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface UserVIPInfoService {
|
| | |
|
| | | /**
|
| | | * 添加用户VIP信息
|
| | | * |
| | | * @param info
|
| | | * @throws UserVIPInfoException
|
| | | */
|
| | | public void addUserVIPInfo(UserVIPInfo info) throws UserVIPInfoException;
|
| | |
|
| | | /**
|
| | | * 申请VIP
|
| | | * |
| | | * @param uid
|
| | | * @throws UserVIPInfoException
|
| | | */
|
| | | public void applyVIP(Long uid) throws UserVIPInfoException;
|
| | |
|
| | | /**
|
| | | * 通过vip申请
|
| | | * |
| | | * @param uid
|
| | | */
|
| | | public void passVIPApply(Long uid) throws UserVIPInfoException;
|
| | |
|
| | | /**
|
| | | * 拒绝申请
|
| | | * |
| | | * @param uid
|
| | | * @param reason
|
| | | */
|
| | | public void rejectVIPApply(Long uid, String reason) throws UserVIPInfoException;
|
| | |
|
| | | /**
|
| | | * 是否为VIP
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public boolean isVIP(Long uid);
|
| | |
|
| | | /**
|
| | | * 根据UID检索
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public UserVIPInfo selectByUid(Long uid);
|
| | |
|
| | | /**
|
| | | * 批量查询是否为VIP
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public Map<Long,Boolean> listByUids(List<Long> uid);
|
| | |
|
| | | }
|
| | |
| | | public static final int AUTO_EXTRACT_MIN_SURPLUS = 2;
|
| | |
|
| | |
|
| | | // 红包奖励-到账奖励不低于5元
|
| | | public static final BigDecimal RED_PACK_ORDER_REWARD_MIN = new BigDecimal("5");
|
| | | // 红包奖励随机范围
|
| | | public static final double RED_PACK_RANDOM_MIN = 0.5;
|
| | | public static final double RED_PACK_RANDOM_MAX = 2;
|
| | | // 红包奖励订单实付款最低
|
| | | public static final BigDecimal RED_PACK_PAY_MIN = new BigDecimal("10");
|
| | | // 红包奖励分享订单连续奖励月数
|
| | | public static final int RED_PACK_REWARD_MONTH = 15;
|
| | | // 红包奖励-单位时间类累计产生≥200金币
|
| | | public static final long RED_PACK_GOLD_COIN = 200;
|
| | | // 红包奖励-邀请时间筛选 2019-11-14 11:51:43
|
| | | public static final long RED_PACK_REWARD_TIME = 1573703503000L;
|
| | | // 一阶段:20天数限制 |
| | | public static final int ONE_STAGE_LIMIT_DAYS = 20;
|
| | | // 一阶段:立得现金3元 |
| | | public static final BigDecimal ONE_STAGE_MONEY = new BigDecimal("3");
|
| | | |
| | | // 二阶段:90天数限制 |
| | | public static final int TWO_STAGE_LIMIT_DAYS = 90;
|
| | | // 二阶段:-队友产生的订单中(自购+分享),邀请人累计产生≥1 元奖金 |
| | | public static final BigDecimal TWO_STAGE_ORDER_REWARD_MIN = new BigDecimal("1");
|
| | | // 二阶段: 红包金额最少3元
|
| | | public static final BigDecimal TWO_STAGE_MONEY_MIN = new BigDecimal("3");
|
| | | // 二阶段:每次最多增加0.5 |
| | | public static final BigDecimal TWO_STAGE_MONEY_ADD = new BigDecimal("0.5");
|
| | | // 二阶段: 增加9次
|
| | | public static final int TWO_STAGE_MONEY_ADD_NUM = 9; |
| | | |
| | | // 三阶段:连续奖励月数
|
| | | public static final int THREE_STAGE_REWARD_MONTH = 15;
|
| | | // 三阶段:-连续 15 个月好友每月“给你累计产生≥2 元奖 金” |
| | | public static final BigDecimal THREE_STAGE_ORDER_REWARD_MIN = new BigDecimal("2");
|
| | | // 三阶段:红包奖励随机范围
|
| | | public static final double THREE_STAGE_RANDOM_MIN = 1.5;
|
| | | public static final double THREE_STAGE_RANDOM_MAX = 2;
|
| | |
|
| | | // 新人奖励连续天数
|
| | | public static final long RED_PACK_NEW_USER_DAYS = 7;
|
| | |
| | | import net.sf.json.JSONArray;
|
| | | import redis.clients.jedis.Jedis;
|
| | | import redis.clients.jedis.JedisPool;
|
| | | import redis.clients.jedis.params.SetParams;
|
| | |
|
| | | //抢红包采用的redis
|
| | | @Component
|
| | |
| | | */
|
| | | private void setString(String key, String value) {
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | SetParams params=new SetParams().nx().ex(60);
|
| | | jedis.set(key, value, params);
|
| | | try {
|
| | | jedis.set(key, value);
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | try {
|
| | | jedis.del(key);
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | try {
|
| | | jedis.setex(key, seconds, value);
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | try {
|
| | | return jedis.get(key);
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | try {
|
| | | jedis.incr(key);
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | try {
|
| | | jedis.expire(key, seconds);
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | else
|
| | | return false;
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | else
|
| | | return false;
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | jedis.close();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | private void fanliGetIntegral(HongBaoV2 hongBaoV2) {
|
| | | if (hongBaoV2 != null && hongBaoV2.getState() == HongBaoV2.STATE_YILINGQU
|
| | | && hongBaoV2.getMoney().compareTo(new BigDecimal(0)) > 0) {
|
| | | // 查询对应的订单号
|
| | | Long mainHongBaoId = hongBaoV2.getId();
|
| | | if (hongBaoV2.getParent() != null && hongBaoV2.getParent().getId() != null)
|
| | | mainHongBaoId = hongBaoV2.getParent().getId();
|
| | |
|
| | | HongBaoOrder hongbaoOrder = hongBaoOrderService.selectDetailByHongBaoId(mainHongBaoId);
|
| | | if (hongbaoOrder == null || hongbaoOrder.getCommonOrder() == null)
|
| | | return;
|
| | | CommonOrder commonOrder = hongbaoOrder.getCommonOrder();
|
| | |
|
| | | if (hongBaoV2.getType() == HongBaoV2.TYPE_ZIGOU) {// 自购订单
|
| | | integralGetService.addRebateOrder(hongBaoV2.getUserInfo().getId());
|
| | | integralGetService.addRebateOrder(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
|
| | | commonOrder.getSourceType());
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_GOODS) {// 分享订单
|
| | | integralGetService.addShareOrder(hongBaoV2.getUserInfo().getId());
|
| | | integralGetService.addShareOrder(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
|
| | | commonOrder.getSourceType());
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_YIJI || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_YIJI) {// 一级邀请
|
| | | integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId());
|
| | | integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
|
| | | commonOrder.getSourceType());
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_ERJI || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_ERJI) {// 二级邀请
|
| | | integralGetService.addInviteOrderLevelTwo(hongBaoV2.getUserInfo().getId());
|
| | | integralGetService.addInviteOrderLevelTwo(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
|
| | | commonOrder.getSourceType());
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | public static boolean greaterThan_2_1(String platform, String versionCode) {
|
| | | if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 52))
|
| | | || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 71)))
|
| | | || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 75)))
|
| | | return true;
|
| | | else
|
| | | return false;
|
| | |
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | public static DaTaoKeDetailV2 getGoodsDetailByGoodsId(Long goodsId) {
|
| | | TaoKeAppInfo app = getRandomApp();
|
| | | Map<String, String> params = new TreeMap<>();
|
| | | params.put("version", "v1.1.1");
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("goodsId", goodsId + "");
|
| | | params.put("sign", getSign(params, app.getAppSecret()));
|
| | | String result = HttpUtil.get("https://openapi.dataoke.com/api/goods/get-goods-details", params,
|
| | | new HashMap<>());
|
| | | System.out.println(result);
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | | JSONObject dataJson = json.optJSONObject("data");
|
| | | if (dataJson != null) {
|
| | | return parseDaTaoKeDetailV2(dataJson);
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static DaTaoKeGoodsResult search(String key, List<Integer> cidList, BigDecimal priceLowerLimit,
|
| | | BigDecimal priceUpperLimit, int page, int pageSize, Integer sort) {
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | |
|
| | | public class CommonGoodsFactory {
|
| | |
|
| | |
| | | return null;
|
| | |
|
| | | CommonGoods cg = new CommonGoods();
|
| | | JDCouponInfo couponInfo = goods.getCouponInfo();
|
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods);
|
| | | if (couponInfo != null) {
|
| | | cg.setCouponStartPrice(couponInfo.getQuota());
|
| | | BigDecimal discount = couponInfo.getDiscount();
|
| | |
| | | TaoBaoHongBaoInfo taoBaoHongBaoInfo = goods.getTaoBaoHongBaoInfo();
|
| | | moneyInfoVO.setFanliMoney("¥" + taoBaoHongBaoInfo.getHongbao());
|
| | | moneyInfoVO.setShareMoney("¥" + taoBaoHongBaoInfo.getHongbao());
|
| | | moneyInfoVO.setMaxMoney("¥" + taoBaoHongBaoInfo.getHongbao().add(MoneyBigDecimalUtil.mul(taoBaoHongBaoInfo.getHongbao(), params.getMaxRewardRate())));
|
| | | moneyInfoVO.setMaxMoney("¥" + taoBaoHongBaoInfo.getHongbao()
|
| | | .add(MoneyBigDecimalUtil.mul(taoBaoHongBaoInfo.getHongbao(), params.getMaxRewardRate())));
|
| | | } else {
|
| | | BigDecimal commission = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getFanLiRate());
|
| | | moneyInfoVO.setFanliMoney("¥" + commission);
|
| | | moneyInfoVO.setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | moneyInfoVO
|
| | | .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | moneyInfoVO.setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, params.getShareRate()));
|
| | | }
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | |
| | | moneyInfoVO.setShareMoney("¥" + JDUtil.getGoodsFanLiMoney(goods, params.getShareRate()));
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | |
|
| | | JDCouponInfo couponInfo = goods.getCouponInfo();
|
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods);
|
| | | if (couponInfo != null) {
|
| | | BigDecimal discount = couponInfo.getDiscount();
|
| | | // 计算券后价
|
| | |
| | | shop.setUserType(30);
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | |
|
| | |
|
| | | // if (Constant.IS_TEST) {
|
| | | // // 添加标签
|
New file |
| | |
| | | package com.yeshi.fanli.util.factory.integral;
|
| | |
|
| | | import com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord;
|
| | |
|
| | | public class UserGetIntegralFromOrderRecordFactory {
|
| | |
|
| | | public static UserGetIntegralFromOrderRecord create(int eventType, Long uid, String orderNo, int sourceType,int integralCount) {
|
| | | UserGetIntegralFromOrderRecord record=new UserGetIntegralFromOrderRecord();
|
| | | record.setEventType(eventType);
|
| | | record.setIntegralCount(integralCount);
|
| | | record.setUid(uid);
|
| | | record.setOrderSourceType(sourceType);
|
| | | record.setOrderNo(orderNo);
|
| | | return record;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail createInviteSuccess2_0_2(Long uid, ThreeSale threeSale) {
|
| | | public static MsgInviteDetail createInviteSuccess2_1(Long uid, ThreeSale threeSale) {
|
| | | if (threeSale == null || uid == null)
|
| | | return null;
|
| | |
|
| | | MsgInviteContentDTO content = new MsgInviteContentDTO();
|
| | | content.setMode("必要条件+选择条件(三选一) ");
|
| | | content.setCode("队员绑定电话号码+授权淘宝 ");
|
| | | content.setState("成功邀请一个队员,队员熟练使用App还可获得红包 ");
|
| | | content.setInviter("1.产生累计≥200金币/2.任意订单/3.成功邀请一个队员");
|
| | | |
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | detail.setBeiZhu("满足获得红包条件后系统将自动下发到“我的-红包”中");
|
| | | detail.setInviteUser(threeSale);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setDesc(new Gson().toJson(content));
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.inviteNew);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setInviteUser(threeSale);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.inviteSucceed);
|
| | | detail.setDesc("队员(好友)熟练使用App可获得红包");
|
| | | detail.setBeiZhu("满足获得红包条件后系统将自动下发到“我的-红包”中");
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.StringUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | public class MsgMoneyDetailFactory {
|
| | |
|
| | |
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 红包相关信息
|
| | | * @param uid
|
| | | * @param type
|
| | | * @param content
|
| | | * @param beiZhu
|
| | | * @return
|
| | | */
|
| | | public static MsgMoneyDetail createRedPackMsg(Long uid, MsgTypeMoneyTypeEnum type, String content, String beiZhu) {
|
| | | if (uid == null || type == null || StringUtil.isNullOrEmpty(content))
|
| | | return null;
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setRead(false);
|
| | | detail.setContent(content);
|
| | | detail.setMsgType(type);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 邀请订单补贴
|
| | |
| | | return detail;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 红包相关信息
|
| | | * @param uid
|
| | | * @param type
|
| | | * @param content
|
| | | * @param beiZhu
|
| | | * @return
|
| | | */
|
| | | public static MsgMoneyDetail createRedPackMsg(Long uid, MsgTypeMoneyTypeEnum type, String content, String beiZhu) {
|
| | | if (uid == null || type == null || StringUtil.isNullOrEmpty(content))
|
| | | return null;
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setRead(false);
|
| | | detail.setContent(content);
|
| | | detail.setMsgType(type);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | return detail;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dto.msg.MsgOtherRewardIntegralDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherSystemGiveDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgRedPackAddContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgRedPackExchangeContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgRedPackGiveContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgRedPackTeamRewardContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgRedPackUseContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
|
| | |
| | |
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_hongbao_tixian.png", dto.getTitle(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackNewUserReward
|
| | | || msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackInviteSucceed
|
| | | || msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackFirstSharedOrder
|
| | | || msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackMonthSharedOrder) { // 红包邀请获得
|
| | | } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackOneStageReward
|
| | | || msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackTwoStageReward
|
| | | || msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackThreeStageReward) { // 红包邀请获得
|
| | | if (StringUtil.isNullOrEmpty(msg.getContent()))
|
| | | return null;
|
| | |
|
| | | MsgRedPackAddContentDTO dto = new Gson().fromJson(msg.getContent(), MsgRedPackAddContentDTO.class);
|
| | | MsgRedPackTeamRewardContentDTO dto = new Gson().fromJson(msg.getContent(), MsgRedPackTeamRewardContentDTO.class);
|
| | | if (dto == null)
|
| | | return null;
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getMsgType().getDesc() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("增加原因", COLOR_TITLE), contentList));
|
| | | contentList.add(new ClientTextStyleVO(dto.getNickName() + "", COLOR_CONTENT,dto.getPortrait()));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("被邀请人", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getMoney() + "", COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("金 额", COLOR_TITLE), contentList));
|
| | | contentList.add(new ClientTextStyleVO(msg.getStateDesc(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("红包进程", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getBalance() + "", COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("红包余额", COLOR_TITLE), contentList));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "", COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("红包金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备 注", COLOR_TITLE), contentList));
|
| | |
|
| | | return new UserMsgVO("http://img.flqapp.com/img/tlj/icon_tlj.png", dto.getTitle(),
|
| | | return new UserMsgVO("http://img.flqapp.com/img/tlj/icon_tlj.png", "红包提醒",
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackUseSuccess) { // 红包使用成功
|
| | | if (StringUtil.isNullOrEmpty(msg.getContent()))
|
| | |
| | |
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite.png", dto.getTitle(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | } else if (msgType == MsgTypeInviteTypeEnum.inviteNew) {
|
| | | if (StringUtil.isNullOrEmpty(msg.getDesc()))
|
| | | return null;
|
| | |
|
| | | MsgInviteContentDTO dto = new Gson().fromJson(msg.getDesc(), MsgInviteContentDTO.class);
|
| | | if (dto == null)
|
| | | } else if (msgType == MsgTypeInviteTypeEnum.inviteSucceed) {
|
| | | if (msg.getInviteUser() == null || msg.getInviteUser().getWorker() == null)
|
| | | return null;
|
| | |
|
| | | List<CommonMsgItemVO> items = new ArrayList<>();
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("被邀请人", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getState() + "", COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("邀请队员成功", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请状态", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getMode() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("熟练使用", COLOR_TITLE), contentList));
|
| | | |
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getCode() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("必要条件", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getInviter() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("选择条件", COLOR_TITLE), contentList));
|
| | | contentList.add(new ClientTextStyleVO(msg.getDesc() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("红包相关", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | |
| | | import java.net.URLEncoder;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.Comparator;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | |
| | |
|
| | | import org.apache.commons.httpclient.HttpClient;
|
| | | import org.apache.commons.httpclient.methods.PostMethod;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | |
| | | return searchResult;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 解析京东的券信息
|
| | | * |
| | | * @param json
|
| | | * @return
|
| | | */
|
| | | private static JDCouponInfo parseJDCouponInfo(JSONObject json) {
|
| | | JDCouponInfo couponInfo = new Gson().fromJson(json.toString(), JDCouponInfo.class);
|
| | | return couponInfo;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 解析京东商品信息
|
| | | * |
| | | * @param json
|
| | | * @return
|
| | | */
|
| | |
|
| | | private static JDGoods parseJDGoods(JSONObject json) {
|
| | | JDGoods goods = new JDGoods();
|
| | |
|
| | |
| | | JSONObject couponJson = JSONObject.fromObject(coupon);
|
| | | JSONArray couponArray = couponJson.optJSONArray("couponList");
|
| | | if (couponArray != null) {
|
| | | BigDecimal discount_temp = null;
|
| | | JDCouponInfo couponInfo = null;
|
| | | List<JDCouponInfo> couponInfoList = new ArrayList<>();
|
| | | for (int i = 0; i < couponArray.size(); i++) {
|
| | | boolean add = false;
|
| | | JSONObject jdcoupon = couponArray.optJSONObject(i);
|
| | |
|
| | | BigDecimal quota = new BigDecimal(jdcoupon.optString("quota"));
|
| | | BigDecimal sub = MoneyBigDecimalUtil.sub(price, quota);
|
| | | if (sub.compareTo(new BigDecimal(0)) < 0) {
|
| | | continue; // 商品价格小于优惠券价格限制
|
| | | JDCouponInfo couponInfo = parseJDCouponInfo(couponArray.optJSONObject(i));
|
| | | if (couponInfo != null)
|
| | | couponInfoList.add(couponInfo);
|
| | | }
|
| | |
|
| | | // 券面额
|
| | | BigDecimal discount = new BigDecimal(jdcoupon.optString("discount"));
|
| | | if (discount_temp == null) {
|
| | | add = true;
|
| | | discount_temp = discount;
|
| | | } else if (discount_temp.compareTo(discount) < 0 && discount.compareTo(price) <= 0) { |
| | | add = true; // 券面额大,且券能够使用
|
| | | // 根据消费条件排序
|
| | | Comparator<JDCouponInfo> cm = new Comparator<JDCouponInfo>() {
|
| | | @Override
|
| | | public int compare(JDCouponInfo o1, JDCouponInfo o2) {
|
| | | return o1.getQuota().compareTo(o2.getQuota());
|
| | | }
|
| | | };
|
| | | Collections.sort(couponInfoList, cm);
|
| | | // if (couponInfoList.size() > 0) {
|
| | | // // 设置券信息为最接近的一个
|
| | | // for (int i = couponInfoList.size() - 1; i >= 0; i--) {
|
| | | // if (couponInfoList.get(i).getQuota().compareTo(goods.getPrice()) <= 0) {
|
| | | // goods.setCouponInfo(couponInfoList.get(i));
|
| | | // break;
|
| | | // }
|
| | | // }
|
| | | // if (goods.getCouponInfo() == null)
|
| | | // goods.setCouponInfo(couponInfoList.get(0));
|
| | | // }
|
| | | // |
| | | goods.setCouponInfoList(couponInfoList);
|
| | |
|
| | | if (add) {
|
| | | if (couponInfo == null) {
|
| | | couponInfo = new JDCouponInfo();
|
| | | }
|
| | |
|
| | | couponInfo.setBindType(jdcoupon.optInt("bindType"));
|
| | | couponInfo.setDiscount(new BigDecimal(jdcoupon.optString("discount")));
|
| | | couponInfo.setQuota(new BigDecimal(jdcoupon.optString("quota")));
|
| | | couponInfo.setPlatformType(jdcoupon.optInt("platformType"));
|
| | | couponInfo.setGetEndTime(jdcoupon.optLong("getEndTime"));
|
| | | couponInfo.setGetStartTime(jdcoupon.optLong("getStartTime"));
|
| | | couponInfo.setUseEndTime(jdcoupon.optLong("useEndTime"));
|
| | | couponInfo.setUseStartTime(jdcoupon.optLong("useStartTime"));
|
| | | couponInfo.setLink(jdcoupon.optString("link"));
|
| | | }
|
| | | }
|
| | |
|
| | | goods.setCouponInfo(couponInfo);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | goods.setInOrderCount30Days(Long.parseLong(inOrderCount));
|
| | | }
|
| | |
|
| | | goods.setCouponInfo(null);
|
| | | goods.setGoodCommentsShare(null);
|
| | | List<String> imageList = new ArrayList<>();
|
| | | imageList.add(json.optString("imgUrl"));
|
| | |
| | | import java.math.BigDecimal;
|
| | | import java.net.URLEncoder;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.Comparator;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
| | | BigDecimal finalPriceDecimal = new BigDecimal(json.optString("finalPrice"));
|
| | | if (finalPriceDecimal != null && json.optString("hasCoupon") != null && json.optInt("hasCoupon") == 1
|
| | | && json.optInt("couponRemainCnt") > 0) {
|
| | | List<JDCouponInfo> couponList = new ArrayList<>();
|
| | | JDCouponInfo coupon = new JDCouponInfo();
|
| | | coupon.setDiscount(new BigDecimal(json.optString("couponDiscount")));
|
| | | coupon.setQuota(new BigDecimal(json.optString("couponQuota")));
|
| | | coupon.setLink("https:" + json.optString("couponLink"));
|
| | | goods.setCouponInfo(coupon);
|
| | | couponList.add(coupon);
|
| | | goods.setCouponInfoList(couponList);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | price = pinGouInfo.getPingouPrice();
|
| | | }
|
| | |
|
| | | JDCouponInfo couponInfo = goods.getCouponInfo();
|
| | | JDCouponInfo couponInfo = getShowCouponInfo(goods.getCouponInfoList(), price);
|
| | | if (couponInfo == null) {
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil
|
| | | .mul(MoneyBigDecimalUtil.mul(price, commissionInfo.getCommissionShare()), new BigDecimal("0.01")),
|
| | |
| | | return BigDecimalUtil.getWithNoZera(MoneyBigDecimalUtil.mul(money, new BigDecimal("0.9")));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 商品佣金计算
|
| | | *
|
| | |
| | | return money;
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | BigDecimal price = null;
|
| | | JDPingouInfo pinGouInfo = goods.getPinGouInfo();
|
| | | if (pinGouInfo == null) {
|
| | |
| | | price = pinGouInfo.getPingouPrice();
|
| | | }
|
| | |
|
| | | JDCouponInfo couponInfo = goods.getCouponInfo();
|
| | | JDCouponInfo couponInfo = getShowCouponInfo(goods.getCouponInfoList(), price);
|
| | | if (couponInfo == null) {
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil
|
| | | .mul(MoneyBigDecimalUtil.mul(price, commissionPlus), new BigDecimal("0.01")),
|
| | | money = MoneyBigDecimalUtil.mul(
|
| | | MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(price, commissionPlus), new BigDecimal("0.01")),
|
| | | MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | | } else {
|
| | | BigDecimal quota = couponInfo.getQuota();
|
| | |
| | | if (quota.compareTo(price) <= 0 && price.compareTo(discount) > 0) {
|
| | |
|
| | | BigDecimal finalPrice = price.subtract(discount);
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(
|
| | | MoneyBigDecimalUtil.mul(finalPrice, commissionPlus),
|
| | | new BigDecimal("0.01")), MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil
|
| | | .mul(MoneyBigDecimalUtil.mul(finalPrice, commissionPlus), new BigDecimal("0.01")),
|
| | | MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | |
|
| | | } else {// 不能用券
|
| | | money = MoneyBigDecimalUtil.mul(
|
| | | MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(price,commissionPlus),
|
| | | new BigDecimal("0.01")),
|
| | | MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(price, commissionPlus), new BigDecimal("0.01")),
|
| | | MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | | }
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public static BigDecimal getQuanPrice(JDGoods jdGoods) {
|
| | | JDCouponInfo couponInfo = jdGoods.getCouponInfo();
|
| | | if (couponInfo == null) {
|
| | | return jdGoods.getPrice();
|
| | | }
|
| | |
|
| | | BigDecimal discount = couponInfo.getDiscount();
|
| | | BigDecimal price = null;
|
| | | JDPingouInfo pinGouInfo = jdGoods.getPinGouInfo();
|
| | | if (pinGouInfo == null) {
|
| | |
| | | } else {
|
| | | price = pinGouInfo.getPingouPrice();
|
| | | }
|
| | | JDCouponInfo couponInfo = getShowCouponInfo(jdGoods.getCouponInfoList(), price);
|
| | | if (couponInfo == null) {
|
| | | return jdGoods.getPrice();
|
| | | }
|
| | |
|
| | | BigDecimal discount = couponInfo.getDiscount();
|
| | | // 计算券后价
|
| | | BigDecimal sub = price.subtract(couponInfo.getQuota());
|
| | | if (sub.compareTo(BigDecimal.valueOf(0)) >= 0) {
|
| | |
| | | return jdGoods;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取类目
|
| | | * @param level 等级
|
| | | * @param parentId 上级id
|
| | | * |
| | | * @param level
|
| | | * 等级
|
| | | * @param parentId
|
| | | * 上级id
|
| | | * @return
|
| | | */
|
| | | public static List<GoodsClassDTO> getCategoryList(int level, int parentId) {
|
| | |
| | |
|
| | | /**
|
| | | * 获取类目
|
| | | * @param level 等级
|
| | | * @param parentId 上级id
|
| | | * |
| | | * @param level
|
| | | * 等级
|
| | | * @param parentId
|
| | | * 上级id
|
| | | * @return
|
| | | */
|
| | | public static List<GoodsClassDTO> getCategoryCommiPlus(int level, int parentId) {
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取需要展示的券
|
| | | * |
| | | * @param couponInfoList
|
| | | * 券列表
|
| | | * @param price
|
| | | * 商品价格
|
| | | * @return
|
| | | */
|
| | | public static JDCouponInfo getShowCouponInfo(List<JDCouponInfo> couponInfoList, BigDecimal price) {
|
| | | if (couponInfoList != null && couponInfoList.size() > 0) {
|
| | | // 根据消费条件排序
|
| | | Comparator<JDCouponInfo> cm = new Comparator<JDCouponInfo>() {
|
| | | @Override
|
| | | public int compare(JDCouponInfo o1, JDCouponInfo o2) {
|
| | | return o1.getQuota().compareTo(o2.getQuota());
|
| | | }
|
| | | };
|
| | | Collections.sort(couponInfoList, cm);
|
| | |
|
| | | // 设置券信息为最接近的一个
|
| | | for (int i = couponInfoList.size() - 1; i >= 0; i--) {
|
| | | if (couponInfoList.get(i).getQuota().compareTo(price) <= 0) {
|
| | | return couponInfoList.get(i);
|
| | | }
|
| | | }
|
| | | return couponInfoList.get(0);
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static JDCouponInfo getShowCouponInfo(JDGoods goods) {
|
| | | if (goods == null)
|
| | | return null;
|
| | | BigDecimal price = null;
|
| | | JDPingouInfo pinGouInfo = goods.getPinGouInfo();
|
| | | if (pinGouInfo == null) {
|
| | | price = goods.getPrice();
|
| | | } else {
|
| | | price = pinGouInfo.getPingouPrice();
|
| | | }
|
| | | return getShowCouponInfo(goods.getCouponInfoList(), price);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.rocketmq;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | |
|
| | | public class MQMsgBodyFactory {
|
| | | |
| | | public static Message create(MQTopicName topic,OrderTopicTagEnum tag,Object body){
|
| | | return new Message(topic.name(), tag.name(), new Gson().toJson(body).getBytes());
|
| | | }
|
| | | |
| | | public static Message create(MQTopicName topic,UserTopicTagEnum tag,Object body){
|
| | | return new Message(topic.name(), tag.name(), new Gson().toJson(body).getBytes());
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dto.mq.user.body.UserSystemCouponUseMQMsg;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | @Component
|
New file |
| | |
| | | package com.yeshi.fanli.util.rocketmq.consumer.integral;
|
| | |
|
| | | 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.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | /**
|
| | | * 金币消息监听
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class IntegralMessageListener implements MessageListener {
|
| | | public IntegralMessageListener() {
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | |
|
| | | LogHelper.mqInfo("consumer:IntegralMessageListener", message.getMsgID(), message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | String tag = message.getTag();
|
| | |
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (OrderTopicTagEnum.orderFanLiActual.name().equalsIgnoreCase(tag)) {// 实时到账
|
| | | OrderMoneyRecievedMQMsg msg = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (msg != null && msg.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {// 自购到账
|
| | | // 得金币
|
| | | } else if (msg != null && msg.getType() == OrderMoneyRecievedMQMsg.TYPE_SHARE) {// 分享订单
|
| | |
|
| | | } else if (msg != null && msg.getType() == OrderMoneyRecievedMQMsg.TYPE_INVITE) {// 邀请订单
|
| | |
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.MessageListener;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.BanLiShopOrderMQMsg;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | |
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderPayService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | /**
|
| | |
| | | import com.yeshi.fanli.service.inter.order.OrderMoneySettleService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | private boolean sendOrderSubsidyUpdateLater(OrderMoneyRecievedMQMsg dto, int day) {
|
| | |
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiDelay.name(),
|
| | | new Gson().toJson(dto).getBytes());
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiDelay,
|
| | | dto);
|
| | | msg.setKey(dto.getSourceType() + "_" + dto.getOrderId());
|
| | | long delayTime = System.currentTimeMillis() + (Constant.IS_TEST ? 1000 * 30L : 1000 * 60 * 60 * 24L * day);
|
| | | msg.setStartDeliverTime(delayTime);
|
New file |
| | |
| | | package com.yeshi.fanli.util.rocketmq.consumer.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | 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.aliyun.openservices.ons.api.Producer;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoV2SettleTemp;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2SettleTempService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoV2Service;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | /**
|
| | | * 订单到账消费
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class OrderMoneyRecievedMessageListener implements MessageListener {
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2SettleTempService hongBaoV2SettleTempService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderService hongBaoOrderService;
|
| | |
|
| | | @Resource
|
| | | private Producer producer;
|
| | |
|
| | | private int getHongBaoType(int type) {
|
| | | switch (type) {
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | | case HongBaoV2.TYPE_SHARE_YIJI:
|
| | | case HongBaoV2.TYPE_SHARE_ERJI:
|
| | | return OrderMoneyRecievedMQMsg.TYPE_INVITE;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | | return OrderMoneyRecievedMQMsg.TYPE_SHARE;
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | return OrderMoneyRecievedMQMsg.TYPE_ZIGOU;
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | // 根据红包做订单分发
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (OrderTopicTagEnum.orderFanLiActual.name().equalsIgnoreCase(message.getTag())) {
|
| | | String key = message.getKey();
|
| | | List<HongBaoV2SettleTemp> list = hongBaoV2SettleTempService.listByKey(key);
|
| | | Map<String, BigDecimal> moneyMap = new HashMap<>();
|
| | | // 临时订单消息
|
| | | for (HongBaoV2SettleTemp temp : list) {
|
| | | long hongBaoId = temp.getHongBaoId();
|
| | | HongBaoV2 v2 = hongBaoV2Service.selectByPrimaryKey(hongBaoId);
|
| | | if (v2 != null) {
|
| | | long mainHongBaoId = v2.getId();
|
| | | if (v2.getParent() != null)
|
| | | mainHongBaoId = v2.getParent().getId();
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderService.selectDetailByHongBaoId(mainHongBaoId);
|
| | | if (hongBaoOrder != null && hongBaoOrder.getCommonOrder() != null) {
|
| | | String mapKey = String.format("%s#%s#%s#%s", hongBaoOrder.getCommonOrder().getOrderNo(),
|
| | | hongBaoOrder.getCommonOrder().getSourceType(), v2.getUserInfo().getId(),
|
| | | getHongBaoType(v2.getType()));
|
| | | if (moneyMap.get(mapKey) == null)
|
| | | moneyMap.put(mapKey, new BigDecimal(0));
|
| | | moneyMap.put(mapKey, moneyMap.get(mapKey).add(v2.getMoney()));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | for (Iterator<String> its = moneyMap.keySet().iterator(); its.hasNext();) {
|
| | | String mapKey = its.next();
|
| | | String[] mapKeys = mapKey.split("#");
|
| | | String orderNo = mapKeys[0];
|
| | | String sourceType = mapKeys[1];
|
| | | String uid = mapKeys[2];
|
| | | String type = mapKeys[3];
|
| | | OrderMoneyRecievedMQMsg msg = new OrderMoneyRecievedMQMsg(Integer.parseInt(type),
|
| | | Long.parseLong(uid), Integer.parseInt(sourceType), orderNo, moneyMap.get(mapKey),
|
| | | new Date(), 0);
|
| | | producer.send(MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER,
|
| | | OrderTopicTagEnum.orderFanLiSeparateByOrderNo, msg));
|
| | | }
|
| | |
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | |
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.aliyun.openservices.ons.api.ConsumeContext;
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.MessageListener;
|
| | | import com.aliyun.openservices.ons.api.Producer;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.IntegralTaskMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserAccountBindingMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInviteMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserRedPackGiftMQMsg;
|
| | |
| | | import com.yeshi.fanli.service.inter.redpack.RedPackWinInviteService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | /**
|
| | |
| | | @Resource
|
| | | private RedPackGiveRecordService redPackGiveRecordService;
|
| | |
|
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | LogHelper.mqInfo("consumer-RedPackMessageListener", message.getMsgID(), message.getTopic(), message.getTag(),
|
| | |
| | | tag = "";
|
| | |
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name())) {// 返利到账
|
| | | OrderMoneyRecievedMQMsg orderMoneyRecievedMQMsg = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | // 分享订单奖励
|
| | | if (orderMoneyRecievedMQMsg.getType() == OrderMoneyRecievedMQMsg.TYPE_SHARE) {
|
| | | // try {
|
| | | // redPackWinInviteService.orderArriveReward(orderMoneyRecievedMQMsg.getUid(),
|
| | | // orderMoneyRecievedMQMsg.getSourceType(), orderMoneyRecievedMQMsg.getOrderId());
|
| | | // } catch (Exception e) {
|
| | | // e.printStackTrace();
|
| | | // }
|
| | | }
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderStatistic.name())) {// 订单统计
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderStatistic.name())) {// 订单统计
|
| | | OrderMQMsg orderMQMsg = new Gson().fromJson(new String(message.getBody()), OrderMQMsg.class);
|
| | | if (orderMQMsg.isValid()) {
|
| | | // 发送24小时延时消息
|
| | | // 测试时发送
|
| | | int hour = 24;
|
| | | if (Constant.IS_TEST) {
|
| | | hour = 1;
|
| | | }
|
| | | orderMQMsg.setDelayHour(hour);
|
| | | Message msg = new Message(message.getTopic(), OrderTopicTagEnum.orderStatisticDelay.name(),
|
| | | new Gson().toJson(orderMQMsg).getBytes());
|
| | | if (orderMQMsg.getStaticticDate().getTime() + 1000 * 60 * 60L * hour > System.currentTimeMillis())// 时间是否已经过了
|
| | | msg.setStartDeliverTime(orderMQMsg.getStaticticDate().getTime() + 1000 * 60 * 60L * hour);
|
| | | else
|
| | | msg.setStartDeliverTime(System.currentTimeMillis() + 1000 * 60);
|
| | | producer.send(msg);
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderStatisticDelay.name())) {// 订单统计
|
| | | OrderMQMsg orderMQMsg = new Gson().fromJson(new String(message.getBody()), OrderMQMsg.class);
|
| | | int hour = 24;
|
| | | if (Constant.IS_TEST) {
|
| | | hour = 1;
|
| | | }
|
| | |
|
| | | if (orderMQMsg.getDelayHour() == hour) {
|
| | | try {// 邀请奖励
|
| | | redPackWinInviteService.inviteSucceedReward(orderMQMsg.getUid());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiSeparateByOrderNo.name())) {// 订单到账(按订单号处理)
|
| | | OrderMoneyRecievedMQMsg orderMoneyRecievedMQMsg = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (orderMoneyRecievedMQMsg.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU
|
| | | || orderMoneyRecievedMQMsg.getType() == OrderMoneyRecievedMQMsg.TYPE_SHARE) {
|
| | | if (!StringUtil.isNullOrEmpty(orderMoneyRecievedMQMsg.getOrderId())
|
| | | && orderMoneyRecievedMQMsg.getUid() != null) {
|
| | | try {
|
| | | redPackWinInviteService.orderArriveReward(orderMoneyRecievedMQMsg.getUid(), orderMoneyRecievedMQMsg.getSourceType(), orderMoneyRecievedMQMsg.getOrderId());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | } else if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | boolean inviteSucceedReward = false;
|
| | | Long uid = null;
|
| | |
| | | UserAccountBindingMQMsg userAccountBindingMQMsg = new Gson().fromJson(new String(message.getBody()),
|
| | | UserAccountBindingMQMsg.class);
|
| | | Integer type = userAccountBindingMQMsg.getType();
|
| | | if (type == UserAccountBindingMQMsg.TYPE_PHONE || type == UserAccountBindingMQMsg.TYPE_TAOBAO) {
|
| | | if (type == UserAccountBindingMQMsg.TYPE_PHONE || type == UserAccountBindingMQMsg.TYPE_WX
|
| | | || type == UserAccountBindingMQMsg.TYPE_TAOBAO) {
|
| | | inviteSucceedReward = true;
|
| | | uid = userAccountBindingMQMsg.getUid();
|
| | | }
|
| | |
| | | UserInviteMQMsg.class);
|
| | | inviteSucceedReward = true;
|
| | | uid = userInviteMQMsg.getWorkerId();
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.integralTaskFinish.name())) {// 金币任务完成
|
| | | IntegralTaskMQMsg integralTaskMQMsg = new Gson().fromJson(new String(message.getBody()),
|
| | | IntegralTaskMQMsg.class);
|
| | | inviteSucceedReward = true;
|
| | | uid = integralTaskMQMsg.getUid();
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.redPackGiftDrawback.name())) {// 红包赠送
|
| | | UserRedPackGiftMQMsg userRedPackGiftMQMsg = new Gson().fromJson(new String(message.getBody()),
|
| | | UserRedPackGiftMQMsg.class);
|
| | | // 红包赠送到期未领取
|
| | | try {
|
| | | try { // 红包赠送到期未领取
|
| | | redPackGiveRecordService.overdueByPrimaryKey(userRedPackGiftMQMsg.getId());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | |
| | |
|
| | | if (inviteSucceedReward) {
|
| | | try {// 邀请奖励
|
| | | if(uid==6269748)
|
| | | {
|
| | | System.out.println(uid);
|
| | | }
|
| | | // redPackWinInviteService.inviteSucceedReward(uid);
|
| | | redPackWinInviteService.inviteSucceedReward(uid);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
| | | package com.yeshi.fanli.util.taobao;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.lang.reflect.Type;
|
| | | import java.math.BigDecimal;
|
| | |
| | | import javax.xml.parsers.DocumentBuilderFactory;
|
| | |
|
| | | import org.apache.commons.httpclient.HttpClient;
|
| | | import org.apache.commons.httpclient.HttpException;
|
| | | import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
|
| | | import org.apache.commons.httpclient.methods.GetMethod;
|
| | | import org.apache.commons.httpclient.params.HttpMethodParams;
|
| | |
| | | return url;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取淘宝的商品详情
|
| | | * |
| | | * @param actionId
|
| | | * @return
|
| | | */
|
| | | public static TaoBaoGoodsBrief getSimpleGoodsBrief(Long actionId) {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("itemNumId", actionId + "");
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | String result = HttpUtil.get(url);
|
| | | HttpClient client = new HttpClient();
|
| | | GetMethod gm = new GetMethod(url);
|
| | | String result = null;
|
| | | try {
|
| | | gm.setRequestHeader("user-agent",
|
| | | "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Mobile Safari/537.36");
|
| | | gm.setRequestHeader("cache-control", "max-age=0");
|
| | | gm.setRequestHeader("sec-fetch-mode", "navigate");
|
| | | gm.setRequestHeader("sec-fetch-site", "none");
|
| | | gm.setRequestHeader("sec-fetch-user", "?1");
|
| | | gm.setRequestHeader("upgrade-insecure-requests", "1");
|
| | | gm.setRequestHeader("cookie",
|
| | | "t=2ef08e4a12314c12dcd98d2ec480dd69; thw=cn; hng=CN%7Czh-CN%7CCNY%7C156; x=e%3D1%26p%3D*%26s%3D0%26c%3D0%26f%3D0%26g%3D0%26t%3D0%26__ll%3D-1%26_ato%3D0; ali_ab=113.251.19.3.1554796147005.0; UM_distinctid=16b9d8257dd388-0a96f36f947888-e343166-1fa400-16b9d8257df114; WAPFDFDTGFG=%2B4cMKKP%2B8PI%2BuhLvELc2mB6zAz5Z54E%3D; _w_app_lg=0; enc=00wU0%2BKYu9Yf1tHSawG%2Bc4aMZojqg8eB6baoMr9Z8Ir4qJ6hRhMhdWQxbM71vvxv6OCsxN50T0xA1gJGIdFm7w%3D%3D; cna=Q9eYFEM1rm8CAXH7EKUDSamu; miid=769739881160810491; lgc=%5Cu6930%5Cu89C6%5Cu79D1%5Cu6280; tracknick=%5Cu6930%5Cu89C6%5Cu79D1%5Cu6280; tg=0; mt=ci=7_1; cookie2=13ad477d84d5e6659aa7855de3617163; _tb_token_=ee895586817b0; dnk=%5Cu6930%5Cu89C6%5Cu79D1%5Cu6280; v=0; _m_h5_tk=286f649add5207dfe82e770832daf1cc_1573547306314; _m_h5_tk_enc=137c39dafc279e40edc796770d3eda8f; tk_trace=oTRxOWSBNwn9dPyorMJE%2FoPdY8zZPEr%2FCrvCMS%2BG3sTRRWrQ%2BVVTl09ME1KrXdbd3QNiuPM1YZeXJrHpvLuG%2FSvA2umbWq5jqrcw%2FDpk1Lj6yQFVptx6jw71DzuBbw%2BuZLEozdKGb%2BZr85uzSnUSWfVAqZprzoB%2Bfde2IHnHJp651xghkKpmsSBgY5muhOI7FvNfc8zH1BIvygVQSEIa1bCCgy2VJl%2FkyuTXaGHb%2FAKxL566%2FLult1lRlo8RZx9s76BhXe7PTot5MPGrayPkRiqWfVdg3C7gFWRjrjjKriN47mbQazOoIM7knBX%2B3mnnmwWbCQjKiuA6I8W9ng%3D%3D; _cc_=VFC%2FuZ9ajQ%3D%3D; unb=3327215652; uc1=lng=zh_CN&tag=8&cookie16=W5iHLLyFPlMGbLDwA%2BdvAGZqLg%3D%3D&cookie15=VT5L2FSpMGV7TQ%3D%3D&cookie14=UoTbnrCeRJd%2F2g%3D%3D&pas=0&existShop=false&cookie21=VFC%2FuZ9aj38X; uc3=vt3=F8dByuWjrX8oBIwXl2Q%3D&nk2=sbdfkkkB37A%3D&id2=UNN%2F6whEupDGWQ%3D%3D&lg2=WqG3DMC9VAQiUQ%3D%3D; csg=30373d82; cookie17=UNN%2F6whEupDGWQ%3D%3D; skt=6a0617b2d0843ef4; existShop=MTU3MzgxNDAxNw%3D%3D; uc4=id4=0%40UgQ3BPth2rlXv3PxjwesD5MgnRD3&nk4=0%40s9JQzQv3gdCkG6YVO6ulkEbNug%3D%3D; _l_g_=Ug%3D%3D; sg=%E6%8A%8021; _nk_=%5Cu6930%5Cu89C6%5Cu79D1%5Cu6280; cookie1=AnRaCZfOZrWoY8u%2BoXxB8y%2FnnwnZszWqI6Bbr5BrFtM%3D; isg=BOnpxPqJkNY3p6zvIy1AdcEC-JVDtt3of1m6aoveZVAPUglk0wbtuNdAFL5BUXUg; l=dBgUvWMcqlf1dR9EBOCanurza77OSIRYYuPzaNbMi_5IT6T6q1QOkBPUkF96VfWfTVLB47_ypV99-etkZ2ejm8IpXUJsAMc.");
|
| | | client.executeMethod(gm);
|
| | | result = gm.getResponseBodyAsString();
|
| | | } catch (HttpException e) {
|
| | | e.printStackTrace();
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | JSONObject resultOBJ = JSONObject.fromObject(result);
|
| | | if (resultOBJ.optJSONObject("data") != null) {
|
| | | data = resultOBJ.optJSONObject("data");
|
| | | if (data != null) {
|
| | | JSONObject item = data.optJSONObject("item");
|
| | | if (item != null) {
|
| | | JSONObject seller = data.optJSONObject("seller");
|
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
|
| | | goods.setTitle(item.optString("title"));
|
| | | goods.setAuctionId(item.optLong("itemId"));
|
| | | goods.setTitle(item.optString("title"));
|
| | | if (item.optJSONArray("images") != null && item.optJSONArray("images").size() > 0) {
|
| | | String picture = item.optJSONArray("images").optString(0);
|
| | | goods.setPictUrl(picture.startsWith("http") ? picture : "https:" + picture);
|
| | | }
|
| | | if (seller != null) {
|
| | | goods.setSellerId(seller.optLong("shopId"));
|
| | | String shopType = seller.optString("shopType");
|
| | | if ("B".equalsIgnoreCase(shopType)) {
|
| | | goods.setUserType(1);
|
| | | } else
|
| | | goods.setUserType(0);
|
| | |
|
| | | goods.setShopTitle(seller.optString("shopName"));
|
| | | }
|
| | | return goods;
|
| | | }
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | |
| | |
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.taobao.api.ApiException;
|
| | | import com.yeshi.fanli.dto.taobao.TaoBaoShopInfoDTO;
|
| | | import com.yeshi.fanli.dto.taobao.TaoLiJinDTO;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport;
|
| | | import com.yeshi.fanli.entity.taobao.RelateGoods;
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | | import com.yeshi.fanli.entity.taobao.SearchShopFilter;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | public static List<RelateGoods> getRelateGoodsList(long auctionId) throws ApiException {
|
| | | List<RelateGoods> resultList = new ArrayList<>();
|
| | | List<TaoBaoGoodsBrief> list = getRelationGoodsRecommend(auctionId, 9);
|
| | | for (TaoBaoGoodsBrief goods : list) {
|
| | | if (goods != null) {
|
| | | RelateGoods rg = new RelateGoods();
|
| | | rg.setId(goods.getAuctionId() + "");
|
| | | rg.setPicUrl(goods.getPictUrl());
|
| | | rg.setTitle(goods.getTitle());
|
| | | rg.setZkPrice(goods.getZkPrice().toString());
|
| | | rg.setUrl(goods.getAuctionUrl());
|
| | | resultList.add(rg);
|
| | | }
|
| | | }
|
| | | return resultList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取券详细信息
|
| | | *
|
| | |
| | | } else
|
| | | return null;
|
| | | return info;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取关联商品推荐
|
| | | * |
| | | * @param auctionId
|
| | | * @return
|
| | | */
|
| | | public static List<TaoBaoGoodsBrief> getRelationGoodsRecommend(long auctionId, int count) {
|
| | | List<TaoBaoGoodsBrief> list = new ArrayList<>();
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.item.recommend.get");
|
| | | map.put("num_iid", auctionId + "");
|
| | | map.put("count", count + "");
|
| | | map.put("platform", 2 + "");
|
| | | map.put("fields",
|
| | | "num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url");
|
| | | String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true);
|
| | | JSONObject data = JSONObject.fromObject(resultStr);
|
| | | if (data.optJSONObject("tbk_item_recommend_get_response") != null) {
|
| | | if (data.optJSONObject("tbk_item_recommend_get_response").optJSONObject("results") == null)
|
| | | return list;
|
| | | JSONArray array = data.optJSONObject("tbk_item_recommend_get_response").optJSONObject("results")
|
| | | .optJSONArray("n_tbk_item");
|
| | | if (array != null)
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | JSONObject item = array.optJSONObject(i);
|
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
|
| | | goods.setAuctionId(item.optLong("num_iid"));
|
| | | goods.setTitle(item.optString("title"));
|
| | | goods.setZkPrice(new BigDecimal(item.optString("zk_final_price")));
|
| | | goods.setAuctionUrl(item.optString("item_url"));
|
| | | goods.setPictUrl(item.optString("pict_url"));
|
| | | goods.setSalesCount(item.optString("volume"));
|
| | | goods.setUserType(item.optInt("user_type"));
|
| | | list.add(goods);
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | public static void taoQiangGou() {
|
| | |
| | | if (response != null && response.optJSONObject("result_list") != null) {
|
| | | JSONArray array = response.optJSONObject("result_list").optJSONArray("map_data");
|
| | | if (array != null) {
|
| | |
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | JSONObject item = array.optJSONObject(i);
|
| | | TaoBaoGoodsBrief goods = parseWuLiaoItemFromMaterialId(item);
|
| | | if (goods != null)
|
| | | goodsList.add(goods);
|
| | | }
|
| | |
|
| | | pageSize = array.size();
|
| | | }
|
| | | }
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | public static List<TaoBaoGoodsBrief> guessLikeByAuctionId(Long auctionId,int count) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.dg.optimus.material");
|
| | | map.put("item_id", auctionId + "");
|
| | | map.put("page_size", count + "");
|
| | | map.put("page_no", 1 + "");
|
| | | map.put("material_id", 13256 + "");
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | JSONObject resultJSON = null;
|
| | | try {
|
| | | resultJSON = TaoKeBaseUtil.baseRequest(map, true);
|
| | |
|
| | | JSONObject response = resultJSON.optJSONObject("tbk_dg_optimus_material_response");
|
| | | if (response != null && response.optJSONObject("result_list") != null) {
|
| | | JSONArray array = response.optJSONObject("result_list").optJSONArray("map_data");
|
| | | if (array != null) {
|
| | |
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | JSONObject item = array.optJSONObject(i);
|
| | | TaoBaoGoodsBrief goods = parseWuLiaoItemFromMaterialId(item);
|
| | | if (goods != null)
|
| | | goodsList.add(goods);
|
| | | }
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | return goodsList;
|
| | | }
|
| | | }
|
| | |
|
| | | class QuanInfo {
|
| | |
| | | @Expose
|
| | | private List<String> subsidyList;
|
| | |
|
| | | |
| | | // 直接收益人-ID
|
| | | private String userId;
|
| | | // 直接收益人-昵称
|
| | |
| | | private String weiQuanBackMoney;//维权资金
|
| | |
|
| | | private Integer otherState; // 1免单
|
| | |
|
| | | @Expose
|
| | | private boolean vipOrder;// 是否为超级用户订单
|
| | |
|
| | | public boolean isVipOrder() {
|
| | | return vipOrder;
|
| | | }
|
| | |
|
| | | public void setVipOrder(boolean vipOrder) {
|
| | | this.vipOrder = vipOrder;
|
| | | }
|
| | |
|
| | | public String getWeiQuanState() {
|
| | | return weiQuanState;
|
| | |
| | | this.receiveTime = receiveTime;
|
| | | }
|
| | |
|
| | |
|
| | | public List<CommonOrderGoodsVO> getListOrderGoods() {
|
| | | return listOrderGoods;
|
| | | }
|
| | |
| | | public void setHongBaoDate(String hongBaoDate) {
|
| | | this.hongBaoDate = hongBaoDate;
|
| | | }
|
| | |
|
| | |
|
| | | public Integer getOrderType() {
|
| | | return orderType;
|
| | |
| | | public void setUserPortrait(String userPortrait) {
|
| | | this.userPortrait = userPortrait;
|
| | | }
|
| | |
|
| | |
|
| | | public Map<String, Object> getRewardDetail() {
|
| | | return rewardDetail;
|