Browse Source

1月优化版本part1

Aslee 3 năm trước cách đây
mục cha
commit
59294bdbcd
50 tập tin đã thay đổi với 1743 bổ sung157 xóa
  1. 7 0
      pom.xml
  2. 17 5
      src/main/java/com/caimei/config/WxApiInterceptor.java
  3. 4 4
      src/main/java/com/caimei/controller/AddressApi.java
  4. 9 2
      src/main/java/com/caimei/controller/AuthApi.java
  5. 2 0
      src/main/java/com/caimei/controller/AuthProductApi.java
  6. 137 0
      src/main/java/com/caimei/controller/DoctorApi.java
  7. 3 1
      src/main/java/com/caimei/controller/ShopApi.java
  8. 1 1
      src/main/java/com/caimei/mapper/AuthMapper.java
  9. 14 1
      src/main/java/com/caimei/mapper/AuthProductMapper.java
  10. 7 4
      src/main/java/com/caimei/mapper/ClubMapper.java
  11. 54 0
      src/main/java/com/caimei/mapper/DoctorMapper.java
  12. 1 1
      src/main/java/com/caimei/mapper/LoginMapper.java
  13. 2 0
      src/main/java/com/caimei/mapper/ShopMapper.java
  14. 6 0
      src/main/java/com/caimei/model/dto/ProductSaveDto.java
  15. 8 2
      src/main/java/com/caimei/model/po/CmBrandAuthPo.java
  16. 56 0
      src/main/java/com/caimei/model/po/CmBrandDoctorPo.java
  17. 15 0
      src/main/java/com/caimei/model/po/ProductPo.java
  18. 5 0
      src/main/java/com/caimei/model/po/UserPo.java
  19. 4 1
      src/main/java/com/caimei/model/vo/AuthFormVo.java
  20. 0 15
      src/main/java/com/caimei/model/vo/AuthVo.java
  21. 29 0
      src/main/java/com/caimei/model/vo/DoctorEquipmentVo.java
  22. 38 0
      src/main/java/com/caimei/model/vo/DoctorFormVo.java
  23. 44 0
      src/main/java/com/caimei/model/vo/DoctorListVo.java
  24. 3 24
      src/main/java/com/caimei/model/vo/ShopFormVo.java
  25. 44 0
      src/main/java/com/caimei/model/vo/WxClubDetailsVo.java
  26. 16 3
      src/main/java/com/caimei/model/vo/WxClubListVo.java
  27. 30 0
      src/main/java/com/caimei/model/vo/WxDoctorListVo.java
  28. 12 0
      src/main/java/com/caimei/model/vo/WxProductListVo.java
  29. 25 0
      src/main/java/com/caimei/model/vo/WxShopVo.java
  30. 22 8
      src/main/java/com/caimei/service/AuthClubService.java
  31. 10 2
      src/main/java/com/caimei/service/AuthProductService.java
  32. 95 0
      src/main/java/com/caimei/service/DoctorService.java
  33. 22 2
      src/main/java/com/caimei/service/LoginService.java
  34. 2 1
      src/main/java/com/caimei/service/ShopService.java
  35. 55 5
      src/main/java/com/caimei/service/impl/AuthClubServiceImpl.java
  36. 151 15
      src/main/java/com/caimei/service/impl/AuthProductServiceImpl.java
  37. 5 20
      src/main/java/com/caimei/service/impl/AuthServiceImpl.java
  38. 209 0
      src/main/java/com/caimei/service/impl/DoctorServiceImpl.java
  39. 87 5
      src/main/java/com/caimei/service/impl/LoginServiceImpl.java
  40. 3 1
      src/main/java/com/caimei/service/impl/ShopServiceImpl.java
  41. 106 0
      src/main/java/com/caimei/utils/ImageUtils.java
  42. 30 5
      src/main/java/com/caimei/wxController/LoginApi.java
  43. 65 7
      src/main/java/com/caimei/wxController/WxAuthApi.java
  44. 1 1
      src/main/resources/config/dev/application-dev.yml
  45. 22 9
      src/main/resources/mapper/AuthMapper.xml
  46. 82 6
      src/main/resources/mapper/AuthProductMapper.xml
  47. 44 2
      src/main/resources/mapper/ClubMapper.xml
  48. 125 0
      src/main/resources/mapper/DoctorMapper.xml
  49. 1 1
      src/main/resources/mapper/LoginMapper.xml
  50. 13 3
      src/main/resources/mapper/ShopMapper.xml

+ 7 - 0
pom.xml

@@ -296,6 +296,13 @@
             <version>5.5.13</version>
         </dependency>
 
+
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>core</artifactId>
+            <version>3.3.0</version>
+        </dependency>
+
     </dependencies>
 
     <profiles>

+ 17 - 5
src/main/java/com/caimei/config/WxApiInterceptor.java

@@ -1,10 +1,9 @@
 package com.caimei.config;
 
 import com.caimei.components.RedisService;
+import com.caimei.mapper.ClubMapper;
 import com.caimei.mapper.LoginMapper;
 import com.caimei.model.vo.WxClubUserVo;
