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);