Browse Source

Merge remote-tracking branch 'remotes/origin/developer' into developerA

# Conflicts:
#	src/main/java/com/caimei/mapper/cmMapper/AuthProductMapper.java
#	src/main/java/com/caimei/service/auth/AuthProductService.java
#	src/main/java/com/caimei/service/auth/impl/AuthProductServiceImpl.java
Aslee 2 năm trước cách đây
mục cha
commit
75178d1a10
28 tập tin đã thay đổi với 314 bổ sung123 xóa
  1. 10 4
      pom.xml
  2. 23 12
      src/main/java/com/caimei/controller/admin/auth/AuthProductApi.java
  3. 0 4
      src/main/java/com/caimei/controller/admin/auth/AuthTemplateApi.java
  4. 5 5
      src/main/java/com/caimei/controller/admin/auth/DefaultApi.java
  5. 2 0
      src/main/java/com/caimei/controller/admin/auth/ShopApi.java
  6. 0 1
      src/main/java/com/caimei/controller/wechat/WxAuthApi.java
  7. 0 1
      src/main/java/com/caimei/mapper/cmMapper/AddressMapper.java
  8. 7 4
      src/main/java/com/caimei/mapper/cmMapper/AuthProductMapper.java
  9. 1 1
      src/main/java/com/caimei/mapper/cmMapper/AuthTemplateMapper.java
  10. 0 2
      src/main/java/com/caimei/model/dto/ProductSaveDto.java
  11. 5 0
      src/main/java/com/caimei/model/dto/ShopInfoDto.java
  12. 11 0
      src/main/java/com/caimei/model/po/ProductTypePo.java
  13. 121 0
      src/main/java/com/caimei/model/vo/AuthProductVo.java
  14. 5 0
      src/main/java/com/caimei/model/vo/ShopInfoVo.java
  15. 15 0
      src/main/java/com/caimei/model/vo/StatementFileVo.java
  16. 0 2
      src/main/java/com/caimei/service/auth/AddressService.java
  17. 7 3
      src/main/java/com/caimei/service/auth/AuthProductService.java
  18. 0 1
      src/main/java/com/caimei/service/auth/impl/AddressServiceImpl.java
  19. 37 12
      src/main/java/com/caimei/service/auth/impl/AuthProductServiceImpl.java
  20. 2 2
      src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java
  21. 21 5
      src/main/java/com/caimei/service/auth/impl/AuthTemplateServiceImpl.java
  22. 0 1
      src/main/java/com/caimei/task/LdmTask.java
  23. 0 41
      src/main/java/com/caimei/utils/ExcelNumberFormatter.java
  24. 0 1
      src/main/java/com/caimei/utils/SmsUtils.java
  25. 25 11
      src/main/resources/mapper/AuthProductMapper.xml
  26. 9 6
      src/main/resources/mapper/AuthTemplateMapper.xml
  27. 4 1
      src/main/resources/mapper/ClubMapper.xml
  28. 4 3
      src/main/resources/mapper/ShopMapper.xml

+ 10 - 4
pom.xml

@@ -145,21 +145,21 @@
             <version>1.26.1-RELEASE</version>
         </dependency>
         <!--引入商品模块-->
-        <dependency>
+        <!--<dependency>
             <groupId>com.caimei.module</groupId>
             <artifactId>product</artifactId>
             <version>0.0.1-SNAPSHOT</version>
-        </dependency>
+        </dependency>-->
         <dependency>
             <groupId>org.bouncycastle</groupId>
             <artifactId>bcprov-jdk16</artifactId>
             <version>1.46</version>
         </dependency>
-        <dependency>
+        <!--<dependency>
             <groupId>com.caimei.module</groupId>
             <artifactId>pay</artifactId>
             <version>0.0.1-SNAPSHOT</version>
-        </dependency>
+        </dependency>-->
         <!-- 对 HTML 富文本文档进行解析和操作 -->
         <dependency>
             <groupId>org.jsoup</groupId>
@@ -314,6 +314,12 @@
             <version>0.9.1</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.twelvemonkeys.imageio</groupId>
+            <artifactId>imageio-jpeg</artifactId>
+            <version>3.4.1</version>
+        </dependency>
+
     </dependencies>
 
     <profiles>

+ 23 - 12
src/main/java/com/caimei/controller/admin/auth/AuthProductApi.java

@@ -1,8 +1,11 @@
 package com.caimei.controller.admin.auth;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.dto.ProductSaveDto;
+import com.caimei.model.po.ProductParamPo;
+import com.caimei.model.po.ProductTypePo;
 import com.caimei.model.vo.ProductFormVo;
 import com.caimei.model.vo.ProductListVo;
 import com.caimei.model.vo.ProductTypeListVo;
