| | |
| | | */
|
| | | // @RequestMapping(value = "saveAdd")
|
| | | public void saveAdd(String callback, AppPageNotification appPageNotification, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | |
| | | String content = appPageNotification.getContent();
|
| | | if (StringUtil.isNullOrEmpty(content) ) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("显示内容不能为空"));
|
| | |
| | | } else {
|
| | | appPageNotification.setMd5(StringUtil.Md5(null + "#" + content + "#" + appPageNotification.getContentUrl()));
|
| | | }
|
| | | |
| | | Boolean show = appPageNotification.getShow();
|
| | | if (show == null) {
|
| | | show = false;
|
| | | appPageNotification.setShow(show);
|
| | | }
|
| | | |
| | | Boolean canClose = appPageNotification.getCanClose();
|
| | | if (canClose == null) {
|
| | | canClose = false;
|
| | | appPageNotification.setCanClose(canClose);
|
| | | }
|
| | | |
| | | String contentUrl = appPageNotification.getContentUrl();
|
| | | if (canClose != null && canClose && !StringUtil.isNullOrEmpty(contentUrl)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("跳转链接和允许关闭不可同时存在"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | Boolean show = appPageNotification.getShow();
|
| | | if (show == null) {
|
| | | show = false;
|
| | | appPageNotification.setShow(show);
|
| | | }
|
| | | |
| | | Boolean canClose = appPageNotification.getCanClose();
|
| | | if (canClose == null) {
|
| | | canClose = false;
|
| | | appPageNotification.setCanClose(canClose);
|
| | | }
|
| | | |
| | | if (canClose && !StringUtil.isNullOrEmpty(appPageNotification.getContentUrl())) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("跳转链接和允许关闭不可同时存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
| | |
|
| | | String beginTimeVO = appPageNotification.getBeginTimeVO();
|
| | |
| | | }
|
| | |
|
| | | appPageNotification.setMd5(StringUtil.Md5(type.name() + "#" + content + "#" + appPageNotification.getContentUrl()));
|
| | | appPageNotification.setId(old.getId());
|
| | | appPageNotification.setUpdateTime(new Date());
|
| | | appPageNotificationService.updateByPrimaryKeySelective(appPageNotification);
|
| | | |
| | | appPageNotification.setId(old.getId());
|
| | | appPageNotification.setType(old.getType());
|
| | | appPageNotification.setCreateTime(old.getCreateTime());
|
| | | appPageNotificationService.updateByPrimaryKey(appPageNotification);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("修改成功"));
|
| | |
|
| | |
| | | }
|
| | |
|
| | | Boolean canClose = resultObj.getCanClose();
|
| | | if (canClose) {
|
| | | resultObj.setCanClose(false);
|
| | | if (canClose != null && canClose) {
|
| | | canClose = false;
|
| | | } else {
|
| | | resultObj.setCanClose(true);
|
| | | canClose = true;
|
| | | }
|
| | |
|
| | | appPageNotificationService.updateByPrimaryKeySelective(resultObj);
|
| | | |
| | | if (canClose && !StringUtil.isNullOrEmpty(resultObj.getContentUrl())) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("跳转链接和允许关闭不可同时存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | AppPageNotification newOBj = new AppPageNotification();
|
| | | newOBj.setId(resultObj.getId());
|
| | | newOBj.setCanClose(canClose);
|
| | | appPageNotificationService.updateByPrimaryKeySelective(newOBj);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("state", resultObj.getCanClose());
|
| | | data.put("state", newOBj.getCanClose());
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | | }
|
| | |
|
| | | Boolean show = resultObj.getShow();
|
| | | if (show) {
|
| | | resultObj.setShow(false);
|
| | | if (show != null && show) {
|
| | | show = false;
|
| | | } else {
|
| | | resultObj.setShow(true);
|
| | | show = true;
|
| | | }
|
| | |
|
| | | appPageNotificationService.updateByPrimaryKeySelective(resultObj);
|
| | | |
| | | AppPageNotification newOBj = new AppPageNotification();
|
| | | newOBj.setId(resultObj.getId());
|
| | | newOBj.setShow(show);
|
| | | appPageNotificationService.updateByPrimaryKeySelective(newOBj);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("state", resultObj.getShow());
|
| | | data.put("state", newOBj.getShow());
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.vo.user.UserGoldCoinVO;
|
| | | import com.yeshi.fanli.vo.user.UserInfoVO;
|
| | |
|
| | |
| | | * @param out
|
| | | * @param request
|
| | | */
|
| | | @RequestSerializableByKey(key = "'passVIP-' +#id")
|
| | | @RequestMapping(value = "passVIP")
|
| | | public void passVIP(String callback, Long id, PrintWriter out, HttpServletRequest request) {
|
| | | try {
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | return;
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
|
| | | return;
|
| | | }
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆"));
|
| | | return;
|
| | | }
|
| | | // 编码转换
|
| | | reason = URLDecoder.decode(reason, "UTF-8");
|
| | | userVIPInfoService.rejectVIPApply(id, reason);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("拒绝成功"));
|
| | | LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 拒绝提现id=" + id + "的升级超级会员申请不存在!");
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | return;
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
|
| | | return;
|
| | | }
|
| | |
| | |
|
| | | } catch (ShareGoodsException e) {
|
| | | if (e.getCode() == 1001 || e.getCode() == 1002) {
|
| | | out.print(JsonUtil.loadFalseResult(1001, e.getMsg()));
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
|
| | | }
|
| | |
| | | // + Constant.systemCommonConfig.getProjectName() + "/client/threeShareNew?uid=" + uid);
|
| | | data.put("inviteLink", "http://a.app.qq.com/o/simple.jsp?pkgname=com.yeshi.ec.rebate");
|
| | |
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra != null) {
|
| | | data.put("inviteCode", userInfoExtra.getInviteCode());
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | if (!StringUtil.isNullOrEmpty(inviteCode)) {
|
| | | data.put("inviteCode", inviteCode);
|
| | | }
|
| | |
|
| | | // 邀请规则
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra == null || userInfoExtra.getInviteCode() == null) {
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | if (StringUtil.isNullOrEmpty(inviteCode)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("邀请码不存在"));
|
| | | return;
|
| | | }
|
| | | String tip = configService.get("invite_activation_success_tip");
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("inviteCode", userInfoExtra.getInviteCode());
|
| | | data.put("inviteCode", inviteCode);
|
| | | data.put("tip", tip);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
| | |
|
| | | data.put("token", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | |
|
| | | String inviteCode = null;
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extra != null)
|
| | | inviteCode = extra.getInviteCode();
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | // 测试
|
| | | List<String> commentTexts = new ArrayList<>();
|
| | | String commentTextStr = configService.get("share_single_goods_comment_text");
|
| | |
| | |
|
| | | } else if (cid == 4) { // 邀请分享
|
| | |
|
| | | String inviteCode = null;
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
|
| | | inviteCode = userInfoExtra.getInviteCode();
|
| | | } else {
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | if (StringUtil.isNullOrEmpty(inviteCode)) {
|
| | | out.print(JsonUtil.loadFalseResult(9001, "邀请码未激活"));
|
| | | return;
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserLotteryRecord;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.exception.user.UserLotteryRecordException;
|
| | | import com.yeshi.fanli.exception.user.UserSystemCouponException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | |
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | // 未读券是否大于0
|
| | | if (userInfoExtra != null && userInfoExtra.getCouponNews() > 0) {
|
| | | userInfoExtra.setCouponNews(0);
|
| | | try {
|
| | | userInfoExtraService.saveUserInfoExtra(userInfoExtra);
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | UserInfoExtra extra = new UserInfoExtra();
|
| | | extra.setId(userInfoExtra.getId());
|
| | | extra.setCouponNews(0);
|
| | | userInfoExtraService.updateByPrimaryKeySelective(extra);
|
| | | }
|
| | |
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | welfareCenterNews = userInfoExtra.getCouponNews();
|
| | | }
|
| | |
|
| | | if (userInfoExtra.getInviteCode() != null && userInfoExtra.getInviteCode().trim().length() > 0) {
|
| | | if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCodeVip())) {
|
| | | invitCode = userInfoExtra.getInviteCodeVip();
|
| | | } else {
|
| | | invitCode = userInfoExtra.getInviteCode();
|
| | | }
|
| | | }
|
| | |
| | | otherInfo.setReduceHongBao(newUserHongBao);
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | |
|
| | | // 专属标签
|
| | | List<ClientTextStyleVO> labels = new ArrayList<ClientTextStyleVO>();
|
| | | labels.add(new ClientTextStyleVO("新人专属", "#FE0014"));
|
| | | labels.add(new ClientTextStyleVO("实付0元", "#FF9600"));
|
| | | goodsDetail.setLabels(labels);
|
| | | |
| | | } else {// 普通购买
|
| | | OtherInfo otherInfo = new OtherInfo();
|
| | | RewardCouponVO rewardCoupon = new RewardCouponVO();
|
| | |
| | | data.put("shareLink", UserInviteUtil.getShareUrl(uid));
|
| | | data.put("redPackLock", redPackForbidService.verifyForbid(uid));
|
| | |
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
|
| | | data.put("inviteCode", userInfoExtra.getInviteCode());
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | if ( !StringUtil.isNullOrEmpty(inviteCode)) {
|
| | | data.put("inviteCode", inviteCode);
|
| | | } else {
|
| | | data.put("inviteCode", "");
|
| | | }
|
| | |
|
| | | //
|
| | | long freeCouponCount = userSystemCouponService.countUsableFreeCouponForBuy(uid);
|
| | | |
| | | // 赠送免单券
|
| | | long freeCouponCount = userSystemCouponService.countGiveFreeCoupon(uid);
|
| | | // 奖励券
|
| | | long rewardCouponCount = userSystemCouponService.countUsableRewardCoupon(uid);
|
| | |
|
| | | data.put("freeCouponCount", freeCouponCount);
|
| | |
| | | UserExtraTaoBaoInfo extraInfo = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | UserInfoExtra userExtraInfo = userInfoExtraService.getUserInfoExtra(uid);
|
| | | String inviteCode = null;
|
| | | if (userExtraInfo != null)
|
| | | inviteCode = userExtraInfo.getInviteCode();
|
| | |
|
| | | if (userExtraInfo != null) {
|
| | | if (!StringUtil.isNullOrEmpty(userExtraInfo.getInviteCodeVip())) {
|
| | | inviteCode = userExtraInfo.getInviteCodeVip();
|
| | | } else {
|
| | | inviteCode = userExtraInfo.getInviteCode();
|
| | | }
|
| | | }
|
| | | String relationId = null;
|
| | | if (extraInfo != null && extraInfo.getRelationId() != null && extraInfo.getRelationValid() != null
|
| | | && extraInfo.getRelationValid() == true)
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.push.DeviceActive;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | |
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.HomeNavbarUserService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDetailService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyService;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailService userMoneyDetailService;
|
| | |
|
| | | |
| | | /**
|
| | | * 新版登录 V1.5.3
|
| | | *
|
| | |
| | | vo.setHelpLink(userVipConfigService.getValueByKey("help_link_vip_h5"));
|
| | | vo.setCsdLink(configService.get("customer_service_link"));
|
| | |
|
| | | // 省钱 -自购产生返利
|
| | | BigDecimal finishMoney = hongBaoV2CountService.getRewardMoneyBySelf(uid);
|
| | | // 分享赚
|
| | | BigDecimal rewardShare = hongBaoV2CountService.getRewardMoneyByShare(uid);
|
| | | // 邀请赚
|
| | | BigDecimal rewardInvite = hongBaoV2CountService.getRewardMoneyByInvite(uid);
|
| | | |
| | | Date now = new Date();
|
| | | Date start = new Date(0);
|
| | | |
| | | // 返利订单、奖励券提成
|
| | | List<UserMoneyDetailTypeEnum> typeFanli = new ArrayList<>();
|
| | | typeFanli.add(UserMoneyDetailTypeEnum.fanli);
|
| | | typeFanli.add(UserMoneyDetailTypeEnum.orderReward);
|
| | | BigDecimal finishMoney = userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeFanli, start, now).abs();
|
| | | |
| | | // 邀请订单、分享订单、补贴
|
| | | List<UserMoneyDetailTypeEnum> typeList = new ArrayList<>();
|
| | | typeList.add(UserMoneyDetailTypeEnum.share);
|
| | | typeList.add(UserMoneyDetailTypeEnum.invite);
|
| | | typeList.add(UserMoneyDetailTypeEnum.inviteAndShare);
|
| | | typeList.add(UserMoneyDetailTypeEnum.systemEqualize);
|
| | | typeList.add(UserMoneyDetailTypeEnum.subsidy);
|
| | | BigDecimal rewardMoney = userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, start, now).abs();
|
| | |
|
| | | UserVIPInfo userVIPInfo = userVIPInfoService.selectByUid(uid);
|
| | | vo.setVipInfo(userVIPInfo);
|
| | |
| | | && userVIPInfo.getState() == UserVIPInfo.STATE_SUCCESS) { // VIP
|
| | | vo.setSuccessTime(TimeUtil.getGernalTime(userVIPInfo.getSuccessTime().getTime(), "yyyy.MM.dd"));
|
| | | vo.setConserveMoney(finishMoney);
|
| | | vo.setEarnMoney(MoneyBigDecimalUtil.add(rewardShare, rewardInvite));
|
| | | vo.setEarnMoney(rewardMoney);
|
| | | } else {
|
| | | BigDecimal rate1 = new BigDecimal(5);
|
| | | BigDecimal rate2 = new BigDecimal(12);
|
| | | vo.setConserveMoney(MoneyBigDecimalUtil.mul2(finishMoney, MoneyBigDecimalUtil.div(rate1, rate2)));
|
| | | vo.setEarnMoney(MoneyBigDecimalUtil.mul2(rewardShare, MoneyBigDecimalUtil.div(rate1, rate2)));
|
| | | BigDecimal rate = new BigDecimal("0.409");
|
| | | vo.setConserveMoney(MoneyBigDecimalUtil.mul2(finishMoney, rate));
|
| | | vo.setEarnMoney(MoneyBigDecimalUtil.mul2(rewardMoney, rate));
|
| | | }
|
| | | vo.setFinishMoney(finishMoney);
|
| | | vo.setFinishMoney(hongBaoV2CountService.getRewardMoneyBySelf(uid));
|
| | |
|
| | | // 会员规则执行时间
|
| | | String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
|
| | |
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.exception.user.UserSystemCouponException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | |
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | // 未读券是否大于0
|
| | | if (userInfoExtra != null && userInfoExtra.getCouponNews() > 0) {
|
| | | userInfoExtra.setCouponNews(0);
|
| | | try {
|
| | | userInfoExtraService.saveUserInfoExtra(userInfoExtra);
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | UserInfoExtra extra = new UserInfoExtra();
|
| | | extra.setId(userInfoExtra.getId());
|
| | | extra.setCouponNews(0);
|
| | | userInfoExtraService.updateByPrimaryKeySelective(extra);
|
| | | }
|
| | |
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | */
|
| | | void updateGoldCoin(@Param("id")Long id, @Param("goldCoin")Integer goldCoin);
|
| | |
|
| | | |
| | | /**
|
| | | * 用于数据更新 加锁
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | void addGoldCoinByUid(@Param("uid")Long uid, @Param("goldCoin")Integer goldCoin);
|
| | | |
| | | /**
|
| | | * 开启提现:超过60天关闭
|
| | | * @param days
|
| | |
| | | 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}) |
| | | IF(uie_gold_coin IS NULL,#{goldCoin}, uie_gold_coin + #{goldCoin}) |
| | | WHERE uie_id = #{id} |
| | | </update> |
| | | |
| | | <update id="addGoldCoinByUid"> |
| | | UPDATE yeshi_ec_user_info_extra SET uie_gold_coin = IF(uie_gold_coin IS NULL,#{goldCoin}, uie_gold_coin + #{goldCoin}) |
| | | WHERE uie_uid = #{uid} |
| | | </update> |
| | | |
| | | |
| | | <select id="getInfoExtraByUid" resultMap="BaseResultMap">SELECT * FROM |
| | | yeshi_ec_user_info_extra WHERE uie_uid = #{uid} |
| | | </select> |
| | |
| | | </set> where uis_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <update id="updateInvalidByBossId" parameterType="Long"> |
| | | <update id="updateInvalidByBossId"> |
| | | UPDATE yeshi_ec_user_invite_separate SET uis_state = 2 |
| | | WHERE uis_boss_id = #{uid} AND uis_state = 0 AND uis_end_time >= NOW() |
| | | </update> |
| | | |
| | | <update id="updateStateByWorkerIdAndBossId" parameterType="Long"> |
| | | <update id="updateStateByWorkerIdAndBossId"> |
| | | UPDATE yeshi_ec_user_invite_separate SET uis_state = #{state} |
| | | WHERE uis_worker_id = #{workerId} AND uis_boss_id = #{uid} |
| | | WHERE uis_worker_id = #{workerId} AND uis_boss_id = #{bossId} |
| | | </update> |
| | | |
| | | <select id="selectByWorkerIdAndBossId" resultMap="BaseResultMap"> |
| | |
| | | ORDER BY uc.usc_state_activate desc, uc.`usc_create_time`
|
| | | </select>
|
| | |
|
| | | <SELECT id="getValidByUidAndType" resultMap="ResultVOMap">
|
| | | <select id="getValidByUidAndType" resultMap="ResultVOMap">
|
| | | SELECT * FROM `yeshi_ec_user_system_coupon` t
|
| | | LEFT JOIN `yeshi_ec_system_coupon` c ON t.`usc_coupon_id` = c.`sc_id`
|
| | | WHERE t.usc_state = 1 AND t.usc_state_activate = 1 AND t.usc_uid = #{uid}
|
| | | AND c.`sc_type`= #{type} AND t.`usc_end_time` <![CDATA[>]]> NOW()
|
| | | </SELECT>
|
| | | </select>
|
| | |
|
| | |
|
| | |
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Cacheable(value = "systemCouponCache",key="'getGiveFreeCouponList'")
|
| | | public List<SystemCoupon> getGiveFreeCouponList() {
|
| | | List<String> listType = new ArrayList<String>();
|
| | | listType.add(CouponTypeEnum.freeCouponGive.name());
|
| | | return systemCouponMapper.getCouponListByType(listType);
|
| | | }
|
| | | |
| | | @Override
|
| | | @Cacheable(value = "systemCouponCache",key="'getGoodsCouponList'")
|
| | | public List<SystemCoupon> getGoodsCouponList() {
|
| | | List<String> listType = new ArrayList<String>();
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateByPrimaryKey(AppPageNotification record) {
|
| | | appPageNotificationMapper.updateByPrimaryKey(record); |
| | | }
|
| | | |
| | | @Override
|
| | | public void updateByPrimaryKeySelective(AppPageNotification record) {
|
| | | appPageNotificationMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
| | | userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | } else if (detail.getType() == MsgTypeOtherTypeEnum.passVIPApply
|
| | | || detail.getType() == MsgTypeOtherTypeEnum.rejectVIPApply
|
| | | || detail.getType() == MsgTypeOtherTypeEnum.teamVIPCallBoss) {
|
| | | || detail.getType() == MsgTypeOtherTypeEnum.teamVIPCallBoss
|
| | | || detail.getType() == MsgTypeOtherTypeEnum.teamSplitCallBoss) {
|
| | | msgOtherDetailMapper.insertSelective(detail);
|
| | | userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | }
|
| | |
| | | coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponReward, "返利订单已到账再返" + percent + "%"));
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponReward, "返利订单已到账再返30%以上"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | getLeftDay(coupon), coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponReward, "返利订单已到账再返" + percent + "%"));
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponReward, "返利订单已到账再返30%以上"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | if (dlist != null && dlist.size() > 0)
|
| | | user = userInfoService.selectByPKey(uid);
|
| | |
|
| | | String inviteCode = null;
|
| | | UserInfoExtra extraInfo = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extraInfo != null) {
|
| | | inviteCode = extraInfo.getInviteCode();
|
| | | }
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | // 添加原来没有的
|
| | | for (String md5 : dlist) {
|
| | | for (SpreadImg img : spreadImgList)
|
| | |
| | | try {
|
| | | UserInfo user = userInfoService.selectByPKey(giveUid);
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | |
| | | String inviteCode = null;
|
| | | if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCodeVip())) {
|
| | | inviteCode = userInfoExtra.getInviteCodeVip();
|
| | | } else {
|
| | | inviteCode = userInfoExtra.getInviteCode();
|
| | | }
|
| | | |
| | | MsgInviteContentDTO msgInvite = new MsgInviteContentDTO();
|
| | | msgInvite.setTitle("邀请消息");
|
| | | msgInvite.setState("成功激活邀请");
|
| | | msgInvite.setCode("你的邀请码:" + userInfoExtra.getInviteCode());
|
| | | msgInvite.setCode("你的邀请码:" + inviteCode);
|
| | | msgInvite.setInviter("昵称:"+user.getNickName());
|
| | | msgInvite.setMode("成功领取邀请人的" + giftName);
|
| | | userInviteMsgNotificationService.receiveGift(uid, "邀请关系一旦确立无法更改 ", msgInvite);
|
| | |
| | | }
|
| | |
|
| | | boolean isupdateRank = true;
|
| | | UserInfoExtra extra = new UserInfoExtra();
|
| | |
|
| | | UserInfoExtra userInfoExtra = userInfoExtraMapper.getInfoExtraByUid(uid);
|
| | | if (userInfoExtra != null && userInfoExtra.getId() != null) {
|
| | |
| | | isupdateRank = false;
|
| | | }
|
| | | }
|
| | | extra.setId(userInfoExtra.getId());
|
| | | } else {
|
| | | userInfoExtra = new UserInfoExtra();
|
| | | userInfoExtra.setUserInfo(new UserInfo(uid));
|
| | | extra.setUserInfo(new UserInfo(uid));
|
| | | }
|
| | |
|
| | | |
| | | // 更新等级
|
| | | if (isupdateRank) {
|
| | | updateRank(userInfoExtra);
|
| | | List<UserRank> listRank = userRankService.getAllRank();
|
| | | if (listRank == null || listRank.size() == 0) {
|
| | | throw new UserInfoExtraException(1, "系统等级不存在");
|
| | | }
|
| | |
|
| | | int selfOrderNum = 0;
|
| | | int sharedOrderNum = 0;
|
| | | int inviteOrderNum = 0;
|
| | | Map<String, Object> map = commonOrderCountService.lastMonthSettleOrderNumber(uid);
|
| | | if (map != null) {
|
| | | // 返利订单
|
| | | if (map.get("totalSelf") != null) {
|
| | | selfOrderNum = Integer.parseInt(map.get("totalSelf").toString());
|
| | | }
|
| | |
|
| | | // 分享订单
|
| | | if (map.get("totalShared") != null) {
|
| | | sharedOrderNum = Integer.parseInt(map.get("totalShared").toString());
|
| | | }
|
| | |
|
| | | // 邀请订单
|
| | | if (map.get("totalInvite") != null) {
|
| | | inviteOrderNum = Integer.parseInt(map.get("totalInvite").toString());
|
| | | }
|
| | | }
|
| | |
|
| | | UserRank rank = null;
|
| | | for (UserRank userRank : listRank) {
|
| | | // 邀请满足
|
| | | Integer inviteNum = userRank.getInviteNum();
|
| | | if (inviteOrderNum >= inviteNum) {
|
| | | rank = userRank;
|
| | | extra.setRankOrderNum(inviteOrderNum);
|
| | | extra.setRankSource(Constant.TYPE_INVITE);
|
| | | }
|
| | |
|
| | | // 分享满足
|
| | | int shareNum = userRank.getShareNum();
|
| | | if (sharedOrderNum >= shareNum) {
|
| | | rank = userRank;
|
| | | extra.setRankOrderNum(sharedOrderNum);
|
| | | extra.setRankSource(Constant.TYPE_SHAER);
|
| | | }
|
| | |
|
| | | // 返利满足
|
| | | int directNum = userRank.getRebateNum();
|
| | | if (selfOrderNum >= directNum) {
|
| | | rank = userRank;
|
| | | extra.setRankOrderNum(selfOrderNum);
|
| | | extra.setRankSource(Constant.TYPE_REBATE);
|
| | | }
|
| | |
|
| | | if (rank != null) {
|
| | | extra.setUserRank(rank);
|
| | | } else {
|
| | | rank = userRank;
|
| | | // 默认最低等级:青铜
|
| | | extra.setUserRank(rank);
|
| | | extra.setRankOrderNum(selfOrderNum);
|
| | | extra.setRankSource(Constant.TYPE_REBATE);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | // 等级更新时间 当月1号
|
| | | Calendar calendar1 = Calendar.getInstance();
|
| | | calendar1.set(Calendar.DAY_OF_MONTH, 1);
|
| | | extra.setRankUpdateTime(calendar1.getTime());
|
| | |
|
| | | // 保存等级信息
|
| | | saveUserInfoExtra(extra);
|
| | |
|
| | | // 保存等级变化记录
|
| | | UserRankRecord userRankRecord = new UserRankRecord();
|
| | | userRankRecord.setUid(uid);
|
| | | userRankRecord.setRankId(rank.getId());
|
| | | userRankRecord.setCreateTime(new Date());
|
| | | userRankRecordMapper.insertSelective(userRankRecord);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | userInfoExtraMapper.insertSelective(userInfoExtra);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserInfoExtra updateRank(UserInfoExtra userInfoExtra) throws UserInfoExtraException {
|
| | | UserInfo userInfo = userInfoExtra.getUserInfo();
|
| | | if (userInfo == null) {
|
| | | throw new UserInfoExtraException(1, "用户不存在");
|
| | | }
|
| | |
|
| | | Long uid = userInfo.getId();
|
| | | if (uid == null) {
|
| | | throw new UserInfoExtraException(1, "用户ID不存在");
|
| | | }
|
| | |
|
| | | List<UserRank> listRank = userRankService.getAllRank();
|
| | | if (listRank == null || listRank.size() == 0) {
|
| | | throw new UserInfoExtraException(1, "系统等级不存在");
|
| | | }
|
| | |
|
| | | int selfOrderNum = 0;
|
| | | int sharedOrderNum = 0;
|
| | | int inviteOrderNum = 0;
|
| | | Map<String, Object> map = commonOrderCountService.lastMonthSettleOrderNumber(uid);
|
| | | if (map != null) {
|
| | | // 返利订单
|
| | | if (map.get("totalSelf") != null) {
|
| | | selfOrderNum = Integer.parseInt(map.get("totalSelf").toString());
|
| | | }
|
| | |
|
| | | // 分享订单
|
| | | if (map.get("totalShared") != null) {
|
| | | sharedOrderNum = Integer.parseInt(map.get("totalShared").toString());
|
| | | }
|
| | |
|
| | | // 邀请订单
|
| | | if (map.get("totalInvite") != null) {
|
| | | inviteOrderNum = Integer.parseInt(map.get("totalInvite").toString());
|
| | | }
|
| | | }
|
| | |
|
| | | UserRank rank = null;
|
| | | for (UserRank userRank : listRank) {
|
| | | // 邀请满足
|
| | | Integer inviteNum = userRank.getInviteNum();
|
| | | if (inviteOrderNum >= inviteNum) {
|
| | | rank = userRank;
|
| | | userInfoExtra.setRankOrderNum(inviteOrderNum);
|
| | | userInfoExtra.setRankSource(Constant.TYPE_INVITE);
|
| | | }
|
| | |
|
| | | // 分享满足
|
| | | int shareNum = userRank.getShareNum();
|
| | | if (sharedOrderNum >= shareNum) {
|
| | | rank = userRank;
|
| | | userInfoExtra.setRankOrderNum(sharedOrderNum);
|
| | | userInfoExtra.setRankSource(Constant.TYPE_SHAER);
|
| | | }
|
| | |
|
| | | // 返利满足
|
| | | int directNum = userRank.getRebateNum();
|
| | | if (selfOrderNum >= directNum) {
|
| | | rank = userRank;
|
| | | userInfoExtra.setRankOrderNum(selfOrderNum);
|
| | | userInfoExtra.setRankSource(Constant.TYPE_REBATE);
|
| | | }
|
| | |
|
| | | if (rank != null) {
|
| | | userInfoExtra.setUserRank(rank);
|
| | | } else {
|
| | | rank = userRank;
|
| | | // 默认最低等级:青铜
|
| | | userInfoExtra.setUserRank(rank);
|
| | | userInfoExtra.setRankOrderNum(selfOrderNum);
|
| | | userInfoExtra.setRankSource(Constant.TYPE_REBATE);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | // 等级更新时间 当月1号
|
| | | Calendar calendar1 = Calendar.getInstance();
|
| | | calendar1.set(Calendar.DAY_OF_MONTH, 1);
|
| | | userInfoExtra.setRankUpdateTime(calendar1.getTime());
|
| | |
|
| | | // 保存信息并返回
|
| | | saveUserInfoExtra(userInfoExtra);
|
| | |
|
| | | UserRankRecord userRankRecord = new UserRankRecord();
|
| | | userRankRecord.setUid(uid);
|
| | | userRankRecord.setRankId(rank.getId());
|
| | | userRankRecord.setCreateTime(new Date());
|
| | | userRankRecordMapper.insertSelective(userRankRecord);
|
| | |
|
| | | return userInfoExtra;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserInfoExtra saveUserInfoExtra(UserInfoExtra userInfoExtra) throws UserInfoExtraException {
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public UserInfoExtra getByUidForUpdate(Long uid) {
|
| | | return userInfoExtraMapper.getByUidForUpdate(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void updateGoldCoin(Long id, Integer goldCoin) {
|
| | | userInfoExtraMapper.updateGoldCoin(id, goldCoin);
|
| | | }
|
| | | |
| | | @Override
|
| | | public void addGoldCoinByUid(Long uid, Integer goldCoin) {
|
| | | userInfoExtraMapper.addGoldCoinByUid(uid, goldCoin);
|
| | | }
|
| | | |
| | | @Override
|
| | | public void updateByPrimaryKeySelective(UserInfoExtra record) {
|
| | | userInfoExtraMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | try {
|
| | | String inviteCode = createInviteCode(uid);
|
| | | if (!StringUtil.isNullOrEmpty(inviteCode)) {
|
| | | userInfoExtra.setUserInfo(new UserInfo(uid));
|
| | | userInfoExtra.setInviteCode(inviteCode);
|
| | | |
| | | saveUserInfoExtra(userInfoExtra);
|
| | | |
| | | UserInfoExtra extra= new UserInfoExtra();
|
| | | extra.setId(userInfoExtra.getId());
|
| | | extra.setInviteCode(inviteCode);
|
| | | userInfoExtraMapper.updateByPrimaryKeySelective(extra);
|
| | | return inviteCode;
|
| | | }
|
| | | } catch (Exception e) {
|
| | |
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.exception.user.UserSystemCouponException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | |
| | | @Resource
|
| | | private UserOtherMsgNotificationService userOtherMsgNotificationService;
|
| | |
|
| | | @Lazy
|
| | | @Resource
|
| | | private CommonOrderCountService commonOrderCountService;
|
| | |
|
| | |
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | |
|
| | | @Lazy
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | |
| | |
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | // 添加一条消息
|
| | | if (userInfoExtra != null) {
|
| | | if (userInfoExtra.getCouponNews() == null) {
|
| | | userInfoExtra.setCouponNews(1);
|
| | | public void run() { // 福利中心红点
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extra != null) {
|
| | | UserInfoExtra updateExtra = new UserInfoExtra();
|
| | | updateExtra.setId(extra.getId());
|
| | | if (extra.getCouponNews() == null) {
|
| | | updateExtra.setCouponNews(1);
|
| | | } else {
|
| | | userInfoExtra.setCouponNews(userInfoExtra.getCouponNews() + 1);
|
| | | updateExtra.setCouponNews(extra.getCouponNews() + 1);
|
| | | }
|
| | |
|
| | | try {
|
| | | userInfoExtraService.saveUserInfoExtra(userInfoExtra);
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | userInfoExtraService.updateByPrimaryKeySelective(updateExtra);
|
| | | }
|
| | |
|
| | | }
|
| | | });
|
| | |
|
| | |
| | |
|
| | | return userSystemCouponMapper.countUsableByUid(uid, listCouponId);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public long countGiveFreeCoupon(Long uid) {
|
| | | if (uid == null)
|
| | | return 0;
|
| | |
|
| | | List<SystemCoupon> couponList = systemCouponService.getGiveFreeCouponList();
|
| | | if (couponList == null || couponList.size() == 0)
|
| | | return 0;
|
| | |
|
| | | List<Long> listCouponId = new ArrayList<Long>();
|
| | | for (SystemCoupon systemCoupon : couponList) {
|
| | | listCouponId.add(systemCoupon.getId());
|
| | | }
|
| | |
|
| | | return userSystemCouponMapper.countUsableByUid(uid, listCouponId);
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | @Override
|
| | | public long countUsableRewardCoupon(Long uid) {
|
| | |
| | | if (userInfoExtra == null) {
|
| | | return;
|
| | | }
|
| | | |
| | | UserInfoExtra extra = new UserInfoExtra();
|
| | | extra.setId(userInfoExtra.getId());
|
| | | Integer couponNews = userInfoExtra.getCouponNews();
|
| | | if (couponNews == null) {
|
| | | userInfoExtra.setCouponNews(num);
|
| | | extra.setCouponNews(num);
|
| | | } else {
|
| | | userInfoExtra.setCouponNews(couponNews + num);
|
| | | extra.setCouponNews(couponNews + num);
|
| | | }
|
| | | userInfoExtraService.saveUserInfoExtra(userInfoExtra);
|
| | | userInfoExtraService.saveUserInfoExtra(extra);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.integral.IntegralDetailMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.integral.IntegralDetail;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.integral.IntegralDetailVO;
|
| | |
| | | @Resource
|
| | | private IntegralDetailMapper integralDetailMapper;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | | |
| | | @Override
|
| | | public void insertSelective(IntegralDetail record) {
|
| | | integralDetailMapper.insertSelective(record);
|
| | |
| | | } else if (ExchangeTypeEnum.inviteCodePublish == type) {
|
| | | if (codePublishRecordService.countValidRecord(uid) > 0)
|
| | | throw new IntegralExchangeException(1, "三天之内不可重复兑换");
|
| | | exchangeTip.setInviteCode(extraVO.getInviteCode());
|
| | | |
| | | String inviteCode = null;
|
| | | if (!StringUtil.isNullOrEmpty(extraVO.getInviteCodeVip())) {
|
| | | inviteCode = extraVO.getInviteCodeVip();
|
| | | } else {
|
| | | inviteCode = extraVO.getInviteCode();
|
| | | }
|
| | | exchangeTip.setInviteCode(inviteCode);
|
| | | exchangeTip.setTip("兑换成功后,将发布于“激活邀请码兑换功能中”,需激活邀请的用户可用金币兑换,本次展示有效期为3天。");
|
| | | } else if (ExchangeTypeEnum.taoLiJin == type) {
|
| | | exchangeTip.setName(exchange.getAmount().setScale(0) + "元推广红包");
|
| | |
| | | if (userInfoExtra == null)
|
| | | return;
|
| | |
|
| | | Integer goldCoin = userInfoExtra.getGoldCoin();
|
| | | if (goldCoin == null)
|
| | | goldCoin = 0;
|
| | | goldCoin = goldCoin + addGoldCoin;
|
| | |
|
| | | int totalGoldCoin = 0;
|
| | | try {
|
| | | UserInfoExtra extra = new UserInfoExtra();
|
| | | extra.setId(userInfoExtra.getId());
|
| | | extra.setGoldCoin(goldCoin);
|
| | | Integer goldCoin = userInfoExtra.getGoldCoin();
|
| | | if (goldCoin == null) {
|
| | | extra.setGoldCoin(addGoldCoin);
|
| | | } else {
|
| | | extra.setGoldCoin(goldCoin + addGoldCoin);
|
| | | }
|
| | | userInfoExtraService.saveUserInfoExtra(extra);
|
| | | totalGoldCoin = extra.getGoldCoin();
|
| | | } catch (UserInfoExtraException e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | return;
|
| | |
| | | MsgOtherRewardIntegralDTO msgOther = new MsgOtherRewardIntegralDTO();
|
| | | msgOther.setTitle("金币奖励");
|
| | | msgOther.setNum(addGoldCoin + "金币");
|
| | | msgOther.setTotal(goldCoin + "金币");
|
| | | msgOther.setTotal(totalGoldCoin + "金币");
|
| | | if (StringUtil.isNullOrEmpty(level)) {
|
| | | msgOther.setSource("首笔分享订单,系统奖励金币 ");
|
| | | msgOther.setExplain("首笔分享订单得到的奖金不足0.01元时奖励 ");
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.context.annotation.Lazy;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.integral.IntegralDetail;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
|
| | |
| | | @Resource
|
| | | private UserVipConfigService userVipConfigService;
|
| | |
|
| | | @Lazy
|
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | |
|
| | |
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Lazy
|
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | |
|
| | | |
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void addUserVIPInfo(UserVIPInfo info) throws UserVIPInfoException {
|
| | | if (info.getId() == null) {
|
| | | throw new UserVIPInfoException(1, "信息不完整");
|
| | |
| | | // 下级的超级会员 不脱离
|
| | | userInviteSeparateService.updateInvalidByBossId(uid);
|
| | |
|
| | | // 赠送券
|
| | | // 额外信息
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getByUidForUpdate(uid);
|
| | | if (userInfoExtra == null)
|
| | | throw new UserVIPInfoException(1, "用户信息不存在");
|
| | | |
| | | // 添加金币
|
| | | IntegralDetail detail = new IntegralDetail();
|
| | | detail.setTitle("升级VIP福利");
|
| | | detail.setUid(uid);
|
| | | detail.setMoney(Constant.VIP_COLDCOIN_NUM);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUniqueKey("VIP-" + uid);
|
| | | integralDetailService.insertSelective(detail);
|
| | | userInfoExtraService.addGoldCoinByUid(uid, Constant.VIP_COLDCOIN_NUM);
|
| | | |
| | | try {
|
| | | // 奖励券
|
| | | BigDecimal percent = new BigDecimal(configService.get("exchange_rebate_percent"));
|
| | | for (int i = 0; i < Constant.VIP_COUPON_REWARD_NUM; i++) {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, percent, false);
|
| | | }
|
| | |
|
| | | // 赠送免单券
|
| | | for (int i = 0; i < Constant.VIP_COUPON_GIVEFREE_NUM; i++) {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCouponGive.name(),
|
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, null, false);
|
| | |
| | | msgOther.setContent1("恭喜你,已成为超级会员");
|
| | | msgOther.setContent2("满足升级条件");
|
| | | msgOther.setContent3(TimeUtil.formatDateDot(new Date()));
|
| | | userOtherMsgNotificationService.passVIPApplyMsg(uid, "返利奖励券和赠送免单券请到我的-福利中心中查看", msgOther);
|
| | | userOtherMsgNotificationService.passVIPApplyMsg(uid, "返利奖励券和、赠送免单券和金币请到我的-福利中心中查看", msgOther);
|
| | |
|
| | | // 通知上级
|
| | | callBoss(uid);
|
| | |
| | | MsgOtherVIPDTO msgboss = new MsgOtherVIPDTO();
|
| | | msgboss.setContent1(userInfo.getNickName() +" "+ uid);
|
| | | msgboss.setContent2("于" + TimeUtil.formatDateDot(new Date()) + "成功升级成为超级会员");
|
| | | msgboss.setContent3("今日起"+limitDays+"天内,你未能成为超级会员将会与其以及其直接粉丝脱离邀请关系 ");
|
| | | msgboss.setContent3("今日起"+limitDays+"天内,你未能成为超级会员将会与其脱离邀请关系 ");
|
| | | userOtherMsgNotificationService.teamVIPCallBoss(bossId, "如有疑问请联系我的-人工客服", msgboss);
|
| | | }
|
| | |
|
| | |
| | | public void applyVIP(Long uid) throws UserVIPInfoException {
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo == null) {
|
| | | throw new UserVIPInfoException(1, "用户信息不存在");
|
| | | userInfo = new UserVIPInfo();
|
| | | userInfo.setId(uid);
|
| | | addUserVIPInfo(userInfo);
|
| | | }
|
| | |
|
| | | if (userInfo.getState() != UserVIPInfo.STATE_INVALID) {
|
| | | if (userInfo.getState() != UserVIPInfo.STATE_INVALID)
|
| | | throw new UserVIPInfoException(2, "已经申请过");
|
| | | }
|
| | |
|
| | | UserVIPInfo info = new UserVIPInfo();
|
| | | info.setId(userInfo.getId());
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | public void InviteSeparate(Long workerId, Long bossId) {
|
| | | public void inviteSeparate(Long workerId, Long bossId) {
|
| | | if (workerId == null || bossId == null)
|
| | | return;
|
| | |
|
| | |
| | | MsgOtherVIPDTO msgboss = new MsgOtherVIPDTO();
|
| | | msgboss.setContent1(userInfo.getNickName() + workerId + "于" +TimeUtil.formatDateDot(userInviteSeparate.getCreateTime())+"成功升级成为超级会员 ");
|
| | | msgboss.setContent2("很遗憾,你未能在"+limitDays+"天升级为超级会员 ");
|
| | | msgboss.setContent3(" 已与其以及其直接粉丝脱离了邀请关系 ");
|
| | | msgboss.setContent3("已与其脱离邀请关系");
|
| | | userOtherMsgNotificationService.teamSplitCallBoss(bossId, "如有疑问请联系我的-人工客服", msgboss);
|
| | | }
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public SystemCoupon getCouponByTypeAndPercent(String type, BigDecimal percent);
|
| | |
|
| | | /**
|
| | | * 赠送免单券
|
| | | * @return
|
| | | */
|
| | | public List<SystemCoupon> getGiveFreeCouponList();
|
| | |
|
| | | }
|
| | |
| | |
|
| | | public AppPageNotification getValidNotificationByTypeCache(String type);
|
| | |
|
| | |
|
| | | public void updateByPrimaryKey(AppPageNotification record);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public void updateUserRankByUid(Long uid) throws UserInfoExtraException;
|
| | |
|
| | | /**
|
| | | * 根据订单更新
|
| | | * |
| | | * @param userInfoExtra
|
| | | * @return
|
| | | * @throws UserInfoExtraException
|
| | | */
|
| | | public UserInfoExtra updateRank(UserInfoExtra userInfoExtra) throws UserInfoExtraException;
|
| | |
|
| | | /**
|
| | | * 用户激活邀请码
|
| | |
| | | * @throws UserInfoExtraException
|
| | | */
|
| | | public void updateInviteCodeVip(String inviteCode, Long uid) throws UserInfoExtraException;
|
| | |
|
| | | |
| | | public void updateByPrimaryKeySelective(UserInfoExtra record);
|
| | |
|
| | | |
| | | /**
|
| | | * 更新金币
|
| | | * @param uid
|
| | | * @param goldCoin
|
| | | */
|
| | | public void addGoldCoinByUid(Long uid, Integer goldCoin);
|
| | |
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public void sendBackByGiveId(Long giveid);
|
| | |
|
| | | /**
|
| | | * 统计赠送免单券
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public long countGiveFreeCoupon(Long uid);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public BigDecimal getCumulativeMoney(Long uid);
|
| | |
|
| | |
|
| | | }
|
| | |
| | | * @param workerId
|
| | | * @param bossId
|
| | | */
|
| | | public void InviteSeparate(Long workerId, Long bossId);
|
| | | public void inviteSeparate(Long workerId, Long bossId);
|
| | |
|
| | | }
|
| | |
| | | public static final int VIP_COUPON_REWARD_NUM = 30;
|
| | | // vip赠送免单券5张
|
| | | public static final int VIP_COUPON_GIVEFREE_NUM = 5;
|
| | | // vip赠送金币
|
| | | public static final int VIP_COLDCOIN_NUM = 1800;
|
| | |
|
| | |
|
| | | public static WXGZConfig wxGZConfig;
|