rk
4 天以前 74b0af6814b96378201ea27d205e054bf01d0306
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
package com.doumee.api.web;
 
import com.doumee.core.annotation.LoginRequired;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.constants.Constants;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
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.business.model.Notice;
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.ActiveOrderTipVO;
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;
 
    @Autowired
    private NoticeService noticeService;
 
    @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));
    }
 
    @LoginRequired
    @ApiOperation(value = "会员通知消息分页", notes = "未读优先,时间倒序")
    @PostMapping("/memberNoticePage")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse<PageData<Notice>> memberNoticePage(@RequestBody PageWrap<Notice> pageWrap) {
        if (pageWrap.getModel() == null) {
            pageWrap.setModel(new Notice());
        }
        pageWrap.getModel().setUserId(this.getMemberId());
        pageWrap.getModel().setUserType(Constants.ZERO);
        return ApiResponse.success("查询成功", noticeService.findPage(pageWrap));
    }
 
 
    @LoginRequired
    @ApiOperation(value = "首页进行中订单提示", notes = "返回最新一条进行中订单的状态和提示文案,无订单返回null")
    @GetMapping("/getActiveOrderTip")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse<ActiveOrderTipVO> getActiveOrderTip() {
        return ApiResponse.success("查询成功", ordersService.getActiveOrderTip(this.getMemberId()));
    }
 
 
    @LoginRequired
    @ApiOperation(value = "会员标记全部已读", notes = "标记当前用户所有未读通知为已读")
    @PostMapping("/memberReadAllNotice")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse readAllNotice() {
        noticeService.readAllNotice(0, this.getMemberId());
        return ApiResponse.success("操作成功");
    }
 
 
}