| | |
| | | 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;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserInfoModifyRecordService userInfoModifyRecordService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private IntegralGetService integralGetService;
|
| | |
|
| | | private ExpressionParser parser = new SpelExpressionParser();
|
| | |
|
| | |
| | | Jedis jedis = jedisPool.getResource();
|
| | | try {
|
| | | if (jedis.setnx(key, "1") > 0) {
|
| | | jedis.expire(key, 60*5);// 5分钟内不处理
|
| | | jedis.expire(key, 60 * 5);// 5分钟内不处理
|
| | | try {
|
| | | // TODO 用户活跃处理
|
| | | userInfoModifyRecordService.syncBeforeInfo(Long.parseLong(uidStr));
|
| | | 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 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);
|
| | | }
|
| | |
| | | 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> |
| | |
| | | package com.yeshi.fanli.service.impl.integral;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | |
|
| | | @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);
|
| | | }
|
| | | }
|
| | |
| | | * @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
|