Преглед изворни кода

Merge branch 'developerA' into developer

# Conflicts:
#	src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java
JiangChongBo пре 2 година
родитељ
комит
5917cfd1f1

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

@@ -857,5 +857,45 @@ public class AuthApi {
         Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         return authService.getDyVidoInfo(authUserId);
     }
-
-    }
+//------------------------------------------抖音挑战赛1.7.7版本----------------------------------------------------------------------------------------------------------------
+    /**
+     * 查询机构信息(后端)
+     * @param mobile
+     * @return
+     */
+    @GetMapping("/get/auth/info")
+    public ResponseJson<PageInfo<RossChallengeRoundVo>> getAuthInfo(String mobile,
+                                                                    @CurrentUser SysUser sysUser,
+                                                                @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);
+        }
+        return authService.getAuthInfo(mobile,pageNum,pageSize,authUserId);
+    }
+    /**
+     * 根据id删除机构信息
+     * @param id
+     * @return
+     */
+    @GetMapping("/del/auth/info")
+    public ResponseJson delAuthInfoById(Integer id){
+        //删除机构信息
+        return authService.delAuthInfoById(id);
+    }
+    /**
+     * 根据id删除视频信息
+     * @param id
+     * @return
+     */
+    @GetMapping("/del/video/info")
+    public ResponseJson delVideoInfoById(Integer id){
+        return authService.delVideoInfoById(id);
+    }
+}

+ 44 - 0
src/main/java/com/caimei/controller/admin/data/DatabaseApi.java

@@ -13,9 +13,13 @@ import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
 
 
 import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
 import java.util.HashMap;
 import java.util.List;
 
@@ -218,4 +222,44 @@ public class DatabaseApi {
     public ResponseJson<HashMap<String, String>> ossTokenGet() {
         return databaseService.ossTokenGet();
     }
+
+    /**
+     * 上传文件夹
+     * @param multipartFiles
+     * @return
+     * @throws IOException
+     */
+    @PostMapping("/upload/dictionary")
+    public  ResponseJson uploadDictionary(@RequestParam("file")MultipartFile[] multipartFiles) throws IOException {
+
+//        for (MultipartFile f: multipartFiles) {
+//            //如果是文件夹,创建该文件夹并获取文件夹所有文件
+//            String name="";
+//            File file1;
+//            if (f instanceof CommonsMultipartFile) {
+//
+//                //转换成这个对象,然后我们需要通过里面的FileItem来获得相对路径
+//
+//                CommonsMultipartFile f2 = (CommonsMultipartFile) f;
+//
+//                name = f2.getName();
+//
+//                System.out.println(name + "        ---------相对路径");
+//
+//                file1 = new File("e:" + "/" + name);
+//
+//                file1.mkdirs();
+//
+//                file1.createNewFile();
+//
+//                f.transferTo(file1);
+//
+//            }
+//            System.out.println(f.getOriginalFilename() + "   iii         --------");
+//            //如果是文件,直接添加
+//
+//        }
+        databaseService.uploadDictionary(multipartFiles);
+        return ResponseJson.success();
+    }
 }

+ 139 - 0
src/main/java/com/caimei/controller/wechat/WxAuthApi.java

@@ -452,4 +452,143 @@ public class WxAuthApi {
     public ResponseJson<ChallengeActivityVo> getActivitty(Integer authUserId){
         return authService.getActivitty(authUserId);
     }
+//--------------------------------------------挑战赛1.7.7(ROSS)-------------------------------------------------------------------------------------------------
+    /**
+     * 新增参赛机构信息
+     * @return
+     */
+    @PostMapping("save/ross/info")
+    public ResponseJson saveRossInfo(@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);
+//        }
+        JSONObject jsonObject = JSONObject.parseObject(params);
+        String mobile=jsonObject.getString("mobile");
+        String licenseOssUrl=jsonObject.getString("licenseOssUrl");
+        String licenseOssName=jsonObject.getString("licenseOssName");
+        Integer authId=jsonObject.getInteger("authId");
+        Integer authuser=jsonObject.getInteger("authUserId");
+//        Integer clubUserId=jsonObject.getInteger("clubUserId");
+        //判断该账号是否已经参赛
+        List<RossChallengeRoundVo> infoByUserName = authService.getInfoByUserName(mobile);
+        if(null !=infoByUserName&&infoByUserName.size()>0){
+            return ResponseJson.success("您已报名",infoByUserName);
+        }
+        RossChallengeRoundVo rossChallengeRoundVo=new RossChallengeRoundVo();
+//        if(null!=authUserId){
+//            rossChallengeRoundVo.setAuthUserId(authUserId);
+//        }else{
+            rossChallengeRoundVo.setAuthUserId(authuser);
+//        }
+        rossChallengeRoundVo.setAuthUserId(authuser);
+        rossChallengeRoundVo.setUserName(mobile);
+        rossChallengeRoundVo.setAuthId(authId);
+        rossChallengeRoundVo.setLicenseOssUrl(licenseOssUrl);
+        rossChallengeRoundVo.setLicenseOssName(licenseOssName);
+//        rossChallengeRoundVo.setClubUserId(clubUserId);
+        if(StringUtils.isEmpty(licenseOssUrl)&&StringUtils.isEmpty(licenseOssName)){
+            rossChallengeRoundVo.setAuthenticationStatus(1);
+        }else{
+            rossChallengeRoundVo.setAuthenticationStatus(0);
+        }
+        rossChallengeRoundVo.setContestStatus(1);
+        Date date=new Date();
+        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//        String format = sf.format(date);
+        rossChallengeRoundVo.setContestTime(new java.sql.Timestamp(date.getTime()));
+        return authService.saveRossInfo(rossChallengeRoundVo);
+    }
+    /**
+     * 验证用户是否已经报名
+     * @param mobile
+     * @return
+     */
+    @GetMapping("/check/contest/info")
+    public ResponseJson<RossChallengeRoundVo> checkContestedInfo(String mobile,Integer authUserId){
+        return authService.checkContestedInfo(mobile,authUserId);
+    }
+    /**
+     * 获取已报名信息列表
+     * @return
+     */
+    @GetMapping("/get/contested/info")
+    public ResponseJson<List<RossChallengeRoundVo>> getcontestedInfo(Integer authUserId){
+        return authService.getcontestedInfo(authUserId);
+    }
+
+    /**
+     * 根据手机号码查询该机构视频列表
+     * @param mobile  登录账号
+     * @return
+     */
+    @GetMapping("/get/video/username")
+    public ResponseJson<List<RossChallengeVideo>> getVideoByUsername(String mobile,Integer clubUserId,Integer authUserId){
+        return authService.getVideoByUsername(mobile,clubUserId,authUserId);
+    }
+
+    /**
+     * 查询视频列表
+     * @param mobileOrAuthpart 电话号码或者机构名称
+     * @return
+     */
+    @GetMapping("/get/video/all")
+    public ResponseJson<PageInfo<RossChallengeVideo>> getVideoAll(String mobileOrAuthpart,Integer clubUserId,Integer authUserId,
+                                                              @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                              @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
+        return authService.getVideoAll(mobileOrAuthpart,clubUserId,authUserId,pageNum,pageSize);
+    }
+    /**
+     * 验证机构是否已经上传了3个视频(点击上传视频时验证)
+     * @param mobile 登录账号
+     * @return
+     */
+    @GetMapping("/check/video/username")
+    public ResponseJson<List<RossChallengeVideo>> checkVideoByUsername(String mobile,Integer authUserId){
+        return authService.checkVideoByUsername(mobile,authUserId);
+    }
+    /**
+     * 点赞与取消点赞
+     * @return
+     */
+    @PostMapping("/up/video/diggcount")
+    public ResponseJson upVideoDiggCount(@RequestBody String params){
+        JSONObject jsonObject=JSONObject.parseObject(params);
+        Integer id=jsonObject.getInteger("id");
+        Integer diggStatus=jsonObject.getInteger("diggStatus");
+        String clubUserIds=jsonObject.getString("clubUserIds");
+        Integer clubUserId=jsonObject.getInteger("clubUserId");
+        return  authService.upVideoDiggCount(id,diggStatus,clubUserId,clubUserIds);
+    }
+    /**
+     * 1.7.7保存视频信息
+     * @return
+     */
+    @PostMapping("/save/video")
+    public ResponseJson saveVideo(@RequestBody String params){
+        JSONObject jsonObject=JSONObject.parseObject(params);
+        Integer authId=jsonObject.getInteger("authId");
+        String userName=jsonObject.getString("userName");
+        String title=jsonObject.getString("title");
+        String ossName=jsonObject.getString("ossName");
+        String cover=jsonObject.getString("cover");
+        String ossUrl=jsonObject.getString("ossUrl");
+        String linked=jsonObject.getString("linked");
+        Integer authUserId=jsonObject.getInteger("authUserId");
+        RossChallengeVideo cr=new RossChallengeVideo();
+        cr.setUserName(userName);
+        cr.setCover(cover);
+        cr.setOssName(ossName);
+        cr.setOssUrl(ossUrl);
+        cr.setTitle(title);
+        cr.setAuthId(authId);
+        cr.setLinked(linked);
+        cr.setAuthUserId(authUserId);
+        return authService.saveVideo(cr);
+    }
 }

