Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum;
|
| | | import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.goods.RecommendUserGoods;
|
| | |
| | | import com.yeshi.fanli.service.inter.push.DeviceActiveService;
|
| | | import com.yeshi.fanli.service.inter.push.PushGoodsService;
|
| | | import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | |
| | |
|
| | | @Resource
|
| | | private MsgDeviceReadStateService msgDeviceReadStateService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | // 消息的类型
|
| | | final static String MSG_TYPE_ORDER = "order";
|
| | |
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key="#acceptData.device")
|
| | | @RequestSerializableByKey(key = "#acceptData.device")
|
| | | @RequestMapping(value = "getUnReadMsgCount", method = RequestMethod.POST)
|
| | | public void getUnReadMsgCount(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | GsonBuilder androidBuilder = new GsonBuilder().registerTypeAdapter(Integer.class,
|
| | |
| | | "android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2, MsgDeviceReadState.TYPE_KEFU);
|
| | | data.put("totalCount", totalCount);
|
| | | }
|
| | |
|
| | | data.put("mineCount", 0);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
| | | data = JSONObject.fromObject(JsonUtil.getApiCommonGson().toJson(num));
|
| | | }
|
| | | data.put("totalCount", totalCount);
|
| | | // "我的"选项角标
|
| | | int welfareCenterNews = 0;
|
| | | if (uid != null) {
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra != null) {
|
| | | if (userInfoExtra.getCouponNews() != null) {
|
| | | welfareCenterNews = userInfoExtra.getCouponNews();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | data.put("mineCount", welfareCenterNews);
|
| | |
|
| | | try {
|
| | | UserSettingsVO vo = userCustomSettingsService.getMySettings(uid);
|
| | |
| | | * @param type
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key="#acceptData.device")
|
| | | @RequestSerializableByKey(key = "#acceptData.device")
|
| | | @RequestMapping(value = "getHomeMsgListNew", method = RequestMethod.POST)
|
| | | public void getHomeMsgListNew(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid != null && uid == 0)
|
| | |
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | |
|
| | | import javax.annotation.Nullable;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.yeshi.fanli.dao.BaseMapper;
|
| | |
| | | * 1倒序-创建时间
|
| | | * @return
|
| | | */
|
| | | List<IntegralTaskRecord> listSignRecordByDateTime(@Param("uid") Long uid, @Param("cid") Long cid, @Param("dateTime") String dateTime);
|
| | | List<IntegralTaskRecord> listSignRecordByDateTime(@Param("uid") Long uid, @Param("cid") Long cid,
|
| | | @Param("dateTime") String dateTime);
|
| | |
|
| | | |
| | | /**
|
| | | * 未领取金币
|
| | | *
|
| | |
| | | * @param minTime
|
| | | * @param maxTime
|
| | | */
|
| | | int countGetCountByTaskIdAndDay(@Param("taskId") Long taskId,@Param("uid")Long uid, @Param("minTime") Date minTime,
|
| | | @Param("maxTime") Date maxTime);
|
| | | |
| | | |
| | | int countGetCountByTaskIdAndDay(@Param("taskId") Long taskId, @Param("uid") Long uid,
|
| | | @Param("minTime") Date minTime, @Param("maxTime") Date maxTime);
|
| | |
|
| | | /**
|
| | | * 统计今日第几次完成的任务
|
| | | *
|
| | |
| | | * @return
|
| | | */
|
| | | int countByTaskIdTodayNum(@Param("uid") Long uid, @Param("tid") Long tid, @Param("date") String date);
|
| | |
|
| | | /**
|
| | | * 根据类型与创建时间检索
|
| | | * |
| | | * @param cid
|
| | | * @param minTime
|
| | | * @param maxTime
|
| | | * @param start
|
| | | * @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);
|
| | |
|
| | | long countByCidAndUidAndCreateTime(@Param("cid") Long cid,@Param("uid") Long uid, @Param("minTime") Date minTime,
|
| | | @Param("maxTime") Date maxTime);
|
| | | }
|
| | |
| | | package com.yeshi.fanli.job;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskClass;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskClass.UniqueKeyEnum;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralTaskClassService;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralTaskRecordService;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | /**
|
| | | * 金币任务
|
| | |
| | | @Resource
|
| | | private PushService pushService;
|
| | |
|
| | | @Resource
|
| | | private IntegralTaskRecordService integralTaskRecordService;
|
| | |
|
| | | @Resource
|
| | | private IntegralTaskClassService integralTaskClassService;
|
| | |
|
| | | /**
|
| | | * 推送签到提醒(每天15点半查询)
|
| | | */
|
| | | @Scheduled(cron="0 30 15 * * ? ")
|
| | | @Scheduled(cron = "0 30 15 * * ? ")
|
| | | public void pushSignInNotify() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | // 获取昨天签到过的
|
| | | IntegralTaskClass dailySignClass = integralTaskClassService.getByUniqueKey(UniqueKeyEnum.dailySign.name());
|
| | | if (dailySignClass == null)
|
| | | return;
|
| | | Long cid = dailySignClass.getId();
|
| | |
|
| | | // 查询今天是否已经签到
|
| | | long timeStamp = System.currentTimeMillis();
|
| | | Date minTime = new Date(TimeUtil.convertToTimeTemp(
|
| | | TimeUtil.getGernalTime(timeStamp - 1000 * 60 * 60 * 24L, "yyyy-MM-dd"), "yyyy-MM-dd"));
|
| | | Date maxTime = new Date(
|
| | | TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(timeStamp, "yyyy-MM-dd"), "yyyy-MM-dd"));
|
| | |
|
| | | // 如果未签到,需要推送信息
|
| | | // pushService.pushUserSignInNotification(uid, title, content, null,
|
| | | // null);
|
| | | Date todayMinTime = new Date(
|
| | | TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(timeStamp, "yyyy-MM-dd"), "yyyy-MM-dd"));
|
| | |
|
| | | Date todayMaxTime = new Date(TimeUtil.convertToTimeTemp(
|
| | | TimeUtil.getGernalTime(timeStamp + 1000 * 60 * 60 * 24L, "yyyy-MM-dd"), "yyyy-MM-dd"));
|
| | |
|
| | | long count = integralTaskRecordService.countByCidAndUidAndCreateTime(cid, null, minTime, maxTime);
|
| | | int page = (int) (count % 200 == 0 ? count / 200 : count / 200 + 1);
|
| | | for (int p = 0; p < page; p++) {
|
| | | List<IntegralTaskRecord> list = integralTaskRecordService.listByCidAndUidAndCreateTime(cid, null, minTime,
|
| | | maxTime, p + 1, 200);
|
| | | if (list != null) {
|
| | | for (IntegralTaskRecord record : list) {
|
| | | // 查询今天是否已经签到
|
| | | long todayCount = integralTaskRecordService.countByCidAndUidAndCreateTime(cid, record.getUid(),
|
| | | todayMinTime, todayMaxTime);
|
| | | if (todayCount <= 0) {// 如果未签到,需要推送信息
|
| | | try {
|
| | | pushService.pushUserSignInNotification(record.getUid(), "今日未签到提醒", "今日还未签到,连续签到金币翻倍哦", null,
|
| | | null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.jd.JDOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.cmq.JDOrderCMQManager;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | |
|
| | |
| | | saveJDOrders(jdOrderList);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 更新一个小时的订单
|
| | | * |
| | | * @param date
|
| | | */
|
| | | private List<JDOrder> getHourOrder(Date date) {
|
| | | List<JDOrder> jdOrderList = new ArrayList<>();
|
| | | int pageSize = 200;
|
| | | int page = 1;
|
| | | JDOrderResult result = JDApiUtil.getOrderList(page++, pageSize, date, JDApiUtil.ORDER_TYPE_UPDATETIME);
|
| | | if (result != null) {
|
| | | jdOrderList.addAll(result.getOrderList());
|
| | | while (result != null && result.isHasMore()) {
|
| | | result = JDApiUtil.getOrderList(page++, pageSize,date, JDApiUtil.ORDER_TYPE_UPDATETIME);
|
| | | if (result != null)
|
| | | jdOrderList.addAll(result.getOrderList());
|
| | | }
|
| | | }
|
| | | return jdOrderList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 更新一天的数据
|
| | | * |
| | | * @param date
|
| | | */
|
| | | public void updateDayOrder(Date date) {
|
| | | Date now = new Date();
|
| | | List<JDOrder> orderList = new ArrayList<>();
|
| | | Date startTime = new Date(
|
| | | TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(date.getTime(), "yyyy-MM-dd"), "yyyy-MM-dd"));
|
| | | // 一个小时为一个步长
|
| | | for (int i = 0; i < 24; i++) {
|
| | | Date da = new Date(startTime.getTime() + 1000 * 60 * 60L * i);
|
| | | if (da.getTime() > now.getTime())
|
| | | return;
|
| | | List<JDOrder> tempOrderList = getHourOrder(da);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | saveJDOrders(orderList);
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 更新最近3天的订单(每天早上凌晨0点过10分,早上8点过10分)
|
| | | */
|
| | | @Scheduled(cron = "0 10 0,8 * * ? ")
|
| | | public void updateLatest3DayOrder() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | Date now = new Date();
|
| | | for (int i = 1; i < 4; i++) {
|
| | | updateDayOrder(new Date(now.getTime() - 1000 * 60 * 60 * 24L * i));
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | AND TO_DAYS(tr.ir_create_time) = TO_DAYS('${date}') AND tr.ir_create_time <![CDATA[<=]]>'${date}'
|
| | | </select>
|
| | |
|
| | | |
| | | <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>
|
| | | </select>
|
| | | |
| | | </mapper> |
| | |
| | | if (UniqueKeyEnum.dailySign == taskClass.getUniqueKey()) {
|
| | | SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
|
| | | Date recordTime = record.getCreateTime();
|
| | | List<IntegralTaskRecord> list = integralTaskRecordMapper.listSignRecordByDateTime(uid, cid, format.format(recordTime));
|
| | | List<IntegralTaskRecord> list = integralTaskRecordMapper.listSignRecordByDateTime(uid, cid,
|
| | | format.format(recordTime));
|
| | | int num = 1;
|
| | | if (list != null && list.size() > 0) {
|
| | | try { |
| | | try {
|
| | | Date nextDate = null;
|
| | | for (IntegralTaskRecord tntegralTaskRecord : list) {
|
| | | if (nextDate == null) {
|
| | |
| | | int num = 0;
|
| | | FrequencyEnum frequency = integralTask.getFrequency();
|
| | | if (frequency == FrequencyEnum.everyday) {
|
| | | num = integralTaskRecordMapper.countByTaskIdTodayNum(uid, taskId, TimeUtil.getWholeTime(record.getCreateTime().getTime()));
|
| | | num = integralTaskRecordMapper.countByTaskIdTodayNum(uid, taskId,
|
| | | TimeUtil.getWholeTime(record.getCreateTime().getTime()));
|
| | | } else if (frequency == FrequencyEnum.onlyOne) {
|
| | | num = 1;
|
| | | }
|
| | | |
| | |
|
| | | if (num <= 0)
|
| | | num = 1;
|
| | | String title = taskClass.getName() + "-" + integralTask.getName() + "-" + num + "次";
|
| | | detail.setTitle(title);
|
| | | }
|
| | | |
| | |
|
| | | detail.setUid(uid);
|
| | | detail.setMoney(record.getGoldCoin());
|
| | | detail.setCreateTime(record.getCreateTime());
|
| | |
| | | integralTaskRecordMapper.insertSelective(record);
|
| | | return record;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<IntegralTaskRecord> listByCidAndUidAndCreateTime(Long cid, Long uid, Date minTime, Date maxTime,
|
| | | int page, int count) {
|
| | | return integralTaskRecordMapper.listByCidAndUidAndCreateTime(cid, uid, minTime, maxTime, (page - 1) * count,
|
| | | count);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByCidAndUidAndCreateTime(Long cid, Long uid, Date minTime, Date maxTime) {
|
| | | return integralTaskRecordMapper.countByCidAndUidAndCreateTime(cid, uid, minTime, maxTime);
|
| | | }
|
| | | }
|
| | |
| | | */
|
| | | public IntegralTaskRecord addRecord(IntegralTaskRecord record) throws IntegralTaskRecordException;
|
| | |
|
| | | /**
|
| | | * 根据类型与时间检索
|
| | | * @param cid
|
| | | * @param minTime
|
| | | * @param maxTime
|
| | | * @param page
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | public List<IntegralTaskRecord> listByCidAndUidAndCreateTime(Long cid,Long uid, Date minTime, Date maxTime, int page, int count);
|
| | |
|
| | | /**
|
| | | * 根据类型与时间检索
|
| | | * @param cid
|
| | | * @param minTime
|
| | | * @param maxTime
|
| | | * @return
|
| | | */
|
| | | public long countByCidAndUidAndCreateTime(Long cid,Long uid, Date minTime, Date maxTime);
|
| | |
|
| | | }
|