Browse Source

ldm版本part5

Aslee 3 years ago
parent
commit
0cf39917df

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

@@ -29,7 +29,7 @@ import java.util.Map;
  * @author : Aslee
  * @date : 2021/5/11
  */
-@Api(tags = "品牌授权API")
+@Api(tags = "认证机构API")
 @Slf4j
 @RestController
 @RequiredArgsConstructor
@@ -137,6 +137,7 @@ public class AuthApi {
         auth.setTownId(townId);
         auth.setAddress(address);
         auth.setCustomFlag(customFlag);
+        auth.setRemarks(remarks);
         if (StringUtils.isEmpty(lngAndLat)) {
             return ResponseJson.error("参数异常,经纬度不能为空");
         }

+ 1 - 1
src/main/java/com/caimei/controller/auth/AuthClubApi.java

@@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.*;
  * @author : Aslee
  * @date : 2021/5/11
  */
-@Api(tags = "机构API")
+@Api(tags = "机构用户API")
 @Slf4j
 @RestController
 @RequiredArgsConstructor

+ 5 - 4
src/main/java/com/caimei/controller/auth/AuthProductApi.java

@@ -26,7 +26,7 @@ import java.util.Map;
  * @author Aslee
  * @date 2021/5/17
  */
-@Api(tags = "授权商品API")
+@Api(tags = "认证商品API")
 @Slf4j
 @RestController
 @RequiredArgsConstructor
@@ -143,7 +143,7 @@ public class AuthProductApi {
     @ApiOperation("添加/编辑设备分类")
     @ApiImplicitParam(name = "params", value = "productTypeId:设备分类id;authUserId:供应商用户id;name:设备分类名称;image:图片;createBy:创建人用户id;", required = true)
     @PostMapping("/type/save")
-    public ResponseJson saveProductType(@RequestBody String params) {
+    public ResponseJson saveProductType(@RequestBody String params) throws IOException {
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer productTypeId = paramsMap.getInteger("productTypeId");
         Integer authUserId = paramsMap.getInteger("authUserId");
@@ -163,9 +163,10 @@ public class AuthProductApi {
     }
 
     @ApiOperation("删除设备分类")
-    @ApiImplicitParam(name = "productTypeId", value = "设备分类id", required = true)
+    @ApiImplicitParam(name = "params", value = "productTypeId:设备分类id", required = true)
     @PostMapping("/type/delete")
-    public ResponseJson deleteProductType(Integer productTypeId) {
+    public ResponseJson deleteProductType(@RequestBody Map<String,Integer> params) {
+        Integer productTypeId = params.get("productTypeId");
         if (null == productTypeId) {
             return ResponseJson.error("参数异常,设备分类id不能为空");
         }

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

@@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
 /**
  * @author Aslee
  */
-@Api(tags = "微信品牌认证API")
+@Api(tags = "微信认证数据API")
 @Slf4j
 @RestController
 @RequiredArgsConstructor
@@ -69,7 +69,7 @@ public class WxAuthApi {
     @ApiOperation("设备分类列表")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "appId", required = true, value = "供应商公众号appId"),
-            @ApiImplicitParam(name = "productTypeName", required = false, value = "设备分类名称"),
+            @ApiImplicitParam(name = "name", required = false, value = "设备分类名称"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })

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

@@ -52,7 +52,7 @@ public interface AuthProductMapper {
 
     void updateProductAuditStatus(@Param("productId") Integer productId, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus, @Param("invalidReason") String invalidReason, @Param("auditBy") Integer auditBy, @Param("auditTime") Date auditTime);
 
-    List<WxProductListVo> getWxProductList(@Param("productTypeId") Integer productTypeId, @Param("productName") String productName);
+    List<WxProductListVo> getWxProductList(@Param("productTypeId") Integer productTypeId, @Param("snCode") String snCode);
 
     Integer getBrandIdByBrandName(String brand);
 
@@ -81,4 +81,6 @@ public interface AuthProductMapper {
     void updateProductTypeAuditStatus(Integer productTypeId, Integer status, Integer auditStatus, String invalidReason, Integer auditBy, Date auditTime);
 
     List<WxProductTypeListVo> getWxProductTypeList(String appId, String name);
+
+    ProductTypePo getProductType(Integer productTypeId);
 }

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

@@ -45,7 +45,7 @@ public interface DoctorMapper {
 
     List<DoctorEquipmentVo> getEquipmentList(Integer doctorId);
 
-    List<WxDoctorListVo> getWxDoctorList(@Param("appId") String appId, @Param("doctorType") Integer doctorType, @Param("doctorName") String doctorName);
+    List<WxDoctorListVo> getWxDoctorList(@Param("appId") String appId, @Param("authId") Integer authId, @Param("doctorType") Integer doctorType, @Param("doctorName") String doctorName);
 
     DoctorFormVo getDoctorDetailsById(Integer doctorId);
 

+ 10 - 0
src/main/java/com/caimei/model/po/ProductTypePo.java

@@ -32,6 +32,16 @@ public class ProductTypePo {
      */
     private String image;
 
+    /**
+     * pc端水印图片
+     */
+    private String pcImage;
+
+    /**
+     * 小程序端水印图片
+     */
+    private String appletsImage;
+
     /**
      * 上线状态:0已下线,1已上线,2待上线
      */

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

@@ -47,4 +47,9 @@ public class AuthFormVo implements Serializable {
     @ApiModelProperty("轮播图")
     private List<String> bannerList;
 
+    @ApiModelProperty("是否需要自定义属性:0否,1是")
+    private Integer customFlag;
+
+    @ApiModelProperty("店铺备注")
+    private String remarks;
 }

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

@@ -41,4 +41,10 @@ public class WxClubDetailsVo implements Serializable {
     @ApiModelProperty("已授权设备")
     private List<WxProductListVo> productList;
 
+    @ApiModelProperty("操作医师列表")
+    private List<WxDoctorListVo> doctorList;
+
+    @ApiModelProperty("店铺备注")
+    private String remarks;
+
 }

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

@@ -118,7 +118,7 @@ public interface AuthProductService {
     /**
      * 保存设备分类
      */
-    ResponseJson saveProductType(Integer productTypeId, Integer authUserId, String name, String image, Integer createBy);
+    ResponseJson saveProductType(Integer productTypeId, Integer authUserId, String name, String image, Integer createBy) throws IOException;
 
     /**
      * 删除设备分类

+ 13 - 6
src/main/java/com/caimei/service/auth/impl/AuthClubServiceImpl.java

@@ -1,9 +1,6 @@
 package com.caimei.service.auth.impl;
 
-import com.caimei.mapper.cmMapper.AuthMapper;
-import com.caimei.mapper.cmMapper.AuthProductMapper;
-import com.caimei.mapper.cmMapper.ClubMapper;
-import com.caimei.mapper.cmMapper.ShopMapper;
+import com.caimei.mapper.cmMapper.*;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.ClubUserPo;
 import com.caimei.model.vo.*;
@@ -40,8 +37,11 @@ public class AuthClubServiceImpl implements AuthClubService {
     @Resource
     private AuthProductMapper authProductMapper;
 
+    @Resource
+    private DoctorMapper doctorMapper;
+
     @Override
-    public ResponseJson<PageInfo<ClubVo>> getClubList( Integer authUserId, String clubName, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<ClubVo>> getClubList(Integer authUserId, String clubName, Integer pageNum, Integer pageSize) {
         if (null == authUserId) {
             return ResponseJson.error("参数异常,请输入供应商用户id", null);
         }
@@ -108,6 +108,13 @@ public class AuthClubServiceImpl implements AuthClubService {
         // 授权设备列表
         List<WxProductListVo> wxProductList = authProductMapper.getClubProductList(authId);
         clubDetail.setProductList(wxProductList);
+        // 操作医师列表
+        List<WxDoctorListVo> doctorList = doctorMapper.getWxDoctorList(null, authId, 1, null);
+        doctorList.forEach(doctor->{
+            List<String> tagList = doctorMapper.getTagList(doctor.getDoctorId());
+            doctor.setTagList(tagList);
+        });
+        clubDetail.setDoctorList(doctorList);
         return ResponseJson.success(clubDetail);
     }
 
@@ -150,6 +157,6 @@ public class AuthClubServiceImpl implements AuthClubService {
     @Override
     public ResponseJson deleteClubUser(Integer clubUserId) {
         clubMapper.deleteClubUser(clubUserId);
-        return null;
+        return ResponseJson.success("删除机构用户成功");
     }
 }

+ 14 - 18
src/main/java/com/caimei/service/auth/impl/AuthProductServiceImpl.java

@@ -116,7 +116,6 @@ public class AuthProductServiceImpl implements AuthProductService {
         Integer brandId = productSaveDto.getBrandId();
         Integer productTypeId = productSaveDto.getProductTypeId();
         String snCode = productSaveDto.getSnCode();
-        String productImage = productSaveDto.getProductImage();
         String certificateImage = productSaveDto.getCertificateImage();
         Integer addQrCodeFlag = productSaveDto.getAddQrCodeFlag();
         Integer addTemplateType = productSaveDto.getAddTemplateType();
@@ -138,9 +137,6 @@ public class AuthProductServiceImpl implements AuthProductService {
         if (null != productIdBySnCode && !productIdBySnCode.equals(productId)) {
             return ResponseJson.error("参数异常,该商品SN码已存在,请重新输入", null);
         }
-        if (StringUtils.isBlank(productImage)) {
-            return ResponseJson.error("参数异常,请上传商品图片", null);
-        }
         if (StringUtils.isBlank(certificateImage)) {
             return ResponseJson.error("参数异常,请上传授权牌照", null);
         }
@@ -169,8 +165,6 @@ public class AuthProductServiceImpl implements AuthProductService {
         product.setProductTypeId(productTypeId);
         // sn码
         product.setSnCode(snCode);
-        // 商品图片
-        product.setProductImage(productImage);
         // 授权牌照
         product.setCertificateImage(certificateImage);
         product.setAddQrCodeFlag(addQrCodeFlag);
@@ -185,9 +179,6 @@ public class AuthProductServiceImpl implements AuthProductService {
             product.setCreateBy(createBy);
             // 创建时间
             product.setCreateTime(new Date());
-            //商品图片添加水印
-            product.setPcImage(addWaterMark(product.getProductImage(), 1));
-            product.setAppletsImage(addWaterMark(product.getProductImage(), 2));
             if (null == addQrCodeFlag || 0 == addQrCodeFlag) {
                 //授权牌照添加水印
                 product.setPcCertificateImage(addWaterMark(product.getCertificateImage(), 1));
@@ -213,15 +204,8 @@ public class AuthProductServiceImpl implements AuthProductService {
             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(dbProduct.getCertificateImage())) || (StringUtils.isEmpty(dbProduct.getPcCertificateImage()) || StringUtils.isEmpty(dbProduct.getAppletsCertificateImage()));
+            boolean updateImageFlag = (StringUtils.isNotBlank(product.getCertificateImage()) && !product.getCertificateImage().equals(dbProduct.getCertificateImage())) || (StringUtils.isEmpty(dbProduct.getPcCertificateImage()) || StringUtils.isEmpty(dbProduct.getAppletsCertificateImage()));
             boolean addQrCodeSign = false;
             boolean addWaterMarkSign = false;
             if (null != dbAddQrCodeFlag && 1 == dbAddQrCodeFlag) {
@@ -439,7 +423,7 @@ public class AuthProductServiceImpl implements AuthProductService {
     }
 
     @Override
-    public ResponseJson saveProductType(Integer productTypeId, Integer authUserId, String name, String image, Integer createBy) {
+    public ResponseJson saveProductType(Integer productTypeId, Integer authUserId, String name, String image, Integer createBy) throws IOException {
         // 是否为添加操作
         boolean insertFlag = null == productTypeId;
         /*
@@ -459,11 +443,23 @@ public class AuthProductServiceImpl implements AuthProductService {
             productType.setCreateBy(createBy);
             // 创建时间
             productType.setCreateTime(new Date());
+            // 设备分类图片添加水印
+            productType.setPcImage(addWaterMark(productType.getImage(),1));
+            productType.setPcImage(addWaterMark(productType.getImage(),2));
             // 插入设备分类
             authProductMapper.insertProductType(productType);
         } else {
             // 设备分类id
             productType.setProductTypeId(productTypeId);
+            ProductTypePo dbProductType = authProductMapper.getProductType(productTypeId);
+            // 设备分类图片是否重新上传
+            boolean updateImageFlag = (StringUtils.isNotBlank(productType.getImage()) && !productType.getImage().equals(dbProductType.getImage()))
+                    || (StringUtils.isEmpty(productType.getPcImage()) || StringUtils.isEmpty(productType.getAppletsImage()));
+            if (updateImageFlag) {
+                //商品图片添加水印
+                productType.setPcImage(addWaterMark(productType.getImage(), 1));
+                productType.setAppletsImage(addWaterMark(productType.getImage(), 2));
+            }
             // 更新设备分类
             authProductMapper.updateProductType(productType);
         }

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

@@ -128,9 +128,14 @@ public class DoctorServiceImpl implements DoctorService {
         if (null != doctorIdByCertificateNo && !doctorIdByCertificateNo.equals(doctorId)) {
             return ResponseJson.error("参数异常,该从业资格证编号已存在,请重新输入", null);
         }
-        if (StringUtils.isBlank(doctor.getClubName()) && null == doctor.getAuthId()) {
+        if (StringUtils.isEmpty(doctor.getClubName()) && (null == doctor.getAuthId() || -1 == doctor.getAuthId())) {
             return ResponseJson.error("参数异常,请输入所属机构");
         }
+        if (null == doctor.getAuthId() || -1 == doctor.getAuthId()) {
+            doctor.setAuthId(null);
+        } else{
+            doctor.setClubName(null);
+        }
         if (null == doctor.getDoctorType()) {
             return ResponseJson.error("参数异常,请输入医师类型");
         }
@@ -143,7 +148,7 @@ public class DoctorServiceImpl implements DoctorService {
         if (null == bannerList || bannerList.size() <= 0) {
             return ResponseJson.error("参数异常,请上传轮播图");
         }
-        if (null == equipmentList || equipmentList.size() <= 0) {
+        if (1 == doctor.getDoctorType() && (null == equipmentList || equipmentList.size() <= 0)) {
             return ResponseJson.error("参数异常,请上传设备列表");
         }
         // 保存医师信息,上线状态默认为“待上线”,审核状态为“待审核”
@@ -210,7 +215,7 @@ public class DoctorServiceImpl implements DoctorService {
             return ResponseJson.error("参数异常,请输入供应商appId", null);
         }
         PageHelper.startPage(pageNum, pageSize);
-        List<WxDoctorListVo> doctorList = doctorMapper.getWxDoctorList(appId, doctorType, doctorName);
+        List<WxDoctorListVo> doctorList = doctorMapper.getWxDoctorList(appId, null, doctorType, doctorName);
         doctorList.forEach(doctor->{
             List<String> tagList = doctorMapper.getTagList(doctor.getDoctorId());
             doctor.setTagList(tagList);

+ 0 - 3
src/main/java/com/caimei/service/sys/impl/SysRoleServiceImpl.java

@@ -80,9 +80,6 @@ public class SysRoleServiceImpl implements SysRoleService {
         if (1 == id) {
             sysRole.setRoleName("shop_base_role");
             sysRole.setRoleDesc("供应商基础功能角色");
-        } else if (2 == id) {
-            sysRole.setRoleName("vip_base_role");
-            sysRole.setRoleDesc("会员基础功能角色");
         }
         systemMapper.updateRole(sysRole);
         // 保存角色菜单关系

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

@@ -48,7 +48,7 @@ public class LoginServiceImpl implements LoginService {
         if (StringUtils.isEmpty(code)) {
             return ResponseJson.error("参数异常,请输入code", null);
         }
-        if (StringUtils.isEmpty(code)) {
+        if (StringUtils.isEmpty(appId)) {
             return ResponseJson.error("参数异常,请输入appId", null);
         }
         // 获取供应商公众号appId对应的appSecret
@@ -91,13 +91,6 @@ public class LoginServiceImpl implements LoginService {
         if (StringUtils.isEmpty(appId)) {
             return ResponseJson.error("参数异常,请输入appId");
         }
-        if (2 == type) {
-            // 服务号校验手机号是否已被使用
-            Integer clubUserId = clubMapper.checkMobile(mobile, appId);
-            if (null != clubUserId) {
-                return ResponseJson.error("该手机号已使用,请重新输入");
-            }
-        }
         // 获取供应商名称
         String shopName = shopMapper.getShopNameByAppId(appId);
         if (StringUtils.isEmpty(shopName)) {
@@ -109,13 +102,14 @@ public class LoginServiceImpl implements LoginService {
         }
         String verifyCode = CodeUtil.generateCodeInt(6);
         String content = "欢迎登录" + shopName + "会员,您的短信验证码为:" + verifyCode + ",该验证码 5 分钟内有效,请勿泄漏于他人。";
-        Boolean sendSms = SmsUtils.sendSms(11, mobile, content);
+        /*Boolean sendSms = SmsUtils.sendSms(11, mobile, content);
         if (!sendSms) {
             log.info("会员登录验证码发送失败,手机号:" + mobile);
             return ResponseJson.error("发送失败,请确认手机号无误");
         } else {
             log.info("会员登录验证码发送成功,手机号:" + mobile + ",验证码:" + verifyCode);
-        }
+        }*/
+        log.info(content);
         redisService.set("code:" + mobile, verifyCode, 300L);
         return ResponseJson.success("发送成功");
     }

+ 2 - 2
src/main/java/com/caimei/task/LdmTask.java

@@ -42,9 +42,9 @@ public class LdmTask {
     }
 
     /**
-     * 定时读取ldm数据库机构数据,存入采美数据库中
+     * 每天凌晨1点读取ldm数据库机构数据,存入采美数据库中
      */
-    @Scheduled(cron = "0 0/30 * * * ?")
+    @Scheduled(cron = "0 0 1 * * ?")
     public void readLdmData() {
         AtomicReference<Integer> ldmLatestClubId = new AtomicReference<>(authMapper.getLdmLatestClubId());
         List<LdmDataPo> ldmDataList = ldmMapper.getLdmClubData(ldmLatestClubId.get());

+ 12 - 5
src/main/resources/config/prod/application-prod.yml

@@ -1,11 +1,18 @@
 spring:
   #数据源连接--start
   datasource:
-    url: jdbc:mysql://rm-wz928s8btl7kxil44.mysql.rds.aliyuncs.com:3306/caimei?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
-    username: coder
-    password: diKtPYZ%wToI&9#L
-    # Hikari will use the above plus the following to setup connection pooling
-    type: com.zaxxer.hikari.HikariDataSource
+    cmdatasource:
+      driver-class-name: com.mysql.cj.jdbc.Driver
+      jdbc-url: jdbc:mysql://172.31.165.28:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+      username: developer
+      password: J5p3tgOVazNl4ydf
+      type: com.zaxxer.hikari.HikariDataSource
+    ldmdatasource:
+      driver-class-name: com.mysql.cj.jdbc.Driver
+      jdbc-url: jdbc:mysql://rm-wz928s8btl7kxil44.mysql.rds.aliyuncs.com:3306/caimei?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
+      username: coder
+      password: diKtPYZ%wToI&9#L
+      type: com.zaxxer.hikari.HikariDataSource
     hikari:
       minimum-idle: 5
       maximum-pool-size: 15

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

@@ -3,7 +3,7 @@
 <mapper namespace="com.caimei.mapper.cmMapper.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, lng, lat,
-                                   mobile, logo, customFLag, remarks, status, createTime, createBy, auditStatus, delFlag)
+                                   mobile, logo, customFlag, remarks, status, createTime, createBy, auditStatus, delFlag)
         values (#{authUserId}, #{authParty}, #{provinceId}, #{cityId}, #{townId}, #{address}, #{lng}, #{lat},
                 #{mobile}, #{logo}, #{customFlag}, #{remarks}, #{status}, NOW(), #{createBy}, #{auditStatus}, #{delFlag})
     </insert>
@@ -113,7 +113,7 @@
                mobile,
                logo,
                customFlag,
-               remarks
+               remarks,
                status
         from cm_brand_auth a
                  left join province p on a.provinceId = p.provinceID

+ 43 - 36
src/main/resources/mapper/AuthProductMapper.xml

@@ -2,11 +2,11 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.mapper.cmMapper.AuthProductMapper">
     <insert id="insertProduct" keyColumn="id" keyProperty="productId" useGeneratedKeys="true" parameterType="com.caimei.model.po.ProductPo">
-        insert into cm_brand_auth_product(`authId`, `brandId`, `productTypeId`, `snCode`, `image`,`pcImage`,`appletsImage`,
+        insert into cm_brand_auth_product(`authId`, `brandId`, `productTypeId`, `snCode`,
                                           `originalCertificateImage`,`certificateImage`,`pcCertificateImage`,
                                           `appletsCertificateImage`, `addQrCodeFlag`,`addTemplateType`, `status`,
                                           `auditStatus`,`createTime`, `createBy`)
-        values (#{authId}, #{brandId}, #{productTypeId}, #{snCode}, #{productImage}, #{pcImage}, #{appletsImage},
+        values (#{authId}, #{brandId}, #{productTypeId}, #{snCode},
                 #{originalCertificateImage}, #{certificateImage}, #{pcCertificateImage},
                 #{appletsCertificateImage}, #{addQrCodeFlag}, #{addTemplateType}, #{status},
                 #{auditStatus}, #{createTime},#{createBy})
@@ -16,8 +16,9 @@
         values (#{productId}, #{paramName}, #{paramContent})
     </insert>
     <insert id="insertProductType">
-        insert into cm_brand_product_type (authUserId, name, image, status, auditStatus, createBy, createTime)
-        values (#{authUserId}, #{name}, #{image}, #{status}, #{auditStatus}, #{createBy}, #{createTime})    </insert>
+        insert into cm_brand_product_type (authUserId, name, image, pcImage, appletsImage, status, auditStatus, createBy, createTime, delFlag)
+        values (#{authUserId}, #{name}, #{image}, #{pcImage}, #{appletsImage}, #{status}, #{auditStatus}, #{createBy}, #{createTime}, 0)
+    </insert>
 
     <update id="updateProductStatusByProductId">
         update cm_brand_auth_product
@@ -30,16 +31,9 @@
             `brandId`          = #{brandId},
             `productTypeId`    = #{productTypeId},
             `snCode`           = #{snCode},
-            `image`            = #{productImage},
             `certificateImage` = #{certificateImage},
             `addQrCodeFlag`    = #{addQrCodeFlag},
             `addTemplateType`  = #{addTemplateType},
-            <if test="pcImage != null and pcImage != ''">
-                `pcImage`      = #{pcImage},
-            </if>
-            <if test="appletsImage != null and appletsImage != ''">
-                `appletsImage` = #{appletsImage},
-            </if>
             <if test="originalCertificateImage != null and originalCertificateImage != ''">
                 `originalCertificateImage`      = #{originalCertificateImage},
             </if>
@@ -81,6 +75,12 @@
     <update id="updateProductType">
         update cm_brand_product_type
         set name  = #{name},
+            <if test="pcImage != null and pcImage != ''">
+                pcImage = #{pcImage},
+            </if>
+            <if test="appletsImage != null and appletsImage != ''">
+                appletsImage = #{appletsImage},
+            </if>
             image = #{image}
         where id = #{productTypeId}
     </update>
@@ -104,14 +104,14 @@
     <delete id="deleteParamsByProductId">
         delete from cm_brand_product_param where productId = #{productId}
     </delete>
-    <delete id="deleteProductType">
-        delete from cm_brand_product_type where id = #{productTypeId}
-    </delete>
+    <update id="deleteProductType">
+        update cm_brand_product_type set delFlag = 1 where id = #{productTypeId}
+    </update>
     <select id="getProductList" resultType="com.caimei.model.vo.ProductListVo">
         select p.id as productId,t.name as productName,snCode,p.status,p.auditStatus,p.createTime,cu.name as createBy,
                au.name as auditBy,p.auditTime,p.invalidReason
         from cm_brand_auth_product p
-        left join cm_brand_product_type t on p.productTypeId = t.id
+        left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
         left join cm_brand_auth_user cu on p.createBy = cu.authUserId
         left join cm_brand_auth_user au on p.auditBy = au.authUserId
         where authId = #{authId}
@@ -140,19 +140,20 @@
         select id from cm_brand_auth_product where snCode = #{snCode} limit 1
     </select>
     <select id="getProductFormByProductId" resultType="com.caimei.model.vo.ProductFormVo">
-        select `id`    as productId,
+        select p.`id`    as productId,
                `authId`,
                `brandId`,
-               `name`  as productName,
+               t.name  as productName,
                `snCode`,
-               `image` as productImage,
+               t.`image` as productImage,
                `certificateImage`,
                `originalCertificateImage`,
                addQrCodeFlag,
                addTemplateType,
-               `status`
-        from cm_brand_auth_product
-        where id = #{productId}
+               p.`status`
+        from cm_brand_auth_product p
+                 left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
+        where p.id = #{productId}
     </select>
     <select id="getParamsByProductId" resultType="com.caimei.model.po.ProductParamPo">
         select `name` as paramName, `content` as paramContent
@@ -163,9 +164,9 @@
         select id from cm_brand_auth_product where authId = #{authId}
     </select>
     <select id="getImageByProductId" resultType="com.caimei.model.po.ProductPo">
-        select image as productImage,
-               pcImage,
-               appletsImage,
+        select t.image as productImage,
+               t.pcImage,
+               t.appletsImage,
                addQrCodeFlag,
                originalCertificateImage,
                certificateImage,
@@ -173,8 +174,9 @@
                appletsCertificateImage,
                addQrCodeFlag,
                addTemplateType
-        from cm_brand_auth_product
-        where id = #{productId}
+        from cm_brand_auth_product p
+                 left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
+        where p.id = #{productId}
     </select>
     <select id="getAllImage" resultType="com.caimei.model.po.ProductPo">
         select id as productId,
@@ -187,9 +189,9 @@
         from cm_brand_auth_product
     </select>
     <select id="getWxProductList" resultType="com.caimei.model.vo.WxProductListVo">
-        select p.id as productId,p.authId, t.name as productName,p.snCode,p.image as productImage,a.authParty as clubName
+        select p.id as productId,p.authId, t.name as productName,p.snCode,t.image as productImage,a.authParty as clubName
         from cm_brand_auth_product p
-        left join cm_brand_product_type t on p.productTypeId = t.id
+        left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
         left join cm_brand_auth a on p.authId = a.id
         left join cm_brand_auth_user au on a.authUserId = au.authUserId
         where p.productTypeId = #{productTypeId}
@@ -207,9 +209,9 @@
         select id from cm_brand where name = #{brand}
     </select>
     <select id="getAuthProductList" resultType="com.caimei.model.vo.ProductFormVo">
-        select p.id as productId,t.name as productName,snCode,cb.name as brandName,image as productImage,certificateImage
+        select p.id as productId,t.name as productName,snCode,cb.name as brandName,t.image as productImage,certificateImage
         from cm_brand_auth_product p
-        left join cm_brand_product_type t on p.productTypeId = t.id
+        left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
         left join cm_brand cb on p.brandId = cb.id
         where authId = #{authId}
         order by createTime desc
@@ -217,8 +219,8 @@
     <select id="getAuthProductByProductId" resultType="com.caimei.module.base.entity.vo.AuthProductVo">
         select t.name       as productName,
                p.snCode,
-               p.pcImage,
-               p.appletsImage,
+               t.pcImage,
+               t.appletsImage,
                p.pcCertificateImage,
                p.appletsCertificateImage,
                p.brandId,
@@ -237,7 +239,7 @@
                i.statementLink,
                i.statementImage
         from cm_brand_auth_product p
-                 left join cm_brand_product_type t on p.productTypeId = t.id
+                 left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
                  left join cm_brand_auth a on p.authId = a.id
                  left join cm_brand_auth_user u on a.authUserId = u.authUserId
                  left join cm_brand_auth_shop_info i on u.authUserId = i.authUserId and p.brandId = i.brandId
@@ -265,7 +267,7 @@
     <select id="getClubProductList" resultType="com.caimei.model.vo.WxProductListVo">
         select p.id as productId, t.name as productName, p.snCode
         from cm_brand_auth_product p
-        left join cm_brand_product_type t on p.productTypeId = t.id
+        left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
         where p.authId = #{authId}
           and p.status = 1
           and p.auditStatus = 1
@@ -277,7 +279,7 @@
         from cm_brand_product_type t
         left join cm_brand_auth_user cu on t.createBy = cu.authUserId
         left join cm_brand_auth_user au on t.auditBy = au.authUserId
-        where t.authUserId = #{authUserId}
+        where t.authUserId = #{authUserId} and t.delFlag = 0
         <if test="name != null and name != ''">
             and t.name like CONCAT('%',#{name},'%')
         </if>
@@ -300,10 +302,15 @@
         select t.id as productTypeId,t.name,t.image
         from cm_brand_product_type t
             left join cm_brand_auth_user u on t.authUserId = u.authUserId
-        where u.appId = #{appId}
+        where u.appId = #{appId} and t.delFlag = 0
         <if test="name != null and name != ''">
             and t.name like concat('%',#{name},'%')
         </if>
         order by t.id desc
     </select>
+    <select id="getProductType" resultType="com.caimei.model.po.ProductTypePo">
+        select id as productTypeId, name, image, pcImage, appletsImage
+        from cm_brand_product_type
+        where id = #{productTypeId};
+    </select>
 </mapper>

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

@@ -71,7 +71,7 @@
         <if test="townId != null">
             and a.townId = #{townId}
         </if>
-        order by distance asc
+        order by distance
     </select>
     <select id="checkMobile" resultType="java.lang.Integer">
         select cu.id as clubUserId from cm_brand_club_user cu
@@ -101,7 +101,8 @@
                a.address,
                a.mobile,
                a.logo,
-               concat(a.lng,',',a.lat) as lngAndLat
+               concat(a.lng,',',a.lat) as lngAndLat,
+               if(a.customFlag = 1,a.remarks,null) as remarks
         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

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

@@ -19,7 +19,7 @@
         VALUES (#{doctorId}, #{tag})
     </insert>
     <insert id="insertParam">
-        insert into cm_brand_doctor_equipment(doctorId, name, content)
+        insert into cm_brand_doctor_param(doctorId, name, content)
         values (#{doctorId}, #{name}, #{content})
     </insert>
     <update id="updateDoctorStatus">
@@ -119,10 +119,20 @@
         where doctorId = #{doctorId}
     </select>
     <select id="getWxDoctorList" resultType="com.caimei.model.vo.WxDoctorListVo">
-        select d.id as doctorId, d.doctorType, d.name as doctorName,d.certificateNo,d.clubName,d.image as doctorImage
+        select d.id as doctorId, d.doctorType, d.name as doctorName,d.certificateNo,ifnull(cba.authParty,d.clubName) as 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}
+        left join cm_brand_auth cba on d.authId = cba.id
+        where
+        au.status = 1
+        and d.status = 1
+        and d.auditStatus = 1
+        <if test="appId != null and appId != ''">
+            and au.appId = #{appId}
+        </if>
+        <if test="authId != null">
+            and d.authId = #{authId}
+        </if>
         <if test="doctorType != null">
             and d.doctorType = #{doctorType}
         </if>

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

@@ -122,7 +122,7 @@
         ifnull(vw.videoWaitNum,0) as videoWaitNum,
         ifnull(fw.fileWaitNum,0) as fileWaitNum,
         ifnull(dw.doctorWaitNum,0) as doctorWaitNum,
-        ifnull(tw.productTypeWaitNum,0) as productTypeWaitNum,
+        ifnull(tw.productTypeWaitNum,0) as productTypeWaitNum
         from cm_brand_auth_user u
         left join cm_brand_auth_shop_info s on u.authUserId = s.authUserId
         left join cm_brand cb on cb.id = s.brandId