+ 38 - 0
src/main/java/com/caimei/mapper/cmMapper/AuthMapper.java

@@ -22,6 +22,8 @@ public interface AuthMapper {
     List<AuthVo> getAuthList(@Param("listType") Integer listType, @Param("authUserId") Integer authUserId, @Param("authParty") String authParty, @Param("mobile") String mobile, @Param("status") Integer status, @Param("starFlag")  Integer starFlag, @Param("auditStatus") Integer auditStatus, @Param("lowerAuditStatus") Integer lowerAuditStatus, @Param("shopAuditStatus") Integer shopAuditStatus, @Param("sendStatus") Integer sendStatus,@Param("authCode") String authCode);
     List<AuthVo> getAuthListAll(@Param("listType") Integer listType, @Param("authUserId") Integer authUserId, @Param("authParty") String authParty, @Param("mobile") String mobile, @Param("status") Integer status, @Param("starFlag")  Integer starFlag, @Param("auditStatus") Integer auditStatus, @Param("lowerAuditStatus") Integer lowerAuditStatus, @Param("shopAuditStatus") Integer shopAuditStatus, @Param("sendStatus") Integer sendStatus,@Param("name") String name,@Param("snCode") String snCode);
 
+    Integer getClubUserIdByAuthId(Integer authId);
+
     void updateAuthStatusByAuthId(@Param("authId") Integer authId, @Param("status") Integer status);
 
     void deleteAuthByAuthId(Integer authId);
@@ -131,6 +133,7 @@ public interface AuthMapper {
     String getPrefix(Integer authUserId);
 
     void saveVideoInfo(@Param("userName") String userName,@Param("cover") String cover,@Param("ossUrl") String ossUrl,@Param("ossName") String ossName,@Param("title") String title,@Param("releaseTime") String releaseTime,@Param("authId") Integer authId,@Param("authUserId")Integer authUserId);
+    void saveVideo(@Param("userName") String userName,@Param("cover") String cover,@Param("ossUrl") String ossUrl,@Param("ossName") String ossName,@Param("title") String title,@Param("releaseTime") String releaseTime,@Param("authId") Integer authId,@Param("linked") String linked,@Param("authUserId")Integer authUserId,@Param("clubUserId")Integer clubUserId);
 
     String getauthUserId(@Param("authId") Integer authId);
 
@@ -174,6 +177,8 @@ public interface AuthMapper {
 
     ChallengeRoundVo getChallengeRoundInfo(Integer videoID);
 
+    RossChallengeVideo getChallengeVideoInfo(Integer videoID);
+
     void upStatusById(Integer id);
 
     String getReleaseTime(@Param("userName")String userName );
@@ -181,4 +186,37 @@ public interface AuthMapper {
     List<ChallengeRoundVo> getRoundlist();
 
     void upVidoInfoById(Integer videoId,@Param("diggCount")String diggCount,@Param("playCount") String playCount);
+
+    void saveRossInfo(RossChallengeRoundVo rossChallengeRoundVo);
+
+    Integer getClubUserId(@Param("mobile")String mobile);
+
+    List<RossChallengeRoundVo> getInfoByUserName(@Param("userName")String userName);
+
+    List<RossChallengeRoundVo> getcontestedInfo(Integer authUserId);
+
+    RossChallengeRoundVo getcontestedInfoByUserName(@Param("mobile")String mobile,@Param("startTime")String startTime,@Param("endTime")String endTime);
+
+
+    List<RossChallengeVideo> getVideoAll(@Param("mobileOrAuthpart")String mobileOrAuthpart,Integer authUserId,@Param("StartTime")String StartTime,@Param("endTime")String endTime);
+
+    List<RossChallengeVideo> getVideoByUsername(@Param("mobile")String mobile,@Param("StartTime")String StartTime,@Param("endTime")String endTime);
+
+    List<RossChallengeVideo> checkVideoByUsername(@Param("mobile")String mobile,@Param("startTime")String startTime,@Param("endTime")String endTime);
+
+    void upVideoDiggCount(Integer videoId,Integer diggFlag,@Param("clubUserIds")String clubUserIds);
+
+    List<RossChallengeRoundVo> getAuthInfo(@Param("mobile")String mobile,@Param("authUserId")Integer authUserId,@Param("StartTime")String StartTime,@Param("endTime")String endTime);
+
+    void delAuthInfoById(Integer id);
+
+    void delVideoInfoById(Integer id);
+
+    void delVideoInfoByUserName(@Param("mobile")String mobile);
+
+    RossChallengeRoundVo getRoundById(Integer id);
+
+    List<RossChallengeRoundVo> getRoundByAuthUserID(Integer authUserId);
+
+    String getAuthparty(Integer authUserId);
 }

+ 20 - 1
src/main/java/com/caimei/mapper/cmMapper/ClubMapper.java

@@ -18,7 +18,7 @@ public interface ClubMapper {
     List<ClubVo> getClubList(@Param("authUserId") Integer authUserId, @Param("authParty") String authParty);
 
     List<ClubUserVo> getClubUserList(@Param("authUserId") Integer authUserId, @Param("mobile") String mobile, String name, @Param("status") Integer status);
-
+    List<ClubUserVo> getmobile(Integer authUserId);
     void insertClubUser(ClubUserPo clubUser);
 
     List<WxClubListVo> getWxClubList(@Param("authUserId") Integer authUserId, @Param("authParty") String authParty, @Param("provinceId") Integer provinceId, @Param("cityId") Integer cityId, @Param("townId") Integer townId, @Param("lng") Double lng, @Param("lat") Double lat);
@@ -54,4 +54,23 @@ public interface ClubMapper {
 
     //根據id獲取用戶信息
     WxClubUserVo getUserInfoByToken(Integer clubUserId);
+
+    //根据id更新authid到V1.7.7版本信息ross挑战赛机构表
+    void upAuthByid(Integer clubUserId,Integer authId);
+    //根据id更新authid到V1.7.7版本信息ross挑战赛视频表
+    void upVideoAuthByid(Integer clubUserId,Integer authId);
+
+    /**
+     * 查询短链接是否存在
+     */
+    Integer findIdByShortLink(String shortLink);
+
+    /**
+     * 保存短链接信息
+     *
+     * @param markId    短信类型
+     * @param shortLink 短链接
+     * @param url       跳转地址
+     */
+    void insertShortLink(int markId, String shortLink, String url);
 }

+ 5 - 0
src/main/java/com/caimei/model/vo/AuthVo.java

@@ -162,5 +162,10 @@ public class AuthVo {
      * 认证编号
      */
     private String authCode;
+    /**
+     * 用户id
+     */
+    private Integer clubUserId;
+
 
 }

+ 59 - 0
src/main/java/com/caimei/model/vo/RossChallengeRoundVo.java

@@ -0,0 +1,59 @@
+package com.caimei.model.vo;
+
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.sql.Date;
+import java.sql.Timestamp;
+
+@Data
+public class RossChallengeRoundVo {
+
+    private Integer id;
+    /**
+     * 供应商id
+     */
+    private Integer authUserId;
+    /**
+     * 用户id
+     */
+    private Integer authId;
+    /**
+     * 用户登录账号
+     */
+    private String userName;
+    /**
+     * 参赛状态(0:未参赛;1已参赛)
+     */
+    private Integer contestStatus;
+    /**
+     * 参赛时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Timestamp contestTime;
+
+    /**
+     * 资质认证营业执照oss地址
+     */
+    private String licenseOssUrl;
+    /**
+     * 资质认证营业执照oss名称
+     */
+    private String licenseOssName;
+    /**
+     * 是否资质认证(0:未认证;1:已认证)
+     */
+    private Integer authenticationStatus;
+    /**
+     * 用户id
+     */
+    private Integer clubUserId;
+    /**
+     * 参赛时间(用于前端展示)
+     */
+    private String contestDate;
+    /**
+     * 机构名称
+     */
+    private String authParty;
+}

+ 68 - 0
src/main/java/com/caimei/model/vo/RossChallengeVideo.java

@@ -0,0 +1,68 @@
+package com.caimei.model.vo;
+
+import lombok.Data;
+
+import java.sql.Date;
+
+@Data
+public class RossChallengeVideo {
+
+    private Integer id;
+    /**
+     * 机构id
+     */
+    private Integer authId;
+    /**
+     * 供应商id
+     */
+    private Integer authUserId;
+    /**
+     * 用户登录账号
+     */
+    private String userName;
+    /**
+     * 视频描述
+     */
+    private String title;
+    /**
+     * 视频oss名称
+     */
+    private String ossName;
+    /**
+     * 视频oss地址
+     */
+    private String ossUrl;
+    /**
+     * 视频封面
+     */
+    private String cover;
+    /**
+     * 视频发布时间
+     */
+    private Date releaseTime;
+    /**
+     * 点赞数量
+     */
+    private Integer diggCount;
+    /**
+     * 视频链接
+     */
+    private String linked;
+    /**
+     *
+     */
+    private String clubUserIds;
+    /**
+     * 机构名称
+     */
+    private String authParty;
+    /**
+     * 是否点赞(0,未点赞;1已点赞)
+     */
+    private Integer diggStatus;
+
+    /**
+     * 用户id
+     */
+    private Integer clubUserId;
+}

+ 9 - 0
src/main/java/com/caimei/service/auth/AuthClubService.java

@@ -77,6 +77,15 @@ public interface AuthClubService {
      */
     ResponseJson saveClubUser(Integer clubUserId, Integer authUserId, String mobile);
 
+    /**
+     * 生成短连接
+     * @param length
+     * @param markId
+     * @param url
+     * @return
+     */
+    String getShortLink(int length, int markId, String url);
+
     /**
      * 删除机构用户
      */

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

@@ -163,6 +163,11 @@ public interface AuthService {
      * @return
      */
     ResponseJson saveVideoInfo(ChallengeRoundVo challengeRoundVo);
+    /**
+     * 1.7.7(ROSS)保存视频信息
+     * @return
+     */
+    ResponseJson saveVideo(RossChallengeVideo rossChallengeVideo);
     /**
      * 根据authid获取authUserId
      */
@@ -297,5 +302,73 @@ public interface AuthService {
      ResponseJson<ChallengeRoundVo> getInfoById(Integer videoId);
 
      ResponseJson getDyVidoInfo(Integer authUserId);
+    /**
+     * 新增参赛机构信息
+     * @param rossChallengeRoundVo
+     * @return
+     */
+    ResponseJson saveRossInfo(RossChallengeRoundVo rossChallengeRoundVo);
+    /**
+     * 根据手机号码获取信息
+     * @param userName
+     * @return
+     */
+    List<RossChallengeRoundVo> getInfoByUserName(String userName);
+    /**
+     * 验证用户是否已经报名
+     * @param mobile
+     * @return
+     */
+    ResponseJson<RossChallengeRoundVo> checkContestedInfo(String mobile,Integer authUserId);
+    /**
+     * 获取已报名信息列表
+     * @return
+     */
+    ResponseJson<List<RossChallengeRoundVo>> getcontestedInfo(Integer authUserId);
+    /**
+     * 查询视频列表
+     * @param mobileOrAuthpart 电话号码或者机构名称
+     * @return
+     */
+    ResponseJson<PageInfo<RossChallengeVideo>> getVideoAll(String mobileOrAuthpart,Integer clubUserId,Integer authUserId,Integer pageNum,Integer pageSize);
 
-    }
+    /**
+     * 根据手机号码查询该机构视频列表
+     * @param mobile  登录账号
+     * @return
+     */
+    ResponseJson<List<RossChallengeVideo>> getVideoByUsername(String mobile,Integer clubUserId,Integer authUserId);
+    /**
+     * 验证机构是否已经上传了3个视频
+     * @param mobile 登录账号
+     * @return
+     */
+    ResponseJson<List<RossChallengeVideo>> checkVideoByUsername(String mobile,Integer authUserId);
+
+    /**
+     * 点赞与取消点赞
+     * @param id
+     * @param diggFlag
+     * @return
+     */
+    ResponseJson upVideoDiggCount(Integer id,Integer diggFlag,Integer clubUserId,String clubUserIds);
+    /**
+     * 查询机构信息(后端)
+     * @param mobile
+     * @return
+     */
+    ResponseJson<PageInfo<RossChallengeRoundVo>> getAuthInfo(String mobile,Integer pageNum,Integer pageSize,Integer authUserId);
+    /**
+     * 根据id删除机构信息
+     * @param id
+     * @return
+     */
+    ResponseJson delAuthInfoById(Integer id);
+
+    /**
+     * 根据id删除视频信息
+     * @param id
+     * @return
+     */
+     ResponseJson delVideoInfoById(Integer id);
+}

+ 62 - 0
src/main/java/com/caimei/service/auth/impl/AuthClubServiceImpl.java

@@ -5,6 +5,7 @@ import com.caimei.model.ResponseJson;
 import com.caimei.model.po.ClubUserPo;
 import com.caimei.model.vo.*;
 import com.caimei.service.auth.AuthClubService;
+import com.caimei.utils.CodeUtil;
 import com.caimei.utils.Md5Util;
 import com.caimei.utils.SmsUtils;
 import com.github.pagehelper.PageHelper;
@@ -166,6 +167,8 @@ public class AuthClubServiceImpl implements AuthClubService {
             } else {
                 log.info("供应商添加机构用户-密码发送成功,手机号:" + mobile);
             }
+            //认证通1.7.7ROSS挑战赛挑战赛活动开启期间新增用户短信发送
+//            smsRossRound(authUserId,mobile);
         } else {
             clubUser.setId(clubUserId);
             clubMapper.updateClubUser(clubUser);
@@ -173,6 +176,61 @@ public class AuthClubServiceImpl implements AuthClubService {
         return ResponseJson.success("保存机构用户成功");
     }
 
+    /**
+     * 认证通1.7.7ROSS挑战赛挑战赛活动开启期间新增用户短信发送
+     * @param authUserId
+     */
+    public void smsRossRound(Integer authUserId,String mobile){
+        //获取手机号码
+//        List<RossChallengeRoundVo> roundByAuthUserID = authMapper.getRoundByAuthUserID(authUserId);
+//        List<ClubUserVo> clubUserList = clubMapper.getClubUserList(authUserId, null, null, null);
+        //如果活动已经开始了,则用户报名成功后向用户发送短信
+        if(null!=authUserId){
+            ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
+            String shortLink = getShortLink(8, 3, "activity/challenge");
+            //判断活动是否开启
+            if(null!=activityTime &&null!=authUserId&&null!=activityTime.getStatus()&&activityTime.getStatus()==1){
+                //获取供应商名称
+                String authParty=authMapper.getAuthparty(authUserId);
+                if(authUserId==12){
+                    authParty="西班牙ROSS";
+                }
+                //生成短连接
+                String s = CodeUtil.generateAccount(8);
+                System.out.println();
+                //短信类型:1通知短信,2验证码短信,3营销短信
+                Integer type=3;
+                String conn="[" + authParty + "]尊敬的会员,ROSS视频挑战赛报名通道已开启,点此进入https://zp.caimei365.com/12/ross/"+shortLink+"ROSS认证通,了解详情。";
+                if(StringUtils.isNotEmpty(mobile)){
+                    Boolean aBoolean = SmsUtils.sendSms(type, mobile, conn);
+                    if(aBoolean){
+                        log.info("挑战赛短信发送成功"+mobile);
+                    }else{
+                        log.info("挑战赛短信发送失败"+mobile);
+                    }
+                }
+            }
+        }
+
+    }
+
+    /**
+     * 生成短链接
+     *
+     * @param length 链接长度
+     * @param markId 跳转类型
+     * @param url    跳转地址
+     */
+    @Override
+    public String getShortLink(int length, int markId, String url) {
+        String shortLink = CodeUtil.generateAccount(length);
+        Integer id = clubMapper.findIdByShortLink(shortLink);
+        if (id != null && id > 0) {
+            getShortLink(length, markId, url);
+        }
+        clubMapper.insertShortLink(markId, shortLink, url);
+        return shortLink;
+    }
     @Override
     public ResponseJson deleteClubUser(Integer clubUserId) {
         clubMapper.deleteClubUser(clubUserId);
@@ -222,6 +280,10 @@ public class AuthClubServiceImpl implements AuthClubService {
     @Override
     public ResponseJson saveBindAuth(Integer authId,String authParty,Integer authUserId,Integer clubUserId){
         clubMapper.saveBindAuth(authId,authParty,authUserId,clubUserId);
+        //1.7.7ross挑战赛新加逻辑:更新机构信息到挑战赛表
+        clubMapper.upAuthByid(clubUserId,authId);
+        //1.7.7ross挑战赛新加逻辑:更新机构信息到视频表
+        clubMapper.upVideoAuthByid(clubUserId,authId);
         return ResponseJson.success("绑定机构成功");
     }
 }

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

@@ -8,6 +8,7 @@ import com.caimei.components.RedisService;
 import com.caimei.config.FastDfsClient;
 import com.caimei.mapper.cmMapper.AuthMapper;
 import com.caimei.mapper.cmMapper.AuthProductMapper;
+import com.caimei.mapper.cmMapper.ClubMapper;
 import com.caimei.mapper.ldmMapper.LdmMapper;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.*;
@@ -38,6 +39,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.message.BasicNameValuePair;
 import org.apache.http.util.EntityUtils;
+import org.apache.ibatis.annotations.Param;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.*;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -123,6 +125,9 @@ public class AuthServiceImpl implements AuthService {
     @Resource
     private RedisService redisService;
 
+    @Resource
+    private ClubMapper clubMapper;
+
     @Override
     public ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty,
                                                       String mobile, Integer status, Integer starFlag, Integer auditStatus,
@@ -529,6 +534,12 @@ public class AuthServiceImpl implements AuthService {
         } else {
             // 审核通过,上线授权
             status = 1;
+            //更新authid到V1.7.7ross挑战赛机构信息表
+            //获取clubruserid
+            Integer clubUserId = authMapper.getClubUserIdByAuthId(authId);
+            //1.7.7ross挑战赛新加逻辑:更新机构信息到挑战赛表
+            clubMapper.upAuthByid(clubUserId,authId);
+            clubMapper.upVideoAuthByid(clubUserId,authId);
         }
         if (1 == source) {
             authMapper.updateAuthAuditStatus(authId, status, auditStatus, invalidReason, auditBy, auditTime);
@@ -550,7 +561,7 @@ public class AuthServiceImpl implements AuthService {
         String extName = originalFilename.substring(index);
         String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/zplma/tempFile/";
         if ("dev".equals(active)) {
-            filePath = "D:\\WorkSpace\\file\\tempImport\\";
+          filePath = "D:\\WorkSpace\\file\\tempImport\\";
         }
         filePath += randomStr + extName;
         try {
@@ -695,6 +706,7 @@ public class AuthServiceImpl implements AuthService {
 //                if (2 != split.length) {
 //                    return ResponseJson.error("第" + i + 1 + "行经纬度格式错误");
 //                }
+
                 // 校验联系电话
                 cell = authPartyRow.getCell(4);
                 cell.setCellType(CellType.STRING);
@@ -1264,6 +1276,20 @@ public class AuthServiceImpl implements AuthService {
         authMapper.saveVideoInfo(cr.getUserName(),cr.getCover(),cr.getOssUrl(),cr.getOssName(),cr.getTitle(),releaseTime,cr.getAuthId(),cr.getAuthUserId());
         return ResponseJson.success("保存成功",null);
     }
+    /**
+     * 1.7.7保存视频信息
+     * @return
+     */
+    @Override
+    public ResponseJson saveVideo(RossChallengeVideo ross){
+        Date date=new Date();
+        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String releaseTime = sf.format(date).replace("T", "");
+        //根据手机号获取clubuserid
+        Integer clubUserId = authMapper.getClubUserId(ross.getUserName());
+        authMapper.saveVideo(ross.getUserName(),ross.getCover(),ross.getOssUrl(),ross.getOssName(),ross.getTitle(),releaseTime,ross.getAuthId(),ross.getLinked(),ross.getAuthUserId(),clubUserId);
+        return ResponseJson.success("保存成功",null);
+    }
 
     /**
      * 根据authid获取authUserId
@@ -1550,8 +1576,18 @@ public class AuthServiceImpl implements AuthService {
         }
         if(challengeList.size()<0||!authUserIdList.contains(authUserId)){
             authMapper.saveActivityInfo(startTime,endTime,status,authUserId);
+            //1.7.7ross挑战赛新加逻辑
+            //活动开启后给供应商下所有机构手机号码发送短信
+//            if(status==1){
+//               smsSend(authUserId);
+//            }
         }else {
             authMapper.upActivityInfo(startTime,endTime,status,authUserId);
+            //1.7.7ross挑战赛新加逻辑
+            //活动开启后给供应商下所有机构手机号码发送短信
+//            if(status==1){
+//                smsSend(authUserId);
+//            }
         }
         return ResponseJson.success();
     }
@@ -1605,7 +1641,7 @@ public class AuthServiceImpl implements AuthService {
         if(activityTime!=null){
             //当按钮关闭时,状态皆为已结束,开始时根据时间判断
             if(activityTime.getStatus()==0){
-                activityTime.setActivityState(2);
+                activityTime.setActivityState(0);
             }else{
                 if(activityTime.getStartTime().compareTo(releaseTime)>0){
                     activityTime.setActivityState(0);
@@ -1682,9 +1718,9 @@ public class AuthServiceImpl implements AuthService {
     public ResponseJson downLoadChoseZip(String fileId,HttpServletResponse response){
         if (fileId.contains(",")) {
             String[] split = fileId.split(",");
-            ArrayList<ChallengeRoundVo> fileTreeVos = new ArrayList<>();
+            ArrayList<RossChallengeVideo> fileTreeVos = new ArrayList<>();
             for (String s : split) {
-                ChallengeRoundVo file = authMapper.getChallengeRoundInfo(Integer.valueOf(s));
+                RossChallengeVideo file = authMapper.getChallengeVideoInfo(Integer.valueOf(s));
                 fileTreeVos.add(file);
             }
             //有package则在服务器固定路径new file.mkdir
@@ -1697,7 +1733,7 @@ public class AuthServiceImpl implements AuthService {
             }
             boolean mkdirs = new File(filePath).mkdirs();
             Assert.isTrue(mkdirs, "文件夹创建失败");
-            for (ChallengeRoundVo challengeRoundVo : fileTreeVos) {
+            for (RossChallengeVideo challengeRoundVo : fileTreeVos) {
                     //普通文件直接下载到临时文件夹uuid下
                     String fileName = "";
                 String ossurl = challengeRoundVo.getOssUrl();
@@ -1759,8 +1795,8 @@ public class AuthServiceImpl implements AuthService {
             file.delete();
             FileZipUtils.deleteFile(new File(zipPath));
         }else {
-            ArrayList<ChallengeRoundVo> fileTreeVos = new ArrayList<>();
-            ChallengeRoundVo f = authMapper.getChallengeRoundInfo(Integer.valueOf(fileId));
+            ArrayList<RossChallengeVideo> fileTreeVos = new ArrayList<>();
+            RossChallengeVideo f = authMapper.getChallengeVideoInfo(Integer.valueOf(fileId));
                 fileTreeVos.add(f);
             //有package则在服务器固定路径new file.mkdir
             UUID uuid = UUID.randomUUID();
@@ -1772,7 +1808,7 @@ public class AuthServiceImpl implements AuthService {
             }
             boolean mkdirs = new File(filePath).mkdirs();
             Assert.isTrue(mkdirs, "文件夹创建失败");
-            for (ChallengeRoundVo challengeRoundVo : fileTreeVos) {
+            for (RossChallengeVideo challengeRoundVo : fileTreeVos) {
                 //普通文件直接下载到临时文件夹uuid下
                 String fileName = "";
                 String ossurl = challengeRoundVo.getOssUrl();
@@ -1878,4 +1914,263 @@ public class AuthServiceImpl implements AuthService {
         }
         return ResponseJson.success();
     }
+
+    /**
+     * 新增参赛机构信息
+     * @param rossChallengeRoundVo
+     * @return
+     */
+    @Override
+    public ResponseJson saveRossInfo(RossChallengeRoundVo rossChallengeRoundVo){
+        //根据手机号获取clubuserid
+        Integer clubUserId = authMapper.getClubUserId(rossChallengeRoundVo.getUserName());
+        rossChallengeRoundVo.setClubUserId(clubUserId);
+        authMapper.saveRossInfo(rossChallengeRoundVo);
+        return ResponseJson.success();
+    }
+
+    /**
+     * 根据手机号码获取信息
+     * @param userName
+     * @return
+     */
+    @Override
+    public List<RossChallengeRoundVo> getInfoByUserName(String userName){
+        return authMapper.getInfoByUserName(userName);
+    }
+    /**
+     * 验证用户是否已经报名
+     * @param mobile
+     * @return
+     */
+    public ResponseJson<RossChallengeRoundVo> checkContestedInfo(String mobile,Integer authUserId){
+        //获取活动时间
+        ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
+        //活动时间内用户是否参与比赛
+        RossChallengeRoundVo ross=new RossChallengeRoundVo();
+        if(null!=activityTime&&StringUtils.isNotEmpty(activityTime.getStartTime())&&StringUtils.isNotEmpty(activityTime.getEndTime())){
+            RossChallengeRoundVo rossChallengeRoundVo = authMapper.getcontestedInfoByUserName(mobile,activityTime.getStartTime(),activityTime.getEndTime());
+            if(null!=rossChallengeRoundVo&&null!=rossChallengeRoundVo.getContestStatus()){
+                ross.setContestStatus(rossChallengeRoundVo.getContestStatus());
+            }else{
+                ross.setContestStatus(0);
+            }
+        }else{
+            ross.setContestStatus(0);
+        }
+        return ResponseJson.success(ross);
+    }
+    /**
+     * 获取已报名信息列表
+     * @return
+     */
+    @Override
+    public ResponseJson<List<RossChallengeRoundVo>> getcontestedInfo(Integer authUserId){
+        List<RossChallengeRoundVo> rossChallengeRoundVos = authMapper.getcontestedInfo(authUserId);
+        return ResponseJson.success(rossChallengeRoundVos);
+    }
+
+    /**
+     * 查询视频列表
+     * @param mobileOrAuthpart 电话号码或者机构名称
+     * @return
+     */
+    @Override
+    public ResponseJson<PageInfo<RossChallengeVideo>> getVideoAll(String mobileOrAuthpart,Integer clubUserId,Integer authUserId,Integer pageNum,Integer pageSize){
+        ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
+        if(null==activityTime&&StringUtils.isEmpty(activityTime.getStartTime())&&StringUtils.isEmpty(activityTime.getEndTime())){
+            return ResponseJson.success();
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        List<RossChallengeVideo> videoAll = authMapper.getVideoAll(mobileOrAuthpart,authUserId,activityTime.getStartTime(),activityTime.getEndTime());
+        PageInfo<RossChallengeVideo> pageData = new PageInfo<>(videoAll);
+        //获取该用户点赞过的视频
+        //如果clubUserId为空,用户不能点赞,直接返回所有视频
+        if(null!=clubUserId){
+            if(null!=videoAll&& videoAll.size()>0){
+                for(RossChallengeVideo video:videoAll){
+                    if (StringUtils.isNotEmpty(video.getClubUserIds())) {
+                        if (video.getClubUserIds().contains(clubUserId.toString())) {
+                            video.setDiggStatus(1);
+                        } else {
+                            video.setDiggStatus(0);
+                        }
+                    } else {
+                        video.setDiggStatus(0);
+                    }
+                };
+            }
+        }
+        return ResponseJson.success(pageData);
+    }
+
+    /**
+     * 根据手机号码查询该机构视频列表
+     * @param mobile  登录账号
+     * @return
+     */
+    @Override
+    public ResponseJson<List<RossChallengeVideo>> getVideoByUsername(String mobile,Integer clubUserId,Integer authUserId){
+        //获取活动时间内的机构列表信息
+        ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
+        if(null==activityTime&&StringUtils.isEmpty(activityTime.getStartTime())&&StringUtils.isEmpty(activityTime.getEndTime())){
+            return ResponseJson.success();
+        }
+        List<RossChallengeVideo> videoByUsername = authMapper.getVideoByUsername(mobile,activityTime.getStartTime(),activityTime.getEndTime());
+        //获取该用户点赞过的视频
+        if(null!=clubUserId){
+        if(null!=videoByUsername&& videoByUsername.size()>0){
+            for(RossChallengeVideo video:videoByUsername){
+                if (StringUtils.isNotEmpty(video.getClubUserIds())) {
+                    if (video.getClubUserIds().contains(clubUserId.toString())) {
+                        video.setDiggStatus(1);
+                    } else {
+                        video.setDiggStatus(0);
+                    }
+                } else {
+                    video.setDiggStatus(0);
+                }
+            };
+        }
+
+        }
+        return ResponseJson.success(videoByUsername);
+
+    }
+
+    /**
+     * 验证机构是否已经上传了3个视频
+     * @param mobile 登录账号
+     * @return
+     */
+    @Override
+    public ResponseJson<List<RossChallengeVideo>> checkVideoByUsername(String mobile,Integer authUserId){
+        //获取活动时间
+        ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
+        if(null!=activityTime&&StringUtils.isNotEmpty(activityTime.getStartTime())&&StringUtils.isNotEmpty(activityTime.getEndTime())){
+            //活动时间内用户是否参与比赛
+            List<RossChallengeVideo> rossChallengeVideos = authMapper.checkVideoByUsername(mobile,activityTime.getStartTime(),activityTime.getEndTime());
+            if(null!=rossChallengeVideos&&rossChallengeVideos.size()>=3){
+                return ResponseJson.success(-1,"抱歉,最多只能上传3个视频!!!",null);
+            }else{
+                return ResponseJson.success();
+            }
+        }else{
+            return ResponseJson.success();
+        }
+    }
+
+    /**
+     * 点赞与取消点赞
+     * @param id
+     * @return
+     */
+    @Override
+    public ResponseJson upVideoDiggCount(Integer id,Integer diggFlag,Integer clubUserId,String clubUserIds){
+        if(diggFlag==0){
+            //取消点赞
+            if(StringUtils.isNotEmpty(clubUserIds)){
+                if(clubUserIds.contains(clubUserId.toString())){
+                    clubUserIds=clubUserIds.replace(clubUserId.toString(),"");
+                    clubUserIds=clubUserIds.replace(",,",",");
+                    if(clubUserIds.lastIndexOf(",")==clubUserIds.length()-1){
+                        clubUserIds=clubUserIds.substring(0,clubUserIds.length()-1);
+                    }
+                    if(clubUserIds.indexOf(",")==0){
+                        clubUserIds=clubUserIds.substring(1,clubUserIds.length());
+                    }
+                }
+            }
+        }else if(diggFlag==1){
+            //点赞
+            if(StringUtils.isEmpty(clubUserIds)){
+                clubUserIds=clubUserIds+clubUserId;
+            }else{
+                clubUserIds=clubUserIds+","+clubUserId;
+            }
+        }
+
+        authMapper.upVideoDiggCount(id,diggFlag,clubUserIds);
+        return ResponseJson.success();
+    }
+
+    /**
+     * 查询机构信息(后端)
+     * @param mobile
+     * @return
+     */
+    @Override
+    public ResponseJson<PageInfo<RossChallengeRoundVo>> getAuthInfo(String mobile,Integer pageNum,Integer pageSize,Integer authUserId){
+        //获取活动时间内的机构列表信息
+        ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
+        PageHelper.startPage(pageNum, pageSize);
+        List<RossChallengeRoundVo> authInfo = authMapper.getAuthInfo(mobile,authUserId,activityTime.getStartTime(),activityTime.getEndTime());
+        PageInfo<RossChallengeRoundVo> pageData = new PageInfo<>(authInfo);
+        if(null!=authInfo&&authInfo.size()>0){
+            for (RossChallengeRoundVo search:authInfo) {
+                if(null != search.getContestTime()){
+                    SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                    Date da=new Date(search.getContestTime().getTime());
+                    String date = fmt.format(da);
+                    search.setContestDate(date);
+                }
+            }
+        }
+        return ResponseJson.success(pageData);
+    }
+
+    /**
+     * 根据id删除机构信息
+     * @param id
+     * @return
+     */
+    @Override
+    public ResponseJson delAuthInfoById(Integer id){
+        //先删除机构对应的视频信息
+        RossChallengeRoundVo round = authMapper.getRoundById(id);
+        if(null!=round && StringUtils.isNotEmpty(round.getUserName())){
+            authMapper.delVideoInfoByUserName(round.getUserName());
+        }
+        //再删除机构信息
+        authMapper.delAuthInfoById(id);
+        return ResponseJson.success();
+    }
+
+    /**
+     * 根据id删除视频信息
+     * @param id
+     * @return
+     */
+    @Override
+    public ResponseJson delVideoInfoById(Integer id){
+        authMapper.delVideoInfoById(id);
+        return ResponseJson.success();
+    }
+
+    public void smsSend(Integer authUserId){
+        //获取手机号码
+//        List<RossChallengeRoundVo> roundByAuthUserID = authMapper.getRoundByAuthUserID(authUserId);
+        List<ClubUserVo> clubUserList = clubMapper.getmobile(authUserId);
+        //获取供应商名称
+        String authParty=authMapper.getAuthparty(authUserId);
+        if(authUserId==12){
+            authParty="西班牙ROSS";
+        }
+        //短信类型:1通知短信,2验证码短信,3营销短信
+        Integer type=3;
+        //[s{20}]尊敬的会员,ROSS视频挑战赛报名通道已开启,点此【http://f6d.cn/Fgp6r】进入ROSS认证通,了解详情。
+        String conn="[" + authParty + "]尊敬的会员,ROSS视频挑战赛报名通道已开启,点此https://zp.caimei365.com/12/ross/activity/challenge进入ROSS认证通,了解详情。";
+        if(null!=clubUserList&& clubUserList.size()>0){
+            clubUserList.stream().forEach(round ->{
+                if(StringUtils.isNotEmpty(round.getMobile())){
+                    Boolean aBoolean = SmsUtils.sendSms(type, round.getMobile(), conn);
+                    if(aBoolean){
+                        log.info("挑战赛短信发送成功"+round.getMobile());
+                    }else{
+                        log.info("挑战赛短信发送失败"+round.getMobile());
+                    }
+                }
+            });
+        }
+    }
 }

+ 3 - 0
src/main/java/com/caimei/service/data/DatabaseService.java

@@ -2,6 +2,7 @@ package com.caimei.service.data;
 
 import com.caimei.model.ResponseJson;
 import com.caimei.model.vo.FileTreeVo;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.HashMap;
@@ -36,4 +37,6 @@ public interface DatabaseService {
     ResponseJson downLoadChoseZip(String fileId, Integer authUserId, HttpServletResponse response);
 
     ResponseJson<FileTreeVo> getFileDetail(Integer fileId, Integer authUserId);
+
+    ResponseJson uploadDictionary(MultipartFile[] multipartFile);
 }

+ 48 - 3
src/main/java/com/caimei/service/data/impl/DatabaseServiceImpl.java

@@ -15,13 +15,12 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.util.Assert;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
+import java.io.*;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -373,4 +372,50 @@ public class DatabaseServiceImpl implements DatabaseService {
     private List<FileTreeVo> existsPackageOrCommonFile(Integer fileId, Integer authUserId, Integer selectFor) {
         return fileMapper.findSonPackage(fileId, authUserId, selectFor);
     }
+   @Override
+   public ResponseJson uploadDictionary(MultipartFile[] File){
+        //文件上传前的名称
+       List<String> filenames=new ArrayList<>();
+       for (MultipartFile multipartFile:File) {
+           String fileName = multipartFile.getOriginalFilename();
+           File file = new File(fileName);
+           OutputStream out = null;
+           try{
+               //获取文件流,以文件流的方式输出到新文件
+//    InputStream in = multipartFile.getInputStream();
+               out = new FileOutputStream(file);
+               byte[] ss = multipartFile.getBytes();
+               for(int i = 0; i < ss.length; i++){
+                   out.write(ss[i]);
+               }
+           }catch(IOException e){
+               e.printStackTrace();
+           }finally {
+               if (out != null){
+                   try {
+                       out.close();
+                   } catch (IOException e) {
+                       e.printStackTrace();
+                   }
+               }
+           }
+           //保存文件夹及其文件
+           upload(file,filenames);
+       }
+        return ResponseJson.success();
+   }
+    public List<String> upload(File file,List<String> filenames){
+        File[] files=file.listFiles();
+        for (File f:files) {
+            if(f.isDirectory()){
+                //递归 保存文件夹(返回父id,便于确定属于哪级目录)
+                fileMapper.creatPackage(0, 0, f.getName());
+                return upload(f,filenames);
+            }else{
+                //保存文件
+                filenames.add(f.getName());
+            }
+        }
+        return filenames;
+    }
 }

+ 79 - 79
src/main/java/com/caimei/task/DyInfoTask.java

@@ -1,80 +1,80 @@
-package com.caimei.task;
+//package com.caimei.task;
+//
+//import com.alibaba.fastjson.JSONArray;
+//import com.alibaba.fastjson.JSONObject;
+//import com.caimei.annotation.CurrentUser;
+//import com.caimei.components.RedisService;
+//import com.caimei.mapper.cmMapper.AuthMapper;
+//import com.caimei.model.po.SysUser;
+//import com.caimei.model.vo.ChallengeActivityVo;
+//import com.caimei.model.vo.ChallengeRoundVo;
+//import com.caimei.model.vo.DyVideoInfoVo;
+//import com.caimei.model.vo.StatisticsVo;
+//import com.caimei.service.auth.impl.AuthServiceImpl;
+//import lombok.AllArgsConstructor;
+//import lombok.NoArgsConstructor;
+//import lombok.RequiredArgsConstructor;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.scheduling.annotation.Async;
+//import org.springframework.scheduling.annotation.EnableScheduling;
+//import org.springframework.scheduling.annotation.Scheduled;
+//import org.springframework.stereotype.Component;
+//
+//import javax.annotation.Resource;
+//import java.text.SimpleDateFormat;
+//import java.util.Date;
+//import java.util.List;
+//
+//@Slf4j
+//@Configuration
+//@EnableScheduling
+//@NoArgsConstructor
+//@AllArgsConstructor
+//public class DyInfoTask {
+//    @Resource
+//    private RedisService redisService;
+//
+//    @Resource
+//    private AuthMapper authMapper;
+//
+//    @Resource
+//    private AuthServiceImpl authServiceImpl;
 
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.caimei.annotation.CurrentUser;
-import com.caimei.components.RedisService;
-import com.caimei.mapper.cmMapper.AuthMapper;
-import com.caimei.model.po.SysUser;
-import com.caimei.model.vo.ChallengeActivityVo;
-import com.caimei.model.vo.ChallengeRoundVo;
-import com.caimei.model.vo.DyVideoInfoVo;
-import com.caimei.model.vo.StatisticsVo;
-import com.caimei.service.auth.impl.AuthServiceImpl;
-import lombok.AllArgsConstructor;
-import lombok.NoArgsConstructor;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-
-@Slf4j
-@Configuration
-@EnableScheduling
-@NoArgsConstructor
-@AllArgsConstructor
-public class DyInfoTask {
-    @Resource
-    private RedisService redisService;
-
-    @Resource
-    private AuthMapper authMapper;
-
-    @Resource
-    private AuthServiceImpl authServiceImpl;
-
-    @Scheduled(cron = "0 0 2 * * ?")
-    public void getDyVidoInfo(){
-        log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>开始执行,ldmLatestClubId:" );
-        // 获取供应商用户id
-//        Integer userIdentity = sysUser.getUserIdentity();
-//        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
-        String dyopenId=null;
-        String DYaccessToken=null;
-        Date date=new Date();
-        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        String now = sf.format(date).replace("T", "");
-        if(redisService.getExpireTime("DyopenId")>0&&redisService.getExpireTime("DYaccessToken")>0){
-            dyopenId=redisService.get("DyopenId").toString();
-            DYaccessToken=redisService.get("DYaccessToken").toString();
-        }
-        //获取供应商下面所有机构发的视频
-        List<ChallengeRoundVo> roundlist = authMapper.getRoundlist();
-        if(null !=roundlist && roundlist.size()>0){
-            //根据item_id更新视频数据(点赞量,播放量)
-            for (ChallengeRoundVo chall:roundlist) {
-                //如果当前时间大于活动结束时间则不再统计
-                ChallengeActivityVo activityTime = authMapper.getActivityTime(chall.getAuthUserId());
-                if(null !=activityTime && now.compareTo(activityTime.getEndTime())<0){
-                    String data = authServiceImpl.getVideoDataByItemId(dyopenId, DYaccessToken, chall.getItemId());
-                    JSONObject paramslist = JSONObject.parseObject(data);
-                    String resultList=paramslist.getString("list");
-                    List<DyVideoInfoVo> listDyVideoInfoVo= JSONArray.parseArray(resultList, DyVideoInfoVo.class);
-                    if(listDyVideoInfoVo!=null&&listDyVideoInfoVo.size()>0){
-                        StatisticsVo StatisticsVo= JSONObject.parseObject(listDyVideoInfoVo.get(0).getStatistics(), StatisticsVo.class);
-                        //更新视频数据到数据库
-                        authMapper.upVidoInfoById(chall.getId(),StatisticsVo.getDigg_count(),StatisticsVo.getPlay_count());
-                    }
-                }
-            }
-        }
-    }
-}
+//    @Scheduled(cron = "0 0 2 * * ?")
+//    public void getDyVidoInfo(){
+//        log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>开始执行,ldmLatestClubId:" );
+//        // 获取供应商用户id
+////        Integer userIdentity = sysUser.getUserIdentity();
+////        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+//        String dyopenId=null;
+//        String DYaccessToken=null;
+//        Date date=new Date();
+//        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//        String now = sf.format(date).replace("T", "");
+//        if(redisService.getExpireTime("DyopenId")>0&&redisService.getExpireTime("DYaccessToken")>0){
+//            dyopenId=redisService.get("DyopenId").toString();
+//            DYaccessToken=redisService.get("DYaccessToken").toString();
+//        }
+//        //获取供应商下面所有机构发的视频
+//        List<ChallengeRoundVo> roundlist = authMapper.getRoundlist();
+//        if(null !=roundlist && roundlist.size()>0){
+//            //根据item_id更新视频数据(点赞量,播放量)
+//            for (ChallengeRoundVo chall:roundlist) {
+//                //如果当前时间大于活动结束时间则不再统计
+//                ChallengeActivityVo activityTime = authMapper.getActivityTime(chall.getAuthUserId());
+//                if(null !=activityTime && now.compareTo(activityTime.getEndTime())<0){
+//                    String data = authServiceImpl.getVideoDataByItemId(dyopenId, DYaccessToken, chall.getItemId());
+//                    JSONObject paramslist = JSONObject.parseObject(data);
+//                    String resultList=paramslist.getString("list");
+//                    List<DyVideoInfoVo> listDyVideoInfoVo= JSONArray.parseArray(resultList, DyVideoInfoVo.class);
+//                    if(listDyVideoInfoVo!=null&&listDyVideoInfoVo.size()>0){
+//                        StatisticsVo StatisticsVo= JSONObject.parseObject(listDyVideoInfoVo.get(0).getStatistics(), StatisticsVo.class);
+//                        //更新视频数据到数据库
+//                        authMapper.upVidoInfoById(chall.getId(),StatisticsVo.getDigg_count(),StatisticsVo.getPlay_count());
+//                    }
+//                }
+//            }
+//        }
+//    }
+//}

+ 95 - 0
src/main/resources/mapper/AuthMapper.xml

@@ -144,6 +144,11 @@
         from cm_brand_auth_banner
         where authId = #{authId}
     </delete>
+    <select id="getClubUserIdByAuthId" resultType="java.lang.Integer">
+        select cbcu1.id from cm_brand_club_user cbcu1 left join cm_brand_auth a
+        on a.createBy = cbcu1.id
+        where a.id=#{authId}
+    </select>
     <select id="getAuthList" resultType="com.caimei.model.vo.AuthVo">
         select a.id as authId, a.authUserId, authParty, cbcu2.mobile, a.status, a.auditStatus, a.shopAuditStatus,
         a.createTime,a.authCode,
@@ -650,6 +655,10 @@
         insert into cm_challenge_round(userName,title,ossName,ossUrl,cover,releaseTime,authId,authUserId)
         values(#{userName},#{title},#{ossName},#{ossUrl},#{cover},#{releaseTime},#{authId},#{authUserId})
     </insert>
+    <insert id="saveVideo">
+        insert into cm_ross_challenge_video(userName,title,ossName,ossUrl,cover,releaseTime,authId,linked,authUserId,clubUserId)
+        values(#{userName},#{title},#{ossName},#{ossUrl},#{cover},#{releaseTime},#{authId},#{linked},#{authUserId},#{clubUserId})
+    </insert>
     <select id="getauthUserId" resultType="java.lang.String">
         select authUserId
         from cm_brand_auth
@@ -796,6 +805,11 @@
         from cm_challenge_round cr
         where cr.id=#{videoID}
     </select>
+    <select id="getChallengeVideoInfo" resultType="com.caimei.model.vo.RossChallengeVideo">
+        select cr.*
+        from cm_ross_challenge_video cr
+        where cr.id=#{videoID}
+    </select>
     <update id="upStatusById">
         update cm_challenge_activity set
             status = 0
@@ -816,4 +830,85 @@
             playCount=#{playCount}
         where id=#{videoId}
     </update>
+    <insert id="saveRossInfo" parameterType="com.caimei.model.vo.RossChallengeRoundVo">
+        insert into cm_ross_challenge_round(authUserId,authId,userName,contestStatus,contestTime,licenseOssUrl,licenseOssName,authenticationStatus,clubUserId)
+        values(#{authUserId},#{authId},#{userName},#{contestStatus},#{contestTime},#{licenseOssUrl},#{licenseOssName},#{authenticationStatus},#{clubUserId})
+    </insert>
+    <select id="getClubUserId" resultType="java.lang.Integer">
+        select id from cm_brand_club_user where mobile=#{mobile}
+    </select>
+    <select id="getInfoByUserName" resultType="com.caimei.model.vo.RossChallengeRoundVo">
+        select * from cm_ross_challenge_round where userName=#{userName} and contestStatus=1
+    </select>
+    <select id="getcontestedInfo" resultType="com.caimei.model.vo.RossChallengeRoundVo">
+        select * from cm_ross_challenge_round where  contestStatus=1 and authUserId=#{authUserId}
+    </select>
+    <select id="getcontestedInfoByUserName" resultType="com.caimei.model.vo.RossChallengeRoundVo">
+        select * from cm_ross_challenge_round where userName=#{mobile}
+           and contestTime &gt; #{startTime} and contestTime &lt; #{endTime}
+    </select>
+    <select id="getVideoAll" resultType="com.caimei.model.vo.RossChallengeVideo">
+        select cr.*,cba.authParty from cm_ross_challenge_video cr
+        left join cm_brand_auth cba on cr.authId=cba.id
+        where cr.authUserId=#{authUserId}
+        and cr.releaseTime &gt; #{StartTime} and cr.releaseTime &lt; #{endTime}
+        <if test="mobileOrAuthpart != null and mobileOrAuthpart != ''">
+            and (cr.userName like concat('%', #{mobileOrAuthpart})
+            or  cba.authParty like concat('%', #{mobileOrAuthpart},'%') )
+        </if>
+        order by cr.diggCount desc,releaseTime
+    </select>
+    <select id="getVideoByUsername" resultType="com.caimei.model.vo.RossChallengeVideo">
+        select * from cm_ross_challenge_video
+        where
+           userName = #{mobile}
+          and releaseTime &gt; #{StartTime} and releaseTime &lt; #{endTime}
+        order by diggCount desc,releaseTime
+    </select>
+    <select id="checkVideoByUsername" resultType="com.caimei.model.vo.RossChallengeVideo">
+        select * from cm_ross_challenge_video
+        where userName = #{mobile}
+          and releaseTime &gt; #{startTime} and releaseTime &lt; #{endTime}
+    </select>
+    <update id="upVideoDiggCount">
+        update cm_ross_challenge_video
+            <set>
+                clubUserIds=#{clubUserIds}
+            <if test="null != diggFlag and diggFlag==1">
+                ,diggCount=diggCount+1
+            </if>
+            <if test="null != diggFlag and diggFlag==0">
+                ,diggCount=diggCount-1
+            </if>
+            </set>
+        where id=#{videoId}
+    </update>
+    <select id="getAuthInfo" resultType="com.caimei.model.vo.RossChallengeRoundVo">
+        select cr.*,cba.authParty from cm_ross_challenge_round cr
+        left join cm_brand_auth cba on cr.authId=cba.id
+        where cr.authUserId=#{authUserId}
+          and cr.contestTime &gt; #{StartTime} and cr.contestTime &lt; #{endTime}
+        <if test="null!=mobile and mobile !=''">
+            and  cr.userName like concat('%', #{mobile})
+        </if>
+        order by contestTime desc
+    </select>
+    <delete id="delAuthInfoById">
+        delete from cm_ross_challenge_round where id=#{id}
+    </delete>
+    <delete id="delVideoInfoById">
+        delete from cm_ross_challenge_video where id=#{id}
+    </delete>
+    <delete id="delVideoInfoByUserName">
+        delete from cm_ross_challenge_video where userName=#{mobile}
+    </delete>
+    <select id="getRoundById" resultType="com.caimei.model.vo.RossChallengeRoundVo">
+        select * from cm_ross_challenge_round where id=#{id}
+    </select>
+    <select id="getRoundByAuthUserID" resultType="com.caimei.model.vo.RossChallengeRoundVo">
+        select * from cm_ross_challenge_round where authUserId=#{authUserId} and contestStatus=1
+    </select>
+    <select id="getAuthparty" resultType="java.lang.String">
+        select name from cm_brand_auth_user where authUserId=#{authUserId}
+    </select>
 </mapper>

+ 26 - 0
src/main/resources/mapper/ClubMapper.xml

@@ -74,6 +74,12 @@
         </if>
         order by cu.addTime desc
     </select>
+    <select id="getmobile" resultType="com.caimei.model.vo.ClubUserVo">
+        select
+        distinct mobile
+        from cm_brand_club_user
+        where authUserId = #{authUserId}
+    </select>
     <select id="getWxClubList" resultType="com.caimei.model.vo.WxClubListVo">
         select id as authId, authParty as authParty,concat(ifnull(p.name,''),ifnull(c.name,''),ifnull(t.name,'')) as area,a.address,a.mobile,a.logo,
         ifnull(round(st_distance(point(a.lng,a.lat),point(#{lng},#{lat}))*111195/1000,2),99999) as distance
@@ -195,4 +201,24 @@
                  left join cm_brand_auth_user au on a.authUserId = au.authUserId
         where  cu.delFlag = 0 and cu.id = #{clubUserId}
     </select>
+    <update id="upAuthByid">
+        update cm_ross_challenge_round
+        set authId = #{authId},
+            authenticationStatus=1
+        where clubUserId = #{clubUserId}
+    </update>
+    <update id="upVideoAuthByid">
+        update cm_ross_challenge_video
+        set authId = #{authId}
+        where clubUserId = #{clubUserId}
+    </update>
+    <select id="findIdByShortLink" resultType="java.lang.Integer">
+        SELECT id
+        FROM cm_short_link
+        WHERE shortLink = #{shortLink}
+    </select>
+    <insert id="insertShortLink">
+        INSERT INTO cm_short_link (markId, shortLink, jumpLink, createTime)
+        VALUES (#{markId}, #{shortLink}, #{url}, NOW())
+    </insert>
 </mapper>