Bläddra i källkod

ross认证通part3

Aslee 2 år sedan
förälder
incheckning
4788e82f55
61 ändrade filer med 1112 tillägg och 2175 borttagningar
  1. 6 3
      src/main/java/com/caimei/config/ApiConfig.java
  2. 6 0
      src/main/java/com/caimei/config/ApiInterceptor.java
  3. 61 5
      src/main/java/com/caimei/config/GlobalTokenAspect.java
  4. 3 2
      src/main/java/com/caimei/controller/admin/auth/AddressApi.java
  5. 11 32
      src/main/java/com/caimei/controller/admin/auth/AuthApi.java
  6. 3 7
      src/main/java/com/caimei/controller/admin/auth/AuthClubApi.java
  7. 3 2
      src/main/java/com/caimei/controller/admin/auth/AuthProductApi.java
  8. 1 3
      src/main/java/com/caimei/controller/admin/auth/DefaultApi.java
  9. 1 1
      src/main/java/com/caimei/controller/admin/auth/DoctorApi.java
  10. 3 3
      src/main/java/com/caimei/controller/admin/auth/DownloadApi.java
  11. 57 0
      src/main/java/com/caimei/controller/admin/auth/LogisticsApi.java
  12. 1 1
      src/main/java/com/caimei/controller/admin/auth/ShopApi.java
  13. 1 1
      src/main/java/com/caimei/controller/admin/auth/UploadApi.java
  14. 1 6
      src/main/java/com/caimei/controller/admin/auth/UserApi.java
  15. 1 1
      src/main/java/com/caimei/controller/admin/data/ArticleApi.java
  16. 1 1
      src/main/java/com/caimei/controller/admin/data/FileApi.java
  17. 1 1
      src/main/java/com/caimei/controller/admin/data/ImageApi.java
  18. 1 1
      src/main/java/com/caimei/controller/admin/data/VideoApi.java
  19. 1 3
      src/main/java/com/caimei/controller/admin/pay/PayApi.java
  20. 1 1
      src/main/java/com/caimei/controller/admin/sys/SysMenuApi.java
  21. 1 1
      src/main/java/com/caimei/controller/admin/sys/SysRoleApi.java
  22. 1 3
      src/main/java/com/caimei/controller/admin/sys/SysUserApi.java
  23. 1 2
      src/main/java/com/caimei/controller/admin/vip/VipApi.java
  24. 8 12
      src/main/java/com/caimei/controller/wechat/RegisterApi.java
  25. 88 11
      src/main/java/com/caimei/controller/wechat/WxAuthApi.java
  26. 100 0
      src/main/java/com/caimei/controller/wechat/WxUploadApi.java
  27. 6 6
      src/main/java/com/caimei/controller/wechat/WxUserApi.java
  28. 2 6
      src/main/java/com/caimei/mapper/cmMapper/AuthMapper.java
  29. 7 3
      src/main/java/com/caimei/mapper/cmMapper/AuthProductMapper.java
  30. 5 1
      src/main/java/com/caimei/mapper/cmMapper/ClubMapper.java
  31. 31 0
      src/main/java/com/caimei/mapper/cmMapper/LogisticsMapper.java
  32. 49 20
      src/main/java/com/caimei/model/dto/ProductSaveDto.java
  33. 6 1
      src/main/java/com/caimei/model/po/ProductPo.java
  34. 2 2
      src/main/java/com/caimei/model/vo/AuthFormVo.java
  35. 3 0
      src/main/java/com/caimei/model/vo/AuthVo.java
  36. 1 1
      src/main/java/com/caimei/model/vo/CertificateLogisticsVo.java
  37. 33 0
      src/main/java/com/caimei/model/vo/LogisticsCompanyVo.java
  38. 7 2
      src/main/java/com/caimei/model/vo/ProductFormVo.java
  39. 6 0
      src/main/java/com/caimei/model/vo/WxClubUserVo.java
  40. 1 1
      src/main/java/com/caimei/service/auth/AddressService.java
  41. 1 1
      src/main/java/com/caimei/service/auth/AuthClubService.java
  42. 6 3
      src/main/java/com/caimei/service/auth/AuthProductService.java
  43. 10 22
      src/main/java/com/caimei/service/auth/AuthService.java
  44. 39 0
      src/main/java/com/caimei/service/auth/LogisticsService.java
  45. 42 1752
      src/main/java/com/caimei/service/auth/impl/AddressServiceImpl.java
  46. 11 2
      src/main/java/com/caimei/service/auth/impl/AuthClubServiceImpl.java
  47. 138 86
      src/main/java/com/caimei/service/auth/impl/AuthProductServiceImpl.java
  48. 9 44
      src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java
  49. 4 2
      src/main/java/com/caimei/service/auth/impl/DownloadServiceImpl.java
  50. 108 0
      src/main/java/com/caimei/service/auth/impl/LogisticsServiceImpl.java
  51. 1 1
      src/main/java/com/caimei/service/wechat/RegisterService.java
  52. 1 1
      src/main/java/com/caimei/service/wechat/WxUserService.java
  53. 2 1
      src/main/java/com/caimei/service/wechat/impl/LoginServiceImpl.java
  54. 40 19
      src/main/java/com/caimei/service/wechat/impl/RegisterServiceImpl.java
  55. 13 19
      src/main/java/com/caimei/service/wechat/impl/WxUserServiceImpl.java
  56. 1 1
      src/main/resources/config/dev/application-dev.yml
  57. 46 40
      src/main/resources/mapper/AuthMapper.xml
  58. 73 26
      src/main/resources/mapper/AuthProductMapper.xml
  59. 17 7
      src/main/resources/mapper/ClubMapper.xml
  60. 26 0
      src/main/resources/mapper/LogisticsMapper.xml
  61. 2 2
      src/main/resources/mapper/ShopMapper.xml

+ 6 - 3
src/main/java/com/caimei/config/ApiConfig.java

@@ -31,11 +31,14 @@ public class ApiConfig implements WebMvcConfigurer {
 //                .addPathPatterns("/upload/**")
                 .addPathPatterns("/user/update/password")
                 .addPathPatterns("/data/**")
+                .addPathPatterns("/sys/**")
+                .addPathPatterns("/vip/**")
                 .excludePathPatterns("/auth/export/excel");
         registry.addInterceptor(wxApiInterceptor)
                 .addPathPatterns("/wx/data/**")
-                .addPathPatterns("/wx/user/token/check")
-                .addPathPatterns("/wx/user/password/update")
-                .excludePathPatterns("/wx/data/feedback/submit");
+                .addPathPatterns("/wx/auth/product/form/data")
+                .addPathPatterns("/wx/auth/form/data")
+                .addPathPatterns("/wx/auth/product/save")
+                .addPathPatterns("/wx/user/token/check");
     }
 }

+ 6 - 0
src/main/java/com/caimei/config/ApiInterceptor.java

@@ -1,12 +1,15 @@
 package com.caimei.config;
 
 import com.caimei.components.RedisService;
+import com.caimei.mapper.cmMapper.ClubMapper;
+import com.caimei.model.vo.WxClubUserVo;
 import com.caimei.utils.JwtUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import org.springframework.web.servlet.HandlerInterceptor;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -26,6 +29,9 @@ public class ApiInterceptor implements HandlerInterceptor {
         this.redisService = redisService;
     }
 
+    @Resource
+    private ClubMapper clubMapper;
+
     @Value("${caimei.zplmapi}")
     private String zplmapi;
 

+ 61 - 5
src/main/java/com/caimei/config/GlobalTokenAspect.java

@@ -1,6 +1,9 @@
 package com.caimei.config;
 
 import com.caimei.components.RedisService;
+import com.caimei.mapper.cmMapper.ClubMapper;
+import com.caimei.mapper.cmMapper.LoginMapper;
+import com.caimei.model.vo.WxClubUserVo;
 import com.caimei.utils.JwtUtil;
 import org.aspectj.lang.JoinPoint;
 import org.aspectj.lang.annotation.Aspect;
@@ -12,6 +15,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
 /**
@@ -34,11 +38,25 @@ public class GlobalTokenAspect {
         this.redisService = redisService;
     }
 
+
+    @Resource
+    private LoginMapper loginMapper;
+
+    @Resource
+    private ClubMapper clubMapper;
+
     /**
-     * 定义一个切入点 我这里是从controller切入
+     * 定义一个切入点后台controller切入
      */
