fanli/src/main/java/com/yeshi/fanli/aspect/IntegralGetVersionLimitAspect.java
@@ -49,7 +49,7 @@ } @Around("execution(public * com.yeshi.fanli.service.impl.integral.*.*(..))") public Object requestSerializable(ProceedingJoinPoint joinPoint) throws IOException { public Object requestSerializable(ProceedingJoinPoint joinPoint) throws Throwable { Signature signature = joinPoint.getSignature(); MethodSignature methodSignature = (MethodSignature) signature; Method targetMethod = methodSignature.getMethod(); @@ -76,15 +76,9 @@ } catch (SecurityException e) { e.printStackTrace(); } try { return joinPoint.proceed(); } catch (Throwable e) { LogHelper.errorDetailInfo(e); } finally { } return null; return joinPoint.proceed(); } } fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java
@@ -11,7 +11,6 @@ import java.util.Set; import javax.annotation.Resource; import javax.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -414,7 +413,6 @@ GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation(); Gson gson = gsonBuilder.create(); JSONObject data = new JSONObject(); data.put("result", gson.toJson(exchange)); out.print(JsonUtil.loadTrueResult(data)); fanli/src/main/java/com/yeshi/fanli/dao/mybatis/integral/IntegralTaskRecordMapper.java
@@ -61,6 +61,18 @@ List<IntegralTaskRecord> listDaySignRecord(@Param("uid") Long uid, @Param("cid") Long cid); /** * 近7天签到情况 * * @param uid * @param cid * @param sortState * 1倒序-创建时间 * @return */ List<IntegralTaskRecord> listSignRecordByDateTime(@Param("uid") Long uid, @Param("cid") Long cid, @Param("dateTime") String dateTime); /** * 未领取金币 * * @param count fanli/src/main/java/com/yeshi/fanli/mapping/integral/IntegralTaskRecordMapper.xml
@@ -146,9 +146,16 @@ AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) <![CDATA[<=]]> DATE(d.ir_create_time) ORDER BY d.ir_create_time desc ORDER BY d.ir_create_time desc </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} ORDER BY d.ir_create_time desc </select> <select id="countTotalGoldCoin" resultType="Integer"> SELECT fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskClassServiceImpl.java
@@ -20,6 +20,7 @@ import com.yeshi.fanli.entity.integral.IntegralTaskClass; import com.yeshi.fanli.entity.integral.IntegralTaskClass.UniqueKeyEnum; import com.yeshi.fanli.entity.integral.IntegralTaskRank; import com.yeshi.fanli.entity.integral.IntegralTaskRecord; import com.yeshi.fanli.service.inter.integral.IntegralTaskClassService; import com.yeshi.fanli.service.inter.integral.IntegralTaskRankService; import com.yeshi.fanli.service.inter.integral.IntegralTaskRecordService; @@ -132,82 +133,73 @@ @Override public DailySignVO getDailySignList(Long uid, Long rankId) throws ParseException{ SimpleDateFormat format = new SimpleDateFormat("MM.dd"); List<SignDateVO> listSign = new ArrayList<SignDateVO>(); IntegralTaskClass taskClass = integralTaskClassMapper.getByUniqueKey(UniqueKeyEnum.dailySign.name()); if (taskClass == null || taskClass.getState() == null || taskClass.getState() != 1) return null; Long cid = taskClass.getId(); List<IntegralTask> listTask = integralTaskService.listByCid(cid); if (listTask == null || listTask.size() == 0) { return null; } Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat("MM.dd"); List<SignDateVO> listSign = new ArrayList<SignDateVO>(); List<Date> listDays = integralTaskRecordService.getSignDays(uid, cid); for (int i = 0; i < listDays.size(); i ++) { if(i == listDays.size() -1) { SignDateVO signDate = new SignDateVO(); signDate.setDate("今日"); signDate.setLightUp(true); listSign.add(signDate); break; List<IntegralTaskRecord> listRecord = integralTaskRecordService.getSignDaysRecord(uid, cid); if (listRecord != null && listRecord.size() > 0) { for (int i = listRecord.size() - 1; i >= 0; i--) { IntegralTaskRecord taskRecord = listRecord.get(i); SignDateVO signDateVO = new SignDateVO(); signDateVO.setLightUp(true); signDateVO.setGoldCoin("+" + taskRecord.getGoldCoin()); if(i == 0) { signDateVO.setDate("今日"); } else { String before = format.format(taskRecord.getCreateTime()); if (before.startsWith("0")) before = before.substring(1, before.length()); signDateVO.setDate(before); } listSign.add(signDateVO); } String before = format.format(listDays.get(i)); if (before.startsWith("0")) before = before.substring(1, before.length()); SignDateVO signDateVO = new SignDateVO(); signDateVO.setDate(before); signDateVO.setLightUp(true); listSign.add(signDateVO); } for (int i = 1; i <= 7- listDays.size(); i ++) { String after = format.format(DateUtil.plusDayDate(i, date)); if (after.startsWith("0")) after = after.substring(1, after.length()); SignDateVO signDateVO = new SignDateVO(); signDateVO.setDate(after); listSign.add(signDateVO); } DailySignVO dailySignVO = new DailySignVO(); for (int i = 0; i < listTask.size(); i++) { if (listSign.size() <= i) { break; } SignDateVO signDateVO = listSign.get(i); IntegralTask task = listTask.get(i); Integer goldCoin = task.getGoldCoin(); Integer baseDoubleNum = task.getDoubleNum(); if (baseDoubleNum != null && baseDoubleNum > 0) goldCoin = goldCoin * baseDoubleNum; IntegralTaskRank traskRank = integralTaskRankService.getByTsakIdAndRankId(task.getId(), rankId); if (traskRank != null) { Integer addCoin = traskRank.getAddCoin(); if (addCoin != null && addCoin > 0) goldCoin += addCoin; Integer doubleNum = traskRank.getDoubleNum(); if (doubleNum != null && doubleNum > 0) { goldCoin = goldCoin * doubleNum; } } signDateVO.setGoldCoin("+" + goldCoin); if("今日".equals(signDateVO.getDate())) dailySignVO.setGoldCoin(goldCoin); } dailySignVO.setDays(listSign.size()); dailySignVO.setDays(listDays.size()); if (listSign.size() < 7) { List<IntegralTask> listTask = integralTaskService.listByCid(cid); if (listTask == null || listTask.size() == 0) { return null; } Date date = new Date(); int j = 1; for (int i = listSign.size(); i < listTask.size(); i ++) { String after = format.format(DateUtil.plusDayDate(j, date)); if (after.startsWith("0")) after = after.substring(1, after.length()); IntegralTask task = listTask.get(i); Integer goldCoin = task.getGoldCoin(); Integer baseDoubleNum = task.getDoubleNum(); if (baseDoubleNum != null && baseDoubleNum > 0) goldCoin = goldCoin * baseDoubleNum; IntegralTaskRank traskRank = integralTaskRankService.getByTsakIdAndRankId(task.getId(), rankId); if (traskRank != null) { Integer addCoin = traskRank.getAddCoin(); if (addCoin != null && addCoin > 0) goldCoin += addCoin; Integer doubleNum = traskRank.getDoubleNum(); if (doubleNum != null && doubleNum > 0) { goldCoin = goldCoin * doubleNum; } } SignDateVO signDateVO = new SignDateVO(); signDateVO.setDate(after); signDateVO.setGoldCoin("+" + goldCoin); listSign.add(signDateVO); j++; } } dailySignVO.setListDate(listSign); return dailySignVO; } fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java
@@ -1,7 +1,8 @@ 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; @@ -105,14 +106,14 @@ } 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); @@ -124,16 +125,13 @@ break; // 天数未连续 } date = createTime; listDate.add(record.getCreateTime()); listRecord.add(record); } } } catch (Exception e) { LogHelper.errorDetailInfo(e); } // 倒序 Collections.reverse(listDate); return listDate; return listRecord; } @Override @@ -255,7 +253,30 @@ // 加入明细 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(); fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOtherMsgNotificationServiceImpl.java
@@ -250,7 +250,7 @@ rewardMoney, orderId); try { msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(), coupon.getId(), dto, MsgTypeOtherTypeEnum.couponReward, "参与活动可获取更多奖励券")); coupon.getId(), dto, MsgTypeOtherTypeEnum.couponReward, "完成金币任务,兑换更多奖励券")); } catch (MsgOtherDetailException e) { e.printStackTrace(); } @@ -278,7 +278,7 @@ .createRewardCouponAlreadyOutOfDate(coupon.getSource(), coupon.getStartTime(), coupon.getEndTime()); try { MsgOtherDetail detail = MsgOtherDetailFactory.createCouponMsg(coupon.getUid(), coupon.getId(), dto, MsgTypeOtherTypeEnum.couponReward, "参与活动可获取更多奖励券"); MsgTypeOtherTypeEnum.couponReward, "完成金币任务,兑换更多奖励券"); detail.setCreateTime(coupon.getEndTime()); msgOtherDetailService.addMsgOtherDetail(detail); } catch (MsgOtherDetailException e) { fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -2036,11 +2036,7 @@ userCouponVO.setCouponTerm(couponTerm); Map<String, Object> remainDays = new HashMap<String, Object>(); try { remainDays.put("content", "剩余" + DateUtil.dateDiff2(new Date(), record.getGiveTime()) + "过期"); } catch (Exception e) { } remainDays.put("content", "剩余23时59分过期"); remainDays.put("fontColor", "#F14242"); userCouponVO.setRemainDays(remainDays); fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralTaskRecordService.java
@@ -72,7 +72,7 @@ * @param cid * @return */ public List<Date> getSignDays(long uid, Long cid); public List<IntegralTaskRecord> getSignDaysRecord(long uid, Long cid); /** * 领取金币 utils/src/main/java/org/yeshi/utils/DateUtil.java
@@ -55,6 +55,8 @@ if (hour > 0 ) { datatime = hour + "时" + min + "分"; } else { if (min < 0) min = 0; datatime = min + "分"; } }