Commit e030d109 by huangZW

111

parent 5c294239
...@@ -8,6 +8,7 @@ import java.util.Date; ...@@ -8,6 +8,7 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -180,39 +181,38 @@ public class StoreController extends WebBaseController{ ...@@ -180,39 +181,38 @@ public class StoreController extends WebBaseController{
//获取首页销售数据 //获取首页销售数据
@IgnoreLogin @IgnoreLogin
@RequestMapping("/get-area-list") @RequestMapping("/get-area-list")
public HaobanResponse getArea(String id) { public HaobanResponse getArea(Integer type,String id) {
Map<String,Object> map = new HashMap<>(); if (type == null) {
Map<String, ProvinceDTO> provinceMap = GlobalDictMap.provinceMap; return resultResponse(HaoBanErrCode.ERR_2);
Map<String,CityDTO> cityMap = GlobalDictMap.cityMap; }
Map<String,CountyDTO> countyMap = GlobalDictMap.countyMap; switch (type) {
List<ProvinceDTO> provinceList=new ArrayList<ProvinceDTO>(); // 省
List<CityDTO> cityList=new ArrayList<CityDTO>(); case 1:
List<CountyDTO>countyList=new ArrayList<CountyDTO>(); return resultResponse(HaoBanErrCode.ERR_1, GlobalDictMap.provinceMap);
for (String key : provinceMap.keySet()) { // 市
provinceList.add(provinceMap.get(key)); case 2:
} Map<String, CityDTO> tabCityMap = GlobalDictMap.cityMap;
for (String key : cityMap.keySet()) { Map<String, CityDTO> cityMap = new HashMap<String, CityDTO>();
cityList.add(cityMap.get(key)); Set<Map.Entry<String, CityDTO>> citySet = tabCityMap.entrySet();
} for (Map.Entry<String, CityDTO> entry : citySet) {
for (String key : countyMap.keySet()) { if (entry.getValue().getProvinceId().equals(id)) {
countyList.add(countyMap.get(key)); cityMap.put(entry.getKey(), entry.getValue());
} }
if(StringUtils.isEmpty(id)){ }
//省 return resultResponse(HaoBanErrCode.ERR_1, cityMap);
return resultResponse(HaoBanErrCode.ERR_1,provinceList); case 3:
}else{ Map<String, CountyDTO> tabCountyMap = GlobalDictMap.countyMap;
if(cityMap.containsKey(id)){ Map<String, CountyDTO> countyMap = new HashMap<String, CountyDTO>();
//市 Set<Map.Entry<String, CountyDTO>> tabSet = tabCountyMap.entrySet();
return resultResponse(HaoBanErrCode.ERR_1,cityList); for (Map.Entry<String, CountyDTO> entry : tabSet) {
}else if(countyMap.containsKey(id)){ if (entry.getValue().getCityId().equals(id)) {
//区 countyMap.put(entry.getKey(), entry.getValue());
return resultResponse(HaoBanErrCode.ERR_1,countyList); }
} }
} return resultResponse(HaoBanErrCode.ERR_1, countyMap);
map.put("province", provinceList); }
map.put("city", cityList);
map.put("country", countyList); return resultResponse(HaoBanErrCode.ERR_8);
return resultResponse(HaoBanErrCode.ERR_8,map);
} }
//获取首页销售数据 //获取首页销售数据
@RequestMapping("/change-store-detail") @RequestMapping("/change-store-detail")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment