Selaa lähdekoodia

1.7.5认证通版本功能优化

JiangChongBo 2 vuotta sitten
vanhempi
commit
4a3a7c7c0f

+ 1 - 0
src/main/java/com/caimei/config/ApiConfig.java

@@ -33,6 +33,7 @@ public class ApiConfig implements WebMvcConfigurer {
                 .addPathPatterns("/data/**")
                 .addPathPatterns("/sys/**")
                 .addPathPatterns("/vip/**")
+                .excludePathPatterns("/auth/webhook")
                 .excludePathPatterns("/auth/export/excel");
         registry.addInterceptor(wxApiInterceptor)
                 .addPathPatterns("/wx/data/**")

+ 1 - 0
src/main/java/com/caimei/config/FilterConfig.java

@@ -25,6 +25,7 @@ public class FilterConfig {
         registration.addUrlPatterns("/sys/*");
         registration.addUrlPatterns("/vip/*");
         registration.addUrlPatterns("/auth/export/excel");
+        registration.addUrlPatterns("auth/webhook");
         registration.setName("argumentFilter");
         // 值越小,Filter越靠前
         registration.setOrder(FilterRegistrationBean.LOWEST_PRECEDENCE);

+ 58 - 5
src/main/java/com/caimei/controller/admin/auth/AuthApi.java

@@ -556,7 +556,7 @@ public class AuthApi {
         @PostMapping("/webhook")
         @ResponseBody
         @WebHooks
-        public Object tes(@RequestBody String params){
+        public Object webhook(@RequestBody String params){
             JSONObject paramsMap = JSONObject.parseObject(params);
             System.out.println(paramsMap.getString("item_id"));
             String content = paramsMap.getString("content");
@@ -590,16 +590,22 @@ public class AuthApi {
     @PostMapping("/sms/send/douyin")
     public ResponseJson sms(@RequestBody String params){//String mobile,String content
          JSONObject jsonObject=JSONObject.parseObject(params);
-         String mobile=jsonObject.getString("mobile");
-         String content=jsonObject.getString("content");
-         String authUser=jsonObject.getString("name");
+         //根据authId获取手机号
+         Integer authId = jsonObject.getInteger("authId");
+        String mobile = authService.getMobileByAuthId(authId);
+        //根据authId获取供应商名称
+        String authUserName = authService.getAuthUserName(authId);
+        String content=jsonObject.getString("content");
+//         String authParty=jsonObject.getString("authParty");
         // 短信类型:1通知短信,2验证码短信,3营销短信
         String con=content.substring(0,content.indexOf("/")+1);
         String cs=content.substring(content.indexOf("com")+3);
          Integer type=1;
-         String kouLin="["+authUser+"]您在认证通抖音视频挑战赛发布的视频已成功上传至抖音平台,抖音分享口令为:"+con+" https://v.douyin.com"+cs+",您可复制该口令后去抖音平台打开";
+         String kouLin="["+authUserName+"]您在认证通抖音视频挑战赛发布的视频已成功上传至抖音平台,抖音分享口令为:"+con+" https://v.douyin.com"+cs+",您可复制该口令后去抖音平台打开";
         Boolean flag = SmsUtils.sendSms(type, mobile, kouLin);
         if (flag){
+            //短信发送成功后,保存口令
+            authService.savaDyCommand(authId,content);
             return ResponseJson.success();
         }else{
             return ResponseJson.error("短信发送失败-----"+mobile);
@@ -735,4 +741,51 @@ public class AuthApi {
         }
         return  authService.getActivityTime(authUserId);
     }
+
+    /**
+     * 获取已发布视频
+     * @param sysUser
+     * @param status
+     * @param cursor
+     * @param count
+     * @return
+     */
+    @GetMapping("/get/published/video/list")
+    public ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideoList(@CurrentUser SysUser sysUser,Integer status,String mobile,String authParty,Integer cursor,Integer count, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                                      @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
+        if(count==null){
+            count=10;
+        }
+        if(cursor==null){
+            cursor=0;
+        }
+        return  authService.getPublishedVideo(mobile,authParty,status,cursor,count,authUserId,pageNum,pageSize);
+    }
+    /**
+     * 获取机构已发布视频的机构下拉列表
+     * @return
+     */
+    @GetMapping("/get/auth/party/list")
+    public ResponseJson<List<ChallengeRoundVo>> getAuthPartylist(@CurrentUser SysUser sysUser){
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
+        return authService.getAuthPartylist(authUserId);
+    }
+
 }

+ 6 - 23
src/main/java/com/caimei/controller/wechat/WxAuthApi.java

@@ -326,16 +326,7 @@ public class WxAuthApi {
      * @return
      */
     @PostMapping("/save/video/info")
-    public ResponseJson saveVideoInfo(@CurrentUser SysUser sysUser,@RequestBody String params){
-        if (null == sysUser) {
-            return ResponseJson.error("用户信息异常", null);
-        }
-        // 获取供应商用户id
-        Integer userIdentity = sysUser.getUserIdentity();
-        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
-        if (null == authUserId) {
-            return ResponseJson.error("供应商用户id不能为空", null);
-        }
+    public ResponseJson saveVideoInfo(@RequestBody String params){
         JSONObject jsonObject=JSONObject.parseObject(params);
 //        //验证用户是否可以发布视频
 //         //是否为机构用户
@@ -362,6 +353,7 @@ public class WxAuthApi {
         String ossName=jsonObject.getString("ossName");
         String cover=jsonObject.getString("cover");
         String ossUrl=jsonObject.getString("ossUrl");
+        Integer authUserId=jsonObject.getInteger("authUserId");
         ChallengeRoundVo cr=new ChallengeRoundVo();
         cr.setUserName(userName);
         cr.setCover(cover);
@@ -383,7 +375,8 @@ public class WxAuthApi {
      * @return
      */
     @GetMapping("/get/published/video/list")
-    public ResponseJson<List<ChallengeRoundVo>> getPublishedVideoList(@CurrentUser SysUser sysUser,Integer status,String clubUserName,Integer cursor,Integer count){
+    public ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideoList(@CurrentUser SysUser sysUser,Integer status,String clubUserName,Integer cursor,Integer count,@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                                      @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
         if (null == sysUser) {
             return ResponseJson.error("用户信息异常", null);
         }
@@ -399,7 +392,7 @@ public class WxAuthApi {
         if(cursor==null){
             cursor=0;
         }
-        return  authService.getPublishedVideoList(clubUserName,status,cursor,count,authUserId);
+        return  authService.getPublishedVideoList(clubUserName,status,cursor,count,authUserId,pageNum,pageSize);
     }
 
     /**
@@ -442,20 +435,10 @@ public class WxAuthApi {
 
     /**
      * 判断活动开启状态
-     * @param sysUser
      * @return
      */
     @GetMapping("/get/activitty")
-    public ResponseJson<ChallengeActivityVo> getActivitty(@CurrentUser SysUser sysUser){
-        if (null == sysUser) {
-            return ResponseJson.error("用户信息异常", null);
-        }
-        // 获取供应商用户id
-        Integer userIdentity = sysUser.getUserIdentity();
-        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
-        if (null == authUserId) {
-            return ResponseJson.error("供应商用户id不能为空", null);
-        }
+    public ResponseJson<ChallengeActivityVo> getActivitty(Integer authUserId){
         return authService.getActivitty(authUserId);
     }
 }

+ 13 - 1
src/main/java/com/caimei/mapper/cmMapper/AuthMapper.java

@@ -136,7 +136,11 @@ public interface AuthMapper {
 
     List<ChallengeRoundVo> getPublishedVideoList(@Param("clubUserName")String clubUserName,@Param("status")Integer status,@Param("authUserId")Integer authUserId);
 
-    Integer checkActivityId();
+    List<ChallengeRoundVo> getPublishedVideo(@Param("mobile")String mobile,@Param("authParty")String authParty,@Param("status")Integer status,@Param("authUserId")Integer authUserId);
+
+    List<ChallengeRoundVo> getAuthPartylist(@Param("authUserId")Integer authUserId);
+
+    List<ChallengeActivityVo> checkActivityId();
 
     void saveActivityInfo(@Param("startTime") String startTime,@Param("endTime")String endTime,@Param("status")Integer status,@Param("authUserId")Integer authUserId);
 
@@ -149,4 +153,12 @@ public interface AuthMapper {
     String getShareId(@Param("shareId")String shareId);
 
     void savaItemIdByShareId(@Param("shareId")String shareId,@Param("itemId")String itemId);
+
+    String getMobileByAuthId(Integer authId);
+
+    String getAuthUserName(Integer authId);
+
+    void savaDyCommand(Integer authId,@Param("content")String content);
+
+
 }

+ 1 - 1
src/main/java/com/caimei/model/vo/ChallengeActivityVo.java

@@ -19,7 +19,7 @@ public class ChallengeActivityVo {
     /**
      * 活动结束时间
      */
-    private String  endtime;
+    private String  endTime;
     /**
      * 活动开启状态(0:未开启;1:已开启)
      */

+ 10 - 2
src/main/java/com/caimei/model/vo/ChallengeRoundVo.java

@@ -49,13 +49,21 @@ public class ChallengeRoundVo {
          * 视频分享抖音凭证id
          */
         private String shareId;
+        /**
+         * 抖音口令
+         */
+        private String dyCommand;
         /**
          * 点赞
          */
-        private String digg_count;
+        private String diggCount;
         /**
          * 播放数量
          */
-        private String play_count;
+        private String playCount;
+        /**
+         *
+         */
+        private String authParty;
 
 }

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

@@ -182,15 +182,33 @@ public interface AuthService {
     boolean checkActivityTime(String releaseTime);
 
     /**
-     * 获取已发布视频
+     * 获取已发布视频(前端)
      * @param clubUserName
      * @param status
      * @param cursor
      * @param count
      * @return
      */
-    ResponseJson<List<ChallengeRoundVo>> getPublishedVideoList(String clubUserName,Integer status,Integer cursor,Integer count,Integer authUserId);
+    ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideoList(String clubUserName,Integer status,Integer cursor,Integer count,Integer authUserId,Integer pageNum,Integer pageSize);
 
+    /**
+     * 获取已发布视频(后端)
+     * @param mobile
+     * @param authParty
+     * @param status
+     * @param cursor
+     * @param count
+     * @param authUserId
+     * @return
+     */
+    ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideo(String mobile,String authParty,Integer status,Integer cursor,Integer count,Integer authUserId,Integer pageNum,Integer pageSize);
+
+    /**
+     * 获取机构已发布视频的机构下拉列表
+     * @param authUserId
+     * @return
+     */
+    ResponseJson<List<ChallengeRoundVo>> getAuthPartylist(Integer authUserId);
     /**
      * 保存活动信息
      * @param startTime
@@ -207,7 +225,7 @@ public interface AuthService {
      ResponseJson<ChallengeActivityVo> getActivityTime(Integer authUserId);
 
     /**
-     * 获取shareId
+     * 判断shareId是否存在
      * @param shareId
      * @return
      */
@@ -227,5 +245,21 @@ public interface AuthService {
      */
      ResponseJson<ChallengeActivityVo> getActivitty(Integer sysUser);
 
+    /**
+     * 根据authId获取手机号
+     * @param authId
+     * @return
+     */
+    String getMobileByAuthId(Integer authId);
+    /**
+     * 根据authId获取供应商名称
+     * @param authId
+     * @return
+     */
+    String getAuthUserName(Integer authId);
 
+    /**
+     * 保存抖音口令
+     */
+   void savaDyCommand(Integer authId,String content);
 }

+ 181 - 20
src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java

@@ -820,7 +820,7 @@ public class AuthServiceImpl implements AuthService {
 //        }
              //验证token是否过期
 //              long dYaccessToken = redisService.getExpireTime("DYaccessToken");
-              return redisService.getExpireTime("DYaccessToken")<0 ? ResponseJson.success(false): ResponseJson.success(true);
+        return redisService.getExpireTime("DYaccessToken")<0 ? ResponseJson.success(false): ResponseJson.success(true);
 //        String clintKey = "awwwvh9tsnvo54w1";//应用唯一标识
 //        String responestype = "code";//写死为'code'即可
 //        String scope = "video.data,video.list,trial.whitelist,data.external.item";//应用授权作用域,多个授权作用域以英文逗号(,)分隔
@@ -1118,7 +1118,7 @@ public class AuthServiceImpl implements AuthService {
      * @param cursor 分页游标, 第一页请求cursor是0, response中会返回下一页请求用到的cursor, 同时response还会返回has_more来表明是否有更多的数据。
      * @param count  每页数量 10
      */
-    public String getVideoList(String openId,Integer cursor,Integer count,String accessToken){
+    public String getVideoList(String openId,Long cursor,Integer count,String accessToken){
         String requestUrl="https://open.douyin.com/video/list/?open_id="+openId+"&cursor="+cursor+"&count="+count;
         //创建httppost对象
         CloseableHttpClient closeableHttpClient = HttpClients.createDefault();
@@ -1131,9 +1131,7 @@ public class AuthServiceImpl implements AuthService {
             HttpEntity entity = execute.getEntity();
             String result=EntityUtils.toString(entity,StandardCharsets.UTF_8);
             JSONObject jsonObject = JSONObject.parseObject(result);
-            String data = jsonObject.getString("data");
-            JSONObject paramslist = JSONObject.parseObject(data);
-             resultList = paramslist.getString("list");
+            resultList = jsonObject.getString("data");
 //             resultList = JSONArray.parseArray(itemIdlist);
 //            String itemId = params.getJSONObject(0).get("item_id").toString();
             //根据itemid获取视频的数据(点赞,播放,评论量)
@@ -1206,7 +1204,7 @@ public class AuthServiceImpl implements AuthService {
    }
 
     /**
-     * 获取已发布视频列表
+     * 获取已发布视频列表(前端)
      * @param clubUserName 手机号或者机构名
      * @param status 用户发布状态
      * @param cursor 页码
@@ -1214,28 +1212,146 @@ public class AuthServiceImpl implements AuthService {
      * @return
      */
     @Override
-   public ResponseJson<List<ChallengeRoundVo>> getPublishedVideoList(String clubUserName,Integer status,Integer cursor,Integer count,Integer authUserId){
-       List<ChallengeRoundVo> listChallengeRoundVo=authMapper.getPublishedVideoList(clubUserName,status,authUserId);
-       //调用抖音api获取视频数据
-        String dyopenId=redisService.get("DyopenId").toString();
-        String DYaccessToken=redisService.get("DYaccessToken").toString();
-        String paramsList = getVideoList(dyopenId, cursor, count, DYaccessToken);
+   public ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideoList(String clubUserName,Integer status,Integer cursor,Integer count,Integer authUserId,Integer pageNum,Integer pageSize){
+        PageHelper.startPage(pageNum, pageSize);
+        List<ChallengeRoundVo> listChallengeRoundVo=authMapper.getPublishedVideoList(clubUserName,status,authUserId);
+        PageInfo<ChallengeRoundVo> pageData = new PageInfo<>(listChallengeRoundVo);
+        //调用抖音api获取视频数据
+        String dyopenId=null;
+        String DYaccessToken=null;
+        if(redisService.getExpireTime("DyopenId")>0&&redisService.getExpireTime("DYaccessToken")>0){
+            dyopenId=redisService.get("DyopenId").toString();
+            DYaccessToken=redisService.get("DYaccessToken").toString();
+        }
+        Long flag=1l;
+        List<DyVideoInfoVo> list=new ArrayList<>();
+        while (flag!=0){
+            if (flag==1){flag=0l;}
+            String data = getVideoList(dyopenId, flag, count, DYaccessToken);
+            JSONObject paramslist = JSONObject.parseObject(data);
+            Integer error_code = Integer.valueOf(paramslist.getString("error_code"));
+            if(error_code>0){
+                break;
+            }
+            String resultList = paramslist.getString("list");
+            String cor = paramslist.getString("cursor");
+            flag=Long.parseLong(cor);
+            List<DyVideoInfoVo> listDyVideoInfoVo= JSONArray.parseArray(resultList, DyVideoInfoVo.class);
 
-        List<DyVideoInfoVo> list= JSONArray.parseArray(paramsList, DyVideoInfoVo.class);
+            if(listDyVideoInfoVo!=null&&listDyVideoInfoVo.size()>0){
+                for (DyVideoInfoVo dv:listDyVideoInfoVo) {
+                    list.add(dv);
+                }
+            }
+        }
+        if(listChallengeRoundVo!=null&&listChallengeRoundVo.size()>0){
+            for (ChallengeRoundVo ChallengeRoundVo:listChallengeRoundVo) {
+                if(StringUtils.isEmpty(ChallengeRoundVo.getDiggCount())){
+                    ChallengeRoundVo.setDiggCount("0");
+                }
+                if(StringUtils.isEmpty(ChallengeRoundVo.getPlayCount())){
+                    ChallengeRoundVo.setPlayCount("0");
+                }
+                if(list!=null&&list.size()>0){
+                    for (DyVideoInfoVo dyVideoInfoVo:list) {
+                        if(dyVideoInfoVo.getItem_id().equals(ChallengeRoundVo.getItemId())){
+                            StatisticsVo StatisticsVo= JSONObject.parseObject(dyVideoInfoVo.getStatistics(), StatisticsVo.class);
+                            ChallengeRoundVo.setDiggCount(StatisticsVo.getDigg_count());
+                            ChallengeRoundVo.setPlayCount(StatisticsVo.getPlay_count());
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+        //根据点赞量降序排序
+//        PageHelper.startPage(pageNum, pageSize);
+        List<ChallengeRoundVo> collect = listChallengeRoundVo.stream().sorted(Comparator.comparing(ChallengeRoundVo::getDiggCount).reversed().thenComparing(ChallengeRoundVo::getPlayCount, Comparator.reverseOrder())).collect(Collectors.toList());//先以属性一升序,升序结果进行属性一降序,再进行属性二降序
+        PageInfo<ChallengeRoundVo> pageDa = new PageInfo<>(collect);
+        return ResponseJson.success(pageDa);
+    }
+
+    /**
+     * 获取已发布视频列表(后端)
+     * @param mobile
+     * @param authParty
+     * @param status
+     * @param cursor
+     * @param count
+     * @param authUserId
+     * @return
+     */
+    @Override
+    public ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideo(String mobile,String authParty,Integer status,Integer cursor,Integer count,Integer authUserId,Integer pageNum,Integer pageSize){
+        PageHelper.startPage(pageNum, pageSize);
+        List<ChallengeRoundVo> listChallengeRoundVo=authMapper.getPublishedVideo(mobile,authParty,status,authUserId);
+        PageInfo<ChallengeRoundVo> pageData = new PageInfo<>(listChallengeRoundVo);
+        //调用抖音api获取视频数据
+        String dyopenId=null;
+        String DYaccessToken=null;
+        if(redisService.getExpireTime("DyopenId")>0&&redisService.getExpireTime("DYaccessToken")>0){
+             dyopenId=redisService.get("DyopenId").toString();
+             DYaccessToken=redisService.get("DYaccessToken").toString();
+        }
+        Long flag=1l;
+        List<DyVideoInfoVo> list=new ArrayList<>();
+        while (flag!=0){
+            if (flag==1){flag=0l;}
+            String data = getVideoList(dyopenId, flag, count, DYaccessToken);
+            JSONObject paramslist = JSONObject.parseObject(data);
+            Integer error_code = Integer.valueOf(paramslist.getString("error_code"));
+            if(error_code>0){
+                break;
+            }
+            String resultList = paramslist.getString("list");
+            String cor = paramslist.getString("cursor");
+            flag=Long.parseLong(cor);
+            List<DyVideoInfoVo> listDyVideoInfoVo= JSONArray.parseArray(resultList, DyVideoInfoVo.class);
+
+            if(listDyVideoInfoVo!=null&&listDyVideoInfoVo.size()>0){
+                for (DyVideoInfoVo dv:listDyVideoInfoVo) {
+                    list.add(dv);
+                }
+            }
+        }
+        if(listChallengeRoundVo!=null&&listChallengeRoundVo.size()>0){
         for (ChallengeRoundVo ChallengeRoundVo:listChallengeRoundVo) {
+            if(StringUtils.isEmpty(ChallengeRoundVo.getDiggCount())){
+                ChallengeRoundVo.setDiggCount("0");
+            }
+            if(StringUtils.isEmpty(ChallengeRoundVo.getPlayCount())){
+                ChallengeRoundVo.setPlayCount("0");
+            }
+            if(list!=null&&list.size()>0){
             for (DyVideoInfoVo dyVideoInfoVo:list) {
                 if(dyVideoInfoVo.getItem_id().equals(ChallengeRoundVo.getItemId())){
                     StatisticsVo StatisticsVo= JSONObject.parseObject(dyVideoInfoVo.getStatistics(), StatisticsVo.class);
-                    ChallengeRoundVo.setDigg_count(StatisticsVo.getDigg_count());
-                    ChallengeRoundVo.setPlay_count(StatisticsVo.getPlay_count());
+                        ChallengeRoundVo.setDiggCount(StatisticsVo.getDigg_count());
+                        ChallengeRoundVo.setPlayCount(StatisticsVo.getPlay_count());
                     break;
                 }
             }
+            }
+        }
         }
         //根据点赞量降序排序
-        List<ChallengeRoundVo> collect = listChallengeRoundVo.stream().sorted(Comparator.comparing(ChallengeRoundVo::getDigg_count).reversed().thenComparing(ChallengeRoundVo::getPlay_count, Comparator.reverseOrder())).collect(Collectors.toList());//先以属性一升序,升序结果进行属性一降序,再进行属性二降序
-        return ResponseJson.success(collect);
+//        PageHelper.startPage(pageNum, pageSize);
+        List<ChallengeRoundVo> collect = listChallengeRoundVo.stream().sorted(Comparator.comparing(ChallengeRoundVo::getDiggCount).reversed().thenComparing(ChallengeRoundVo::getPlayCount, Comparator.reverseOrder())).collect(Collectors.toList());//先以属性一升序,升序结果进行属性一降序,再进行属性二降序
+        PageInfo<ChallengeRoundVo> pageDa = new PageInfo<>(collect);
+        return ResponseJson.success(pageDa);
+    }
+
+    /**
+     * 获取机构已发布视频的机构下拉列表
+     * @param authUserId
+     * @return
+     */
+    @Override
+    public  ResponseJson<List<ChallengeRoundVo>> getAuthPartylist(Integer authUserId){
+
+        return ResponseJson.success(authMapper.getAuthPartylist(authUserId));
     }
+
     /**
      * 保存活动信息
      * @param startTime
@@ -1246,8 +1362,12 @@ public class AuthServiceImpl implements AuthService {
     @Override
     public ResponseJson saveActivityTime(String startTime,String endTime,Integer status,Integer authUserId){
         //如果数据库有值则修改,没值则新增
-        Integer aid = authMapper.checkActivityId();
-        if(aid==null){
+        List<ChallengeActivityVo> challengeList = authMapper.checkActivityId();
+        List<Integer> authUserIdList=new ArrayList<>();
+        for (ChallengeActivityVo ac:challengeList) {
+            authUserIdList.add(ac.getAuthUserId());
+        }
+        if(challengeList.size()<0||!authUserIdList.contains(authUserId)){
             authMapper.saveActivityInfo(startTime,endTime,status,authUserId);
         }else {
             authMapper.upActivityInfo(startTime,endTime,status,authUserId);
@@ -1263,10 +1383,22 @@ public class AuthServiceImpl implements AuthService {
     public ResponseJson<ChallengeActivityVo> getActivityTime(Integer authUserId){
          return ResponseJson.success(authMapper.getActivityTime(authUserId));
     }
+
+    /**
+     * 判断shareId是否存在
+     * @param shareId
+     * @return
+     */
     @Override
     public boolean getShareId(String shareId){
         return StringUtils.isNotEmpty(authMapper.getShareId(shareId));
     }
+
+    /**
+     * 根据ShareId保存itemId (webhook触发时调用)
+     * @param shareId
+     * @param itemId
+     */
     @Override
     public void savaItemIdByShareId(String shareId,String itemId){
         authMapper.savaItemIdByShareId(shareId,itemId);
@@ -1280,7 +1412,7 @@ public class AuthServiceImpl implements AuthService {
         if(activityTime!=null){
             if(activityTime.getStartTime().compareTo(releaseTime)>0){
                 activityTime.setActivityState(0);
-            }else if(activityTime.getStartTime().compareTo(releaseTime)<0&&activityTime.getEndtime().compareTo(releaseTime)>0){
+            }else if(activityTime.getStartTime().compareTo(releaseTime)<0&&activityTime.getEndTime().compareTo(releaseTime)>0){
                 activityTime.setActivityState(1);
             }else {
                 activityTime.setActivityState(2);
@@ -1288,4 +1420,33 @@ public class AuthServiceImpl implements AuthService {
         }
         return ResponseJson.success(activityTime);
     }
+
+    /**
+     * 根据authId获取手机号
+     * @param authId
+     * @return
+     */
+    @Override
+    public String getMobileByAuthId(Integer authId){
+        return authMapper.getMobileByAuthId(authId);
+    }
+    /**
+     * 根据authId获取手机号
+     * @param authId
+     * @return
+     */
+    @Override
+    public String getAuthUserName(Integer authId){
+        return authMapper.getAuthUserName(authId);
+    }
+
+    /**
+     * 保存抖音口令
+     * @param authId
+     * @return
+     */
+    @Override
+    public void savaDyCommand(Integer authId,String content){
+         authMapper.savaDyCommand(authId,content);
+    }
 }

+ 44 - 7
src/main/resources/mapper/AuthMapper.xml

@@ -654,10 +654,10 @@
     <select id="checkActivityTime" resultType="java.lang.Integer">
         select id
         from cm_challenge_activity
-        where startTime  &lt;#{releaseTime}  and  endtime &gt;#{releaseTime} and status=1
+        where startTime  &lt;#{releaseTime}  and  endTime &gt;#{releaseTime} and status=1
     </select>
     <select id="getPublishedVideoList" resultType="com.caimei.model.vo.ChallengeRoundVo">
-        select cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId,cr.authId
+        select cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId,cr.authId,cba.authParty,cr.dyCommand
         from cm_challenge_round cr left join cm_brand_auth cba
         on cr.authId=cba.id
                where cr.authUserId=#{authUserId}
@@ -669,23 +669,38 @@
             and cr.status = #{status}
         </if>
     </select>
-    <select id="checkActivityId" resultType="java.lang.Integer">
-        select id
+    <select id="getPublishedVideo" resultType="com.caimei.model.vo.ChallengeRoundVo">
+        select cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId,cr.authId,cba.authParty,cr.dyCommand
+        from cm_challenge_round cr left join cm_brand_auth cba
+        on cr.authId=cba.id
+        where cr.authUserId=#{authUserId}
+        <if test="mobile != null and mobile != ''">
+            and cr.userName like concat('%', #{mobile})
+        </if>
+        <if test="authParty != null and authParty != ''">
+            or  cba.authParty=#{authParty})
+        </if>
+        <if test="status != null">
+            and cr.status = #{status}
+        </if>
+    </select>
+    <select id="checkActivityId" resultType="com.caimei.model.vo.ChallengeActivityVo">
+        select id,authUserId
         from cm_challenge_activity
     </select>
     <insert id="saveActivityInfo">
-            insert into cm_challenge_activity(startTime,endtime,status,authUserId)
+            insert into cm_challenge_activity(startTime,endTime,status,authUserId)
             values(#{startTime},#{endTime},#{status},#{authUserId})
     </insert>
     <update id="upActivityInfo">
         update cm_challenge_activity set
             startTime=#{startTime},
-            endtime=#{endTime},
+            endTime=#{endTime},
             status = #{status}
         where authUserId=#{authUserId}
     </update>
     <select id="getActivityTime" resultType="com.caimei.model.vo.ChallengeActivityVo">
-        select id,startTime,endtime,status,authUserId
+        select id,startTime,endTime,status,authUserId
         from cm_challenge_activity
         where authUserId=#{authUserId}
     </select>
@@ -704,4 +719,26 @@
             itemId=#{itemId}
         where shareId=#{shareId}
     </update>
+    <select id="getAuthUserName" resultType="java.lang.String">
+        select name
+        from cm_brand_auth cba
+        left join cm_brand_auth_user cu on cu.authUserId=cba.authUserId
+        where cba.id=#{authId}
+    </select>
+    <select id="getMobileByAuthId" resultType="java.lang.String">
+        select userName
+        from cm_challenge_round cr
+        where cr.authId=#{authId}
+    </select>
+    <update id="savaDyCommand">
+        update cm_challenge_round set
+            dyCommand=#{content}
+        where authId=#{authId}
+    </update>
+    <select id="getAuthPartylist" resultType="com.caimei.model.vo.ChallengeRoundVo">
+        select cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId, cr.authId,cba.authParty,cr.dyCommand
+        from cm_challenge_round cr left join cm_brand_auth cba
+        on cr.authId=cba.id
+        where cr.authUserId=#{authUserId}
+    </select>
 </mapper>