@@ -87,7 +90,6 @@ public class AuthProductApi {
      * @param productSaveDto {
      *                   productId              授权商品id
      *                   authId                 授权id
-     *                   brandId                品牌id
      *                   productTypeId          设备分类id
      *                   snCode                 商品SN码
      *                   productImage           商品图片
@@ -99,7 +101,6 @@ public class AuthProductApi {
      *                   status                 上线状态:0已下线,1已上线,2待上线
      *                   createBy               创建人id
      *                   source                 来源:1供应商保存,2机构保存
-     *                   paramList              商品参数列表
      * }
      */
     @ApiOperation("添加/编辑授权商品")
@@ -108,12 +109,6 @@ public class AuthProductApi {
         return authProductService.saveProduct(productSaveDto, false);
     }
 
-    /**
-     * 获取授权商品回显数据
-     *
-     * @param productId 授权商品id
-     * @return ProductFormVo
-     */
     @ApiOperation("授权商品回显数据")
     @ApiImplicitParam(name = "productId", required = true, value = "授权商品id")
     @GetMapping("/form/data")
@@ -130,9 +125,6 @@ public class AuthProductApi {
         return authProductService.updateAllWaterMark();
     }
 
-    /**
-     * 审核商品
-     */
     @ApiOperation("审核商品")
     @ApiImplicitParam(name = "params", value = "productId:授权商品id;auditStatus:审核状态:0审核未通过,1审核通过,2待审核;" +
             "invalidReason:审核不通过原因;auditBy:审核人用户id;source:来源:1管理员审核,2供应商审核", required = true)
@@ -147,6 +139,16 @@ public class AuthProductApi {
         return authProductService.auditProduct(productId, auditStatus, invalidReason, auditBy, source);
     }
 
+    @ApiOperation("设备分类回显数据")
+    @ApiImplicitParam(name = "productTypeId", required = true, value = "设备分类id")
+    @GetMapping("/type/form/data")
+    public ResponseJson<ProductTypePo> getProductTypeFormData(Integer productTypeId) {
+        if (null == productTypeId) {
+            return ResponseJson.error("设备分类id不能为空", null);
+        }
+        return authProductService.getProductTypeFromData(productTypeId);
+    }
+
     @ApiOperation("添加/编辑设备分类")
     @ApiImplicitParam(name = "params", value = "productTypeId:设备分类id;authUserId:供应商用户id;name:设备分类名称;image:图片;createBy:创建人用户id;", required = true)
     @PostMapping("/type/save")
@@ -154,19 +156,28 @@ public class AuthProductApi {
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer productTypeId = paramsMap.getInteger("productTypeId");
         Integer authUserId = paramsMap.getInteger("authUserId");
+        Integer brandId = paramsMap.getInteger("brandId");
         String name = paramsMap.getString("name");
         String image = paramsMap.getString("image");
         Integer createBy = paramsMap.getInteger("createBy");
+        String paramListStr = paramsMap.getString("paramList");
+        List<ProductParamPo> paramList = JSONArray.parseArray(paramListStr, ProductParamPo.class);
         if (null == authUserId) {
             return ResponseJson.error("参数异常,供应商用户id不能为空");
         }
+        if (null == brandId) {
+            return ResponseJson.error("参数异常,品牌id不能为空");
+        }
         if (StringUtils.isEmpty(name)) {
             return ResponseJson.error("参数异常,设备分类名称不能为空");
         }
         if (StringUtils.isEmpty(image)) {
             return ResponseJson.error("参数异常,图片不能为空");
         }
-        return authProductService.saveProductType(productTypeId, authUserId, name, image, createBy, 1);
+        if (null == paramList || paramList.size() <= 0) {
+            return ResponseJson.error("参数异常,参数列表不能为空", null);
+        }
+        return authProductService.saveProductType(productTypeId, authUserId, brandId, name, image, createBy, paramList, 1);
     }
 
     @ApiOperation("删除设备分类")

+ 0 - 4
src/main/java/com/caimei/controller/admin/auth/AuthTemplateApi.java

@@ -83,10 +83,6 @@ public class AuthTemplateApi {
                 return ResponseJson.error("模板图片不能为空");
             }
         }
-        if (StringUtils.isEmpty(qrPosition)) {
-            // 默认左上角
-            qrPosition = "0,0";
-        }
         return authTemplateService.saveTemplate(templateId, templateImage, authUserId, status, qrPosition, qrSize, logoSize, authFlag, productFlag);
     }
 

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

@@ -1,6 +1,6 @@
 package com.caimei.controller.admin.auth;
 
