浏览代码

正品联盟审核版本

Aslee 3 年之前
父节点
当前提交
06134a5496

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

@@ -37,23 +37,26 @@ public class AuthApi {
      */
     @ApiOperation("授权列表")
     @ApiImplicitParams({
+            @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1授权列表,2授权审核列表"),
             @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
             @ApiImplicitParam(name = "authParty", required = false, value = "授权机构"),
+            @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
+            @ApiImplicitParam(name = "lowerAuditStatus", required = false, value = "商品信息审核状态:0未完成审核,1已完成审核"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     @GetMapping("/list")
-    public ResponseJson<PageInfo<AuthVo>> getAuthList(Integer authUserId, String authParty,
+    public ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty, Integer auditStatus, Integer lowerAuditStatus,
                                                       @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                       @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
-        return authService.getAuthList(authUserId, authParty, pageNum, pageSize);
+        return authService.getAuthList(listType, authUserId, authParty, auditStatus, lowerAuditStatus, pageNum, pageSize);
     }
 
     /**
      * 更新授权状态
      */
     @ApiOperation("更新授权状态")
-    @ApiImplicitParam(name = "params", value = "authId:授权id;status:授权状态:0停用 1启用", required = true)
+    @ApiImplicitParam(name = "params", value = "authId:授权id;status:授权状态:0停用 1启用;", required = true)
     @PostMapping("/update/status")
     public ResponseJson updateAuthStatus(@RequestBody Map<String,Integer> params) {
         Integer authId = params.get("authId");
@@ -92,13 +95,14 @@ public class AuthApi {
      * 审核品牌授权
      */
     @ApiOperation("审核品牌授权")
-    @ApiImplicitParam(name = "params", value = "authId:授权id;auditStatus:审核状态:0审核未通过,1审核通过,2待审核;invalidReason:审核不通过原因", required = true)
+    @ApiImplicitParam(name = "params", value = "authId:授权id;auditStatus:审核状态:0审核未通过,1审核通过,2待审核;invalidReason:审核不通过原因;auditBy:审核人用户id", required = true)
     @PostMapping("/audit")
     public ResponseJson auditAuth(@RequestBody String params) {
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer authId = paramsMap.getInteger("authId");
         Integer auditStatus = paramsMap.getInteger("auditStatus");
         String invalidReason = paramsMap.getString("invalidReason");
-        return authService.auditAuth(authId, auditStatus, invalidReason);
+        Integer auditBy = paramsMap.getInteger("auditBy");
+        return authService.auditAuth(authId, auditStatus, invalidReason, auditBy);
     }
 }

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

@@ -38,17 +38,19 @@ public class AuthProductApi {
      */
     @ApiOperation("授权商品列表")
     @ApiImplicitParams({
+            @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1商品列表,2商品审核列表"),
             @ApiImplicitParam(name = "authId", required = true, value = "授权id"),
             @ApiImplicitParam(name = "productName", required = false, value = "商品名称"),
             @ApiImplicitParam(name = "snCode", required = false, value = "商品SN码"),
+            @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<ProductListVo>> getProductList(Integer authId, String productName, String snCode,
+    public ResponseJson<PageInfo<ProductListVo>> getProductList(Integer listType, Integer authId, String productName, String snCode, Integer auditStatus,
                                                                     @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                     @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
-        return authProductService.getProductList(authId, productName, snCode, pageNum, pageSize);
+        return authProductService.getProductList(listType, authId, productName, snCode, auditStatus, pageNum, pageSize);
     }
 
 
@@ -122,13 +124,14 @@ public class AuthProductApi {
      * 审核商品
      */
     @ApiOperation("审核商品")
-    @ApiImplicitParam(name = "params", value = "productId:授权商品id;auditStatus:审核状态:0审核未通过,1审核通过,2待审核;invalidReason:审核不通过原因", required = true)
+    @ApiImplicitParam(name = "params", value = "productId:授权商品id;auditStatus:审核状态:0审核未通过,1审核通过,2待审核;invalidReason:审核不通过原因;auditBy:审核人用户id", required = true)
     @PostMapping("/audit")
     public ResponseJson auditProduct(@RequestBody String params) {
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer productId = paramsMap.getInteger("productId");
         Integer auditStatus = paramsMap.getInteger("auditStatus");
         String invalidReason = paramsMap.getString("invalidReason");
-        return authProductService.auditProduct(productId, auditStatus, invalidReason);
+        Integer auditBy = paramsMap.getInteger("auditBy");
+        return authProductService.auditProduct(productId, auditStatus, invalidReason, auditBy);
     }
 }

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

@@ -42,20 +42,21 @@ public class ShopApi {
      */
     @ApiOperation("供应商列表")
     @ApiImplicitParams({
+            @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1供应商列表,2审核列表"),
             @ApiImplicitParam(name = "shopName", required = false, value = "供应商名称"),
             @ApiImplicitParam(name = "shopType", required = false, value = "供应商类型:1品牌方,2代理商"),
             @ApiImplicitParam(name = "brandId", required = false, value = "所属品牌id"),
             @ApiImplicitParam(name = "mobile", required = false, value = "手机号"),
             @ApiImplicitParam(name = "linkMan", required = false, value = "联系人"),
+            @ApiImplicitParam(name = "lowerAuditStatus", required = false, value = "下级审核状态,0未完成审核,1已完成审核"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     @GetMapping("/list")
-    public ResponseJson<PageInfo<ShopListVo>> getShopList(String shopName, Integer shopType, Integer brandId, String mobile, String linkMan,
+    public ResponseJson<PageInfo<ShopListVo>> getShopList(Integer listType, String shopName, Integer shopType, Integer brandId, String mobile, String linkMan, Integer lowerAuditStatus,
                                                           @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                           @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
-
-        return shopService.getShopList(shopName, shopType, brandId, mobile, linkMan, pageNum, pageSize);
+        return shopService.getShopList(listType, shopName, shopType, brandId, mobile, linkMan, lowerAuditStatus, pageNum, pageSize);
     }
 
     /**

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

@@ -5,6 +5,7 @@ import com.caimei.model.vo.AuthVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -16,7 +17,7 @@ import java.util.List;
 @Mapper
 public interface AuthMapper {
 
-    List<AuthVo> getAuthList(@Param("authUserId") Integer authUserId, @Param("authParty") String authParty);
+    List<AuthVo> getAuthList(@Param("listType") Integer listType, @Param("authUserId") Integer authUserId, @Param("authParty") String authParty, @Param("auditStatus") Integer auditStatus);
 
     void updateAuthStatusByAuthId(@Param("authId") Integer authId, @Param("status") Integer status);
 
@@ -28,5 +29,5 @@ public interface AuthMapper {
 
     Integer getProductWaitAuditNum(Integer authId);
 
-    void updateAuthAuditStatus(@Param("authId") Integer authId, @Param("auditStatus") Integer auditStatus, @Param("invalidReason") String invalidReason);
+    void updateAuthAuditStatus(@Param("authId") Integer authId, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus, @Param("invalidReason") String invalidReason, @Param("auditBy") Integer auditBy, @Param("auditTime") Date auditTime);
 }

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

@@ -7,6 +7,7 @@ import com.caimei.model.vo.ProductListVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -18,7 +19,7 @@ import java.util.List;
 @Mapper
 public interface AuthProductMapper {
 
-    List<ProductListVo> getProductList(@Param("authId") Integer authId, @Param("productName") String productName, @Param("snCode") String snCode);
+    List<ProductListVo> getProductList(@Param("listType") Integer listType, @Param("authId") Integer authId, @Param("productName") String productName, @Param("snCode") String snCode, @Param("auditStatus") Integer auditStatus);
 
     void updateProductStatusByProductId(@Param("productId") Integer productId, @Param("status") Integer status);
 
@@ -46,5 +47,5 @@ public interface AuthProductMapper {
 
     void updateImageByProductId(ProductPo product);
 
-    void updateProductAuditStatus(@Param("productId") Integer productId, @Param("auditStatus") Integer auditStatus, @Param("invalidReason") String invalidReason);
+    void updateProductAuditStatus(@Param("productId") Integer productId, @Param("auditStatus") Integer auditStatus, @Param("invalidReason") String invalidReason, @Param("auditBy") Integer auditBy, @Param("auditTime") Date auditTime);
 }

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

@@ -18,7 +18,7 @@ import java.util.List;
 @Mapper
 public interface ShopMapper {
 
-    List<ShopListVo> getShopList(@Param("shopName") String shopName, @Param("shopType") Integer shopType, @Param("brandId") Integer brandId, @Param("mobile") String mobile, @Param("linkMan") String linkMan);
+    List<ShopListVo> getShopList(@Param("listType") Integer listType, @Param("shopName") String shopName, @Param("shopType") Integer shopType, @Param("brandId") Integer brandId, @Param("mobile") String mobile, @Param("linkMan") String linkMan);
 
     void updateShopStatusByUserId(@Param("authUserId") Integer authUserId, @Param("status") Integer status);
 

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

@@ -27,6 +27,11 @@ public class CmBrandAuthPo {
      */
     private Integer status;
 
+    /**
+     * 审核状态:0审核未通过,1审核通过,2待审核
+     */
+    private Integer auditStatus;
+
     /**
      * 创建时间
      */

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

@@ -72,6 +72,11 @@ public class ProductPo {
      */
     private Integer status;
 
+    /**
+     * 审核状态:0审核未通过,1审核通过,2待审核
+     */
+    private Integer auditStatus;
+
     /**
      * 创建时间
      */

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

@@ -50,4 +50,13 @@ public class AuthVo {
 
     @ApiModelProperty("下级待审核数量")
     private Integer waitAuditNum;
+
+    @ApiModelProperty("审核人")
+    private String auditBy;
+
+    @ApiModelProperty("审核时间")
+    private Date auditTime;
+
+    @ApiModelProperty("审核不通过原因")
+    private String invalidReason;
 }

+ 9 - 0
src/main/java/com/caimei/model/vo/ProductListVo.java

@@ -31,4 +31,13 @@ public class ProductListVo {
 
     @ApiModelProperty("创建人")
     private String createBy;
+
+    @ApiModelProperty("审核时间")
+    private Date auditTime;
+
+    @ApiModelProperty("审核人")
+    private String auditBy;
+
+    @ApiModelProperty("审核不通过原因")
+    private String invalidReason;
 }

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

@@ -20,14 +20,17 @@ public interface AuthProductService {
     /**
      * 授权商品列表
      *
+     *
+     * @param listType      列表类型:1商品列表,2商品审核列表
      * @param authId        授权id
      * @param productName   商品名称
      * @param snCode        商品SN码
+     * @param auditStatus   审核状态:0审核未通过,1审核通过,2待审核
      * @param pageNum       第几页
      * @param pageSize      一页多少条
      * @return  ProductListVo
      */
-    ResponseJson<PageInfo<ProductListVo>> getProductList(Integer authId, String productName, String snCode, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<ProductListVo>> getProductList(Integer listType, Integer authId, String productName, String snCode, Integer auditStatus, Integer pageNum, Integer pageSize);
 
     /**
      * 更新授权商品状态
@@ -87,7 +90,8 @@ public interface AuthProductService {
      * @param productId         商品id
      * @param auditStatus       审核状态
      * @param invalidReason     审核不通过原因
+     * @param auditBy           审核人用户id
      * @return ResponseJson
      */
-    ResponseJson auditProduct(Integer productId, Integer auditStatus, String invalidReason);
+    ResponseJson auditProduct(Integer productId, Integer auditStatus, String invalidReason, Integer auditBy);
 }

+ 16 - 13
src/main/java/com/caimei/service/AuthService.java

@@ -2,11 +2,8 @@ package com.caimei.service;
 
 import com.caimei.model.ResponseJson;
 import com.caimei.model.vo.AuthVo;
-import com.caimei.model.vo.BrandVo;
 import com.github.pagehelper.PageInfo;
 
-import java.util.List;
-
 /**
  * Description
  *
@@ -17,19 +14,24 @@ public interface AuthService {
 
     /**
      * 授权列表
-     * @param authUserId    供应商用户id
-     * @param authParty     授权机构
-     * @param pageNum       第几页
-     * @param pageSize      一页多少条
-     * @return  AuthVo
+     *
+     * @param listType   列表类型:1授权列表,2授权审核列表
+     * @param authUserId 供应商用户id
+     * @param authParty  授权机构
+     * @param auditStatus  审核状态:0审核未通过,1审核通过,2待审核
+     * @param lowerAuditStatus  商品信息审核状态:0未完成审核,1已完成审核
+     * @param pageNum    第几页
+     * @param pageSize   一页多少条
+     * @return AuthVo
      */
-    ResponseJson<PageInfo<AuthVo>> getAuthList(Integer authUserId, String authParty, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty, Integer auditStatus, Integer lowerAuditStatus, Integer pageNum, Integer pageSize);
 
     /**
      * 更新授权状态
-     * @param authId    授权id
-     * @param status    授权状态:0停用 1启用
-     * @return  ResponseJson
+     *
+     * @param authId 授权id
+     * @param status 授权状态:0停用 1启用
+     * @return ResponseJson
      */
     ResponseJson updateAuthStatus(Integer authId, Integer status);
 
@@ -57,7 +59,8 @@ public interface AuthService {
      * @param authId            授权id
      * @param auditStatus       审核状态
      * @param invalidReason     审核不通过原因
+     * @param auditBy           审核人用户id
      * @return ResponseJson
      */
-    ResponseJson auditAuth(Integer authId, Integer auditStatus, String invalidReason);
+    ResponseJson auditAuth(Integer authId, Integer auditStatus, String invalidReason, Integer auditBy);
 }

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

@@ -18,16 +18,19 @@ public interface ShopService {
     /**
      * 供应商列表数据
      *
+     *
+     * @param listType  列表类型:1供应商列表,2审核列表
      * @param shopName  供应商名称
      * @param shopType  供应商类型:1品牌方,2代理商
      * @param brandId   所属品牌Id
      * @param mobile    手机号
      * @param linkMan   联系人
+     * @param lowerAuditStatus  下级审核状态,0未完成审核,1已完成审核
      * @param pageNum   第几页
      * @param pageSize  一页多少条
      * @return PageInfo<ShopVo>
      */
-    ResponseJson<PageInfo<ShopListVo>> getShopList(String shopName, Integer shopType, Integer brandId, String mobile, String linkMan, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<ShopListVo>> getShopList(Integer listType, String shopName, Integer shopType, Integer brandId, String mobile, String linkMan, Integer lowerAuditStatus, Integer pageNum, Integer pageSize);
 
     /**
      * 更新供应商状态

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

@@ -51,12 +51,13 @@ public class AuthProductServiceImpl implements AuthProductService {
     private String imageDomain;
 
     @Override
-    public ResponseJson<PageInfo<ProductListVo>> getProductList(Integer authId, String productName, String snCode, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<ProductListVo>> getProductList(Integer listType, Integer authId, String productName, String snCode, Integer auditStatus, Integer pageNum, Integer pageSize) {
         if (null == authId) {
             return ResponseJson.error("参数异常,请输入授权id", null);
         }
+        listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
-        List<ProductListVo> productList = authProductMapper.getProductList(authId, productName, snCode);
+        List<ProductListVo> productList = authProductMapper.getProductList(listType, authId, productName, snCode, auditStatus);
         PageInfo<ProductListVo> pageData = new PageInfo<>(productList);
         return ResponseJson.success(pageData);
     }
@@ -145,8 +146,9 @@ public class AuthProductServiceImpl implements AuthProductService {
         product.setProductImage(productImage);
         // 授权牌照
         product.setCertificateImage(certificateImage);
-        // 商品信息保存后,上线状态默认为“待上线”
+        // 商品信息保存后,上线状态默认为“待上线”,审核状态为“待审核”
         product.setStatus(2);
+        product.setAuditStatus(2);
         if (insertFlag) {
             // 创建人id
             product.setCreateBy(createBy);
@@ -169,13 +171,13 @@ public class AuthProductServiceImpl implements AuthProductService {
             // 商品id
             product.setProductId(productId);
             ProductPo productImages = authProductMapper.getImageByProductId(productId);
-            boolean updateImageFlag = (StringUtils.isNotBlank(product.getProductImage()) && !product.getProductImage().equals(productImages.getProductImage())) || (StringUtils.isEmpty(product.getPcImage()) || StringUtils.isEmpty(product.getAppletsImage()));
+            boolean updateImageFlag = (StringUtils.isNotBlank(product.getProductImage()) && !product.getProductImage().equals(productImages.getProductImage())) || (StringUtils.isEmpty(productImages.getPcImage()) || StringUtils.isEmpty(productImages.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(product.getPcCertificateImage()) || StringUtils.isEmpty(product.getPcCertificateImage()));
+            updateImageFlag = (StringUtils.isNotBlank(product.getCertificateImage()) && !product.getCertificateImage().equals(productImages.getCertificateImage())) || (StringUtils.isEmpty(productImages.getPcCertificateImage()) || StringUtils.isEmpty(productImages.getPcCertificateImage()));
             if (updateImageFlag) {
                 //授权牌照添加水印
                 product.setPcCertificateImage(addWaterMark(product.getCertificateImage(), 1));
@@ -274,7 +276,7 @@ public class AuthProductServiceImpl implements AuthProductService {
     }
 
     @Override
-    public ResponseJson auditProduct(Integer productId, Integer auditStatus, String invalidReason) {
+    public ResponseJson auditProduct(Integer productId, Integer auditStatus, String invalidReason, Integer auditBy) {
         if (productId == null) {
             return ResponseJson.error("请输入商品id");
         }
@@ -284,7 +286,14 @@ public class AuthProductServiceImpl implements AuthProductService {
         if (auditStatus == 0 && StringUtils.isEmpty(invalidReason)) {
             return ResponseJson.error("请输入审核不通过的理由");
         }
-        authProductMapper.updateProductAuditStatus(productId, auditStatus, invalidReason);
+        if (auditStatus == 0 && StringUtils.isEmpty(invalidReason)) {
+            return ResponseJson.error("请输入审核不通过的理由");
+        }
+        if (auditBy == null) {
+            return ResponseJson.error("请输入审核人用户id");
+        }
+        Date auditTime = new Date();
+        authProductMapper.updateProductAuditStatus(productId, auditStatus, invalidReason, auditBy, auditTime);
         return ResponseJson.success("审核品牌授权成功");
     }
 }

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

@@ -4,7 +4,6 @@ import com.caimei.mapper.AuthMapper;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.CmBrandAuthPo;
 import com.caimei.model.vo.AuthVo;
-import com.caimei.model.vo.BrandVo;
 import com.caimei.service.AuthProductService;
 import com.caimei.service.AuthService;
 import com.github.pagehelper.PageHelper;
@@ -17,6 +16,7 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.util.Date;
 import java.util.List;
+import java.util.ListIterator;
 
 /**
  * Description
@@ -39,22 +39,29 @@ public class AuthServiceImpl implements AuthService {
     }
 
     @Override
-    public ResponseJson<PageInfo<AuthVo>> getAuthList(Integer authUserId, String authParty, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty, Integer auditStatus, Integer lowerAuditStatus, Integer pageNum, Integer pageSize) {
         if (null == authUserId) {
             return ResponseJson.error("参数异常,请输入供应商用户id", null);
         }
+        listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
-        List<AuthVo> authList = authMapper.getAuthList(authUserId, authParty);
-        authList.forEach(auth->{
-            Integer waitAuditNum = authMapper.getProductWaitAuditNum(auth.getAuthId());
+        List<AuthVo> authList = authMapper.getAuthList(listType, authUserId, authParty, auditStatus);
+        ListIterator<AuthVo> iterator = authList.listIterator();
+        while (iterator.hasNext()) {
+            AuthVo auth = iterator.next();
+            Integer waitAuditNum = auth.getWaitAuditNum();
             if (waitAuditNum > 0) {
                 auth.setLowerAuditStatus(0);
-                auth.setWaitAuditNum(waitAuditNum);
+                if (null != lowerAuditStatus && 1 == lowerAuditStatus) {
+                    iterator.remove();
+                }
             } else {
                 auth.setLowerAuditStatus(1);
-                auth.setWaitAuditNum(0);
+                if (null != lowerAuditStatus && 0 == lowerAuditStatus) {
+                    iterator.remove();
+                }
             }
-        });
+        }
         PageInfo<AuthVo> pageData = new PageInfo<>(authList);
         return ResponseJson.success(pageData);
     }
@@ -109,8 +116,9 @@ public class AuthServiceImpl implements AuthService {
         CmBrandAuthPo auth = new CmBrandAuthPo();
         auth.setAuthUserId(authUserId);
         auth.setAuthParty(authParty);
-        // 保存品牌授权信息,上线状态默认为“待上线”
+        // 保存品牌授权信息,上线状态默认为“待上线”,审核状态为“待审核”
         auth.setStatus(2);
+        auth.setAuditStatus(2);
         if (null == authId) {
             auth.setCreateBy(createBy);
             auth.setCreateTime(new Date());
@@ -129,7 +137,7 @@ public class AuthServiceImpl implements AuthService {
     }
 
     @Override
-    public ResponseJson auditAuth(Integer authId, Integer auditStatus, String invalidReason) {
+    public ResponseJson auditAuth(Integer authId, Integer auditStatus, String invalidReason, Integer auditBy) {
         if (authId == null) {
             return ResponseJson.error("请输入授权id");
         }
@@ -139,7 +147,20 @@ public class AuthServiceImpl implements AuthService {
         if (auditStatus == 0 && StringUtils.isEmpty(invalidReason)) {
             return ResponseJson.error("请输入审核不通过的理由");
         }
-        authMapper.updateAuthAuditStatus(authId, auditStatus, invalidReason);
+        if (auditBy == null) {
+            return ResponseJson.error("请输入审核人用户id");
+        }
+        Date auditTime = new Date();
+        // 授权状态更新
+        Integer status = null;
+        if (auditStatus == 0) {
+            // 审核不通过,下线授权
+            status = 0;
+        } else {
+            // 审核通过,上线授权
+            status = 1;
+        }
+        authMapper.updateAuthAuditStatus(authId, status, auditStatus, invalidReason, auditBy, auditTime);
         return ResponseJson.success("审核品牌授权成功");
     }
 }

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

@@ -37,23 +37,28 @@ public class ShopServiceImpl implements ShopService {
     private UserMapper userMapper;
 
     @Override
-    public ResponseJson<PageInfo<ShopListVo>> getShopList(String shopName, Integer shopType, Integer brandId, String mobile, String linkMan, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<ShopListVo>> getShopList(Integer listType, String shopName, Integer shopType, Integer brandId, String mobile, String linkMan, Integer lowerAuditStatus, Integer pageNum, Integer pageSize) {
+        listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
-        List<ShopListVo> shopList = shopMapper.getShopList(shopName, shopType, brandId, mobile, linkMan);
-        shopList.forEach(shop->{
-            // 授权待审核数量
-            Integer authWaitAuditNum = shopMapper.getAuthWaitAuditNum(shop.getAuthUserId());
-            // 商品待审核数量
-            Integer productWaitAuditNum = shopMapper.getProductWaitAuditNum(shop.getAuthUserId());
-            int waitAuditNum = authWaitAuditNum + productWaitAuditNum;
+        List<ShopListVo> shopList = shopMapper.getShopList(listType, shopName, shopType, brandId, mobile, linkMan);
+        ListIterator<ShopListVo> iterator = shopList.listIterator();
+        while (iterator.hasNext()) {
+            ShopListVo shop = iterator.next();
+            int waitAuditNum = shop.getWaitAuditNum();
             if (waitAuditNum > 0) {
                 shop.setLowerAuditStatus(0);
-                shop.setWaitAuditNum(waitAuditNum);
+                // 查询筛选项处理
+                if (null != lowerAuditStatus && 1 == lowerAuditStatus) {
+                    iterator.remove();
+                }
             }else {
                 shop.setLowerAuditStatus(1);
-                shop.setWaitAuditNum(0);
+                // 查询筛选项处理
+                if (null != lowerAuditStatus && 0 == lowerAuditStatus) {
+                    iterator.remove();
+                }
             }
-        });
+        }
         PageInfo<ShopListVo> pageData = new PageInfo<>(shopList);
         return ResponseJson.success(pageData);
     }

+ 4 - 0
src/main/resources/backup.sql

@@ -86,11 +86,15 @@ UPDATE `cm_brand_auth_product` set brandId = 204 where id between 3 and 62;
 ALTER TABLE `cm_brand_auth`
     ADD COLUMN `auditStatus` INT NULL COMMENT '审核状态:0审核未通过,1审核通过,2待审核' AFTER `status`,
     ADD COLUMN `invalidReason` VARCHAR(255) NULL COMMENT '审核不通过原因' AFTER `auditStatus`,
+    ADD COLUMN `auditBy` INT NULL COMMENT '审核人用户id' AFTER `createBy`,
+    ADD COLUMN `auditTime` DATETIME NULL COMMENT '审核时间' AFTER `auditBy`,
     CHANGE COLUMN `status` `status` INT NULL  DEFAULT NULL COMMENT '上架状态:0已下线,1已上线,2待上线' ;
 
 ALTER TABLE `cm_brand_auth_product`
     ADD COLUMN `auditStatus` INT NULL COMMENT '审核状态:0审核未通过,1审核通过,2待审核' AFTER `status`,
     ADD COLUMN `invalidReason` VARCHAR(255) NULL COMMENT '审核不通过原因' AFTER `auditStatus`,
+    ADD COLUMN `auditBy` INT NULL DEFAULT NULL COMMENT '审核人用户id' AFTER `createBy`,
+    ADD COLUMN `auditTime` DATETIME NULL COMMENT '审核时间' AFTER `auditBy`,
     CHANGE COLUMN `status` `status` INT NULL DEFAULT NULL COMMENT '上架状态:0下线,1上线,2待上线' ;
 
 # ==================================正品联盟6月优化end===============================================

+ 26 - 10
src/main/resources/mapper/AuthMapper.xml

@@ -2,8 +2,8 @@
 <!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" >
-        insert into cm_brand_auth (authUserId, authParty, status, createTime, createBy)
-        values (#{authUserId}, #{authParty}, #{status}, #{createTime}, #{createBy})
+        insert into cm_brand_auth (authUserId, authParty, status, createTime, createBy, auditStatus)
+        values (#{authUserId}, #{authParty}, #{status}, #{createTime}, #{createBy}, #{auditStatus})
     </insert>
     <update id="updateAuthStatusByAuthId">
         update cm_brand_auth
@@ -12,28 +12,44 @@
     </update>
     <update id="updateAuthByAuthId">
         update cm_brand_auth
-        set authParty = #{authParty},
-            status    = #{status}
-        where id = #{id}
+        set authParty   = #{authParty},
+            status      = #{status},
+            auditStatus = #{auditStatus}
+        where id = #{id};
     </update>
     <update id="updateAuthAuditStatus">
         update cm_brand_auth
-        set auditStatus   = #{auditStatus},
-            invalidReason = #{invalidReason}
+        set status        = #{status},
+            auditStatus   = #{auditStatus},
+            invalidReason = #{invalidReason},
+            auditBy       = #{auditBy},
+            auditTime     = #{auditTime}
         where id = #{authId}
     </update>
     <delete id="deleteAuthByAuthId">
         delete from cm_brand_auth where id = #{authId}
     </delete>
     <select id="getAuthList" resultType="com.caimei.model.vo.AuthVo">
-        select id as authId, authParty, a.status, a.auditStatus, a.createTime, u.name as createBy
+        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
         from cm_brand_auth a
-                 left join cm_brand_auth_user u on a.createBy = u.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
         where a.authUserId = #{authUserId}
         <if test="authParty != null and authParty != ''">
             and a.authParty like CONCAT('%',#{authParty},'%')
         </if>
-        order by a.createTime desc
+        <if test="auditStatus != null">
+            and a.auditStatus = #{auditStatus}
+        </if>
+        <if test="listType == 2">
+            order by a.auditStatus desc,waitAuditNum desc, a.createTime desc
+        </if>
+        <if test="listType == 1">
+            order by a.createTime desc
+        </if>
+
     </select>
     <select id="getProductWaitAuditNum" resultType="java.lang.Integer">
         select count(*)

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

@@ -3,10 +3,10 @@
 <mapper namespace="com.caimei.mapper.AuthProductMapper">
     <insert id="insertProduct" keyColumn="id" keyProperty="productId" useGeneratedKeys="true" parameterType="com.caimei.model.po.ProductPo">
         insert into cm_brand_auth_product(`authId`, `brandId`, `name`, `snCode`, `image`,`pcImage`,`appletsImage`, `certificateImage`,
-                                          `pcCertificateImage`,`appletsCertificateImage`, `status`,
+                                          `pcCertificateImage`,`appletsCertificateImage`, `status`, `auditStatus`,
                                           `createTime`, `createBy`)
         values (#{authId}, #{brandId}, #{productName}, #{snCode}, #{productImage}, #{pcImage}, #{appletsImage},
-                #{certificateImage}, #{pcCertificateImage}, #{appletsCertificateImage}, #{status}, #{createTime},
+                #{certificateImage}, #{pcCertificateImage}, #{appletsCertificateImage}, #{status}, #{auditStatus}, #{createTime},
                 #{createBy})
     </insert>
     <insert id="insertProductParam">
@@ -28,6 +28,7 @@
             `image`            = #{productImage},
             `certificateImage` = #{certificateImage},
             `status`           = #{status},
+            `auditStatus`      = #{auditStatus},
             <if test="pcImage != null and pcImage != ''">
                 `pcImage`      = #{pcImage},
             </if>
@@ -54,7 +55,9 @@
     <update id="updateProductAuditStatus">
         update cm_brand_auth_product
         set auditStatus   = #{auditStatus},
-            invalidReason = #{invalidReason}
+            invalidReason = #{invalidReason},
+            auditBy       = #{auditBy},
+            auditTime     = #{auditTime}
         where id = #{productId}
     </update>
     <delete id="deleteProductByProductId">
@@ -64,9 +67,11 @@
         delete from cm_brand_product_param where productId = #{productId}
     </delete>
     <select id="getProductList" resultType="com.caimei.model.vo.ProductListVo">
-        select id as productId,p.name as productName,snCode,p.status,p.auditStatus,p.createTime,u.name as createBy
+        select id as productId,p.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_auth_user u on p.createBy = u.authUserId
+        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}
         <if test="productName != null and productName != ''">
             and p.name like CONCAT('%',#{productName},'%')
@@ -74,7 +79,15 @@
         <if test="snCode != null and snCode != ''">
             and snCode like CONCAT('%',#{snCode},'%')
         </if>
-        order by p.createTime desc
+        <if test="auditStatus != null">
+            and auditStatus = #{auditStatus}
+        </if>
+        <if test="listType == 1">
+            order by p.createTime desc
+        </if>
+        <if test="listType == 2">
+            order by p.auditStatus desc,p.createTime desc
+        </if>
     </select>
     <select id="getProductIdBySnCode" resultType="java.lang.Integer">
         select id from cm_brand_auth_product where snCode = #{snCode} limit 1

+ 14 - 6
src/main/resources/mapper/ShopMapper.xml

@@ -92,11 +92,14 @@
     </delete>
     <select id="getShopList" resultType="com.caimei.model.vo.ShopListVo">
         select u.authUserId,u.name,u.shopType,group_concat(cb.name) as brandName,group_concat(cb.id) as brandId,
-               u.mobile,u.linkMan,u.status as shopStatus,u.createTime,
-            (select au.name from cm_brand_auth_user au where au.authUserId = u.createBy) as createBy
-            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
+        u.mobile,u.linkMan,u.status as shopStatus,u.createTime,
+        (select au.name from cm_brand_auth_user au where au.authUserId = u.createBy) as createBy,
+        ((select count(*)from cm_brand_auth where authUserId = u.authUserId and auditStatus = 2) +
+        (select count(*) from cm_brand_auth_product p left join cm_brand_auth a on p.authId = a.id
+        where a.authUserId = u.authUserId and p.auditStatus = 2)) as waitAuditNum
+        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
         where u.userIdentity = 2
         <if test="shopName != null and shopName !=''">
             AND u.name like CONCAT('%',#{shopName},'%')
@@ -114,7 +117,12 @@
             AND u.linkMan like CONCAT('%',#{linkMan},'%')
         </if>
         group by u.authUserId,u.createTime
-        ORDER BY u.createTime DESC
+        <if test="listType == 2">
+            ORDER BY waitAuditNum desc, u.createTime DESC
+        </if>
+        <if test="listType != 2">
+            ORDER BY u.createTime DESC
+        </if>
     </select>
     <select id="getShopMobileByUserId" resultType="java.lang.String">
         select mobile from cm_brand_auth_user where authUserId = #{authUserId}