zhijiezhao před 2 roky
rodič
revize
3812ecc61d

+ 5 - 1
src/main/java/com/caimei/controller/admin/auth/AuthTemplateApi.java

@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
 
 /**
  * 授权牌模板API
+ *
  * @author Aslee
  * @date 2022/7/6
  */
@@ -75,7 +76,7 @@ public class AuthTemplateApi {
             "status:状态:1启用,0停用;qrPosition:二维码位置;qrSize:二维码尺寸;" +
             "logoSize:logo尺寸;authFlag:1设置为机构授权牌模板;productFlag:1设置为设备授权牌模板")
     @PostMapping("/save")
-    public ResponseJson saveTemplate(@CurrentUser SysUser sysUser, @RequestBody String params){
+    public ResponseJson saveTemplate(@CurrentUser SysUser sysUser, @RequestBody String params) {
         if (null == sysUser) {
             return ResponseJson.error("用户信息异常", null);
         }
@@ -83,6 +84,9 @@ public class AuthTemplateApi {
         Integer userIdentity = sysUser.getUserIdentity();
         Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         JSONObject parseObject = JSONObject.parseObject(params);
+        if (1 == userIdentity && null == authUserId) {
+            authUserId = parseObject.getInteger("authUserId");
+        }
         Integer templateId = parseObject.getInteger("templateId");
         String templateImage = parseObject.getString("templateImage");
         Integer status = parseObject.getInteger("status");

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

@@ -126,4 +126,6 @@ public interface AuthMapper {
     List<AuthFormVo> getClubBindAuth(Integer authUserId);
 
     List<ProductFormVo> getRelationgList(String snCode);
- }
+
+    String getPrefix(Integer authUserId);
+}

+ 31 - 28
src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java

@@ -98,16 +98,18 @@ public class AuthServiceImpl implements AuthService {
         PageInfo<AuthVo> pageData = new PageInfo<>(authList);
         return ResponseJson.success(pageData);
     }
+
     @Override
     public 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) {
+                                                         String mobile, Integer status, Integer starFlag, Integer auditStatus,
+                                                         Integer lowerAuditStatus, Integer shopAuditStatus, Integer sendStatus, String name, String snCode, Integer pageNum, Integer pageSize) {
         listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
-        List<AuthVo> authList = authMapper.getAuthListAll(listType, authUserId, authParty, mobile, status, starFlag, auditStatus, lowerAuditStatus, shopAuditStatus, sendStatus,name,snCode);
+        List<AuthVo> authList = authMapper.getAuthListAll(listType, authUserId, authParty, mobile, status, starFlag, auditStatus, lowerAuditStatus, shopAuditStatus, sendStatus, name, snCode);
         PageInfo<AuthVo> pageData = new PageInfo<>(authList);
         return ResponseJson.success(pageData);
     }
+
     @Override
     public ResponseJson updateAuthStatus(Integer authId, Integer status) {
         if (null == authId) {
@@ -135,7 +137,7 @@ public class AuthServiceImpl implements AuthService {
         authMapper.deleteBanner(authId);
         // 删除商品及商品参数
         List<Integer> productIdList = authProductService.getProductIdsByAuthId(authId);
-        productIdList.forEach(productId->{
+        productIdList.forEach(productId -> {
             if (null != productId) {
                 authProductService.deleteProduct(productId);
             }
@@ -150,7 +152,7 @@ public class AuthServiceImpl implements AuthService {
         }
         AuthFormVo authFormVo = authMapper.getAuthFormById(authId);
         //该机构关联机构用集合形式返回便于前端赋值
-        if(null!=authFormVo.getRelationId()&&!"".equals(authFormVo.getRelationId())){
+        if (null != authFormVo.getRelationId() && !"".equals(authFormVo.getRelationId())) {
             String[] relationIdList = authFormVo.getRelationId().split(",");
             List<AuthFormVo> authIdList = authMapper.getAuthIdList(relationIdList);
             authFormVo.setReleationClubList(authIdList);
@@ -173,12 +175,12 @@ public class AuthServiceImpl implements AuthService {
     @Override
     public ResponseJson importLdmImage(Integer authUserId) {
         List<LdmDataPo> ldmClubData = ldmMapper.getLdmClubData(null, 0);
-        ldmClubData.forEach(ldmClub->{
+        ldmClubData.forEach(ldmClub -> {
             String pic2 = ldmClub.getPic2();
             String pic3 = ldmClub.getPic3();
             String pic4 = ldmClub.getPic4();
             List<AuthVo> authList = authMapper.getAuthByNameAndAddress(ldmClub.getAuthParty(), ldmClub.getAddress());
-            if (null != authList && authList.size() > 0 ) {
+            if (null != authList && authList.size() > 0) {
                 if (authList.size() > 1) {
                     log.info(">>>>>>>>>>>>>>>>>>>>>导入ldm门店图错误:对应门店过多,门店名称:" + ldmClub.getAuthParty());
                 } else {
@@ -208,8 +210,8 @@ public class AuthServiceImpl implements AuthService {
     }
 
     @Override
-    public ResponseJson starAuth(Integer authId, Integer starFlag,String starNum) {
-        authMapper.starAuth(authId, starFlag,starNum);
+    public ResponseJson starAuth(Integer authId, Integer starFlag, String starNum) {
+        authMapper.starAuth(authId, starFlag, starNum);
         return ResponseJson.success();
     }
 
@@ -260,7 +262,7 @@ public class AuthServiceImpl implements AuthService {
             if (2 == auth.getAuthImageType() && StringUtils.isEmpty(auth.getAuthImage())) {
                 return ResponseJson.error("授权牌不能为空");
             }
-        }else {
+        } else {
             // 机构添加默认模板库生成
             auth.setAuthImageType(1);
         }
@@ -327,7 +329,7 @@ public class AuthServiceImpl implements AuthService {
     }
 
     @Override
-    public String addWaterMark(String image,Integer type){
+    public String addWaterMark(String image, Integer type) {
         try {
             //type:1pc,2applets
             ClassPathResource classPathResource = new ClassPathResource("/images/newPcWaterMark.png");
@@ -382,7 +384,7 @@ public class AuthServiceImpl implements AuthService {
         return null;
     }
 
-    private Map<String,Object> getTemplateInfo(TemplateVo template, CmBrandAuthPo auth) {
+    private Map<String, Object> getTemplateInfo(TemplateVo template, CmBrandAuthPo auth) {
         HashMap<String, Object> map = new HashMap<>();
         Integer templateId = template.getTemplateId();
         if (1 == templateId) {
@@ -429,7 +431,7 @@ public class AuthServiceImpl implements AuthService {
             }
             // 添加二维码信息
             if (StringUtils.isNotEmpty(template.getQrPosition())) {
-                String qrCodeLink = zpServer + "/" + auth.getAuthUserId() + "/app/approve/club/detail?id=" + auth.getId();
+                String qrCodeLink = zpServer + "/" + auth.getAuthUserId() + "/" + authMapper.getPrefix(auth.getAuthUserId()) + "/approve/club/detail?id=" + auth.getId();
                 map.put("addQr1_link", qrCodeLink);
                 map.put("addQr1_size", template.getQrSize());
                 String[] split = template.getQrPosition().split(",");
@@ -476,7 +478,7 @@ public class AuthServiceImpl implements AuthService {
 
 
     @Override
-    @Transactional(rollbackFor=Exception.class)
+    @Transactional(rollbackFor = Exception.class)
     public ResponseJson importDataByExcel(MultipartFile file, Integer authUserId, Integer createBy) {
         String originalFilename = file.getOriginalFilename();
         String randomStr = UUID.randomUUID().toString();
@@ -707,38 +709,39 @@ public class AuthServiceImpl implements AuthService {
         }
         return ResponseJson.success("导入成功");
     }
+
     /**
      * 获取机构关联的机构信息
      * 1.7.4版本:
-     *
      */
     @Override
-    public ResponseJson<List<AuthFormVo>> getRelationgInfo(String  snCode,Integer authUserId){
+    public ResponseJson<List<AuthFormVo>> getRelationgInfo(String snCode, Integer authUserId) {
         //根据sn码获取关联这个产品的机构列表
         List<ProductFormVo> relationgList = authMapper.getRelationgList(snCode);
-        String  relationgInfo=null;
-        List<AuthFormVo> authIdList=null;
-        if(relationgList.size()>0){
-            for(int i=0;i<relationgList.size();i++){
-                if(null!=relationgInfo){
-                    relationgInfo+=",";
+        String relationgInfo = null;
+        List<AuthFormVo> authIdList = null;
+        if (relationgList.size() > 0) {
+            for (int i = 0; i < relationgList.size(); i++) {
+                if (null != relationgInfo) {
+                    relationgInfo += ",";
                 }
-                relationgInfo+=relationgList.get(i).getRelationId();
+                relationgInfo += relationgList.get(i).getRelationId();
             }
-            if(null!=relationgInfo){
+            if (null != relationgInfo) {
                 String[] relationIdList = relationgInfo.split(",");
                 authIdList = authMapper.getAuthIdList(relationIdList);
             }
         }
         return ResponseJson.success(authIdList);
     }
+
     /**
-     *  1.7.4版本
+     * 1.7.4版本
      * 获取可绑定机构机构信息
-     * **/
+     **/
     @Override
-    public ResponseJson<List<AuthFormVo>> getClubBindAuth(Integer authUserId){
+    public ResponseJson<List<AuthFormVo>> getClubBindAuth(Integer authUserId) {
         List<AuthFormVo> clubBindAuth = authMapper.getClubBindAuth(authUserId);
-        return  ResponseJson.success(clubBindAuth);
+        return ResponseJson.success(clubBindAuth);
     }
 }

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

@@ -629,5 +629,10 @@
                  LEFT JOIN cm_brand_auth_product a on r.productId = a.id
         where snCode =#{snCode}
     </select>
+    <select id="getPrefix" resultType="java.lang.String">
+        select ifnull(prefix,'app')
+        from cm_brand_auth_user
+        where authUserId = #{authUserId}
+    </select>
 
 </mapper>