-import com.caimei.module.base.entity.bo.JsonModel;
+import com.caimei.model.ResponseJson;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -23,13 +23,13 @@ public class DefaultApi {
 
     @GetMapping("/unauthorized")
     @ApiOperation("Token失效")
-    public JsonModel unauthorized() {
-        return new JsonModel().error(-99, "Token失效请重新登录!");
+    public ResponseJson unauthorized() {
+        return ResponseJson.error(-99, "Token失效请重新登录!");
     }
 
     @GetMapping("/error")
     @ApiOperation("处理非法请求")
-    public JsonModel error() {
-        return new JsonModel().error(-100, "非法的请求!");
+    public ResponseJson error() {
+        return ResponseJson.error(-100, "非法的请求!");
     }
 }

+ 2 - 0
src/main/java/com/caimei/controller/admin/auth/ShopApi.java

@@ -140,6 +140,7 @@ public class ShopApi {
             Integer countryId = (Integer) infoMap.get("countryId");
             String brandAuthLogo = (String) infoMap.get("brandAuthLogo");
             String securityLink = (String) infoMap.get("securityLink");
+            String manufacturer = (String) infoMap.get("manufacturer");
             Integer statementType = (Integer) infoMap.get("statementType");
             String statementContent = (String) infoMap.get("statementContent");
             String statementLink = (String) infoMap.get("statementLink");
@@ -153,6 +154,7 @@ public class ShopApi {
             shopInfo.setCountryId(countryId);
             shopInfo.setBrandAuthLogo(brandAuthLogo);
             shopInfo.setSecurityLink(securityLink);
+            shopInfo.setManufacturer(manufacturer);
             shopInfo.setStatementType(statementType);
             shopInfo.setStatementContent(statementContent);
             shopInfo.setStatementLink(statementLink);

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

@@ -5,7 +5,6 @@ import com.caimei.model.ResponseJson;
 import com.caimei.model.dto.ProductSaveDto;
 import com.caimei.model.po.CmBrandAuthPo;
 import com.caimei.model.vo.*;
-import com.caimei.module.base.entity.vo.AuthProductVo;
 import com.caimei.service.auth.*;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;

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

@@ -1,7 +1,6 @@
 package com.caimei.mapper.cmMapper;
 
 import com.caimei.model.vo.AddressSelectVo;
-import com.caimei.module.base.entity.vo.AddressVo;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;

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

@@ -4,9 +4,6 @@ import com.caimei.model.po.ProductParamPo;
 import com.caimei.model.po.ProductPo;
 import com.caimei.model.po.ProductTypePo;
 import com.caimei.model.vo.*;
-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;
 
@@ -64,7 +61,7 @@ public interface AuthProductMapper {
 
     StatementFileVo getStatementFile(Integer authUserId, Integer brandId);
 
-    List<CmBrandProductParamPo> getAuthProductParams(Integer productId);
+    List<ProductParamPo> getAuthProductParams(Integer productId);
 
     List<WxProductListVo> getClubProductList(Integer authId);
 
@@ -92,5 +89,11 @@ public interface AuthProductMapper {
 
     Integer getAuthUserIdByProductId(Integer productId);
 
+    void deleteParamsByProductTypeId(Integer productTypeId);
+
+    void insertProductTypeParam(@Param("productTypeId") Integer productTypeId, @Param("paramName") String paramName, @Param("paramContent") String paramContent);
+
+    List<ProductParamPo> getProductTypeParamList(Integer productTypeId);
+
     void checkAuthProduct(Integer productId);
 }

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

@@ -24,7 +24,7 @@ public interface AuthTemplateMapper {
 
     void insertTemplate(@Param("templateImage") String templateImage, @Param("authUserId") Integer authUserId, @Param("templateSize") String templateSize, @Param("qrPosition") String qrPosition, @Param("qrSize") Integer qrSize, @Param("logoSize") String logoSize);
 
-    void updateSelective(@Param("templateId") Integer templateId, @Param("templateImage") String templateImage, @Param("authUserId") Integer authUserId, @Param("status") Integer status, @Param("qrPosition") String qrPosition, @Param("qrSize") Integer qrSize, String logoSize, @Param("authFlag") Integer authFlag, @Param("productFlag") Integer productFlag);
+    void updateSelective(@Param("templateId") Integer templateId, @Param("templateImage") String templateImage, @Param("templateSize") String templateSize, @Param("authUserId") Integer authUserId, @Param("status") Integer status, @Param("qrPosition") String qrPosition, @Param("qrSize") Integer qrSize, String logoSize, @Param("authFlag") Integer authFlag, @Param("productFlag") Integer productFlag);
 
     void clearAuthFlag(Integer authUserId);
 

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

@@ -2,8 +2,6 @@ package com.caimei.model.dto;
 
 
 import com.caimei.model.po.ProductParamPo;
-import com.caimei.module.base.entity.po.CmBrandProductParamPo;
-import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import javax.validation.constraints.NotNull;

+ 5 - 0
src/main/java/com/caimei/model/dto/ShopInfoDto.java

@@ -35,6 +35,11 @@ public class ShopInfoDto {
      */
     private String securityLink;
 
+    /**
+     * 制造商
+     */
+    private String manufacturer;
+
     /**
      * 公众号二维码图片
      */

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

@@ -3,6 +3,7 @@ package com.caimei.model.po;
 import lombok.Data;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * cm_brand_auth_product
@@ -22,6 +23,11 @@ public class ProductTypePo {
      */
     private Integer authUserId;
 
+    /**
+     * 品牌id
+     */
+    private Integer brandId;
+
     /**
      * 设备分类名称
      */
@@ -76,4 +82,9 @@ public class ProductTypePo {
      * 审核时间
      */
     private Date auditTime;
+
+    /**
+     * 参数列表
+     */
+    private List<ProductParamPo> paramList;
 }

+ 121 - 0
src/main/java/com/caimei/model/vo/AuthProductVo.java

@@ -0,0 +1,121 @@
+package com.caimei.model.vo;
+
+import com.caimei.model.po.ProductParamPo;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author Aslee
+ */
+@Data
+public class AuthProductVo {
+    /**
+     * 商品名称
+     */
+    private String productName;
+    /**
+     * 商品SN码
+     */
+    private String snCode;
+    /**
+     * 商品图片
+     */
+    private String productImage;
+    /**
+     * 供应商公众号二维码图片
+     */
+    private String qrCodeImage;
+    /**
+     * 授权牌照
+     */
+    private String certificateImage;
+    /**
+     * 品牌授权Id
+     */
+    private Integer authId;
+    /**
+     * 品牌授权logo
+     */
+    private String authLogo;
+    /**
+     * 品牌Id
+     */
+    private Integer brandId;
+    /**
+     * 品牌名称
+     */
+    private String brandName;
+    /**
+     * 产地
+     */
+    private String productionPlace;
+    /**
+     * 防伪链接
+     */
+    private String securityLink;
+    /**
+     * 制造商
+     */
+    private String manufacturer;
+    /**
+     * 供应商类型:1品牌方,2代理商
+     */
+    private Integer shopType;
+    /**
+     * 供应商名称
+     */
+    private String shopName;
+    /**
+     * 供应商用户id
+     */
+    private Integer authUserId;
+    /**
+     * 声明类型:1弹窗声明,2链接声明
+     */
+    private Integer statementType;
+    /**
+     * 声明弹窗内容
+     */
+    private String statementContent;
+    /**
+     * 声明链接
+     */
+    private String statementLink;
+    /**
+     * 声明图片
+     */
+    private String statementImage;
+    /**
+     * 声明文件
+     */
+    private StatementFileVo statementFile;
+    /**
+     * 被授权方
+     */
+    private String authParty;
+    /**
+     * 机构logo
+     */
+    private String clubLogo;
+    /**
+     * 商品参数
+     */
+    private List<ProductParamPo> paramList;
+    /**
+     * pc商品图片(含水印)
+     */
+    private String pcImage;
+    /**
+     * 小程序商品图片(含水印)
+     */
+    private String appletsImage;
+    /**
+     * pc授权牌照图片(含水印)
+     */
+    private String pcCertificateImage;
+    /**
+     * 小程序授权牌照图片(含水印)
+     */
+    private String appletsCertificateImage;
+}

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

@@ -34,6 +34,11 @@ public class ShopInfoVo {
      */
     private String securityLink;
 
+    /**
+     * 制造商
+     */
+    private String manufacturer;
+
     /**
      * 代理声明类型:1弹窗,2链接,3图片,4文件
      */

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

@@ -0,0 +1,15 @@
+package com.caimei.model.vo;
+
+import com.caimei.model.po.CmBrandAuthFilePo;
+import lombok.Data;
+
+/**
+ * @author Aslee
+ */
+@Data
+public class StatementFileVo extends CmBrandAuthFilePo {
+    /**
+     * 访问声明文件链接
+     */
+    private String url;
+}

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

@@ -3,8 +3,6 @@ package com.caimei.service.auth;
 
 import com.caimei.model.ResponseJson;
 import com.caimei.model.vo.AddressSelectVo;
-import com.caimei.module.base.entity.vo.AddressVo;
-import com.github.pagehelper.PageInfo;
 
 import java.util.List;
 

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

@@ -2,9 +2,9 @@ package com.caimei.service.auth;
 
 import com.caimei.model.ResponseJson;
 import com.caimei.model.dto.ProductSaveDto;
+import com.caimei.model.po.ProductParamPo;
 import com.caimei.model.po.ProductTypePo;
 import com.caimei.model.vo.*;
-import com.caimei.module.base.entity.vo.AuthProductVo;
 import com.github.pagehelper.PageInfo;
 
 import java.io.IOException;
@@ -52,7 +52,6 @@ public interface AuthProductService {
 
     /**
      * 添加/编辑授权商品
-     * @param source  来源:1供应商保存,2机构保存
      *
      * @param productSaveDto {
      *                       productId              授权商品id
@@ -125,7 +124,7 @@ public interface AuthProductService {
     /**
      * 保存设备分类
      */
-    ResponseJson<ProductTypePo> saveProductType(Integer productTypeId, Integer authUserId, String name, String image, Integer createBy, Integer createSource) throws IOException;
+    ResponseJson<ProductTypePo> saveProductType(Integer productTypeId, Integer authUserId, Integer brandId, String name, String image, Integer createBy, List<ProductParamPo> paramList, Integer createSource) throws IOException;
 
     /**
      * 删除设备分类
@@ -157,6 +156,11 @@ public interface AuthProductService {
      */
     ResponseJson<PageInfo<WxProductTypeListVo>> getWxProductTypeList(Integer authUserId, String appId, String name, Integer pageNum, Integer pageSize);
 
+    /**
+     * 设备分类回显数据
+     * @return
+     */
+    ResponseJson<ProductTypePo> getProductTypeFromData(Integer productTypeId);
     /**
      * 更改查看标记
      * @param productId

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

@@ -9,7 +9,6 @@ import com.caimei.model.po.CmBrandAuthPo;
 import com.caimei.model.po.TownPo;
 import com.caimei.model.vo.AddressSelectVo;
 import com.caimei.model.vo.RossAddressVo;
-import com.caimei.module.base.entity.vo.TownVo;
 import com.caimei.service.auth.AddressService;
 import com.caimei.service.auth.UploadService;
 import com.caimei.utils.RequestUtil;

+ 37 - 12
src/main/java/com/caimei/service/auth/impl/AuthProductServiceImpl.java

@@ -11,8 +11,6 @@ import com.caimei.model.po.ProductParamPo;
 import com.caimei.model.po.ProductPo;
 import com.caimei.model.po.ProductTypePo;
 import com.caimei.model.vo.*;
-import com.caimei.module.base.entity.vo.AuthProductVo;
-import com.caimei.module.base.entity.vo.StatementFileVo;
 import com.caimei.service.auth.AuthProductService;
 import com.caimei.service.auth.UploadService;
 import com.caimei.utils.Base64Util;
@@ -170,9 +168,9 @@ public class AuthProductServiceImpl implements AuthProductService {
                 return ResponseJson.error("参数异常,请选择二维码授权牌模板", null);
             }
         }
-        if (null == paramList || paramList.size() <= 0) {
+        /*if (null == paramList || paramList.size() <= 0) {
             return ResponseJson.error("参数异常,商品参数列表不能为空", null);
-        }
+        }*/
         // 是否为添加操作
         boolean insertFlag = null == productId;
         ProductFormVo dbProduct = null;
@@ -334,11 +332,13 @@ public class AuthProductServiceImpl implements AuthProductService {
         // 删除商品参数
         authProductMapper.deleteParamsByProductId(product.getProductId());
         // 保存商品参数
-        paramList.forEach(param -> {
-            if (StringUtils.isNotBlank(param.getParamName()) && StringUtils.isNotBlank(param.getParamContent())) {
-                authProductMapper.insertProductParam(product.getProductId(), param.getParamName(), param.getParamContent());
-            }
-        });
+        if (paramList != null) {
+            paramList.forEach(param -> {
+                if (StringUtils.isNotBlank(param.getParamName()) && StringUtils.isNotBlank(param.getParamContent())) {
+                    authProductMapper.insertProductParam(product.getProductId(), param.getParamName(), param.getParamContent());
+                }
+            });
+        }
         return ResponseJson.success("保存授权商品成功");
     }
 
@@ -390,6 +390,9 @@ public class AuthProductServiceImpl implements AuthProductService {
             return ResponseJson.error("商品不存在", null);
         }
         List<ProductParamPo> paramList = authProductMapper.getParamsByProductId(productId);
+        if (null == paramList || paramList.size() == 0) {
+            paramList = authProductMapper.getProductTypeParamList(productForm.getProductTypeId());
+        }
         productForm.setParamList(paramList);
         return ResponseJson.success(productForm);
     }
@@ -453,8 +456,9 @@ public class AuthProductServiceImpl implements AuthProductService {
                 // 查询设备分类是否已存在
                 ProductTypePo productType = authProductMapper.getProductType(null, product.getName(), authUserId);
                 if (null == productType) {
+                    List<ProductParamPo> paramList = authProductMapper.getParamsByProductId(productId);
                     try {
-                        ResponseJson<ProductTypePo> result = saveProductType(null, authUserId, product.getName(), product.getImage(), product.getCreateBy(), 2);
+                        ResponseJson<ProductTypePo> result = saveProductType(null, authUserId, product.getBrandId(), product.getName(), product.getImage(), product.getCreateBy(), paramList, 2);
                         int code = result.getCode();
                         if (0 == code) {
                             productType = result.getData();
@@ -481,8 +485,9 @@ public class AuthProductServiceImpl implements AuthProductService {
                 // 查询设备分类是否已存在
                 ProductTypePo productType = authProductMapper.getProductType(null, product.getName(), authUserId);
                 if (null == productType) {
+                    List<ProductParamPo> paramList = authProductMapper.getParamsByProductId(productId);
                     try {
-                        ResponseJson<ProductTypePo> result = saveProductType(null, authUserId, product.getName(), product.getImage(), product.getCreateBy(), 2);
+                        ResponseJson<ProductTypePo> result = saveProductType(null, authUserId, product.getBrandId(), product.getName(), product.getImage(), product.getCreateBy(), paramList, 2);
                         int code = result.getCode();
                         if (0 == code) {
                             productType = result.getData();
@@ -537,7 +542,7 @@ public class AuthProductServiceImpl implements AuthProductService {
     }
 
     @Override
-    public ResponseJson<ProductTypePo> saveProductType(Integer productTypeId, Integer authUserId, String name, String image, Integer createBy, Integer createSource) throws IOException {
+    public ResponseJson<ProductTypePo> saveProductType(Integer productTypeId, Integer authUserId, Integer brandId, String name, String image, Integer createBy, List<ProductParamPo> paramList, Integer createSource) throws IOException {
         // 是否为添加操作
         boolean insertFlag = null == productTypeId;
         /*
@@ -545,6 +550,7 @@ public class AuthProductServiceImpl implements AuthProductService {
          */
         ProductTypePo productType = new ProductTypePo();
         productType.setAuthUserId(authUserId);
+        productType.setBrandId(brandId);
         productType.setName(name);
         productType.setImage(image);
         productType.setCreateBy(createBy);
@@ -584,6 +590,16 @@ public class AuthProductServiceImpl implements AuthProductService {
             // 更新设备分类
             authProductMapper.updateProductType(productType);
         }
+        // 删除设备分类参数
+        authProductMapper.deleteParamsByProductTypeId(productType.getProductTypeId());
+        // 保存商品参数
+        if (null != paramList) {
+            paramList.forEach(param -> {
+                if (StringUtils.isNotBlank(param.getParamName()) && StringUtils.isNotBlank(param.getParamContent())) {
+                    authProductMapper.insertProductTypeParam(productType.getProductTypeId(), param.getParamName(), param.getParamContent());
+                }
+            });
+        }
         return ResponseJson.success("保存设备分类成功", productType);
     }
 
@@ -594,6 +610,7 @@ public class AuthProductServiceImpl implements AuthProductService {
             return ResponseJson.error("该设备有绑定设备认证,暂时无法删除");
         }
         authProductMapper.deleteProductType(productTypeId);
+        authProductMapper.deleteParamsByProductTypeId(productTypeId);
         return ResponseJson.success("删除设备分类成功");
     }
 
@@ -644,6 +661,14 @@ public class AuthProductServiceImpl implements AuthProductService {
         return ResponseJson.success(pageData);
     }
 
+    @Override
+    public ResponseJson<ProductTypePo> getProductTypeFromData(Integer productTypeId) {
+        ProductTypePo productType = authProductMapper.getProductType(productTypeId, null, null);
+        List<ProductParamPo> paramList = authProductMapper.getProductTypeParamList(productTypeId);
+        productType.setParamList(paramList);
+        return ResponseJson.success(productType);
+    }
+
     @Override
     public ResponseJson checkAuthProduct(Integer productId) {
         authProductMapper.checkAuthProduct(productId);

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

@@ -409,7 +409,7 @@ public class AuthServiceImpl implements AuthService {
                 map.put("addWord1_style", Font.BOLD);
                 map.put("addWord1_size", (int) Math.round(90 * rate));
                 map.put("addWord1_x", (int) Math.round(2168 * rate));
-                map.put("addWord1_y", (int) Math.round(3150 * rate));
+                map.put("addWord1_y", (int) Math.round(3165 * rate));
             }
             // 添加认证日期信息
             if (null != auth.getAuthDate()) {
@@ -420,7 +420,7 @@ public class AuthServiceImpl implements AuthService {
                 map.put("addWord2_style", Font.PLAIN);
                 map.put("addWord2_size", (int) Math.round(90 * rate));
                 map.put("addWord2_x", (int) Math.round(2085 * rate));
-                map.put("addWord2_y", (int) Math.round(3277 * rate));
+                map.put("addWord2_y", (int) Math.round(3292 * rate));
             }
             // 添加二维码信息
             if (StringUtils.isNotEmpty(template.getQrPosition())) {

+ 21 - 5
src/main/java/com/caimei/service/auth/impl/AuthTemplateServiceImpl.java

@@ -7,6 +7,7 @@ import com.caimei.service.auth.AuthTemplateService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -45,9 +46,10 @@ public class AuthTemplateServiceImpl implements AuthTemplateService {
     @Override
     public ResponseJson saveTemplate(Integer templateId, String templateImage, Integer authUserId, Integer status, String qrPosition, Integer qrSize, String logoSize, Integer authFlag, Integer productFlag) {
         boolean insertFlag = null == templateId;
-        if (insertFlag) {
-            Integer width = null;
-            Integer height = null;
+        Integer width = null;
+        Integer height = null;
+        String templateSize = null;
+        if (StringUtils.isNotEmpty(templateImage)) {
             try {
                 BufferedImage image = ImageIO.read(new URL(templateImage));
                 width = image.getWidth();
@@ -55,16 +57,30 @@ public class AuthTemplateServiceImpl implements AuthTemplateService {
             } catch (Exception e) {
                 e.printStackTrace();
             }
-            String templateSize = (null == width ? 0 : width) + "," + (null == height ? 0 : height);
+            templateSize = (null == width ? 0 : width) + "," + (null == height ? 0 : height);
+        }
+        if (insertFlag) {
+            if (StringUtils.isEmpty(qrPosition)) {
+                // 默认左上角
+                qrPosition = "0,0";
+            }
             authTemplateMapper.insertTemplate(templateImage, authUserId, templateSize, qrPosition, qrSize, logoSize);
         } else {
+            TemplateVo dbTemplate = authTemplateMapper.getTemplateFormData(templateId, null, null, null, null);
             if (null != authFlag && 1 == authFlag) {
                 authTemplateMapper.clearAuthFlag(authUserId);
             }
             if (null != productFlag && 1 == productFlag) {
                 authTemplateMapper.clearProductFlag(authUserId);
             }
-            authTemplateMapper.updateSelective(templateId, templateImage, authUserId, status, qrPosition, qrSize, logoSize, authFlag, productFlag);
+            if (null != dbTemplate) {
+                if (null != authUserId && !dbTemplate.getAuthUserId().equals(authUserId)) {
+                    // 更新了供应商,不选中位置
+                    authFlag = 0;
+                    productFlag = 0;
+                }
+                authTemplateMapper.updateSelective(templateId, templateImage, templateSize, authUserId, status, qrPosition, qrSize, logoSize, authFlag, productFlag);
+            }
         }
         return ResponseJson.success();
     }

+ 0 - 1
src/main/java/com/caimei/task/LdmTask.java

@@ -5,7 +5,6 @@ import com.caimei.mapper.ldmMapper.LdmMapper;
 import com.caimei.model.po.CmBrandAuthPo;
 import com.caimei.model.po.LdmDataPo;
 import com.caimei.model.po.TownPo;
-import com.caimei.module.base.entity.po.Town;
 import com.caimei.service.auth.UploadService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;

+ 0 - 41
src/main/java/com/caimei/utils/ExcelNumberFormatter.java

@@ -1,41 +0,0 @@
-package com.caimei.utils;
-
-import com.caimei.module.pay.util.MathUtil;
-import org.apache.commons.lang.StringUtils;
-
-public class ExcelNumberFormatter {
-	
-	public String format(String bigDecimal){
-		if(bigDecimal == null){
-			return StringUtils.EMPTY;
-		}else{
-			return MathUtil.round(bigDecimal,2).toString();
-		}
-	}
-
-	public Double formatStr(String bigDecimal){
-		if(bigDecimal == null){
-			return 0.00;
-		}else{
-			return MathUtil.round(bigDecimal,2).doubleValue();
-		}
-	}
-
-	public String formatDouble(Double number){
-		if(number == null){
-			return StringUtils.EMPTY;
-		}else{
-			return MathUtil.round(number.toString(),2).toString();
-		}
-	}
-
-	public String addStr(Object str1, Object str2) {
-		if (str1 == null || str2 == null) return "";
-		return str1.toString() + str2.toString();
-	}
-
-	public String addStrings(Object str1, Object str2, Object str3, Object str4) {
-		if (str1 == null || str2 == null || str3 == null || str4 == null) return "";
-		return str1.toString() + str2.toString() + str3.toString() + str4.toString();
-	}
-}

+ 0 - 1
src/main/java/com/caimei/utils/SmsUtils.java

@@ -2,7 +2,6 @@ package com.caimei.utils;
 
 
 import com.alibaba.fastjson.JSONObject;
-import com.caimei.module.pay.util.HttpRequest;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Value;

+ 25 - 11
src/main/resources/mapper/AuthProductMapper.xml

@@ -18,8 +18,12 @@
         values (#{productId}, #{paramName}, #{paramContent})
     </insert>
     <insert id="insertProductType" keyColumn="id" keyProperty="productTypeId" useGeneratedKeys="true" parameterType="com.caimei.model.po.ProductTypePo">
-        insert into cm_brand_product_type (authUserId, name, image, pcImage, appletsImage, status, auditStatus, auditBy, auditTime, createBy, createSource, createTime, delFlag)
-        values (#{authUserId}, #{name}, #{image}, #{pcImage}, #{appletsImage}, #{status}, #{auditStatus}, #{auditBy}, #{auditTime}, #{createBy}, #{createSource}, #{createTime}, 0)
+        insert into cm_brand_product_type (authUserId, brandId, name, image, pcImage, appletsImage, status, auditStatus, auditBy, auditTime, createBy, createSource, createTime, delFlag)
+        values (#{authUserId}, #{brandId}, #{name}, #{image}, #{pcImage}, #{appletsImage}, #{status}, #{auditStatus}, #{auditBy}, #{auditTime}, #{createBy}, #{createSource}, #{createTime}, 0)
+    </insert>
+    <insert id="insertProductTypeParam">
+        insert into cm_brand_product_type_param (productTypeId, name, content)
+        values (#{productTypeId}, #{paramName}, #{paramContent})
     </insert>
 
     <update id="updateProductStatusByProductId">
@@ -95,6 +99,7 @@
     <update id="updateProductType">
         update cm_brand_product_type
         set name  = #{name},
+            brandId = #{brandId},
             <if test="pcImage != null and pcImage != ''">
                 pcImage = #{pcImage},
             </if>
@@ -126,6 +131,9 @@
     <delete id="deleteParamsByProductId">
         delete from cm_brand_product_param where productId = #{productId}
     </delete>
+    <delete id="deleteParamsByProductTypeId">
+        delete from cm_brand_product_type_param where productTypeId = #{productTypeId}
+    </delete>
     <update id="deleteProductType">
         update cm_brand_product_type set delFlag = 1 where id = #{productTypeId}
     </update>
@@ -200,7 +208,6 @@
     <select id="getProductFormByProductId" resultType="com.caimei.model.vo.ProductFormVo">
         select p.`id`    as productId,
                `authId`,
-               `brandId`,
                cb.name as brandName,
                p.productTypeId,
                if(p.productTypeId is null, p.name, t.name) as productName,
@@ -301,7 +308,7 @@
         where authId = #{authId}
         order by p.createTime desc
     </select>
-    <select id="getAuthProductByProductId" resultType="com.caimei.module.base.entity.vo.AuthProductVo">
+    <select id="getAuthProductByProductId" resultType="com.caimei.model.vo.AuthProductVo">
         select t.name       as productName,
                p.snCode,
                t.image as pcImage,
@@ -314,11 +321,13 @@
                c.name       as productionPlace,
                a.id         as authId,
                a.authParty,
+               a.logo       as clubLogo,
                u.authUserId as authUserId,
                u.name       as shopName,
                u.shopType,
                u.qrCodeImage,
                i.securityLink,
+               i.manufacturer,
                i.statementType,
                i.statementContent,
                i.statementLink,
@@ -327,7 +336,7 @@
                  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
+                 left join cm_brand_auth_shop_info i on u.authUserId = i.authUserId and t.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}
@@ -339,17 +348,17 @@
           and t.status = 1
           and t.auditStatus = 1
     </select>
-    <select id="getStatementFile" resultType="com.caimei.module.base.entity.vo.StatementFileVo">
+    <select id="getStatementFile" resultType="com.caimei.model.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 id="getAuthProductParams" resultType="com.caimei.model.po.ProductParamPo">
+        select p.name as paramName, p.content as paramContent
+        from cm_brand_product_type_param p left join cm_brand_auth_product ap on p.productTypeId = ap.productTypeId
+        where ap.id = #{productId}
     </select>
     <select id="getClubProductList" resultType="com.caimei.model.vo.WxProductListVo">
         select p.id as productId, t.name as productName, p.snCode
@@ -398,7 +407,7 @@
         order by t.id desc
     </select>
     <select id="getProductType" resultType="com.caimei.model.po.ProductTypePo">
-        select id as productTypeId, name, image, pcImage, appletsImage
+        select id as productTypeId, brandId, name, image, pcImage, appletsImage, authUserId, createBy
         from cm_brand_product_type
         <where>
             <if test="productTypeId != null">
@@ -427,4 +436,9 @@
                  left join cm_brand_auth a on p.authId = a.id
         where p.id = #{productId}
     </select>
+    <select id="getProductTypeParamList" resultType="com.caimei.model.po.ProductParamPo">
+        select name as paramName, content as paramContent
+        from cm_brand_product_type_param
+        where productTypeId = #{productTypeId}
+    </select>
 </mapper>

+ 9 - 6
src/main/resources/mapper/AuthTemplateMapper.xml

@@ -8,12 +8,15 @@
     <update id="updateSelective">
         update cm_brand_auth_template
         <set>
-            <if test="authUserId != null and null == authFlag and null == productFlag">
-                authUserId = #{authUserId}, authFlag = 0, productFlag = 0,
+            <if test="authUserId != null">
+                authUserId = #{authUserId},
             </if>
             <if test="templateImage != null and templateImage != ''">
                 templateImage = #{templateImage},
             </if>
+            <if test="templateSize != null and templateSize != ''">
+                templateSize = #{templateSize},
+            </if>
             <if test="status != null">
                 status = #{status},
             </if>
@@ -26,11 +29,11 @@
             <if test="logoSize != null and logoSize != ''">
                 logoSize = #{logoSize},
             </if>
-            <if test="authFlag != null and authFlag == 1">
-                authFlag = 1,
+            <if test="authFlag != null">
+                authFlag = #{authFlag},
             </if>
-            <if test="productFlag != null and productFlag == 1">
-                productFlag = 1,
+            <if test="productFlag != null">
+                productFlag = #{productFlag},
             </if>
         </set>
         where id = #{templateId}

+ 4 - 1
src/main/resources/mapper/ClubMapper.xml

@@ -82,6 +82,9 @@
         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
+        left join (select cbap.authId as authId, count(*) as productCount
+        from cm_brand_auth_product cbap where cbap.status = 1
+        group by cbap.authId) pc on a.id = pc.authId
         where au.authUserId = #{authUserId}
         and a.status = 1
         and a.auditStatus = 1
@@ -99,7 +102,7 @@
         <if test="townId != null">
             and a.townId = #{townId}
         </if>
-        order by distance
+        order by pc.productCount desc, distance
     </select>
     <select id="checkMobile" resultType="java.lang.Integer">
         select cu.id as clubUserId from cm_brand_club_user cu

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

@@ -13,7 +13,7 @@
     <insert id="insertShopInfo">
         insert into cm_brand_auth_shop_info
         <trim prefix="(" suffix=")" suffixOverrides=",">
-            authUserId,brandId,countryId,securityLink,
+            authUserId,brandId,countryId,securityLink,manufacturer,
             <if test="statementType != null">
                 statementType,
             </if>
@@ -28,7 +28,7 @@
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-            #{authUserId},#{brandId},#{countryId},#{securityLink},
+            #{authUserId},#{brandId},#{countryId},#{securityLink},#{manufacturer},
             <if test="statementType != null">
                 #{statementType},
             </if>
@@ -73,7 +73,7 @@
     <update id="updateShopInfo">
         update cm_brand_auth_shop_info
         <set>
-            countryId=#{countryId},securityLink = #{securityLink},
+            countryId=#{countryId},securityLink = #{securityLink},manufacturer = #{manufacturer},
             <if test="statementType != null">
                 statementType = #{statementType},
             </if>
@@ -283,6 +283,7 @@
         select i.brandId,
                i.countryId,
                i.securityLink,
+               i.manufacturer,
                i.statementType,
                i.statementContent,
                i.statementLink,