添加了各级查看自己要审核的商品的信息

This commit is contained in:
XinYi Song 2021-12-16 16:09:39 +08:00
parent 9b472191ec
commit c1523b22ec
4 changed files with 54 additions and 3 deletions

View File

@ -69,4 +69,26 @@ public class ProductController {
} }
return productService.selectProductShelfType(sysUserEntity.getId(),productCounty,shelfType); 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);
}
} }

View File

@ -2,8 +2,6 @@ package com.xkrs.service;
import com.xkrs.model.qo.ProductQo; import com.xkrs.model.qo.ProductQo;
import java.util.List;
/** /**
* @Author: XinYi Song * @Author: XinYi Song
* @Date: 2021/12/15 15:38 * @Date: 2021/12/15 15:38
@ -26,4 +24,14 @@ public interface ProductService {
* @return * @return
*/ */
String selectProductShelfType(Integer businessId, String productCounty, String shelfType); 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);
} }

View File

@ -117,4 +117,22 @@ public class ProductServiceImpl implements ProductService {
} }
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,productEntities,locale); 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<ProductEntity> 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);
}
} }

View File

@ -31,7 +31,7 @@ public class Query {
* @param reviewType * @param reviewType
* @return * @return
*/ */
public List<ProductEntity> selectProductCounty(Integer businessId, String productCounty, String reviewType) { public List<ProductEntity> selectProductCounty(Integer businessId, String productCity, String productCounty, String reviewType) {
Specification<ProductEntity> specification = new Specification<ProductEntity>() { Specification<ProductEntity> specification = new Specification<ProductEntity>() {
@Override @Override
public Predicate toPredicate(Root<ProductEntity> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) { public Predicate toPredicate(Root<ProductEntity> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
@ -39,6 +39,9 @@ public class Query {
if(businessId != null){ if(businessId != null){
list.add(criteriaBuilder.equal(root.get("businessId").as(Integer.class), businessId)); 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)){ if(productCounty != null && !"".equals(productCounty)){
list.add(criteriaBuilder.equal(root.get("productCounty").as(String.class), productCounty)); list.add(criteriaBuilder.equal(root.get("productCounty").as(String.class), productCounty));
} }