Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.aspectj.lang.ProceedingJoinPoint;
|
| | | import org.aspectj.lang.JoinPoint;
|
| | | import org.aspectj.lang.Signature;
|
| | | import org.aspectj.lang.annotation.Aspect;
|
| | | import org.aspectj.lang.annotation.Before;
|
| | | import org.aspectj.lang.reflect.MethodSignature;
|
| | | import org.springframework.core.DefaultParameterNameDiscoverer;
|
| | |
| | | import org.springframework.expression.ExpressionParser;
|
| | | import org.springframework.expression.spel.standard.SpelExpressionParser;
|
| | | import org.springframework.expression.spel.support.StandardEvaluationContext;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralGetService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoModifyRecordService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.annotation.UserActive;
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | // @Component
|
| | | // @Aspect
|
| | | // @Order(6)
|
| | | @Component
|
| | | @Aspect
|
| | | public class ActiveUserAspect {
|
| | |
|
| | | @Resource
|
| | | private JedisPool jedisPool;
|
| | |
|
| | | @Resource
|
| | | private UserInfoModifyRecordService userInfoModifyRecordService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private IntegralGetService integralGetService;
|
| | |
|
| | | private ExpressionParser parser = new SpelExpressionParser();
|
| | |
|
| | | private DefaultParameterNameDiscoverer nameDiscoverer = new DefaultParameterNameDiscoverer();
|
| | |
|
| | | public String generateKeyBySpEL(String spELString, ProceedingJoinPoint joinPoint) {
|
| | | public String generateKeyBySpEL(String spELString, JoinPoint joinPoint) {
|
| | | MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
|
| | | String[] paramNames = nameDiscoverer.getParameterNames(methodSignature.getMethod());
|
| | | Expression expression = parser.parseExpression(spELString);
|
| | |
| | | public static final String EDP = "execution(* com.yeshi.fanli.controller.client.*.*.*(..))";
|
| | |
|
| | | @Before(EDP)
|
| | | public void activeBefore(ProceedingJoinPoint joinPoint) {
|
| | | public void activeBefore(JoinPoint joinPoint) {
|
| | | try {
|
| | | Signature signature = joinPoint.getSignature();
|
| | | MethodSignature methodSignature = (MethodSignature) signature;
|
| | |
| | | String key = "useractive-" + uidStr;
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | try {
|
| | |
|
| | | if (jedis.setnx(key, "1") > 0) {
|
| | | jedis.expire(key, 60);// 60s内不处理
|
| | | jedis.expire(key, 60 * 5);// 5分钟内不处理
|
| | | try {
|
| | | // TODO 用户活跃处理
|
| | |
|
| | | Long uid = Long.parseLong(uidStr);
|
| | | userInfoModifyRecordService.syncBeforeInfo(uid);
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extra != null && !StringUtil.isNullOrEmpty(extra.getInviteCode()))
|
| | | integralGetService.addInviteActivate(uid);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.util.annotation.UserActive;
|
| | | import com.yeshi.fanli.util.email.MailSenderUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.HongBaoFactory;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserTaoLiJinDetailService userTaoLiJinDetailService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserInfoModifyRecordService userInfoModifyRecordService;
|
| | | |
| | |
|
| | | private static final String PASSWORD_MAX_ERROR = "password_max_error";
|
| | | private static final String EXTRACT_MIN_MONEY = "extract_min_money";
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * h5收藏
|
| | | *
|
| | |
| | |
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 用户队员列表查询 1.5.3查询有效队员
|
| | | *
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 用户队员信息保存 1.4.1
|
| | |
| | | * @param requst
|
| | | * @param out
|
| | | */
|
| | | @UserActive(uid = "#uid")
|
| | | @RequestMapping(value = "getuserinfoNew", method = RequestMethod.POST)
|
| | | public void getuserinfoNew(AcceptData acceptData, Long uid, HttpServletRequest requst, PrintWriter out) {
|
| | | try {
|
| | |
| | | userInfo.setRankNamePicture(null);
|
| | | userInfo.setRankIcon(null);
|
| | | }
|
| | | |
| | |
|
| | | // 1.6.5 之后返回性别、微信号
|
| | | if(VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | if(userInfoExtra.getSex() != null)
|
| | | if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | if (userInfoExtra.getSex() != null)
|
| | | userInfo.setSex(userInfoExtra.getSex());
|
| | | |
| | | if(!StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin()))
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin()))
|
| | | userInfo.setWeiXin(userInfoExtra.getWeiXin());
|
| | | }
|
| | | }
|
| | | // 1.6.5 之后返回 微信号提示
|
| | | if(VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | userInfo.setWeiXinTip("添加微信号后,你的邀请人和一级队员可以通过微信与你建立联系。");
|
| | | |
| | |
|
| | | data.put("user", JsonUtil.getConvertBigDecimalToStringBuilder(gsonBuilder).create().toJson(userInfo));
|
| | | data.put("invitCode", invitCode); // 邀请码
|
| | | data.put("welfareCenterNews", welfareCenterNews);// 福利中心消息
|
| | |
| | | userInfoService.uploadPortrait(file, uid);
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult("保存成功"));
|
| | | |
| | |
|
| | | } catch (UserInfoException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | try {
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveInfo")
|
| | | public void saveInfo(AcceptData acceptData, String nickName, String weiXin, Integer sex, Long uid, PrintWriter out) {
|
| | | public void saveInfo(AcceptData acceptData, String nickName, String weiXin, Integer sex, Long uid,
|
| | | PrintWriter out) {
|
| | | try {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | |
| | | out.print(JsonUtil.loadFalseResult("昵称过长"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (maskKeyService.examineContent(nickName)) {
|
| | | out.print(JsonUtil.loadFalseResult("不能包含敏感词汇"));
|
| | | return;
|
| | | }
|
| | | userInfoService.saveUserInfo(nickName, uid);
|
| | | |
| | |
|
| | | userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.nickName, nickName);
|
| | | }
|
| | | |
| | |
|
| | | // 修改微信号
|
| | | if (!StringUtil.isNullOrEmpty(weiXin)) {
|
| | | if (weiXin.length() > 32) {
|
| | | out.print(JsonUtil.loadFalseResult("微信号过长"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra != null) {
|
| | | UserInfoExtra extra = new UserInfoExtra();
|
| | | extra.setId(userInfoExtra.getId());
|
| | | extra.setWeiXin(weiXin);
|
| | | userInfoExtraService.saveUserInfoExtra(extra);
|
| | | |
| | |
|
| | | userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.setWeiXinNum, weiXin);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 修改性别
|
| | | if (sex != null && sex > 0 && sex < 3) {
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | |
| | | extra.setId(userInfoExtra.getId());
|
| | | extra.setSex(sex);
|
| | | userInfoExtraService.saveUserInfoExtra(extra);
|
| | | |
| | |
|
| | | userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.gender, sex + "");
|
| | | }
|
| | | }
|
| | |
| | | otherInfo.setSpreadHongBao(spreadHongBao);
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | |
|
| | | // 1.6.5后改为福利价
|
| | | if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | if (goodsDetail.getCouponPrice() != null
|
| | | && goodsDetail.getCouponPrice().compareTo(new BigDecimal(0)) > 0)
|
| | | goodsDetail.setCouponPrice(goodsDetail.getCouponPrice().subtract(spreadMoney));
|
| | | else
|
| | | goodsDetail.setZkPrice(goodsDetail.getZkPrice().subtract(spreadMoney));
|
| | | }
|
| | |
|
| | | goodsDetail.getMoneyInfo().setFanliMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods,
|
| | | hongBaoManageService.getTLJShareRate(System.currentTimeMillis())));
|
| | | goodsDetail.getMoneyInfo().setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods,
|
| | |
| | | shareValid = false;
|
| | | helpLink = configService.get("zigoulijian_nofanli_help");
|
| | |
|
| | | String tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, new BigDecimal(70)).toString();
|
| | | BigDecimal tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE);
|
| | |
|
| | | ReduceHongBao reduceHongBao = new ReduceHongBao();
|
| | | reduceHongBao.setLeft(buyGoods.getLeftHongBaoCount());
|
| | | reduceHongBao.setMoney(tljHongBao);
|
| | | reduceHongBao.setMoney(tljHongBao.toString());
|
| | | reduceHongBao.setName("付款立减 ");
|
| | | reduceHongBao.setTip("当日领取,当日内使用,过期失效");
|
| | | reduceHongBao.setTotal(buyGoods.getTotalHongBaoCount());
|
| | |
| | | OtherInfo otherInfo = new OtherInfo();
|
| | | otherInfo.setReduceHongBao(reduceHongBao);
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | |
|
| | | // 1.6.5后改为福利价
|
| | | if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | if (goodsDetail.getCouponPrice() != null
|
| | | && goodsDetail.getCouponPrice().compareTo(new BigDecimal(0)) > 0)
|
| | | goodsDetail.setCouponPrice(goodsDetail.getCouponPrice().subtract(tljHongBao));
|
| | | else
|
| | | goodsDetail.setZkPrice(goodsDetail.getZkPrice().subtract(tljHongBao));
|
| | | }
|
| | |
|
| | | }
|
| | | extraVO.setFanliValid(fanliValid);
|
| | | extraVO.setShareValid(shareValid);
|
| | |
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.fasterxml.jackson.core.util.VersionUtil;
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.JsonElement;
|
| | |
| | | BigDecimal lastMonthUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 4);
|
| | | if (lastMonthUse == null || lastMonthUse.compareTo(zero) > 0) {
|
| | | lastMonthUse = zero;
|
| | | } |
| | | |
| | | String giveMin = configTaoLiJinService.getValueByKey("give_min_amount"); |
| | | }
|
| | |
|
| | | |
| | | String giveMin = configTaoLiJinService.getValueByKey("give_min_amount");
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("tlj", tlj.setScale(2).toString());
|
| | | data.put("giveMin", giveMin);
|
| | | data.put("giveTip", "注:赠送推广红包金额至少"+ giveMin +"元");
|
| | | data.put("giveTip", "注:赠送推广红包金额至少" + giveMin + "元");
|
| | | data.put("helpLink", configTaoLiJinService.getValueByKey("hongbao_help_link"));
|
| | | data.put("countShare", countShare);
|
| | | data.put("todayWin", todayWin.setScale(2).toString());
|
| | |
| | | }
|
| | |
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate);
|
| | | |
| | | // 大于1.6.5的才会显示福利价
|
| | | if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | if (detailVO.getCouponPrice() != null && detailVO.getCouponPrice().compareTo(new BigDecimal(0)) > 0)
|
| | | detailVO.setCouponPrice(detailVO.getCouponPrice().subtract(spreadMoney));
|
| | | else
|
| | | detailVO.setZkPrice(detailVO.getZkPrice().subtract(spreadMoney));
|
| | | }
|
| | | |
| | | // 去掉标签
|
| | | detailVO.setLabels(null);
|
| | |
|
| | |
| | | }
|
| | |
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, proportion, proportion);
|
| | |
|
| | | // 大于1.6.5的才会显示福利价
|
| | | if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | if (detailVO.getCouponPrice() != null && detailVO.getCouponPrice().compareTo(new BigDecimal(0)) > 0)
|
| | | detailVO.setCouponPrice(detailVO.getCouponPrice().subtract(spreadMoney));
|
| | | else
|
| | | detailVO.setZkPrice(detailVO.getZkPrice().subtract(spreadMoney));
|
| | | }
|
| | |
|
| | | // 去掉标签
|
| | | detailVO.setLabels(null);
|
| | |
|
| | |
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 赠送淘礼金
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param amount
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | String tips = userTaoLiJinRecordService.giveTaolijin(uid, amount);
|
| | | out.print(JsonUtil.loadTrueResult(tips));
|
| | |
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | |
|
| | | import javax.annotation.Nullable;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.yeshi.fanli.dao.BaseMapper;
|
| | |
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | List<IntegralTaskRecord> listByCidAndUidAndCreateTime(@Param("cid") Long cid,@Param("uid") Long uid, @Param("minTime") Date minTime,
|
| | | @Param("maxTime") Date maxTime, @Param("start") long start, @Param("count") int count);
|
| | | List<IntegralTaskRecord> listByCidAndUidAndCreateTime(@Param("cid") Long cid, @Param("uid") Long uid,
|
| | | @Param("minTime") Date minTime, @Param("maxTime") Date maxTime, @Param("start") long start,
|
| | | @Param("count") int count);
|
| | |
|
| | | long countByCidAndUidAndCreateTime(@Param("cid") Long cid,@Param("uid") Long uid, @Param("minTime") Date minTime,
|
| | | long countByCidAndUidAndCreateTime(@Param("cid") Long cid, @Param("uid") Long uid, @Param("minTime") Date minTime,
|
| | | @Param("maxTime") Date maxTime);
|
| | |
|
| | | /**
|
| | | * 根据用户ID与任务ID查询
|
| | | * |
| | | * @param uid
|
| | | * @param taskId
|
| | | * @param start
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | List<IntegralTaskRecord> listByUidAndTaskId(@Param("uid") Long uid, @Param("taskId") Long taskId,
|
| | | @Param("start") long start, @Param("count") int count);
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord; |
| | | |
| | | public interface UserInfoModifyRecordMapper extends BaseMapper<UserInfoModifyRecord> { |
| | | |
| | | |
| | | /** |
| | | * 统计修改次数 |
| | | * |
| | | * @param uid |
| | | * @param type 可为空则查询所有类型 |
| | | * @param type |
| | | * 可为空则查询所有类型 |
| | | * @return |
| | | */ |
| | | long countByUid(@Param("uid") Long uid, @Param("type") String type); |
| | | |
| | | /** |
| | | * 根据修改类型与用户ID查询最近一次的修改记录 |
| | | * |
| | | * @param uid |
| | | * @param type |
| | | * @return |
| | | */ |
| | | UserInfoModifyRecord selectLatestByUidAndType(@Param("uid") Long uid, @Param("type") String type); |
| | | |
| | | } |
| | |
| | | AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) <![CDATA[<=]]> |
| | | DATE(d.ir_create_time) |
| | | ORDER BY d.ir_create_time desc
|
| | | </select> |
| | |
|
| | | </select>
|
| | |
|
| | | <select id="listSignRecordByDateTime" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_integral_task_record d
|
| | | WHERE d.`ir_uid` = #{uid} and d.ir_cid=#{cid}
|
| | | AND d.ir_create_time <![CDATA[<=]]> #{dateTime}
|
| | | WHERE d.`ir_uid` = #{uid}
|
| | | and d.ir_cid=#{cid}
|
| | | AND d.ir_create_time <![CDATA[<=]]>
|
| | | #{dateTime}
|
| | | ORDER BY d.ir_create_time desc
|
| | | </select> |
| | | |
| | |
| | | <if test="maxTime!=null"> |
| | | and #{maxTime}>ir_create_time |
| | | </if> |
| | | </select> |
| | |
|
| | | </select>
|
| | |
|
| | | <select id="countByTaskIdTodayNum" resultType="Integer">
|
| | | SELECT IFNULL(COUNT(tr.`ir_id`),0) FROM yeshi_ec_integral_task_record tr
|
| | | WHERE tr.ir_uid = #{uid} AND tr.`ir_task_id`= #{tid} |
| | | AND TO_DAYS(tr.ir_create_time) = TO_DAYS('${date}') AND tr.ir_create_time <![CDATA[<=]]>'${date}'
|
| | | SELECT IFNULL(COUNT(tr.`ir_id`),0) FROM yeshi_ec_integral_task_record
|
| | | tr
|
| | | WHERE tr.ir_uid = #{uid} AND tr.`ir_task_id`= #{tid}
|
| | | AND TO_DAYS(tr.ir_create_time) = TO_DAYS('${date}') AND tr.ir_create_time <![CDATA[<=]]>'${date}'
|
| | | </select>
|
| | | |
| | | |
| | | <select id="listByCidAndUidAndCreateTime" resultMap="BaseResultMap">
|
| | |
|
| | |
|
| | | <select id="listByCidAndUidAndCreateTime" resultMap="BaseResultMap">
|
| | | select * from yeshi_ec_integral_task_record where ir_cid=#{cid}
|
| | | <if test="uid!=null">
|
| | | and ir_uid=#{uid}
|
| | | </if>
|
| | | <if test="minTime!=null">
|
| | | and ir_create_time>=#{minTime}
|
| | | </if>
|
| | | <if test="maxTime!=null">
|
| | | and #{maxTime}>ir_create_time
|
| | | </if>
|
| | | limit #{start},#{count}
|
| | | </select>
|
| | | |
| | | <select id="countByCidAndUidAndCreateTime" resultType="java.lang.Long">
|
| | | select count(ir_id) from yeshi_ec_integral_task_record where ir_cid=#{cid}
|
| | | <if test="uid!=null">
|
| | | and ir_uid=#{uid}
|
| | | </if>
|
| | | <if test="minTime!=null">
|
| | | and ir_create_time>=#{minTime}
|
| | | </if>
|
| | | |
| | | <if test="maxTime!=null">
|
| | | and #{maxTime}>ir_create_time
|
| | | </if>
|
| | | and ir_uid=#{uid}
|
| | | </if>
|
| | | <if test="minTime!=null">
|
| | | and ir_create_time>=#{minTime}
|
| | | </if>
|
| | | <if test="maxTime!=null">
|
| | | and #{maxTime}>ir_create_time
|
| | | </if>
|
| | | limit #{start},#{count}
|
| | | </select>
|
| | |
|
| | | <select id="listByUidAndTaskId" resultMap="BaseResultMap">
|
| | | select * from yeshi_ec_integral_task_record where ir_task_id=#{taskId}
|
| | | <if test="uid!=null">
|
| | | and ir_uid=#{uid}
|
| | | </if>
|
| | | order by ir_id desc
|
| | | limit #{start},#{count}
|
| | | </select>
|
| | | |
| | |
|
| | | <select id="countByCidAndUidAndCreateTime" resultType="java.lang.Long">
|
| | | select count(ir_id) from yeshi_ec_integral_task_record where
|
| | | ir_cid=#{cid}
|
| | | <if test="uid!=null">
|
| | | and ir_uid=#{uid}
|
| | | </if>
|
| | | <if test="minTime!=null">
|
| | | and ir_create_time>=#{minTime}
|
| | | </if>
|
| | |
|
| | | <if test="maxTime!=null">
|
| | | and #{maxTime}>ir_create_time
|
| | | </if>
|
| | | </select>
|
| | |
|
| | | </mapper> |
| | |
| | | <!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.UserInfoModifyRecordMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord"> |
| | | <id column="umr_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="umr_uid" property="uid" jdbcType="BIGINT"/> |
| | | <result column="umr_type" property="type" jdbcType="VARCHAR"/> |
| | | <result column="umr_value" property="value" jdbcType="VARCHAR"/> |
| | | <result column="umr_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">umr_id,umr_uid,umr_type,umr_value,umr_create_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_modify_record where umr_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_modify_record where umr_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_modify_record (umr_id,umr_uid,umr_type,umr_value,umr_create_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{value,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_modify_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">umr_id,</if> |
| | | <if test="uid != null">umr_uid,</if> |
| | | <if test="type != null">umr_type,</if> |
| | | <if test="value != null">umr_value,</if> |
| | | <if test="createTime != null">umr_create_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="type != null">#{type,jdbcType=VARCHAR},</if> |
| | | <if test="value != null">#{value,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord">update yeshi_ec_user_modify_record set umr_uid = #{uid,jdbcType=BIGINT},umr_type = #{type,jdbcType=VARCHAR},umr_value = #{value,jdbcType=VARCHAR},umr_create_time = #{createTime,jdbcType=TIMESTAMP} where umr_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord">update yeshi_ec_user_modify_record |
| | | <set> |
| | | <if test="uid != null">umr_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="type != null">umr_type=#{type,jdbcType=VARCHAR},</if> |
| | | <if test="value != null">umr_value=#{value,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">umr_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where umr_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="countByUid" resultType="Long"> |
| | | SELECT IFNULL(COUNT(d.`umr_id`),0) FROM yeshi_ec_user_modify_record d |
| | | WHERE d.`umr_uid` = #{uid} |
| | | <if test="type != null">AND d.`umr_type`= #{type}</if> |
| | | </select> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord"> |
| | | <id column="umr_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="umr_uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="umr_type" property="type" jdbcType="VARCHAR" /> |
| | | <result column="umr_value" property="value" jdbcType="VARCHAR" /> |
| | | <result column="umr_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">umr_id,umr_uid,umr_type,umr_value,umr_create_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_modify_record where umr_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_user_modify_record where umr_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" |
| | | parameterType="com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_user_modify_record |
| | | (umr_id,umr_uid,umr_type,umr_value,umr_create_time) values |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{value,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_user_modify_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">umr_id,</if> |
| | | <if test="uid != null">umr_uid,</if> |
| | | <if test="type != null">umr_type,</if> |
| | | <if test="value != null">umr_value,</if> |
| | | <if test="createTime != null">umr_create_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="type != null">#{type,jdbcType=VARCHAR},</if> |
| | | <if test="value != null">#{value,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord">update yeshi_ec_user_modify_record set umr_uid = |
| | | #{uid,jdbcType=BIGINT},umr_type = #{type,jdbcType=VARCHAR},umr_value = |
| | | #{value,jdbcType=VARCHAR},umr_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP} where umr_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" |
| | | parameterType="com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord"> |
| | | update yeshi_ec_user_modify_record |
| | | <set> |
| | | <if test="uid != null">umr_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="type != null">umr_type=#{type,jdbcType=VARCHAR},</if> |
| | | <if test="value != null">umr_value=#{value,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">umr_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where umr_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="countByUid" resultType="Long"> |
| | | SELECT IFNULL(COUNT(d.`umr_id`),0) FROM yeshi_ec_user_modify_record d |
| | | WHERE d.`umr_uid` = #{uid} |
| | | <if test="type != null">AND d.`umr_type`= #{type}</if> |
| | | </select> |
| | | |
| | | |
| | | <select id="selectLatestByUidAndType" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_user_modify_record d |
| | | WHERE d.`umr_uid` = #{uid} |
| | | <if test="type != null">AND d.`umr_type`= #{type}</if> |
| | | order by umr_id desc |
| | | limit 1 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTask;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskRank;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTask.FrequencyEnum;
|
| | | 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.exception.integral.IntegralGetException;
|
| | | import com.yeshi.fanli.exception.integral.IntegralTaskRecordException;
|
| | |
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private IntegralTaskRankService integralTaskRankService;
|
| | |
|
| | |
| | | if (count > 0)
|
| | | throw new IntegralGetException(2, "事件触发达到上限");
|
| | | }
|
| | | |
| | |
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra == null)
|
| | | throw new IntegralGetException(2, "额外信息不存在");
|
| | | |
| | |
|
| | | UserRank userRank = userInfoExtra.getUserRank();
|
| | | if (userRank == null)
|
| | | throw new IntegralGetException(2,"等级信息不存在");
|
| | | throw new IntegralGetException(2, "等级信息不存在");
|
| | |
|
| | | int goldCoin = task.getGoldCoin();
|
| | | if (task.getDoubleNum() != null && task.getDoubleNum() > 0)
|
| | | goldCoin = task.getDoubleNum() * goldCoin;
|
| | | |
| | |
|
| | | Long taskId = task.getId();
|
| | | IntegralTaskRank traskRank = integralTaskRankService.getByTsakIdAndRankId(taskId, userRank.getId());
|
| | | if (traskRank != null) {
|
| | |
| | |
|
| | | @Override
|
| | | public int countGetCountByTaskIdAndDay(Long taskId, Long uid, Date day) {
|
| | | if (day == null)
|
| | | return 0;
|
| | | Date minTime = new Date(
|
| | | TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(day.getTime(), "yyyy-MM-dd"), "yyyy-MM-dd"));
|
| | | Date maxTime = new Date(minTime.getTime() + 1000 * 60 * 60 * 24L);
|
| | | Date minTime = null;
|
| | | Date maxTime = null;
|
| | | if (day == null) {
|
| | | minTime = new Date(TimeUtil.convertToTimeTemp("1970-01-01", "yyyy-MM-dd"));
|
| | | maxTime = new Date(TimeUtil.convertToTimeTemp("2100-01-01", "yyyy-MM-dd"));
|
| | | } else {
|
| | | minTime = new Date(
|
| | | TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(day.getTime(), "yyyy-MM-dd"), "yyyy-MM-dd"));
|
| | | maxTime = new Date(minTime.getTime() + 1000 * 60 * 60 * 24L);
|
| | | }
|
| | | return integralTaskRecordMapper.countGetCountByTaskIdAndDay(taskId, uid, minTime, maxTime);
|
| | | }
|
| | |
|
| | |
| | | public long countByCidAndUidAndCreateTime(Long cid, Long uid, Date minTime, Date maxTime) {
|
| | | return integralTaskRecordMapper.countByCidAndUidAndCreateTime(cid, uid, minTime, maxTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<IntegralTaskRecord> listByUidAndTaskId(Long uid, Long taskId, int page, int count) {
|
| | | return integralTaskRecordMapper.listByUidAndTaskId(uid, taskId, (page - 1) * count, count);
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | 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.jd.JDApiUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | |
| | | // 添加资金明细与红包的映射关系
|
| | | for (HongBaoV2 v2 : userHongBao.get(uid)) {
|
| | | accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(v2.getId(), userMoneyDetail.getId());
|
| | | try {
|
| | | HongBaoRecieveCMQManager.getInstance().addHongBaoRecieveMsg(v2.getId());
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | // 站内信+推送
|
| | |
| | | @Override
|
| | | @Transactional
|
| | | public void fanliInvaiteAndShare(Long uid) throws TaoBaoWeiQuanException {
|
| | | List<Long> recieveHongBaoIds = new ArrayList<>();
|
| | | /**
|
| | | * 处理邀请赚订单
|
| | | */
|
| | |
| | | List<Integer> types = new ArrayList<>();
|
| | | types.add(HongBaoV2.TYPE_YIJI);
|
| | | types.add(HongBaoV2.TYPE_ERJI);
|
| | | long count= hongBaoV2Mapper.countCanBalanceHongBaoByTypeAndUid(types, uid);
|
| | | List<HongBaoV2> hongBaoList =new ArrayList<>();
|
| | | //1000条数据为1页
|
| | | int page=(int) (count%1000==0?count/1000:count/1000+1);
|
| | | for(int i=0;i<page;i++)
|
| | | {
|
| | | List<HongBaoV2> tempHongBaoList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid, i*1000,1000);
|
| | | if(tempHongBaoList!=null&&tempHongBaoList.size()>0)
|
| | | long count = hongBaoV2Mapper.countCanBalanceHongBaoByTypeAndUid(types, uid);
|
| | | List<HongBaoV2> hongBaoList = new ArrayList<>();
|
| | | // 1000条数据为1页
|
| | | int page = (int) (count % 1000 == 0 ? count / 1000 : count / 1000 + 1);
|
| | | for (int i = 0; i < page; i++) {
|
| | | List<HongBaoV2> tempHongBaoList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid, i * 1000,
|
| | | 1000);
|
| | | if (tempHongBaoList != null && tempHongBaoList.size() > 0)
|
| | | hongBaoList.addAll(tempHongBaoList);
|
| | | }
|
| | | // 灰度测试中,京东/拼多多订单分享/邀请订单不返利
|
| | |
| | | types.clear();
|
| | | types.add(HongBaoV2.TYPE_SHARE_YIJI);
|
| | | types.add(HongBaoV2.TYPE_SHARE_ERJI);
|
| | | //TODO 需要处理超过1w条数据的订单
|
| | | List<HongBaoV2> hbList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid,0, 10000);
|
| | | // TODO 需要处理超过1w条数据的订单
|
| | | List<HongBaoV2> hbList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid, 0, 10000);
|
| | |
|
| | | if (hbList != null && hbList.size() > 0)
|
| | | totalHongBaoList.addAll(hbList);
|
| | |
| | | for (String orderId : drawBackOrders)
|
| | | taoBaoWeiQuanDrawBackService.doWeiQuanInvite(orderId);
|
| | | }
|
| | |
|
| | | if (hbIdList.size() > 0)
|
| | | recieveHongBaoIds.addAll(hbIdList);
|
| | | hbIdList.clear();
|
| | | drawBackOrders.clear();
|
| | |
|
| | |
| | | // 查询UID的分享赚订单
|
| | | types.clear();
|
| | | types.add(HongBaoV2.TYPE_SHARE_GOODS);
|
| | | //TODO 需要处理超过10000条数据的订单
|
| | | List<HongBaoV2> hongBaoShareList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid,0, 10000);
|
| | | // TODO 需要处理超过10000条数据的订单
|
| | | List<HongBaoV2> hongBaoShareList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid, 0, 10000);
|
| | | for (HongBaoV2 hongBao : hongBaoShareList) {
|
| | | hongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBao.getId());
|
| | | hongBao = filterWeiQuanINGHongBao(hongBao);
|
| | |
| | |
|
| | | // 添加到红包返利记录集合
|
| | | accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(hbIdList, userMoneyDetail.getId());
|
| | | if (hbIdList.size() > 0)
|
| | | recieveHongBaoIds.addAll(hbIdList);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | taoBaoWeiQuanDrawBackService.doWeiQuanShare(orderId);
|
| | | }
|
| | |
|
| | | // 所有的返利到账红包ID
|
| | | for (Long hongBaoId : recieveHongBaoIds) {
|
| | | try {
|
| | | HongBaoRecieveCMQManager.getInstance().addHongBaoRecieveMsg(hongBaoId);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserInfoModifyRecordMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord.ModifyTypeEnum;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralGetService;
|
| | | import com.yeshi.fanli.service.inter.user.BindingAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoModifyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private UserInfoModifyRecordMapper userInfoModifyRecordMapper;
|
| | | |
| | |
|
| | | @Resource
|
| | | private IntegralGetService integralGetService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private BindingAccountService bindingAccountService;
|
| | |
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | |
|
| | | @Async()
|
| | | @Override
|
| | |
| | | try {
|
| | | if (uid == null || StringUtil.isNullOrEmpty(value))
|
| | | return;
|
| | | |
| | |
|
| | | long count = countByUid(uid, type.name());
|
| | | if (count == 0) {
|
| | | if (type == ModifyTypeEnum.bindPhone) {
|
| | |
| | | integralGetService.addSetWeiXinNum(uid);
|
| | | }
|
| | | }
|
| | | |
| | | UserInfoModifyRecord record = new UserInfoModifyRecord();
|
| | | record.setUid(uid);
|
| | | record.setType(type);
|
| | | record.setValue(value);
|
| | | record.setCreateTime(new Date());
|
| | | userInfoModifyRecordMapper.insertSelective(record);
|
| | |
|
| | | UserInfoModifyRecord oldRecord = userInfoModifyRecordMapper.selectLatestByUidAndType(uid, type.name());
|
| | | if (oldRecord == null || !oldRecord.getValue().equalsIgnoreCase(value)) {// 不能修改重复的数据
|
| | | UserInfoModifyRecord record = new UserInfoModifyRecord();
|
| | | record.setUid(uid);
|
| | | record.setType(type);
|
| | | record.setValue(value);
|
| | | record.setCreateTime(new Date());
|
| | | userInfoModifyRecordMapper.insertSelective(record);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | public long countByUid(Long uid, String type) {
|
| | | return userInfoModifyRecordMapper.countByUid(uid, type);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void syncBeforeInfo(Long uid) {
|
| | | // 获取用户基本信息
|
| | | UserInfo user = userInfoService.selectByPKey(uid);
|
| | | if (user == null || user.getState() != UserInfo.STATE_NORMAL) {// 用户不正常
|
| | | return;
|
| | | }
|
| | | if (!StringUtil.isNullOrEmpty(user.getPhone())) {
|
| | | addModifyRecord(uid, ModifyTypeEnum.bindPhone, user.getPhone());
|
| | | }
|
| | |
|
| | | BindingAccount account = bindingAccountService.getBindingAccountByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
|
| | | if (account != null) {
|
| | | addModifyRecord(uid, ModifyTypeEnum.bindAlipay, account.getAccount());
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(user.getWxUnionId())) {
|
| | | addModifyRecord(uid, ModifyTypeEnum.bindWeiXin, user.getWxUnionId());
|
| | | }
|
| | |
|
| | | if (user.getNickName() != null && !user.getNickName().startsWith("返利券")) {
|
| | | addModifyRecord(uid, ModifyTypeEnum.nickName, user.getNickName() + "");
|
| | | }
|
| | |
|
| | | if (!Constant.systemCommonConfig.getDefaultPortrait().equalsIgnoreCase(user.getPortrait())) {
|
| | | addModifyRecord(uid, ModifyTypeEnum.portrait, user.getPortrait());
|
| | | }
|
| | |
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra != null) {
|
| | | if (userInfoExtra.getSex() != null)
|
| | | addModifyRecord(uid, ModifyTypeEnum.gender, userInfoExtra.getSex() + "");
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin()))
|
| | | addModifyRecord(uid, ModifyTypeEnum.setWeiXinNum, userInfoExtra.getWeiXin());
|
| | | }
|
| | |
|
| | | UserExtraTaoBaoInfo taoBaoExtra = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | if (taoBaoExtra != null && !StringUtil.isNullOrEmpty(taoBaoExtra.getRelationId())
|
| | | && !StringUtil.isNullOrEmpty(taoBaoExtra.getSpecialId()) && taoBaoExtra.getRelationValid()
|
| | | && taoBaoExtra.getSpecialValid()) {
|
| | | addModifyRecord(uid, ModifyTypeEnum.bindTaoBao, taoBaoExtra.getTaoBaoUid());
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | * @param uid
|
| | | */
|
| | | public void addInviteActivate(Long uid);
|
| | | |
| | | |
| | |
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public List<IntegralTaskRecord> listByCidAndUidAndCreateTime(Long cid,Long uid, Date minTime, Date maxTime, int page, int count);
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 根据用户ID与任务ID查询记录
|
| | | * @param uid
|
| | | * @param taskId
|
| | | * @param page
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | public List<IntegralTaskRecord> listByUidAndTaskId(Long uid,Long taskId,int page,int count);
|
| | | /**
|
| | | * 根据类型与时间检索
|
| | | * @param cid
|
| | |
| | | public void addModifyRecord(Long uid, ModifyTypeEnum type, String value);
|
| | |
|
| | | /**
|
| | | * 统计修改次数
|
| | | * 同步之前的用户信息
|
| | | * |
| | | * @param uid
|
| | | * @param type 可为空则查询所有类型
|
| | | */
|
| | | public void syncBeforeInfo(Long uid);
|
| | |
|
| | | /**
|
| | | * 统计修改次数
|
| | | * |
| | | * @param uid
|
| | | * @param type
|
| | | * 可为空则查询所有类型
|
| | | * @return
|
| | | */
|
| | | public long countByUid(Long uid, String type);
|
| | |
|
| | |
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.TaoBaoWeiQuanException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.jd.JDOrderService;
|
| | | import com.yeshi.fanli.service.inter.lable.BoutiqueAutoRuleService;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.ExtractService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.cmq.HongBaoRecieveCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.JDOrderCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.PDDOrderCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.ThreeSaleCMQManager;
|
| | |
| | |
|
| | | @Resource
|
| | | private PDDOrderService pddOrderService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | private static boolean isInited = false;
|
| | |
|
| | |
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 红包到账后的金币获取
|
| | | */
|
| | | public void doHongBaoRecieveIntegralGetJob() {
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | while (true) {
|
| | | Map<String, Long> map = HongBaoRecieveCMQManager.getInstance()
|
| | | .consumeQueueMsg(HongBaoRecieveCMQManager.QUEUE_INTEGRAL, 16);
|
| | | if (map != null) {
|
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String key = its.next();
|
| | | Long hongBaoId = map.get(key);
|
| | | try {
|
| | | HongBaoV2 hongBaoV2 = hongBaoV2Service.selectByPrimaryKey(hongBaoId);
|
| | | if (hongBaoV2 != null && hongBaoV2.getState() == HongBaoV2.STATE_YILINGQU) {
|
| | | if (hongBaoV2.getType() == HongBaoV2.TYPE_ZIGOU) {// 自购
|
| | | // TODO 添加加金币事件
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_GOODS) {// 分享赚
|
| | | // TODO 添加加金币事件
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_YIJI
|
| | | || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_YIJI) {// 一级邀请赚
|
| | | // TODO 添加加金币事件
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_ERJI
|
| | | || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_ERJI) {// 二级邀请赚
|
| | | // TODO 添加加金币事件
|
| | | }
|
| | | }
|
| | | HongBaoRecieveCMQManager.getInstance()
|
| | | .deleteQueueMsg(HongBaoRecieveCMQManager.QUEUE_INTEGRAL, key);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | } finally {
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.cmq;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.yeshi.utils.CMQUtil;
|
| | |
|
| | | import com.qcloud.cmq.Message;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
|
| | | public class HongBaoRecieveCMQManager {
|
| | |
|
| | | private static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25";
|
| | | private static String secretKey = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo";
|
| | | private static HongBaoRecieveCMQManager userMoneyChangeCMQManager;
|
| | | private static CMQUtil cmqUtil;
|
| | |
|
| | | private final static String TOPIC_NAME = "topic_hongbao";
|
| | |
|
| | | public static String QUEUE_INTEGRAL = TOPIC_NAME + "_" + "integral";
|
| | |
|
| | | public static String SUBSCRIBE_INTEGRAL = "integral";
|
| | |
|
| | | static {
|
| | | cmqUtil = CMQUtil.getInstance(secretId, secretKey);
|
| | | // 创建主题,添加订阅
|
| | | cmqUtil.createTopic(TOPIC_NAME);
|
| | | // 用户券订阅
|
| | | String[] subscripts = new String[] { SUBSCRIBE_INTEGRAL };
|
| | | String[] queues = new String[] { QUEUE_INTEGRAL };
|
| | |
|
| | | for (int i = 0; i < subscripts.length; i++) {
|
| | | String queueName = queues[i];
|
| | | try {
|
| | | cmqUtil.createQueue(queueName);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | try {
|
| | | cmqUtil.subscribeTopic(TOPIC_NAME, subscripts[i], queueName);
|
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public static HongBaoRecieveCMQManager getInstance() {
|
| | | if (userMoneyChangeCMQManager == null)
|
| | | userMoneyChangeCMQManager = new HongBaoRecieveCMQManager();
|
| | | return userMoneyChangeCMQManager;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 发布
|
| | | * |
| | | * @param hongBaoId
|
| | | */
|
| | | public void addHongBaoRecieveMsg(Long hongBaoId) {
|
| | | if (hongBaoId == null)
|
| | | return;
|
| | | cmqUtil.publishTopicMessage(TOPIC_NAME, hongBaoId + "");
|
| | | LogHelper.test("红包消息投递成功");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 消费队列消息
|
| | | * |
| | | * @param queueName
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | public Map<String, Long> consumeQueueMsg(String queueName, int count) {
|
| | | List<Message> list = cmqUtil.recieveMsg(count, queueName);
|
| | | Map<String, Long> map = new HashMap<>();
|
| | |
|
| | | if (list != null)
|
| | | for (Message msg : list) {
|
| | | String result = msg.msgBody;
|
| | | map.put(msg.receiptHandle, Long.parseLong(result));
|
| | | }
|
| | | return map;
|
| | | }
|
| | |
|
| | | public void deleteQueueMsg(String queueName, String receiptHandle) {
|
| | | cmqUtil.deleteMsg(queueName, receiptHandle);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | map.put("page", page + "");
|
| | | map.put("page_size", pageSize + "");
|
| | | String result = baseRequest(map);
|
| | | System.out.println(result);
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | | JSONObject root = json.optJSONObject("order_list_get_response");
|
| | | if (root != null) {
|
| | |
| | | return "";
|
| | | }
|
| | |
|
| | | public static String getShortLink(String url) { |
| | | public static String getShortLink(String url) {
|
| | | String shortLink = getShortLink2(url);
|
| | | if (StringUtil.isNullOrEmpty(shortLink))
|
| | | shortLink = getShortLink3(url);
|
| | |
| | | private static String getShortLink2(String url) {
|
| | | try {
|
| | | String totalUrl = String.format(
|
| | | "https://api.weibo.com/2/short_url/shorten.json?source=3403499693&url_long=%s",
|
| | | "http://api.t.sina.com.cn/short_url/shorten.json?source=3403499693&url_long=%s",
|
| | | URLEncoder.encode(url));
|
| | | String result = get(totalUrl, null);
|
| | | JSONObject data = JSONObject.fromObject(result);
|
| | | JSONArray array = data.optJSONArray("urls");
|
| | | data = array.optJSONObject(0);
|
| | | String shortUrl = data.optString("url_short");
|
| | | if (!StringUtil.isNullOrEmpty(shortUrl))
|
| | | return shortUrl;
|
| | | JSONObject data = JSONArray.fromObject(result).optJSONObject(0);
|
| | | return data.optString("url_short");
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | private static String getShortLink3(String url) {
|
| | | try {
|
| | | String totalUrl = String.format(
|
| | | "https://api.weibo.com/2/short_url/shorten.json?source=2963429064&url_long=%s",
|
| | | "http://api.t.sina.com.cn/short_url/shorten.json?source=2963429064&url_long=%s",
|
| | | URLEncoder.encode(url));
|
| | | String result = get(totalUrl, null);
|
| | | JSONObject data = JSONObject.fromObject(result);
|
| | | JSONArray array = data.optJSONArray("urls");
|
| | | data = array.optJSONObject(0);
|
| | | String shortUrl = data.optString("url_short");
|
| | | if (!StringUtil.isNullOrEmpty(shortUrl))
|
| | | return shortUrl;
|
| | | JSONObject data = JSONArray.fromObject(result).optJSONObject(0);
|
| | | return data.optString("url_short");
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | |
| | | public static String postSimple(String url) {
|
| | | HttpClient client = new HttpClient();
|
| | | PostMethod method = new PostMethod(url);
|
| | |
| | | }
|
| | | return "";
|
| | | }
|
| | | |
| | | |
| | |
|
| | | public static String post(String url) {
|
| | | HttpClient client = new HttpClient();
|
| | | PostMethod method = new PostMethod(url);
|
| | |
| | |
|
| | | public static String post(String url, Map<String, String> map, Map<String, String> headers) {
|
| | | HttpClient client = new HttpClient();
|
| | | // client.getHostConfiguration().setProxy("192.168.1.122", 8888);
|
| | | // client.getHostConfiguration().setProxy("192.168.1.122", 8888);
|
| | | PostMethod pm = new PostMethod(url);// 创建HttpPost对象
|
| | | NameValuePair[] ns = new NameValuePair[map.keySet().size()];
|
| | | Iterator<String> its = map.keySet().iterator();
|