浏览代码

Merge branch 'developerA' into developer

JiangChongBo 2 年之前
父节点
当前提交
f8abdecf23

+ 16 - 2
src/main/java/com/caimei/controller/admin/auth/AuthApi.java

@@ -58,6 +58,8 @@ import java.util.*;
 public class AuthApi {
 public class AuthApi {
 
 
     private final AuthService authService;
     private final AuthService authService;
+    @Resource
+    private RedisService redisService;
 
 
     /**
     /**
      * 授权列表
      * 授权列表
@@ -530,6 +532,18 @@ public class AuthApi {
         return authService.getDouYingCode(response);
         return authService.getDouYingCode(response);
     }
     }
 
 
+    /**
+     * 清除抖音授权token缓存
+     * @return
+     */
+    @GetMapping("/clean/douyin/redis")
+    public  ResponseJson cleanDYRedis(){
+        redisService.remove("DYaccessToken");
+        redisService.remove("DyrefreshToken");
+        redisService.remove("DyopenId");
+        return ResponseJson.success();
+    }
+
     /**
     /**
      * 根据用户的code值获取AcessToken
      * 根据用户的code值获取AcessToken
      * ccode 用户授权登录code
      * ccode 用户授权登录code
@@ -763,7 +777,7 @@ public class AuthApi {
      */
      */
     @GetMapping("/get/published/video/list")
     @GetMapping("/get/published/video/list")
     public ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideoList(@CurrentUser SysUser sysUser, Integer status, String userName, String authParty, Integer cursor, Integer count, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
     public ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideoList(@CurrentUser SysUser sysUser, Integer status, String userName, String authParty, Integer cursor, Integer count, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
-                                                                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+                                                                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,String startTIme,String endTime) {
         if (null == sysUser) {
         if (null == sysUser) {
             return ResponseJson.error("用户信息异常", null);
             return ResponseJson.error("用户信息异常", null);
         }
         }
@@ -779,7 +793,7 @@ public class AuthApi {
         if (cursor == null) {
         if (cursor == null) {
             cursor = 0;
             cursor = 0;
         }
         }
-        return authService.getPublishedVideo(userName, authParty, status, cursor, count, authUserId, pageNum, pageSize);
+        return authService.getPublishedVideo(userName, authParty, status, cursor, count, authUserId, pageNum, pageSize,startTIme,endTime);
     }
     }
 
 
     /**
     /**

+ 1 - 1
src/main/java/com/caimei/service/auth/AuthService.java

@@ -201,7 +201,7 @@ public interface AuthService {
      * @param authUserId
      * @param authUserId
      * @return
      * @return
      */
      */
-    ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideo(String mobile,String authParty,Integer status,Integer cursor,Integer count,Integer authUserId,Integer pageNum,Integer pageSize);
+    ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideo(String mobile,String authParty,Integer status,Integer cursor,Integer count,Integer authUserId,Integer pageNum,Integer pageSize,String startTIme,String endTime);
 
 
     /**
     /**
      * 获取机构已发布视频的机构下拉列表
      * 获取机构已发布视频的机构下拉列表

+ 26 - 8
src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java

@@ -47,10 +47,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import org.springframework.util.Assert;
 import org.springframework.util.Assert;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -835,6 +832,17 @@ public class AuthServiceImpl implements AuthService {
 //        response.sendRedirect(code);
 //        response.sendRedirect(code);
     }
     }
 
 
+    /**
+     * 清除抖音授权token缓存
+     * @return
+     */
+    @GetMapping("/clean/douyin/redis")
+     public  ResponseJson cleanDYRedis(){
+         redisService.remove("DYaccessToken");
+         redisService.remove("DyrefreshToken");
+         redisService.remove("DyopenId");
+         return ResponseJson.success();
+     }
     /**
     /**
      * 根据用户的code值获取AcessToken
      * 根据用户的code值获取AcessToken
      * ccode 用户授权登录code
      * ccode 用户授权登录code
@@ -1357,10 +1365,15 @@ public class AuthServiceImpl implements AuthService {
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideo(String mobile,String authParty,Integer status,Integer cursor,Integer count,Integer authUserId,Integer pageNum,Integer pageSize){
+    public ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideo(String mobile,String authParty,Integer status,Integer cursor,Integer count,Integer authUserId,Integer pageNum,Integer pageSize,String startTIme,String endTime){
         PageHelper.startPage(pageNum, pageSize);
         PageHelper.startPage(pageNum, pageSize);
+        List<ChallengeRoundVo> listChallengeRoundVo=null;
         ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
         ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
-        List<ChallengeRoundVo> listChallengeRoundVo=authMapper.getPublishedVideo(mobile,authParty,status,authUserId,activityTime.getStartTime(),activityTime.getEndTime());
+        if(StringUtils.isNotEmpty(startTIme)&&StringUtils.isNotEmpty(endTime)){
+            listChallengeRoundVo=authMapper.getPublishedVideo(mobile,authParty,status,authUserId,startTIme,endTime);
+        }else{
+            listChallengeRoundVo=authMapper.getPublishedVideo(mobile,authParty,status,authUserId,activityTime.getStartTime(),activityTime.getEndTime());
+        }
         PageInfo<ChallengeRoundVo> pageData = new PageInfo<>(listChallengeRoundVo);
         PageInfo<ChallengeRoundVo> pageData = new PageInfo<>(listChallengeRoundVo);
         //调用抖音api获取视频数据
         //调用抖音api获取视频数据
         String dyopenId=null;
         String dyopenId=null;
@@ -1422,7 +1435,12 @@ public class AuthServiceImpl implements AuthService {
         }
         }
         PageInfo<ChallengeRoundVo> pageDa = new PageInfo<>(collect);
         PageInfo<ChallengeRoundVo> pageDa = new PageInfo<>(collect);
         //获取不排名的数据
         //获取不排名的数据
-        List<ChallengeRoundVo> publishedVideoListNoRanking = authMapper.getPublishedVideoNoRanking(mobile,authParty,status,authUserId,activityTime.getStartTime(),activityTime.getEndTime());
+        List<ChallengeRoundVo> publishedVideoListNoRanking=null;
+        if(StringUtils.isNotEmpty(startTIme)&&StringUtils.isNotEmpty(endTime)){
+            publishedVideoListNoRanking = authMapper.getPublishedVideoNoRanking(mobile,authParty,status,authUserId,startTIme,endTime);
+        }else{
+            publishedVideoListNoRanking = authMapper.getPublishedVideoNoRanking(mobile,authParty,status,authUserId,activityTime.getStartTime(),activityTime.getEndTime());
+        }
         //获取不排名的数据
         //获取不排名的数据
         if(publishedVideoListNoRanking.size()>0&&listChallengeRoundVo.size()>0){
         if(publishedVideoListNoRanking.size()>0&&listChallengeRoundVo.size()>0){
             for (ChallengeRoundVo noRanking:publishedVideoListNoRanking) {
             for (ChallengeRoundVo noRanking:publishedVideoListNoRanking) {
@@ -1495,7 +1513,7 @@ public class AuthServiceImpl implements AuthService {
         String releaseTime = sf.format(date).replace("T", "");
         String releaseTime = sf.format(date).replace("T", "");
         ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
         ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
         //如果当前时间大于结束时间则活动状态置为未开启状态
         //如果当前时间大于结束时间则活动状态置为未开启状态
-        if(activityTime!=null){
+        if(activityTime!=null&&StringUtils.isNotEmpty(activityTime.getEndTime())){
             if(activityTime.getEndTime().compareTo(releaseTime)<0){
             if(activityTime.getEndTime().compareTo(releaseTime)<0){
                 activityTime.setStatus(0);
                 activityTime.setStatus(0);
                 authMapper.upStatusById(activityTime.getId());
                 authMapper.upStatusById(activityTime.getId());