From e37f68eef94d4fbe489625cac2ffbba32912b1e8 Mon Sep 17 00:00:00 2001 From: tuyp Date: Fri, 25 Mar 2022 18:32:09 +0800 Subject: [PATCH] 2022.03.23 疫情备份 重复数据处理 --- src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java | 2 +- src/main/java/com/subsidy/controller/VodPlayHistoryController.java | 6 ++++++ src/main/java/com/subsidy/mapper/VodDictMapper.java | 6 ++++++ src/main/java/com/subsidy/service/VodPlayHistoryService.java | 5 +++++ src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java | 22 ++++++++++++++++++++++ src/main/java/com/subsidy/vo/vod/VodPlayStateVO.java | 20 ++++++++++++++++++++ src/main/resources/application.properties | 4 ++-- src/main/resources/mapper/VodDictMapper.xml | 14 ++++++++++++++ 8 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/subsidy/vo/vod/VodPlayStateVO.java diff --git a/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java b/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java index 63574c7..36d4db1 100644 --- a/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java +++ b/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java @@ -64,7 +64,7 @@ public class AuthenticationInterceptor implements HandlerInterceptor { token = authorization.replace("Bearer ", ""); } /*Token不存在*/ - if (token == null || JwtUtil.isExpired(token) || !JwtUtil.verifyToken(token)) { + if (token == null || !JwtUtil.verifyToken(token)) { throw new HttpException(1010); } diff --git a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java index 5e873fd..cbbea4e 100644 --- a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java +++ b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java @@ -77,4 +77,10 @@ public class VodPlayHistoryController { vodPlayHistoryService.playLengthFix(remainSecondsDTO); } + + @PostMapping("testPlays") + public ResponseVO testPlays(){ + return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.testPlays()); + } + } diff --git a/src/main/java/com/subsidy/mapper/VodDictMapper.java b/src/main/java/com/subsidy/mapper/VodDictMapper.java index 5461f18..3391cc8 100644 --- a/src/main/java/com/subsidy/mapper/VodDictMapper.java +++ b/src/main/java/com/subsidy/mapper/VodDictMapper.java @@ -5,6 +5,7 @@ import com.subsidy.model.VodDictDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.subsidy.vo.vod.ClassVodCompleteInfoVO; import com.subsidy.vo.vod.GetContendVodsVO; +import com.subsidy.vo.vod.VodPlayStateVO; import org.springframework.stereotype.Repository; import java.util.List; @@ -39,4 +40,9 @@ public interface VodDictMapper extends BaseMapper { * 修改某个视频的顺序 */ void updateVodOrderNo(Long id,Integer orderNo); + + /** + * 重复数据查找 + */ + List testPlays(Long memberId); } diff --git a/src/main/java/com/subsidy/service/VodPlayHistoryService.java b/src/main/java/com/subsidy/service/VodPlayHistoryService.java index 450eb8b..454edfc 100644 --- a/src/main/java/com/subsidy/service/VodPlayHistoryService.java +++ b/src/main/java/com/subsidy/service/VodPlayHistoryService.java @@ -6,6 +6,9 @@ import com.subsidy.dto.vod.SignDatePlaysDTO; import com.subsidy.dto.vod.FixDataTwoDTO; import com.subsidy.model.VodPlayHistoryDO; import com.baomidou.mybatisplus.extension.service.IService; +import com.subsidy.vo.vod.VodPlayStateVO; + +import java.util.List; /** *

@@ -28,4 +31,6 @@ public interface VodPlayHistoryService extends IService { void remainSeconds(RemainSecondsDTO remainSecondsDTO); void playLengthFix(RemainSecondsDTO remainSecondsDTO); + + List testPlays(); } diff --git a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java index f32a0db..0a59e39 100644 --- a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java @@ -12,6 +12,7 @@ import com.subsidy.model.*; import com.subsidy.service.VodPlayHistoryService; import com.subsidy.util.ConstantUtils; import com.subsidy.util.RedisUtil; +import com.subsidy.vo.vod.VodPlayStateVO; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -612,6 +613,27 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl testPlays(){ + + List memberDOS = memberMapper.selectList(null); + List result = new ArrayList<>(); + for (MemberDO memberDO : memberDOS){ + List vodPlayStateVOS = vodDictMapper.testPlays(memberDO.getId()); + for (int i = 0 ; i < vodPlayStateVOS.size() ; i ++){ + for ( int k = i+1 ; k < vodPlayStateVOS.size() ; k ++){ + VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(k); + VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i); + if (vodPlayStateVO.getStartDate().after(vodPlayStateVO1.getStartDate()) && vodPlayStateVO.getStartDate().before(vodPlayStateVO1.getEndDate())){ + System.out.println("11111111111111111111111"+vodPlayStateVO); + result.add(vodPlayStateVO.getId()); + } + } + } + } + return result; + } + + //19为基数的话,3次签到6.5到8,4次签到4.8-6, // 5次4-6,6次3.2-6,7次及以上2.5-6吧 diff --git a/src/main/java/com/subsidy/vo/vod/VodPlayStateVO.java b/src/main/java/com/subsidy/vo/vod/VodPlayStateVO.java new file mode 100644 index 0000000..9590eca --- /dev/null +++ b/src/main/java/com/subsidy/vo/vod/VodPlayStateVO.java @@ -0,0 +1,20 @@ +package com.subsidy.vo.vod; + +import lombok.Data; + +import java.util.Date; + +@Data +public class VodPlayStateVO { + + private Long id; + + private Long memberId; + + private Date startDate; + + private Date endDate; + + private Integer playLength; + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 37ce64a..a62a220 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,7 +1,7 @@ # 环境配置 -spring.profiles.active=prod +spring.profiles.active=dev # 端口号 -spring.server.port=23459 +spring.server.port=23457 #嵌入tomcat配置 #和CPU数 spring.server.acceptorThreadCount=600 diff --git a/src/main/resources/mapper/VodDictMapper.xml b/src/main/resources/mapper/VodDictMapper.xml index 486168a..0f9721e 100644 --- a/src/main/resources/mapper/VodDictMapper.xml +++ b/src/main/resources/mapper/VodDictMapper.xml @@ -91,4 +91,18 @@ update vod_dict t set t.order_no = #{orderNo} where t.id = #{id} + -- libgit2 0.25.0