-import com.caimei.service.LoginService;
-import com.caimei.utils.JwtUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
@@ -33,16 +32,29 @@ public class WxApiInterceptor implements HandlerInterceptor {
     @Resource
     private LoginMapper loginMapper;
 
+    @Resource
+    private ClubMapper clubMapper;
+
     @Value("${caimei.zplmapi}")
     private String zplmapi;
 
     @Override
     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
         String token = request.getHeader("X-Token");
-        String cacheOpenId = null != token ? (null != redisService.get(token) ? String.valueOf(redisService.get(token)) : null) : null;
+        String cacheValue = null != token ? (null != redisService.get(token) ? String.valueOf(redisService.get(token)) : null) : null;
         // 验证机构用户是否可以登录
-        WxClubUserVo clubUser = loginMapper.findClubUser(cacheOpenId);
-        if (null == cacheOpenId || null == clubUser) {
+        WxClubUserVo clubUser = null;
+        if (null != cacheValue && cacheValue.contains("|")) {
+            // 订阅号登录用户
+            String[] cacheArr = cacheValue.split("|");
+            String mobile = cacheArr[0];
+            String appId = cacheArr[1];
+            clubUser = clubMapper.getWxClubUser(mobile, appId);
+        } else {
+            // 服务号登录用户
+            clubUser = loginMapper.findClubUserByOpenId(cacheValue);
+        }
+        if (null == cacheValue || null == clubUser) {
             // Token失效
             response.sendRedirect(zplmapi + "/unauthorized");
             return false;

+ 4 - 4
src/main/java/com/caimei/controller/AddressApi.java

@@ -17,15 +17,15 @@ import java.util.List;
 
 
 /**
- * 收货地址Api
+ * 地址Api
  *
- * @author : Charles
+ * @author : Aslee
  * @date : 2021/7/2
  */
-@Api(tags = "收货地址API")
+@Api(tags = "地址API")
 @RestController
 @RequiredArgsConstructor
-@RequestMapping("/order/address")
+@RequestMapping("/address")
 public class AddressApi {
 
     private final AddressService addressService;

+ 9 - 2
src/main/java/com/caimei/controller/AuthApi.java

@@ -15,10 +15,12 @@ import io.swagger.annotations.ApiImplicitParams;
 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.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -104,7 +106,7 @@ public class AuthApi {
         Integer cityId = paramsMap.getInteger("cityId");
         Integer townId = paramsMap.getInteger("townId");
         String address = paramsMap.getString("address");
-        String lonAndLat = paramsMap.getString("lonAndLat");
+        String lngAndLat = paramsMap.getString("lngAndLat");
         String mobile = paramsMap.getString("mobile");
         String logo = paramsMap.getString("logo");
         List<String> bannerList = (List<String>) paramsMap.get("bannerList");
@@ -121,7 +123,12 @@ public class AuthApi {
         auth.setCityId(cityId);
         auth.setTownId(townId);
         auth.setAddress(address);
-        auth.setLonAndLat(lonAndLat);
+        if (StringUtils.isEmpty(lngAndLat)) {
+            return ResponseJson.error("参数异常,经纬度不能为空");
+        }
+        String[] split = lngAndLat.split(",");
+        auth.setLng(new BigDecimal(split[0]));
+        auth.setLat(new BigDecimal(split[1]));
         auth.setMobile(mobile);
         auth.setLogo(logo);
         auth.setCreateBy(createBy);

+ 2 - 0
src/main/java/com/caimei/controller/AuthProductApi.java

@@ -88,6 +88,8 @@ public class AuthProductApi {
      *                   snCode                 商品SN码
      *                   productImage           商品图片
      *                   certificateImage       授权牌照
+     *                   addQrCodeFlag          是否生成二维码授权牌:0否,1是
+     *                   addTemplateType        生成二维码授权牌模板:1左下,2右边,3左边
      *                   status                 上线状态:0已下线,1已上线,2待上线
      *                   createBy               创建人id
      *                   paramList              商品参数列表

+ 137 - 0
src/main/java/com/caimei/controller/DoctorApi.java

@@ -0,0 +1,137 @@
+package com.caimei.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.po.CmBrandDoctorPo;
+import com.caimei.model.vo.DoctorFormVo;
+import com.caimei.model.vo.DoctorListVo;
+import com.caimei.service.DoctorService;
+import com.github.pagehelper.PageInfo;
+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;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 供应商API
+ *
+ * @author : Aslee
+ * @date : 2021/5/11
+ */
+@Api(tags = "医师API")
+@Slf4j
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/doctor")
+public class DoctorApi {
+
+    private final DoctorService doctorService;
+
+    @ApiOperation("医师列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1医师列表,2医师审核列表"),
+            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "doctorName", 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);
+    }
+
+    /**
+     * 更新医师状态
+     */
+    @ApiOperation("更新医师状态")
+    @ApiImplicitParam(name = "params", value = "doctorId:医师id;status:医师状态:0停用 1启用;", required = true)
+    @PostMapping("/update/status")
+    public ResponseJson updateDoctorStatus(@RequestBody Map<String,Integer> params) {
+        Integer doctorId = params.get("doctorId");
+        Integer status = params.get("status");
+        return doctorService.updateDoctorStatus(doctorId, status);
+    }
+
+    /**
+     * 删除医师
+     */
+    @ApiOperation("删除医师")
+    @ApiImplicitParam(name = "params", value = "doctorId:医师id", required = true)
+    @PostMapping("/delete")
+    public ResponseJson deleteDoctor(@RequestBody Map<String,Integer> params) {
+        Integer doctorId = params.get("doctorId");
+        return doctorService.deleteDoctor(doctorId);
+    }
+
+    /**
+     * 医师回显数据
+     */
+    @ApiOperation("医师回显数据")
+    @ApiImplicitParam(name = "doctorId", required = true, value = "医师id")
+    @GetMapping("/form/data")
+    public ResponseJson<DoctorFormVo> getDoctorFormData(Integer doctorId) {
+        return doctorService.getDoctorFormData(doctorId);
+    }
+
+    /**
+     * 添加/编辑医师
+     */
+    @ApiOperation("添加/编辑医师")
+    @ApiImplicitParam(name = "params", value = "doctorId:医师id;authUserId:供应商用户id;doctorName:医师姓名;" +
+            "certificateNo:从业资格证编号;clubName:所在机构;createBy:创建人id;bannerList:轮播图列表;" +
+            "equipment([{equipmentName:'',brand:'',image:''}])", required = true)
+    @PostMapping("/save")
+    public ResponseJson saveDoctor(@RequestBody String params) {
+        JSONObject paramsMap = JSONObject.parseObject(params);
+        Integer doctorId = paramsMap.getInteger("doctorId");
+        Integer authUserId = paramsMap.getInteger("authUserId");
+        String doctorName = paramsMap.getString("doctorName");
+        String certificateNo = paramsMap.getString("certificateNo");
+        String clubName = paramsMap.getString("clubName");
+        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");
+
+        /*
+            组装医师数据
+         */
+        CmBrandDoctorPo doctor = new CmBrandDoctorPo();
+        doctor.setId(doctorId);
+        doctor.setAuthUserId(authUserId);
+        doctor.setName(doctorName);
+        doctor.setImage(doctorImage);
+        doctor.setCertificateNo(certificateNo);
+        doctor.setClubName(clubName);
+        doctor.setCreateBy(createBy);
+        return doctorService.saveDoctor(doctor, bannerList, equipmentList);
+    }
+
+
+    /**
+     * 审核医师
+     */
+    @ApiOperation("审核医师")
+    @ApiImplicitParam(name = "params", value = "doctorId:医师id;auditStatus:审核状态:0审核未通过,1审核通过,2待审核;invalidReason:审核不通过原因;auditBy:审核人用户id", required = true)
+    @PostMapping("/audit")
+    public ResponseJson auditDoctor(@RequestBody String params) {
+        JSONObject paramsMap = JSONObject.parseObject(params);
+        Integer doctorId = paramsMap.getInteger("doctorId");
+        Integer auditStatus = paramsMap.getInteger("auditStatus");
+        String invalidReason = paramsMap.getString("invalidReason");
+        Integer auditBy = paramsMap.getInteger("auditBy");
+        return doctorService.auditDoctor(doctorId, auditStatus, invalidReason, auditBy);
+    }
+}

+ 3 - 1
src/main/java/com/caimei/controller/ShopApi.java

@@ -82,6 +82,7 @@ public class ShopApi {
      *                    mobile             手机号
      *                    linkMan            联系人
      *                    shopStatus         供应商状态:0停用 1启用
+     *                    logo               代理商logo
      *                    qrCodeImage        公众号二维码图片
      *                    createBy           创建人用户id
      *                    shopInfo  [
@@ -122,6 +123,7 @@ public class ShopApi {
         if (null == shopStatus) {
             return ResponseJson.error("参数异常,请输入供应商状态");
         }
+        String logo = (String) paramsMap.get("logo");
         String qrCodeImage = (String) paramsMap.get("qrCodeImage");
         Integer wxAccountType = (Integer) paramsMap.get("wxAccountType");
         String appId = (String) paramsMap.get("appId");
@@ -157,7 +159,7 @@ public class ShopApi {
             shopInfo.setStatementFileId(statementFileId);
             shopInfoList.add(shopInfo);
         }
-        return shopService.saveShop(authUserId, shopType, shopName, mobile, linkMan, shopStatus, qrCodeImage, wxAccountType, appId, appSecret, createBy, shopInfoList);
+        return shopService.saveShop(authUserId, shopType, shopName, mobile, linkMan, shopStatus,logo, qrCodeImage, wxAccountType, appId, appSecret, createBy, shopInfoList);
     }
 
     /**

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

@@ -17,7 +17,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);
+    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);
 
     void updateAuthStatusByAuthId(@Param("authId") Integer authId, @Param("status") Integer status);
 

+ 14 - 1
src/main/java/com/caimei/mapper/AuthProductMapper.java

@@ -5,6 +5,9 @@ import com.caimei.model.po.ProductPo;
 import com.caimei.model.vo.ProductFormVo;
 import com.caimei.model.vo.ProductListVo;
 import com.caimei.model.vo.WxProductListVo;
+import com.caimei.module.base.entity.po.CmBrandProductParamPo;
+import com.caimei.module.base.entity.vo.AuthProductVo;
+import com.caimei.module.base.entity.vo.StatementFileVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -50,9 +53,19 @@ 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("authId") Integer authId, @Param("productName") String productName);
+    List<WxProductListVo> getWxProductList(@Param("appId") String appId, @Param("productName") String productName);
 
     Integer getBrandIdByBrandName(String brand);
 
     List<ProductFormVo> getAuthProductList(Integer authId);
+
+    void updateCertificateImage(ProductPo product);
+
+    AuthProductVo getAuthProductByProductId(Integer productId);
+
+    StatementFileVo getStatementFile(Integer authUserId, Integer brandId);
+
+    List<CmBrandProductParamPo> getAuthProductParams(Integer productId);
+
+    List<WxProductListVo> getClubProductList(Integer authId);
 }

+ 7 - 4
src/main/java/com/caimei/mapper/ClubMapper.java

@@ -1,12 +1,11 @@
 package com.caimei.mapper;
 
 import com.caimei.model.po.ClubUserPo;
-import com.caimei.model.vo.ClubUserVo;
-import com.caimei.model.vo.ClubVo;
-import com.caimei.model.vo.WxClubListVo;
+import com.caimei.model.vo.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
@@ -30,9 +29,13 @@ public interface ClubMapper {
 
     Integer getStatusByClubUserId(Integer clubUserId);
 
-    List<WxClubListVo> getWxClubList(@Param("appId") String appId, @Param("clubName") String clubName);
+    List<WxClubListVo> getWxClubList(@Param("appId") String appId, @Param("clubName") String clubName, @Param("provinceId") Integer provinceId, @Param("cityId") Integer cityId, @Param("townId") Integer townId, @Param("lng") BigDecimal lng, @Param("lat") BigDecimal lat);
 
     Integer checkMobile(@Param("mobile") String mobile, @Param("appId") String appId);
 
     void insertFeedback(@Param("clubUserId") Integer clubUserId, @Param("content") String content);
+
+    WxClubUserVo getWxClubUser(@Param("mobile") String mobile, @Param("appId") String appId);
+
+    WxClubDetailsVo getClubDetails(Integer authId);
 }

+ 54 - 0
src/main/java/com/caimei/mapper/DoctorMapper.java

@@ -0,0 +1,54 @@
+package com.caimei.mapper;
+
+import com.caimei.model.po.CmBrandDoctorPo;
+import com.caimei.model.vo.DoctorEquipmentVo;
+import com.caimei.model.vo.DoctorFormVo;
+import com.caimei.model.vo.DoctorListVo;
+import com.caimei.model.vo.WxDoctorListVo;
+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/1/7
+ */
+@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);
+
+    void updateDoctorStatus(@Param("doctorId") Integer doctorId, @Param("status") Integer status);
+
+    void deleteDoctorByDoctorId(Integer doctorId);
+
+    void insertDoctor(CmBrandDoctorPo doctor);
+
+    void updateDoctorByDoctorId(CmBrandDoctorPo doctor);
+
+    void updateDoctorAuditStatus(@Param("doctorId") Integer doctorId, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus, @Param("invalidReason") String invalidReason, @Param("auditBy") Integer auditBy, @Param("auditTime") Date auditTime);
+
+    CmBrandDoctorPo getDoctorById(Integer doctorId);
+
+    Integer getDoctorIdByCertificateNo(@Param("certificateNo") String certificateNo, @Param("authUserId") Integer authUserId);
+
+    void deleteBanner(Integer doctorId);
+
+    void insertBanner(@Param("doctorId") Integer doctorId, @Param("banner") String banner);
+
+    List<String> getBannerList(Integer doctorId);
+
+    void deleteEquipment(Integer doctorId);
+
+    void insertEquipment(@Param("doctorId") Integer doctorId, @Param("equipmentName") String equipmentName, @Param("brand") String brand, @Param("image") String image);
+
+    List<DoctorEquipmentVo> getEquipmentList(Integer doctorId);
+
+    List<WxDoctorListVo> getWxDoctorList(@Param("appId") String appId,@Param("doctorName") String doctorName);
+
+    DoctorFormVo getDoctorDetailsById(Integer doctorId);
+}

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

@@ -16,7 +16,7 @@ import org.apache.ibatis.annotations.Param;
 public interface LoginMapper {
 
 
-    WxClubUserVo findClubUser(String openId);
+    WxClubUserVo findClubUserByOpenId(String openId);
 
     ClubUserPo findByInvitationCode(String invitationCode);
 

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

@@ -83,4 +83,6 @@ public interface ShopMapper {
     String getShopNameByAppId(String appId);
 
     List<String> getShopBrands(Integer authUserId);
+
+    WxShopVo getWxShopInfo(String appId);
 }

+ 6 - 0
src/main/java/com/caimei/model/dto/ProductSaveDto.java

@@ -45,6 +45,12 @@ public class ProductSaveDto {
     @ApiModelProperty("授权牌照")
     private String certificateImage;
 
+    @ApiModelProperty("是否生成二维码授权牌:0否,1是")
+    private Integer addQrCodeFlag;
+
+    @ApiModelProperty("生成二维码授权牌模板:1左下,2右边,3左边")
+    private Integer addTemplateType;
+
     @NotNull(message = "创建人id不能为空")
     @ApiModelProperty("创建人id")
     private Integer createBy;

+ 8 - 2
src/main/java/com/caimei/model/po/CmBrandAuthPo.java

@@ -1,6 +1,7 @@
 package com.caimei.model.po;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
@@ -47,9 +48,14 @@ public class CmBrandAuthPo {
     private String address;
 
     /**
-     * 经
+     * 经度
      */
-    private String lonAndLat;
+    private BigDecimal lng;
+
+    /**
+     * 纬度
+     */
+    private BigDecimal lat;
 
     /**
      * 联系方式

+ 56 - 0
src/main/java/com/caimei/model/po/CmBrandDoctorPo.java

@@ -0,0 +1,56 @@
+package com.caimei.model.po;
+
+import com.caimei.model.vo.ProductFormVo;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * cm_brand_auth
+ * @author 
+ */
+@Data
+public class CmBrandDoctorPo {
+    private Integer id;
+
+    /**
+     * 供应商用户id
+     */
+    private Integer authUserId;
+
+    /**
+     * 医师名称
+     */
+    private String name;
+
+    /**
+     * 从业资格证编号
+     */
+    private String certificateNo;
+
+    /**
+     * 所在机构
+     */
+    private String clubName;
+
+    /**
+     * 医师照片
+     */
+    private String image;
+
+    /**
+     * 上线状态:0已下线,1已上线,2待上线
+     */
+    private Integer status;
+
+    /**
+     * 审核状态:0审核未通过,1审核通过,2待审核
+     */
+    private Integer auditStatus;
+
+    /**
+     * 创建人Id
+     */
+    private Integer createBy;
+
+}

+ 15 - 0
src/main/java/com/caimei/model/po/ProductPo.java

@@ -52,6 +52,11 @@ public class ProductPo {
      */
     private String appletsImage;
 
+    /**
+     * 原授权牌照
+     */
+    private String originalCertificateImage;
+
     /**
      * 授权牌照
      */
@@ -67,6 +72,16 @@ public class ProductPo {
      */
     private String appletsCertificateImage;
 
+    /**
+     * 是否生成二维码授权牌:0否,1是
+     */
+    private Integer addQrCodeFlag;
+
+    /**
+     * 生成二维码授权牌模板:1左下,2右边,3左边
+     */
+    private Integer addTemplateType;
+
     /**
      * 上线状态:0已下线,1已上线,2待上线
      */

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

@@ -45,6 +45,11 @@ public class UserPo {
      */
     private Integer shopType;
 
+    /**
+     * 代理商logo
+     */
+    private String logo;
+
     /**
      * 公众号二维码图片
      */

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

@@ -17,6 +17,9 @@ public class AuthFormVo implements Serializable {
     @ApiModelProperty("授权机构id")
     private Integer authId;
 
+    @ApiModelProperty("授权机构")
+    private String authParty;
+
     @ApiModelProperty("省id")
     private Integer provinceId;
 
@@ -30,7 +33,7 @@ public class AuthFormVo implements Serializable {
     private String address;
 
     @ApiModelProperty("经纬度")
-    private String lonAndLat;
+    private String lngAndLat;
 
     @ApiModelProperty("联系方式")
     private String mobile;

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

@@ -15,33 +15,18 @@ public class AuthVo {
     @ApiModelProperty("授权id")
     private Integer authId;
 
-    /**
-     * 授权机构
-     */
     @ApiModelProperty("授权机构")
     private String authParty;
 
-    /**
-     * 上线状态:0已下线,1已上线,2待上线
-     */
     @ApiModelProperty("上线状态:0已下线,1已上线,2待上线")
     private Integer status;
 
-    /**
-     * 审核状态:0审核未通过,1审核通过,2待审核
-     */
     @ApiModelProperty("审核状态:0审核未通过,1审核通过,2待审核")
     private Integer auditStatus;
 
-    /**
-     * 创建时间
-     */
     @ApiModelProperty("创建时间")
     private Date createTime;
 
-    /**
-     * 创建人Id
-     */
     @ApiModelProperty("创建人")
     private String createBy;
 

+ 29 - 0
src/main/java/com/caimei/model/vo/DoctorEquipmentVo.java

@@ -0,0 +1,29 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2022/1/7
+ */
+@Data
+public class DoctorEquipmentVo implements Serializable {
+    @ApiModelProperty("仪器名称")
+    private String equipmentName;
+
+    @ApiModelProperty("品牌")
+    private String brand;
+
+    @ApiModelProperty("所属机构")
+    private String clubName;
+
+    @ApiModelProperty("轮播图")
+    private List<String> bannerList;
+
+}

+ 38 - 0
src/main/java/com/caimei/model/vo/DoctorFormVo.java

@@ -0,0 +1,38 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/5/11
+ */
+@Data
+public class DoctorFormVo implements Serializable {
+    @ApiModelProperty("医师id")
+    private Integer doctorId;
+
+    @ApiModelProperty("医师名称")
+    private String doctorName;
+
+    @ApiModelProperty("从业资格证编号")
+    private String certificateNo;
+
+    @ApiModelProperty("所属机构")
+    private String clubName;
+
+    @ApiModelProperty("医师照片")
+    private String doctorImage;
+
+    @ApiModelProperty("轮播图")
+    private List<String> bannerList;
+
+    @ApiModelProperty("仪器")
+    private List<DoctorEquipmentVo> equipmentList;
+
+}

+ 44 - 0
src/main/java/com/caimei/model/vo/DoctorListVo.java

@@ -0,0 +1,44 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * cm_brand_doctor
+ * @author  Aslee
+ * @date 2021/5/17
+ */
+@Data
+public class DoctorListVo {
+    @ApiModelProperty("医师id")
+    private Integer doctorId;
+
+    @ApiModelProperty("医师姓名")
+    private String doctorName;
+
+    @ApiModelProperty("从业资格证编号")
+    private String certificateNo;
+
+    @ApiModelProperty("上线状态:0已下线,1已上线,2待上线")
+    private Integer status;
+
+    @ApiModelProperty("审核状态:0审核未通过,1审核通过,2待审核")
+    private Integer auditStatus;
+
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+
+    @ApiModelProperty("创建人")
+    private String createBy;
+
+    @ApiModelProperty("审核人")
+    private String auditBy;
+
+    @ApiModelProperty("审核时间")
+    private Date auditTime;
+
+    @ApiModelProperty("审核不通过原因")
+    private String invalidReason;
+}

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

@@ -16,24 +16,18 @@ import java.util.List;
  */
 @Data
 public class ShopFormVo implements Serializable {
-    /**
-     * 供应商用户id
-     */
     @ApiModelProperty("供应商用户id")
     private Integer authUserId;
 
-    /**
-     * 供应商名称
-     */
     @ApiModelProperty("供应商名称")
     private String shopName;
 
-    /**
-     * 供应商类型:1代理商 2品牌方
-     */
     @ApiModelProperty("供应商类型")
     private Integer shopType;
 
+    @ApiModelProperty("代理商logo")
+    private String logo;
+
     @ApiModelProperty("公众号二维码图片")
     private String qrCodeImage;
 
@@ -43,33 +37,18 @@ public class ShopFormVo implements Serializable {
     @ApiModelProperty("供应商公众号appSecret")
     private String appSecret;
 
-    /**
-     * 手机号
-     */
     @ApiModelProperty("手机号")
     private String mobile;
 
-    /**
-     * 联系人
-     */
     @ApiModelProperty("联系人")
     private String linkMan;
 
-    /**
-     * 供应商状态:0停用 1启用
-     */
     @ApiModelProperty("供应商状态:0停用 1启用")
     private Integer shopStatus;
 
-    /**
-     * 供应商信息列表
-     */
     @ApiModelProperty("供应商信息列表")
     private List<ShopInfoVo> shopInfo;
 
-    /**
-     * 已存在商品的品牌id,以,隔开
-     */
     @ApiModelProperty("已存在商品的品牌id,以,隔开")
     private String existProductBrandIds;
 }

+ 44 - 0
src/main/java/com/caimei/model/vo/WxClubDetailsVo.java

@@ -0,0 +1,44 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/5/11
+ */
+@Data
+public class WxClubDetailsVo implements Serializable {
+    @ApiModelProperty("授权机构id")
+    private Integer authId;
+
+    @ApiModelProperty("授权机构")
+    private String authParty;
+
+    @ApiModelProperty("省市区")
+    private String area;
+
+    @ApiModelProperty("详细地址")
+    private String address;
+
+    @ApiModelProperty("经纬度")
+    private String lngAndLat;
+
+    @ApiModelProperty("联系方式")
+    private String mobile;
+
+    @ApiModelProperty("机构logo")
+    private String logo;
+
+    @ApiModelProperty("轮播图")
+    private List<String> bannerList;
+
+    @ApiModelProperty("已授权设备")
+    private List<WxProductListVo> productList;
+
+}

+ 16 - 3
src/main/java/com/caimei/model/vo/WxClubListVo.java

@@ -3,6 +3,7 @@ package com.caimei.model.vo;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -15,9 +16,21 @@ public class WxClubListVo {
     @ApiModelProperty("机构id")
     private Integer authId;
 
-    /**
-     * 机构名称
-     */
     @ApiModelProperty("机构名称")
     private String clubName;
+
+    @ApiModelProperty("省市区")
+    private String area;
+
+    @ApiModelProperty("详细地址")
+    private String address;
+
+    @ApiModelProperty("联系方式")
+    private String mobile;
+
+    @ApiModelProperty("机构logo")
+    private String logo;
+
+    @ApiModelProperty("距离")
+    private BigDecimal distance;
 }

+ 30 - 0
src/main/java/com/caimei/model/vo/WxDoctorListVo.java

@@ -0,0 +1,30 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 微信公众号商品列表
+ * @author Aslee
+ * @date 2021/5/17
+ */
+@Data
+public class WxDoctorListVo {
+    @ApiModelProperty("医师id")
+    private Integer doctorId;
+
+    @ApiModelProperty("授权机构id")
+    private Integer authId;
+
+    @ApiModelProperty("医师姓名")
+    private String doctorName;
+
+    @ApiModelProperty("资格证编号")
+    private String certificateNo;
+
+    @ApiModelProperty("医师照片")
+    private String doctorImage;
+
+    @ApiModelProperty("机构名称")
+    private String clubName;
+}

+ 12 - 0
src/main/java/com/caimei/model/vo/WxProductListVo.java

@@ -15,6 +15,18 @@ public class WxProductListVo {
     @ApiModelProperty("商品id")
     private Integer productId;
 
+    @ApiModelProperty("授权机构id")
+    private Integer authId;
+
     @ApiModelProperty("商品名称")
     private String productName;
+
+    @ApiModelProperty("商品SN码")
+    private String snCode;
+
+    @ApiModelProperty("商品图片")
+    private String productImage;
+
+    @ApiModelProperty("机构名称")
+    private String clubName;
 }

+ 25 - 0
src/main/java/com/caimei/model/vo/WxShopVo.java

@@ -0,0 +1,25 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/5/11
+ */
+@Data
+public class WxShopVo implements Serializable {
+    @ApiModelProperty("供应商用户id")
+    private Integer authUserId;
+
+    @ApiModelProperty("供应商名称")
+    private String shopName;
+
+    @ApiModelProperty("logo")
+    private String logo;
+}

+ 22 - 8
src/main/java/com/caimei/service/AuthClubService.java

@@ -1,9 +1,7 @@
 package com.caimei.service;
 
 import com.caimei.model.ResponseJson;
-import com.caimei.model.vo.ClubUserVo;
-import com.caimei.model.vo.ClubVo;
-import com.caimei.model.vo.WxClubListVo;
+import com.caimei.model.vo.*;
 import com.github.pagehelper.PageInfo;
 
 /**
@@ -59,13 +57,15 @@ public interface AuthClubService {
 
     /**
      * 微信公众号机构列表
-     * @param appId         供应商公众号appId
-     * @param clubName      机构名称
-     * @param pageNum       第几页
-     * @param pageSize      一页多少条
+     *
+     * @param appId    供应商公众号appId
+     * @param clubName 机构名称
+     * @param pageNum  第几页
+     * @param pageSize 一页多少条
      * @return
      */
-    ResponseJson<PageInfo<WxClubListVo>> getWxClubList(String appId, String clubName, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<WxClubListVo>> getWxClubList(String appId, String lngAndLat, String clubName, Integer provinceId,
+                                                       Integer cityId, Integer townId, Integer pageNum, Integer pageSize);
 
     /**
      * 提交反馈
@@ -74,4 +74,18 @@ public interface AuthClubService {
      * @return
      */
     ResponseJson submitFeedback(Integer clubUserId, String content);
+
+    /**
+     * 微信公众号机构详情
+     * @param authId 机构id
+     * @return
+     */
+    ResponseJson<WxClubDetailsVo> getWxClubDetails(Integer authId);
+
+    /**
+     * 根据appId获取供应商信息
+     * @param appId
+     * @return
+     */
+    ResponseJson<WxShopVo> getWxShopInfo(String appId);
 }

+ 10 - 2
src/main/java/com/caimei/service/AuthProductService.java

@@ -5,6 +5,7 @@ import com.caimei.model.dto.ProductSaveDto;
 import com.caimei.model.vo.ProductFormVo;
 import com.caimei.model.vo.ProductListVo;
 import com.caimei.model.vo.WxProductListVo;
+import com.caimei.module.base.entity.vo.AuthProductVo;
 import com.github.pagehelper.PageInfo;
 
 import java.io.IOException;
@@ -100,13 +101,20 @@ public interface AuthProductService {
 
     /**
      * 微信公众号机构列表
-     * @param authId        认证机构id
+     * @param appId         供应商公众号appId
      * @param productName   商品名称
      * @param pageNum       第几页
      * @param pageSize      一页多少条
      * @return
      */
-    ResponseJson<PageInfo<WxProductListVo>> getWxProductList(Integer authId, String productName, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<WxProductListVo>> getWxProductList(String appId, String productName, Integer pageNum, Integer pageSize);
+
+    /**
+     * 认证商品详情
+     * @param productId     商品id
+     * @return
+     */
+    ResponseJson<AuthProductVo> getAuthProductDetails(Integer productId);
 }
 
 

+ 95 - 0
src/main/java/com/caimei/service/DoctorService.java

@@ -0,0 +1,95 @@
+package com.caimei.service;
+
+import com.caimei.model.ResponseJson;
+import com.caimei.model.po.CmBrandDoctorPo;
+import com.caimei.model.vo.DoctorFormVo;
+import com.caimei.model.vo.DoctorListVo;
+import com.caimei.model.vo.WxDoctorListVo;
+import com.github.pagehelper.PageInfo;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2022/1/7
+ */
+public interface DoctorService {
+
+    /**
+     * 医师列表
+     *
+     * @param listType   列表类型:1医师列表,2医师审核列表
+     * @param authUserId 供应商用户id
+     * @param doctorName  医师
+     * @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);
+
+    /**
+     * 更新医师状态
+     *
+     * @param doctorId 医师id
+     * @param status 医师状态:0停用 1启用
+     * @return ResponseJson
+     */
+    ResponseJson updateDoctorStatus(Integer doctorId, Integer status);
+
+    /**
+     * 删除医师
+     * @param doctorId    医师id
+     * @return  ResponseJson
+     */
+    ResponseJson deleteDoctor(Integer doctorId);
+
+    /**
+     * 添加/编辑医师
+     *
+     * @param doctor       医师机构
+     * @param bannerList 轮播图列表
+     * @param equipmentList 仪器列表
+     * @return ResponseJson
+     */
+    ResponseJson saveDoctor(CmBrandDoctorPo doctor, List<String> bannerList, List<Map<String,String>> equipmentList);
+
+    /**
+     * 审核品牌医师
+     *
+     * @param doctorId            医师id
+     * @param auditStatus       审核状态
+     * @param invalidReason     审核不通过原因
+     * @param auditBy           审核人用户id
+     * @return ResponseJson
+     */
+    ResponseJson auditDoctor(Integer doctorId, Integer auditStatus, String invalidReason, Integer auditBy);
+
+    /**
+     * 医师回显数据
+     * @param doctorId    医师id
+     * @return
+     */
+    ResponseJson<DoctorFormVo> getDoctorFormData(Integer doctorId);
+
+    /**
+     * 微信公众号医师列表
+     * @param appId
+     * @param doctorName
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    ResponseJson<PageInfo<WxDoctorListVo>> getWxDoctorList(String appId, String doctorName, Integer pageNum, Integer pageSize);
+
+    /**
+     * 认证医师详情
+     * @param doctorId
+     * @return
+     */
+    ResponseJson<DoctorFormVo> getAuthDoctorDetails(Integer doctorId);
+}

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

@@ -23,12 +23,13 @@ public interface LoginService {
      *
      * @param mobile
      * @param appId
+     * @param type
      * @return
      */
-    ResponseJson sendVerifyCode(String mobile, String appId);
+    ResponseJson sendVerifyCode(String mobile, String appId, Integer type);
 
     /**
-     * 邀请码登录
+     * 服务号邀请码登录
      * @param mobile
      * @param verifyCode
      * @param invitationCode
@@ -38,4 +39,23 @@ public interface LoginService {
      * @return
      */
     ResponseJson<WxClubUserVo> loginByInvitationCode(String mobile, String verifyCode, String invitationCode, String accessToken, String openId, String appId) throws Exception;
+
+    /**
+     * 订阅号验证码登录
+     * @param mobile        手机号
+     * @param verifyCode    验证码
+     * @param appId         公众号appId
+     * @return
+     */
+    ResponseJson<WxClubUserVo> loginByVerifyCode(String mobile, String verifyCode, String accessToken, String appId);
+
+    /**
+     * 订阅号邀请码登录
+     * @param mobile
+     * @param invitationCode
+     * @param accessToken
+     * @param appId
+     * @return
+     */
+    ResponseJson<WxClubUserVo> loginByInvitationCode(String mobile, String invitationCode, String accessToken, String appId);
 }

+ 2 - 1
src/main/java/com/caimei/service/ShopService.java

@@ -76,13 +76,14 @@ public interface ShopService {
      *                    statementFileId    声明文件id
      *                    createBy           创建人用户id
      *                    }
+     * @param logo
      * @param qrCodeImage
      * @param wxAccountType
      * @param appId
      * @param appSecret
      * @param shopInfoList
      */
-    ResponseJson saveShop(Integer authUserId, Integer shopType, String shopName, String mobile, String linkMan, Integer shopStatus, String qrCodeImage, Integer wxAccountType, String appId, String appSecret, Integer createBy, List<ShopInfoDto> shopInfoList);
+    ResponseJson saveShop(Integer authUserId, Integer shopType, String shopName, String mobile, String linkMan, Integer shopStatus, String logo, String qrCodeImage, Integer wxAccountType, String appId, String appSecret, Integer createBy, List<ShopInfoDto> shopInfoList);
 
     /**
      * 获取供应商回显数据

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

@@ -1,20 +1,24 @@
 package com.caimei.service.impl;
 
+import com.caimei.mapper.AuthMapper;
+import com.caimei.mapper.AuthProductMapper;
 import com.caimei.mapper.ClubMapper;
+import com.caimei.mapper.ShopMapper;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.ClubUserPo;
-import com.caimei.model.vo.ClubUserVo;
-import com.caimei.model.vo.ClubVo;
-import com.caimei.model.vo.WxClubListVo;
+import com.caimei.model.po.CmBrandAuthPo;
+import com.caimei.model.vo.*;
 import com.caimei.service.AuthClubService;
 import com.caimei.utils.CodeUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.util.*;
 
 /**
@@ -30,6 +34,15 @@ public class AuthClubServiceImpl implements AuthClubService {
     @Resource
     private ClubMapper clubMapper;
 
+    @Resource
+    private AuthMapper authMapper;
+
+    @Resource
+    private ShopMapper shopMapper;
+
+    @Resource
+    private AuthProductMapper authProductMapper;
+
     @Override
     public ResponseJson<PageInfo<ClubVo>> getClubList( Integer authUserId, String clubName, Integer pageNum, Integer pageSize) {
         if (null == authUserId) {
@@ -101,12 +114,19 @@ public class AuthClubServiceImpl implements AuthClubService {
     }
 
     @Override
-    public ResponseJson<PageInfo<WxClubListVo>> getWxClubList(String appId, String clubName, Integer pageNum, Integer pageSize) {
+    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);
         }
+        if (StringUtils.isEmpty(lngAndLat)) {
+            return ResponseJson.error("参数异常,请输入用户当前经纬度", null);
+        }
+        String[] split = lngAndLat.split(",");
+        BigDecimal lng = new BigDecimal(split[0]);
+        BigDecimal lat = new BigDecimal(split[1]);
         PageHelper.startPage(pageNum, pageSize);
-        List<WxClubListVo> clubList = clubMapper.getWxClubList(appId, clubName);
+        List<WxClubListVo> clubList = clubMapper.getWxClubList(appId, clubName, provinceId, cityId, townId, lng, lat);
         PageInfo<WxClubListVo> pageData = new PageInfo<>(clubList);
         return ResponseJson.success(pageData);
     }
@@ -122,4 +142,34 @@ public class AuthClubServiceImpl implements AuthClubService {
         clubMapper.insertFeedback(clubUserId, content);
         return ResponseJson.success("提交成功");
     }
+
+    @Override
+    public ResponseJson<WxClubDetailsVo> getWxClubDetails(Integer authId) {
+        if (null == authId) {
+            return ResponseJson.error("参数异常,请输入机构id", null);
+        }
+        WxClubDetailsVo clubDetail = clubMapper.getClubDetails(authId);
+        if (null == clubDetail) {
+            return ResponseJson.error("机构不存在", null);
+        }
+        // 轮播图列表
+        List<String> bannerList = authMapper.getBannerList(clubDetail.getAuthId());
+        clubDetail.setBannerList(bannerList);
+        // 授权设备列表
+        List<WxProductListVo> wxProductList = authProductMapper.getClubProductList(authId);
+        clubDetail.setProductList(wxProductList);
+        return ResponseJson.success(clubDetail);
+    }
+
+    @Override
+    public ResponseJson<WxShopVo> getWxShopInfo(String appId) {
+        if (StringUtils.isEmpty(appId)) {
+            return ResponseJson.error("参数异常,请输入appId", null);
+        }
+        WxShopVo shop = shopMapper.getWxShopInfo(appId);
+        if (null == shop) {
+            return ResponseJson.error("供应商不存在", null);
+        }
+        return ResponseJson.success(shop);
+    }
 }

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

@@ -1,5 +1,7 @@
 package com.caimei.service.impl;
 
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClientBuilder;
 import com.caimei.config.FastDfsClient;
 import com.caimei.mapper.AuthProductMapper;
 import com.caimei.model.ResponseJson;
@@ -8,7 +10,10 @@ import com.caimei.model.po.ProductParamPo;
 import com.caimei.model.po.ProductPo;
 import com.caimei.model.vo.ProductFormVo;
 import com.caimei.model.vo.ProductListVo;
+import com.caimei.model.vo.WxDoctorListVo;
 import com.caimei.model.vo.WxProductListVo;
+import com.caimei.module.base.entity.vo.AuthProductVo;
+import com.caimei.module.base.entity.vo.StatementFileVo;
 import com.caimei.service.AuthProductService;
 import com.caimei.service.UploadService;
 import com.caimei.utils.Base64Util;
@@ -52,11 +57,22 @@ public class AuthProductServiceImpl implements AuthProductService {
 
     private UploadService uploadService;
 
+    @Value("${spring.profiles.active}")
+    private String active;
+
+    @Value("${caimei.oldapi}")
+    private String wwwServer;
+
     @Autowired
     public void setUploadService(UploadService uploadService) {
         this.uploadService = uploadService;
     }
 
+    private String endpoint = "https://oss-cn-shenzhen.aliyuncs.com";
+    private String accessKeyId = "LTAI4GBL3o4YkWnbKYgf2Xia";
+    private String accessKeySecret = "dBjAXqbYiEPP6Ukuk2ZsXQeET7FVkK";
+    private String bucketName = "caimei-oss";
+
     @Override
     public ResponseJson<PageInfo<ProductListVo>> getProductList(Integer listType, Integer authId, String productName, String snCode, Integer status, Integer auditStatus, Integer pageNum, Integer pageSize) {
         if (null == authId) {
@@ -108,6 +124,8 @@ public class AuthProductServiceImpl implements AuthProductService {
         String snCode = productSaveDto.getSnCode();
         String productImage = productSaveDto.getProductImage();
         String certificateImage = productSaveDto.getCertificateImage();
+        Integer addQrCodeFlag = productSaveDto.getAddQrCodeFlag();
+        Integer addTemplateType = productSaveDto.getAddTemplateType();
         Integer createBy = productSaveDto.getCreateBy();
         List<ProductParamPo> paramList = productSaveDto.getParamList();
         if (null == authId) {
@@ -132,6 +150,12 @@ public class AuthProductServiceImpl implements AuthProductService {
         if (StringUtils.isBlank(certificateImage)) {
             return ResponseJson.error("参数异常,请上传授权牌照", null);
         }
+        if (null == addQrCodeFlag) {
+            return ResponseJson.error("参数异常,请选择是否生成二维码授权牌", null);
+        }
+        if (1 == addQrCodeFlag && null == addTemplateType) {
+            return ResponseJson.error("参数异常,请选择二维码授权牌模板", null);
+        }
         if (null == paramList || paramList.size() <= 0) {
             return ResponseJson.error("参数异常,商品参数列表不能为空", null);
         }
@@ -153,39 +177,113 @@ public class AuthProductServiceImpl implements AuthProductService {
         product.setProductImage(productImage);
         // 授权牌照
         product.setCertificateImage(certificateImage);
+        product.setAddQrCodeFlag(addQrCodeFlag);
+        product.setAddTemplateType(addTemplateType);
         // 商品信息保存后,上线状态默认为“待上线”,审核状态为“待审核”
         product.setStatus(2);
         product.setAuditStatus(2);
         if (insertFlag) {
+            // 原授权牌照
+            product.setOriginalCertificateImage(product.getCertificateImage());
             // 创建人id
             product.setCreateBy(createBy);
             // 创建时间
             product.setCreateTime(new Date());
-            // 商品图片和授权牌照添加水印
-            if (StringUtils.isNotBlank(product.getProductImage())) {
-                //商品图片添加水印
-                product.setPcImage(addWaterMark(product.getProductImage(), 1));
-                product.setAppletsImage(addWaterMark(product.getProductImage(), 2));
-            }
-            if (StringUtils.isNotBlank(product.getCertificateImage())) {
+            //商品图片添加水印
+            product.setPcImage(addWaterMark(product.getProductImage(), 1));
+            product.setAppletsImage(addWaterMark(product.getProductImage(), 2));
+            if (0 == addQrCodeFlag) {
                 //授权牌照添加水印
                 product.setPcCertificateImage(addWaterMark(product.getCertificateImage(), 1));
                 product.setAppletsCertificateImage(addWaterMark(product.getCertificateImage(), 2));
             }
             // 插入授权商品
             authProductMapper.insertProduct(product);
+            if (1 == addQrCodeFlag) {
+                // 生成二维码授权牌
+                String addQrCodeImg = addQrCode(product.getCertificateImage(), product.getProductId(), addTemplateType);
+                product.setCertificateImage(addQrCodeImg);
+                //授权牌照添加水印
+                product.setPcCertificateImage(addWaterMark(addQrCodeImg, 1));
+                product.setAppletsCertificateImage(addWaterMark(addQrCodeImg, 2));
+                //更新授权牌照
+                authProductMapper.updateCertificateImage(product);
+            }
         } else {
             // 商品id
             product.setProductId(productId);
-            ProductPo productImages = authProductMapper.getImageByProductId(productId);
-            boolean updateImageFlag = (StringUtils.isNotBlank(product.getProductImage()) && !product.getProductImage().equals(productImages.getProductImage())) || (StringUtils.isEmpty(productImages.getPcImage()) || StringUtils.isEmpty(productImages.getAppletsImage()));
+            ProductPo dbProduct = authProductMapper.getImageByProductId(productId);
+            // 数据库该商品授权牌是否添加二维码
+            Integer dbAddQrCodeFlag = dbProduct.getAddQrCodeFlag();
+            // 数据库该商品授权牌添加二维码模板
+            Integer dbAddTemplateType = dbProduct.getAddTemplateType();
+            // 商品图片是否重新上传
+            boolean updateImageFlag = (StringUtils.isNotBlank(product.getProductImage()) && !product.getProductImage().equals(dbProduct.getProductImage())) || (StringUtils.isEmpty(dbProduct.getPcImage()) || StringUtils.isEmpty(dbProduct.getAppletsImage()));
             if (updateImageFlag) {
                 //商品图片添加水印
                 product.setPcImage(addWaterMark(product.getProductImage(), 1));
                 product.setAppletsImage(addWaterMark(product.getProductImage(), 2));
             }
-            updateImageFlag = (StringUtils.isNotBlank(product.getCertificateImage()) && !product.getCertificateImage().equals(productImages.getCertificateImage())) || (StringUtils.isEmpty(productImages.getPcCertificateImage()) || StringUtils.isEmpty(productImages.getPcCertificateImage()));
-            if (updateImageFlag) {
+            // 授权牌照是否重新上传
+            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 (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(product.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;
+                    }
+                } 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));
@@ -226,6 +324,22 @@ public class AuthProductServiceImpl implements AuthProductService {
         return imagePath;
     }
 
+    private String addQrCode(String certificateImage, Integer productId, Integer addTemplateType) throws IOException {
+        String qrCodeLink = wwwServer + "/product/auth/product-" + productId + ".html";
+        String qrCodeImage = ImageUtils.addQrCode(certificateImage, qrCodeLink, addTemplateType);
+        String imagePath = null;
+        if (StringUtils.isNotEmpty(qrCodeImage)) {
+            MultipartFile imgFile = Base64Util.base64ToMultipart(qrCodeImage);
+            if (null != imgFile) {
+                imagePath = uploadService.saveFile(imgFile);
+            }
+            log.info(">>>>>>>>>>>>>>>>水印图片上传成功:" + imagePath);
+        } else {
+            log.info(">>>>>>>>>>>>>>>>水印图片上传失败");
+        }
+        return imagePath;
+    }
+
     @Override
     public ResponseJson<ProductFormVo> getProductFormData(Integer productId) {
         if (null == productId) {
@@ -295,13 +409,35 @@ public class AuthProductServiceImpl implements AuthProductService {
     }
 
     @Override
-    public ResponseJson<PageInfo<WxProductListVo>> getWxProductList(Integer authId, String productName, Integer pageNum, Integer pageSize) {
-        if (null == authId) {
-            return ResponseJson.error("参数异常,请输入授权id", null);
+    public ResponseJson<PageInfo<WxProductListVo>> getWxProductList(String appId, String productName, Integer pageNum, Integer pageSize) {
+        if (null == appId) {
+            return ResponseJson.error("参数异常,请输入供应商appId", null);
         }
         PageHelper.startPage(pageNum, pageSize);
-        List<WxProductListVo> productList = authProductMapper.getWxProductList(authId, productName);
+        List<WxProductListVo> productList = authProductMapper.getWxProductList(appId, productName);
         PageInfo<WxProductListVo> pageData = new PageInfo<>(productList);
         return ResponseJson.success(pageData);
     }
+
+    @Override
+    public ResponseJson<AuthProductVo> getAuthProductDetails(Integer productId) {
+        AuthProductVo authProduct = authProductMapper.getAuthProductByProductId(productId);
+        if (null == authProduct) {
+            return ResponseJson.error("商品不存在", null);
+        }
+        // 代理声明文件
+        if (null != authProduct.getStatementType() && authProduct.getStatementType() == 4) {
+            StatementFileVo statementFile = authProductMapper.getStatementFile(authProduct.getAuthUserId(), authProduct.getBrandId());
+            OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
+            // 设置URL过期时间为1个小时
+            Date expiration = new Date(System.currentTimeMillis() + 3600L * 1000);
+            String url = ossClient.generatePresignedUrl(bucketName, active + "/authFile/" + statementFile.getOssName(), expiration).toString();
+            statementFile.setUrl(url);
+            ossClient.shutdown();
+            authProduct.setStatementFile(statementFile);
+        }
+        // 商品参数
+        authProduct.setParamList(authProductMapper.getAuthProductParams(productId));
+        return ResponseJson.success(authProduct);
+    }
 }

+ 5 - 20
src/main/java/com/caimei/service/impl/AuthServiceImpl.java

@@ -84,25 +84,7 @@ public class AuthServiceImpl implements AuthService {
         }
         listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
-        List<AuthVo> authList = authMapper.getAuthList(listType, authUserId, authParty, status, auditStatus);
-        ListIterator<AuthVo> iterator = authList.listIterator();
-        while (iterator.hasNext()) {
-            // 根据是否完成商品信息审核筛选项,进行筛选
-            AuthVo auth = iterator.next();
-            Integer waitAuditNum = auth.getWaitAuditNum();
-            if (waitAuditNum > 0) {
-                auth.setLowerAuditStatus(0);
-                if (null != lowerAuditStatus && 1 == lowerAuditStatus) {
-                    iterator.remove();
-                }
-            } else {
-                auth.setLowerAuditStatus(1);
-                if (null != lowerAuditStatus && 0 == lowerAuditStatus) {
-                    iterator.remove();
-                }
-            }
-        }
-
+        List<AuthVo> authList = authMapper.getAuthList(listType, authUserId, authParty, status, auditStatus, lowerAuditStatus);
         PageInfo<AuthVo> pageData = new PageInfo<>(authList);
         return ResponseJson.success(pageData);
     }
@@ -130,6 +112,8 @@ public class AuthServiceImpl implements AuthService {
         }
         // 删除品牌授权
         authMapper.deleteAuthByAuthId(authId);
+        // 删除轮播图
+        authMapper.deleteBanner(authId);
         // 删除商品及商品参数
         List<Integer> productIdList = authProductService.getProductIdsByAuthId(authId);
         productIdList.forEach(productId->{
@@ -149,6 +133,7 @@ public class AuthServiceImpl implements AuthService {
         AuthFormVo authFormVo = new AuthFormVo();
         authFormVo.setAuthId(auth.getId());
         BeanUtils.copyProperties(auth, authFormVo);
+        authFormVo.setLngAndLat(auth.getLng() + "," + auth.getLat());
         List<String> bannerList = authMapper.getBannerList(authId);
         authFormVo.setBannerList(bannerList);
         return ResponseJson.success(authFormVo);
@@ -173,7 +158,7 @@ public class AuthServiceImpl implements AuthService {
             return ResponseJson.error("参数异常,请输入创建人id");
         }
         if (!importFlag) {
-            if (null == auth.getProvinceId() || null == auth.getCityId() || null == auth.getTownId() || StringUtils.isEmpty(auth.getAddress()) || StringUtils.isEmpty(auth.getLonAndLat())) {
+            if (null == auth.getProvinceId() || null == auth.getCityId() || null == auth.getTownId() || StringUtils.isEmpty(auth.getAddress()) || null == auth.getLng() || null == auth.getLat()) {
                 return ResponseJson.error("参数异常,地址信息异常");
             }
             if (StringUtils.isEmpty(auth.getLogo())) {

+ 209 - 0
src/main/java/com/caimei/service/impl/DoctorServiceImpl.java

@@ -0,0 +1,209 @@
+package com.caimei.service.impl;
+
+import com.caimei.mapper.DoctorMapper;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.po.CmBrandDoctorPo;
+import com.caimei.model.vo.*;
+import com.caimei.service.DoctorService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2022/1/7
+ */
+@Slf4j
+@Service
+public class DoctorServiceImpl implements DoctorService {
+
+    @Resource
+    private DoctorMapper doctorMapper;
+
+    @Value("${spring.profiles.active}")
+    private String active;
+
+    @Value("${caimei.imageDomain}")
+    private String imageDomain;
+
+    @Override
+    public ResponseJson<PageInfo<DoctorListVo>> getDoctorList(Integer listType, Integer authUserId, String doctorName, 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);
+        PageInfo<DoctorListVo> pageData = new PageInfo<>(doctorList);
+        return ResponseJson.success(pageData);
+    }
+
+    @Override
+    public ResponseJson updateDoctorStatus(Integer doctorId, Integer status) {
+        if (null == doctorId) {
+            return ResponseJson.error("请输入医师id");
+        }
+        if (null == status) {
+            return ResponseJson.error("请输入要更新的状态值");
+        }
+        doctorMapper.updateDoctorStatus(doctorId, status);
+        if (0 == status) {
+            return ResponseJson.success("下线医师成功");
+        } else {
+            return ResponseJson.success("上线医师成功");
+        }
+    }
+
+    @Override
+    public ResponseJson deleteDoctor(Integer doctorId) {
+        if (null == doctorId) {
+            return ResponseJson.error("参数异常,请输入医师id");
+        }
+        // 删除医师
+        doctorMapper.deleteDoctorByDoctorId(doctorId);
+        // 删除轮播图
+        doctorMapper.deleteBanner(doctorId);
+        // 删除仪器
+        doctorMapper.deleteEquipment(doctorId);
+        return ResponseJson.success("删除医师成功");
+    }
+
+    @Override
+    public ResponseJson<DoctorFormVo> getDoctorFormData(Integer doctorId) {
+        if (null == doctorId) {
+            return ResponseJson.error("参数异常,医师id不能为空", null);
+        }
+        CmBrandDoctorPo doctor = doctorMapper.getDoctorById(doctorId);
+        DoctorFormVo doctorFormVo = new DoctorFormVo();
+        doctorFormVo.setDoctorId(doctor.getId());
+        doctorFormVo.setDoctorName(doctor.getName());
+        BeanUtils.copyProperties(doctor, doctorFormVo);
+        // 轮播图
+        List<String> bannerList = doctorMapper.getBannerList(doctorId);
+        doctorFormVo.setBannerList(bannerList);
+        // 仪器
+        List<DoctorEquipmentVo> equipmentList = doctorMapper.getEquipmentList(doctorId);
+        doctorFormVo.setEquipmentList(equipmentList);
+        return ResponseJson.success(doctorFormVo);
+    }
+
+    @Override
+    public ResponseJson saveDoctor(CmBrandDoctorPo doctor, List<String> bannerList, List<Map<String,String>> equipmentList) {
+        Integer doctorId = doctor.getId();
+        Integer authUserId = doctor.getAuthUserId();
+        String certificateNo = doctor.getCertificateNo();
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,请输入供应商用户id");
+        }
+        if (StringUtils.isBlank(doctor.getName())) {
+            return ResponseJson.error("参数异常,请输入医师名称");
+        }
+        if (StringUtils.isBlank(certificateNo)) {
+            return ResponseJson.error("参数异常,请输入从业资格证编号");
+        }
+        Integer doctorIdByCertificateNo = doctorMapper.getDoctorIdByCertificateNo(certificateNo, authUserId);
+        if (null != doctorIdByCertificateNo && !doctorIdByCertificateNo.equals(doctorId)) {
+            return ResponseJson.error("参数异常,该从业资格证编号已存在,请重新输入", null);
+        }
+        if (StringUtils.isBlank(doctor.getClubName())) {
+            return ResponseJson.error("参数异常,请输入所属机构");
+        }
+        if (StringUtils.isBlank(doctor.getImage())) {
+            return ResponseJson.error("参数异常,请上传医师照片");
+        }
+        if (null == doctor.getCreateBy()) {
+            return ResponseJson.error("参数异常,请输入创建人id");
+        }
+        if (null == bannerList || bannerList.size() <= 0) {
+            return ResponseJson.error("参数异常,请上传轮播图");
+        }
+        if (null == equipmentList || equipmentList.size() <= 0) {
+            return ResponseJson.error("参数异常,请上传设备列表");
+        }
+        // 保存医师信息,上线状态默认为“待上线”,审核状态为“待审核”
+        doctor.setStatus(2);
+        doctor.setAuditStatus(2);
+        /*
+            保存医师
+         */
+        if (null == doctorId) {
+            doctorMapper.insertDoctor(doctor);
+        } else {
+            doctorMapper.updateDoctorByDoctorId(doctor);
+            // 删除原有的轮播图
+            doctorMapper.deleteBanner(doctor.getId());
+            // 删除原有的设备
+            doctorMapper.deleteEquipment(doctor.getId());
+        }
+        // 保存轮播图
+        bannerList.forEach(banner-> doctorMapper.insertBanner(doctor.getId(), banner));
+        // 保存设备
+        equipmentList.forEach(equipment-> {
+            doctorMapper.insertEquipment(doctor.getId(), equipment.get("equipmentName"), equipment.get("brand"), equipment.get("image"));
+        });
+        return ResponseJson.success("保存医师成功", doctor);
+    }
+
+    @Override
+    public ResponseJson auditDoctor(Integer doctorId, Integer auditStatus, String invalidReason, Integer auditBy) {
+        if (doctorId == null) {
+            return ResponseJson.error("请输入医师id");
+        }
+        if (auditStatus == null) {
+            return ResponseJson.error("请输入审核结果");
+        }
+        if (auditStatus == 0 && StringUtils.isEmpty(invalidReason)) {
+            return ResponseJson.error("请输入审核不通过的原因");
+        }
+        if (auditBy == null) {
+            return ResponseJson.error("请输入审核人用户id");
+        }
+        Date auditTime = new Date();
+        // 医师状态更新
+        Integer status = null;
+        if (auditStatus == 0) {
+            // 审核不通过,下线医师
+            status = 0;
+        } else {
+            // 审核通过,上线医师
+            status = 1;
+        }
+        doctorMapper.updateDoctorAuditStatus(doctorId, status, auditStatus, invalidReason, auditBy, auditTime);
+        return ResponseJson.success("审核医师成功");
+    }
+
+    @Override
+    public ResponseJson<PageInfo<WxDoctorListVo>> getWxDoctorList(String appId, String doctorName, Integer pageNum, Integer pageSize) {
+        if (null == appId) {
+            return ResponseJson.error("参数异常,请输入供应商appId", null);
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        List<WxDoctorListVo> productList = doctorMapper.getWxDoctorList(appId, doctorName);
+        PageInfo<WxDoctorListVo> pageData = new PageInfo<>(productList);
+        return ResponseJson.success(pageData);
+    }
+
+    @Override
+    public ResponseJson<DoctorFormVo> getAuthDoctorDetails(Integer doctorId) {
+        if (null == doctorId) {
+            return ResponseJson.error("参数异常,医师id不能为空", null);
+        }
+        DoctorFormVo doctor = doctorMapper.getDoctorDetailsById(doctorId);
+        // 轮播图
+        List<String> bannerList = doctorMapper.getBannerList(doctorId);
+        doctor.setBannerList(bannerList);
+        // 仪器
+        List<DoctorEquipmentVo> equipmentList = doctorMapper.getEquipmentList(doctorId);
+        doctor.setEquipmentList(equipmentList);
+        return ResponseJson.success(doctor);
+    }
+}

+ 87 - 5
src/main/java/com/caimei/service/impl/LoginServiceImpl.java

@@ -69,7 +69,7 @@ public class LoginServiceImpl implements LoginService {
         String openId = infoMap.get("openId");
         String accessToken = infoMap.get("accessToken");
         log.info("微信授权,openId:>>>>>>>>>>>" + openId);
-        WxClubUserVo clubUser = loginMapper.findClubUser(openId);
+        WxClubUserVo clubUser = loginMapper.findClubUserByOpenId(openId);
         if (null == clubUser) {
             clubUser = new WxClubUserVo();
             clubUser.setOpenId(openId);
@@ -83,16 +83,18 @@ public class LoginServiceImpl implements LoginService {
     }
 
     @Override
-    public ResponseJson sendVerifyCode(String mobile, String appId) {
+    public ResponseJson sendVerifyCode(String mobile, String appId, Integer type) {
         if (StringUtils.isEmpty(mobile)) {
             return ResponseJson.error("参数异常,请输入手机号");
         }
         if (StringUtils.isEmpty(appId)) {
             return ResponseJson.error("参数异常,请输入appId");
         }
-        Integer clubUserId = clubMapper.checkMobile(mobile, appId);
-        if (null != clubUserId) {
-            return ResponseJson.error("该手机号已使用,请重新输入");
+        if (1 == type) {
+            Integer clubUserId = clubMapper.checkMobile(mobile, appId);
+            if (null != clubUserId) {
+                return ResponseJson.error("该手机号已使用,请重新输入");
+            }
         }
         // 获取供应商名称
         String shopName = shopMapper.getShopNameByAppId(appId);
@@ -172,4 +174,84 @@ public class LoginServiceImpl implements LoginService {
         redisService.set(accessToken, openId, 60L * 60 * 4);
         return ResponseJson.success(clubUser);
     }
+
+    @Override
+    public ResponseJson<WxClubUserVo> loginByVerifyCode(String mobile, String verifyCode, String accessToken, 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);
+        }
+        // 校验验证码是否正确
+        String redisVerifyCode = null == redisService.get("code:" + mobile) ? null : redisService.get("code:" + mobile).toString();
+        if (!verifyCode.equals(redisVerifyCode)) {
+            return ResponseJson.error("验证码错误,请重新输入", null);
+        }
+        // 获取手机号对应机构用户
+        WxClubUserVo clubUser = clubMapper.getWxClubUser(mobile, appId);
+        if (null == clubUser) {
+            clubUser = new WxClubUserVo();
+            clubUser.setMobile(mobile);
+            return ResponseJson.error(-2,"未注册,请填写邀请码注册", clubUser);
+        }
+        // 校验机构和供应商的状态是否为已上线
+        CmBrandAuthPo clubPo = authMapper.getAuthById(clubUser.getAuthId());
+        Integer shopStatus = shopMapper.getShopStatus(clubPo.getAuthUserId());
+        if (1 != clubPo.getStatus() || 1 != shopStatus) {
+            return ResponseJson.error("登录失败", null);
+        }
+        // 登录成功redis保存token
+        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) {
+        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);
+        }
+        // 校验邀请码是否有效
+        ClubUserPo clubUserPo = loginMapper.findByInvitationCode(invitationCode);
+        if (null == clubUserPo || 2 == clubUserPo.getStatus() || clubUserPo.getInvitationCodeTime().compareTo(new Date()) < 0) {
+            return ResponseJson.error("邀请码已失效", null);
+        }
+        // 校验机构和供应商的状态是否为已上线
+        CmBrandAuthPo clubPo = authMapper.getAuthById(clubUserPo.getAuthId());
+        Integer shopStatus = shopMapper.getShopStatus(clubPo.getAuthUserId());
+        if (1 != clubPo.getStatus() || 1 != shopStatus) {
+            return ResponseJson.error("登录失败", null);
+        }
+        // 校验appId是否和机构所属供应商的appId相同
+        String dbAppId = shopMapper.getAppId(clubPo.getAuthUserId());
+        if (StringUtils.isEmpty(dbAppId) || !appId.equals(dbAppId)) {
+            return ResponseJson.error("登录失败", null);
+        }
+        loginMapper.bindClubUser(mobile, null, null, invitationCode);
+        WxClubUserVo clubUser = new WxClubUserVo();
+        clubUser.setClubUserId(clubUserPo.getId());
+        clubUser.setAuthId(clubUserPo.getAuthId());
+        clubUser.setAuthUserId(clubPo.getAuthUserId());
+        clubUser.setMobile(mobile);
+        clubUser.setAccessToken(accessToken);
+        // 登录成功redis保存token
+        redisService.set(accessToken, mobile + "|" + appId, 60L * 60 * 24);
+        return ResponseJson.success(clubUser);
+    }
 }

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

@@ -187,7 +187,7 @@ public class ShopServiceImpl implements ShopService {
     }
 
     @Override
-    public ResponseJson saveShop(Integer authUserId, Integer shopType, String shopName, String mobile, String linkMan, Integer shopStatus, String qrCodeImage, Integer wxAccountType, String appId, String appSecret, Integer createBy, List<ShopInfoDto> shopInfoList) {
+    public ResponseJson saveShop(Integer authUserId, Integer shopType, String shopName, String mobile, String linkMan, Integer shopStatus, String logo, String qrCodeImage, Integer wxAccountType, String appId, String appSecret, Integer createBy, List<ShopInfoDto> shopInfoList) {
         // 是否为添加操作
         boolean insertFlag = null == authUserId;
         Integer userIdByMobile = shopMapper.getUserIdByMobile(mobile);
@@ -232,6 +232,8 @@ public class ShopServiceImpl implements ShopService {
         shop.setLinkMan(linkMan);
         // 供应商状态
         shop.setStatus(shopStatus);
+        // 代理商logo
+        shop.setLogo(logo);
         // 公众号二维码图片
         shop.setQrCodeImage(qrCodeImage);
         // 公众号类型

+ 106 - 0
src/main/java/com/caimei/utils/ImageUtils.java

@@ -1,5 +1,9 @@
 package com.caimei.utils;
 
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.EncodeHintType;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.common.BitMatrix;
 import org.springframework.util.StringUtils;
 import sun.misc.BASE64Encoder;
 
@@ -8,7 +12,10 @@ import javax.swing.*;
 import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.io.ByteArrayOutputStream;
+import java.io.File;
 import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Description
@@ -193,4 +200,103 @@ public class ImageUtils {
 		}
 		return null;
 	}
+
+	public static String addQrCode(String srcImgURL, String qrCodeLink, Integer addTemplateType) {
+		//io流
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		try {
+			//原图片
+			ImageIcon imageIcon = new ImageIcon(new URL(srcImgURL));
+			Image srcImg = imageIcon.getImage();
+			BufferedImage buffImg = ImageIO.read(new URL(srcImgURL));
+
+			//二维码图片
+			BufferedImage qrCodeImg = createQrCode(qrCodeLink);
+
+			// 1、得到画笔对象
+			Graphics2D g = buffImg.createGraphics();
+
+			// 2、设置对线段的锯齿状边缘处理
+			g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
+					RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+
+			g.drawImage(
+					srcImg.getScaledInstance(srcImg.getWidth(null),
+							srcImg.getHeight(null), Image.SCALE_SMOOTH), 0, 0,
+					null);
+			g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP,
+					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;
+				y = srcHeight* 3 / 4 - qrCodeHeight / 2 - 12;
+			} else if (2 == addTemplateType) {
+				x = srcWidth * 3 / 4 - qrCodeWidth / 2 + 46;
+				y = (srcHeight - qrCodeHeight) / 2;
+			} else if (3 == addTemplateType) {
+				x = srcWidth / 4 - qrCodeWidth / 2 - 46;
+				y = (srcHeight - qrCodeHeight) / 2;
+			}
+			g.drawImage(qrCodeImg, x, y, null);
+			g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
+			// 7、释放资源
+			g.dispose();
+
+			//将图片写入流中
+			String fileType = srcImgURL.substring(srcImgURL.lastIndexOf(".") + 1);
+			ImageIO.write(buffImg, fileType, baos);
+			//转换成字节
+			byte[] bytes = baos.toByteArray();
+			BASE64Encoder encoder = new BASE64Encoder();
+			//转换成base64串
+			String addImage = encoder.encodeBuffer(bytes).trim();
+			//删除 \r\n
+			addImage = addImage.replaceAll("\n", "").replaceAll("\r", "");
+			return "data:image/jpg;base64," + addImage;
+
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				if (null != baos) {
+					baos.close();
+				}
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+		return null;
+	}
+
+	private static final int BLACK = 0xFF000000;
+	private static final int WHITE = 0xFFFFFFFF;
+
+	public static BufferedImage createQrCode(String url) {
+		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);
+			int width = bitMatrix.getWidth();
+			int height = bitMatrix.getHeight();
+			BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+			for (int x = 0; x < width; x++) {
+				for (int y = 0; y < height; y++) {
+					image.setRGB(x, y, bitMatrix.get(x, y) ? BLACK : WHITE);
+				}
+			}
+			return image;
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
 }

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

@@ -34,7 +34,7 @@ public class LoginApi {
 
     private final LoginService loginService;
 
-    @ApiOperation("公众号授权登录")
+    @ApiOperation("服务号授权登录")
     @ApiImplicitParam(name = "params", value = "code登录凭证;appId;", required = true)
     @PostMapping("/login/authorization")
     public ResponseJson<WxClubUserVo> authorizationLogin(@RequestBody String params) {
@@ -45,18 +45,19 @@ public class LoginApi {
     }
 
     @ApiOperation("登录验证码发送")
-    @ApiImplicitParam(name = "params", value = "mobile:手机号", 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);
         String mobile = parseObject.getString("mobile");
         String appId = parseObject.getString("appId");
-        return loginService.sendVerifyCode(mobile, appId);
+        Integer type = parseObject.getInteger("type");
+        return loginService.sendVerifyCode(mobile, appId, type);
     }
 
-    @ApiOperation("邀请码登录")
+    @ApiOperation("服务号邀请码登录")
     @ApiImplicitParam(name = "params", value = "mobile:手机号;verifyCode:验证码;invitationCode:邀请码;accessToken;openId;appId", required = true)
-    @PostMapping("/login/invitation/code")
+    @PostMapping("/login/service/invitation/code")
     public ResponseJson<WxClubUserVo> invitationCode(@RequestBody String params) throws Exception {
         JSONObject parseObject = JSONObject.parseObject(params);
         String mobile = parseObject.getString("mobile");
@@ -68,6 +69,30 @@ public class LoginApi {
         return loginService.loginByInvitationCode(mobile, verifyCode, invitationCode, accessToken, openId, appId);
     }
 
+    @ApiOperation("订阅号验证码登录")
+    @ApiImplicitParam(name = "params", value = "mobile:手机号;verifyCode:验证码;accessToken;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);
+    }
+
+    @ApiOperation("订阅号邀请码登录")
+    @ApiImplicitParam(name = "params", value = "mobile:手机号;invitationCode:邀请码;accessToken;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);
+    }
+
     @ApiOperation("校验token是否失效")
     @PostMapping("/token/check")
     public ResponseJson checkToken(){

+ 65 - 7
src/main/java/com/caimei/wxController/WxAuthApi.java

@@ -1,10 +1,11 @@
 package com.caimei.wxController;
 
 import com.caimei.model.ResponseJson;
-import com.caimei.model.vo.WxClubListVo;
-import com.caimei.model.vo.WxProductListVo;
+import com.caimei.model.vo.*;
+import com.caimei.module.base.entity.vo.AuthProductVo;
 import com.caimei.service.AuthClubService;
 import com.caimei.service.AuthProductService;
+import com.caimei.service.DoctorService;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -30,32 +31,89 @@ public class WxAuthApi {
 
     private final AuthProductService authProductService;
 
+    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 = "一页多少条")
+    })
+    @GetMapping("/shop/info")
+    public ResponseJson<WxShopVo> getWxShopInfo(String appId) {
+        return authClubService.getWxShopInfo(appId);
+    }
+
     @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 = "一页多少条")
     })
     @GetMapping("/club/list")
-    public ResponseJson<PageInfo<WxClubListVo>> getWxClubList(String appId, String clubName,
+    public ResponseJson<PageInfo<WxClubListVo>> getWxClubList(String appId, String lngAndLat, String clubName, Integer provinceId,
+                                                              Integer cityId, Integer townId,
                                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
-        return authClubService.getWxClubList(appId, clubName, pageNum, pageSize);
+        return authClubService.getWxClubList(appId, lngAndLat, clubName, provinceId, cityId, townId, pageNum, pageSize);
     }
 
+    @ApiOperation("已认证机构详情")
+    @ApiImplicitParam(required = false, name = "authId", value = "正品联盟机构Id")
+    @GetMapping("/club/details")
+    public ResponseJson<WxClubDetailsVo> getWxClubDetails(Integer authId) {
+        return authClubService.getWxClubDetails(authId);
+    }
 
     @ApiOperation("已认证商品列表")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "authId", required = true, value = "认证机构id"),
+            @ApiImplicitParam(name = "appId", required = true, value = "供应商公众号appId"),
             @ApiImplicitParam(name = "productName", required = false, value = "商品名称"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     @GetMapping("/product/list")
-    public ResponseJson<PageInfo<WxProductListVo>> getWxProductList(Integer authId, String productName,
+    public ResponseJson<PageInfo<WxProductListVo>> getWxProductList(String appId, String productName,
                                                                     @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                     @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
-        return authProductService.getWxProductList(authId, productName, pageNum, pageSize);
+        return authProductService.getWxProductList(appId, productName, pageNum, pageSize);
+    }
+
+    @ApiOperation("已认证商品详情")
+    @ApiImplicitParam(required = false, name = "productId", value = "正品联盟商品Id")
+    @GetMapping("/product/details")
+    public ResponseJson<AuthProductVo> getAuthProductDetails(Integer productId) {
+        return authProductService.getAuthProductDetails(productId);
+    }
+
+    @ApiOperation("已认证医师列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "appId", required = true, value = "供应商公众号appId"),
+            @ApiImplicitParam(name = "productName", required = false, value = "医师名称"),
+            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
+            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
+    })
+    @GetMapping("/product/list")
+    public ResponseJson<PageInfo<WxDoctorListVo>> getWxDoctorList(String appId, String doctorName,
+                                                                   @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                                   @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return doctorService.getWxDoctorList(appId, doctorName, pageNum, pageSize);
+    }
+
+    @ApiOperation("已认证医师详情")
+    @ApiImplicitParam(required = false, name = "doctorId", value = "正品联盟医师Id")
+    @GetMapping("/doctor/details")
+    public ResponseJson<DoctorFormVo> getAuthDoctorDetails(Integer doctorId) {
+        return doctorService.getAuthDoctorDetails(doctorId);
     }
 }

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

@@ -51,7 +51,7 @@ logging:
 
 # swagger文档显示配置
 swagger:
-  enabled: false
+  enabled: true
 
 # 新旧www服务域名
 caimei:

+ 22 - 9
src/main/resources/mapper/AuthMapper.xml

@@ -2,9 +2,9 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.mapper.AuthMapper">
     <insert id="insertAuth" keyColumn="id" keyProperty="id" useGeneratedKeys="true" parameterType="com.caimei.model.po.CmBrandAuthPo">
-        insert into cm_brand_auth (authUserId, authParty, provinceId, cityId, townId, address, lonAndLat,
+        insert into cm_brand_auth (authUserId, authParty, provinceId, cityId, townId, address, lng, lat,
                                    mobile, logo, status, createTime, createBy, auditStatus)
-        values (#{authUserId}, #{authParty}, #{provinceId}, #{cityId}, #{townId}, #{address}, #{lonAndLat},
+        values (#{authUserId}, #{authParty}, #{provinceId}, #{cityId}, #{townId}, #{address}, #{lng}, #{lat},
                 #{mobile}, #{logo}, #{status}, NOW(), #{createBy}, #{auditStatus})
     </insert>
     <insert id="insertBanner">
@@ -23,7 +23,8 @@
             cityId      = #{cityId},
             townId      = #{townId},
             address     = #{address},
-            lonAndLat   = #{lonAndLat},
+            lng         = #{lng},
+            lat         = #{lat},
             mobile      = #{mobile},
             logo        = #{logo},
             status      = #{status},
@@ -47,11 +48,14 @@
     </delete>
     <select id="getAuthList" resultType="com.caimei.model.vo.AuthVo">
         select id as authId, authParty, a.status, a.auditStatus, a.createTime, cu.name as createBy,
-               au.name as auditBy,a.auditTime,a.invalidReason,
-            (select count(*) from cm_brand_auth_product where authId = a.id and auditStatus = 2) as waitAuditNum
+            au.name as auditBy,a.auditTime,a.invalidReason,
+            ifnull(ap.waitAuditNum,0) as waitAuditNum,
+            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 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
+            authId) ap on a.id = ap.authId
         where a.authUserId = #{authUserId}
         <if test="authParty != null and authParty != ''">
             and a.authParty like CONCAT('%',#{authParty},'%')
@@ -62,6 +66,14 @@
         <if test="auditStatus != null">
             and a.auditStatus = #{auditStatus}
         </if>
+        <if test="lowerAuditStatus != null">
+            <if test="0 == lowerAuditStatus">
+                and ifnull(ap.waitAuditNum,0) > 0
+            </if>
+            <if test="1 == lowerAuditStatus">
+                and ifnull(ap.waitAuditNum,0) = 0
+            </if>
+        </if>
         <choose>
             <when test="listType == 2">
                 order by a.auditStatus desc,waitAuditNum desc, a.createTime desc
@@ -90,7 +102,8 @@
                cityId,
                townId,
                address,
-               lonAndLat,
+               lng,
+               lat,
                mobile,
                logo,
                status
@@ -110,6 +123,6 @@
         order by createTime desc
     </select>
     <select id="getBannerList" resultType="java.lang.String">
-        select from cm_brand_auth_banner where authId = #{authId}
+        select banner from cm_brand_auth_banner where authId = #{authId}
     </select>
 </mapper>

+ 82 - 6
src/main/resources/mapper/AuthProductMapper.xml

@@ -61,6 +61,13 @@
             auditTime     = #{auditTime}
         where id = #{productId}
     </update>
+    <update id="updateCertificateImage">
+        update cm_brand_auth_product
+        set certificateImage = #{certificateImage},
+            pcCertificateImage = #{pcCertificateImage},
+            appletsCertificateImage = #{appletsCertificateImage}
+        where id = #{productId}
+    </update>
     <delete id="deleteProductByProductId">
         delete from cm_brand_auth_product where id = #{productId}
     </delete>
@@ -122,9 +129,13 @@
         select image as productImage,
                pcImage,
                appletsImage,
+               addQrCodeFlag,
+               originalCertificateImage,
                certificateImage,
                pcCertificateImage,
-               appletsCertificateImage
+               appletsCertificateImage,
+               addQrCodeFlag,
+               addTemplateType
         from cm_brand_auth_product
         where id = #{productId}
     </select>
@@ -139,13 +150,20 @@
         from cm_brand_auth_product
     </select>
     <select id="getWxProductList" resultType="com.caimei.model.vo.WxProductListVo">
-        select id as productId,name as productName
-        from cm_brand_auth_product
-        where authId = #{authId}
+        select p.id as productId,p.authId, p.name as productName,p.snCode,p.image as productImage,a.authParty
+        from cm_brand_auth_product p
+        left join cm_brand_auth a on p.authId = a.id
+        left join cm_brand_auth_user au on a.authUserId = au.authUserId
+        where au.appId = #{appId}
         <if test="productName != null and productName != ''">
-            and name like concat('%',#{productName},'%')
+            and p.name like concat('%',#{productName},'%')
         </if>
-        order by createTime desc
+        and au.status = 1
+        and a.status = 1
+        and a.auditStatus = 1
+        and p.status = 1
+        and p.auditStatus = 1
+        order by p.createTime desc
     </select>
     <select id="getBrandIdByBrandName" resultType="java.lang.Integer">
         select id from cm_brand where name = #{brand}
@@ -157,4 +175,62 @@
         where authId = #{authId}
         order by createTime desc
     </select>
+    <select id="getAuthProductByProductId" resultType="com.caimei.module.base.entity.vo.AuthProductVo">
+        select p.name       as productName,
+               p.snCode,
+               p.pcImage,
+               p.appletsImage,
+               p.pcCertificateImage,
+               p.appletsCertificateImage,
+               p.brandId,
+               b.authLogo,
+               b.name       as brandName,
+               c.name       as productionPlace,
+               a.id         as authId,
+               a.authParty,
+               u.authUserId as authUserId,
+               u.name       as shopName,
+               u.shopType,
+               u.qrCodeImage,
+               i.securityLink,
+               i.statementType,
+               i.statementContent,
+               i.statementLink,
+               i.statementImage
+        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
+                 left join cm_brand_auth_shop_info i on u.authUserId = i.authUserId and p.brandId = i.brandId
+                 left join cm_brand b on i.brandId = b.id
+                 left join country c on i.countryId = c.countryId
+        where p.id = #{productId}
+          and u.status = 1
+          and a.status = 1
+          and p.status = 1
+          and a.auditStatus = 1
+          and p.auditStatus = 1
+    </select>
+    <select id="getStatementFile" resultType="com.caimei.module.base.entity.vo.StatementFileVo">
+        select name,ossName,md5Hex,uploadTime
+        from cm_brand_auth_file
+        where authUserId = #{authUserId}
+          and brandId = #{brandId}
+        limit 1
+    </select>
+    <select id="getAuthProductParams" resultType="com.caimei.module.base.entity.po.CmBrandProductParamPo">
+        select name, content
+        from cm_brand_product_param
+        where productId = #{productId}
+    </select>
+    <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
+    </select>
 </mapper>

+ 44 - 2
src/main/resources/mapper/ClubMapper.xml

@@ -64,16 +64,30 @@
         where id = #{clubUserId}
     </select>
     <select id="getWxClubList" resultType="com.caimei.model.vo.WxClubListVo">
-        select id as authId, authParty as clubName
+        select id as authId, authParty as clubName,concat(p.name,c.name,t.name) as area,a.address,a.mobile,a.logo,
+        round(st_distance(point(a.lng,a.lat),point(#{lng},#{lat}))*111195/1000,2) as distance
         from cm_brand_auth a
         left join cm_brand_auth_user au on a.authUserId = au.authUserId
+        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 au.appId = #{appId}
         and a.status = 1
+        and a.auditStatus = 1
         and au.status = 1
         <if test="clubName != null and clubName != ''">
             and a.authParty like concat('%',#{clubName},'%')
         </if>
-        order by a.createTime desc
+        <if test="provinceId != null">
+            and a.provinceId = #{provinceId}
+        </if>
+        <if test="cityId != null">
+            and a.cityId = #{cityId}
+        </if>
+        <if test="townId != null">
+            and a.townId = #{townId}
+        </if>
+        order by distance asc
     </select>
     <select id="checkMobile" resultType="java.lang.Integer">
         select cu.id as clubUserId from cm_brand_club_user cu
@@ -81,4 +95,32 @@
         left join cm_brand_auth_user au on a.authUserId = au.authUserId
         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, a.id as authId, au.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
+        where cu.mobile = #{mobile}
+          and au.appId = #{appId}
+          and cu.delFlag = 0
+        limit 1
+    </select>
+    <select id="getClubDetails" resultType="com.caimei.model.vo.WxClubDetailsVo">
+        select a.id                           as authId,
+               a.authParty,
+               concat(p.name, c.name, t.name) as area,
+               a.address,
+               a.mobile,
+               a.logo,
+               concat(a.lng,',',a.lat) as lngAndLat
+        from cm_brand_auth a
+                 left join cm_brand_auth_user u on a.authUserId = u.authUserId
+                 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 a.id = #{authId}
+          and u.status = 1
+          and a.status = 1
+          and a.auditStatus = 1;
+    </select>
 </mapper>

+ 125 - 0
src/main/resources/mapper/DoctorMapper.xml

@@ -0,0 +1,125 @@
+<?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.DoctorMapper">
+    <insert id="insertDoctor" keyColumn="id" keyProperty="id" useGeneratedKeys="true" parameterType="com.caimei.model.po.CmBrandDoctorPo">
+        insert into cm_brand_doctor (authUserId, name, certificateNo, clubName, image, status, createTime, createBy,
+                                     auditStatus)
+        values (#{authUserId}, #{name}, #{certificateNo}, #{clubName}, #{image}, #{status}, NOW(), #{createBy}, #{auditStatus})
+    </insert>
+    <insert id="insertBanner">
+        insert into cm_brand_doctor_banner (doctorId, banner)
+        VALUES (#{doctorId}, #{banner})
+    </insert>
+    <insert id="insertEquipment">
+        insert into cm_brand_doctor_equipment(doctorId, name, brand, image)
+        values (#{doctorId}, #{equipmentName}, #{brand}, #{image})
+    </insert>
+    <update id="updateDoctorStatus">
+        update cm_brand_doctor
+        set status = #{status}
+        where id = #{doctorId}
+    </update>
+    <update id="updateDoctorByDoctorId">
+        update cm_brand_doctor
+        set name          = #{name},
+            certificateNo = #{certificateNo},
+            clubName      = #{clubName},
+            image         = #{image},
+            status        = #{status},
+            auditStatus   = #{auditStatus}
+        where id = #{id}
+    </update>
+    <update id="updateDoctorAuditStatus">
+        update cm_brand_doctor
+        set status        = #{status},
+            auditStatus   = #{auditStatus},
+            invalidReason = #{invalidReason},
+            auditBy       = #{auditBy},
+            auditTime     = #{auditTime}
+        where id = #{doctorId}
+    </update>
+    <delete id="deleteDoctorByDoctorId">
+        delete from cm_brand_doctor where id = #{doctorId}
+    </delete>
+    <delete id="deleteBanner">
+        delete from cm_brand_doctor_banner where doctorId = #{doctorId}
+    </delete>
+    <delete id="deleteEquipment">
+        delete from cm_brand_doctor_equipment where doctorId = #{doctorId}
+    </delete>
+    <select id="getDoctorList" resultType="com.caimei.model.vo.DoctorListVo">
+        select id as doctorId, a.name as doctorName,a.certificateNo, a.status, a.auditStatus, a.createTime, cu.name as createBy,
+               au.name as auditBy,a.auditTime,a.invalidReason
+        from cm_brand_doctor 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
+        where a.authUserId = #{authUserId}
+        <if test="doctorName != null and doctorName != ''">
+            and a.name like CONCAT('%',#{doctorName},'%')
+        </if>
+        <if test="status != null">
+            and a.status = #{status}
+        </if>
+        <if test="auditStatus != null">
+            and a.auditStatus = #{auditStatus}
+        </if>
+        <choose>
+            <when test="listType == 2">
+                order by a.auditStatus desc, a.createTime desc
+            </when>
+            <otherwise>
+                order by a.createTime desc
+            </otherwise>
+        </choose>
+    </select>
+    <select id="getDoctorById" resultType="com.caimei.model.po.CmBrandDoctorPo">
+        select id,
+               name,
+               authUserId,
+               certificateNo,
+               clubName,
+               image as doctorImage,
+               status
+        from cm_brand_doctor
+        where id = #{doctorId}
+    </select>
+    <select id="getDoctorIdByCertificateNo" resultType="java.lang.Integer">
+        select id
+        from cm_brand_doctor
+        where certificateNo = #{certificateNo}
+          and authUserId = #{authUserId}
+    </select>
+    <select id="getBannerList" resultType="java.lang.String">
+        select banner from cm_brand_doctor_banner where doctorId = #{doctorId}
+    </select>
+    <select id="getEquipmentList" resultType="com.caimei.model.vo.DoctorEquipmentVo">
+        select name as equipmentName, brand, image
+        from cm_brand_doctor_equipment
+        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
+        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 d.status = 1
+        and d.auditStatus = 1
+    </select>
+    <select id="getDoctorDetailsById" resultType="com.caimei.model.vo.DoctorFormVo">
+        select id     as doctorId,
+               d.name as doctorName,
+               certificateNo,
+               clubName,
+               image  as doctorImage
+        from cm_brand_doctor d
+                 left join cm_brand_auth_user au on d.authUserId = au.authUserId
+        where id = #{doctorId}
+          and au.status = 1
+          and d.status = 1
+          and d.auditStatus = 1
+    </select>
+</mapper>

+ 1 - 1
src/main/resources/mapper/LoginMapper.xml

@@ -11,7 +11,7 @@
         where invitationCode = #{invitationCode};
     </update>
 
-    <select id="findClubUser" resultType="com.caimei.model.vo.WxClubUserVo">
+    <select id="findClubUserByOpenId" resultType="com.caimei.model.vo.WxClubUserVo">
         select cu.id as clubUserId, cu.authId, a.authUserId, cu.mobile, cu.openId
         from cm_brand_club_user cu
                  left join cm_brand_auth a on cu.authId = a.id

+ 13 - 3
src/main/resources/mapper/ShopMapper.xml

@@ -6,9 +6,9 @@
         values (#{authUserId}, #{brandId}, #{name}, #{ossName}, #{md5Hex}, #{uploadTime})
     </insert>
     <insert id="insertShop"  keyColumn="authUserId" keyProperty="authUserId" useGeneratedKeys="true" parameterType="com.caimei.model.po.UserPo">
-        insert into cm_brand_auth_user (`name`, `mobile`, `password`, `linkMan`, `userIdentity`, `shopType`, `qrCodeImage`, `wxAccountType`, `appId`, `appSecret`, `createTime`,
+        insert into cm_brand_auth_user (`name`, `mobile`, `password`, `linkMan`, `userIdentity`, `shopType`, `logo`, `qrCodeImage`, `wxAccountType`, `appId`, `appSecret`, `createTime`,
                                         `createBy`,`status`)
-        values (#{name}, #{mobile}, #{password}, #{linkMan}, #{userIdentity}, #{shopType}, #{qrCodeImage}, #{wxAccountType}, #{appId}, #{appSecret}, #{createTime}, #{createBy}, #{status});
+        values (#{name}, #{mobile}, #{password}, #{linkMan}, #{userIdentity}, #{shopType}, #{logo}, #{qrCodeImage}, #{wxAccountType}, #{appId}, #{appSecret}, #{createTime}, #{createBy}, #{status});
     </insert>
     <insert id="insertShopInfo">
         insert into cm_brand_auth_shop_info
@@ -63,6 +63,7 @@
         set `mobile`        = #{mobile},
             `linkMan`       = #{linkMan},
             `status`        = #{status},
+            `logo`          = #{logo},
             `qrCodeImage`   = #{qrCodeImage},
             `wxAccountType` = #{wxAccountType},
             `appId`         = #{appId},
@@ -171,7 +172,7 @@
         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.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.logo, u.qrCodeImage, u.appId, u.appSecret
         from cm_brand_auth_user u
         where u.authUserId = #{authUserId};
     </select>
@@ -290,5 +291,14 @@
                  left join cm_brand b on i.brandId = b.id
         where i.authUserId = #{authUserId}
     </select>
+    <select id="getWxShopInfo" resultType="com.caimei.model.vo.WxShopVo">
+        select au.authUserId, au.name as shopName, if(au.shopType = 1, cb.authLogo, au.logo) as logo
+        from cm_brand_auth_user au
+                 left join cm_brand_auth_shop_info si on au.authUserId = si.authUserId
+                 left join cm_brand cb on si.brandId = cb.id
+        where au.appId = #{appId}
+        and au.status = 1
+        limit 1
+    </select>
 
 </mapper>