From d555c2ec3b6cc57fabab55aec5e2b8a657285542 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Sat, 17 Apr 2021 13:57:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HighMerchantStoreController.java | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighMerchantStoreController.java b/hai-cweb/src/main/java/com/cweb/controller/HighMerchantStoreController.java index 4f68cb16..31d81f60 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighMerchantStoreController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighMerchantStoreController.java @@ -8,10 +8,7 @@ import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.MemberValidateUtil; import com.hai.common.utils.ResponseMsgUtil; -import com.hai.entity.BsCompany; -import com.hai.entity.HighCoupon; -import com.hai.entity.HighMerchant; -import com.hai.entity.HighMerchantStore; +import com.hai.entity.*; import com.hai.model.*; import com.hai.service.*; import io.swagger.annotations.Api; @@ -24,6 +21,8 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Array; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -55,6 +54,9 @@ public class HighMerchantStoreController { @Resource private BsCompanyService bsCompanyService; + @Resource + private CommonService commonService; + @RequestMapping(value="/getMerchantStoreById",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据id查询商户门店") @@ -133,17 +135,17 @@ public class HighMerchantStoreController { @RequestMapping(value="/getMerchantList",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询商户列表") - public ResponseData getMerchantList( - @RequestParam(name = "regionId", required = true) String regionId) { + public ResponseData getMerchantList(@RequestParam(name = "regionId", required = true) String regionId) { try { - - BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(regionId); - - Map map = new HashMap<>(); - map.put("companyId", bsCompany.getId()); - map.put("status", 1); - - return ResponseMsgUtil.success(highMerchantService.getMerchantList(map)); + SecRegion region = commonService.getRegionsById(Long.parseLong(regionId)); + if (region != null && region.getParentId() != null) { + BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getParentId().toString()); + Map map = new HashMap<>(); + map.put("companyId", bsCompany.getId()); + map.put("status", 1); + return ResponseMsgUtil.success(highMerchantService.getMerchantList(map)); + } + return ResponseMsgUtil.success(new ArrayList<>()); } catch (Exception e) { log.error("HighMerchantController -> getMerchantList() error!",e);