rk
5 天以前 74b0af6814b96378201ea27d205e054bf01d0306
server/web/src/main/java/com/doumee/api/web/ConfigApi.java
@@ -2,14 +2,21 @@
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.vo.AccountResponse;
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;
@@ -17,7 +24,7 @@
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.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -52,6 +59,18 @@
    @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")
@@ -118,10 +137,58 @@
        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("操作成功");
    }
}