rk
昨天 3aef471b170a703b501ddb4d9d2a12791d07ff28
server/web/src/main/java/com/doumee/api/web/ConfigApi.java
@@ -3,20 +3,26 @@
import com.doumee.core.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.business.model.Banner;
import com.doumee.dao.business.model.Category;
import com.doumee.dao.dto.CalculateLocalPriceDTO;
import com.doumee.dao.dto.CalculateRemotePriceDTO;
import com.doumee.dao.vo.AccountResponse;
import com.doumee.service.business.CategoryService;
import com.doumee.dao.vo.PriceCalculateVO;
import com.doumee.dao.vo.UserCenterVO;
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.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.List;
/**
@@ -28,21 +34,97 @@
@Api(tags = "配置类接口")
@Trace(exclude = true)
@RestController
@RequestMapping("/web/orders")
@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(value = "获取分类列表", notes = "小程序端")
    @GetMapping("/getCategoryList")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "类型:0=品种配置;1=车辆类型配置;2=餐标配置;3=手续费配置;", required = true)
            @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<UserCenterVO> 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));
    }
}