| | |
| | |
|
| | | import org.aspectj.lang.ProceedingJoinPoint;
|
| | | import org.aspectj.lang.Signature;
|
| | | import org.aspectj.lang.annotation.Around;
|
| | | import org.aspectj.lang.annotation.Aspect;
|
| | | import org.aspectj.lang.reflect.MethodSignature;
|
| | | import org.springframework.stereotype.Component;
|
| | |
| | |
|
| | | public static String KEY = "thisWarning";
|
| | |
|
| | | // @Around(EDP)
|
| | | @Around(EDP)
|
| | | public Object appH5Around(ProceedingJoinPoint joinPoint) throws IOException {
|
| | |
|
| | | ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder
|
| | |
| | | import java.io.IOException;
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.admin.InviteGetMoney;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.entity.system.SystemClientParams;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | | import com.yeshi.fanli.exception.banner.SwiperPictureException;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.InviteGetMoneyService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | import com.yeshi.fanli.service.inter.user.QrCodeService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserRankingsService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | private SystemClientParamsService systemClientParamsService;
|
| | |
|
| | | @Resource
|
| | | private QrCodeService qrCodeService;
|
| | |
|
| | | @Resource
|
| | | private SpreadUserImgService spreadUserImgService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | | @Resource
|
| | | private UserRankingsService userRankingsService;
|
| | |
| | |
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | | |
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | | |
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | |
|
| | | @RequestMapping(value = "/inviteGetMoney", method = RequestMethod.POST)
|
| | | public void everyDayTaskList(AcceptData acceptData, int pageIndex, PrintWriter out, String uid)
|
| | |
| | | data.put("inviteRules", valueBr);
|
| | | out.print(JsonUtil.loadTrue(0, JsonUtil.getSimpleGson().toJson(data), "成功"));
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 邀请激活-特别提示语
|
| | | * @param callback
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getActivationTip")
|
| | | public void getActivationTip(AcceptData acceptData, String callback, PrintWriter out) {
|
| | | try {
|
| | | String tip = configService.get("invite_activation_tip");
|
| | | if (tip == null || tip.trim().length() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无提醒"));
|
| | | return;
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("tip", tip);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("获取失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 激活邀请
|
| | | * @param callback
|
| | | * @param uid 用户id
|
| | | * @param inviteCode 邀请嘛
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "activationInvite")
|
| | | public void activationInvite(AcceptData acceptData, String callback, Long uid, String inviteCode, PrintWriter out) {
|
| | | try {
|
| | | |
| | | if (uid == null || inviteCode == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不正确"));
|
| | | return;
|
| | | }
|
| | | |
| | | String newCode = userInfoExtraService.activateInviteCode(uid, inviteCode);
|
| | | if (newCode == null || newCode.trim().length() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("激活失败"));
|
| | | return;
|
| | | }
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("激活成功"));
|
| | | |
| | | } catch (UserInfoExtraException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("激活失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 获取邀请码
|
| | | * @param callback
|
| | | * @param uid 用户id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getInviteCode")
|
| | | public void getInviteCode(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
|
| | | try {
|
| | | |
| | | if (uid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不正确"));
|
| | | return;
|
| | | }
|
| | | |
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); |
| | | if (userInfoExtra == null || userInfoExtra.getInviteCode() == null) {
|
| | | 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("tip", tip);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("获取数据失败"));
|
| | | e.printStackTrace();
|
| | | } |
| | | }
|
| | | |
| | | /**
|
| | | * 获取邀请短连接
|
| | | * @param callback
|
| | | * @param uid 用户id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getShortLink")
|
| | | public void getShortLink(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
|
| | | try {
|
| | | |
| | | if (uid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不正确"));
|
| | | return;
|
| | | }
|
| | | |
| | | String shortLink = UserUtil.getInviteShortLink(uid);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("shortLink", shortLink);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("生成短连接失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 获取邀请电话号码
|
| | | * @param callback
|
| | | * @param uid 用户id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getUserPhone")
|
| | | public void getUserPhone(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
|
| | | try {
|
| | | |
| | | if (uid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不正确"));
|
| | | return;
|
| | | }
|
| | | |
| | | UserInfo userInfo = userInfoService.selectByPKey(uid);
|
| | | if (userInfo == null || userInfo.getPhone() == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂未绑定电话号码"));
|
| | | return;
|
| | | }
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("phone", userInfo.getPhone());
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("获取数据失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 获取用户邀请上级
|
| | | * @param callback
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getUserBoss")
|
| | | public void getUserBoss(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不正确"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
|
| | | if (threeSale == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("无上级邀请人"));
|
| | | return;
|
| | | }
|
| | | |
| | | |
| | | UserInfo boss = threeSale.getBoss();
|
| | | if (boss == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("上级邀请人获取失败"));
|
| | | return;
|
| | | }
|
| | |
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | Long createTime = threeSale.getCreateTime();
|
| | | Date inviteTime = new Date(createTime);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("nickName", boss.getNickName());
|
| | | data.put("portrait", boss.getPortrait());
|
| | | data.put("inviteTime", sdf.format(inviteTime));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("获取数据失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取等级信息
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getUserConfig", method = RequestMethod.POST)
|
| | | public void getUserConfig(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | |
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | |
| | | String inviteCode = userInfoExtraService.getUserInviteCode(uid);
|
| | | |
| | | JSONObject inviteData = new JSONObject();
|
| | | if (inviteCode == null || inviteCode.trim().length() == 0) {
|
| | | // 无邀请码
|
| | | inviteData.put("content", "邀请激活");
|
| | | inviteData.put("link", configService.get("invite_activation_url"));
|
| | | } else {
|
| | | // 已有邀请码
|
| | | inviteData.put("content", "邀请码");
|
| | | inviteData.put("link", configService.get("invite_activation_success_url"));
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("invite", inviteData);
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (UserInfoExtraException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("获取失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | * @return |
| | | */ |
| | | List<ThreeSale> listByWorkerId(Long workerId); |
| | | |
| | | |
| | | /** |
| | | * 获取成功邀请关系数量 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | int getSuccessRelationshipNum(@Param("uid") Long uid); |
| | | |
| | | |
| | | /** |
| | | * 根据邀请者ID、bossID查询 有效关系 |
| | | * |
| | | * @param workerId |
| | | * @return |
| | | */ |
| | | ThreeSale getRelationshipByBossIdAndWorkerId(@Param("bossId") Long bossId, @Param("workerId") Long workerId); |
| | | |
| | | |
| | | } |
| | |
| | | Map<String, Object> getWeekHasOrder(@Param("channel")String channel, @Param("startTime")String startTime, |
| | | @Param("endTime")String endTime, @Param("orderNum")Integer orderNum); |
| | | |
| | | |
| | | /** |
| | | * 根据电话号码、邀请码获取邀请用户 |
| | | * @param phone |
| | | * @param inviteCode |
| | | * @return |
| | | */ |
| | | UserInfo getInfoByPhoneOrInviteCode(@Param("phone")String phone, @Param("inviteCode")String inviteCode); |
| | | |
| | | } |
| | |
| | | */ |
| | | UserInfoExtraVO getInfoExtraVOByUid(Long uid); |
| | | |
| | | |
| | | /** |
| | | * 更新用户信息根据Uid |
| | | * @param userInfoExtra |
| | | */ |
| | | void updateInfoExtraByUid(UserInfoExtra userInfoExtra); |
| | | |
| | | } |
| | |
| | | @Column(name = "uie_rank_update_time")
|
| | | private Date rankUpdateTime;
|
| | |
|
| | | // 邀请码
|
| | | @Column(name = "uie_invite_code")
|
| | | private String inviteCode;
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "uie_create_time")
|
| | | private Date createTime;
|
| | |
| | | this.rankOrderNum = rankOrderNum;
|
| | | }
|
| | |
|
| | | public String getInviteCode() {
|
| | | return inviteCode;
|
| | | }
|
| | |
|
| | | public void setInviteCode(String inviteCode) {
|
| | | this.inviteCode = inviteCode;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getSuccessRelationshipNum" resultType="java.lang.Integer"> |
| | | SELECT IFNULL (COUNT(*),0) FROM `yeshi_ec_threesale` t |
| | | WHERE t.`state` = 1 AND (t.`worker_id` =${uid} OR t.`boss_id` = ${uid}) |
| | | </select> |
| | | |
| | | <select id="getRelationshipByBossIdAndWorkerId" resultMap="BaseResultMap"> |
| | | SELECT * FROM `yeshi_ec_threesale` t |
| | | WHERE t.`boss_id` = ${bossId} AND t.`worker_id` = ${workerId} |
| | | AND t.`state` = 0 AND (t.`expire` = 0 OR t.`expire`IS NULL) |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') |
| | | ORDER BY u.`createtime` |
| | | </select> |
| | | |
| | | <select id="getInfoByPhoneOrInviteCode" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_user u |
| | | LEFT JOIN yeshi_ec_user_info_extra uf ON uf.`uie_uid` = u.`id` |
| | | WHERE uf.`uie_invite_code` IS NOT NULL |
| | | AND (u.`phone` =#{phone} OR uf.`uie_invite_code` = #{inviteCode}) |
| | | LIMIT 1 |
| | | </select> |
| | | </mapper> |
| | |
| | | <result column="uie_rank_source" property="rankSource" jdbcType="INTEGER"/> |
| | | <result column="uie_rank_order_num" property="rankOrderNum" jdbcType="INTEGER"/> |
| | | <result column="uie_rank_update_time" property="rankUpdateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/> |
| | | <result column="uie_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | |
| | | <result column="uie_rank_source" property="rankSource" jdbcType="INTEGER"/> |
| | | <result column="uie_rank_order_num" property="rankOrderNum" jdbcType="INTEGER"/> |
| | | <result column="uie_rank_update_time" property="rankUpdateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/> |
| | | <result column="uie_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | |
| | | |
| | | </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_create_time,uie_update_time</sql> |
| | | <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_create_time,uie_update_time</sql> |
| | | |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT} |
| | |
| | | |
| | | <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_create_time,uie_update_time) values (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <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_create_time,uie_update_time) values (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{inviteCode,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_extra |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="rankSource != null">uie_rank_source,</if> |
| | | <if test="rankOrderNum != null">uie_rank_order_num,</if> |
| | | <if test="rankUpdateTime != null">uie_rank_update_time,</if> |
| | | <if test="inviteCode != null">uie_invite_code,</if> |
| | | <if test="createTime != null">uie_create_time,</if> |
| | | <if test="updateTime != null">uie_update_time,</if> |
| | | </trim>values |
| | |
| | | <if test="rankSource != null">#{rankSource,jdbcType=INTEGER},</if> |
| | | <if test="rankOrderNum != null">#{rankOrderNum,jdbcType=INTEGER},</if> |
| | | <if test="rankUpdateTime != null">#{rankUpdateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="inviteCode != null">#{inviteCode,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.UserInfoExtra">update yeshi_ec_user_info_extra set uie_uid = #{userInfo.id,jdbcType=BIGINT},uie_rank_id = #{userRank.id,jdbcType=BIGINT},uie_rank_source = #{rankSource,jdbcType=INTEGER},uie_rank_order_num = #{rankOrderNum,jdbcType=INTEGER},uie_rank_update_time = #{rankUpdateTime,jdbcType=TIMESTAMP},uie_create_time = #{createTime,jdbcType=TIMESTAMP},uie_update_time = #{updateTime,jdbcType=TIMESTAMP} where uie_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update yeshi_ec_user_info_extra set uie_uid = #{userInfo.id,jdbcType=BIGINT},uie_rank_id = #{userRank.id,jdbcType=BIGINT},uie_rank_source = #{rankSource,jdbcType=INTEGER},uie_rank_order_num = #{rankOrderNum,jdbcType=INTEGER},uie_rank_update_time = #{rankUpdateTime,jdbcType=TIMESTAMP},uie_invite_code = #{inviteCode,jdbcType=VARCHAR},uie_create_time = #{createTime,jdbcType=TIMESTAMP},uie_update_time = #{updateTime,jdbcType=TIMESTAMP} where uie_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update yeshi_ec_user_info_extra |
| | | <set> |
| | | <if test="userInfo != null">uie_uid=#{userInfo.id,jdbcType=BIGINT},</if> |
| | |
| | | <if test="rankSource != null">uie_rank_source=#{rankSource,jdbcType=INTEGER},</if> |
| | | <if test="rankOrderNum != null">uie_rank_order_num=#{rankOrderNum,jdbcType=INTEGER},</if> |
| | | <if test="rankUpdateTime != null">uie_rank_update_time=#{rankUpdateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="inviteCode != null">uie_invite_code=#{inviteCode,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where uie_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateInfoExtraByUid" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra"> |
| | | update yeshi_ec_user_info_extra |
| | | <set> |
| | | <if test="userRank != null">uie_rank_id=#{userRank.id,jdbcType=BIGINT},</if> |
| | | <if test="rankSource != null">uie_rank_source=#{rankSource,jdbcType=INTEGER},</if> |
| | | <if test="rankOrderNum != null">uie_rank_order_num=#{rankOrderNum,jdbcType=INTEGER},</if> |
| | | <if test="rankUpdateTime != null">uie_rank_update_time=#{rankUpdateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="inviteCode != null">uie_invite_code=#{inviteCode,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where uie_uid = #{userInfo.id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | |
| | | <select id="getInfoExtraByUid" resultMap="BaseResultMap"> |
| | | SELECT * |
| | | FROM yeshi_ec_user_info_extra |
| | | SELECT * FROM yeshi_ec_user_info_extra |
| | | WHERE uie_uid = #{uid} |
| | | </select> |
| | | |
| | |
| | | LEFT JOIN yeshi_ec_user_rank rk ON rk.`ur_id` = ue.`uie_rank_id` |
| | | WHERE u.id = #{uid} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | return threeSaleMapper.listByWorkerId(workerId);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public int getSuccessRelationshipNum(Long uid) {
|
| | | return threeSaleMapper.getSuccessRelationshipNum(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void bindRelationshipByInviteCode(UserInfo invitee, UserInfo inviter) throws ThreeSaleException {
|
| | | |
| | | if (invitee == null || inviter == null)
|
| | | throw new ThreeSaleException(1, "用户信息为空");
|
| | | |
| | | // 获取有效的邀请关系
|
| | | ThreeSale threeSale = |
| | | threeSaleMapper.getRelationshipByBossIdAndWorkerId(inviter.getId(), invitee.getId());
|
| | | |
| | | if (threeSale != null) {
|
| | | // 有效关系--生效
|
| | | threeSale.setState(true);
|
| | | threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
|
| | | threeSale.setSucceedTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
| | | threeSaleMapper.updateByPrimaryKeySelective(threeSale);
|
| | | } else {
|
| | | // 新建立确定关系
|
| | | threeSale = new ThreeSale();
|
| | | threeSale.setBoss(inviter);
|
| | | threeSale.setWorker(invitee);
|
| | | threeSale.setState(true);
|
| | | threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
|
| | | threeSale.setSucceedTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setCreateTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
| | | threeSaleMapper.insertSelective(threeSale);
|
| | | }
|
| | |
|
| | | }
|
| | | |
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRankRecord;
|
| | | import com.yeshi.fanli.exception.ThreeSaleException;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserRankService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.vo.user.UserInfoExtraVO;
|
| | |
|
| | |
|
| | |
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | | |
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | | |
| | |
|
| | | @Override
|
| | | public UserInfoExtraVO getRankInfo(Long uid) throws UserInfoExtraException, Exception {
|
| | |
|
| | |
| | | throw new UserInfoExtraException(1, "用户附加信息不存在");
|
| | | }
|
| | |
|
| | | // 等级列表
|
| | | List<UserRank> listRank = userRankService.getAllRank();
|
| | | if (listRank == null || listRank.size() == 0) {
|
| | | throw new UserInfoExtraException(1, "系统等级不存在");
|
| | | }
|
| | | extraVO.setListRank(listRank);
|
| | |
|
| | | // 等级对照表
|
| | | String contrast = configService.get("user_rank_contrast");
|
| | | extraVO.setRankContrast(contrast);
|
| | | // 特别提醒
|
| | | String rankTip = configService.get("user_rank_tip");
|
| | | extraVO.setRankTip(rankTip);
|
| | |
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | return userInfoExtra;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String activateInviteCode(Long uid, String inviteCode) throws UserInfoExtraException{
|
| | | if (uid == null || inviteCode == null) {
|
| | | throw new UserInfoExtraException(1, "用户id、邀请码不能为空");
|
| | | }
|
| | | |
| | | // 被邀请人信息
|
| | | UserInfo invitee = userInfoService.selectByPKey(uid);
|
| | | if (invitee == null) {
|
| | | throw new UserInfoExtraException(1, "用户不存在");
|
| | | }
|
| | | |
| | | // 邀请人信息
|
| | | UserInfo inviter = userInfoService.getInfoByPhoneOrInviteCode(inviteCode, inviteCode);
|
| | | if (inviter == null) {
|
| | | throw new UserInfoExtraException(1, "请输入有效的邀请码");
|
| | | }
|
| | | |
| | | // 绑定关系
|
| | | try {
|
| | | threeSaleSerivce.bindRelationshipByInviteCode(invitee, inviter);
|
| | | } catch (ThreeSaleException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | throw new UserInfoExtraException(1, "激活失败");
|
| | | }
|
| | | |
| | | |
| | | // 邀请码有效、生成邀请码
|
| | | String code = UserUtil.getInviteCode(uid); |
| | | if (code == null || code.trim().length() == 0) {
|
| | | throw new UserInfoExtraException(1, "激活码生成失败");
|
| | | }
|
| | | |
| | | UserInfoExtra userInfoExtra = new UserInfoExtra();
|
| | | userInfoExtra.setUserInfo(invitee);
|
| | | userInfoExtra.setInviteCode(code);
|
| | | |
| | | // 保存额外信息
|
| | | saveUserInfoExtra(userInfoExtra);
|
| | | |
| | | |
| | | Long id = userInfoExtra.getId();
|
| | | if (id == null) {
|
| | | throw new UserInfoExtraException(1, "激活码生成失败");
|
| | | }
|
| | | |
| | | return code;
|
| | | }
|
| | | |
| | | @Override
|
| | | public UserInfoExtra getUserInfoExtra(Long uid) {
|
| | | return userInfoExtraMapper.getInfoExtraByUid(uid);
|
| | | }
|
| | | |
| | | @Override
|
| | | public String getUserInviteCode(Long uid) throws UserInfoExtraException {
|
| | | |
| | | UserInfoExtra userInfoExtra = userInfoExtraMapper.getInfoExtraByUid(uid);
|
| | | if (userInfoExtra == null) {
|
| | | userInfoExtra = new UserInfoExtra();
|
| | | }
|
| | | |
| | | // 邀请码
|
| | | String inviteCode = userInfoExtra.getInviteCode();
|
| | | |
| | | if (inviteCode == null || inviteCode.trim().length() == 0) {
|
| | | // 判断用户
|
| | | int relationshipNum = threeSaleSerivce.getSuccessRelationshipNum(uid);
|
| | | |
| | | if (relationshipNum > 0) {
|
| | | // 邀请码有效、生成邀请码
|
| | | inviteCode = UserUtil.getInviteCode(uid); |
| | | if (inviteCode == null || inviteCode.trim().length() == 0) {
|
| | | throw new UserInfoExtraException(1, "激活码生成失败");
|
| | | }
|
| | | |
| | | // 保存邀请码
|
| | | userInfoExtra.setUserInfo(new UserInfo(uid));
|
| | | userInfoExtra.setInviteCode(inviteCode);
|
| | | // 保存附加信息
|
| | | saveUserInfoExtra(userInfoExtra);
|
| | | }
|
| | | }
|
| | | |
| | | return inviteCode;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | return userInfoMapper.longTimeNoLogin(daysNum, list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据电话号码、邀请码获取邀请用户
|
| | | * @param phone
|
| | | * @param inviteCode
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public UserInfo getInfoByPhoneOrInviteCode(String phone, String inviteCode) {
|
| | | return userInfoMapper.getInfoByPhoneOrInviteCode(phone, inviteCode);
|
| | | }
|
| | | |
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public List<ThreeSale> listByWorkerId(Long workerId);
|
| | | |
| | | |
| | | /**
|
| | | * 获取成功邀请关系数量
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public int getSuccessRelationshipNum(Long uid);
|
| | |
|
| | | /**
|
| | | * 邀请码生成上下级关系
|
| | | * @param invitee
|
| | | * @param inviter
|
| | | * @throws ThreeSaleException
|
| | | */
|
| | | public void bindRelationshipByInviteCode(UserInfo invitee, UserInfo inviter) throws ThreeSaleException;
|
| | |
|
| | | }
|
| | |
| | | * @throws UserInfoExtraException
|
| | | */
|
| | | public UserInfoExtra updateRank(UserInfoExtra userInfoExtra) throws UserInfoExtraException;
|
| | |
|
| | | /**
|
| | | * 用户激活邀请码
|
| | | * @param uid
|
| | | * @param inviteCode
|
| | | * @return
|
| | | * @throws UserInfoExtraException
|
| | | */
|
| | | public String activateInviteCode(Long uid, String inviteCode) throws UserInfoExtraException;
|
| | |
|
| | | /**
|
| | | * 获取用户附加信息
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public UserInfoExtra getUserInfoExtra(Long uid);
|
| | |
|
| | | /**
|
| | | * 获取用户邀请码
|
| | | * @param uid
|
| | | * @return
|
| | | * @throws UserInfoExtraException
|
| | | */
|
| | | public String getUserInviteCode(Long uid) throws UserInfoExtraException;
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.user;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.net.ConnectException;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
| | | */
|
| | | public List<Long> longTimeNoLogin(int daysNum, List<Long> list);
|
| | |
|
| | | /**
|
| | | * 根据电话号码、邀请码获取邀请用户
|
| | | * @param phone
|
| | | * @param inviteCode
|
| | | * @return
|
| | | */
|
| | | public UserInfo getInfoByPhoneOrInviteCode(String phone, String inviteCode);
|
| | |
|
| | | }
|
| | |
| | | import java.util.List;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | return String.format(Constant.systemCommonConfig.getBaseUserRankIconUrl() + "/rank_picture_%s.png", rank + "");
|
| | | }
|
| | |
|
| | | |
| | | public static String getInviteShortLink (Long uid) {
|
| | | return HttpUtil.getShortLink("http://" + Constant.wxGZConfig.getLoginHost() + "/"
|
| | | + Constant.systemCommonConfig.getProjectName() + "/"
|
| | | + java.lang.System.currentTimeMillis()+
|
| | | "/client/threeShareNew?uid=" + uid);
|
| | | }
|
| | | |
| | | |
| | | |
| | | public static String getInviteCode(Long uid) {
|
| | |
|
| | | long num = 1000000000L + uid;
|
| | |
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | |
|
| | | public class UserInfoExtraVO extends UserInfoExtra implements Serializable {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | |
|
| | | // 系统等级列表
|
| | | // 系统等级列表图片
|
| | | @Expose
|
| | | private List<UserRank> listRank;
|
| | | private String rankContrast;
|
| | | // 系统特别提醒
|
| | | @Expose
|
| | | private String rankTip;
|
| | |
| | | this.galaMsg = galaMsg;
|
| | | }
|
| | |
|
| | | public List<UserRank> getListRank() {
|
| | | return listRank;
|
| | |
|
| | | public String getRankContrast() {
|
| | | return rankContrast;
|
| | | }
|
| | |
|
| | | public void setListRank(List<UserRank> listRank) {
|
| | | this.listRank = listRank;
|
| | | public void setRankContrast(String rankContrast) {
|
| | | this.rankContrast = rankContrast;
|
| | | }
|
| | |
|
| | | public int getOrderNumSelf() {
|