Bläddra i källkod

认证通1.7.7版本功能开发

JiangChongBo 2 år sedan
förälder
incheckning
5e20d5ae7c

+ 34 - 9
src/main/java/com/caimei/controller/admin/auth/AuthApi.java

@@ -878,13 +878,18 @@ public class AuthApi {
         String licenseOssUrl=jsonObject.getString("licenseOssUrl");
         String licenseOssName=jsonObject.getString("licenseOssName");
         Integer authId=jsonObject.getInteger("authId");
+        Integer authuser=jsonObject.getInteger("authUserId");
         //判断该账号是否已经参赛
         List<RossChallengeRoundVo> infoByUserName = authService.getInfoByUserName(mobile);
         if(null !=infoByUserName&&infoByUserName.size()>0){
             return ResponseJson.success("您已报名",null);
         }
         RossChallengeRoundVo rossChallengeRoundVo=new RossChallengeRoundVo();
-        rossChallengeRoundVo.setAuthUserId(authUserId);
+        if(null!=authUserId){
+            rossChallengeRoundVo.setAuthUserId(authUserId);
+        }else{
+            rossChallengeRoundVo.setAuthUserId(authuser);
+        }
         rossChallengeRoundVo.setUserName(mobile);
         rossChallengeRoundVo.setAuthId(authId);
         rossChallengeRoundVo.setLicenseOssUrl(licenseOssUrl);
@@ -895,19 +900,39 @@ public class AuthApi {
             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("get/contested/info")
-    public ResponseJson<List<RossChallengeRoundVo>> getcontestedInfo(){
-        return authService.getcontestedInfo();
+    @GetMapping("/get/auth/info")
+    public ResponseJson<List<RossChallengeRoundVo>> getAuthInfo(String mobile){
+        return authService.getAuthInfo(mobile);
     }
-
-    @GetMapping("get/video/all")
-    public ResponseJson<List<RossChallengeVideo>> getVideoAll(String mobileOrAuthpart){
-        return authService.getVideoAll(mobileOrAuthpart);
+    /**
+     * 根据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);
     }
 }

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

@@ -452,4 +452,69 @@ public class WxAuthApi {
     public ResponseJson<ChallengeActivityVo> getActivitty(Integer authUserId){
         return authService.getActivitty(authUserId);
     }
+//--------------------------------------------挑战赛1.7.7(ROSS)-------------------------------------------------------------------------------------------------
+    /**
+     * 获取已报名信息列表
+     * @return
+     */
+    @GetMapping("/get/contested/info")
+    public ResponseJson<List<RossChallengeRoundVo>> getcontestedInfo(){
+        return authService.getcontestedInfo();
+    }
+
+    /**
+     * 根据手机号码查询该机构视频列表
+     * @param mobile  登录账号
+     * @return
+     */
+    @GetMapping("/get/video/username")
+    public ResponseJson<List<RossChallengeVideo>> getVideoByUsername(String mobile){
+        return authService.getVideoByUsername(mobile);
+    }
+
+    /**
+     * 验证机构是否已经上传了3个视频(点击上传视频时验证)
+     * @param mobile 登录账号
+     * @return
+     */
+    @GetMapping("/check/video/username")
+    public ResponseJson<List<RossChallengeVideo>> checkVideoByUsername(String mobile){
+        return authService.checkVideoByUsername(mobile);
+    }
+    /**
+     * 点赞与取消点赞
+     * @param id
+     * @param diggFlag
+     * @return
+     */
+    @GetMapping("/up/video/diggcount")
+    public ResponseJson upVideoDiggCount(Integer id,Integer diggFlag){
+        return  authService.upVideoDiggCount(id,diggFlag);
+    }
+    /**
+     * 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);
+    }
 }

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

@@ -131,6 +131,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);
 
     String getauthUserId(@Param("authId") Integer authId);
 
@@ -190,4 +191,23 @@ public interface AuthMapper {
 
     List<RossChallengeVideo> getVideoAll(@Param("mobileOrAuthpart")String mobileOrAuthpart);
 
+    List<RossChallengeVideo> getVideoByUsername(@Param("mobile")String mobile);
+
+    List<RossChallengeVideo> checkVideoByUsername(@Param("mobile")String mobile);
+
+    void upVideoDiggCount(Integer videoId,Integer diggFlag);
+
+    List<RossChallengeRoundVo> getAuthInfo(@Param("mobile")String mobile);
+
+    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);
 }

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

@@ -1,8 +1,10 @@
 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 {
@@ -24,6 +26,12 @@ public class RossChallengeRoundVo {
      * 参赛状态(0:未参赛;1已参赛)
      */
     private Integer contestStatus;
+    /**
+     * 参赛时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Timestamp contestTime;
+
     /**
      * 资质认证营业执照oss地址
      */
@@ -36,4 +44,8 @@ public class RossChallengeRoundVo {
      * 是否资质认证(0:未认证;1:已认证)
      */
     private Integer authenticationStatus;
+    /**
+     * 参赛时间(用于前端展示)
+     */
+    private String contestDate;
 }

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

@@ -28,6 +28,10 @@ public class RossChallengeVideo {
      * 视频oss地址
      */
     private String ossUrl;
+    /**
+     * 视频封面
+     */
+    private String cover;
     /**
      * 视频发布时间
      */
@@ -36,6 +40,10 @@ public class RossChallengeVideo {
      * 点赞数量
      */
     private Integer diggCount;
+    /**
+     * 视频链接
+     */
+    private String linked;
     /**
      * 机构名称
      */

+ 45 - 0
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
      */
@@ -320,4 +325,44 @@ public interface AuthService {
      * @return
      */
     ResponseJson<List<RossChallengeVideo>> getVideoAll(String mobileOrAuthpart);
+
+    /**
+     * 根据手机号码查询该机构视频列表
+     * @param mobile  登录账号
+     * @return
+     */
+    ResponseJson<List<RossChallengeVideo>> getVideoByUsername(String mobile);
+    /**
+     * 验证机构是否已经上传了3个视频
+     * @param mobile 登录账号
+     * @return
+     */
+    ResponseJson<List<RossChallengeVideo>> checkVideoByUsername(String mobile);
+
+    /**
+     * 点赞与取消点赞
+     * @param id
+     * @param diggFlag
+     * @return
+     */
+    ResponseJson upVideoDiggCount(Integer id,Integer diggFlag);
+    /**
+     * 查询机构信息(后端)
+     * @param mobile
+     * @return
+     */
+    ResponseJson<List<RossChallengeRoundVo>> getAuthInfo(String mobile);
+    /**
+     * 根据id删除机构信息
+     * @param id
+     * @return
+     */
+    ResponseJson delAuthInfoById(Integer id);
+
+    /**
+     * 根据id删除视频信息
+     * @param id
+     * @return
+     */
+     ResponseJson delVideoInfoById(Integer id);
 }

+ 140 - 1
src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java

@@ -1266,6 +1266,18 @@ 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", "");
+        authMapper.saveVideo(ross.getUserName(),ross.getCover(),ross.getOssUrl(),ross.getOssName(),ross.getTitle(),releaseTime,ross.getAuthId(),ross.getLinked());
+        return ResponseJson.success("保存成功",null);
+    }
 
     /**
      * 根据authid获取authUserId
@@ -1552,8 +1564,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();
     }
@@ -1607,7 +1629,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);
@@ -1889,6 +1911,14 @@ public class AuthServiceImpl implements AuthService {
     @Override
     public ResponseJson saveRossInfo(RossChallengeRoundVo rossChallengeRoundVo){
         authMapper.saveRossInfo(rossChallengeRoundVo);
+        //如果活动已经开始了,则用户报名成功后向用户发送短信
+        if(null!=rossChallengeRoundVo.getAuthUserId()){
+            ChallengeActivityVo activityTime = authMapper.getActivityTime(rossChallengeRoundVo.getAuthUserId());
+            //判断活动是否开启
+            if(null!=activityTime &&null!=rossChallengeRoundVo.getAuthUserId()&&null!=activityTime.getStatus()&&activityTime.getStatus()==1){
+                smsSend(rossChallengeRoundVo.getAuthUserId());
+            }
+        }
         return ResponseJson.success();
     }
 
@@ -1922,4 +1952,113 @@ public class AuthServiceImpl implements AuthService {
         List<RossChallengeVideo> videoAll = authMapper.getVideoAll(mobileOrAuthpart);
         return ResponseJson.success(videoAll);
     }
+
+    /**
+     * 根据手机号码查询该机构视频列表
+     * @param mobile  登录账号
+     * @return
+     */
+    @Override
+    public ResponseJson<List<RossChallengeVideo>> getVideoByUsername(String mobile){
+        List<RossChallengeVideo> videoByUsername = authMapper.getVideoByUsername(mobile);
+        return ResponseJson.success(videoByUsername);
+
+    }
+
+    /**
+     * 验证机构是否已经上传了3个视频
+     * @param mobile 登录账号
+     * @return
+     */
+    @Override
+    public ResponseJson<List<RossChallengeVideo>> checkVideoByUsername(String mobile){
+        List<RossChallengeVideo> rossChallengeVideos = authMapper.checkVideoByUsername(mobile);
+        if(null!=rossChallengeVideos&&rossChallengeVideos.size()>=3){
+            return ResponseJson.success(-1,"抱歉,最多只能上传3个视频!!!",null);
+        }else{
+            return ResponseJson.success();
+        }
+    }
+
+    /**
+     * 点赞与取消点赞
+     * @param id
+     * @return
+     */
+    @Override
+    public ResponseJson upVideoDiggCount(Integer id,Integer diggFlag){
+        authMapper.upVideoDiggCount(id,diggFlag);
+        return ResponseJson.success();
+    }
+
+    /**
+     * 查询机构信息(后端)
+     * @param mobile
+     * @return
+     */
+    @Override
+    public ResponseJson<List<RossChallengeRoundVo>> getAuthInfo(String mobile){
+        List<RossChallengeRoundVo> authInfo = authMapper.getAuthInfo(mobile);
+        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(authInfo);
+    }
+
+    /**
+     * 根据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);
+        //获取供应商名称
+        String authParty=authMapper.getAuthparty(authUserId);
+        //短信类型:1通知短信,2验证码短信,3营销短信
+        Integer type=1;
+        String conn="[" + authParty + "]认证通抖音视频挑战赛邀您参与获大奖,点击链接:https://zp.caimei365.com/12/ross/activity/challenge或去Ross认证通打开";
+        if(null!=roundByAuthUserID&& roundByAuthUserID.size()>0){
+            roundByAuthUserID.stream().forEach(round ->{
+                if(StringUtils.isNotEmpty(round.getUserName())){
+                    Boolean aBoolean = SmsUtils.sendSms(type, round.getUserName(), conn);
+                    if(aBoolean){
+                        log.info("挑战赛短信发送成功"+round.getUserName());
+                    }else{
+                        log.info("挑战赛短信发送失败"+round.getUserName());
+                    }
+                }
+            });
+        }
+    }
 }

+ 53 - 2
src/main/resources/mapper/AuthMapper.xml

@@ -650,6 +650,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)
+        values(#{userName},#{title},#{ossName},#{ossUrl},#{cover},#{releaseTime},#{authId},#{linked})
+    </insert>
     <select id="getauthUserId" resultType="java.lang.String">
         select authUserId
         from cm_brand_auth
@@ -817,8 +821,8 @@
         where id=#{videoId}
     </update>
     <insert id="saveRossInfo" parameterType="com.caimei.model.vo.RossChallengeRoundVo">
-        insert into cm_ross_challenge_round(authUserId,authId,userName,contestStatus,licenseOssUrl,licenseOssName,authenticationStatus)
-        values(#{authUserId},#{authId},#{userName},#{contestStatus},#{licenseOssUrl},#{licenseOssName},#{authenticationStatus})
+        insert into cm_ross_challenge_round(authUserId,authId,userName,contestStatus,contestTime,licenseOssUrl,licenseOssName,authenticationStatus)
+        values(#{authUserId},#{authId},#{userName},#{contestStatus},#{contestTime},#{licenseOssUrl},#{licenseOssName},#{authenticationStatus})
     </insert>
     <select id="getInfoByUserName" resultType="com.caimei.model.vo.RossChallengeRoundVo">
         select * from cm_ross_challenge_round where userName=#{userName} and contestStatus=1
@@ -836,4 +840,51 @@
         </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}
+        order by diggCount desc,releaseTime
+    </select>
+    <select id="checkVideoByUsername" resultType="com.caimei.model.vo.RossChallengeVideo">
+        select * from cm_ross_challenge_video
+        where userName = #{mobile}
+    </select>
+    <update id="upVideoDiggCount">
+        update cm_ross_challenge_video
+            <set>
+            <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 * from cm_ross_challenge_round
+        <if test="null!=mobile and mobile !=''">
+            where  userName like concat('%', #{mobile})
+        </if>
+        order by contestTime
+    </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>