Browse Source

1月优化版本part2

Aslee 3 years ago
parent
commit
13e98dad90
44 changed files with 466 additions and 161 deletions
  1. 2 2
      src/main/java/com/caimei/config/WxApiInterceptor.java
  2. 9 0
      src/main/java/com/caimei/controller/AddressApi.java
  3. 7 6
      src/main/java/com/caimei/controller/DoctorApi.java
  4. 14 1
      src/main/java/com/caimei/controller/DownloadApi.java
  5. 1 1
      src/main/java/com/caimei/mapper/DoctorMapper.java
  6. 4 2
      src/main/java/com/caimei/mapper/FileMapper.java
  7. 3 1
      src/main/java/com/caimei/mapper/ShopMapper.java
  8. 15 0
      src/main/java/com/caimei/model/en/QrCodeSize.java
  9. 0 18
      src/main/java/com/caimei/model/po/AuthImageDataPo.java
  10. 5 0
      src/main/java/com/caimei/model/po/CmBrandAuthPo.java
  11. 32 0
      src/main/java/com/caimei/model/po/ProductImagePo.java
  12. 20 0
      src/main/java/com/caimei/model/po/UploadFilePo.java
  13. 3 0
      src/main/java/com/caimei/model/vo/AuthFormVo.java
  14. 3 7
      src/main/java/com/caimei/model/vo/DoctorEquipmentVo.java
  15. 6 0
      src/main/java/com/caimei/model/vo/ProductFormVo.java
  16. 3 0
      src/main/java/com/caimei/model/vo/ShopFormVo.java
  17. 3 0
      src/main/java/com/caimei/model/vo/ShopListVo.java
  18. 5 0
      src/main/java/com/caimei/service/AddressService.java
  19. 3 2
      src/main/java/com/caimei/service/DoctorService.java
  20. 7 0
      src/main/java/com/caimei/service/DownloadService.java
  21. 2 3
      src/main/java/com/caimei/service/LoginService.java
  22. 7 0
      src/main/java/com/caimei/service/SDKService.java
  23. 10 0
      src/main/java/com/caimei/service/UploadService.java
  24. 17 0
      src/main/java/com/caimei/service/impl/AddressServiceImpl.java
  25. 1 1
      src/main/java/com/caimei/service/impl/AuthClubServiceImpl.java
  26. 1 1
      src/main/java/com/caimei/service/impl/AuthProductServiceImpl.java
  27. 11 0
      src/main/java/com/caimei/service/impl/AuthServiceImpl.java
  28. 8 4
      src/main/java/com/caimei/service/impl/DoctorServiceImpl.java
  29. 75 3
      src/main/java/com/caimei/service/impl/DownloadServiceImpl.java
  30. 3 8
      src/main/java/com/caimei/service/impl/FileServiceImpl.java
  31. 10 12
      src/main/java/com/caimei/service/impl/LoginServiceImpl.java
  32. 9 0
      src/main/java/com/caimei/service/impl/SDKServiceImpl.java
  33. 4 11
      src/main/java/com/caimei/service/impl/ShopServiceImpl.java
  34. 38 15
      src/main/java/com/caimei/service/impl/UploadServiceImpl.java
  35. 22 9
      src/main/java/com/caimei/utils/ImageUtils.java
  36. 5 13
      src/main/java/com/caimei/wxController/LoginApi.java
  37. 10 0
      src/main/java/com/caimei/wxController/SDKApi.java
  38. 4 13
      src/main/java/com/caimei/wxController/WxAuthApi.java
  39. 1 1
      src/main/resources/config/dev/application-dev.yml
  40. 8 4
      src/main/resources/mapper/AuthMapper.xml
  41. 14 8
      src/main/resources/mapper/AuthProductMapper.xml
  42. 6 3
      src/main/resources/mapper/DoctorMapper.xml
  43. 7 1
      src/main/resources/mapper/FileMapper.xml
  44. 48 11
      src/main/resources/mapper/ShopMapper.xml

+ 2 - 2
src/main/java/com/caimei/config/WxApiInterceptor.java

@@ -44,9 +44,9 @@ public class WxApiInterceptor implements HandlerInterceptor {
         String cacheValue = null != token ? (null != redisService.get(token) ? String.valueOf(redisService.get(token)) : null) : null;
         // 验证机构用户是否可以登录
         WxClubUserVo clubUser = null;
-        if (null != cacheValue && cacheValue.contains("|")) {
+        if (null != cacheValue && cacheValue.contains(",")) {
             // 订阅号登录用户
-            String[] cacheArr = cacheValue.split("|");
+            String[] cacheArr = cacheValue.split(",");
             String mobile = cacheArr[0];
             String appId = cacheArr[1];
             clubUser = clubMapper.getWxClubUser(mobile, appId);

+ 9 - 0
src/main/java/com/caimei/controller/AddressApi.java

@@ -50,4 +50,13 @@ public class AddressApi {
         return addressService.getSelectAddress(type, parentId);
     }
 
+
+    /**
+     * 所有地址下拉完整数据
+     */
+    @ApiOperation("所有地址完整数据(旧:/club/address)")
+    @GetMapping("/select/all")
+    public ResponseJson<List<AddressSelectVo>> getAllSelectAddress() {
+        return addressService.getAllSelectAddress();
+    }
 }

+ 7 - 6
src/main/java/com/caimei/controller/DoctorApi.java

@@ -40,16 +40,17 @@ public class DoctorApi {
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1医师列表,2医师审核列表"),
             @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
             @ApiImplicitParam(name = "doctorName", required = false, value = "医师姓名"),
+            @ApiImplicitParam(name = "certificateNo", required = false, value = "从业资格证编号"),
             @ApiImplicitParam(name = "status", required = false, value = "上线状态:0已下线,1已上线,2待上线"),
             @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     @GetMapping("/list")
-    public ResponseJson<PageInfo<DoctorListVo>> getDoctorList(Integer listType, Integer authUserId, String doctorName, Integer status, Integer auditStatus,
-                                                      @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
-                                                      @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
-        return doctorService.getDoctorList(listType, authUserId, doctorName, status, auditStatus, pageNum, pageSize);
+    public ResponseJson<PageInfo<DoctorListVo>> getDoctorList(Integer listType, Integer authUserId, String doctorName, String certificateNo, Integer status, Integer auditStatus,
+                                                              @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                              @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return doctorService.getDoctorList(listType, authUserId, doctorName, certificateNo, status, auditStatus, pageNum, pageSize);
     }
 
     /**
@@ -91,7 +92,7 @@ public class DoctorApi {
     @ApiOperation("添加/编辑医师")
     @ApiImplicitParam(name = "params", value = "doctorId:医师id;authUserId:供应商用户id;doctorName:医师姓名;" +
             "certificateNo:从业资格证编号;clubName:所在机构;createBy:创建人id;bannerList:轮播图列表;" +
-            "equipment([{equipmentName:'',brand:'',image:''}])", required = true)
+            "doctorImage:医师照片;equipmentList([{equipmentName:'',brand:'',image:''}])", required = true)
     @PostMapping("/save")
     public ResponseJson saveDoctor(@RequestBody String params) {
         JSONObject paramsMap = JSONObject.parseObject(params);
@@ -103,7 +104,7 @@ public class DoctorApi {
         String doctorImage = paramsMap.getString("doctorImage");
         Integer createBy = paramsMap.getInteger("createBy");
         List<String> bannerList = (List<String>) paramsMap.get("bannerList");
-        List<Map<String,String>> equipmentList = (List<Map<String,String>>) paramsMap.get("equipmentList");
+        List<Map<String,Object>> equipmentList = (List<Map<String,Object>>) paramsMap.get("equipmentList");
 
         /*
             组装医师数据

+ 14 - 1
src/main/java/com/caimei/controller/DownloadApi.java

@@ -1,10 +1,12 @@
 package com.caimei.controller;
 
+import com.caimei.model.ResponseJson;
 import com.caimei.service.DownloadService;
 import com.caimei.service.UploadService;
 import com.caimei.utils.OSSUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -32,7 +34,7 @@ import java.util.UUID;
  * @author Aslee
  * @date 2021/5/14
  */
-@Api(tags = "上传API")
+@Api(tags = "下载API")
 @Slf4j
 @RestController
 @RequiredArgsConstructor
@@ -54,4 +56,15 @@ public class DownloadApi {
             e.printStackTrace();
         }
     }
+
+
+    @ApiOperation("一键下载授权牌/二维码")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "type", required = true, value = "1授权牌,2二维码")
+    })
+    @GetMapping("/shop/image")
+    public void downloadImage(Integer authUserId, Integer type, HttpServletRequest request, HttpServletResponse response) throws Exception {
+        downloadService.downloadShopImage(authUserId, type, request, response);
+    }
 }

