| | |
| | | package com.yeshi.fanli.service.impl.integral;
|
| | |
|
| | | import java.text.ParseException;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | |
| | | }
|
| | |
|
| | | if (num > 7) {
|
| | | num = 1;
|
| | | num = 7;
|
| | | }
|
| | | return num;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Date> getSignDays(long uid, Long cid) {
|
| | | List<Date> listDate = new ArrayList<Date>();
|
| | | public List<IntegralTaskRecord> getSignDaysRecord(long uid, Long cid) {
|
| | | List<IntegralTaskRecord> listRecord = new ArrayList<IntegralTaskRecord>();
|
| | | try {
|
| | | // 签到时间正序序查询近7天数据
|
| | | List<IntegralTaskRecord> list = integralTaskRecordMapper.listDaySignRecord(uid, cid);
|
| | |
| | | break; // 天数未连续
|
| | | }
|
| | | date = createTime;
|
| | | listDate.add(record.getCreateTime());
|
| | | listRecord.add(record);
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
|
| | | // 倒序
|
| | | Collections.reverse(listDate);
|
| | | return listDate;
|
| | | return listRecord;
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | // 加入明细
|
| | | IntegralDetail detail = new IntegralDetail();
|
| | | if (UniqueKeyEnum.dailySign == taskClass.getUniqueKey()) {
|
| | | detail.setTitle(taskClass.getName() + "-" + integralTask.getName());
|
| | | SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
|
| | | Date recordTime = record.getCreateTime();
|
| | | List<IntegralTaskRecord> list = integralTaskRecordMapper.listSignRecordByDateTime(uid, cid, format.format(recordTime));
|
| | | int num = 1;
|
| | | if (list != null && list.size() > 0) {
|
| | | try { |
| | | Date nextDate = null;
|
| | | for (IntegralTaskRecord tntegralTaskRecord : list) {
|
| | | if (nextDate == null) {
|
| | | nextDate = tntegralTaskRecord.getCreateTime();
|
| | | continue;
|
| | | }
|
| | |
|
| | | if (DateUtil.daysBetween2(tntegralTaskRecord.getCreateTime(), nextDate) != 1) {
|
| | | break; // 天数未连续
|
| | | }
|
| | | nextDate = tntegralTaskRecord.getCreateTime();
|
| | | num++;
|
| | | }
|
| | | } catch (ParseException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | detail.setTitle(taskClass.getName() + "-第" + num + "天");
|
| | | } else {
|
| | | int num = 0;
|
| | | FrequencyEnum frequency = integralTask.getFrequency();
|