From c1523b22ec2af2229cb3d0ff5815359bafc69099 Mon Sep 17 00:00:00 2001 From: XinYi Song <2037158277@qq.com> Date: Thu, 16 Dec 2021 16:09:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E5=90=84=E7=BA=A7?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E8=87=AA=E5=B7=B1=E8=A6=81=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E7=9A=84=E5=95=86=E5=93=81=E7=9A=84=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/controller/ProductController.java | 22 +++++++++++++++++++ .../java/com/xkrs/service/ProductService.java | 12 ++++++++-- .../xkrs/service/impl/ProductServiceImpl.java | 18 +++++++++++++++ src/main/java/com/xkrs/utils/Query.java | 5 ++++- 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/xkrs/controller/ProductController.java b/src/main/java/com/xkrs/controller/ProductController.java index 1beb4ac..60ae201 100644 --- a/src/main/java/com/xkrs/controller/ProductController.java +++ b/src/main/java/com/xkrs/controller/ProductController.java @@ -69,4 +69,26 @@ public class ProductController { } return productService.selectProductShelfType(sysUserEntity.getId(),productCounty,shelfType); } + + /** + * 各级查看自己要审核的商品 + * 区县代理商查看联盟商家 0 市级代理商查看区县1 总部查看市级2 总部通过是3 不通过4 + * @param map + * @param token + * @return + */ + @PostMapping("/selectProductReviewType") + public String selectProductReviewType(@RequestBody Map map, @RequestHeader(value="Authorization") String token){ + Locale locale = LocaleContextHolder.getLocale(); + String productCity = (String) map.get("productCity"); + String productCounty = (String) map.get("productCounty"); + String reviewType = (String) map.get("reviewType"); + // 验证token + String tokenUserName = TokenUtil.getTokenUserName(token); + SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName); + if(sysUserEntity == null){ + return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale); + } + return productService.selectProductReviewType(sysUserEntity.getId(),productCity,productCounty,reviewType); + } } diff --git a/src/main/java/com/xkrs/service/ProductService.java b/src/main/java/com/xkrs/service/ProductService.java index 7c5c61d..cc5665a 100644 --- a/src/main/java/com/xkrs/service/ProductService.java +++ b/src/main/java/com/xkrs/service/ProductService.java @@ -2,8 +2,6 @@ package com.xkrs.service; import com.xkrs.model.qo.ProductQo; -import java.util.List; - /** * @Author: XinYi Song * @Date: 2021/12/15 15:38 @@ -26,4 +24,14 @@ public interface ProductService { * @return */ String selectProductShelfType(Integer businessId, String productCounty, String shelfType); + + /** + * 各级查看自己要审核的商品 + * @param businessId + * @param productCity + * @param productCounty + * @param reviewType + * @return + */ + String selectProductReviewType(Integer businessId, String productCity, String productCounty, String reviewType); } diff --git a/src/main/java/com/xkrs/service/impl/ProductServiceImpl.java b/src/main/java/com/xkrs/service/impl/ProductServiceImpl.java index 0a230e7..3983841 100644 --- a/src/main/java/com/xkrs/service/impl/ProductServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/ProductServiceImpl.java @@ -117,4 +117,22 @@ public class ProductServiceImpl implements ProductService { } return outputEncapsulationObject(PromptMessageEnum.SUCCESS,productEntities,locale); } + + /** + * 各级查看自己要审核的商品 + * @param businessId + * @param productCity + * @param productCounty + * @param reviewType + * @return + */ + @Override + public String selectProductReviewType(Integer businessId, String productCity, String productCounty, String reviewType) { + Locale locale = LocaleContextHolder.getLocale(); + List productEntities = query.selectProductCounty(businessId, productCity, productCounty, reviewType); + if(productEntities == null || productEntities.size() == 0){ + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有任何要审核的商品信息!",locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,productEntities,locale); + } } diff --git a/src/main/java/com/xkrs/utils/Query.java b/src/main/java/com/xkrs/utils/Query.java index d6fb54b..fa7b9f0 100644 --- a/src/main/java/com/xkrs/utils/Query.java +++ b/src/main/java/com/xkrs/utils/Query.java @@ -31,7 +31,7 @@ public class Query { * @param reviewType * @return */ - public List selectProductCounty(Integer businessId, String productCounty, String reviewType) { + public List selectProductCounty(Integer businessId, String productCity, String productCounty, String reviewType) { Specification specification = new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery criteriaQuery, CriteriaBuilder criteriaBuilder) { @@ -39,6 +39,9 @@ public class Query { if(businessId != null){ list.add(criteriaBuilder.equal(root.get("businessId").as(Integer.class), businessId)); } + if(productCity != null && !"".equals(productCity)){ + list.add(criteriaBuilder.equal(root.get("productCity").as(String.class), productCity)); + } if(productCounty != null && !"".equals(productCounty)){ list.add(criteriaBuilder.equal(root.get("productCounty").as(String.class), productCounty)); }