rk
15 小时以前 ab9cd2c82bd64de8e33510db1d1e78a5b3b4de70
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
package com.doumee.api.web;
 
import com.doumee.core.annotation.LoginRequired;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.utils.geocode.MapUtil;
import com.doumee.dao.business.model.Areas;
import com.doumee.dao.business.model.Banner;
import com.doumee.dao.business.model.Category;
import com.doumee.dao.dto.AreasDto;
import com.doumee.dao.dto.CalculateLocalPriceDTO;
import com.doumee.dao.dto.CalculateRemotePriceDTO;
import com.doumee.dao.dto.SameCityCheckDTO;
import com.doumee.dao.vo.PriceCalculateVO;
import com.doumee.dao.vo.PlatformAboutVO;
import com.doumee.service.business.*;
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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.List;
 
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2025/7/15 15:49
 */
@Api(tags = "配置类接口")
@Trace(exclude = true)
@RestController
@RequestMapping("/web/config")
@Slf4j
public class ConfigApi extends ApiController{
 
    @Autowired
    private CategoryService categoryService;
 
    @Autowired
    private AreasService areasService;
 
    @Autowired
    private BannerService bannerService;
 
    @Autowired
    private OrdersService ordersService;
 
    @Autowired
    private MemberService memberService;
 
    @ApiOperation("全部区划树形查询")
    @PostMapping("/treeList")
    public ApiResponse<List<Areas>> treeList (@RequestBody AreasDto pageWrap) {
        Areas a = new Areas();
        BeanUtils.copyProperties(pageWrap,a);
        areasService.cacheData();
        return ApiResponse.success(areasService.findList(a));
    }
 
    @ApiOperation(value = "获取分类列表", notes = "小程序端")
    @GetMapping("/getCategoryList")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "类型:1=车辆类型;2=物品分类;3=物品等级;4=物品尺寸;", required = true)
    })
    public ApiResponse<List<Category>> getCategoryList(@RequestParam Integer type) {
        return  ApiResponse.success("操作成功",categoryService.getCategoryList(type));
    }
 
    @ApiOperation(value = "获取开放城市列表", notes = "返回已开放城市,含首字母,按首字母排序")
    @GetMapping("/getOpenCityList")
    public ApiResponse<List<Areas>> getOpenCityList() {
        return ApiResponse.success("操作成功", areasService.getOpenCityList());
    }
 
    @ApiOperation(value = "获取轮播图列表", notes = "根据位置返回轮播图,含图片全路径")
    @GetMapping("/getBannerList")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "position", value = "位置:0=会员端首页轮播;1=司机APP引导页;", required = true)
    })
    public ApiResponse<List<Banner>> getBannerList(@RequestParam Integer position) {
        return ApiResponse.success("操作成功", bannerService.findListByPosition(position));
    }
 
    @ApiOperation(value = "获取城市已开通物品尺寸", notes = "根据城市主键查询已开通的物品尺寸(category type=4)")
    @GetMapping("/getCitySizeList")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "cityId", value = "城市主键", required = true)
    })
    public ApiResponse<List<Category>> getCitySizeList(@RequestParam Integer cityId) {
        return ApiResponse.success("操作成功", categoryService.getCitySizeList(cityId));
    }
 
 
    @ApiOperation(value = "获取系统配置", notes = "小程序端")
    @GetMapping("/getPlatformAboutUs")
    public ApiResponse<PlatformAboutVO> getPlatformAboutUs() {
        return  ApiResponse.success("查询成功",memberService.getPlatformAboutUs());
    }
 
    @LoginRequired
    @ApiOperation(value = "计算保价费用", notes = "根据报价金额计算保价费用")
    @GetMapping("/calculateInsuranceFee")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "BigDecimal", name = "declaredValue", value = "报价金额", required = true),
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse<BigDecimal> calculateInsuranceFee(@RequestParam BigDecimal declaredValue) {
        return ApiResponse.success("操作成功", ordersService.calculateInsuranceFee(declaredValue));
    }
 
    @LoginRequired
    @ApiOperation(value = "计算就地存取预估费用", notes = "根据城市、天数、物品类型和数量计算就地存取预估费用")
    @PostMapping("/calculateLocalPrice")
    public ApiResponse<PriceCalculateVO> calculateLocalPrice(@RequestBody @Valid CalculateLocalPriceDTO dto) {
        return ApiResponse.success("操作成功", ordersService.calculateLocalPrice(dto));
    }
 
    @LoginRequired
    @ApiOperation(value = "计算异地存取预估费用", notes = "根据距离、物品类型和数量计算异地存取预估费用")
    @PostMapping("/calculateRemotePrice")
    public ApiResponse<PriceCalculateVO> calculateRemotePrice(@RequestBody @Valid CalculateRemotePriceDTO dto) {
        return ApiResponse.success("操作成功", ordersService.calculateRemotePrice(dto));
    }
 
    @ApiOperation(value = "校验两个经纬度是否同城", notes = "传入两组经纬度,返回是否在同一城市")
    @PostMapping("/isSameCity")
    public ApiResponse<Boolean> isSameCity(@RequestBody SameCityCheckDTO dto) {
        return ApiResponse.success("操作成功", MapUtil.isSameCity(dto.getLat1(), dto.getLng1(), dto.getLat2(), dto.getLng2()));
    }
 
    @ApiOperation(value = "根据城市名称查询城市信息", notes = "仅返回已开通的城市,未开通返回空")
    @GetMapping("/getCityByName")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "cityName", value = "城市名称", required = true)
    })
    public ApiResponse<Areas> getCityByName(@RequestParam String cityName) {
        return ApiResponse.success("查询成功", areasService.getOpenedCityByName(cityName));
    }
 
 
}