Sfoglia il codice sorgente

Merge branch 'developerB' into developer

zhijiezhao 1 anno fa
parent
commit
fb6b17a946

+ 69 - 23
src/main/java/com/caimei/controller/admin/auth/AuthApi.java

@@ -6,6 +6,7 @@ import com.caimei.annotation.Idempotent;
 import com.caimei.annotation.WebHooks;
 import com.caimei.components.RedisService;
 import com.caimei.model.ResponseJson;
+import com.caimei.model.po.AuthQrcodePo;
 import com.caimei.model.po.CmBrandAuthPo;
 import com.caimei.model.po.SysUser;
 import com.caimei.model.vo.*;
@@ -20,18 +21,6 @@ import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.http.Consts;
-import org.apache.http.HttpEntity;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ContentType;
-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.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -39,7 +28,6 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.math.BigDecimal;
-import java.nio.charset.StandardCharsets;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -61,6 +49,56 @@ public class AuthApi {
     @Resource
     private RedisService redisService;
 
+    @ApiOperation("预设二维码列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "unionStatus", required = false, value = "激活状态 0未激活 1已激活"),
+            @ApiImplicitParam(name = "productTypeId", required = false, value = "设备类型Id"),
+            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
+            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
+    })
+    @GetMapping("/qrcode/list")
+    public ResponseJson<PageInfo<AuthQrcodePo>> getQrCodeList(Integer authUserId, Integer unionStatus, Integer productTypeId,
+                                                              @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                              @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return authService.getQrcodeList(authUserId, unionStatus, productTypeId, pageNum, pageSize);
+    }
+
+    @ApiOperation("二维码关联机构列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", required = true, value = "二维码Id"),
+            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "productTypeId", required = true, value = "设备类型Id"),
+            @ApiImplicitParam(name = "authParty", required = false, value = "机构名称"),
+            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
+            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
+    })
+    @GetMapping("/concat/list")
+    public ResponseJson<PageInfo<AuthVo>> getConcatList(Integer id,Integer authUserId, Integer productTypeId, String authParty,
+                                                        @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                        @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return authService.getConcatList(id,authUserId, productTypeId, authParty, pageNum, pageSize);
+    }
+
+    @ApiOperation("批量生成二维码")
+    @ApiImplicitParam(name = "params", value = "authUserId:供应商Id;num:生成数量;productTypeId:设备类型id", required = true)
+    @PostMapping("/qrcode/made")
+    public ResponseJson getQrCodeList(@RequestBody Map<String, Integer> params) {
+        Integer authUserId = params.get("authUserId");
+        Integer num = params.get("num");
+        Integer productTypeId = params.get("productTypeId");
+        return authService.makeQrcode(authUserId, productTypeId, num);
+    }
+
+    @ApiOperation("预设二维码关联")
+    @ApiImplicitParam(name = "params", value = "authId:机构id;id:二维码id;", required = true)
+    @PostMapping("/qrcode/concat")
+    public ResponseJson concatQrcode(@RequestBody Map<String, Integer> params) {
+        Integer authId = params.get("authId");
+        Integer id = params.get("id");
+        return authService.concatQrcode(authId, id);
+    }
+
     /**
      * 授权列表
      */
