Browse Source

认证通V1.7.7功能开发

JiangChongBo 2 years ago
parent
commit
030d00e770

+ 53 - 1
src/main/java/com/caimei/controller/admin/auth/AuthApi.java

@@ -857,5 +857,57 @@ public class AuthApi {
         Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         return authService.getDyVidoInfo(authUserId);
     }
+//------------------------------------------抖音挑战赛1.7.7版本----------------------------------------------------------------------------------------------------------------
+    /**
+     * 新增参赛机构信息
+     * @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");
+        //判断该账号是否已经参赛
+        List<RossChallengeRoundVo> infoByUserName = authService.getInfoByUserName(mobile);
+        if(null !=infoByUserName&&infoByUserName.size()>0){
+            return ResponseJson.success("您已报名",null);
+        }
+        RossChallengeRoundVo rossChallengeRoundVo=new RossChallengeRoundVo();
+        rossChallengeRoundVo.setAuthUserId(authUserId);
+        rossChallengeRoundVo.setUserName(mobile);
+        rossChallengeRoundVo.setAuthId(authId);
+        rossChallengeRoundVo.setLicenseOssUrl(licenseOssUrl);
+        rossChallengeRoundVo.setLicenseOssName(licenseOssName);
+        if(StringUtils.isEmpty(licenseOssUrl)&&StringUtils.isEmpty(licenseOssName)){
+            rossChallengeRoundVo.setAuthenticationStatus(1);
+        }else{
+            rossChallengeRoundVo.setAuthenticationStatus(0);
+        }
+        rossChallengeRoundVo.setContestStatus(1);
+        return authService.saveRossInfo(rossChallengeRoundVo);
+    }
+    /**
+     * 获取已报名信息列表
+     * @return
+     */
+    @GetMapping("get/contested/info")
+    public ResponseJson<List<RossChallengeRoundVo>> getcontestedInfo(){
+        return authService.getcontestedInfo();
+    }
 
-    }
+    @GetMapping("get/video/all")
+    public ResponseJson<List<RossChallengeVideo>> getVideoAll(String mobileOrAuthpart){
+        return authService.getVideoAll(mobileOrAuthpart);
+    }
+}

+ 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();
+    }
 }

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

@@ -181,4 +181,13 @@ public interface AuthMapper {
     List<ChallengeRoundVo> getRoundlist();
 
     void upVidoInfoById(Integer videoId,@Param("diggCount")String diggCount,@Param("playCount") String playCount);
+
+    void saveRossInfo(RossChallengeRoundVo rossChallengeRoundVo);
+
+    List<RossChallengeRoundVo> getInfoByUserName(@Param("userName")String userName);
+
+    List<RossChallengeRoundVo> getcontestedInfo();
+
+    List<RossChallengeVideo> getVideoAll(@Param("mobileOrAuthpart")String mobileOrAuthpart);
+
 }

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

@@ -0,0 +1,39 @@
+package com.caimei.model.vo;
+
+import lombok.Data;
+
+import java.sql.Date;
+
+@Data
+public class RossChallengeRoundVo {
+
+    private Integer id;
+    /**
+     * 供应商id
+     */
+    private Integer authUserId;
+    /**
+     * 用户id
+     */
+    private Integer authId;
+    /**
+     * 用户登录账号
+     */
+    private String userName;
+    /**
+     * 参赛状态(0:未参赛;1已参赛)
+     */
+    private Integer contestStatus;
+    /**
+     * 资质认证营业执照oss地址
+     */
+    private String licenseOssUrl;
+    /**
+     * 资质认证营业执照oss名称
+     */
+    private String licenseOssName;
+    /**
+     * 是否资质认证(0:未认证;1:已认证)
+     */
+    private Integer authenticationStatus;
+}

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

@@ -0,0 +1,43 @@
+package com.caimei.model.vo;
+
+import lombok.Data;
+
+import java.sql.Date;
+
+@Data
+public class RossChallengeVideo {
+
+    private Integer id;
+    /**
+     * 机构id
+     */
+    private Integer authId;
+    /**
+     * 用户登录账号
+     */
+    private String userName;
+    /**
+     * 视频描述
+     */
+    private String title;
+    /**
+     * 视频oss名称
+     */
+    private String ossName;
+    /**
+     * 视频oss地址
+     */
+    private String ossUrl;
+    /**
+     * 视频发布时间
+     */
+    private Date releaseTime;
+    /**
+     * 点赞数量
+     */
+    private Integer diggCount;
+    /**
+     * 机构名称
+     */
+    private String authParty;
+}

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

@@ -297,5 +297,27 @@ 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);
+    /**
+     * 获取已报名信息列表
+     * @return
+     */
+    ResponseJson<List<RossChallengeRoundVo>> getcontestedInfo();
+    /**
+     * 查询视频列表
+     * @param mobileOrAuthpart 电话号码或者机构名称
+     * @return
+     */
+    ResponseJson<List<RossChallengeVideo>> getVideoAll(String mobileOrAuthpart);
+}

+ 43 - 0
src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java

@@ -38,6 +38,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;
@@ -1861,4 +1862,46 @@ public class AuthServiceImpl implements AuthService {
         }
         return ResponseJson.success();
     }
+
+    /**
+     * 新增参赛机构信息
+     * @param rossChallengeRoundVo
+     * @return
+     */
+    @Override
+    public ResponseJson saveRossInfo(RossChallengeRoundVo rossChallengeRoundVo){
+        authMapper.saveRossInfo(rossChallengeRoundVo);
+        return ResponseJson.success();
+    }
+
+    /**
+     * 根据手机号码获取信息
+     * @param userName
+     * @return
+     */
+    @Override
+    public List<RossChallengeRoundVo> getInfoByUserName(String userName){
+        return authMapper.getInfoByUserName(userName);
+    }
+
+    /**
+     * 获取已报名信息列表
+     * @return
+     */
+    @Override
+    public ResponseJson<List<RossChallengeRoundVo>> getcontestedInfo(){
+        List<RossChallengeRoundVo> rossChallengeRoundVos = authMapper.getcontestedInfo();
+        return ResponseJson.success(rossChallengeRoundVos);
+    }
+
+    /**
+     * 查询视频列表
+     * @param mobileOrAuthpart 电话号码或者机构名称
+     * @return
+     */
+    @Override
+    public ResponseJson<List<RossChallengeVideo>> getVideoAll(String mobileOrAuthpart){
+        List<RossChallengeVideo> videoAll = authMapper.getVideoAll(mobileOrAuthpart);
+        return ResponseJson.success(videoAll);
+    }
 }

+ 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;
+    }
 }

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

@@ -816,4 +816,24 @@
             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,licenseOssUrl,licenseOssName,authenticationStatus)
+        values(#{authUserId},#{authId},#{userName},#{contestStatus},#{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
+    </select>
+    <select id="getcontestedInfo" resultType="com.caimei.model.vo.RossChallengeRoundVo">
+        select * from cm_ross_challenge_round where  contestStatus=1
+    </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 1=1
+        <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>
 </mapper>