+ 1 - 1
src/main/java/com/caimei/mapper/DoctorMapper.java

@@ -20,7 +20,7 @@ import java.util.List;
 @Mapper
 public interface DoctorMapper {
 
-    List<DoctorListVo> getDoctorList(@Param("listType") Integer listType, @Param("authUserId") Integer authUserId, @Param("doctorParty") String doctorParty, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus);
+    List<DoctorListVo> getDoctorList(@Param("listType") Integer listType, @Param("authUserId") Integer authUserId, @Param("doctorName") String doctorName, @Param("certificateNo") String certificateNo, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus);
 
     void updateDoctorStatus(@Param("doctorId") Integer doctorId, @Param("status") Integer status);
 

+ 4 - 2
src/main/java/com/caimei/mapper/FileMapper.java

@@ -1,7 +1,7 @@
 package com.caimei.mapper;
 
 import com.caimei.model.po.CourseFilePo;
-import com.caimei.model.po.AuthImageDataPo;
+import com.caimei.model.po.ProductImagePo;
 import com.caimei.model.po.FilePo;
 import com.caimei.model.vo.CourseFileListVo;
 import com.caimei.model.vo.FileListVo;
@@ -37,7 +37,7 @@ public interface FileMapper {
 
     List<WxFileListVo> getWxFileList(@Param("authUserId") Integer authUserId, @Param("fileTitle") String fileTitle);
 
-    List<AuthImageDataPo> getAuthImageData();
+    List<ProductImagePo> getAuthImageData();
 
     void updateCourseFile(CourseFilePo courseFile);
 
@@ -46,4 +46,6 @@ public interface FileMapper {
     List<CourseFileListVo> getCourseFileList(@Param("fileType") Integer fileType, @Param("fileModule") String fileModule, @Param("fileTitle") String fileTitle);
 
     void deleteCourseFileByFileId(Integer fileId);
+
+    List<ProductImagePo> getProductImageList(Integer authUserId);
 }

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

@@ -18,7 +18,7 @@ import java.util.List;
 @Mapper
 public interface ShopMapper {
 
-    List<ShopListVo> getShopList(@Param("listType") Integer listType, @Param("shopName") String shopName, @Param("shopType") Integer shopType, @Param("brandId") Integer brandId, @Param("mobile") String mobile, @Param("linkMan") String linkMan);
+    List<ShopListVo> getShopList(@Param("listType") Integer listType, @Param("shopName") String shopName, @Param("shopType") Integer shopType, @Param("brandId") Integer brandId, @Param("mobile") String mobile, @Param("linkMan") String linkMan, @Param("lowerAuditStatus") Integer lowerAuditStatus);
 
     void updateShopStatusByUserId(@Param("authUserId") Integer authUserId, @Param("status") Integer status);
 
@@ -85,4 +85,6 @@ public interface ShopMapper {
     List<String> getShopBrands(Integer authUserId);
 
     WxShopVo getWxShopInfo(String appId);
+
+    Integer getWxAccountTypeByAppId(String appId);
 }

+ 15 - 0
src/main/java/com/caimei/model/en/QrCodeSize.java

@@ -0,0 +1,15 @@
+package com.caimei.model.en;
+
+import lombok.Data;
+
+import java.util.Date;
+
+
+/**
+ * @author Aslee
+ */
+public class QrCodeSize {
+    public static final int LARGE = 137;
+    public static final int MEDIUM = 104;
+    public static final int SMALL = 70;
+}

+ 0 - 18
src/main/java/com/caimei/model/po/AuthImageDataPo.java

@@ -1,18 +0,0 @@
-package com.caimei.model.po;
-
-import lombok.Data;
-
-import java.util.Date;
-
-/**
- * cm_brand_file
- * @author  Aslee
- */
-@Data
-public class AuthImageDataPo {
-    private String authImage;
-
-    private String authParty;
-
-    private String snCode;
-}

+ 5 - 0
src/main/java/com/caimei/model/po/CmBrandAuthPo.java

@@ -42,6 +42,11 @@ public class CmBrandAuthPo {
      */
     private Integer townId;
 
+    /**
+     * 区域
+     */
+    private String area;
+
     /**
      * 详细地址
      */

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

@@ -0,0 +1,32 @@
+package com.caimei.model.po;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * cm_brand_file
+ * @author  Aslee
+ */
+@Data
+public class ProductImagePo {
+    /**
+     * 商品id
+     */
+    private Integer productId;
+
+    /**
+     * 图片链接
+     */
+    private String certificateImage;
+
+    /**
+     * 授权机构
+     */
+    private String authParty;
+
+    /**
+     * sn码
+     */
+    private String snCode;
+}

+ 20 - 0
src/main/java/com/caimei/model/po/UploadFilePo.java

@@ -0,0 +1,20 @@
+package com.caimei.model.po;
+
+import lombok.Data;
+
+/**
+ * cm_brand_file
+ * @author  Aslee
+ */
+@Data
+public class UploadFilePo {
+    /**
+     * 文件名称
+     */
+    private String fileName;
+
+    /**
+     * 文件链接
+     */
+    private String fileUrl;
+}

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

@@ -29,6 +29,9 @@ public class AuthFormVo implements Serializable {
     @ApiModelProperty("区id")
     private Integer townId;
 
+    @ApiModelProperty("区域")
+    private String area;
+
     @ApiModelProperty("详细地址")
     private String address;
 

+ 3 - 7
src/main/java/com/caimei/model/vo/DoctorEquipmentVo.java

@@ -14,16 +14,12 @@ import java.util.List;
  */
 @Data
 public class DoctorEquipmentVo implements Serializable {
-    @ApiModelProperty("仪器名称")
+    @ApiModelProperty("设备名称")
     private String equipmentName;
 
     @ApiModelProperty("品牌")
     private String brand;
 
-    @ApiModelProperty("所属机构")
-    private String clubName;
-
-    @ApiModelProperty("轮播图")
-    private List<String> bannerList;
-
+    @ApiModelProperty("设备图片")
+    private String image;
 }

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

@@ -38,6 +38,12 @@ public class ProductFormVo {
     @ApiModelProperty("授权牌照")
     private String certificateImage;
 
+    @ApiModelProperty("是否生成二维码授权牌:0否,1是")
+    private Integer addQrCodeFlag;
+
+    @ApiModelProperty("生成二维码授权牌模板:1左下,2右边,3左边")
+    private Integer addTemplateType;
+
     @ApiModelProperty("商品参数列表")
     private List<ProductParamPo> paramList;
 }

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

@@ -28,6 +28,9 @@ public class ShopFormVo implements Serializable {
     @ApiModelProperty("代理商logo")
     private String logo;
 
+    @ApiModelProperty("微信公众号类型:1订阅号,2服务号")
+    private Integer wxAccountType;
+
     @ApiModelProperty("公众号二维码图片")
     private String qrCodeImage;
 

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

@@ -93,4 +93,7 @@ public class ShopListVo implements Serializable {
 
     @ApiModelProperty("文件待审核数量")
     private Integer fileWaitNum;
+
+    @ApiModelProperty("医师待审核数量")
+    private Integer doctorWaitNum;
 }

+ 5 - 0
src/main/java/com/caimei/service/AddressService.java

@@ -22,4 +22,9 @@ public interface AddressService {
      * @param parentId 父级地址Id
      */
     ResponseJson<List<AddressSelectVo>> getSelectAddress(Integer type, Integer parentId);
+
+    /**
+     * 所有地址下拉完整数据
+     */
+    ResponseJson<List<AddressSelectVo>> getAllSelectAddress();
 }

+ 3 - 2
src/main/java/com/caimei/service/DoctorService.java

@@ -24,13 +24,14 @@ public interface DoctorService {
      * @param listType   列表类型:1医师列表,2医师审核列表
      * @param authUserId 供应商用户id
      * @param doctorName  医师
+     * @param certificateNo
      * @param status    上线状态:0已下线,1已上线,2待上线
      * @param auditStatus  审核状态:0审核未通过,1审核通过,2待审核
      * @param pageNum    第几页
      * @param pageSize   一页多少条
      * @return DoctorListVo
      */
-    ResponseJson<PageInfo<DoctorListVo>> getDoctorList(Integer listType, Integer authUserId, String doctorName, Integer status, Integer auditStatus, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<DoctorListVo>> getDoctorList(Integer listType, Integer authUserId, String doctorName, String certificateNo, Integer status, Integer auditStatus, Integer pageNum, Integer pageSize);
 
     /**
      * 更新医师状态
@@ -56,7 +57,7 @@ public interface DoctorService {
      * @param equipmentList 仪器列表
      * @return ResponseJson
      */
-    ResponseJson saveDoctor(CmBrandDoctorPo doctor, List<String> bannerList, List<Map<String,String>> equipmentList);
+    ResponseJson saveDoctor(CmBrandDoctorPo doctor, List<String> bannerList, List<Map<String,Object>> equipmentList);
 
     /**
      * 审核品牌医师

+ 7 - 0
src/main/java/com/caimei/service/DownloadService.java

@@ -19,4 +19,11 @@ public interface DownloadService {
      * @param response
      */
     void downloadFile(String ossName, String fileName, HttpServletRequest request, HttpServletResponse response) throws IOException;
+
+    /**
+     * 一键下载授权牌,二维码
+     * @param authUserId
+     * @param type
+     */
+    void downloadShopImage(Integer authUserId, Integer type, HttpServletRequest request, HttpServletResponse response) throws Exception;
 }

+ 2 - 3
src/main/java/com/caimei/service/LoginService.java

@@ -47,15 +47,14 @@ public interface LoginService {
      * @param appId         公众号appId
      * @return
      */
-    ResponseJson<WxClubUserVo> loginByVerifyCode(String mobile, String verifyCode, String accessToken, String appId);
+    ResponseJson<WxClubUserVo> loginByVerifyCode(String mobile, String verifyCode, String appId);
 
     /**
      * 订阅号邀请码登录
      * @param mobile
      * @param invitationCode
-     * @param accessToken
      * @param appId
      * @return
      */
-    ResponseJson<WxClubUserVo> loginByInvitationCode(String mobile, String invitationCode, String accessToken, String appId);
+    ResponseJson<WxClubUserVo> loginByInvitationCode(String mobile, String invitationCode, String appId);
 }

+ 7 - 0
src/main/java/com/caimei/service/SDKService.java

@@ -19,4 +19,11 @@ public interface SDKService {
      * @return
      */
     ResponseJson<Map<String, String>> getConfigData(String authUserId, String url) throws Exception;
+
+    /**
+     * 获取公众号类型
+     * @param appId
+     * @return Integer:1服务号,2订阅号
+     */
+    ResponseJson<Integer> getWxAccountType(String appId);
 }

+ 10 - 0
src/main/java/com/caimei/service/UploadService.java

@@ -1,9 +1,11 @@
 package com.caimei.service;
 
 import com.alibaba.fastjson.JSONArray;
+import com.caimei.model.po.UploadFilePo;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
+import java.util.List;
 
 /**
  * Description
@@ -26,4 +28,12 @@ public interface UploadService {
      * @return
      */
     String saveImageZip(JSONArray imageArr) throws IOException, Exception;
+
+    /**
+     * 将多张图片压缩
+     * @param fileList
+     * @return
+     * @throws Exception
+     */
+    String createImageZip(List<UploadFilePo> fileList) throws  Exception;
 }

+ 17 - 0
src/main/java/com/caimei/service/impl/AddressServiceImpl.java

@@ -48,4 +48,21 @@ public class AddressServiceImpl implements AddressService {
         return ResponseJson.error("地址选项类型错误!", null);
     }
 
+    @Override
+    public ResponseJson<List<AddressSelectVo>> getAllSelectAddress() {
+        // 获取所有省份列表
+        List<AddressSelectVo> provinceList = addressMapper.getAllProvinceList();
+        provinceList.forEach(province -> {
+            // 获取当前省份下的所有城市列表
+            List<AddressSelectVo> cityList = addressMapper.getCityListByProvinceId(province.getId());
+            cityList.forEach(city -> {
+                // 获取当前城市下的所有地区列表
+                List<AddressSelectVo> townList = addressMapper.getTownListByCityId(city.getId());
+                city.setChildren(townList);
+            });
+            province.setChildren(cityList);
+        });
+        return ResponseJson.success(provinceList);
+    }
+
 }

+ 1 - 1
src/main/java/com/caimei/service/impl/AuthClubServiceImpl.java

@@ -117,7 +117,7 @@ public class AuthClubServiceImpl implements AuthClubService {
     public ResponseJson<PageInfo<WxClubListVo>> getWxClubList(String appId, String lngAndLat, String clubName, Integer provinceId,
                                                               Integer cityId, Integer townId, Integer pageNum, Integer pageSize) {
         if (null == appId) {
-            return ResponseJson.error("参数异常,请输入供应商用户id", null);
+            return ResponseJson.error("参数异常,请输入供应商公众号appId", null);
         }
         if (StringUtils.isEmpty(lngAndLat)) {
             return ResponseJson.error("参数异常,请输入用户当前经纬度", null);

+ 1 - 1
src/main/java/com/caimei/service/impl/AuthProductServiceImpl.java

@@ -249,7 +249,7 @@ public class AuthProductServiceImpl implements AuthProductService {
                         addWaterMarkSign = true;
                     } else if (!addTemplateType.equals(dbAddTemplateType)) {
                         // 原图片,更改模板,将当前授权牌替换为原图,生成二维码授权牌,生成水印图片
-                        product.setCertificateImage(product.getOriginalCertificateImage());
+                        product.setCertificateImage(dbProduct.getOriginalCertificateImage());
                         addQrCodeSign = true;
                         addWaterMarkSign = true;
                     }

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

@@ -85,6 +85,17 @@ public class AuthServiceImpl implements AuthService {
         listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
         List<AuthVo> authList = authMapper.getAuthList(listType, authUserId, authParty, status, auditStatus, lowerAuditStatus);
+        ListIterator<AuthVo> iterator = authList.listIterator();
+        while (iterator.hasNext()) {
+            // 根据是否完成商品信息审核筛选项,进行筛选
+            AuthVo auth = iterator.next();
+            Integer waitAuditNum = auth.getWaitAuditNum();
+            if (waitAuditNum > 0) {
+                auth.setLowerAuditStatus(0);
+            } else {
+                auth.setLowerAuditStatus(1);
+            }
+        }
         PageInfo<AuthVo> pageData = new PageInfo<>(authList);
         return ResponseJson.success(pageData);
     }

+ 8 - 4
src/main/java/com/caimei/service/impl/DoctorServiceImpl.java

@@ -36,13 +36,13 @@ public class DoctorServiceImpl implements DoctorService {
     private String imageDomain;
 
     @Override
-    public ResponseJson<PageInfo<DoctorListVo>> getDoctorList(Integer listType, Integer authUserId, String doctorName, Integer status, Integer auditStatus, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<DoctorListVo>> getDoctorList(Integer listType, Integer authUserId, String doctorName, String certificateNo, Integer status, Integer auditStatus, Integer pageNum, Integer pageSize) {
         if (null == authUserId) {
             return ResponseJson.error("参数异常,请输入供应商用户id", null);
         }
         listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
-        List<DoctorListVo> doctorList = doctorMapper.getDoctorList(listType, authUserId, doctorName, status, auditStatus);
+        List<DoctorListVo> doctorList = doctorMapper.getDoctorList(listType, authUserId, doctorName, certificateNo, status, auditStatus);
         PageInfo<DoctorListVo> pageData = new PageInfo<>(doctorList);
         return ResponseJson.success(pageData);
     }
@@ -86,6 +86,7 @@ public class DoctorServiceImpl implements DoctorService {
         DoctorFormVo doctorFormVo = new DoctorFormVo();
         doctorFormVo.setDoctorId(doctor.getId());
         doctorFormVo.setDoctorName(doctor.getName());
+        doctorFormVo.setDoctorImage(doctor.getImage());
         BeanUtils.copyProperties(doctor, doctorFormVo);
         // 轮播图
         List<String> bannerList = doctorMapper.getBannerList(doctorId);
@@ -97,7 +98,7 @@ public class DoctorServiceImpl implements DoctorService {
     }
 
     @Override
-    public ResponseJson saveDoctor(CmBrandDoctorPo doctor, List<String> bannerList, List<Map<String,String>> equipmentList) {
+    public ResponseJson saveDoctor(CmBrandDoctorPo doctor, List<String> bannerList, List<Map<String,Object>> equipmentList) {
         Integer doctorId = doctor.getId();
         Integer authUserId = doctor.getAuthUserId();
         String certificateNo = doctor.getCertificateNo();
@@ -148,7 +149,7 @@ public class DoctorServiceImpl implements DoctorService {
         bannerList.forEach(banner-> doctorMapper.insertBanner(doctor.getId(), banner));
         // 保存设备
         equipmentList.forEach(equipment-> {
-            doctorMapper.insertEquipment(doctor.getId(), equipment.get("equipmentName"), equipment.get("brand"), equipment.get("image"));
+            doctorMapper.insertEquipment(doctor.getId(), (String) equipment.get("equipmentName"), (String) equipment.get("brand"), (String) equipment.get("image"));
         });
         return ResponseJson.success("保存医师成功", doctor);
     }
@@ -198,6 +199,9 @@ public class DoctorServiceImpl implements DoctorService {
             return ResponseJson.error("参数异常,医师id不能为空", null);
         }
         DoctorFormVo doctor = doctorMapper.getDoctorDetailsById(doctorId);
+        if (null == doctor) {
+            return ResponseJson.error("医师不存在", null);
+        }
         // 轮播图
         List<String> bannerList = doctorMapper.getBannerList(doctorId);
         doctor.setBannerList(bannerList);

+ 75 - 3
src/main/java/com/caimei/service/impl/DownloadServiceImpl.java

@@ -1,19 +1,30 @@
 package com.caimei.service.impl;
 
 import com.caimei.mapper.FileMapper;
+import com.caimei.model.en.QrCodeSize;
+import com.caimei.model.po.ProductImagePo;
+import com.caimei.model.po.UploadFilePo;
 import com.caimei.service.DownloadService;
+import com.caimei.service.UploadService;
+import com.caimei.utils.ImageUtils;
 import com.caimei.utils.OSSUtils;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import javax.imageio.ImageIO;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Description
@@ -28,14 +39,75 @@ public class DownloadServiceImpl implements DownloadService {
     @Resource
     private FileMapper fileMapper;
 
+    private UploadService uploadService;
+
+    @Value("${caimei.oldapi}")
+    private String wwwServer;
+
+    @Value("${spring.profiles.active}")
+    private String active;
+
+    @Autowired
+    public void setUploadService(UploadService uploadService) {
+        this.uploadService = uploadService;
+    }
+
     @Override
     public void downloadFile(String ossName, String fileName, HttpServletRequest request, HttpServletResponse response) throws IOException {
         OSSUtils.downFile("authFile/", ossName, fileName);
-        download(request, response, fileName);
+        download(request, response, "./" + fileName, fileName);
+    }
+
+    @Override
+    public void downloadShopImage(Integer authUserId, Integer type, HttpServletRequest request, HttpServletResponse response) throws Exception {
+        if (null == authUserId || null == type) {
+            return;
+        }
+        ArrayList<UploadFilePo> fileList = new ArrayList<>();
+        List<ProductImagePo> productImageList = fileMapper.getProductImageList(authUserId);
+        if (1 == type) {
+            productImageList.forEach(productImage -> {
+                UploadFilePo file = new UploadFilePo();
+                file.setFileUrl(productImage.getCertificateImage());
+                file.setFileName(productImage.getAuthParty() + "-" + productImage.getSnCode());
+                fileList.add(file);
+            });
+        } else {
+            productImageList.forEach(productImage -> {
+                String qrCodeLink = wwwServer + "/product/auth/product-" + productImage.getProductId() + ".html";
+                // 生成二维码
+                BufferedImage qrCodeImage = ImageUtils.createQrCode(qrCodeLink, QrCodeSize.LARGE);
+                String fileName = productImage.getAuthParty() + "-" + productImage.getSnCode();
+                String imagePath = createBufferedImageFile(qrCodeImage, fileName, "png");
+                UploadFilePo file = new UploadFilePo();
+                file.setFileUrl(imagePath);
+                file.setFileName(productImage.getAuthParty() + "-" + productImage.getSnCode());
+                fileList.add(file);
+            });
+        }
+        String fileName = 1 == type ? "授权牌" : "二维码";
+        // 将授权牌压缩成zip文件
+        String imageZipPath = uploadService.createImageZip(fileList);
+        download(request, response, imageZipPath, fileName + ".zip");
+    }
+
+    private String createBufferedImageFile(BufferedImage qrCodeImage, String fileName, String prefix) {
+        String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/zplma/tempFile/";
+        if ("dev".equals(active)){
+            filePath = "D:\\WorkSpace\\file\\tempImport\\";
+        }
+        filePath = filePath + fileName + "." + prefix;
+        File file = new File(filePath);
+        try {
+            ImageIO.write(qrCodeImage, prefix, file);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filePath;
     }
 
-    public void download(HttpServletRequest request, HttpServletResponse response, String fileName) throws IOException {
-        File file = new File("./" + fileName);
+    public void download(HttpServletRequest request, HttpServletResponse response, String filePath, String fileName) throws IOException {
+        File file = new File(filePath);
         //  文件存在才下载
         if (file.exists()) {
             OutputStream out = null;

+ 3 - 8
src/main/java/com/caimei/service/impl/FileServiceImpl.java

@@ -3,7 +3,7 @@ package com.caimei.service.impl;
 import com.caimei.mapper.FileMapper;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.CourseFilePo;
-import com.caimei.model.po.AuthImageDataPo;
+import com.caimei.model.po.ProductImagePo;
 import com.caimei.model.po.FilePo;
 import com.caimei.model.vo.CourseFileListVo;
 import com.caimei.model.vo.FileListVo;
@@ -24,11 +24,6 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Date;
 import java.util.List;
-import java.util.UUID;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import static com.caimei.service.impl.UploadServiceImpl.inputStreamToFile;
 
 /**
  * Description
@@ -180,10 +175,10 @@ public class FileServiceImpl implements FileService {
     @Override
     public void download() {
         String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/zplma/atuhImage/";
-        List<AuthImageDataPo> authImageList = fileMapper.getAuthImageData();
+        List<ProductImagePo> authImageList = fileMapper.getAuthImageData();
         authImageList.forEach(authImage->{
             try {
-                String imageUrl = authImage.getAuthImage();
+                String imageUrl = authImage.getCertificateImage();
                 HttpURLConnection httpUrl = (HttpURLConnection) new URL(imageUrl).openConnection();
                 httpUrl.connect();
                 //通过输入流获取图片数据

+ 10 - 12
src/main/java/com/caimei/service/impl/LoginServiceImpl.java

@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.util.Date;
 import java.util.Map;
+import java.util.UUID;
 
 /**
  * Description
@@ -90,7 +91,8 @@ public class LoginServiceImpl implements LoginService {
         if (StringUtils.isEmpty(appId)) {
             return ResponseJson.error("参数异常,请输入appId");
         }
-        if (1 == type) {
+        if (2 == type) {
+            // 服务号校验手机号是否已被使用
             Integer clubUserId = clubMapper.checkMobile(mobile, appId);
             if (null != clubUserId) {
                 return ResponseJson.error("该手机号已使用,请重新输入");
@@ -176,16 +178,13 @@ public class LoginServiceImpl implements LoginService {
     }
 
     @Override
-    public ResponseJson<WxClubUserVo> loginByVerifyCode(String mobile, String verifyCode, String accessToken, String appId) {
+    public ResponseJson<WxClubUserVo> loginByVerifyCode(String mobile, String verifyCode, String appId) {
         if (StringUtils.isEmpty(mobile)) {
             return ResponseJson.error("参数异常,请输入手机号", null);
         }
         if (StringUtils.isEmpty(verifyCode)) {
             return ResponseJson.error("参数异常,请输入验证码", null);
         }
-        if (StringUtils.isEmpty(accessToken)) {
-            return ResponseJson.error("参数异常,请输入accessToken", null);
-        }
         if (StringUtils.isEmpty(appId)) {
             return ResponseJson.error("参数异常,请输入appId", null);
         }
@@ -208,22 +207,20 @@ public class LoginServiceImpl implements LoginService {
             return ResponseJson.error("登录失败", null);
         }
         // 登录成功redis保存token
-        redisService.set(accessToken, mobile + "|" + appId, 60L * 60 * 24);
+        String accessToken = UUID.randomUUID().toString();
+        redisService.set(accessToken, mobile + "," + appId, 60L * 60 * 24);
         clubUser.setAccessToken(accessToken);
         return ResponseJson.success(clubUser);
     }
 
     @Override
-    public ResponseJson<WxClubUserVo> loginByInvitationCode(String mobile, String invitationCode, String accessToken, String appId) {
+    public ResponseJson<WxClubUserVo> loginByInvitationCode(String mobile, String invitationCode, String appId) {
         if (StringUtils.isEmpty(mobile)) {
             return ResponseJson.error("参数异常,请输入手机号", null);
         }
         if (StringUtils.isEmpty(invitationCode)) {
             return ResponseJson.error("参数异常,请输入邀请码", null);
         }
-        if (StringUtils.isEmpty(accessToken)) {
-            return ResponseJson.error("参数异常,请输入accessToken", null);
-        }
         if (StringUtils.isEmpty(appId)) {
             return ResponseJson.error("参数异常,请输入appId", null);
         }
@@ -249,9 +246,10 @@ public class LoginServiceImpl implements LoginService {
         clubUser.setAuthId(clubUserPo.getAuthId());
         clubUser.setAuthUserId(clubPo.getAuthUserId());
         clubUser.setMobile(mobile);
-        clubUser.setAccessToken(accessToken);
         // 登录成功redis保存token
-        redisService.set(accessToken, mobile + "|" + appId, 60L * 60 * 24);
+        String accessToken = UUID.randomUUID().toString();
+        redisService.set(accessToken, mobile + "," + appId, 60L * 60 * 24);
+        clubUser.setAccessToken(accessToken);
         return ResponseJson.success(clubUser);
     }
 }

+ 9 - 0
src/main/java/com/caimei/service/impl/SDKServiceImpl.java

@@ -80,4 +80,13 @@ public class SDKServiceImpl implements SDKService {
         log.info("生成签名:>>>>"+signature);
         return ResponseJson.success(map);
     }
+
+    @Override
+    public ResponseJson<Integer> getWxAccountType(String appId) {
+        Integer wxAccountType = shopMapper.getWxAccountTypeByAppId(appId);
+        if (null == wxAccountType) {
+            return ResponseJson.error("公众号不存在", null);
+        }
+        return ResponseJson.success(wxAccountType);
+    }
 }

+ 4 - 11
src/main/java/com/caimei/service/impl/ShopServiceImpl.java

@@ -41,28 +41,21 @@ public class ShopServiceImpl implements ShopService {
     public ResponseJson<PageInfo<ShopListVo>> getShopList(Integer listType, String shopName, Integer shopType, Integer brandId, String mobile, String linkMan, Integer lowerAuditStatus, Integer pageNum, Integer pageSize) {
         listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
-        List<ShopListVo> shopList = shopMapper.getShopList(listType, shopName, shopType, brandId, mobile, linkMan);
+        List<ShopListVo> shopList = shopMapper.getShopList(listType, shopName, shopType, brandId, mobile, linkMan, lowerAuditStatus);
         ListIterator<ShopListVo> iterator = shopList.listIterator();
         while (iterator.hasNext()) {
-            // 根据是否完成商品信息审核筛选项,进行筛选
+            // 根据是否完成商品信息审核筛选项,设置下级审核状态
             ShopListVo shop = iterator.next();
             int articleWaitNum = shop.getArticleWaitNum();
             int imageWaitNum = shop.getImageWaitNum();
             int videoWaitNum = shop.getVideoWaitNum();
             int fileWaitNum = shop.getFileWaitNum();
-            int waitAuditNum = 3 == listType ? (articleWaitNum + imageWaitNum + videoWaitNum + fileWaitNum) : shop.getWaitAuditNum();
+            int doctorWaitNum = shop.getDoctorWaitNum();
+            int waitAuditNum = 2 == listType ? shop.getWaitAuditNum() : (3 == listType ? (articleWaitNum + imageWaitNum + videoWaitNum + fileWaitNum) : (4 == listType ? doctorWaitNum : 0));
             if (waitAuditNum > 0) {
                 shop.setLowerAuditStatus(0);
-                // 查询筛选项处理
-                if (null != lowerAuditStatus && 1 == lowerAuditStatus) {
-                    iterator.remove();
-                }
             }else {
                 shop.setLowerAuditStatus(1);
-                // 查询筛选项处理
-                if (null != lowerAuditStatus && 0 == lowerAuditStatus) {
-                    iterator.remove();
-                }
             }
         }
         PageInfo<ShopListVo> pageData = new PageInfo<>(shopList);

+ 38 - 15
src/main/java/com/caimei/service/impl/UploadServiceImpl.java

@@ -2,8 +2,8 @@ package com.caimei.service.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.caimei.config.FastDfsClient;
+import com.caimei.model.po.UploadFilePo;
 import com.caimei.service.UploadService;
-import com.caimei.utils.OSSUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -12,8 +12,9 @@ import org.springframework.web.multipart.MultipartFile;
 
 import java.io.*;
 import java.net.HttpURLConnection;
-import java.net.URI;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.UUID;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
@@ -46,9 +47,9 @@ public class UploadServiceImpl implements UploadService {
         String extName = originalFilename.substring(index);
         String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/zplma/tempFile/";
         if ("dev".equals(active)){
-            filePath = "D:\\WorkSpace\\file\\tempImport";
+            filePath = "D:\\WorkSpace\\file\\tempImport\\";
         }
-        filePath += "\\" + randomStr + extName;
+        filePath += randomStr + extName;
         // 临时图片
         File tempFile = new File(filePath);
         file.transferTo(tempFile);
@@ -63,6 +64,26 @@ public class UploadServiceImpl implements UploadService {
 
     @Override
     public String saveImageZip(JSONArray imageArr) throws Exception {
+        ArrayList<UploadFilePo> fileList = new ArrayList<>();
+        for (Object object : imageArr) {
+            UploadFilePo file = new UploadFilePo();
+            file.setFileUrl(object.toString());
+            String imgRandomId = UUID.randomUUID().toString();
+            file.setFileName(imgRandomId);
+            fileList.add(file);
+        }
+        String imageZipPath = createImageZip(fileList);
+        // 上传zip
+        String imageUrl = imageDomain + "/" + client.uploadFile(imageZipPath);
+        // 删除临时图片
+        File zipFile = new File(imageZipPath);
+        boolean delete = zipFile.delete();
+        log.info("【图片上传】>>>>>>>>>>>>>>>>删除临时图片压缩包:" + delete);
+        return imageUrl;
+    }
+
+    @Override
+    public String createImageZip(List<UploadFilePo> fileList) throws Exception {
         String randomStr = UUID.randomUUID().toString();
         String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/zplma/tempImage/";
         if ("dev".equals(active)){
@@ -73,12 +94,17 @@ public class UploadServiceImpl implements UploadService {
         log.info("【图片上传】>>>>>>>>>>>>>>>>图片压缩包临时路径:" + filePath);
         ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile));
         BufferedOutputStream bo = new BufferedOutputStream(out);
-        for (Object s : imageArr) {
-            String imageUrl = s.toString();
-            HttpURLConnection httpUrl = (HttpURLConnection) new URL(imageUrl).openConnection();
-            httpUrl.connect();
-            String imgRandomId = UUID.randomUUID().toString();
-            File image = inputStreamToFile(httpUrl.getInputStream(), imgRandomId + ".png");
+        for (UploadFilePo file : fileList) {
+            String fileUrl = file.getFileUrl();
+            File image = null;
+            if (fileUrl.startsWith("http")) {
+                HttpURLConnection httpUrl = (HttpURLConnection) new URL(fileUrl).openConnection();
+                httpUrl.connect();
+                String prefix = fileUrl.substring(fileUrl.lastIndexOf("."));
+                image = inputStreamToFile(httpUrl.getInputStream(), file.getFileName() + "." + prefix);
+            } else {
+                image = new File(fileUrl);
+            }
             out.putNextEntry(new ZipEntry(image.getName()));
             FileInputStream in = new FileInputStream(image);
             BufferedInputStream bi = new BufferedInputStream(in);
@@ -89,14 +115,11 @@ public class UploadServiceImpl implements UploadService {
             bo.flush();
             bi.close();
             in.close();
+            image.delete();
         }
         bo.close();
         out.close();
-        String imageUrl = imageDomain + "/" + client.uploadFile(filePath);
-        // 删除临时图片
-        boolean delete = zipFile.delete();
-        log.info("【图片上传】>>>>>>>>>>>>>>>>删除临时图片压缩包:" + delete);
-        return imageUrl;
+        return filePath;
     }
 
 

+ 22 - 9
src/main/java/com/caimei/utils/ImageUtils.java

@@ -1,5 +1,6 @@
 package com.caimei.utils;
 
+import com.caimei.model.en.QrCodeSize;
 import com.google.zxing.BarcodeFormat;
 import com.google.zxing.EncodeHintType;
 import com.google.zxing.MultiFormatWriter;
@@ -209,9 +210,12 @@ public class ImageUtils {
 			ImageIcon imageIcon = new ImageIcon(new URL(srcImgURL));
 			Image srcImg = imageIcon.getImage();
 			BufferedImage buffImg = ImageIO.read(new URL(srcImgURL));
+			int srcWidth = srcImg.getWidth(null);
+			int srcHeight = srcImg.getHeight(null);
 
 			//二维码图片
-			BufferedImage qrCodeImg = createQrCode(qrCodeLink);
+			int qrCodeSize = getQrCodeSize(srcWidth);
+			BufferedImage qrCodeImg = createQrCode(qrCodeLink, qrCodeSize);
 
 			// 1、得到画笔对象
 			Graphics2D g = buffImg.createGraphics();
@@ -228,20 +232,18 @@ public class ImageUtils {
 					1f));
 
 			// 6、二维码图片的位置
-			int srcWidth = srcImg.getWidth(null);
-			int srcHeight = srcImg.getHeight(null);
 			int qrCodeWidth = qrCodeImg.getWidth(null);
 			int qrCodeHeight = qrCodeImg.getHeight(null);
 			int x = 0;
 			int y = 0;
 			if (1 == addTemplateType) {
-				x = srcWidth / 4 - qrCodeWidth / 2 - 46;
+				x = srcWidth / 4 - qrCodeWidth / 2 - qrCodeWidth/3;
 				y = srcHeight* 3 / 4 - qrCodeHeight / 2 - 12;
 			} else if (2 == addTemplateType) {
-				x = srcWidth * 3 / 4 - qrCodeWidth / 2 + 46;
+				x = srcWidth * 3 / 4 - qrCodeWidth / 2 + qrCodeWidth;
 				y = (srcHeight - qrCodeHeight) / 2;
 			} else if (3 == addTemplateType) {
-				x = srcWidth / 4 - qrCodeWidth / 2 - 46;
+				x = srcWidth / 4 - qrCodeWidth / 2 - qrCodeWidth;
 				y = (srcHeight - qrCodeHeight) / 2;
 			}
 			g.drawImage(qrCodeImg, x, y, null);
@@ -275,16 +277,27 @@ public class ImageUtils {
 		return null;
 	}
 
+	private static int getQrCodeSize(int srcWidth) {
+		int qrCodeSize = QrCodeSize.LARGE;
+		if (srcWidth < 1350) {
+			qrCodeSize = QrCodeSize.MEDIUM;
+		}
+		if (srcWidth < 1000) {
+			qrCodeSize = QrCodeSize.SMALL;
+		}
+		return qrCodeSize;
+	}
+
 	private static final int BLACK = 0xFF000000;
 	private static final int WHITE = 0xFFFFFFFF;
 
-	public static BufferedImage createQrCode(String url) {
+	public static BufferedImage createQrCode(String url,int qrCodeSize) {
 		try {
 			Map<EncodeHintType, String> hints = new HashMap<>();
 			hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
 			//设置二维码白边的大小
-			hints.put(EncodeHintType.MARGIN,"0");
-			BitMatrix bitMatrix = new MultiFormatWriter().encode(url, BarcodeFormat.QR_CODE, 137, 137, hints);
+			hints.put(EncodeHintType.MARGIN, "0");
+			BitMatrix bitMatrix = new MultiFormatWriter().encode(url, BarcodeFormat.QR_CODE, qrCodeSize, qrCodeSize, hints);
 			int width = bitMatrix.getWidth();
 			int height = bitMatrix.getHeight();
 			BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

+ 5 - 13
src/main/java/com/caimei/wxController/LoginApi.java

@@ -2,23 +2,17 @@ package com.caimei.wxController;
 
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;
-import com.caimei.model.dto.PasswordDto;
-import com.caimei.model.vo.UserLoginVo;
 import com.caimei.model.vo.WxClubUserVo;
 import com.caimei.service.LoginService;
-import com.caimei.service.UserService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
-import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Map;
-
 
 /**
  * 微信机构用户登录API
@@ -45,7 +39,7 @@ public class LoginApi {
     }
 
     @ApiOperation("登录验证码发送")
-    @ApiImplicitParam(name = "params", value = "mobile:手机号;appId:公众号appId;type:1服务号验证码,2订阅号验证码", required = true)
+    @ApiImplicitParam(name = "params", value = "mobile:手机号;appId:公众号appId;type:1订阅号验证码,2服务号验证码", required = true)
     @PostMapping("/verify/code/send")
     public ResponseJson sendVerifyCode(@RequestBody String params) {
         JSONObject parseObject = JSONObject.parseObject(params);
@@ -70,27 +64,25 @@ public class LoginApi {
     }
 
     @ApiOperation("订阅号验证码登录")
-    @ApiImplicitParam(name = "params", value = "mobile:手机号;verifyCode:验证码;accessToken;openId;appId", required = true)
+    @ApiImplicitParam(name = "params", value = "mobile:手机号;verifyCode:验证码;openId;appId", required = true)
     @PostMapping("/login/subscribe/verify/code")
     public ResponseJson<WxClubUserVo> loginByVerifyCode(@RequestBody String params){
         JSONObject parseObject = JSONObject.parseObject(params);
         String mobile = parseObject.getString("mobile");
         String verifyCode = parseObject.getString("verifyCode");
-        String accessToken = parseObject.getString("accessToken");
         String appId = parseObject.getString("appId");
-        return loginService.loginByVerifyCode(mobile, verifyCode, accessToken, appId);
+        return loginService.loginByVerifyCode(mobile, verifyCode, appId);
     }
 
     @ApiOperation("订阅号邀请码登录")
-    @ApiImplicitParam(name = "params", value = "mobile:手机号;invitationCode:邀请码;accessToken;openId;appId", required = true)
+    @ApiImplicitParam(name = "params", value = "mobile:手机号;invitationCode:邀请码;openId;appId", required = true)
     @PostMapping("/login/subscribe/invitation/code")
     public ResponseJson<WxClubUserVo> loginByInvitationCode(@RequestBody String params){
         JSONObject parseObject = JSONObject.parseObject(params);
         String mobile = parseObject.getString("mobile");
         String invitationCode = parseObject.getString("invitationCode");
-        String accessToken = parseObject.getString("accessToken");
         String appId = parseObject.getString("appId");
-        return loginService.loginByInvitationCode(mobile, invitationCode, accessToken, appId);
+        return loginService.loginByInvitationCode(mobile, invitationCode, appId);
     }
 
     @ApiOperation("校验token是否失效")

+ 10 - 0
src/main/java/com/caimei/wxController/SDKApi.java

@@ -33,4 +33,14 @@ public class SDKApi {
         return sdkService.getConfigData(appId, url);
     }
 
+
+    @ApiOperation("获取公众号类型")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "appId", required = true, value = "公众号appId")
+    })
+    @GetMapping("/account/type")
+    public ResponseJson<Integer> getWxAccountType(String appId) {
+        return sdkService.getWxAccountType(appId);
+    }
+
 }

+ 4 - 13
src/main/java/com/caimei/wxController/WxAuthApi.java

@@ -33,17 +33,8 @@ public class WxAuthApi {
 
     private final DoctorService doctorService;
 
-    @ApiOperation("已认证机构列表")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "appId", required = true, value = "供应商公众号appId"),
-            @ApiImplicitParam(name = "lngAndLat", required = true, value = "用户当前经纬度"),
-            @ApiImplicitParam(name = "clubName", required = false, value = "机构名称"),
-            @ApiImplicitParam(name = "provinceId", required = false, value = "省id"),
-            @ApiImplicitParam(name = "cityId", required = false, value = "市id"),
-            @ApiImplicitParam(name = "townId", required = false, value = "区id"),
-            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
-            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
-    })
+    @ApiOperation("供应商信息")
+    @ApiImplicitParam(name = "appId", required = true, value = "供应商公众号appId")
     @GetMapping("/shop/info")
     public ResponseJson<WxShopVo> getWxShopInfo(String appId) {
         return authClubService.getWxShopInfo(appId);
@@ -99,11 +90,11 @@ public class WxAuthApi {
     @ApiOperation("已认证医师列表")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "appId", required = true, value = "供应商公众号appId"),
-            @ApiImplicitParam(name = "productName", required = false, value = "医师名称"),
+            @ApiImplicitParam(name = "doctorName", required = false, value = "医师名称"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
-    @GetMapping("/product/list")
+    @GetMapping("/doctor/list")
     public ResponseJson<PageInfo<WxDoctorListVo>> getWxDoctorList(String appId, String doctorName,
                                                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                    @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {

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

@@ -55,7 +55,7 @@ swagger:
 
 # 新旧www服务域名
 caimei:
-  oldapi: http://localhost:8100
+  oldapi: http://192.168.2.81:8009
   zplmapi: http://192.168.2.68:8012
   #图片服务器
   imageDomain: http://192.168.2.100

+ 8 - 4
src/main/resources/mapper/AuthMapper.xml

@@ -98,16 +98,20 @@
         select id,
                authParty,
                authUserId,
-               provinceId,
-               cityId,
-               townId,
+               a.provinceId,
+               a.cityId,
+               a.townId,
+               concat(p.name, '/', c.name, '/', t.name) as area,
                address,
                lng,
                lat,
                mobile,
                logo,
                status
-        from cm_brand_auth
+        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="getAuthIdByAuthParty" resultType="java.lang.Integer">

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

@@ -2,12 +2,14 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.mapper.AuthProductMapper">
     <insert id="insertProduct" keyColumn="id" keyProperty="productId" useGeneratedKeys="true" parameterType="com.caimei.model.po.ProductPo">
-        insert into cm_brand_auth_product(`authId`, `brandId`, `name`, `snCode`, `image`,`pcImage`,`appletsImage`, `certificateImage`,
-                                          `pcCertificateImage`,`appletsCertificateImage`, `status`, `auditStatus`,
-                                          `createTime`, `createBy`)
+        insert into cm_brand_auth_product(`authId`, `brandId`, `name`, `snCode`, `image`,`pcImage`,`appletsImage`,
+                                          `originalCertificateImage`,`certificateImage`,`pcCertificateImage`,
+                                          `appletsCertificateImage`, `addQrCodeFlag`,`addTemplateType`, `status`,
+                                          `auditStatus`,`createTime`, `createBy`)
         values (#{authId}, #{brandId}, #{productName}, #{snCode}, #{productImage}, #{pcImage}, #{appletsImage},
-                #{certificateImage}, #{pcCertificateImage}, #{appletsCertificateImage}, #{status}, #{auditStatus}, #{createTime},
-                #{createBy})
+                #{originalCertificateImage}, #{certificateImage}, #{pcCertificateImage},
+                #{appletsCertificateImage}, #{addQrCodeFlag}, #{addTemplateType}, #{status},
+                #{auditStatus}, #{createTime},#{createBy})
     </insert>
     <insert id="insertProductParam">
         insert into cm_brand_product_param (`productId`, `name`, `content`)
@@ -27,6 +29,8 @@
             `snCode`           = #{snCode},
             `image`            = #{productImage},
             `certificateImage` = #{certificateImage},
+            `addQrCodeFlag`    = #{addQrCodeFlag},
+            `addTemplateType`  = #{addTemplateType},
             `status`           = #{status},
             `auditStatus`      = #{auditStatus},
             <if test="pcImage != null and pcImage != ''">
@@ -35,6 +39,9 @@
             <if test="appletsImage != null and appletsImage != ''">
                 `appletsImage` = #{appletsImage},
             </if>
+            <if test="originalCertificateImage != null and originalCertificateImage != ''">
+                `originalCertificateImage`      = #{originalCertificateImage},
+            </if>
             <if test="pcCertificateImage != null and pcCertificateImage != ''">
                 `pcCertificateImage`      = #{pcCertificateImage},
             </if>
@@ -113,6 +120,8 @@
                `snCode`,
                `image` as productImage,
                `certificateImage`,
+               addQrCodeFlag,
+               addTemplateType,
                `status`
         from cm_brand_auth_product
         where id = #{productId}
@@ -225,10 +234,7 @@
     <select id="getClubProductList" resultType="com.caimei.model.vo.WxProductListVo">
         select p.id as productId, p.name as productName, p.snCode
         from cm_brand_auth_product p
-                 left join cm_brand_auth a on p.authId = a.id
         where p.authId = #{authId}
-          and a.status = 1
-          and a.auditStatus = 1
           and p.status = 1
           and p.auditStatus = 1
         order by p.createTime desc

+ 6 - 3
src/main/resources/mapper/DoctorMapper.xml

@@ -57,6 +57,9 @@
         <if test="doctorName != null and doctorName != ''">
             and a.name like CONCAT('%',#{doctorName},'%')
         </if>
+        <if test="certificateNo != null and certificateNo != ''">
+            and a.certificateNo like concat('%',#{certificateNo},'%')
+        </if>
         <if test="status != null">
             and a.status = #{status}
         </if>
@@ -78,7 +81,7 @@
                authUserId,
                certificateNo,
                clubName,
-               image as doctorImage,
+               image,
                status
         from cm_brand_doctor
         where id = #{doctorId}
@@ -98,14 +101,14 @@
         where doctorId = #{doctorId}
     </select>
     <select id="getWxDoctorList" resultType="com.caimei.model.vo.WxDoctorListVo">
-        select d.name as doctorName,d.certificateNo,d.clubName,d.image as doctorImage
+        select d.id as doctorId, d.name as doctorName,d.certificateNo,d.clubName,d.image as doctorImage
         from cm_brand_doctor d
         left join cm_brand_auth_user au on d.authUserId = au.authUserId
         where au.appId = #{appId}
         <if test="doctorName != null and doctorName != ''">
             and d.name like concat('%',#{doctorName},'%')
         </if>
-        au.status = 1
+        and au.status = 1
         and d.status = 1
         and d.auditStatus = 1
     </select>

+ 7 - 1
src/main/resources/mapper/FileMapper.xml

@@ -118,10 +118,16 @@
         </if>
         order by createTime desc
     </select>
-    <select id="getAuthImageData" resultType="com.caimei.model.po.AuthImageDataPo">
+    <select id="getAuthImageData" resultType="com.caimei.model.po.ProductImagePo">
         SELECT certificateImage as authImage,a.authParty,p.snCode
         FROM cm_brand_auth_product p
                  left join cm_brand_auth a on p.authId = a.id
                  left join cm_brand_auth_user u on a.authUserId = u.authUserId where u.authUserId = 4;
     </select>
+    <select id="getProductImageList" resultType="com.caimei.model.po.ProductImagePo">
+        SELECT p.id as productId, certificateImage,a.authParty,p.snCode
+        FROM cm_brand_auth_product p
+                 left join cm_brand_auth a on p.authId = a.id
+                 left join cm_brand_auth_user u on a.authUserId = u.authUserId where u.authUserId = #{authUserId};
+    </select>
 </mapper>

+ 48 - 11
src/main/resources/mapper/ShopMapper.xml

@@ -106,17 +106,23 @@
         select u.authUserId,u.name,u.shopType,group_concat(cb.name) as brandName,group_concat(cb.id) as brandId,
         u.mobile,u.linkMan,u.status as shopStatus,u.createTime,
         (select au.name from cm_brand_auth_user au where au.authUserId = u.createBy) as createBy,
-        ((select count(*)from cm_brand_auth where authUserId = u.authUserId and auditStatus = 2) +
-        (select count(*) from cm_brand_auth_product p left join cm_brand_auth a on p.authId = a.id
-        where a.authUserId = u.authUserId and p.auditStatus = 2)) as waitAuditNum,
-        (select count(*) from cm_brand_article a where a.authUserId = u.authUserId and a.auditStatus = 2) as
-        articleWaitNum,
-        (select count(*) from cm_brand_image i where i.authUserId = u.authUserId and i.auditStatus = 2) as imageWaitNum,
-        (select count(*) from cm_brand_video v where v.authUserId = u.authUserId and v.auditStatus = 2) as videoWaitNum,
-        (select count(*) from cm_brand_file f where f.authUserId = u.authUserId and f.auditStatus = 2) as fileWaitNum
+        (ifnull(aw.authWaitNum,0)+ifnull(pw.productWaitNum,0)) as waitAuditNum,
+        ifnull(arw.articleWaitNum,0) as articleWaitNum,
+        ifnull(iw.imageWaitNum,0) as imageWaitNum,
+        ifnull(vw.videoWaitNum,0) as videoWaitNum,
+        ifnull(fw.fileWaitNum,0) as fileWaitNum,
+        ifnull(dw.doctorWaitNum,0) as doctorWaitNum
         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 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
+        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
+        left join (select authUserId, count(*) as fileWaitNum from cm_brand_file where auditStatus = 2 group by authUserId) fw on u.authUserId = fw.authUserId
+        left join (select authUserId, count(*) as doctorWaitNum from cm_brand_doctor where auditStatus = 2 group by authUserId) dw on u.authUserId = dw.authUserId
         where u.userIdentity = 2
         <if test="shopName != null and shopName !=''">
             AND u.name like CONCAT('%',#{shopName},'%')
@@ -133,13 +139,40 @@
         <if test="linkMan != null and linkMan !=''">
             AND u.linkMan like CONCAT('%',#{linkMan},'%')
         </if>
+        <if test="lowerAuditStatus != null">
+            <if test="0 == lowerAuditStatus">
+                <if test="listType == 2">
+                    and (ifnull(aw.authWaitNum,0)+ifnull(pw.productWaitNum,0)) > 0
+                </if>
+                <if test="listType == 3">
+                    and (ifnull(articleWaitNum,0) + ifnull(imageWaitNum,0) + ifnull(videoWaitNum,0) + ifnull(fileWaitNum,0)) > 0
+                </if>
+                <if test="listType == 4">
+                    and ifnull(dw.doctorWaitNum,0) > 0
+                </if>
+            </if>
+            <if test="1 == lowerAuditStatus">
+                <if test="listType == 2">
+                    and (ifnull(aw.authWaitNum,0)+ifnull(pw.productWaitNum,0)) = 0
+                </if>
+                <if test="listType == 3">
+                    and (ifnull(articleWaitNum,0) + ifnull(imageWaitNum,0) + ifnull(videoWaitNum,0) + ifnull(fileWaitNum,0)) = 0
+                </if>
+                <if test="listType == 4">
+                    and ifnull(dw.doctorWaitNum,0) = 0
+                </if>
+            </if>
+        </if>
         group by u.authUserId,u.createTime
         <choose>
             <when test="listType == 2">
                 ORDER BY waitAuditNum desc, u.createTime DESC
             </when>
             <when test="listType == 3">
-                ORDER BY (articleWaitNum + imageWaitNum +videoWaitNum +fileWaitNum) desc, u.createTime DESC
+                ORDER BY (ifnull(articleWaitNum,0) + ifnull(imageWaitNum,0) + ifnull(videoWaitNum,0) + ifnull(fileWaitNum,0)) desc, u.createTime DESC
+            </when>
+            <when test="listType == 4">
+                ORDER BY ifnull(dw.doctorWaitNum,0) desc, u.createTime DESC
             </when>
             <otherwise>
                 ORDER BY u.createTime DESC
@@ -172,7 +205,8 @@
         select count(*) from cm_brand_auth_file where md5Hex = #{md5Hex}
     </select>
     <select id="getShopByUserId" resultType="com.caimei.model.vo.ShopFormVo">
-        select u.authUserId, u.name as shopName, u.mobile, u.linkMan, u.status as shopStatus, u.shopType as shopType, u.logo, u.qrCodeImage, u.appId, u.appSecret
+        select u.authUserId, u.name as shopName, u.mobile, u.linkMan, u.status as shopStatus, u.shopType as shopType,
+               u.wxAccountType, u.logo, u.qrCodeImage, u.appId, u.appSecret
         from cm_brand_auth_user u
         where u.authUserId = #{authUserId};
     </select>
@@ -274,7 +308,7 @@
         where authUserId = #{authUserId}
     </select>
     <select id="getUserIdByAppId" resultType="java.lang.Integer">
-        select authUserId from cm_brand_auth_user where mobile = #{mobile} and userIdentity = 2 and appId is not null limit 1
+        select authUserId from cm_brand_auth_user where appId = #{appId} and userIdentity = 2 and appId is not null limit 1
     </select>
     <select id="getAppSecretByAppId" resultType="java.lang.String">
         select appSecret from cm_brand_auth_user where appId = #{appId} and status = 1
@@ -300,5 +334,8 @@
         and au.status = 1
         limit 1
     </select>
+    <select id="getWxAccountTypeByAppId" resultType="java.lang.Integer">
+        select wxAccountType from cm_brand_auth_user where appId = #{appId} and status = 1
+    </select>
 
 </mapper>