@@ -534,10 +572,11 @@ public class AuthApi {
 
     /**
      * 清除抖音授权token缓存
+     *
      * @return
      */
     @GetMapping("/clean/douyin/redis")
-    public  ResponseJson cleanDYRedis(){
+    public ResponseJson cleanDYRedis() {
         redisService.remove("DYaccessToken");
         redisService.remove("DyrefreshToken");
         redisService.remove("DyopenId");
@@ -777,7 +816,7 @@ public class AuthApi {
      */
     @GetMapping("/get/published/video/list")
     public ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideoList(@CurrentUser SysUser sysUser, Integer status, String userName, String authParty, Integer cursor, Integer count, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
-                                                                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,String startTIme,String endTime) {
+                                                                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, String startTIme, String endTime) {
         if (null == sysUser) {
             return ResponseJson.error("用户信息异常", null);
         }
@@ -793,7 +832,7 @@ public class AuthApi {
         if (cursor == null) {
             cursor = 0;
         }
-        return authService.getPublishedVideo(userName, authParty, status, cursor, count, authUserId, pageNum, pageSize,startTIme,endTime);
+        return authService.getPublishedVideo(userName, authParty, status, cursor, count, authUserId, pageNum, pageSize, startTIme, endTime);
     }
 
     /**
@@ -851,23 +890,26 @@ public class AuthApi {
     public ResponseJson<ChallengeRoundVo> getInfoById(Integer videoId) {
         return authService.getInfoById(videoId);
     }
+
     @GetMapping("/getDyVidoInfo")
-    public ResponseJson getDyVidoInfo(@CurrentUser SysUser sysUser){
+    public ResponseJson getDyVidoInfo(@CurrentUser SysUser sysUser) {
         Integer userIdentity = sysUser.getUserIdentity();
         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,Integer authenticationStatus,
-                                                                @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
-                                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
+                                                                    @CurrentUser SysUser sysUser, Integer authenticationStatus,
+                                                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                                    @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
         if (null == sysUser) {
             return ResponseJson.error("用户信息异常", null);
         }
@@ -877,25 +919,29 @@ public class AuthApi {
         if (null == authUserId) {
             return ResponseJson.error("供应商用户id不能为空", null);
         }
-        return authService.getAuthInfo(mobile,pageNum,pageSize,authUserId,authenticationStatus);
+        return authService.getAuthInfo(mobile, pageNum, pageSize, authUserId, authenticationStatus);
     }
+
     /**
      * 根据id删除机构信息
+     *
      * @param id
      * @return
      */
     @GetMapping("/del/auth/info")
-    public ResponseJson delAuthInfoById(Integer id){
+    public ResponseJson delAuthInfoById(Integer id) {
         //删除机构信息
         return authService.delAuthInfoById(id);
     }
+
     /**
      * 根据id删除视频信息
+     *
      * @param id
      * @return
      */
     @GetMapping("/del/video/info")
-    public ResponseJson delVideoInfoById(Integer id){
+    public ResponseJson delVideoInfoById(Integer id) {
         return authService.delVideoInfoById(id);
     }
 }

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

@@ -366,7 +366,7 @@ public class WxAuthApi {
     @ApiOperation("已认证商品详情")
     @ApiImplicitParam(required = false, name = "productId", value = "正品联盟商品Id")
     @GetMapping("/product/details")
-    public ResponseJson<AuthProductVo> getAuthProductDetails(Integer productId) {
+    public ResponseJson<AuthProductVo> getAuthProductDetails(String productId) {
         return authProductService.getAuthProductDetails(productId);
     }
 

+ 50 - 34
src/main/java/com/caimei/mapper/cmMapper/AuthMapper.java

@@ -1,5 +1,6 @@
 package com.caimei.mapper.cmMapper;
 
+import com.caimei.model.po.AuthQrcodePo;
 import com.caimei.model.po.CmBrandAuthPo;
 import com.caimei.model.po.LdmDataPo;
 import com.caimei.model.po.TownPo;
@@ -7,6 +8,7 @@ import com.caimei.model.vo.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -19,8 +21,9 @@ import java.util.List;
 @Mapper
 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);
+    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);
 
@@ -32,7 +35,7 @@ public interface AuthMapper {
 
     void updateAuthByAuthId(CmBrandAuthPo auth);
 
-    void updateRelaByAuthId(Integer authId,@Param("relationId")String relationId,@Param("relationName")String relationName);
+    void updateRelaByAuthId(Integer authId, @Param("relationId") String relationId, @Param("relationName") String relationName);
 
     CmBrandAuthPo getRelationInfo(Integer id);
 
@@ -94,7 +97,7 @@ public interface AuthMapper {
 
     List<String> getCityNames(Integer ProvinceId);
 
-    Integer getCityIdByProvinceId(@Param("provinceId")Integer provinceId,@Param("cityName") String cityName);
+    Integer getCityIdByProvinceId(@Param("provinceId") Integer provinceId, @Param("cityName") String cityName);
 
     String getProvinceNameById(Integer provinceId);
 
@@ -114,26 +117,29 @@ public interface AuthMapper {
 
     void checkAuth(Integer authId);
 
-    void starAuth(@Param("authId") Integer authId, @Param("starFlag") Integer starFlag,@Param("starNum") String starNum);
+    void starAuth(@Param("authId") Integer authId, @Param("starFlag") Integer starFlag, @Param("starNum") String starNum);
 
     void addScanCount(Integer authId);
 
     //根据id查询机构集合
     List<AuthFormVo> getAuthIdList(@Param("relationIdList") String[] relationIdList);
+
     //获取关联机构的信息
-    AuthFormVo  getRelationgInfo(Integer authId,Integer authUserId);
+    AuthFormVo getRelationgInfo(Integer authId, Integer authUserId);
+
     /**
-     *  1.7.4版本
+     * 1.7.4版本
      * 获取可绑定机构机构信息
-     * **/
+     **/
     List<AuthFormVo> getClubBindAuth(Integer authUserId);
 
     List<ProductFormVo> getRelationgList(String snCode);
 
     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);
+    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);
 
@@ -141,35 +147,35 @@ public interface AuthMapper {
 
     Integer checkActivityTime(@Param("releaseTime") String releaseTime);
 
-    List<ChallengeRoundVo> getPublishedVideoList(@Param("clubUserName")String clubUserName,@Param("status")Integer status,Integer authUserId,@Param("startTime")String startTime,@Param("endTime")String endTime);
+    List<ChallengeRoundVo> getPublishedVideoList(@Param("clubUserName") String clubUserName, @Param("status") Integer status, Integer authUserId, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
-    List<ChallengeRoundVo> getPublishedVideoListNoRanking(@Param("clubUserName")String clubUserName,@Param("status")Integer status,Integer authUserId,@Param("startTime")String startTime,@Param("endTime")String endTime);
+    List<ChallengeRoundVo> getPublishedVideoListNoRanking(@Param("clubUserName") String clubUserName, @Param("status") Integer status, Integer authUserId, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
-    List<ChallengeRoundVo> getPublishedVideo(@Param("mobile")String mobile,@Param("authParty")String authParty,@Param("status")Integer status,@Param("authUserId")Integer authUserId,@Param("startTime")String startTime,@Param("endTime")String endTime);
+    List<ChallengeRoundVo> getPublishedVideo(@Param("mobile") String mobile, @Param("authParty") String authParty, @Param("status") Integer status, @Param("authUserId") Integer authUserId, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
-    List<ChallengeRoundVo> getPublishedVideoNoRanking(@Param("mobile")String mobile,@Param("authParty")String authParty,@Param("status")Integer status,@Param("authUserId")Integer authUserId,@Param("startTime")String startTime,@Param("endTime")String endTime);
+    List<ChallengeRoundVo> getPublishedVideoNoRanking(@Param("mobile") String mobile, @Param("authParty") String authParty, @Param("status") Integer status, @Param("authUserId") Integer authUserId, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
-    List<ChallengeRoundVo> getAuthPartylist(@Param("authUserId")Integer authUserId);
+    List<ChallengeRoundVo> getAuthPartylist(@Param("authUserId") Integer authUserId);
 
     List<ChallengeActivityVo> checkActivityId();
 
-    void saveActivityInfo(@Param("startTime") String startTime,@Param("endTime")String endTime,@Param("status")Integer status,@Param("authUserId")Integer authUserId);
+    void saveActivityInfo(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("status") Integer status, @Param("authUserId") Integer authUserId);
 
-    void upActivityInfo(@Param("startTime") String startTime,@Param("endTime")String endTime,@Param("status")Integer status,@Param("authUserId")Integer authUserId);
+    void upActivityInfo(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("status") Integer status, @Param("authUserId") Integer authUserId);
 
-    ChallengeActivityVo  getActivityTime(@Param("authUserId") Integer authUserId);
+    ChallengeActivityVo getActivityTime(@Param("authUserId") Integer authUserId);
 
-    void savaShareIdByAuthId(@Param("authId")Integer authId,@Param("shareId")String shareId);
+    void savaShareIdByAuthId(@Param("authId") Integer authId, @Param("shareId") String shareId);
 
-    String getShareId(@Param("shareId")String shareId);
+    String getShareId(@Param("shareId") String shareId);
 
-    void savaItemIdByShareId(@Param("shareId")String shareId,@Param("itemId")String itemId);
+    void savaItemIdByShareId(@Param("shareId") String shareId, @Param("itemId") String itemId);
 
     String getMobileByAuthId(Integer authId);
 
     String getAuthUserName(Integer authId);
 
-    void savaDyCommand(Integer authId,@Param("content")String content);
+    void savaDyCommand(Integer authId, @Param("content") String content);
 
     String getOssNameId(Integer videoID);
 
@@ -181,38 +187,38 @@ public interface AuthMapper {
 
     void upStatusById(Integer id);
 
-    String getReleaseTime(@Param("userName")String userName );
+    String getReleaseTime(@Param("userName") String userName);
 
     List<ChallengeRoundVo> getRoundlist();
 
-    void upVidoInfoById(Integer videoId,@Param("diggCount")String diggCount,@Param("playCount") String playCount);
+    void upVidoInfoById(Integer videoId, @Param("diggCount") String diggCount, @Param("playCount") String playCount);
 
     void saveRossInfo(RossChallengeRoundVo rossChallengeRoundVo);
 
-    List<Integer> getClubUserId(@Param("mobile")String mobile);
+    List<Integer> getClubUserId(@Param("mobile") String mobile);
 
-    List<RossChallengeRoundVo> getInfoByUserName(@Param("userName")String userName);
+    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);
+    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> 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> 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);
+    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);
+    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,Integer authenticationStatus);
+    List<RossChallengeRoundVo> getAuthInfo(@Param("mobile") String mobile, @Param("authUserId") Integer authUserId, @Param("StartTime") String StartTime, @Param("endTime") String endTime, Integer authenticationStatus);
 
     void delAuthInfoById(Integer id);
 
     void delVideoInfoById(Integer id);
 
-    void delVideoInfoByUserName(@Param("mobile")String mobile);
+    void delVideoInfoByUserName(@Param("mobile") String mobile);
 
     RossChallengeRoundVo getRoundById(Integer id);
 
@@ -220,5 +226,15 @@ public interface AuthMapper {
 
     String getAuthparty(Integer authUserId);
 
-    List<ClubUserVo> getclubuserInfo(Integer authUserId,@Param("clubUserIds")String clubUserIds);
+    List<ClubUserVo> getclubuserInfo(Integer authUserId, @Param("clubUserIds") String clubUserIds);
+
+    List<AuthQrcodePo> findQrCodes(Integer authUserId, Integer productTypeId, Integer unionStatus);
+
+    void insertQrCode(AuthQrcodePo qrcodePo);
+
+    void updateQrCodes(@Param("qrcodePos") List<AuthQrcodePo> qrcodePos);
+
+    void concatQrcode(@Param("authId") Integer authId, @Param("id") Integer id);
+
+    List<AuthVo> getConcatList(Integer id,Integer authUserId, Integer productTypeId, String authParty);
 }

+ 2 - 0
src/main/java/com/caimei/mapper/cmMapper/AuthProductMapper.java

@@ -125,4 +125,6 @@ public interface AuthProductMapper {
     List<ProductListVo> getPronductInfo(Integer authId, Integer authUserId);
 
     Integer getNewestRelationId();
+
+    Integer findProductByQr(String substring);
 }

+ 32 - 0
src/main/java/com/caimei/model/po/AuthQrcodePo.java

@@ -0,0 +1,32 @@
+package com.caimei.model.po;
+
+import lombok.Data;
+
+@Data
+public class AuthQrcodePo {
+
+    private Integer id;
+    /**
+     * 替代链接id
+     */
+    private String qrCodeId;
+    /**
+     * 仪器品类Id
+     */
+    private Integer productTypeId;
+    private Integer authId;
+    private Integer authUserId;
+    private String addtime;
+    /**
+     * 关联状态 未关联0,已关联1
+     */
+    private Integer unionStatus;
+    /**
+     * 仪器名称
+     */
+    private String productName;
+    /**
+     * 机构名称
+     */
+    private String authParty;
+}

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

@@ -129,7 +129,7 @@ public interface AuthProductService {
      * @param productId     商品id
      * @return
      */
-    ResponseJson<AuthProductVo> getAuthProductDetails(Integer productId);
+    ResponseJson<AuthProductVo> getAuthProductDetails(String productId);
 
     /**
      * 保存设备分类

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

@@ -2,6 +2,7 @@ package com.caimei.service.auth;
 
 import com.caimei.annotation.CurrentUser;
 import com.caimei.model.ResponseJson;
+import com.caimei.model.po.AuthQrcodePo;
 import com.caimei.model.po.CmBrandAuthPo;
 import com.caimei.model.po.SysUser;
 import com.caimei.model.vo.*;
@@ -37,8 +38,9 @@ public interface AuthService {
      * @param auditStatus      审核状态:0审核未通过,1审核通过,2待审核
      * @return AuthVo
      */
-    ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty, String mobile, Integer status, Integer starFlag, Integer auditStatus, Integer lowerAuditStatus, Integer shopAuditStatus, Integer sendStatus,String authCode ,Integer pageNum, Integer pageSize);
-    ResponseJson<PageInfo<AuthVo>> getAuthListAll(Integer listType, Integer authUserId, String authParty, String mobile, Integer status, Integer starFlag, Integer auditStatus, Integer lowerAuditStatus, Integer shopAuditStatus, Integer sendStatus, String name,String snCode,Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty, String mobile, Integer status, Integer starFlag, Integer auditStatus, Integer lowerAuditStatus, Integer shopAuditStatus, Integer sendStatus, String authCode, Integer pageNum, Integer pageSize);
+
+    ResponseJson<PageInfo<AuthVo>> getAuthListAll(Integer listType, Integer authUserId, String authParty, String mobile, Integer status, Integer starFlag, Integer auditStatus, Integer lowerAuditStatus, Integer shopAuditStatus, Integer sendStatus, String name, String snCode, Integer pageNum, Integer pageSize);
 
     /**
      * 更新授权状态
@@ -51,8 +53,9 @@ public interface AuthService {
 
     /**
      * 删除授权
-     * @param authId    授权id
-     * @return  ResponseJson
+     *
+     * @param authId 授权id
+     * @return ResponseJson
      */
     ResponseJson deleteAuth(Integer authId);
 
@@ -69,10 +72,10 @@ public interface AuthService {
     /**
      * 审核品牌授权
      *
-     * @param authId            授权id
-     * @param auditStatus       审核状态
-     * @param invalidReason     审核不通过原因
-     * @param auditBy           审核人用户id
+     * @param authId        授权id
+     * @param auditStatus   审核状态
+     * @param invalidReason 审核不通过原因
+     * @param auditBy       审核人用户id
      * @param source
      * @return ResponseJson
      */
@@ -80,8 +83,9 @@ public interface AuthService {
 
     /**
      * 导入excel中的授权机构和商品数据
-     * @param file          excel表格
-     * @param authUserId    供应商用户id
+     *
+     * @param file       excel表格
+     * @param authUserId 供应商用户id
      * @param createBy
      * @return
      */
@@ -89,7 +93,8 @@ public interface AuthService {
 
     /**
      * 授权机构回显数据
-     * @param authId    机构id
+     *
+     * @param authId 机构id
      * @return
      */
     ResponseJson<AuthFormVo> getAuthFormData(Integer authId);
@@ -101,6 +106,7 @@ public interface AuthService {
 
     /**
      * ldm门店图/备注导入
+     *
      * @param authUserId
      * @return
      */
@@ -108,6 +114,7 @@ public interface AuthService {
 
     /**
      * 生成机构授权牌
+     *
      * @param auth
      * @return
      */
@@ -116,10 +123,11 @@ public interface AuthService {
     /**
      * 添加水印
      */
-    String addWaterMark(String image,Integer type);
+    String addWaterMark(String image, Integer type);
 
     /**
      * 更改查看标记
+     *
      * @param authId
      * @return
      */
@@ -128,46 +136,56 @@ public interface AuthService {
     /**
      * 更改明星标识
      */
-    ResponseJson starAuth(Integer authId, Integer starFlag,String starNum);
+    ResponseJson starAuth(Integer authId, Integer starFlag, String starNum);
+
     /**
      * 获取机构关联的机构信息
      * 1.7.4版本:编辑时新加关联机构操作
-     *
      */
-    ResponseJson<List<AuthFormVo>> getRelationgInfo(String  snCode, Integer authUserId);
+    ResponseJson<List<AuthFormVo>> getRelationgInfo(String snCode, Integer authUserId);
+
     /**
      * 获取可绑定机构机构信息
-     * **/
+     **/
     ResponseJson<List<AuthFormVo>> getClubBindAuth(Integer authUserId);
 
     /**
      * 用户扫码授权,获取code值
+     *
      * @param response
      * @return
      * @throws IOException
      */
     ResponseJson getDouYingCode(HttpServletResponse response) throws IOException;
+
     /**
      * 根据用户的code值获取AcessToken
      * ccode 用户授权登录code
      **/
     ResponseJson getDouYingAcessToken(String ccode) throws IOException;
+
     /**
      * h5的方式上传视频
+     *
      * @return
      * @throws IOException
      */
-    ResponseJson getclientToken(String title,String videoPath,Integer authId) throws IOException;
+    ResponseJson getclientToken(String title, String videoPath, Integer authId) throws IOException;
+
     /**
      * 保存视频信息
+     *
      * @return
      */
     ResponseJson saveVideoInfo(ChallengeRoundVo challengeRoundVo);
+
     /**
      * 1.7.7(ROSS)保存视频信息
+     *
      * @return
      */
     ResponseJson<RossChallengeVideo> saveVideo(RossChallengeVideo rossChallengeVideo);
+
     /**
      * 根据authid获取authUserId
      */
@@ -175,6 +193,7 @@ public interface AuthService {
 
     /**
      * 判断是否存在userName
+     *
      * @param userName
      * @return
      */
@@ -182,22 +201,25 @@ public interface AuthService {
 
     /**
      * 验证是否在活动时间内
+     *
      * @return
      */
     boolean checkActivityTime(String releaseTime);
 
     /**
      * 获取已发布视频(前端)
+     *
      * @param clubUserName
      * @param status
      * @param cursor
      * @param count
      * @return
      */
-    ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideoList(String clubUserName,Integer status,Integer cursor,Integer count,Integer pageNum,Integer pageSize,Integer authUserId);
+    ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideoList(String clubUserName, Integer status, Integer cursor, Integer count, Integer pageNum, Integer pageSize, Integer authUserId);
 
     /**
      * 获取已发布视频(后端)
+     *
      * @param mobile
      * @param authParty
      * @param status
@@ -206,31 +228,36 @@ public interface AuthService {
      * @param authUserId
      * @return
      */
-    ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideo(String mobile,String authParty,Integer status,Integer cursor,Integer count,Integer authUserId,Integer pageNum,Integer pageSize,String startTIme,String endTime);
+    ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideo(String mobile, String authParty, Integer status, Integer cursor, Integer count, Integer authUserId, Integer pageNum, Integer pageSize, String startTIme, String endTime);
 
     /**
      * 获取机构已发布视频的机构下拉列表
+     *
      * @param authUserId
      * @return
      */
     ResponseJson<List<ChallengeRoundVo>> getAuthPartylist(Integer authUserId);
+
     /**
      * 保存活动信息
+     *
      * @param startTime
      * @param endTime
      * @param status
      * @return
      */
-    ResponseJson saveActivityTime(String startTime,String endTime,Integer status,Integer authUserId);
+    ResponseJson saveActivityTime(String startTime, String endTime, Integer status, Integer authUserId);
 
     /**
      * 获取活动信息
+     *
      * @return
      */
-     ResponseJson<ChallengeActivityVo> getActivityTime(Integer authUserId);
+    ResponseJson<ChallengeActivityVo> getActivityTime(Integer authUserId);
 
     /**
      * 判断shareId是否存在
+     *
      * @param shareId
      * @return
      */
@@ -238,26 +265,31 @@ public interface AuthService {
 
     /**
      * 根据ShareId保存itemId (webhook触发时调用)
+     *
      * @param shareId
      * @param itemId
      */
-     void savaItemIdByShareId(String shareId,String itemId);
+    void savaItemIdByShareId(String shareId, String itemId);
 
     /**
      * 判断活动开启状态
+     *
      * @param sysUser
      * @return
      */
-     ResponseJson<ChallengeActivityVo> getActivitty(Integer sysUser);
+    ResponseJson<ChallengeActivityVo> getActivitty(Integer sysUser);
 
     /**
      * 根据authId获取手机号
+     *
      * @param authId
      * @return
      */
     String getMobileByAuthId(Integer authId);
+
     /**
      * 根据authId获取供应商名称
+     *
      * @param authId
      * @return
      */
@@ -265,18 +297,20 @@ public interface AuthService {
 
     /**
      * 获取发布时间
+     *
      * @param userName
      * @return
      */
     String getReleaseTime(String userName);
 
-        /**
-         * 保存抖音口令
-         */
-   void savaDyCommand(Integer authId,String content);
+    /**
+     * 保存抖音口令
+     */
+    void savaDyCommand(Integer authId, String content);
 
     /**
      * 根据authId获取ossName
+     *
      * @param videoID
      * @return
      */
@@ -284,82 +318,102 @@ public interface AuthService {
 
     /**
      * 删除视频
+     *
      * @param videoID
      */
     void deleteVideoByAuthId(Integer videoID);
 
     /**
      * 下载视频
+     *
      * @param fileId
      * @param response
      * @return
      */
-    ResponseJson downLoadChoseZip(String fileId,HttpServletResponse response);
+    ResponseJson downLoadChoseZip(String fileId, HttpServletResponse response);
+
     /**
      * 根据id获取信息
-     *
      */
-     ResponseJson<ChallengeRoundVo> getInfoById(Integer videoId);
+    ResponseJson<ChallengeRoundVo> getInfoById(Integer videoId);
+
+    ResponseJson getDyVidoInfo(Integer authUserId);
 
-     ResponseJson getDyVidoInfo(Integer authUserId);
     /**
      * 新增参赛机构信息
+     *
      * @param rossChallengeRoundVo
      * @return
      */
     ResponseJson saveRossInfo(RossChallengeRoundVo rossChallengeRoundVo);
+
     /**
      * 根据手机号码获取信息
+     *
      * @param userName
      * @return
      */
-    RossChallengeRoundVo getInfoByUserName(String userName,Integer authUserId);
+    RossChallengeRoundVo getInfoByUserName(String userName, Integer authUserId);
+
     /**
      * 验证用户是否已经报名
+     *
      * @param mobile
      * @return
      */
-    ResponseJson<RossChallengeRoundVo> checkContestedInfo(String mobile,Integer authUserId);
+    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);
+    ResponseJson<PageInfo<RossChallengeVideo>> getVideoAll(String mobileOrAuthpart, Integer clubUserId, Integer authUserId, Integer pageNum, Integer pageSize);
 
     /**
      * 根据手机号码查询该机构视频列表
-     * @param mobile  登录账号
+     *
+     * @param mobile 登录账号
      * @return
      */
-    ResponseJson<List<RossChallengeVideo>> getVideoByUsername(String mobile,Integer clubUserId,Integer authUserId);
+    ResponseJson<List<RossChallengeVideo>> getVideoByUsername(String mobile, Integer clubUserId, Integer authUserId);
+
     /**
      * 验证机构是否已经上传了3个视频
+     *
      * @param mobile 登录账号
      * @return
      */
-    ResponseJson<List<RossChallengeVideo>> checkVideoByUsername(String mobile,Integer authUserId);
+    ResponseJson<List<RossChallengeVideo>> checkVideoByUsername(String mobile, Integer authUserId);
 
     /**
      * 点赞与取消点赞
+     *
      * @param id
      * @param diggFlag
      * @return
      */
-    ResponseJson upVideoDiggCount(Integer id,Integer diggFlag,Integer clubUserId,String clubUserIds);
+    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,Integer authenticationStatus);
+    ResponseJson<PageInfo<RossChallengeRoundVo>> getAuthInfo(String mobile, Integer pageNum, Integer pageSize, Integer authUserId, Integer authenticationStatus);
+
     /**
      * 根据id删除机构信息
+     *
      * @param id
      * @return
      */
@@ -367,8 +421,17 @@ public interface AuthService {
 
     /**
      * 根据id删除视频信息
+     *
      * @param id
      * @return
      */
-     ResponseJson delVideoInfoById(Integer id);
+    ResponseJson delVideoInfoById(Integer id);
+
+    ResponseJson<PageInfo<AuthQrcodePo>> getQrcodeList(Integer authUserId, Integer unionStatus, Integer productTypeId, Integer pageNum, Integer pageSize);
+
+    ResponseJson makeQrcode(Integer authUserId, Integer productTypeId, Integer num);
+
+    ResponseJson concatQrcode(Integer authId, Integer id);
+
+    ResponseJson<PageInfo<AuthVo>> getConcatList(Integer id,Integer authUserId, Integer productTypeId, String authParty, Integer pageNum, Integer pageSize);
 }

+ 32 - 29
src/main/java/com/caimei/service/auth/impl/AuthClubServiceImpl.java

@@ -57,43 +57,43 @@ public class AuthClubServiceImpl implements AuthClubService {
     }
 
     @Override
-    public ResponseJson<PageInfo<ClubUserVo>> getClubUserList(Integer authUserId, String mobile, String name, Integer status, Integer pageNum, Integer pageSize,Integer authenticationStatus) {
-       //判断筛选条件是否是认证机构
-        if(null==authenticationStatus){
+    public ResponseJson<PageInfo<ClubUserVo>> getClubUserList(Integer authUserId, String mobile, String name, Integer status, Integer pageNum, Integer pageSize, Integer authenticationStatus) {
+        //判断筛选条件是否是认证机构
+        if (null == authenticationStatus) {
             //查询全部
             PageHelper.startPage(pageNum, pageSize);
             List<ClubUserVo> clubUserList = clubMapper.getAllCertifiedClubUserList(authUserId, mobile, name, status);
             clubUserList.forEach(clubUserVo -> {
-                if(null!=clubUserVo.getAuthId()){
+                if (null != clubUserVo.getAuthId()) {
                     clubUserVo.setAuthenticationStatus("1");
-                }else {
+                } else {
                     clubUserVo.setAuthenticationStatus("0");
                 }
             });
             PageInfo<ClubUserVo> pageData = new PageInfo<>(clubUserList);
             return ResponseJson.success(pageData);
         }
-        if(authenticationStatus==0){
+        if (authenticationStatus == 0) {
             //查询未认证的机构
             PageHelper.startPage(pageNum, pageSize);
-            List<ClubUserVo> clubUserList = clubMapper.getNotCertifiedClubUserList(authUserId, mobile, name, status,authenticationStatus);
+            List<ClubUserVo> clubUserList = clubMapper.getNotCertifiedClubUserList(authUserId, mobile, name, status, authenticationStatus);
             clubUserList.forEach(clubUserVo -> {
-                if(null!=clubUserVo.getAuthId()){
+                if (null != clubUserVo.getAuthId()) {
                     clubUserVo.setAuthenticationStatus("1");
-                }else {
+                } else {
                     clubUserVo.setAuthenticationStatus("0");
                 }
             });
             PageInfo<ClubUserVo> pageData = new PageInfo<>(clubUserList);
             return ResponseJson.success(pageData);
-        }else{
+        } else {
             //查询已认证的机构
             PageHelper.startPage(pageNum, pageSize);
             List<ClubUserVo> clubUserList = clubMapper.getClubUserList(authUserId, mobile, name, status);
             clubUserList.forEach(clubUserVo -> {
-                if(null!=clubUserVo.getAuthId()){
+                if (null != clubUserVo.getAuthId()) {
                     clubUserVo.setAuthenticationStatus("1");
-                }else {
+                } else {
                     clubUserVo.setAuthenticationStatus("0");
                 }
             });
@@ -157,7 +157,7 @@ public class AuthClubServiceImpl implements AuthClubService {
         clubDetail.setProductList(wxProductList);
         // 操作医师列表
         List<WxDoctorListVo> doctorList = doctorMapper.getWxDoctorList(null, authId, 1, null);
-        doctorList.forEach(doctor->{
+        doctorList.forEach(doctor -> {
             List<String> tagList = doctorMapper.getTagList(doctor.getDoctorId());
             doctor.setTagList(tagList);
         });
@@ -206,7 +206,7 @@ public class AuthClubServiceImpl implements AuthClubService {
             } else {
                 shopName = shop.getShopName();
             }
-            String content = "("+ shopName +")您认证通登录密码为:rzt123456,请勿泄漏于他人。【采美网提供技术支持】";
+            String content = "(" + shopName + ")您认证通登录密码为:rzt123456,请勿泄漏于他人。【采美网提供技术支持】";
             Boolean sendSms = SmsUtils.sendSms(1, mobile, content);
             if (!sendSms) {
                 log.info("供应商添加机构用户-密码发送失败,手机号:" + mobile);
@@ -225,28 +225,29 @@ public class AuthClubServiceImpl implements AuthClubService {
 
     /**
      * 认证通1.7.7ROSS挑战赛挑战赛活动开启期间新增用户短信发送
+     *
      * @param authUserId
      */
-    public void smsRossRound(Integer authUserId,String mobile){
+    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){
+        if (null != authUserId) {
             ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
-            String shortLink =getShortLink(8, 3, zpServer+"/12/ross/activity/challenge");
+            String shortLink = getShortLink(8, 3, zpServer + "/12/ross/activity/challenge");
             //判断活动是否开启
-            if(null!=activityTime &&null!=authUserId&&null!=activityTime.getStatus()&&activityTime.getStatus()==1){
+            if (null != activityTime && null != authUserId && null != activityTime.getStatus() && activityTime.getStatus() == 1) {
                 //获取供应商名称
-                String authParty=authMapper.getAuthparty(authUserId);
-                if(authUserId==12){
-                    authParty="西班牙ROSS";
+                String authParty = authMapper.getAuthparty(authUserId);
+                if (authUserId == 12) {
+                    authParty = "西班牙ROSS";
                 }
                 //生成短连接
                 //短信类型:1通知短信,2验证码短信,3营销短信
-                Integer type=3;
-                String conn="[" + authParty + "]尊敬的会员,ROSS视频挑战赛报名通道已开启,点此进入www.caimei365.com/t/"+shortLink+" ROSS认证通,了解详情。【采美网提供技术支持】";
-                if(StringUtils.isNotEmpty(mobile)){
+                Integer type = 3;
+                String conn = "[" + authParty + "]尊敬的会员,ROSS视频挑战赛报名通道已开启,点此进入www.caimei365.com/t/" + shortLink + " ROSS认证通,了解详情。【采美网提供技术支持】";
+                if (StringUtils.isNotEmpty(mobile)) {
                     Boolean aBoolean = SmsUtils.sendSms(type, mobile, conn);
 //                    if(aBoolean){
 //                        log.info("挑战赛短信发送成功"+mobile);
@@ -276,6 +277,7 @@ public class AuthClubServiceImpl implements AuthClubService {
         clubMapper.insertShortLink(markId, shortLink, url);
         return shortLink;
     }
+
     @Override
     public ResponseJson deleteClubUser(Integer clubUserId) {
         clubMapper.deleteClubUser(clubUserId);
@@ -306,7 +308,7 @@ public class AuthClubServiceImpl implements AuthClubService {
         } else {
             shopName = shop.getShopName();
         }
-        String content = "("+ shopName +")您认证通登录密码为:rzt123456,请勿泄漏于他人。【采美网提供技术支持】";
+        String content = "(" + shopName + ")您认证通登录密码为:rzt123456,请勿泄漏于他人。【采美网提供技术支持】";
         Boolean sendSms = SmsUtils.sendSms(1, mobile, content);
         if (!sendSms) {
             log.info("机构用户重置密码发送失败,手机号:" + mobile);
@@ -322,13 +324,14 @@ public class AuthClubServiceImpl implements AuthClubService {
         List<WxClubListVo> starClubList = clubMapper.getWxStarClubList(authUserId);
         return ResponseJson.success(starClubList);
     }
+
     @Override
-    public ResponseJson saveBindAuth(Integer authId,String authParty,Integer authUserId,Integer clubUserId){
-        clubMapper.saveBindAuth(authId,authParty,authUserId,clubUserId);
+    public ResponseJson saveBindAuth(Integer authId, String authParty, Integer authUserId, Integer clubUserId) {
+        clubMapper.saveBindAuth(authId, authParty, authUserId, clubUserId);
         //1.7.7ross挑战赛新加逻辑:更新机构信息到挑战赛表
-        clubMapper.upAuthByid(clubUserId,authId);
+        clubMapper.upAuthByid(clubUserId, authId);
         //1.7.7ross挑战赛新加逻辑:更新机构信息到视频表
-        clubMapper.upVideoAuthByid(clubUserId,authId);
+        clubMapper.upVideoAuthByid(clubUserId, authId);
         return ResponseJson.success("绑定机构成功");
     }
 }

+ 56 - 47
src/main/java/com/caimei/service/auth/impl/AuthProductServiceImpl.java

@@ -149,13 +149,13 @@ public class AuthProductServiceImpl implements AuthProductService {
         String productImage = productSaveDto.getProductImage();
         String snCode = productSaveDto.getSnCode();
         String certificateImage = productSaveDto.getCertificateImage();
-        String authImageLogo=productSaveDto.getAuthImageLogo();
+        String authImageLogo = productSaveDto.getAuthImageLogo();
         Integer certificateImageType = productSaveDto.getCertificateImageType();
         Integer createBy = productSaveDto.getCreateBy();
         String purchaseWay = productSaveDto.getPurchaseWay();
         String invoiceImage = productSaveDto.getInvoiceImage();
         Integer source = null == productSaveDto.getSource() ? 1 : productSaveDto.getSource();
-        List<String> snList=productSaveDto.getSnList();
+        List<String> snList = productSaveDto.getSnList();
         List<ProductParamPo> paramList = productSaveDto.getParamList();
         if (null == authId) {
             return ResponseJson.error("参数异常,请输入授权id", null);
@@ -207,7 +207,7 @@ public class AuthProductServiceImpl implements AuthProductService {
                 if (null != productIdBySnCode) {
                     return ResponseJson.error("该商品SN码已存在,请重新输入", null);
                 }
-            } else if (2 == authType){
+            } else if (2 == authType) {
                 // 关联设备
                 productId = productIdBySnCode;
                 // 检测机构是否已关联该设备
@@ -216,7 +216,7 @@ public class AuthProductServiceImpl implements AuthProductService {
                     return ResponseJson.error("不能重复关联同一台设备");
                 }
             }
-        }else {
+        } else {
             // 编辑
             dbRelation = authProductMapper.getProductRelation(relationId, null, null);
             dbProduct = authProductMapper.getProductFormData(relationId);
@@ -229,7 +229,7 @@ public class AuthProductServiceImpl implements AuthProductService {
                     if (null != productIdBySnCode && !productIdBySnCode.equals(productId)) {
                         return ResponseJson.error("该商品SN码已存在,请重新输入", null);
                     }
-                } else if (2 == authType){
+                } else if (2 == authType) {
                     productId = productIdBySnCode;
                     // 检测机构是否已关联该设备
                     ProductRelationVo productRelation = authProductMapper.getProductRelation(null, productId, authId);
@@ -237,7 +237,7 @@ public class AuthProductServiceImpl implements AuthProductService {
                         return ResponseJson.error("不能重复关联同一台设备");
                     }
                 }
-            } else if (2 == dbRelation.getAuthType()){
+            } else if (2 == dbRelation.getAuthType()) {
                 // 原本为关联设备
                 if (1 == authType) {
                     // 设备id为null
@@ -277,14 +277,14 @@ public class AuthProductServiceImpl implements AuthProductService {
         product.setCertificateImageType(certificateImageType);
         product.setAuthImageLogo(authImageLogo);
         String authDate = productSaveDto.getAuthDate();
-        product.setAuthDate(null!=authDate&&""!=authDate?authDate:null);
+        product.setAuthDate(null != authDate && "" != authDate ? authDate : null);
         // 购买渠道
         product.setPurchaseWay(purchaseWay);
         // 发票图片
         product.setInvoiceImage(invoiceImage);
         // 供应商保存,直接上线;机构保存,需要供应商审核通过后才上线
         if (1 == authType) {
-            product.setShopAuditStatus(1 ==   source ? 1 : 2);
+            product.setShopAuditStatus(1 == source ? 1 : 2);
             if (null != dbProduct && 1 != dbProduct.getAuditStatus()) {
                 // 被驳回的数据,编辑变为待审核状态
                 product.setStatus(2);
@@ -318,9 +318,9 @@ public class AuthProductServiceImpl implements AuthProductService {
                 authProductMapper.updateProductByProductId(product);
             }
             // 插入机构设备关联关系
-             authProductMapper.insertProductRelation(authId, product.getProductId(), authType);
+            authProductMapper.insertProductRelation(authId, product.getProductId(), authType);
             //查询最新关联id
-            relationId=authProductMapper.getNewestRelationId();
+            relationId = authProductMapper.getNewestRelationId();
         } else {
             if (1 == dbRelation.getAuthType()) {
                 // 更新设备
@@ -381,37 +381,38 @@ public class AuthProductServiceImpl implements AuthProductService {
         }
         return ResponseJson.success("保存授权商品成功");
     }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public  ResponseJson saveProductAndRelaTion(Integer authId,List<String> snlist,Integer authType) throws IOException{
+    public ResponseJson saveProductAndRelaTion(Integer authId, List<String> snlist, Integer authType) throws IOException {
         //判断机构关联id是否有值(有则机构关联关联了其他机构属于新增操作,无则属于编辑操作)
         String relaId = authProductMapper.getRelationId(authId);
-        List<Integer>  listSnId=new ArrayList<>();
-        if(null!=relaId&&!"".equals(relaId)){
+        List<Integer> listSnId = new ArrayList<>();
+        if (null != relaId && !"".equals(relaId)) {
             //根据sn码获取产品id
-            for(int i=0;i<snlist.size();i++){
+            for (int i = 0; i < snlist.size(); i++) {
                 List<ProductPo> List = authProductMapper.getSnList(snlist.get(i));
                 //判断本身机构下的设备和关联机构下 设备有不有重复的
-                if(List.get(0).getAuthId()!=authId){
+                if (List.get(0).getAuthId() != authId) {
                     listSnId.add(List.get(0).getProductId());
                 }
             }
             //根据产品id插入机构设备关联关系
-            for(int i=0;i<snlist.size();i++){
+            for (int i = 0; i < snlist.size(); i++) {
                 authProductMapper.insertProductRelation(authId, listSnId.get(i), authType);
             }
             return ResponseJson.success("保存授权商品成功");
-        }else{
+        } else {
             //根据sn码获取产品id
-            for(int i=0;i<snlist.size();i++){
+            for (int i = 0; i < snlist.size(); i++) {
                 List<ProductPo> List = authProductMapper.getSnList(snlist.get(i));
                 //判断本身机构下的设备和关联机构下 设备有不有重复的
-                if(List.get(0).getAuthId()!=authId){
+                if (List.get(0).getAuthId() != authId) {
                     listSnId.add(List.get(0).getProductId());
                 }
             }
             //根据产品id插入机构设备关联关系
-            for(int i=0;i<snlist.size();i++){
+            for (int i = 0; i < snlist.size(); i++) {
                 authProductMapper.insertProductRelation(authId, listSnId.get(i), authType);
             }
             return ResponseJson.success("保存授权商品成功");
@@ -444,6 +445,7 @@ public class AuthProductServiceImpl implements AuthProductService {
         }
         return null;
     }
+
     public String generateAuthImageLogo(TemplateVo authTemplate, ProductFormVo product) {
         if (null != authTemplate) {
             // 根据模板id设置相关数据
@@ -471,7 +473,7 @@ public class AuthProductServiceImpl implements AuthProductService {
         return null;
     }
 
-    private Map<String,Object> getTemplateInfo(TemplateVo template, ProductFormVo product) {
+    private Map<String, Object> getTemplateInfo(TemplateVo template, ProductFormVo product) {
         HashMap<String, Object> map = new HashMap<>();
         Integer templateId = template.getTemplateId();
         if (1 == templateId) {
@@ -519,7 +521,7 @@ public class AuthProductServiceImpl implements AuthProductService {
             // 添加二维码信息
             if (StringUtils.isNotEmpty(template.getQrPosition())) {
 //                String qrCodeLink = wwwServer + "/product/auth/product-" + product.getProductId() + ".html";
-                String qrCodeLink = zpapiServer + "/"+product.getCreateBy()+"/"+product.getPrefix()+"/approve/device/detail?id=" + product.getProductId() ;
+                String qrCodeLink = zpapiServer + "/" + product.getCreateBy() + "/" + product.getPrefix() + "/approve/device/detail?id=" + product.getProductId();
                 map.put("addQr1_link", qrCodeLink);
                 map.put("addQr1_size", template.getQrSize());
                 String[] split = template.getQrPosition().split(",");
@@ -532,7 +534,7 @@ public class AuthProductServiceImpl implements AuthProductService {
         return map;
     }
 
-    private Map<String,Object> getTemplateLogoInfo(TemplateVo template, ProductFormVo product) {
+    private Map<String, Object> getTemplateLogoInfo(TemplateVo template, ProductFormVo product) {
         HashMap<String, Object> map = new HashMap<>();
         Integer templateId = template.getTemplateId();
         if (1 == templateId) {
@@ -596,7 +598,7 @@ public class AuthProductServiceImpl implements AuthProductService {
         return map;
     }
 
-    private String addWaterMark(String image,Integer type) throws IOException {
+    private String addWaterMark(String image, Integer type) throws IOException {
         //type:1pc,2applets
         ClassPathResource classPathResource = new ClassPathResource("/images/newPcWaterMark.png");
         InputStream inputStreamImg = classPathResource.getInputStream();
@@ -645,8 +647,8 @@ public class AuthProductServiceImpl implements AuthProductService {
             paramList = authProductMapper.getParamsByProductId(productForm.getProductId());
         }
         productForm.setParamList(paramList);
-        if(null!=productForm.getAuthDates()){
-            SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
+        if (null != productForm.getAuthDates()) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
             String authDate = simpleDateFormat.format(productForm.getAuthDates());
             productForm.setAuthDate(authDate);
         }
@@ -661,7 +663,7 @@ public class AuthProductServiceImpl implements AuthProductService {
     @Override
     public ResponseJson updateAllWaterMark() {
         List<ProductPo> productList = authProductMapper.getAllImage();
-        productList.forEach(product->{
+        productList.forEach(product -> {
             try {
                 if (StringUtils.isNotEmpty(product.getImage())) {
                     //商品图片添加水印
@@ -775,7 +777,7 @@ public class AuthProductServiceImpl implements AuthProductService {
         }
         PageHelper.startPage(pageNum, pageSize);
         List<WxProductListVo> productList = authProductMapper.getWxProductList(listType, authId, authParty, productTypeId, snCode);
-        productList.forEach(product->{
+        productList.forEach(product -> {
             List<WxClubListVo> clubList = authProductMapper.getProductClubList(product.getProductId());
             product.setClubList(clubList);
         });
@@ -784,16 +786,23 @@ public class AuthProductServiceImpl implements AuthProductService {
     }
 
     @Override
-    public ResponseJson<AuthProductVo> getAuthProductDetails(Integer productId) {
-        AuthProductVo authProduct = authProductMapper.getAuthProductByProductId(productId);
+    public ResponseJson<AuthProductVo> getAuthProductDetails(String productId) {
+        Integer pid = 0;
+        if (productId.startsWith("HC")) {
+            String substring = productId.substring(2);
+            pid = authProductMapper.findProductByQr(substring);
+        }else{
+            pid = Integer.valueOf(productId);
+        }
+        AuthProductVo authProduct = authProductMapper.getAuthProductByProductId(pid);
         if (null == authProduct) {
             return ResponseJson.error("商品不存在", null);
         }
-        authProduct.setClubList(authProductMapper.getProductClubList(productId));
+        authProduct.setClubList(authProductMapper.getProductClubList(pid));
         // 商品参数
-        authProduct.setParamList(authProductMapper.getAuthProductParams(productId));
+        authProduct.setParamList(authProductMapper.getAuthProductParams(pid));
         // 增加扫码次数
-        authProductMapper.addScanCount(productId);
+        authProductMapper.addScanCount(pid);
         return ResponseJson.success(authProduct);
     }
 
@@ -838,8 +847,8 @@ public class AuthProductServiceImpl implements AuthProductService {
             // 创建时间
             productType.setCreateTime(new Date());
             // 设备分类图片添加水印
-            productType.setPcImage(addWaterMark(productType.getImage(),1));
-            productType.setAppletsImage(addWaterMark(productType.getImage(),2));
+            productType.setPcImage(addWaterMark(productType.getImage(), 1));
+            productType.setAppletsImage(addWaterMark(productType.getImage(), 2));
             // 插入设备分类
             authProductMapper.insertProductType(productType);
         } else {
@@ -897,16 +906,16 @@ public class AuthProductServiceImpl implements AuthProductService {
         List<ProductTypeListVo> productList = authProductMapper.getProductTypeList(listType, authUserId, name, status, auditStatus);
         //如果是手机号则进行脱敏处理
         //手机号脱敏处理(脱敏规则: 保留前三后四, 比如15638296218置换为156****6218)
-        if(null!=productList&&productList.size()>0){
+        if (null != productList && productList.size() > 0) {
             productList.forEach(authVo -> {
                 //判断是否是手机号
-                String phoneNumber=authVo.getCreateBy();
-                if(StringUtils.isNotEmpty(phoneNumber)){
+                String phoneNumber = authVo.getCreateBy();
+                if (StringUtils.isNotEmpty(phoneNumber)) {
 //                    boolean matches = phoneNumber.matches("^[1][3,4,5,7,8,9][0-9]{9}$");
 //                    if(matches){
-                        //脱敏处理
-                            phoneNumber = phoneNumber.replaceAll("(\\w{3})\\w*(\\w{4})", "$1****$2");
-                            authVo.setCreateBy(phoneNumber);
+                    //脱敏处理
+                    phoneNumber = phoneNumber.replaceAll("(\\w{3})\\w*(\\w{4})", "$1****$2");
+                    authVo.setCreateBy(phoneNumber);
 //                    }
                 }
             });
@@ -959,7 +968,7 @@ public class AuthProductServiceImpl implements AuthProductService {
 
     @Override
     public ResponseJson<ProductFormVo> getProductInfo(Integer productId, String snCode) {
-        ProductFormVo product =  authProductMapper.getProductInfo(productId, snCode);
+        ProductFormVo product = authProductMapper.getProductInfo(productId, snCode);
         if (null == product) {
             return ResponseJson.error(-1, "设备SN码不存在", null);
         }
@@ -976,7 +985,7 @@ public class AuthProductServiceImpl implements AuthProductService {
     public ResponseJson<List<ProductListVo>> getSnCodeList(Integer authUserId, Integer authId, Integer downStatus, String productName, String sncode, String authParty) {
         List<ProductListVo> snCodeList = new ArrayList<>();
         List<Integer> liallSn = authProductMapper.getAllSn(authId);
-        List<String> allSnlist =liallSn.size()==0?null: authProductMapper.getAllSnlist(liallSn);
+        List<String> allSnlist = liallSn.size() == 0 ? null : authProductMapper.getAllSnlist(liallSn);
         //判断机构筛选下拉框 0全部,1与其他机构关联
         if (1 == downStatus) {
             //判断该机构是否与其他机构关联
@@ -985,11 +994,11 @@ public class AuthProductServiceImpl implements AuthProductService {
             if (!"".equals(relationId) && null != relationId) {
                 relationIdList = relationId.split(",");
                 //获取该机构下relationIdList的sn码
-                snCodeList = authProductMapper.getSnCodeList(authUserId, authId, relationIdList, allSnlist,  productName,  sncode,  authParty);
+                snCodeList = authProductMapper.getSnCodeList(authUserId, authId, relationIdList, allSnlist, productName, sncode, authParty);
             }
-        }else {
+        } else {
             //获取该机构下所有的sn码
-            snCodeList = authProductMapper.getSnCodeList(authUserId, authId, null, allSnlist,  productName,  sncode,  authParty);
+            snCodeList = authProductMapper.getSnCodeList(authUserId, authId, null, allSnlist, productName, sncode, authParty);
         }
 
         return ResponseJson.success(snCodeList);
@@ -1002,7 +1011,7 @@ public class AuthProductServiceImpl implements AuthProductService {
         return ResponseJson.success();
     }
 
-    public ResponseJson<List<ProductListVo>> getPronductInfo( Integer authId,Integer authUserId){
+    public ResponseJson<List<ProductListVo>> getPronductInfo(Integer authId, Integer authUserId) {
         List<ProductListVo> pronductInfo = authProductMapper.getPronductInfo(authId, authUserId);
         return ResponseJson.success(pronductInfo);
     }

File diff suppressed because it is too large
+ 284 - 261
src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java


+ 260 - 114
src/main/resources/mapper/AuthMapper.xml

@@ -62,8 +62,8 @@
     </update>
     <update id="updateRelaByAuthId">
         update cm_brand_auth
-        set relationId          = #{relationId},
-            relationName        = #{relationName}
+        set relationId   = #{relationId},
+            relationName = #{relationName}
         where id = #{authId}
     </update>
     <update id="updateAuthAuditStatus">
@@ -76,7 +76,9 @@
         where id = #{authId}
     </update>
     <select id="getRelationInfo" resultType="com.caimei.model.po.CmBrandAuthPo">
-        select relationId,relationName  from cm_brand_auth where id=#{id}
+        select relationId, relationName
+        from cm_brand_auth
+        where id = #{id}
     </select>
     <update id="deleteAuthByAuthId">
         update cm_brand_auth
@@ -145,9 +147,11 @@
         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 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,
@@ -243,7 +247,8 @@
     </select>
 
     <select id="getAuthListAll" resultType="com.caimei.model.vo.AuthVo">
-        select DISTINCT a.id as authId, a.authUserId, authParty, cbcu2.mobile, a.status, a.auditStatus, a.shopAuditStatus,
+        select DISTINCT a.id as authId, a.authUserId, authParty, cbcu2.mobile, a.status, a.auditStatus,
+        a.shopAuditStatus,
         a.createTime,
         if(a.createSource = 1,ifnull(cu.loginAccount, cu.name),cbcu1.mobile) as createBy,ifnull(au.loginAccount,au.name)
         as auditBy,a.auditTime,a.invalidReason,
@@ -416,19 +421,22 @@
         select provinceID
         from province
         where name like
-              concat(#{provinceName}, '%') limit 1;
+              concat(#{provinceName}, '%')
+        limit 1;
     </select>
     <select id="getCityId" resultType="java.lang.Integer">
         select cityID
         from city
         where name like
-              concat(#{cityName}, '%') limit 1;
+              concat(#{cityName}, '%')
+        limit 1;
     </select>
     <select id="getTownId" resultType="java.lang.Integer">
         select townID
         from town
         where name like
-              concat(#{townName}, '%') limit 1;
+              concat(#{townName}, '%')
+        limit 1;
     </select>
     <select id="getLdmLatestClubId" resultType="java.lang.Integer">
         select ldmClubId
@@ -444,19 +452,22 @@
         select name
         from nissan_base_region1
         where code = #{regId1}
-          and level = 0 limit 1
+          and level = 0
+        limit 1
     </select>
     <select id="getCityName" resultType="java.lang.String">
         select name
         from nissan_base_region1
         where code = #{regId1}
-          and level = 1 limit 1
+          and level = 1
+        limit 1
     </select>
     <select id="getTownName" resultType="java.lang.String">
         select name
         from nissan_base_region1
         where code = #{regId1}
-          and level = 2 limit 1
+          and level = 2
+        limit 1
     </select>
     <select id="getTownList" resultType="com.caimei.model.po.TownPo">
         select townID as townId, cityID as cityId
@@ -586,7 +597,8 @@
     <select id="getAdminUserId" resultType="java.lang.Integer">
         select authUserId
         from cm_brand_auth_user
-        where userIdentity = 1 limit 1
+        where userIdentity = 1
+        limit 1
     </select>
     <select id="getAuthTemplate" resultType="com.caimei.model.vo.TemplateVo">
         select at.id as templateId, templateImage, qrPosition, qrSize
@@ -629,17 +641,16 @@
     </select>
 
     <select id="getClubBindAuth" resultType="com.caimei.model.vo.AuthFormVo">
-        select au.id as authId,au.authParty
+        select au.id as authId, au.authParty
         from cm_brand_auth au
-        where au.id not in (
-            select cu.authId
-
-            from cm_brand_auth a
-                     left join cm_brand_club_user cu on cu.authId = a.id
-            where cu.authUserId = #{authUserId}
-              and cu.delFlag = 0
-              and (a.id is null || a.delFlag = 0))
-          and au.delFlag = 0 and au.authUserId = #{authUserId}
+        where au.id not in (select cu.authId
+                            from cm_brand_auth a
+                                     left join cm_brand_club_user cu on cu.authId = a.id
+                            where cu.authUserId = #{authUserId}
+                              and cu.delFlag = 0
+                              and (a.id is null || a.delFlag = 0))
+          and au.delFlag = 0
+          and au.authUserId = #{authUserId}
     </select>
 
 
@@ -647,20 +658,22 @@
         select DISTINCT r.authId as relationId
         from cm_brand_product_relation r
                  LEFT JOIN cm_brand_auth_product a on r.productId = a.id
-        where snCode =#{snCode}
+        where snCode = #{snCode}
     </select>
     <select id="getPrefix" resultType="java.lang.String">
-        select ifnull(prefix,'app')
+        select ifnull(prefix, 'app')
         from cm_brand_auth_user
         where authUserId = #{authUserId}
     </select>
     <insert id="saveVideoInfo">
-        insert into cm_challenge_round(userName,title,ossName,ossUrl,cover,releaseTime,authId,authUserId)
-        values(#{userName},#{title},#{ossName},#{ossUrl},#{cover},#{releaseTime},#{authId},#{authUserId})
+        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 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
@@ -675,128 +688,149 @@
     <select id="checkActivityTime" resultType="java.lang.Integer">
         select id
         from cm_challenge_activity
-        where startTime  &lt;#{releaseTime}  and  endTime &gt;#{releaseTime} and status=1
+        where startTime &lt; #{releaseTime}
+          and endTime &gt; #{releaseTime}
+          and status = 1
     </select>
     <select id="getPublishedVideoList" resultType="com.caimei.model.vo.ChallengeRoundVo">
-        select cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId,cr.authId,cba.authParty,cr.dyCommand,cr.diggCount,cr.playCount
+        select
+        cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId,cr.authId,cba.authParty,cr.dyCommand,cr.diggCount,cr.playCount
         from cm_challenge_round cr
         left join cm_brand_auth cba on cr.authId=cba.id
         left join cm_challenge_activity cca on cca.authUserId=cr.authUserId
-               where cr.authUserId=#{authUserId}
+        where cr.authUserId=#{authUserId}
         <if test="clubUserName != null and clubUserName != ''">
             and (cr.userName like concat('%', #{clubUserName})
-            or  cba.authParty like concat('%', #{clubUserName},'%') )
+            or cba.authParty like concat('%', #{clubUserName},'%') )
         </if>
-       and  cr.releaseTime &gt;#{startTime} and  cr.releaseTime&lt;#{endTime}
+        and cr.releaseTime &gt;#{startTime} and cr.releaseTime&lt;#{endTime}
     </select>
     <select id="getPublishedVideoListNoRanking" resultType="com.caimei.model.vo.ChallengeRoundVo">
-        select cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId,cr.authId,cba.authParty,cr.dyCommand,cr.diggCount,cr.playCount
+        select
+        cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId,cr.authId,cba.authParty,cr.dyCommand,cr.diggCount,cr.playCount
         from cm_challenge_round cr
         left join cm_brand_auth cba on cr.authId=cba.id
         left join cm_challenge_activity cca on cca.authUserId=cr.authUserId
         where cr.authUserId=#{authUserId}
         <if test="clubUserName != null and clubUserName != ''">
             and (cr.userName like concat('%', #{clubUserName})
-            or  cba.authParty like concat('%', #{clubUserName},'%') )
+            or cba.authParty like concat('%', #{clubUserName},'%') )
         </if>
-        and  (cr.releaseTime &lt;#{startTime} or  cr.releaseTime &gt;#{endTime})
+        and (cr.releaseTime &lt;#{startTime} or cr.releaseTime &gt;#{endTime})
     </select>
     <select id="getPublishedVideo" resultType="com.caimei.model.vo.ChallengeRoundVo">
-        select cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId,cr.authId,cba.authParty,cr.dyCommand,cr.diggCount,cr.playCount
+        select
+        cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId,cr.authId,cba.authParty,cr.dyCommand,cr.diggCount,cr.playCount
         from cm_challenge_round cr
         left join cm_brand_auth cba on cr.authId=cba.id
         left join cm_challenge_activity cca on cca.authUserId=cr.authUserId
         where cr.authUserId=#{authUserId}
-        and  cr.releaseTime &gt;#{startTime} and  cr.releaseTime&lt;#{endTime}
+        and cr.releaseTime &gt;#{startTime} and cr.releaseTime&lt;#{endTime}
         <if test="mobile != null and mobile != ''">
             and cr.userName like concat('%', #{mobile})
         </if>
         <if test="authParty != null and authParty != ''">
-            and  cba.authParty like concat('%', #{authParty},'%')
+            and cba.authParty like concat('%', #{authParty},'%')
         </if>
         <if test="status != null">
             and cr.status = #{status}
         </if>
     </select>
     <select id="getPublishedVideoNoRanking" resultType="com.caimei.model.vo.ChallengeRoundVo">
-        select cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId,cr.authId,cba.authParty,cr.dyCommand,cr.diggCount,cr.playCount
+        select
+        cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId,cr.authId,cba.authParty,cr.dyCommand,cr.diggCount,cr.playCount
         from cm_challenge_round cr
         left join cm_brand_auth cba on cr.authId=cba.id
         left join cm_challenge_activity cca on cca.authUserId=cr.authUserId
         where cr.authUserId=#{authUserId}
-        and  (cr.releaseTime &lt;#{startTime} or  cr.releaseTime &gt;#{endTime})
+        and (cr.releaseTime &lt;#{startTime} or cr.releaseTime &gt;#{endTime})
         <if test="mobile != null and mobile != ''">
             and cr.userName like concat('%', #{mobile})
         </if>
         <if test="authParty != null and authParty != ''">
-            and  cba.authParty like concat('%', #{authParty},'%')
+            and cba.authParty like concat('%', #{authParty},'%')
         </if>
         <if test="status != null">
             and cr.status = #{status}
         </if>
     </select>
     <select id="checkActivityId" resultType="com.caimei.model.vo.ChallengeActivityVo">
-        select id,authUserId
+        select id, authUserId
         from cm_challenge_activity
     </select>
     <insert id="saveActivityInfo">
-            insert into cm_challenge_activity(startTime,endTime,status,authUserId)
-            values(#{startTime},#{endTime},#{status},#{authUserId})
+        insert into cm_challenge_activity(startTime, endTime, status, authUserId)
+        values (#{startTime}, #{endTime}, #{status}, #{authUserId})
     </insert>
     <update id="upActivityInfo">
-        update cm_challenge_activity set
-            startTime=#{startTime},
+        update cm_challenge_activity
+        set startTime=#{startTime},
             endTime=#{endTime},
-            status = #{status}
-        where authUserId=#{authUserId}
+            status   = #{status}
+        where authUserId = #{authUserId}
     </update>
     <select id="getActivityTime" resultType="com.caimei.model.vo.ChallengeActivityVo">
-        select id,startTime,endTime,status,authUserId
+        select id, startTime, endTime, status, authUserId
         from cm_challenge_activity
-        where authUserId=#{authUserId}
+        where authUserId = #{authUserId}
     </select>
     <update id="savaShareIdByAuthId">
-        update cm_challenge_round set
-            shareId=#{shareId}
-        where authId=#{authId}
+        update cm_challenge_round
+        set shareId=#{shareId}
+        where authId = #{authId}
     </update>
     <select id="getShareId" resultType="java.lang.String">
         select shareId
         from cm_challenge_round
-        where shareId=#{shareId}
+        where shareId = #{shareId}
     </select>
     <update id="savaItemIdByShareId">
-        update cm_challenge_round set
-            itemId=#{itemId},
+        update cm_challenge_round
+        set itemId=#{itemId},
             status=1
-        where shareId=#{shareId}
+        where shareId = #{shareId}
     </update>
     <select id="getAuthUserName" resultType="java.lang.String">
         select name
         from cm_brand_auth cba
-        left join cm_brand_auth_user cu on cu.authUserId=cba.authUserId
-        where cba.id=#{authId}
+                 left join cm_brand_auth_user cu on cu.authUserId = cba.authUserId
+        where cba.id = #{authId}
     </select>
     <select id="getMobileByAuthId" resultType="java.lang.String">
         select userName
         from cm_challenge_round cr
-        where cr.authId=#{authId}
+        where cr.authId = #{authId}
     </select>
     <update id="savaDyCommand">
-        update cm_challenge_round set
-            dyCommand=#{content}
-        where authId=#{authId}
+        update cm_challenge_round
+        set dyCommand=#{content}
+        where authId = #{authId}
     </update>
     <select id="getAuthPartylist" resultType="com.caimei.model.vo.ChallengeRoundVo">
-        select cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId, cr.authId,cba.authParty,cr.dyCommand,cr.diggCount,cr.playCount
-        from cm_challenge_round cr left join cm_brand_auth cba
-        on cr.authId=cba.id
-        where cr.authUserId=#{authUserId}
+        select cr.id,
+               cr.userName,
+               cr.itemId,
+               cr.title,
+               cr.ossName,
+               cr.ossUrl,
+               cr.cover,
+               cr.releaseTime,
+               cr.status,
+               cr.shareId,
+               cr.authId,
+               cba.authParty,
+               cr.dyCommand,
+               cr.diggCount,
+               cr.playCount
+        from cm_challenge_round cr
+                 left join cm_brand_auth cba
+                           on cr.authId = cba.id
+        where cr.authUserId = #{authUserId}
     </select>
     <select id="getOssNameId" resultType="java.lang.String">
         select ossName
         from cm_challenge_round cr
-        where cr.id=#{videoID}
+        where cr.id = #{videoID}
     </select>
     <delete id="deleteVideoById">
         delete
@@ -804,52 +838,96 @@
         where id = #{videoID}
     </delete>
     <select id="getChallengeRoundInfo" resultType="com.caimei.model.vo.ChallengeRoundVo">
-        select cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId, cr.authId,cr.dyCommand,cr.diggCount,cr.playCount
+        select cr.id,
+               cr.userName,
+               cr.itemId,
+               cr.title,
+               cr.ossName,
+               cr.ossUrl,
+               cr.cover,
+               cr.releaseTime,
+               cr.status,
+               cr.shareId,
+               cr.authId,
+               cr.dyCommand,
+               cr.diggCount,
+               cr.playCount
         from cm_challenge_round cr
-        where cr.id=#{videoID}
+        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}
+        where cr.id = #{videoID}
     </select>
     <update id="upStatusById">
-        update cm_challenge_activity set
-            status = 0
-        where id=#{id}
+        update cm_challenge_activity
+        set status = 0
+        where id = #{id}
     </update>
     <select id="getReleaseTime" resultType="java.lang.String">
         select releaseTime
         from cm_challenge_round cr
-        where cr.userName=#{userName}
+        where cr.userName = #{userName}
     </select>
     <select id="getRoundlist" resultType="com.caimei.model.vo.ChallengeRoundVo">
-        select cr.id,cr.userName,cr.authUserId,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId, cr.authId,cr.dyCommand,cr.diggCount,cr.playCount
+        select cr.id,
+               cr.userName,
+               cr.authUserId,
+               cr.itemId,
+               cr.title,
+               cr.ossName,
+               cr.ossUrl,
+               cr.cover,
+               cr.releaseTime,
+               cr.status,
+               cr.shareId,
+               cr.authId,
+               cr.dyCommand,
+               cr.diggCount,
+               cr.playCount
         from cm_challenge_round cr
     </select>
     <update id="upVidoInfoById">
-        update cm_challenge_round set
-            diggCount=#{diggCount},
+        update cm_challenge_round
+        set diggCount=#{diggCount},
             playCount=#{playCount}
-        where id=#{videoId}
+        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 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>
+    <insert id="insertQrCode" parameterType="com.caimei.model.po.AuthQrcodePo" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO cm_brand_auth_qrcode(authUserId, productTypeId, addtime)
+        VALUES (#{authUserId}, #{productTypeId}, now())
     </insert>
     <select id="getClubUserId" resultType="java.lang.Integer">
-        select id from cm_brand_club_user where mobile=#{mobile}
+        select id
+        from cm_brand_club_user
+        where mobile = #{mobile}
         order by addTime desc
     </select>
     <select id="getInfoByUserName" resultType="com.caimei.model.vo.RossChallengeRoundVo">
-        select * from cm_ross_challenge_round where userName=#{userName} and contestStatus=1
+        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 *
+        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 *
+        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
@@ -858,35 +936,52 @@
         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},'%') )
+            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 *
+        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
+        select *
+        from cm_ross_challenge_video
         where userName = #{mobile}
-          and releaseTime &gt; #{startTime} and releaseTime &lt; #{endTime}
+          and releaseTime &gt; #{startTime}
+          and releaseTime &lt; #{endTime}
     </select>
     <update id="upVideoDiggCount">
         update cm_ross_challenge_video
-            <set>
-                clubUserIds=#{clubUserIds}
+        <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>
+        </set>
         where id=#{videoId}
     </update>
+    <update id="updateQrCodes">
+        UPDATE cm_brand_auth_qrcode
+        SET qrCodeId = concat('HC', id)
+        WHERE id in
+        <foreach item="code" collection="qrcodePos" open="(" separator="," close=")">
+            #{code.id}
+        </foreach>
+    </update>
+    <update id="concatQrcode">
+        update cm_brand_auth_qrcode
+        set authId      = #{authId},
+            unionStatus = 1
+        where id = #{id}
+    </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
@@ -895,44 +990,95 @@
             and cr.contestTime &gt; #{StartTime} and cr.contestTime &lt; #{endTime}
         </if>
         <if test="null!=mobile and mobile !=''">
-            and  cr.userName like concat('%', #{mobile})
+            and cr.userName like concat('%', #{mobile})
         </if>
         <if test="null!=authenticationStatus">
-            and  cr.authenticationStatus=#{authenticationStatus}
+            and cr.authenticationStatus=#{authenticationStatus}
         </if>
         order by contestTime desc
     </select>
     <delete id="delAuthInfoById">
-        delete from cm_ross_challenge_round where id=#{id}
+        delete
+        from cm_ross_challenge_round
+        where id = #{id}
     </delete>
     <delete id="delVideoInfoById">
-        delete from cm_ross_challenge_video where id=#{id}
+        delete
+        from cm_ross_challenge_video
+        where id = #{id}
     </delete>
     <delete id="delVideoInfoByUserName">
-        delete from cm_ross_challenge_video where userName=#{mobile}
+        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 *
+        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 *
+        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 name
+        from cm_brand_auth_user
+        where authUserId = #{authUserId}
     </select>
     <select id="getclubuserInfo" resultType="com.caimei.model.vo.ClubUserVo">
         select cu.name,cu.mobile,cu.addTime,
-            (case
-                 when cu.name is null then '未认证'
-                 when cu.name is not null then '已认证' end
-            ) as authenticationStatus,
-               cu.status
+        (case
+        when cu.name is null then '未认证'
+        when cu.name is not null then '已认证' end
+        ) as authenticationStatus,
+        cu.status
         from cm_brand_club_user cu
         LEFT JOIN cm_brand_auth a ON cu.authId = a.id
         where a.authUserId=#{authUserId}
         <if test="clubUserIds != null and clubUserIds!=''">
-           and  find_in_set(cu.id,#{clubUserIds})
+            and find_in_set(cu.id,#{clubUserIds})
         </if>
         order by cu.addTime desc
     </select>
+    <select id="findQrCodes" resultType="com.caimei.model.po.AuthQrcodePo">
+        select cba.id,cba.authId,cba.authUserId,cba.qrCodeId,cba.addtime,cba.unionStatus,cbp.name as productName,cbu.authParty
+        from cm_brand_auth_qrcode cba
+        left join cm_brand_product_type cbp on cba.productTypeId = cbp.id
+        left join cm_brand_auth cbu on cbu.id = cba.authId
+        where cba.authUserId = #{authUserId} and cba.delFlag = 0
+        <if test="unionStatus != null and unionStatus!=''">
+            and cba.unionStatus = #{unionStatus}
+        </if>
+        <if test="productTypeId != null and productTypeId!=''">
+            and cba.productTypeId = #{productTypeId}
+        </if>
+    </select>
+    <select id="getConcatList" resultType="com.caimei.model.vo.AuthVo">
+        select a.id as authId,
+               a.authUserId,
+               a.authParty,
+               a.status,
+               a.auditStatus,
+               a.shopAuditStatus,
+               a.createTime,
+               a.authCode
+        from cm_brand_auth a
+        LEFT JOIN cm_brand_auth_qrcode cbq ON a.id = cbq.authId
+        where a.authUserId = #{authUserId}
+          and a.delFlag = 0
+          and a.shopAuditStatus = 1
+          AND cbq.authId IS NULL
+          and exists(select 1
+                     from cm_brand_auth_product cp
+                     left join cm_brand_product_relation cbr on cp.id = cbr.productId
+                     where cp.productTypeId = #{productTypeId}
+                       and cbr.authId = a.id)
+        <if test="authParty != null and authParty != ''">
+            and a.authParty like concat('%', #{authParty},'%')
+        </if>
+        order by a.createTime desc, a.id desc
+    </select>
 </mapper>

+ 8 - 0
src/main/resources/mapper/AuthProductMapper.xml

@@ -583,4 +583,12 @@
     <select id="getNewestRelationId" resultType="java.lang.Integer">
     select id from cm_brand_product_relation order by id desc limit 1
     </select>
+    <select id="findProductByQr" resultType="java.lang.Integer">
+        SELECT cap.id
+        FROM cm_brand_auth_product cap
+        LEFT JOIN cm_brand_product_relation cbr ON cap.id = cbr.productId
+        LEFT JOIN cm_brand_auth_qrcode cbq ON cbq.authId = cbr.authId
+        WHERE cbq.id = #{substring}
+        LIMIT 1
+    </select>
 </mapper>

Some files were not shown because too many files changed in this diff