-    @Pointcut("execution(public * com.caimei.controller..*.*(..))")
-    public void pointCut() {
+    @Pointcut("execution(public * com.caimei.controller.admin..*.*(..))")
+    public void adminPointCut() {
+    }
+    
+    /**
+     * 定义一个切入点, 从前端controller切入
+     */
+    @Pointcut("execution(public * com.caimei.controller.wechat..*.*(..))")
+    public void wxPointCut() {
     }
 
     /**
@@ -48,8 +66,8 @@ public class GlobalTokenAspect {
      * @param joinPoint
      * @throws Throwable
      */
-    @Before("pointCut()")
-    public void before(JoinPoint joinPoint) throws Throwable {
+    @Before("adminPointCut()")
+    public void adminBefore(JoinPoint joinPoint) throws Throwable {
         ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
         HttpServletRequest request = attributes.getRequest();
         String token = request.getHeader("X-Token");
@@ -65,6 +83,44 @@ public class GlobalTokenAspect {
         }
     }
 
+    /**
+     * 前置通知
+     * 在进入方法前执行 可以对参数进行限制或者拦截
+     * 通常在这边做日志存储存到数据库中
+     * @param joinPoint
+     * @throws Throwable
+     */
+    @Before("wxPointCut()")
+    public void userBefore(JoinPoint joinPoint) throws Throwable {
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = attributes.getRequest();
+        String token = request.getHeader("X-Token");
+        String cacheToken = null!=token ? String.valueOf(redisService.get(token)) : null;
+        // Redis过期后会得到"null"值,所以需判断字符串"null"
+        if (cacheToken != null && cacheToken.length() != 0 && !"null".equals(cacheToken)) {
+            // 验证机构用户是否可以登录
+            WxClubUserVo clubUser = null;
+            if (cacheToken.contains(",")) {
+                // 订阅号登录用户
+                String[] cacheArr = cacheToken.split(",");
+                String mobile = cacheArr[0];
+                Integer authUserId = Integer.parseInt(cacheArr[1]);
+                clubUser = clubMapper.getWxClubUser(mobile, null, authUserId, null, null);
+            } else if (cacheToken.contains("|")){
+                // 服务号登录用户
+                String[] cacheArr = cacheToken.split("\\|");
+                String openId = cacheArr[0];
+                String appId = cacheArr[1];
+                clubUser = loginMapper.getClubUserByOpenId(openId, appId);
+            }
+            if (null != clubUser) {
+                // token 续签
+                redisService.set(token, cacheToken, 60L * 60 * 24);
+            }
+
+        }
+    }
+
     /**
      * JWT Token续签:
      * 业务逻辑:登录成功后,用户在未过期时间内继续操作,续签token。

+ 3 - 2
src/main/java/com/caimei/controller/auth/AddressApi.java → src/main/java/com/caimei/controller/admin/auth/AddressApi.java

@@ -1,4 +1,4 @@
-package com.caimei.controller.auth;
+package com.caimei.controller.admin.auth;
 
 
 import com.caimei.model.ResponseJson;
@@ -58,8 +58,9 @@ public class AddressApi {
         return addressService.getAllSelectAddress();
     }
 
+    @ApiOperation("Ross机构数据导入")
     @GetMapping("/address/test")
-    public ResponseJson addressTest() {
+    public ResponseJson addressTest() throws Exception {
         return addressService.addressTest();
     }
 }

+ 11 - 32
src/main/java/com/caimei/controller/auth/AuthApi.java → src/main/java/com/caimei/controller/admin/auth/AuthApi.java

@@ -1,6 +1,5 @@
-package com.caimei.controller.auth;
+package com.caimei.controller.admin.auth;
 
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.CmBrandAuthPo;
@@ -50,16 +49,17 @@ public class AuthApi {
             @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
             @ApiImplicitParam(name = "lowerAuditStatus", required = false, value = "商品信息审核状态:0未完成审核,1已完成审核"),
             @ApiImplicitParam(name = "shopAuditStatus", required = false, value = "供应商审核状态:0未审核,1已审核"),
+            @ApiImplicitParam(name = "sendStatus", required = false, value = "寄送状态:0未寄送,1已寄送"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     @GetMapping("/list")
     public ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty,
                                                       Integer status, Integer auditStatus, Integer lowerAuditStatus,
-                                                      Integer shopAuditStatus,
+                                                      Integer shopAuditStatus, Integer sendStatus,
                                                       @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                       @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
-        return authService.getAuthList(listType, authUserId, authParty, status, auditStatus, lowerAuditStatus, shopAuditStatus, pageNum, pageSize);
+        return authService.getAuthList(listType, authUserId, authParty, status, auditStatus, lowerAuditStatus, shopAuditStatus, sendStatus, pageNum, pageSize);
     }
 
     @ApiOperation("机构下拉框列表")
@@ -114,7 +114,7 @@ public class AuthApi {
             "firstClubType:一级分类为医美=1,生美=2,项目公司=3,个人=4,其他=5;" +
             "secondClubType:医美的二级分类为诊所=1、门诊=2、医院=3,其他=4。生美二级分类,美容院=5,养生馆=6,其他=7;" +
             "medicalLicenseImage:医疗许可证图;empNum:员工人数;"+
-            "logo;customFlag:是否需要自定义属性:0否,1是;remarks:店铺备注;createBy:创建人id", required = true)
+            "logo;customFlag:是否需要自定义属性:0否,1是;remarks:店铺备注;createBy:创建人id;source:1供应商保存,2机构保存", required = true)
     @PostMapping("/save")
     public ResponseJson saveAuth(@RequestBody String params) {
         JSONObject paramsMap = JSONObject.parseObject(params);
@@ -137,6 +137,11 @@ public class AuthApi {
         List<String> bannerList = (List<String>) paramsMap.get("bannerList");
         String authParty = paramsMap.getString("authParty");
         Integer createBy = paramsMap.getInteger("createBy");
+        Integer source = paramsMap.getInteger("source");
+        if (null == source) {
+            // 默认供应商保存
+            source = 1;
+        }
         /*
             组装授权数据
          */
@@ -164,7 +169,7 @@ public class AuthApi {
         auth.setEmpNum(empNum);
         auth.setLogo(logo);
         auth.setCreateBy(createBy);
-        return authService.saveAuth(auth, bannerList, false, 1);
+        return authService.saveAuth(auth, bannerList, false, source);
     }
 
 
@@ -185,32 +190,6 @@ public class AuthApi {
         return authService.auditAuth(authId, auditStatus, invalidReason, auditBy, source);
     }
 
-
-    @ApiOperation("寄送授权牌")
-    @ApiImplicitParam(name = "params", value = "authId:授权id;companyName:快递公司;companyCode:快递公司代码;logisticsNumber:快递单号;" +
-            "imageList:图片备注列表;remarks:备注", required = true)
-    @PostMapping("/certificate/send")
-    public ResponseJson send(@RequestBody String params) {
-        JSONObject paramsMap = JSONObject.parseObject(params);
-        Integer authId = paramsMap.getInteger("authId");
-        String companyName = paramsMap.getString("companyName");
-        String companyCode = paramsMap.getString("companyCode");
-        String logisticsNumber = paramsMap.getString("logisticsNumber");
-        JSONArray imageList = paramsMap.getJSONArray("imageList");
-        String remarks = paramsMap.getString("remarks");
-        return authService.sendCertificate(authId, companyName, companyCode, logisticsNumber, imageList, remarks);
-    }
-
-
-    @ApiOperation("寄送授权牌物流详情")
-    @ApiImplicitParam(name = "params", value = "authId:授权id;", required = true)
-    @GetMapping("/certificate/logistics")
-    public ResponseJson sendDetails(@RequestBody String params) {
-        JSONObject paramsMap = JSONObject.parseObject(params);
-        Integer authId = paramsMap.getInteger("authId");
-        return authService.certificateLogistics(authId);
-    }
-
     @ApiOperation("excel导入")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),

+ 3 - 7
src/main/java/com/caimei/controller/auth/AuthClubApi.java → src/main/java/com/caimei/controller/admin/auth/AuthClubApi.java

@@ -1,4 +1,4 @@
-package com.caimei.controller.auth;
+package com.caimei.controller.admin.auth;
 
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;
@@ -66,23 +66,19 @@ public class AuthClubApi {
 
     @ApiOperation("添加/编辑机构用户")
     @PostMapping("/user/save")
-    @ApiImplicitParam(name = "params", value = "clubUserId:机构用户id;authUserId:供应商用户id;name:姓名;mobile:手机号", required = true)
+    @ApiImplicitParam(name = "params", value = "clubUserId:机构用户id;authUserId:供应商用户id;mobile:手机号", required = true)
     public ResponseJson saveClubUser(@RequestBody String params) {
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer clubUserId = paramsMap.getInteger("clubUserId");
         Integer authUserId = paramsMap.getInteger("authUserId");
-        String name = paramsMap.getString("name");
         String mobile = paramsMap.getString("mobile");
         if (null == authUserId) {
             return ResponseJson.error("参数异常,请输入供应商用户id");
         }
-        if (StringUtils.isEmpty(name)) {
-            return ResponseJson.error("参数异常,请输入姓名");
-        }
         if (StringUtils.isEmpty(mobile)) {
             return ResponseJson.error("参数异常,请输入手机号");
         }
-        return authClubService.saveClubUser(clubUserId, authUserId, name, mobile);
+        return authClubService.saveClubUser(clubUserId, authUserId, mobile);
     }
 
     @ApiOperation("删除机构用户")

+ 3 - 2
src/main/java/com/caimei/controller/auth/AuthProductApi.java → src/main/java/com/caimei/controller/admin/auth/AuthProductApi.java

@@ -1,4 +1,4 @@
-package com.caimei.controller.auth;
+package com.caimei.controller.admin.auth;
 
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;
@@ -98,13 +98,14 @@ public class AuthProductApi {
      *                   invoiceImage           发票图片
      *                   status                 上线状态:0已下线,1已上线,2待上线
      *                   createBy               创建人id
+     *                   source                 来源:1供应商保存,2机构保存
      *                   paramList              商品参数列表
      * }
      */
     @ApiOperation("添加/编辑授权商品")
     @PostMapping("/save")
     public ResponseJson saveProduct(@RequestBody ProductSaveDto productSaveDto) throws IOException {
-        return authProductService.saveProduct(productSaveDto, false, 1);
+        return authProductService.saveProduct(productSaveDto, false);
     }
 
     /**

+ 1 - 3
src/main/java/com/caimei/controller/auth/DefaultApi.java → src/main/java/com/caimei/controller/admin/auth/DefaultApi.java

@@ -1,11 +1,9 @@
-package com.caimei.controller.auth;
+package com.caimei.controller.admin.auth;
 
 import com.caimei.module.base.entity.bo.JsonModel;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 /**

+ 1 - 1
src/main/java/com/caimei/controller/auth/DoctorApi.java → src/main/java/com/caimei/controller/admin/auth/DoctorApi.java

@@ -1,4 +1,4 @@
-package com.caimei.controller.auth;
+package com.caimei.controller.admin.auth;
 
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;

+ 3 - 3
src/main/java/com/caimei/controller/auth/DownloadApi.java → src/main/java/com/caimei/controller/admin/auth/DownloadApi.java

@@ -1,4 +1,4 @@
-package com.caimei.controller.auth;
+package com.caimei.controller.admin.auth;
 
 import com.caimei.service.auth.DownloadService;
 import io.swagger.annotations.Api;
@@ -46,10 +46,10 @@ public class DownloadApi {
     }
 
 
-    @ApiOperation("一键下载授权牌/二维码")
+    @ApiOperation("一键下载授权牌/设备二维码/机构二维码")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
-            @ApiImplicitParam(name = "type", required = true, value = "1授权牌,2二维码")
+            @ApiImplicitParam(name = "type", required = true, value = "1授权牌,2设备二维码,3机构二维码")
     })
     @GetMapping("/shop/image")
     public void downloadImage(Integer authUserId, Integer type, HttpServletRequest request, HttpServletResponse response) throws Exception {

+ 57 - 0
src/main/java/com/caimei/controller/admin/auth/LogisticsApi.java

@@ -0,0 +1,57 @@
+package com.caimei.controller.admin.auth;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.model.ResponseJson;
+import com.caimei.service.auth.LogisticsService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 物流API
+ *
+ * @author : Aslee
+ * @date : 2022/6/15
+ */
+@Api(tags = "物流API")
+@Slf4j
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/logistics")
+public class LogisticsApi {
+
+    private final LogisticsService logisticsService;
+
+
+    @ApiOperation("寄送授权牌")
+    @ApiImplicitParam(name = "params", value = "authId:授权id;companyId:物流公司id;logisticsNumber:快递单号;" +
+            "imageList:图片备注列表;remarks:备注", required = true)
+    @PostMapping("/certificate/send")
+    public ResponseJson send(@RequestBody String params) {
+        JSONObject paramsMap = JSONObject.parseObject(params);
+        Integer authId = paramsMap.getInteger("authId");
+        Integer companyId = paramsMap.getInteger("companyId");
+        String logisticsNumber = paramsMap.getString("logisticsNumber");
+        JSONArray imageList = paramsMap.getJSONArray("imageList");
+        String remarks = paramsMap.getString("remarks");
+        return logisticsService.sendCertificate(authId, companyId, logisticsNumber, imageList, remarks);
+    }
+
+    @ApiOperation("寄送授权牌物流详情")
+    @ApiImplicitParam(name = "authId", value = "授权id", required = true)
+    @GetMapping("/certificate/details")
+    public ResponseJson certificateLogistics(Integer authId) {
+        return logisticsService.certificateLogistics(authId);
+    }
+
+    @ApiOperation("物流公司数据")
+    @GetMapping("/company/data")
+    public ResponseJson getLogisticsCompany() {
+        return logisticsService.getLogisticsCompany();
+    }
+
+}

+ 1 - 1
src/main/java/com/caimei/controller/auth/ShopApi.java → src/main/java/com/caimei/controller/admin/auth/ShopApi.java

@@ -1,4 +1,4 @@
-package com.caimei.controller.auth;
+package com.caimei.controller.admin.auth;
 
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;

+ 1 - 1
src/main/java/com/caimei/controller/auth/UploadApi.java → src/main/java/com/caimei/controller/admin/auth/UploadApi.java

@@ -1,4 +1,4 @@
-package com.caimei.controller.auth;
+package com.caimei.controller.admin.auth;
 
 import com.caimei.service.auth.UploadService;
 import com.caimei.utils.OSSUtils;

+ 1 - 6
src/main/java/com/caimei/controller/auth/UserApi.java → src/main/java/com/caimei/controller/admin/auth/UserApi.java

@@ -1,20 +1,15 @@
-package com.caimei.controller.auth;
+package com.caimei.controller.admin.auth;
 
 import com.caimei.model.ResponseJson;
-import com.caimei.model.dto.PackageDto;
 import com.caimei.model.dto.PasswordDto;
 import com.caimei.model.vo.UserLoginVo;
-import com.caimei.model.vo.VipConfigurationVo;
 import com.caimei.service.auth.UserService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
-import org.springframework.http.HttpHeaders;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
 import java.util.Map;
 
 

+ 1 - 1
src/main/java/com/caimei/controller/data/ArticleApi.java → src/main/java/com/caimei/controller/admin/data/ArticleApi.java

@@ -1,4 +1,4 @@
-package com.caimei.controller.data;
+package com.caimei.controller.admin.data;
 
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;

+ 1 - 1
src/main/java/com/caimei/controller/data/FileApi.java → src/main/java/com/caimei/controller/admin/data/FileApi.java

@@ -1,4 +1,4 @@
-package com.caimei.controller.data;
+package com.caimei.controller.admin.data;
 
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;

+ 1 - 1
src/main/java/com/caimei/controller/data/ImageApi.java → src/main/java/com/caimei/controller/admin/data/ImageApi.java

@@ -1,4 +1,4 @@
-package com.caimei.controller.data;
+package com.caimei.controller.admin.data;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;

+ 1 - 1
src/main/java/com/caimei/controller/data/VideoApi.java → src/main/java/com/caimei/controller/admin/data/VideoApi.java

@@ -1,4 +1,4 @@
-package com.caimei.controller.data;
+package com.caimei.controller.admin.data;
 
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;

+ 1 - 3
src/main/java/com/caimei/controller/pay/PayApi.java → src/main/java/com/caimei/controller/admin/pay/PayApi.java

@@ -1,8 +1,7 @@
-package com.caimei.controller.pay;
+package com.caimei.controller.admin.pay;
 
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;
-import com.caimei.model.dto.PayVipDto;
 import com.caimei.utils.RequestUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -12,7 +11,6 @@ import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.HashMap;
 import java.util.Map;
 
 /**

+ 1 - 1
src/main/java/com/caimei/controller/sys/SysMenuApi.java → src/main/java/com/caimei/controller/admin/sys/SysMenuApi.java

@@ -1,4 +1,4 @@
-package com.caimei.controller.sys;
+package com.caimei.controller.admin.sys;
 
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.SysMenu;

+ 1 - 1
src/main/java/com/caimei/controller/sys/SysRoleApi.java → src/main/java/com/caimei/controller/admin/sys/SysRoleApi.java

@@ -1,4 +1,4 @@
-package com.caimei.controller.sys;
+package com.caimei.controller.admin.sys;
 
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.SysRole;

+ 1 - 3
src/main/java/com/caimei/controller/sys/SysUserApi.java → src/main/java/com/caimei/controller/admin/sys/SysUserApi.java

@@ -1,14 +1,12 @@
-package com.caimei.controller.sys;
+package com.caimei.controller.admin.sys;
 
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.SysUser;
-import com.caimei.model.po.UserProfile;
 import com.caimei.service.sys.SysUserService;
 import com.github.pagehelper.PageInfo;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
 
 /**
  * Description

+ 1 - 2
src/main/java/com/caimei/controller/vip/VipApi.java → src/main/java/com/caimei/controller/admin/vip/VipApi.java

@@ -1,9 +1,8 @@
-package com.caimei.controller.vip;
+package com.caimei.controller.admin.vip;
 
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.SysMenu;
-import com.caimei.model.po.SysRole;
 import com.caimei.model.vo.*;
 import com.caimei.service.vip.VipService;
 import com.github.pagehelper.PageInfo;

+ 8 - 12
src/main/java/com/caimei/controller/wechat/RegisterApi.java

@@ -11,8 +11,6 @@ import lombok.RequiredArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
-import java.io.IOException;
-import java.util.Map;
 
 
 /**
@@ -21,7 +19,7 @@ import java.util.Map;
  * @author : Aslee
  * @date : 2021/5/11
  */
-@Api(tags = "机构用户注册API")
+@Api(tags = "微信机构用户注册API")
 @RestController
 @RequiredArgsConstructor
 @RequestMapping("/wx/user/register")
@@ -30,7 +28,7 @@ public class RegisterApi {
     private final RegisterService registerService;
 
     @ApiOperation("普通注册")
-    @ApiImplicitParam(name = "params", value = "mobile:手机号;verifyCode:验证码;password:密码;authUserId:供应商用户id;authId:机构id", required = true)
+    @ApiImplicitParam(name = "params", value = "mobile:手机号;verifyCode:验证码;password:密码;authUserId:供应商用户id;", required = true)
     @PostMapping("/simple")
     public ResponseJson<WxClubUserVo> simpleRegister(@RequestBody String params) {
         JSONObject parseObject = JSONObject.parseObject(params);
@@ -38,7 +36,6 @@ public class RegisterApi {
         String verifyCode = parseObject.getString("verifyCode");
         String password = parseObject.getString("password");
         Integer authUserId = parseObject.getInteger("authUserId");
-        String authParty = parseObject.getString("authParty");
         if (StringUtils.isEmpty(mobile)) {
             return ResponseJson.error("手机号不能为空", null);
         }
@@ -51,17 +48,16 @@ public class RegisterApi {
         if (null == authUserId) {
             return ResponseJson.error("供应商用户id不能为空", null);
         }
-        if (StringUtils.isEmpty(authParty)) {
-            return ResponseJson.error("机构名称不能为空", null);
-        }
-        return registerService.simpleRegister(mobile, verifyCode, password, authUserId, authParty);
+        return registerService.simpleRegister(mobile, verifyCode, password, authUserId, null);
     }
 
     @ApiOperation("全部注册")
-    @ApiImplicitParam(name = "params", value = "registerType:1机构用户注册,机构认证,3设备认证;" +
-            "authUserId:供应商用户id" +
+    @ApiImplicitParam(name = "params", value = "registerType:1机构用户注册,2机构认证,3设备认证;" +
+            "authUserId:供应商用户id;" +
+            "authId:机构id;" +
+            "clubUserId:机构用户id;" +
             "clubUserInfo:机构用户数据;" +
-            "clubInfo:机构数据;" +
+            "authInfo:机构数据;" +
             "productInfo:设备数据", required = true)
     @PostMapping("/all")
     public ResponseJson allRegister(@RequestBody String params) {

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

@@ -1,11 +1,10 @@
 package com.caimei.controller.wechat;
 
 import com.caimei.model.ResponseJson;
+import com.caimei.model.dto.ProductSaveDto;
 import com.caimei.model.vo.*;
 import com.caimei.module.base.entity.vo.AuthProductVo;
-import com.caimei.service.auth.AuthClubService;
-import com.caimei.service.auth.AuthProductService;
-import com.caimei.service.auth.DoctorService;
+import com.caimei.service.auth.*;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -14,10 +13,10 @@ import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.IOException;
+import java.util.List;
 
 /**
  * @author Aslee
@@ -30,10 +29,14 @@ import org.springframework.web.bind.annotation.RestController;
 public class WxAuthApi {
     private final AuthClubService authClubService;
 
+    private final AuthService authService;
+
     private final AuthProductService authProductService;
 
     private final DoctorService doctorService;
 
+    private final ShopService shopService;
+
     @ApiOperation("供应商信息")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id"),
@@ -95,18 +98,92 @@ public class WxAuthApi {
         return authProductService.getWxProductTypeList(authUserId, appId, name, pageNum, pageSize);
     }
 
-    @ApiOperation("认证商品列表")
+    @ApiOperation("认证商品列表")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "productTypeId", required = true, value = "设备分类id"),
+            @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1供应商设备分类上线设备列表 2设备认证列表"),
+            @ApiImplicitParam(name = "authId", required = false, value = "机构id"),
+            @ApiImplicitParam(name = "productTypeId", required = false, value = "设备分类id"),
             @ApiImplicitParam(name = "snCode", required = false, value = "sn码后四位"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     @GetMapping("/product/list")
-    public ResponseJson<PageInfo<WxProductListVo>> getWxProductList(Integer productTypeId, String snCode,
+    public ResponseJson<PageInfo<WxProductListVo>> getWxProductList(Integer listType, Integer authId, Integer productTypeId, String snCode,
                                                                     @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                     @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
-        return authProductService.getWxProductList(productTypeId, snCode, pageNum, pageSize);
+        return authProductService.getWxProductList(listType, authId, productTypeId, snCode, pageNum, pageSize);
+    }
+
+    /**
+     * 获取授权商品回显数据
+     */
+    @ApiOperation("授权商品回显数据")
+    @ApiImplicitParam(name = "productId", required = true, value = "授权商品id")
+    @GetMapping("/product/form/data")
+    public ResponseJson<ProductFormVo> getProductFormData(Integer productId) {
+        return authProductService.getProductFormData(productId);
+    }
+
+    /**
+     * 品牌列表
+     *
+     * @param type 1品牌方可用品牌列表,2代理商可用品牌列表,3供应商可用品牌列表
+     * @return AuthVo
+     */
+    @ApiOperation("品牌列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "type", value = "1品牌方品牌列表,2代理商品牌列表,3供应商可用品牌列表", required = true),
+            @ApiImplicitParam(name = "authUserId", value = "供应商用户id", required = false)
+    })
+    @GetMapping("/brand/list")
+    public ResponseJson<List<BrandVo>> getBrandList(Integer type, Integer authUserId) {
+        return shopService.getBrandList(type, authUserId);
+    }
+
+    /**
+     * 添加/编辑授权商品
+     * @param productSaveDto {
+     *                   productId              授权商品id
+     *                   authId                 授权id
+     *                   brandId                品牌id
+     *                   productTypeId          设备分类id
+     *                   snCode                 商品SN码
+     *                   productImage           商品图片
+     *                   certificateImage       授权牌照
+     *                   addQrCodeFlag          是否生成二维码授权牌:0否,1是
+     *                   addTemplateType        生成二维码授权牌模板:1左下,2右边,3左边
+     *                   purchaseWay            购买渠道
+     *                   invoiceImage           发票图片
+     *                   status                 上线状态:0已下线,1已上线,2待上线
+     *                   createBy               创建人id
+     *                   source                 来源:1供应商保存,2机构保存
+     *                   paramList              商品参数列表
+     * }
+     */
+    @ApiOperation("添加/编辑授权商品")
+    @PostMapping("/product/save")
+    public ResponseJson saveProduct(@RequestBody ProductSaveDto productSaveDto) throws IOException {
+        return authProductService.saveProduct(productSaveDto, false);
+    }
+
+    /**
+     * 授权机构回显数据
+     */
+    @ApiOperation("授权机构回显数据")
+    @ApiImplicitParam(name = "authId", required = true, value = "机构用户id")
+    @GetMapping("/form/data")
+    public ResponseJson<AuthFormVo> getAuthFormData(Integer authId) {
+        return authService.getAuthFormData(authId);
+    }
+
+    @ApiOperation("设备分类下拉框列表")
+    @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id")
+    @GetMapping("/product/type/select")
+    public ResponseJson<List<ProductTypeListVo>> getProductTypeSelectList(Integer authUserId) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,供应商用户id不能为空", null);
+        }
+        return authProductService.getProductTypeSelectList(authUserId);
     }
 
     @ApiOperation("已认证商品详情")

+ 100 - 0
src/main/java/com/caimei/controller/wechat/WxUploadApi.java

@@ -0,0 +1,100 @@
+package com.caimei.controller.wechat;
+
+import com.caimei.controller.admin.auth.UploadApi;
+import com.caimei.service.auth.UploadService;
+import com.caimei.utils.OSSUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * @author Aslee
+ * @date 2021/5/14
+ */
+@Api(tags = "微信上传API")
+@Slf4j
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/wx/upload")
+public class WxUploadApi {
+    private static final Logger logger = LoggerFactory.getLogger(UploadApi.class);
+    @Value("${caimei.imageDomain}")
+    private String imageDomain;
+    private final UploadService uploadService;
+
+    /**
+     * 上传图片
+     */
+    @ApiOperation("上传图片")
+    @ApiImplicitParam(name = "file", value = "图片", required = true)
+    @PostMapping("/image")
+    public Map<String, Object> uploadImage(MultipartFile file) throws IOException {
+        Map<String, Object> map = new HashMap<>(2);
+        String saveFile;
+        if (file != null ) {
+            // 保存文件
+            saveFile = uploadService.saveFile(file);
+            map.put("data", saveFile);
+            map.put("msg", "上传成功");
+            logger.info("【图片上传】>>>>>>>>>>>>>>>>图片上传成功:" + saveFile);
+        } else {
+            map.put("msg", "上传失败");
+            logger.info("【图片上传】>>>>>>>>>>>>>>>>图片上传失败:");
+        }
+        return map;
+    }
+
+
+
+    @ApiOperation("上传文件")
+    @ApiImplicitParam(name = "file", value = "文件", required = true)
+    @PostMapping("/file")
+    public Map<String, Object> uploadFile(MultipartFile file) throws IOException {
+        Map<String, Object> map = new HashMap<>(2);
+        String fileAllName = file.getOriginalFilename();
+        String realName = fileAllName.substring(0, fileAllName.lastIndexOf("."));
+        String fileType = fileAllName.substring(fileAllName.lastIndexOf(".") + 1);
+        String fileName = file.getResource().getFilename();
+        String uuid = UUID.randomUUID().toString().replaceAll("-", "");
+        String filePath = uuid + "." + fileType;
+        String contentType = OSSUtils.getContentType(fileAllName);
+        log.info(">>>>>>>>>>>>>上传文件");
+        //保存本地
+        File uploadFile = OSSUtils.ossUpload(file);
+        //将文件上传oss
+        log.info("开始上传>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        log.info("开始时间" + format.format(new Date()));
+        String previewUrl = OSSUtils.ossUpload(filePath, uploadFile, contentType, null);
+        log.info("结束时间" + format.format(new Date()));
+        if (StringUtils.isNotEmpty(previewUrl)) {
+            map.put("previewUrl", previewUrl);
+            map.put("downloadUrl", filePath);
+            map.put("fileName", fileName);
+            map.put("msg", "上传成功");
+            logger.info(">>>>>>>>>>>>>>>>文件上传成功:" + previewUrl);
+        } else {
+            map.put("msg", "上传失败");
+            logger.info(">>>>>>>>>>>>>>>>文件上传失败:");
+        }
+        return map;
+    }
+}

+ 6 - 6
src/main/java/com/caimei/controller/wechat/WxUserApi.java

@@ -22,7 +22,7 @@ import java.util.Map;
  * @author : Aslee
  * @date : 2021/5/11
  */
-@Api(tags = "机构用户API")
+@Api(tags = "微信机构用户API")
 @RestController
 @RequiredArgsConstructor
 @RequestMapping("/wx/user")
@@ -32,19 +32,19 @@ public class WxUserApi {
 
     @ApiOperation("获取用户信息")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "mobile", required = true, value = "手机号"),
+            @ApiImplicitParam(name = "mobile", required = false, value = "手机号"),
             @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id"),
             @ApiImplicitParam(name = "clubUserId", required = false, value = "机构用户id")
     })
     @GetMapping("/info")
-    public ResponseJson<Map<String,Object>> register(String mobile, Integer authUserId, Integer clubUserId) {
-        if (StringUtils.isEmpty(mobile) && null == clubUserId) {
+    public ResponseJson<Map<String, Object>> getUserInfo(String mobile, Integer authUserId, Integer clubUserId, Integer authId) {
+        if (StringUtils.isEmpty(mobile) && null == clubUserId && null == authId) {
             return ResponseJson.error("参数异常", null);
         }
-        if (null == clubUserId && null == authUserId) {
+        if (StringUtils.isNotEmpty(mobile) && null == authUserId) {
             return ResponseJson.error("供应商用户id不能为空", null);
         }
-        return wxUserService.getUserInfo(mobile, authUserId, clubUserId);
+        return wxUserService.getUserInfo(mobile, authUserId, clubUserId, authId);
     }
 
     @ApiOperation("登录注册验证码发送")

+ 2 - 6
src/main/java/com/caimei/mapper/cmMapper/AuthMapper.java

@@ -22,7 +22,7 @@ import java.util.List;
 @Mapper
 public interface AuthMapper {
 
-    List<AuthVo> getAuthList(@Param("listType") Integer listType, @Param("authUserId") Integer authUserId, @Param("authParty") String authParty, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus, @Param("lowerAuditStatus") Integer lowerAuditStatus, @Param("shopAuditStatus") Integer shopAuditStatus);
+    List<AuthVo> getAuthList(@Param("listType") Integer listType, @Param("authUserId") Integer authUserId, @Param("authParty") String authParty, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus, @Param("lowerAuditStatus") Integer lowerAuditStatus, @Param("shopAuditStatus") Integer shopAuditStatus, @Param("sendStatus") Integer sendStatus);
 
     void updateAuthStatusByAuthId(@Param("authId") Integer authId, @Param("status") Integer status);
 
@@ -74,7 +74,7 @@ public interface AuthMapper {
 
     Integer getProvinceIdByCityId(Integer cityId);
 
-    AuthFormVo getAuthByUserMobile(@Param("mobile") String userMobile, @Param("authUserId") Integer authUserId);
+    AuthFormVo getAuthBaseInfo(@Param("authUserId") Integer authUserId, @Param("authId") Integer authId);
 
     AuthVo getAuthById(Integer authId);
 
@@ -94,9 +94,5 @@ public interface AuthMapper {
 
     String getTownNameById(Integer townId);
 
-    void sendCertificate(CertificateLogisticsPo logistics);
-
     void updateSendStatus(Integer authId);
-
-    CertificateLogisticsVo getCertificateLogistics(Integer authId);
 }

+ 7 - 3
src/main/java/com/caimei/mapper/cmMapper/AuthProductMapper.java

@@ -52,7 +52,7 @@ public interface AuthProductMapper {
 
     void updateProductAuditStatus(@Param("productId") Integer productId, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus, @Param("invalidReason") String invalidReason, @Param("auditBy") Integer auditBy, @Param("auditTime") Date auditTime);
 
-    List<WxProductListVo> getWxProductList(@Param("productTypeId") Integer productTypeId, @Param("snCode") String snCode);
+    List<WxProductListVo> getWxProductList(@Param("listType") Integer listType, @Param("authId") Integer authId, @Param("productTypeId") Integer productTypeId, @Param("snCode") String snCode);
 
     Integer getBrandIdByBrandName(String brand);
 
@@ -82,9 +82,13 @@ public interface AuthProductMapper {
 
     List<WxProductTypeListVo> getWxProductTypeList(Integer authUserId, String name);
 
-    ProductTypePo getProductType(Integer productTypeId);
+    ProductTypePo getProductType(Integer productTypeId, String productName, Integer authUserId);
 
     Integer getProductCountByTypeId(Integer productTypeId);
 
-    void updateProductShopAuditStatus(@Param("productId") Integer productId, @Param("shopAuditStatus") Integer auditStatus, @Param("shopInvalidReason") String invalidReason, @Param("shopAuditTime") Date auditTime);
+    void updateProductShopAuditStatus(@Param("productId") Integer productId, @Param("productTypeId") Integer productTypeId, @Param("shopAuditStatus") Integer auditStatus, @Param("shopInvalidReason") String invalidReason, @Param("shopAuditTime") Date auditTime);
+
+    ProductPo getProductPo(Integer productId);
+
+    Integer getAuthUserIdByProductId(Integer productId);
 }

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

@@ -38,9 +38,13 @@ public interface ClubMapper {
 
     void updatePassword(@Param("mobile") String mobile, @Param("password") String password, @Param("authUserId") Integer authUserId);
 
-    void updateAuthId(@Param("clubUserId") Integer clubUserId, @Param("authId") Integer authId);
+    void bindAuthId(@Param("clubUserId") Integer clubUserId, @Param("authId") Integer authId);
 
     void updateStatus(@Param("clubUserId") Integer clubUserId, @Param("status") Integer status);
 
     void updateClubUserPassword(@Param("clubUserId") Integer clubUserId, @Param("password") String md5Password);
+
+    void unbindAuthId(Integer clubUserId);
+
+    String getDbPassword(Integer clubUserId);
 }

+ 31 - 0
src/main/java/com/caimei/mapper/cmMapper/LogisticsMapper.java

@@ -0,0 +1,31 @@
+package com.caimei.mapper.cmMapper;
+
+import com.caimei.model.po.CertificateLogisticsPo;
+import com.caimei.model.po.CmBrandAuthPo;
+import com.caimei.model.po.LdmDataPo;
+import com.caimei.model.po.TownPo;
+import com.caimei.model.vo.AuthFormVo;
+import com.caimei.model.vo.AuthVo;
+import com.caimei.model.vo.CertificateLogisticsVo;
+import com.caimei.model.vo.LogisticsCompanyVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2022/6/15
+ */
+@Mapper
+public interface LogisticsMapper {
+
+    void sendCertificate(CertificateLogisticsPo logistics);
+
+    CertificateLogisticsVo getCertificateLogistics(Integer authId);
+
+    List<LogisticsCompanyVo> getLogisticsCompanyList(Integer companyId);
+}

+ 49 - 20
src/main/java/com/caimei/model/dto/ProductSaveDto.java

@@ -18,49 +18,78 @@ import java.util.List;
  */
 @Data
 public class ProductSaveDto {
-    @ApiModelProperty("授权商品id")
+    /**
+     * 授权商品id
+     */
     private Integer productId;
 
-    @NotNull(message = "授权id不能为空")
-    @ApiModelProperty("授权id")
+    /**
+     * 授权id
+     */
     private Integer authId;
 
-    @NotNull(message = "品牌id不能为空")
-    @ApiModelProperty("品牌id")
+    /**
+     * 品牌id
+     */
     private Integer brandId;
 
-    @ApiModelProperty("设备分类id")
+    /**
+     * 设备分类id
+     */
     private Integer productTypeId;
 
-    @NotNull(message = "商品SN码不能为空")
-    @ApiModelProperty("商品SN码")
+    /**
+     * 设备名称
+     */
+    private String productName;
+
+    /**
+     * 商品SN码
+     */
     private String snCode;
 
-    @NotNull(message = "商品图片不能为空")
-    @ApiModelProperty("商品图片")
+    /**
+     * 商品图片
+     */
     private String productImage;
 
-    @NotNull(message = "授权牌照不能为空")
-    @ApiModelProperty("授权牌照")
+    /**
+     * 授权牌照
+     */
     private String certificateImage;
 
-    @ApiModelProperty("是否生成二维码授权牌:0否,1是")
+    /**
+     * 是否生成二维码授权牌:0否,1是
+     */
     private Integer addQrCodeFlag;
 
-    @ApiModelProperty("生成二维码授权牌模板:1左下,2右边,3左边")
+    /**
+     * 生成二维码授权牌模板:1左下,2右边,3左边
+     */
     private Integer addTemplateType;
 
-    @ApiModelProperty("购买渠道")
+    /**
+     * 购买渠道
+     */
     private String purchaseWay;
 
-    @ApiModelProperty("发票图片")
+    /**
+     * 发票图片
+     */
     private String invoiceImage;
 
-    @NotNull(message = "创建人id不能为空")
-    @ApiModelProperty("创建人id")
+    /**
+     * 创建人id
+     */
     private Integer createBy;
 
-    @NotNull(message = "商品参数列表不能为空")
-    @ApiModelProperty("商品参数列表")
+    /**
+     * 商品参数列表
+     */
     private List<ProductParamPo> paramList;
+
+    /**
+     * 来源:1供应商保存,2机构保存
+     */
+    private Integer source;
 }

+ 6 - 1
src/main/java/com/caimei/model/po/ProductPo.java

@@ -34,6 +34,11 @@ public class ProductPo {
      */
     private Integer productTypeId;
 
+    /**
+     * 设备名称
+     */
+    private String name;
+
     /**
      * sn码
      */
@@ -42,7 +47,7 @@ public class ProductPo {
     /**
      * 商品图片
      */
-    private String productImage;
+    private String image;
 
     /**
      * pc添加水印商品图片

+ 2 - 2
src/main/java/com/caimei/model/vo/AuthFormVo.java

@@ -126,7 +126,7 @@ public class AuthFormVo implements Serializable {
     private Integer shopAuditStatus;
 
     /**
-     * 供应商审核不通过原因
+     * 审核不通过原因
      */
-    private Integer shopInvalidReason;
+    private Integer invalidReason;
 }

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

@@ -27,6 +27,9 @@ public class AuthVo {
     @ApiModelProperty("审核状态:0审核未通过,1审核通过,2待审核")
     private Integer auditStatus;
 
+    @ApiModelProperty("寄送状态:0未寄送,1已寄送")
+    private Integer sendStatus;
+
     @ApiModelProperty("创建时间")
     private Date createTime;
 

+ 1 - 1
src/main/java/com/caimei/model/vo/CertificateLogisticsVo.java

@@ -15,7 +15,7 @@ public class CertificateLogisticsVo {
     /**
      * 机构名称
      */
-    private Integer authParty;
+    private String authParty;
 
     /**
      * 快递单当前的状态(0:在途,即货物处于运输过程中;1:揽件,货物已由快递公司揽收并且产生了第一条跟踪信息;2:疑难,货物寄送过程出了问题;3:签收,收件人已签收;4:退签,即货物由于用户拒签、超区等原因退回,而且发件人已经签收;5:派件,即快递正在进行同城派件;6:退回,货物正处于退回发件人的途中;)

+ 33 - 0
src/main/java/com/caimei/model/vo/LogisticsCompanyVo.java

@@ -0,0 +1,33 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 选择地址下拉框列表 数据
+ *
+ * @author : Charles
+ * @date : 2021/7/2
+ */
+@Data
+public class LogisticsCompanyVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 物流公司id
+     */
+    private Integer id;
+
+    /**
+     * 公司名称
+     */
+    private String companyName;
+
+    /**
+     * 公司代码
+     */
+    private String companyCode;
+}

+ 7 - 2
src/main/java/com/caimei/model/vo/ProductFormVo.java

@@ -89,13 +89,18 @@ public class ProductFormVo {
      */
     private List<ProductParamPo> paramList;
 
+    /**
+     * 审核状态:0审核未通过,1审核通过,2待审核
+     */
+    private Integer auditStatus;
+
     /**
      * 供应商审核状态:0审核未通过,1审核通过,2待审核
      */
     private Integer shopAuditStatus;
 
     /**
-     * 供应商审核不通过原因
+     * 审核不通过原因
      */
-    private Integer shopInvalidReason;
+    private Integer invalidReason;
 }

+ 6 - 0
src/main/java/com/caimei/model/vo/WxClubUserVo.java

@@ -27,6 +27,12 @@ public class WxClubUserVo {
     @ApiModelProperty("openId")
     private String openId;
 
+    @ApiModelProperty("管理员审核状态")
+    private String auditStatus;
+
+    @ApiModelProperty("供应商审核状态")
+    private String shopAuditStatus;
+
     @ApiModelProperty("accessToken")
     private String accessToken;
 }

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

@@ -28,5 +28,5 @@ public interface AddressService {
      */
     ResponseJson<List<AddressSelectVo>> getAllSelectAddress();
 
-    ResponseJson addressTest();
+    ResponseJson addressTest() throws Exception;
 }

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

@@ -73,7 +73,7 @@ public interface AuthClubService {
     /**
      * 添加/编辑机构用户
      */
-    ResponseJson saveClubUser(Integer clubUserId, Integer authUserId, String name, String mobile);
+    ResponseJson saveClubUser(Integer clubUserId, Integer authUserId, String mobile);
 
     /**
      * 删除机构用户

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

@@ -2,6 +2,7 @@ package com.caimei.service.auth;
 
 import com.caimei.model.ResponseJson;
 import com.caimei.model.dto.ProductSaveDto;
+import com.caimei.model.po.ProductTypePo;
 import com.caimei.model.vo.*;
 import com.caimei.module.base.entity.vo.AuthProductVo;
 import com.github.pagehelper.PageInfo;
@@ -66,7 +67,7 @@ public interface AuthProductService {
      *                       }
      * @return ResponseJson
      */
-    ResponseJson saveProduct(ProductSaveDto productSaveDto, boolean importFlag, Integer source) throws IOException;
+    ResponseJson saveProduct(ProductSaveDto productSaveDto, boolean importFlag) throws IOException;
 
     /**
      * 获取授权商品回显数据
@@ -103,13 +104,15 @@ public interface AuthProductService {
 
     /**
      * 微信公众号机构列表
+     *
+     * @param listType
      * @param productTypeId         设备分类id
      * @param snCode   sn码后四位
      * @param pageNum       第几页
      * @param pageSize      一页多少条
      * @return
      */
-    ResponseJson<PageInfo<WxProductListVo>> getWxProductList(Integer productTypeId, String snCode, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<WxProductListVo>> getWxProductList(Integer listType, Integer authId, Integer productTypeId, String snCode, Integer pageNum, Integer pageSize);
 
     /**
      * 认证商品详情
@@ -121,7 +124,7 @@ public interface AuthProductService {
     /**
      * 保存设备分类
      */
-    ResponseJson saveProductType(Integer productTypeId, Integer authUserId, String name, String image, Integer createBy) throws IOException;
+    ResponseJson<ProductTypePo> saveProductType(Integer productTypeId, Integer authUserId, String name, String image, Integer createBy) throws IOException;
 
     /**
      * 删除设备分类

+ 10 - 22
src/main/java/com/caimei/service/auth/AuthService.java

@@ -22,18 +22,18 @@ public interface AuthService {
     /**
      * 授权列表
      *
-     * @param listType             列表类型:1授权列表,2授权审核列表
-     * @param authUserId           供应商用户id
-     * @param authParty            授权机构
-     * @param status               上线状态:0已下线,1已上线,2待上线
-     * @param auditStatus          审核状态:0审核未通过,1审核通过,2待审核
-     * @param lowerAuditStatus     商品信息审核状态:0未完成审核,1已完成审核
-     * @param shopAuditStatus      供应商审核状态:0审核未通过,1审核通过,2待审核
-     * @param pageNum              第几页
-     * @param pageSize             一页多少条
+     * @param listType         列表类型:1授权列表,2授权审核列表
+     * @param authUserId       供应商用户id
+     * @param authParty        授权机构
+     * @param status           上线状态:0已下线,1已上线,2待上线
+     * @param auditStatus      审核状态:0审核未通过,1审核通过,2待审核
+     * @param lowerAuditStatus 商品信息审核状态:0未完成审核,1已完成审核
+     * @param shopAuditStatus  供应商审核状态:0审核未通过,1审核通过,2待审核
+     * @param pageNum          第几页
+     * @param pageSize         一页多少条
      * @return AuthVo
      */
-    ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty, Integer status, Integer auditStatus, Integer lowerAuditStatus, Integer shopAuditStatus, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty, Integer status, Integer auditStatus, Integer lowerAuditStatus, Integer shopAuditStatus, Integer sendStatus, Integer pageNum, Integer pageSize);
 
     /**
      * 更新授权状态
@@ -110,16 +110,4 @@ public interface AuthService {
      * 机构下拉框列表
      */
     ResponseJson<List<AuthVo>> getAuthSelectList(Integer authUserId);
-
-    /**
-     * 寄送机构授权牌
-     */
-    ResponseJson sendCertificate(Integer authId, String companyName, String companyCode, String logisticsNumber, JSONArray imageList, String remarks);
-
-    /**
-     * 寄送授权牌物流详情
-     * @param authId
-     * @return
-     */
-    ResponseJson certificateLogistics(Integer authId);
 }

+ 39 - 0
src/main/java/com/caimei/service/auth/LogisticsService.java

@@ -0,0 +1,39 @@
+package com.caimei.service.auth;
+
+import com.alibaba.fastjson.JSONArray;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.po.CmBrandAuthPo;
+import com.caimei.model.vo.AuthFormVo;
+import com.caimei.model.vo.AuthVo;
+import com.github.pagehelper.PageInfo;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2022/6/15
+ */
+public interface LogisticsService {
+
+    /**
+     * 寄送机构授权牌
+     */
+    ResponseJson sendCertificate(Integer authId, Integer companyId, String logisticsNumber, JSONArray imageList, String remarks);
+
+    /**
+     * 寄送授权牌物流详情
+     * @param authId
+     * @return
+     */
+    ResponseJson certificateLogistics(Integer authId);
+
+    /**
+     * 物流公司数据
+     * @return
+     */
+    ResponseJson getLogisticsCompany();
+}

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 42 - 1752
src/main/java/com/caimei/service/auth/impl/AddressServiceImpl.java


+ 11 - 2
src/main/java/com/caimei/service/auth/impl/AuthClubServiceImpl.java

@@ -135,13 +135,12 @@ public class AuthClubServiceImpl implements AuthClubService {
     }
 
     @Override
-    public ResponseJson saveClubUser(Integer clubUserId, Integer authUserId, String name, String mobile) {
+    public ResponseJson saveClubUser(Integer clubUserId, Integer authUserId, String mobile) {
         // 是否为添加操作
         boolean insertFlag = null == clubUserId;
         // 构建机构用户
         ClubUserPo clubUser = new ClubUserPo();
         clubUser.setAuthUserId(authUserId);
-        clubUser.setName(name);
         clubUser.setMobile(mobile);
         if (insertFlag) {
             // 根据手机号校验该机构下是否已添加该机构用户
@@ -151,7 +150,17 @@ public class AuthClubServiceImpl implements AuthClubService {
             }
             clubUser.setAddTime(new Date());
             clubUser.setPassword("rzt123456");
+            clubUser.setStatus(1);
             clubMapper.insertClubUser(clubUser);
+            String content = "您认证通登录密码为:rzt123456";
+            Boolean sendSms = SmsUtils.sendSms(11, mobile, content);
+            if (!sendSms) {
+                log.info("供应商添加机构用户-密码发送失败,手机号:" + mobile);
+                return ResponseJson.error("发送失败,请确认手机号无误");
+            } else {
+                log.info("供应商添加机构用户-密码发送成功,手机号:" + mobile);
+
+            }
         } else {
             clubUser.setId(clubUserId);
             clubMapper.updateClubUser(clubUser);

+ 138 - 86
src/main/java/com/caimei/service/auth/impl/AuthProductServiceImpl.java

@@ -2,6 +2,7 @@ package com.caimei.service.auth.impl;
 
 import com.aliyun.oss.OSS;
 import com.aliyun.oss.OSSClientBuilder;
+import com.caimei.mapper.cmMapper.AuthMapper;
 import com.caimei.mapper.cmMapper.AuthProductMapper;
 import com.caimei.mapper.cmMapper.ShopMapper;
 import com.caimei.model.ResponseJson;
@@ -50,6 +51,9 @@ public class AuthProductServiceImpl implements AuthProductService {
     @Resource
     private ShopMapper shopMapper;
 
+    @Resource
+    private AuthMapper authMapper;
+
     @Value("${caimei.imageDomain}")
     private String imageDomain;
 
@@ -116,11 +120,13 @@ public class AuthProductServiceImpl implements AuthProductService {
     }
 
     @Override
-    public ResponseJson saveProduct(ProductSaveDto productSaveDto, boolean importFlag, Integer source) throws IOException {
+    public ResponseJson saveProduct(ProductSaveDto productSaveDto, boolean importFlag) throws IOException {
         Integer productId = productSaveDto.getProductId();
         Integer authId = productSaveDto.getAuthId();
         Integer brandId = productSaveDto.getBrandId();
         Integer productTypeId = productSaveDto.getProductTypeId();
+        String productName = productSaveDto.getProductName();
+        String productImage = productSaveDto.getProductImage();
         String snCode = productSaveDto.getSnCode();
         String certificateImage = productSaveDto.getCertificateImage();
         Integer addQrCodeFlag = productSaveDto.getAddQrCodeFlag();
@@ -128,15 +134,23 @@ public class AuthProductServiceImpl implements AuthProductService {
         Integer createBy = productSaveDto.getCreateBy();
         String purchaseWay = productSaveDto.getPurchaseWay();
         String invoiceImage = productSaveDto.getInvoiceImage();
+        Integer source = null == productSaveDto.getSource() ? 1 : productSaveDto.getSource();
         List<ProductParamPo> paramList = productSaveDto.getParamList();
         if (null == authId) {
             return ResponseJson.error("参数异常,请输入授权id", null);
         }
+        AuthVo auth = authMapper.getAuthById(authId);
         if (null == brandId) {
             return ResponseJson.error("参数异常,请输入品牌id", null);
         }
-        if (null == productTypeId) {
-            return ResponseJson.error("参数异常,请输入设备分类id", null);
+        if (null == productTypeId && StringUtils.isEmpty(productName)) {
+            return ResponseJson.error("参数异常,请输入设备分类id或设备名称", null);
+        }
+        if (null == productTypeId && StringUtils.isNotEmpty(productName)) {
+            ProductTypePo productType = authProductMapper.getProductType(null, productName, auth.getAuthUserId());
+            if (null != productType) {
+                productTypeId = productType.getProductTypeId();
+            }
         }
         if (StringUtils.isBlank(snCode)) {
             return ResponseJson.error("参数异常,请输入商品SN码", null);
@@ -145,10 +159,10 @@ public class AuthProductServiceImpl implements AuthProductService {
         if (null != productIdBySnCode && !productIdBySnCode.equals(productId)) {
             return ResponseJson.error("参数异常,该商品SN码已存在,请重新输入", null);
         }
-        if (StringUtils.isBlank(certificateImage)) {
+        if (1 == source && StringUtils.isBlank(certificateImage)) {
             return ResponseJson.error("参数异常,请上传授权牌照", null);
         }
-        if (!importFlag) {
+        if (!importFlag && 1 == source) {
             if (null == addQrCodeFlag) {
                 return ResponseJson.error("参数异常,请选择是否生成二维码授权牌", null);
             }
@@ -169,8 +183,14 @@ public class AuthProductServiceImpl implements AuthProductService {
         product.setAuthId(authId);
         // 品牌id
         product.setBrandId(brandId);
-        // 商品名称
+        // 设备分类id
         product.setProductTypeId(productTypeId);
+        if (null == productTypeId) {
+            // 设备名称(仅机构添加新设备时使用)
+            product.setName(productName);
+            // 设备图片(仅机构添加新设备时使用)
+            product.setImage(productImage);
+        }
         // sn码
         product.setSnCode(snCode);
         // 授权牌照
@@ -192,14 +212,14 @@ public class AuthProductServiceImpl implements AuthProductService {
             product.setCreateBy(createBy);
             // 创建时间
             product.setCreateTime(new Date());
-            if (null == addQrCodeFlag || 0 == addQrCodeFlag) {
-                //授权牌照添加水印
+            /*if (1 == source && (null == addQrCodeFlag || 0 == addQrCodeFlag)) {
+                //授权牌照不添加二维码,直接添加水印
                 product.setPcCertificateImage(addWaterMark(product.getCertificateImage(), 1));
                 product.setAppletsCertificateImage(addWaterMark(product.getCertificateImage(), 2));
-            }
+            }*/
             // 插入授权商品
             authProductMapper.insertProduct(product);
-            if (null != addQrCodeFlag && 1 == addQrCodeFlag) {
+            /*if (1 == source && (null != addQrCodeFlag && 1 == addQrCodeFlag)) {
                 // 生成二维码授权牌
                 String addQrCodeImg = addQrCode(product.getCertificateImage(), product.getProductId(), addTemplateType);
                 product.setCertificateImage(addQrCodeImg);
@@ -208,79 +228,85 @@ public class AuthProductServiceImpl implements AuthProductService {
                 product.setAppletsCertificateImage(addWaterMark(addQrCodeImg, 2));
                 //更新授权牌照
                 authProductMapper.updateCertificateImage(product);
-            }
+            }*/
+            // 自动生成授权牌
+
         } else {
             // 商品id
             product.setProductId(productId);
-            ProductPo dbProduct = authProductMapper.getImageByProductId(productId);
-            // 数据库该商品授权牌是否添加二维码
-            Integer dbAddQrCodeFlag = dbProduct.getAddQrCodeFlag();
-            // 数据库该商品授权牌添加二维码模板
-            Integer dbAddTemplateType = dbProduct.getAddTemplateType();
-            // 授权牌照是否重新上传
-            boolean updateImageFlag = (StringUtils.isNotBlank(product.getCertificateImage()) && !product.getCertificateImage().equals(dbProduct.getCertificateImage())) || (StringUtils.isEmpty(dbProduct.getPcCertificateImage()) || StringUtils.isEmpty(dbProduct.getAppletsCertificateImage()));
-            boolean addQrCodeSign = false;
-            boolean addWaterMarkSign = false;
-            if (null != dbAddQrCodeFlag && 1 == dbAddQrCodeFlag) {
-                if (0 == addQrCodeFlag) {
-                    // 原本是,现在否
-                    if (updateImageFlag) {
-                        // 新上传图片,将原图片替换为当前图片,生成水印图片
-                        product.setOriginalCertificateImage(product.getCertificateImage());
-                        addWaterMarkSign = true;
-                    } else {
-                        // 原图片,将当前授权牌替换为原图,生成水印图片
-                        product.setCertificateImage(dbProduct.getOriginalCertificateImage());
-                        addWaterMarkSign = true;
-                    }
-                } else if (1 == addQrCodeFlag) {
-                    // 原本是,现在是
-                    if (updateImageFlag) {
-                        // 新上传图片,将原图片替换为当前图片,生成二维码授权牌,生成水印图片
-                        product.setOriginalCertificateImage(product.getCertificateImage());
-                        addQrCodeSign = true;
-                        addWaterMarkSign = true;
-                    } else if (!addTemplateType.equals(dbAddTemplateType)) {
-                        // 原图片,更改模板,将当前授权牌替换为原图,生成二维码授权牌,生成水印图片
-                        product.setCertificateImage(dbProduct.getOriginalCertificateImage());
-                        addQrCodeSign = true;
-                        addWaterMarkSign = true;
-                    }
-                    // else 原图片,不更改模板,不做更改
-                }
-            } else {
-                if (1 == addQrCodeFlag) {
-                    // 原本否,现在是
-                    if (updateImageFlag) {
-                        // 新上传图片,将原图片替换为当前图片,生成二维码授权牌,生成水印图片
-                        product.setOriginalCertificateImage(product.getCertificateImage());
-                        addQrCodeSign = true;
-                        addWaterMarkSign = true;
-                    } else {
-                        // 原图片,生成二维码授权牌,生成水印图片
-                        addQrCodeSign = true;
-                        addWaterMarkSign = true;
+            /*if (1 == source) {
+                ProductPo dbProduct = authProductMapper.getImageByProductId(productId);
+                // 数据库该商品授权牌是否添加二维码
+                Integer dbAddQrCodeFlag = dbProduct.getAddQrCodeFlag();
+                // 数据库该商品授权牌添加二维码模板
+                Integer dbAddTemplateType = dbProduct.getAddTemplateType();
+                // 授权牌照是否重新上传
+                boolean updateImageFlag = (StringUtils.isNotBlank(product.getCertificateImage()) && !product.getCertificateImage().equals(dbProduct.getCertificateImage())) || (StringUtils.isEmpty(dbProduct.getPcCertificateImage()) || StringUtils.isEmpty(dbProduct.getAppletsCertificateImage()));
+                boolean addQrCodeSign = false;
+                boolean addWaterMarkSign = false;
+                if (null != dbAddQrCodeFlag && 1 == dbAddQrCodeFlag) {
+                    if (0 == addQrCodeFlag) {
+                        // 原本是,现在否
+                        if (updateImageFlag) {
+                            // 新上传图片,将原图片替换为当前图片,生成水印图片
+                            product.setOriginalCertificateImage(product.getCertificateImage());
+                            addWaterMarkSign = true;
+                        } else {
+                            // 原图片,将当前授权牌替换为原图,生成水印图片
+                            product.setCertificateImage(dbProduct.getOriginalCertificateImage());
+                            addWaterMarkSign = true;
+                        }
+                    } else if (1 == addQrCodeFlag) {
+                        // 原本是,现在是
+                        if (updateImageFlag) {
+                            // 新上传图片,将原图片替换为当前图片,生成二维码授权牌,生成水印图片
+                            product.setOriginalCertificateImage(product.getCertificateImage());
+                            addQrCodeSign = true;
+                            addWaterMarkSign = true;
+                        } else if (!addTemplateType.equals(dbAddTemplateType)) {
+                            // 原图片,更改模板,将当前授权牌替换为原图,生成二维码授权牌,生成水印图片
+                            product.setCertificateImage(dbProduct.getOriginalCertificateImage());
+                            addQrCodeSign = true;
+                            addWaterMarkSign = true;
+                        }
+                        // else 原图片,不更改模板,不做更改
                     }
                 } else {
-                    // 原本否,现在否
-                    if (updateImageFlag) {
-                        // 新上传图片,将原图片替换为当前图片,生成二维码授权牌,生成水印图片
-                        product.setOriginalCertificateImage(product.getCertificateImage());
-                        addWaterMarkSign = true;
+                    if (1 == addQrCodeFlag) {
+                        // 原本否,现在是
+                        if (updateImageFlag) {
+                            // 新上传图片,将原图片替换为当前图片,生成二维码授权牌,生成水印图片
+                            product.setOriginalCertificateImage(product.getCertificateImage());
+                            addQrCodeSign = true;
+                            addWaterMarkSign = true;
+                        } else {
+                            // 原图片,生成二维码授权牌,生成水印图片
+                            addQrCodeSign = true;
+                            addWaterMarkSign = true;
+                        }
+                    } else {
+                        // 原本否,现在否
+                        if (updateImageFlag) {
+                            // 新上传图片,将原图片替换为当前图片,生成二维码授权牌,生成水印图片
+                            product.setOriginalCertificateImage(product.getCertificateImage());
+                            addWaterMarkSign = true;
+                        }
+                        // 原图片,不做更改
                     }
-                    // 原图片,不做更改
                 }
-            }
-            if (addQrCodeSign) {
-                // 生成二维码授权牌
-                String addQrCodeImg = addQrCode(product.getCertificateImage(), productId, addTemplateType);
-                product.setCertificateImage(addQrCodeImg);
-            }
-            if (addWaterMarkSign) {
-                //授权牌照添加水印
-                product.setPcCertificateImage(addWaterMark(product.getCertificateImage(), 1));
-                product.setAppletsCertificateImage(addWaterMark(product.getCertificateImage(), 2));
-            }
+                if (addQrCodeSign) {
+                    // 生成二维码授权牌
+                    String addQrCodeImg = addQrCode(product.getCertificateImage(), productId, addTemplateType);
+                    product.setCertificateImage(addQrCodeImg);
+                }
+                if (addWaterMarkSign) {
+                    //授权牌照添加水印
+                    product.setPcCertificateImage(addWaterMark(product.getCertificateImage(), 1));
+                    product.setAppletsCertificateImage(addWaterMark(product.getCertificateImage(), 2));
+                }
+            }*/
+            // 自动生成授权牌
+
             // 更新授权商品
             authProductMapper.updateProductByProductId(product);
         }
@@ -357,10 +383,10 @@ public class AuthProductServiceImpl implements AuthProductService {
         List<ProductPo> productList = authProductMapper.getAllImage();
         productList.forEach(product->{
             try {
-                if (StringUtils.isNotEmpty(product.getProductImage())) {
+                if (StringUtils.isNotEmpty(product.getImage())) {
                     //商品图片添加水印
-                    product.setPcImage(addWaterMark(product.getProductImage(), 1));
-                    product.setAppletsImage(addWaterMark(product.getProductImage(), 2));
+                    product.setPcImage(addWaterMark(product.getImage(), 1));
+                    product.setAppletsImage(addWaterMark(product.getImage(), 2));
                 }
                 if (StringUtils.isNotEmpty(product.getCertificateImage())) {
                     //授权牌照添加水印
@@ -400,18 +426,44 @@ public class AuthProductServiceImpl implements AuthProductService {
             authProductMapper.updateProductAuditStatus(productId, status, auditStatus, invalidReason, auditBy, auditTime);
         }
         if (2 == source) {
-            authProductMapper.updateProductShopAuditStatus(productId, auditStatus, invalidReason, auditTime);
+            // 获取设备信息
+            ProductPo product = authProductMapper.getProductPo(productId);
+            Integer productTypeId = product.getProductTypeId();
+            if (1 == auditStatus && null == productTypeId && StringUtils.isNotEmpty(product.getName()) && StringUtils.isNotEmpty(product.getImage())) {
+                // 新增设备分类
+                Integer authUserId = authProductMapper.getAuthUserIdByProductId(productId);
+                // 查询设备分类是否已存在
+                ProductTypePo productType = authProductMapper.getProductType(null, product.getName(), authUserId);
+                if (null == productType) {
+                    try {
+                        ResponseJson<ProductTypePo> result = saveProductType(null, authUserId, product.getName(), product.getImage(), null);
+                        int code = result.getCode();
+                        if (0 == code) {
+                            productType = result.getData();
+                            productTypeId = productType.getProductTypeId();
+                            // 设备分类直接审核通过
+                            auditProductType(productTypeId, 1, null, auditBy);
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                } else {
+                    productTypeId = productType.getProductTypeId();
+                }
+            }
+            authProductMapper.updateProductShopAuditStatus(productId, productTypeId, auditStatus, invalidReason, auditTime);
         }
         return ResponseJson.success("审核商品成功");
     }
 
     @Override
-    public ResponseJson<PageInfo<WxProductListVo>> getWxProductList(Integer productTypeId, String snCode, Integer pageNum, Integer pageSize) {
-        if (null == productTypeId) {
+    public ResponseJson<PageInfo<WxProductListVo>> getWxProductList(Integer listType, Integer authId, Integer productTypeId, String snCode, Integer pageNum, Integer pageSize) {
+        listType = null == listType ? 1 : listType;
+        if (1 == listType && null == productTypeId) {
             return ResponseJson.error("参数异常,请输入设备分类id", null);
         }
         PageHelper.startPage(pageNum, pageSize);
-        List<WxProductListVo> productList = authProductMapper.getWxProductList(productTypeId, snCode);
+        List<WxProductListVo> productList = authProductMapper.getWxProductList(listType, authId, productTypeId, snCode);
         PageInfo<WxProductListVo> pageData = new PageInfo<>(productList);
         return ResponseJson.success(pageData);
     }
@@ -439,7 +491,7 @@ public class AuthProductServiceImpl implements AuthProductService {
     }
 
     @Override
-    public ResponseJson saveProductType(Integer productTypeId, Integer authUserId, String name, String image, Integer createBy) throws IOException {
+    public ResponseJson<ProductTypePo> saveProductType(Integer productTypeId, Integer authUserId, String name, String image, Integer createBy) throws IOException {
         // 是否为添加操作
         boolean insertFlag = null == productTypeId;
         /*
@@ -467,7 +519,7 @@ public class AuthProductServiceImpl implements AuthProductService {
         } else {
             // 设备分类id
             productType.setProductTypeId(productTypeId);
-            ProductTypePo dbProductType = authProductMapper.getProductType(productTypeId);
+            ProductTypePo dbProductType = authProductMapper.getProductType(productTypeId, null, null);
             // 设备分类图片是否重新上传
             boolean updateImageFlag = (StringUtils.isNotBlank(productType.getImage()) && !productType.getImage().equals(dbProductType.getImage()))
                     || (StringUtils.isEmpty(productType.getPcImage()) || StringUtils.isEmpty(productType.getAppletsImage()));
@@ -479,7 +531,7 @@ public class AuthProductServiceImpl implements AuthProductService {
             // 更新设备分类
             authProductMapper.updateProductType(productType);
         }
-        return ResponseJson.success("保存设备分类成功");
+        return ResponseJson.success("保存设备分类成功", productType);
     }
 
     @Override

+ 9 - 44
src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java

@@ -90,14 +90,14 @@ public class AuthServiceImpl implements AuthService {
     @Override
     public ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty,
                                                       Integer status, Integer auditStatus, Integer lowerAuditStatus,
-                                                      Integer shopAuditStatus,
+                                                      Integer shopAuditStatus, Integer sendStatus,
                                                       Integer pageNum, Integer pageSize) {
         if (null == authUserId) {
             return ResponseJson.error("参数异常,请输入供应商用户id", null);
         }
         listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
-        List<AuthVo> authList = authMapper.getAuthList(listType, authUserId, authParty, status, auditStatus, lowerAuditStatus, shopAuditStatus);
+        List<AuthVo> authList = authMapper.getAuthList(listType, authUserId, authParty, status, auditStatus, lowerAuditStatus, shopAuditStatus, sendStatus);
         PageInfo<AuthVo> pageData = new PageInfo<>(authList);
         return ResponseJson.success(pageData);
     }
@@ -153,47 +153,10 @@ public class AuthServiceImpl implements AuthService {
 
     @Override
     public ResponseJson<List<AuthVo>> getAuthSelectList(Integer authUserId) {
-        List<AuthVo> authList = authMapper.getAuthList(1, authUserId, null, null, null, null, null);
+        List<AuthVo> authList = authMapper.getAuthList(1, authUserId, null, null, null, null, null, null);
         return ResponseJson.success(authList);
     }
 
-    @Override
-    public ResponseJson sendCertificate(Integer authId, String companyName, String companyCode, String logisticsNumber, JSONArray imageList, String remarks) {
-        CertificateLogisticsPo logistics = new CertificateLogisticsPo();
-        logistics.setAuthId(authId);
-        logistics.setCompanyName(companyName);
-        logistics.setCompanyCode(companyCode);
-        logistics.setLogisticsNumber(logisticsNumber);
-        logistics.setRemarks(remarks);
-        String imageRemarks = "";
-        if (null != imageList){
-            String[] imagePath = new String[imageList.size()];
-            for (int i = 0; i < imagePath.length; i++) {
-                imagePath[i] = imageList.get(i).toString();
-            }
-            imageRemarks = StringUtils.join(imagePath, "##");
-        }
-        logistics.setRemarksImage(imageRemarks);
-        logistics.setType(4);
-        logistics.setState(1);
-        logistics.setUpdateDate(new Date());
-        authMapper.sendCertificate(logistics);
-        // 更改机构寄送状态
-        authMapper.updateSendStatus(authId);
-        return ResponseJson.success("寄送成功");
-    }
-
-    @Override
-    public ResponseJson certificateLogistics(Integer authId) {
-        CertificateLogisticsVo certificateLogistics = authMapper.getCertificateLogistics(authId);
-        String[] imageArr = certificateLogistics.getRemarksImage().split("##");
-        List<String> imageList = Arrays.asList(imageArr);
-        certificateLogistics.setImageList(imageList);
-        List<RouterVo> routers = JSONArray.parseArray(certificateLogistics.getInfo(), RouterVo.class);
-        certificateLogistics.setRouterList(routers);
-        return ResponseJson.success(certificateLogistics);
-    }
-
     @Override
     public ResponseJson saveAuth(CmBrandAuthPo auth, List<String> bannerList, boolean importFlag, Integer source) {
         Integer authId = auth.getId();
@@ -205,10 +168,10 @@ public class AuthServiceImpl implements AuthService {
         if (StringUtils.isBlank(authParty)) {
             return ResponseJson.error("参数异常,请输入授权机构名称");
         }
-        Integer authIdByAuthParty = authMapper.getAuthIdByAuthParty(authParty, authUserId);
+        /*Integer authIdByAuthParty = authMapper.getAuthIdByAuthParty(authParty, authUserId);
         if (null != authIdByAuthParty && !authIdByAuthParty.equals(authId)) {
             return ResponseJson.error("参数异常,该授权机构已存在,请重新输入");
-        }
+        }*/
         if (null == auth.getFirstClubType()) {
             return ResponseJson.error("请勾选机构类型");
         }
@@ -221,7 +184,7 @@ public class AuthServiceImpl implements AuthService {
         if (null == auth.getEmpNum()) {
             return ResponseJson.error("请输入员工人数");
         }
-        if (null == auth.getCreateBy()) {
+        if (1 == source && null == auth.getCreateBy()) {
             return ResponseJson.error("参数异常,请输入创建人id");
         }
         if (!importFlag) {
@@ -275,6 +238,7 @@ public class AuthServiceImpl implements AuthService {
         Date auditTime = new Date();
         // 授权状态更新
         Integer status = null;
+
         if (auditStatus == 0) {
             // 审核不通过,下线授权
             status = 0;
@@ -647,7 +611,8 @@ public class AuthServiceImpl implements AuthService {
                     String certificateImage = productDto.getCertificateImage();
                     productDto.setProductImage(productImage);
                     productDto.setCertificateImage(certificateImage);
-                    authProductService.saveProduct(productDto, true, 1);
+                    productDto.setSource(1);
+                    authProductService.saveProduct(productDto, true);
                 } catch (IOException e) {
                     e.printStackTrace();
                 }

+ 4 - 2
src/main/java/com/caimei/service/auth/impl/DownloadServiceImpl.java

@@ -72,7 +72,7 @@ public class DownloadServiceImpl implements DownloadService {
                 file.setFileName(productImage.getAuthParty() + "-" + productImage.getSnCode());
                 fileList.add(file);
             });
-        } else {
+        } else if (2 == type) {
             productImageList.forEach(productImage -> {
                 String qrCodeLink = wwwServer + "/product/auth/product-" + productImage.getProductId() + ".html";
                 // 生成二维码
@@ -84,8 +84,10 @@ public class DownloadServiceImpl implements DownloadService {
                 file.setFileName(productImage.getAuthParty() + "-" + productImage.getSnCode());
                 fileList.add(file);
             });
+        } else {
+
         }
-        String fileName = 1 == type ? "授权牌" : "二维码";
+        String fileName = 1 == type ? "授权牌" : 2 == type ? "设备二维码" : "机构二维码";
         // 将授权牌压缩成zip文件
         String imageZipPath = uploadService.createImageZip(fileList);
         download(request, response, imageZipPath, fileName + ".zip");

+ 108 - 0
src/main/java/com/caimei/service/auth/impl/LogisticsServiceImpl.java

@@ -0,0 +1,108 @@
+package com.caimei.service.auth.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.caimei.config.FastDfsClient;
+import com.caimei.mapper.cmMapper.AuthMapper;
+import com.caimei.mapper.cmMapper.AuthProductMapper;
+import com.caimei.mapper.cmMapper.LogisticsMapper;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.dto.ProductSaveDto;
+import com.caimei.model.po.*;
+import com.caimei.model.vo.*;
+import com.caimei.service.auth.*;
+import com.caimei.utils.ExcelOperateUtil;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.github.tobato.fastdfs.service.FastFileStorageClient;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.*;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletResponse;
+import java.awt.image.BufferedImage;
+import java.io.*;
+import java.math.BigDecimal;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/5/11
+ */
+@Slf4j
+@Service
+public class LogisticsServiceImpl implements LogisticsService {
+
+    @Resource
+    private LogisticsMapper logisticsMapper;
+
+    @Resource
+    private AuthMapper authMapper;
+
+    @Value("${spring.profiles.active}")
+    private String active;
+
+    @Value("${caimei.imageDomain}")
+    private String imageDomain;
+
+    @Override
+    public ResponseJson sendCertificate(Integer authId, Integer companyId, String logisticsNumber, JSONArray imageList, String remarks) {
+        List<LogisticsCompanyVo> logisticsCompanyList = logisticsMapper.getLogisticsCompanyList(companyId);
+        if (null == logisticsCompanyList || logisticsCompanyList.size() == 0) {
+            return ResponseJson.error("物流公司不存在");
+        }
+        LogisticsCompanyVo logisticsCompany = logisticsCompanyList.get(0);
+        CertificateLogisticsPo logistics = new CertificateLogisticsPo();
+        logistics.setAuthId(authId);
+        logistics.setCompanyName(logisticsCompany.getCompanyName());
+        logistics.setCompanyCode(logisticsCompany.getCompanyCode());
+        logistics.setLogisticsNumber(logisticsNumber);
+        logistics.setRemarks(remarks);
+        String imageRemarks = "";
+        if (null != imageList){
+            String[] imagePath = new String[imageList.size()];
+            for (int i = 0; i < imagePath.length; i++) {
+                imagePath[i] = imageList.get(i).toString();
+            }
+            imageRemarks = StringUtils.join(imagePath, "##");
+        }
+        logistics.setRemarksImage(imageRemarks);
+        logistics.setType(4);
+        logistics.setState(1);
+        logistics.setUpdateDate(new Date());
+        logisticsMapper.sendCertificate(logistics);
+        // 更改机构寄送状态
+        authMapper.updateSendStatus(authId);
+        return ResponseJson.success("寄送成功");
+    }
+
+    @Override
+    public ResponseJson certificateLogistics(Integer authId) {
+        CertificateLogisticsVo certificateLogistics = logisticsMapper.getCertificateLogistics(authId);
+        String[] imageArr = certificateLogistics.getRemarksImage().split("##");
+        List<String> imageList = Arrays.asList(imageArr);
+        certificateLogistics.setImageList(imageList);
+        List<RouterVo> routers = JSONArray.parseArray(certificateLogistics.getInfo(), RouterVo.class);
+        certificateLogistics.setRouterList(routers);
+        return ResponseJson.success(certificateLogistics);
+    }
+
+    @Override
+    public ResponseJson getLogisticsCompany() {
+        List<LogisticsCompanyVo> logisticsCompanyList = logisticsMapper.getLogisticsCompanyList(null);
+        return ResponseJson.success(logisticsCompanyList);
+    }
+}

+ 1 - 1
src/main/java/com/caimei/service/wechat/RegisterService.java

@@ -14,7 +14,7 @@ public interface RegisterService {
     /**
      * 普通注册
      */
-    ResponseJson<WxClubUserVo> simpleRegister(String mobile, String verifyCode, String password, Integer authUserId, String authParty);
+    ResponseJson<WxClubUserVo> simpleRegister(String mobile, String verifyCode, String password, Integer authUserId, Integer authId);
 
     /**
      * 全部注册

+ 1 - 1
src/main/java/com/caimei/service/wechat/WxUserService.java

@@ -20,7 +20,7 @@ public interface WxUserService {
      * @param authUserId
      * @return
      */
-    ResponseJson<Map<String, Object>> getUserInfo(String mobile, Integer authUserId, Integer clubUserId);
+    ResponseJson<Map<String, Object>> getUserInfo(String mobile, Integer authUserId, Integer clubUserId, Integer authId);
 
 
     /**

+ 2 - 1
src/main/java/com/caimei/service/wechat/impl/LoginServiceImpl.java

@@ -212,8 +212,9 @@ public class LoginServiceImpl implements LoginService {
         if (null == clubUser) {
             return ResponseJson.error("用户不存在", null);
         } else {
+            String dbPassword = clubMapper.getDbPassword(clubUser.getClubUserId());
             // 比对密码
-            passwordVerify = passwordVerify(password, password);
+            passwordVerify = passwordVerify(password, dbPassword);
             if (passwordVerify) {
                 // 登录成功redis保存token
                 String accessToken = UUID.randomUUID().toString();

+ 40 - 19
src/main/java/com/caimei/service/wechat/impl/RegisterServiceImpl.java

@@ -9,7 +9,6 @@ import com.caimei.model.dto.ProductSaveDto;
 import com.caimei.model.po.ClubUserPo;
 import com.caimei.model.po.CmBrandAuthPo;
 import com.caimei.model.vo.AuthFormVo;
-import com.caimei.model.vo.AuthVo;
 import com.caimei.model.vo.WxClubUserVo;
 import com.caimei.service.auth.AuthProductService;
 import com.caimei.service.auth.AuthService;
@@ -48,32 +47,41 @@ public class RegisterServiceImpl implements RegisterService {
     private AuthProductService authProductService;
 
     @Override
-    public ResponseJson<WxClubUserVo> simpleRegister(String mobile, String verifyCode, String password, Integer authUserId, String authParty) {
+    public ResponseJson<WxClubUserVo> simpleRegister(String mobile, String verifyCode, String password, Integer authUserId, Integer authId) {
         // 校验手机号
         WxClubUserVo clubUserVo = clubMapper.getWxClubUser(mobile, null, authUserId, null, null);
         if (null != clubUserVo) {
             return ResponseJson.error(-2, "抱歉,该手机号已注册!", null);
         }
         // 手机号是否有对应的机构
-        AuthFormVo auth = authMapper.getAuthByUserMobile(mobile, authUserId);
-        if (null != auth && !authParty.equals(auth.getAuthParty())) {
-            return ResponseJson.error("机构名称不一致,请确认机构名称", null);
-        }
+        AuthFormVo auth = null;
+        if (null != authId) {
+            auth = authMapper.getAuthBaseInfo(null, authId);
+        }/* else {
+            auth = authMapper.getAuthBaseInfo(mobile, authUserId, null);
+        }*/
         // 校验验证码是否正确
         String redisVerifyCode = null == redisService.get("code:" + mobile) ? null : redisService.get("code:" + mobile).toString();
-        if (!verifyCode.equals(redisVerifyCode)) {
+        /*if (!verifyCode.equals(redisVerifyCode)) {
             return ResponseJson.error("验证码错误,请重新输入", null);
-        }
+        }*/
         String md5Password = Md5Util.md5(password);
         /*
          * 构建机构用户数据
          */
         ClubUserPo clubUser = new ClubUserPo();
         clubUser.setAuthUserId(authUserId);
+        clubUser.setMobile(mobile);
         if (null != auth) {
             clubUser.setAuthId(auth.getAuthId());
+            clubUser.setName(auth.getAuthParty());
+            // 是否已有其他账号绑定该机构
+            WxClubUserVo oldUser = clubMapper.getWxClubUser(null, null, null, auth.getAuthId(), null);
+            if (null != oldUser) {
+                // 解绑
+                clubMapper.unbindAuthId(oldUser.getClubUserId());
+            }
         }
-        clubUser.setName(authParty);
         clubUser.setStatus(1);
         clubUser.setPassword(md5Password);
         clubUser.setAddTime(new Date());
@@ -93,10 +101,14 @@ public class RegisterServiceImpl implements RegisterService {
             String mobile = (String) clubUserMap.get("mobile");
             String verifyCode = (String) clubUserMap.get("verifyCode");
             String password = (String) clubUserMap.get("password");
-            String authParty = (String) clubUserMap.get("authParty");
-            ResponseJson<WxClubUserVo> result = simpleRegister(mobile, verifyCode, password, authUserId, authParty);
-            WxClubUserVo clubUser = result.getData();
-            clubUserId = clubUser.getClubUserId();
+            ResponseJson<WxClubUserVo> result = simpleRegister(mobile, verifyCode, password, authUserId, authId);
+            int code = result.getCode();
+            if (0 != code) {
+                return result;
+            } else {
+                WxClubUserVo data = result.getData();
+                clubUserId = data.getClubUserId();
+            }
         }
         if (registerType.contains("2")) {
             if (StringUtils.isEmpty(authInfo)) {
@@ -105,6 +117,7 @@ public class RegisterServiceImpl implements RegisterService {
                 return ResponseJson.error("认证机构数据异常");
             }
             CmBrandAuthPo auth = JSONObject.parseObject(authInfo, CmBrandAuthPo.class);
+            auth.setAuthUserId(authUserId);
             JSONObject authMap = JSONObject.parseObject(authInfo);
             String lngAndLat = authMap.getString("lngAndLat");
             if (StringUtils.isEmpty(lngAndLat)) {
@@ -125,7 +138,7 @@ public class RegisterServiceImpl implements RegisterService {
                 authId = data.getId();
             }
             // 保存机构用户对应的机构id
-            clubMapper.updateAuthId(clubUserId, authId);
+            clubMapper.bindAuthId(clubUserId, authId);
         }
         if (registerType.contains("3")) {
             if (StringUtils.isEmpty(productInfo)) {
@@ -133,11 +146,19 @@ public class RegisterServiceImpl implements RegisterService {
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return ResponseJson.error("认证设备数据异常");
             }
-            ProductSaveDto productSaveDto = JSONObject.parseObject(productInfo, ProductSaveDto.class);
-            productSaveDto.setAuthId(authId);
-            try {
-                authProductService.saveProduct(productSaveDto, false, 1);
-            } catch (Exception e) {
+            List<ProductSaveDto> productList = JSONObject.parseArray(productInfo, ProductSaveDto.class);
+            try{
+                for (ProductSaveDto product : productList) {
+                    product.setAuthId(authId);
+                    product.setSource(2);
+                    ResponseJson result = authProductService.saveProduct(product, false);
+                    if (0 != result.getCode()) {
+                        // 设置手动回滚事务
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                        return ResponseJson.error(result);
+                    }
+                }
+            }catch (Exception e) {
                 // 设置手动回滚事务
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return ResponseJson.error("保存认证设备失败");

+ 13 - 19
src/main/java/com/caimei/service/wechat/impl/WxUserServiceImpl.java

@@ -4,8 +4,6 @@ import com.caimei.components.RedisService;
 import com.caimei.mapper.cmMapper.*;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.vo.AuthFormVo;
-import com.caimei.model.vo.AuthVo;
-import com.caimei.model.vo.ProductListVo;
 import com.caimei.model.vo.WxClubUserVo;
 import com.caimei.service.wechat.WxUserService;
 import com.caimei.utils.CodeUtil;
@@ -16,7 +14,6 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -32,32 +29,25 @@ public class WxUserServiceImpl implements WxUserService {
     @Resource
     private RedisService redisService;
     @Resource
-    private LoginMapper loginMapper;
-    @Resource
-    private ShopMapper shopMapper;
-    @Resource
     private ClubMapper clubMapper;
     @Resource
     private AuthMapper authMapper;
-    @Resource
-    private AuthProductMapper authProductMapper;
 
 
     @Override
-    public ResponseJson<Map<String, Object>> getUserInfo(String mobile, Integer authUserId, Integer clubUserId) {
+    public ResponseJson<Map<String, Object>> getUserInfo(String mobile, Integer authUserId, Integer clubUserId, Integer authId) {
         HashMap<String, Object> map = new HashMap<>(2);
         // 机构用户
         WxClubUserVo clubUser = clubMapper.getWxClubUser(mobile, null, authUserId, null, clubUserId);
         // 授权机构
         AuthFormVo auth = null;
-        if (null == clubUser) {
-            // 机构用户未注册,查询手机号对应的已认证机构
-            auth = authMapper.getAuthByUserMobile(mobile, authUserId);
-        } else {
-            // 机构用户已注册
-            if (null != clubUser.getAuthId()) {
-                auth = authMapper.getAuthFormById(clubUser.getAuthId());
-            }
+
+        // 机构用户已注册
+        if (null != clubUser && null != clubUser.getAuthId()) {
+            auth = authMapper.getAuthBaseInfo(authUserId, clubUser.getAuthId());
+        }
+        if (null != authId) {
+            auth = authMapper.getAuthBaseInfo(authUserId, authId);
         }
         map.put("clubUser", clubUser);
         map.put("auth", auth);
@@ -84,7 +74,11 @@ public class WxUserServiceImpl implements WxUserService {
             log.info(msgType + "验证码发送成功,手机号:" + mobile + ",验证码:" + verifyCode);
         }
         log.info(content);
-        redisService.set("code:" + mobile, verifyCode, 300L);
+        long expireTime = 300L;
+        if (1 == type) {
+            expireTime = 60 * 20L;
+        }
+        redisService.set("code:" + mobile, verifyCode, expireTime);
         return ResponseJson.success("发送成功");
     }
 

+ 1 - 1
src/main/resources/config/dev/application-dev.yml

@@ -66,7 +66,7 @@ caimei:
   zplmapi: http://192.168.2.68:8012
   #图片服务器
   imageDomain: http://192.168.2.100
-  core: http://localhost:18002
+  core: http://192.168.2.100:18002
   #公众号
   appid: wx6512b1dfb84c28e1
   secret: 10f94918f59f630351319382bb29cab1

+ 46 - 40
src/main/resources/mapper/AuthMapper.xml

@@ -13,12 +13,6 @@
         insert into cm_brand_auth_banner (authId, banner)
         VALUES (#{authId}, #{banner})
     </insert>
-    <insert id="sendCertificate">
-        insert into logistics_information (type, authId, nu, state, logisticsCompanyName, logisticsCompanyCode,
-                                           updateDate, remarks, remarksImage)
-        values (#{type}, #{authId}, #{logisticsNumber}, #{state}, #{companyName}, #{companyCode}, #{updateDate},
-                #{remarks}, #{remarksImage})
-    </insert>
     <update id="updateAuthStatusByAuthId">
         update cm_brand_auth
         set status = #{status}
@@ -26,23 +20,25 @@
     </update>
     <update id="updateAuthByAuthId">
         update cm_brand_auth
-        set authParty       = #{authParty},
-            provinceId      = #{provinceId},
-            cityId          = #{cityId},
-            townId          = #{townId},
-            address         = #{address},
-            lng             = #{lng},
-            lat             = #{lat},
-            mobile          = #{mobile},
-            userMobile      = #{userMobile},
-            firstClubType   = #{firstClubType},
-            secondClubType  = #{secondClubType},
-            logo            = #{logo},
-            customFlag      = #{customFlag},
-            remarks         = #{remarks},
-            status          = #{status},
-            auditStatus     = #{auditStatus},
-            shopAuditStatus = #{shopAuditStatus}
+        set authParty           = #{authParty},
+            provinceId          = #{provinceId},
+            cityId              = #{cityId},
+            townId              = #{townId},
+            address             = #{address},
+            lng                 = #{lng},
+            lat                 = #{lat},
+            mobile              = #{mobile},
+            userMobile          = #{userMobile},
+            firstClubType       = #{firstClubType},
+            secondClubType      = #{secondClubType},
+            medicalLicenseImage = #{medicalLicenseImage},
+            empNum              = #{empNum},
+            logo                = #{logo},
+            customFlag          = #{customFlag},
+            remarks             = #{remarks},
+            status              = #{status},
+            auditStatus         = #{auditStatus},
+            shopAuditStatus     = #{shopAuditStatus}
         where id = #{id}
     </update>
     <update id="updateAuthAuditStatus">
@@ -62,9 +58,12 @@
     </update>
     <update id="updateAuthShopAuditStatus">
         update cm_brand_auth
-        set shopAuditStatus   = #{shopAuditStatus},
-            shopInvalidReason = #{shopInvalidReason},
-            shopAuditTime     = #{shopAuditTime}
+        set shopAuditStatus = #{shopAuditStatus},
+        <if test="0 == shopAuditStatus">
+            auditStatus = #{shopAuditStatus},
+        </if>
+        shopInvalidReason = #{shopInvalidReason},
+        shopAuditTime = #{shopAuditTime}
         where id = #{authId}
     </update>
     <update id="updateSendStatus">
@@ -77,14 +76,14 @@
     </delete>
     <select id="getAuthList" resultType="com.caimei.model.vo.AuthVo">
         select id as authId, authParty, a.status, a.auditStatus, a.shopAuditStatus, a.createTime, cu.name as createBy,
-            au.name as auditBy,a.auditTime,a.invalidReason,
+            au.name as auditBy,a.auditTime,a.invalidReason,a.sendStatus,
             ifnull(ap.waitAuditNum,0) as waitAuditNum,
             ifnull(bp.waitAuditNum,0) as shopWaitAuditNum,
             if(ifnull(ap.waitAuditNum,0)>0,0,1) as lowerAuditStatus
         from cm_brand_auth a
         left join cm_brand_auth_user cu on a.createBy = cu.authUserId
         left join cm_brand_auth_user au on a.auditBy = au.authUserId
-        left join (select authId,count(*) as waitAuditNum from cm_brand_auth_product where auditStatus = 2 group by
+        left join (select authId,count(*) as waitAuditNum from cm_brand_auth_product where auditStatus = 2 and shopAuditStatus = 1 group by
             authId) ap on a.id = ap.authId
         left join (select authId,count(*) as waitAuditNum from cm_brand_auth_product where shopAuditStatus = 2 group by
             authId) bp on a.id = bp.authId
@@ -112,6 +111,14 @@
                 and (a.shopAuditStatus = 0 or a.shopAuditStatus = 1 or ifnull(bp.waitAuditNum,0) > 0)
             </if>
         </if>
+        <if test="sendStatus != null">
+            <if test="0 == sendStatus">
+                and a.sendStatus != 1
+            </if>
+            <if test="1 == sendStatus">
+                and a.sendStatus = 1
+            </if>
+        </if>
         <if test="lowerAuditStatus != null">
             <if test="0 == lowerAuditStatus">
                 and ifnull(ap.waitAuditNum,0) > 0
@@ -206,11 +213,17 @@
     <select id="getProvinceIdByCityId" resultType="java.lang.Integer">
         select provinceID from city where cityID = #{cityId}
     </select>
-    <select id="getAuthByUserMobile" resultType="com.caimei.model.vo.AuthFormVo">
-        select id as authId, authParty
+    <select id="getAuthBaseInfo" resultType="com.caimei.model.vo.AuthFormVo">
+        select id as authId, authParty, auditStatus, shopAuditStatus
         from cm_brand_auth
-        where authUserId = #{authUserId}
-          and userMobile = #{mobile}
+        <where>
+            <if test="authUserId != null">
+                and authUserId = #{authUserId}
+            </if>
+            <if test="authId != null">
+                and id = #{authId}
+            </if>
+        </where>
     </select>
     <select id="getAuthById" resultType="com.caimei.model.vo.AuthVo">
         select id      as authId,
@@ -251,20 +264,13 @@
                remarks,
                status,
                auditStatus,
-               shopAuditStatus,
-               shopInvalidReason
+               if(shopAuditStatus = 0,shopInvalidReason,invalidReason) as invalidReason
         from cm_brand_auth a
                  left join province p on a.provinceId = p.provinceID
                  left join city c on a.cityId = c.cityID
                  left join town t on a.townId = t.townID
         where id = #{authId}
     </select>
-    <select id="getCertificateLogistics" resultType="com.caimei.model.vo.CertificateLogisticsVo">
-        select a.authParty, logisticsCompanyName as companyName, logisticsCompanyCode as companyCode, nu as logisticsNumber,
-               state, info, remarksImage, li.remarks, updateDate
-               from logistics_information li left join cm_brand_auth a on li.authId = a.id
-        where authId = #{authId}
-    </select>
     <select id="getTownNames" resultType="java.lang.String">
         select name from town
     </select>

+ 73 - 26
src/main/resources/mapper/AuthProductMapper.xml

@@ -2,12 +2,12 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.mapper.cmMapper.AuthProductMapper">
     <insert id="insertProduct" keyColumn="id" keyProperty="productId" useGeneratedKeys="true" parameterType="com.caimei.model.po.ProductPo">
-        insert into cm_brand_auth_product(`authId`, `brandId`, `productTypeId`, `snCode`,
+        insert into cm_brand_auth_product(`authId`, `brandId`, `productTypeId`, `snCode`, name, image,
                                           `originalCertificateImage`, `certificateImage`, `pcCertificateImage`,
                                           `appletsCertificateImage`, `addQrCodeFlag`, `addTemplateType`,
                                           purchaseWay, invoiceImage, `status`,
                                           `auditStatus`, shopAuditStatus, `createTime`, `createBy`)
-        values (#{authId}, #{brandId}, #{productTypeId}, #{snCode},
+        values (#{authId}, #{brandId}, #{productTypeId}, #{snCode}, #{name}, #{image},
                 #{originalCertificateImage}, #{certificateImage}, #{pcCertificateImage},
                 #{appletsCertificateImage}, #{addQrCodeFlag}, #{addTemplateType},
                 #{purchaseWay}, #{invoiceImage}, #{status},
@@ -17,7 +17,7 @@
         insert into cm_brand_product_param (`productId`, `name`, `content`)
         values (#{productId}, #{paramName}, #{paramContent})
     </insert>
-    <insert id="insertProductType">
+    <insert id="insertProductType" keyColumn="id" keyProperty="productTypeId" useGeneratedKeys="true" parameterType="com.caimei.model.po.ProductTypePo">
         insert into cm_brand_product_type (authUserId, name, image, pcImage, appletsImage, status, auditStatus, createBy, createTime, delFlag)
         values (#{authUserId}, #{name}, #{image}, #{pcImage}, #{appletsImage}, #{status}, #{auditStatus}, #{createBy}, #{createTime}, 0)
     </insert>
@@ -116,9 +116,17 @@
     </update>
     <update id="updateProductShopAuditStatus">
         update cm_brand_auth_product
-        set shopAuditStatus   = #{shopAuditStatus},
-            shopInvalidReason = #{shopInvalidReason},
-            shopAuditTime     = #{shopAuditTime}
+        set shopAuditStatus = #{shopAuditStatus},
+        <if test="0 == shopAuditStatus">
+            auditStatus = #{shopAuditStatus},
+        </if>
+        shopInvalidReason = #{shopInvalidReason},
+        <if test="productTypeId != null">
+            productTypeId = #{productTypeId},
+            name = null,
+            image = null,
+        </if>
+        shopAuditTime = #{shopAuditTime}
         where id = #{productId}
     </update>
     <select id="getProductList" resultType="com.caimei.model.vo.ProductListVo">
@@ -139,7 +147,10 @@
             and p.status = #{status}
         </if>
         <if test="auditStatus != null">
-            and p.auditStatus = #{auditStatus} and p.shopAuditStatus = 1
+            and p.auditStatus = #{auditStatus}
+        </if>
+        <if test="2 == listType">
+            and p.shopAuditStatus = 1
         </if>
         <if test="shopAuditStatus != null">
             <if test="0 == shopAuditStatus">
@@ -168,10 +179,11 @@
         select p.`id`    as productId,
                `authId`,
                `brandId`,
+               cb.name as brandName,
                p.productTypeId,
-               t.name  as productName,
+               if(p.productTypeId is null, p.name, t.name) as productName,
                `snCode`,
-               t.`image` as productImage,
+               if(p.productTypeId is null, p.image, t.image) as productImage,
                `certificateImage`,
                `originalCertificateImage`,
                addQrCodeFlag,
@@ -179,10 +191,11 @@
                purchaseWay,
                invoiceImage,
                p.`status`,
-               p.shopAuditStatus,
-               p.shopInvalidReason
+               p.auditStatus,
+               if(shopAuditStatus = 0,shopInvalidReason,p.invalidReason) as invalidReason
         from cm_brand_auth_product p
                  left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
+                 left join cm_brand cb on p.brandId = cb.id
         where p.id = #{productId}
     </select>
     <select id="getParamsByProductId" resultType="com.caimei.model.po.ProductParamPo">
@@ -210,7 +223,7 @@
     </select>
     <select id="getAllImage" resultType="com.caimei.model.po.ProductPo">
         select id as productId,
-               image as productImage,
+               image,
                pcImage,
                appletsImage,
                certificateImage,
@@ -219,23 +232,35 @@
         from cm_brand_auth_product
     </select>
     <select id="getWxProductList" resultType="com.caimei.model.vo.WxProductListVo">
-        select p.id as productId,p.authId, t.name as productName,p.snCode,t.image as productImage,a.authParty as
-        clubName
+        select p.id as productId,
+        p.authId,
+        if(p.productTypeId is null,p.name,t.name) as productName,
+        p.snCode,
+        if(p.productTypeId is null,p.image,t.image) as productImage,
+        a.authParty as clubName,
+        p.auditStatus
         from cm_brand_auth_product p
         left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
         left join cm_brand_auth a on p.authId = a.id
         left join cm_brand_auth_user au on a.authUserId = au.authUserId
-        where p.productTypeId = #{productTypeId}
-        <if test="snCode != null and snCode != ''">
-            and p.snCode like concat('%',#{snCode})
-        </if>
-        and au.status = 1
-        and a.status = 1
-        and a.auditStatus = 1
-        and p.status = 1
-        and p.auditStatus = 1
-        and t.status = 1
-        and t.auditStatus = 1
+        <where>
+            <if test="listType == 1">
+                and p.productTypeId = #{productTypeId}
+                and au.status = 1
+                and a.status = 1
+                and a.auditStatus = 1
+                and p.status = 1
+                and p.auditStatus = 1
+                and t.status = 1
+                and t.auditStatus = 1
+            </if>
+            <if test="snCode != null and snCode != ''">
+                and p.snCode like concat('%',#{snCode})
+            </if>
+            <if test="authId != null">
+                and p.authId = #{authId}
+            </if>
+        </where>
         order by p.createTime desc
     </select>
     <select id="getBrandIdByBrandName" resultType="java.lang.Integer">
@@ -346,9 +371,31 @@
     <select id="getProductType" resultType="com.caimei.model.po.ProductTypePo">
         select id as productTypeId, name, image, pcImage, appletsImage
         from cm_brand_product_type
-        where id = #{productTypeId};
+        <where>
+            <if test="productTypeId != null">
+                and id = #{productTypeId}
+            </if>
+            <if test="productName != null and productName != ''">
+                and name = #{productName}
+            </if>
+            <if test="authUserId != null">
+                and authUserId = #{authUserId}
+            </if>
+        </where>
+        limit 1
     </select>
     <select id="getProductCountByTypeId" resultType="java.lang.Integer">
         select count(*) from cm_brand_auth_product where productTypeId = #{productTypeId}
     </select>
+    <select id="getProductPo" resultType="com.caimei.model.po.ProductPo">
+        select id as productId, productTypeId, name, image
+        from cm_brand_auth_product
+        where id = #{productId}
+    </select>
+    <select id="getAuthUserIdByProductId" resultType="java.lang.Integer">
+        select a.authUserId
+        from cm_brand_auth_product p
+                 left join cm_brand_auth a on p.authId = a.id
+        where p.id = #{productId}
+    </select>
 </mapper>

+ 17 - 7
src/main/resources/mapper/ClubMapper.xml

@@ -11,8 +11,7 @@
     </insert>
     <update id="updateClubUser">
         update cm_brand_club_user
-        set name   = #{name},
-            mobile = #{mobile}
+        set mobile = #{mobile}
         where id = #{id}
     </update>
     <update id="deleteClubUser">
@@ -24,8 +23,8 @@
         where mobile = #{mobile}
           and authUserId = #{authUserId}
     </update>
-    <update id="updateAuthId">
-        update cm_brand_club_user set authId = #{authId} where id = #{clubUserId}
+    <update id="bindAuthId">
+        update cm_brand_club_user set authId = #{authId}, name = (select DISTINCT authParty from cm_brand_auth where id = #{authId}) where id = #{clubUserId}
     </update>
     <update id="updateStatus">
         update cm_brand_club_user
@@ -37,6 +36,11 @@
         set password=#{password}
         where id = #{clubUserId}
     </update>
+    <update id="unbindAuthId">
+        update cm_brand_club_user
+        set authId = null, name = null
+        where id = #{clubUserId}
+    </update>
     <select id="getClubList" resultType="com.caimei.model.vo.ClubVo">
         select id as authId,authParty as clubName,createTime
         from cm_brand_auth where authUserId = #{authUserId}
@@ -53,11 +57,11 @@
         cu.addTime,
         cu.nickName,
         cu.mobile,
-        cu.openId
+        cu.openId,
+        cu.status
         from cm_brand_club_user cu
         left join cm_brand_auth a on cu.authId = a.id
         where cu.authUserId = #{authUserId}
-        and cu.status = 1
         and cu.delFlag = 0
         <if test="name != null and name != ''">
             and cu.name like concat('%',#{name},'%')
@@ -104,7 +108,7 @@
         where cu.mobile = #{mobile} and au.appId = #{appId} and cu.delFlag = 0 limit 1
     </select>
     <select id="getWxClubUser" resultType="com.caimei.model.vo.WxClubUserVo">
-        select cu.id as clubUserId, cu.authId as authId, au.authUserId, cu.mobile
+        select cu.id as clubUserId, cu.authId as authId, cu.authUserId, cu.mobile
         from cm_brand_club_user cu
                  left join cm_brand_auth a on cu.authId = a.id
                  left join cm_brand_auth_user au on a.authUserId = au.authUserId
@@ -121,6 +125,9 @@
           <if test="authId != null">
               and cu.authId = #{authId}
           </if>
+          <if test="clubUserId != null">
+              and cu.id = #{clubUserId}
+          </if>
         limit 1
     </select>
     <select id="getClubDetails" resultType="com.caimei.model.vo.WxClubDetailsVo">
@@ -142,4 +149,7 @@
           and a.status = 1
           and a.auditStatus = 1;
     </select>
+    <select id="getDbPassword" resultType="java.lang.String">
+        select password from cm_brand_club_user where id = #{clubUserId}
+    </select>
 </mapper>

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

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei.mapper.cmMapper.LogisticsMapper">
+    <insert id="sendCertificate">
+        insert into logistics_information (type, authId, nu, state, logisticsCompanyName, logisticsCompanyCode,
+                                           updateDate, remarks, remarksImage)
+        values (#{type}, #{authId}, #{logisticsNumber}, #{state}, #{companyName}, #{companyCode}, #{updateDate},
+                #{remarks}, #{remarksImage})
+    </insert>
+    <select id="getCertificateLogistics" resultType="com.caimei.model.vo.CertificateLogisticsVo">
+        select a.authParty, logisticsCompanyName as companyName, logisticsCompanyCode as companyCode, nu as logisticsNumber,
+               state, info, remarksImage, li.remarks, updateDate
+               from logistics_information li left join cm_brand_auth a on li.authId = a.id
+        where authId = #{authId}
+    </select>
+    <select id="getLogisticsCompanyList" resultType="com.caimei.model.vo.LogisticsCompanyVo">
+        select id, label as companyName, value as companyCode
+        from sys_dict
+        where type = 'kd_type'
+        and del_flag = 0
+        <if test="companyId != null">
+            and id =#{companyId}
+        </if>
+        order by -sort desc
+    </select>
+</mapper>

+ 2 - 2
src/main/resources/mapper/ShopMapper.xml

@@ -127,9 +127,9 @@
         from cm_brand_auth_user u
         left join cm_brand_auth_shop_info s on u.authUserId = s.authUserId
         left join cm_brand cb on cb.id = s.brandId
-        left join (select authUserId, count(*) as authWaitNum from cm_brand_auth where auditStatus = 2 group by authUserId) aw on u.authUserId = aw.authUserId
+        left join (select authUserId, count(*) as authWaitNum from cm_brand_auth where auditStatus = 2 and shopAuditStatus = 1 group by authUserId) aw on u.authUserId = aw.authUserId
         left join (select a.authUserId, count(*) as productWaitNum from cm_brand_auth_product p left join cm_brand_auth a on p.authId = a.id
-        where p.auditStatus = 2 group by a.authUserId) pw on u.authUserId = pw.authUserId
+        where p.auditStatus = 2 and p.shopAuditStatus = 1 group by a.authUserId) pw on u.authUserId = pw.authUserId
         left join (select authUserId, count(*) as articleWaitNum from cm_brand_article where auditStatus = 2 group by authUserId) arw on u.authUserId = arw.authUserId
         left join (select authUserId, count(*) as imageWaitNum from cm_brand_image where auditStatus = 2 group by authUserId) iw on u.authUserId = iw.authUserId
         left join (select authUserId, count(*) as videoWaitNum from cm_brand_video where auditStatus = 2 group by authUserId) vw on u.authUserId = vw.authUserId

Vissa filer visades inte eftersom för många filer har ändrats