Commit e37f68ee by 涂亚平

2022.03.23 疫情备份 重复数据处理

1 parent 1f5ea089
......@@ -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);
}
......
......@@ -77,4 +77,10 @@ public class VodPlayHistoryController {
vodPlayHistoryService.playLengthFix(remainSecondsDTO);
}
@PostMapping("testPlays")
public ResponseVO testPlays(){
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.testPlays());
}
}
......@@ -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<VodDictDO> {
* 修改某个视频的顺序
*/
void updateVodOrderNo(Long id,Integer orderNo);
/**
* 重复数据查找
*/
List<VodPlayStateVO> testPlays(Long memberId);
}
......@@ -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;
/**
* <p>
......@@ -28,4 +31,6 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
void remainSeconds(RemainSecondsDTO remainSecondsDTO);
void playLengthFix(RemainSecondsDTO remainSecondsDTO);
List<Long> testPlays();
}
......@@ -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<VodPlayHistoryMapper,
}
}
public List<Long> testPlays(){
List<MemberDO> memberDOS = memberMapper.selectList(null);
List<Long> result = new ArrayList<>();
for (MemberDO memberDO : memberDOS){
List<VodPlayStateVO> 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吧
......
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;
}
# 环境配置
spring.profiles.active=prod
spring.profiles.active=dev
# 端口号
spring.server.port=23459
spring.server.port=23457
#嵌入tomcat配置
#和CPU数
spring.server.acceptorThreadCount=600
......
......@@ -91,4 +91,18 @@
update vod_dict t set t.order_no = #{orderNo} where t.id = #{id}
</update>
<select id="testPlays" parameterType="long" resultType="com.subsidy.vo.vod.VodPlayStateVO">
SELECT
id,
member_id,
DATE_SUB( create_date, INTERVAL play_length SECOND ) AS start_date,
create_date AS end_date,
t.play_length
FROM
vod_play_history t
where t.member_id = #{memberId}
ORDER BY
t.member_id,
start_date
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!