doum
2025-12-12 dce1e83ec27a066ebc6c17a4ac6d03c9ad6ff703
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
95
96
97
98
99
100
101
102
103
package com.doumee.api.web;
 
import com.doumee.config.annotation.LoginRequired;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.model.ApiResponse;
import com.doumee.dao.business.model.Areas;
import com.doumee.dao.web.dto.AreasDto;
import com.doumee.dao.web.dto.shop.Position;
import com.doumee.dao.web.response.HotCityResponse;
import com.doumee.dao.web.response.LabelsResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2023/3/23 10:54
 */
@Api(tags = "工具库")
@Trace(exclude = true)
@RestController
@RequestMapping("/web/util")
@Slf4j
public class UtilApi extends ApiController {
 
 
 
    @LoginRequired
    @ApiOperation(value = "获取常用城市", notes = "小程序端")
    @GetMapping("/getHotCityResponseList")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    @Transactional(rollbackFor = Exception.class)
    public ApiResponse<List<HotCityResponse>> getHotCityResponseList() {
        return  ApiResponse.success("查询成功",hotCityService.getHotCityResponseList());
    }
 
 
    @LoginRequired
    @ApiOperation(value = "获取城市信息", notes = "小程序端")
    @PostMapping("/getCityInfoList")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true),
    })
    public ApiResponse<List<Areas>> getCityInfoList(@RequestBody Areas areas) {
        return  ApiResponse.success("查询成功",areasService.getCityList(areas));
    }
 
    @ApiOperation("全部树形查询")
    @PostMapping("/treeList")
//    @RequiresPermissions("business:areas:query")
    public ApiResponse<List<Areas>> treeList (@RequestBody AreasDto pageWrap) {
        Areas a = new Areas();
        BeanUtils.copyProperties(pageWrap,a);
        return ApiResponse.success(areasService.findList(a));
    }
 
 
    @LoginRequired
    @ApiOperation(value = "获取标签信息", notes = "小程序端")
    @GetMapping("/getLabelsResponseList")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "类型0商品分类 1商品品牌 2商家标签 3快递 4退货选项 5换货选项 6退款选项 7取消订单选项 8咖啡百科分类 9咨 询分类 10活动赛事分类 11达人探店分类", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "module", value = "所属模块 0平台商城 1咖豆商城", required = false),
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "parentId", value = "父级编码(自关联)", required = false),
    })
    public ApiResponse<List<LabelsResponse>> getLabelsResponseList(@RequestParam Integer type , Integer module , Integer parentId ) {
        return  ApiResponse.success("查询成功",labelsService.getLabelsResponse(type,module,parentId));
    }
 
 
    /**
     * 根据经纬度获取地址 同时跟新用户所在城市
     * @param position
     * @return
     */
    @LoginRequired
    @ApiOperation(value = "根据经纬度获取地址", notes = "小程序端")
    @PostMapping("/getAreasByPosition")
    public ApiResponse<Areas> getAreasByPosition(@RequestBody  Position position){
        return  ApiResponse.success(areasService.getAreasByPosition(position));
    }
 
 
    @ApiOperation("根据父节点和类型查询")
    @PostMapping("/listByParentId")
//    @RequiresPermissions("business:areas:query")
    public ApiResponse<List<Areas>> listByParentId (@RequestBody AreasDto pageWrap) {
        return ApiResponse.success(areasService.findByParentId(pageWrap.getParentId(),pageWrap.getType(),pageWrap.getFlag()) );
    }
 
}