Helius
2021-06-28 b1b61f9bbd329b593ee019e3de98e4df14466af3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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);
    }
 
}