| package com.xzx.gc.user.controller; | 
|   | 
| import cn.hutool.core.bean.BeanUtil; | 
| import com.xzx.gc.common.Result; | 
| import com.xzx.gc.common.utils.BusinessUtil; | 
| import com.xzx.gc.entity.AddressLevelInfo; | 
| import com.xzx.gc.entity.LongiLati; | 
| import com.xzx.gc.model.JsonResult; | 
| import com.xzx.gc.model.admin.AreaModel; | 
| import com.xzx.gc.user.dto.AddressLevelDto; | 
| import com.xzx.gc.user.mapper.LongiLatiMapper; | 
| import com.xzx.gc.user.service.AddressLevelService; | 
| import io.swagger.annotations.Api; | 
| import io.swagger.annotations.ApiImplicitParam; | 
| import io.swagger.annotations.ApiImplicitParams; | 
| import io.swagger.annotations.ApiOperation; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.web.bind.annotation.*; | 
|   | 
| import java.util.List; | 
| import java.util.Map; | 
|   | 
| /** | 
|  * @author:andylei | 
|  * @title | 
|  * @Description | 
|  * @date 2018/11/22/022 | 
|  * @修改历史 | 
|  */ | 
| @Api(tags = "地址层级管理") | 
| @RestController | 
| public class AddressLevelController { | 
|   | 
|   | 
|     @Autowired | 
|     private AddressLevelService addressLevelService; | 
|   | 
|     @Autowired | 
|     private LongiLatiMapper longiLatiMapper; | 
|     /** | 
|      * 地址层级查询 | 
|      */ | 
|     @ApiOperation( value = "查询地址层级") | 
|     @PostMapping(value = {"/addressLevel/query","/admin/front/addressLevel/query"}) | 
|     public Result<List<AddressLevelInfo>> addressQuery(@RequestBody AddressLevelDto addressLevelDto) { | 
|         Result result = new Result(); | 
|         AddressLevelInfo addressLevelInfo=new AddressLevelInfo(); | 
|         BeanUtil.copyProperties(addressLevelDto,addressLevelInfo); | 
|   | 
|         List<AddressLevelInfo> addressLevelInfos = addressLevelService.findByAny(addressLevelInfo); | 
|         result.setData(addressLevelInfos); | 
|         return result; | 
|     } | 
|   | 
|   | 
|     /** | 
|      * 查询字典里面的角色 | 
|      * @return | 
|      */ | 
|     @PostMapping( "/admin/front/addressLevel/queryAllAreaApi.json") | 
|     @ApiOperation(value="用户管理-查询区域", notes="test: 仅0有正确返回") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(paramType="query", name = "level", value = "第三级(1:省会,2:城市,3 :区域)", required = true, dataType = "String") | 
|     }) | 
|     public JsonResult<List<Map<String, Object>>> queryAllAreaApi(@RequestBody AreaModel model){ | 
|         List<Map<String, Object>> list = addressLevelService.queryAllProvince(model.getLevel()); | 
|         return JsonResult.success(list); | 
|     } | 
|   | 
|   | 
|     /** | 
|      * 查询仓库列表 | 
|      * @param | 
|      * @return | 
|      */ | 
|     @PostMapping( "/admin/front/addressLevel/queryApiArea.json") | 
|     @ApiOperation(value="数据统计-仓库数据(地区接口)", notes="test: 仅0有正确返回") | 
|     public JsonResult<List<Map<String, Object>>> queryApiArea(){ | 
|         //返回长沙市的区域(后期根据需求修改) | 
|         List<Map<String,Object>> resultMap = addressLevelService.queryApiArea(); | 
|         return JsonResult.success(resultMap); | 
|     } | 
|   | 
|     @PostMapping( "/admin/front/addressLevel/queryAreaLongiLati.json") | 
|     @ApiOperation(value="根据地区名称查询经纬度", notes="test: 仅0有正确返回") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(paramType="query", name ="name", value = "地区名称", required = true, dataType = "String") | 
|     }) | 
|     public JsonResult<AreaModel> queryAreaLongiLati(@RequestBody AreaModel model){ | 
|         AreaModel map = longiLatiMapper.queryAreaLongiLati(model); | 
|         return JsonResult.success(map); | 
|     } | 
|   | 
| } |