From e7cd3b4159e4d40729b7528cb0d8ab4dc6a5c586 Mon Sep 17 00:00:00 2001 From: XinYi Song <2037158277@qq.com> Date: Tue, 21 Dec 2021 09:36:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=80=BB=E9=83=A8?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E8=A6=81=E5=AE=A1=E6=A0=B8=E7=9A=84=E5=95=86?= =?UTF-8?q?=E5=AE=B6=E7=9A=84=E4=BF=A1=E6=81=AF=E7=9A=84=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MerchantSettlementController.java | 13 +++++++++ .../service/MerchantSettlementService.java | 9 ++++++ .../impl/MerchantSettlementServiceImpl.java | 17 +++++++++++ src/main/java/com/xkrs/utils/Query.java | 29 +++++++++++++++++++ 4 files changed, 68 insertions(+) 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