diff --git a/src/main/java/com/xkrs/controller/MerchantSettlementController.java b/src/main/java/com/xkrs/controller/MerchantSettlementController.java index e2986c9..a23f90f 100644 --- a/src/main/java/com/xkrs/controller/MerchantSettlementController.java +++ b/src/main/java/com/xkrs/controller/MerchantSettlementController.java @@ -146,4 +146,17 @@ public class MerchantSettlementController { String phone = (String) map.get("phone"); return merchantSettlementService.updateNotPassBusiness(id,phone); } + + /** + * 总部查看要审核的商家的信息 + * @param map + * @return + */ + @PostMapping("/selectDefaultBusiness") + public String selectDefaultBusiness(@RequestBody Map map){ + String businessCity = (String) map.get("businessCity"); + String businessCountry = (String) map.get("businessCountry"); + String businessName = (String) map.get("businessName"); + return merchantSettlementService.selectDefaultBusiness(businessCity,businessCountry,businessName); + } } diff --git a/src/main/java/com/xkrs/service/MerchantSettlementService.java b/src/main/java/com/xkrs/service/MerchantSettlementService.java index 99992f4..6e108d6 100644 --- a/src/main/java/com/xkrs/service/MerchantSettlementService.java +++ b/src/main/java/com/xkrs/service/MerchantSettlementService.java @@ -78,4 +78,13 @@ public interface MerchantSettlementService { * @throws ClientException */ String updateNotPassBusiness(Integer id,String phone) throws ClientException; + + /** + * 总部查看要审核的商家的信息 + * @param businessCity + * @param businessCountry + * @param businessName + * @return + */ + String selectDefaultBusiness(String businessCity, String businessCountry, String businessName); } diff --git a/src/main/java/com/xkrs/service/impl/MerchantSettlementServiceImpl.java b/src/main/java/com/xkrs/service/impl/MerchantSettlementServiceImpl.java index 7ff8005..60495d6 100644 --- a/src/main/java/com/xkrs/service/impl/MerchantSettlementServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/MerchantSettlementServiceImpl.java @@ -226,4 +226,21 @@ public class MerchantSettlementServiceImpl implements MerchantSettlementService businessDao.updateNotPassBusiness(id); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"操作成功!",locale); } + + /** + * 总部查看要审核的商家的信息 + * @param businessCity + * @param businessCountry + * @param businessName + * @return + */ + @Override + public String selectDefaultBusiness(String businessCity, String businessCountry, String businessName) { + Locale locale = LocaleContextHolder.getLocale(); + List businessEntities = query.selectDefaultBusiness(businessCity, businessCountry, businessName); + if(businessEntities == null || businessEntities.size() == 0){ + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有要审核的商家的信息!",locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,businessEntities,locale); + } } diff --git a/src/main/java/com/xkrs/utils/Query.java b/src/main/java/com/xkrs/utils/Query.java index 891c140..403b1c3 100644 --- a/src/main/java/com/xkrs/utils/Query.java +++ b/src/main/java/com/xkrs/utils/Query.java @@ -117,5 +117,34 @@ public class Query { return businessDao.findAll(specification); } + /** + * 总部查看要审核的商家的信息 + * @param businessCity + * @param businessCountry + * @param businessName + * @return + */ + public List selectDefaultBusiness(String businessCity, String businessCountry, String businessName) { + Specification specification = new Specification() { + @Override + public Predicate toPredicate(Root root, CriteriaQuery criteriaQuery, CriteriaBuilder criteriaBuilder) { + List list = new ArrayList<>(); + if(businessCity != null && !"".equals(businessCity)){ + list.add(criteriaBuilder.equal(root.get("businessCity").as(Integer.class), businessCity)); + } + if(businessCountry != null && !"".equals(businessCountry)){ + list.add(criteriaBuilder.equal(root.get("businessCountry").as(String.class), businessCountry)); + } + if(businessName != null && !"".equals(businessName)){ + list.add(criteriaBuilder.like(root.get("businessName").as(String.class), "%" + businessName + "%")); + } + list.add(criteriaBuilder.equal(root.get("businessType").as(String.class), "0")); + Predicate[] predicates = new Predicate[list.size()]; + return criteriaBuilder.and(list.toArray(predicates)); + } + }; + return businessDao.findAll(specification); + } + } \ No newline at end of file