rk
18 小时以前 095210f9149c73e6e00d997b39fd6c44a65e4d38
server/web/src/main/java/com/doumee/api/web/ConfigApi.java
@@ -1,16 +1,28 @@
package com.doumee.api.web;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.annotation.LoginDriverRequired;
import com.doumee.core.annotation.LoginRequired;
import com.doumee.core.annotation.LoginShopRequired;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.constants.Constants;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.utils.Tencent.MapUtil;
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.AppVersion;
import com.doumee.dao.business.model.Notice;
import com.alibaba.fastjson.JSONObject;
import com.doumee.dao.dto.AreasDto;
import com.doumee.dao.dto.CalculateLocalPriceDTO;
import com.doumee.dao.dto.CalculateRemotePriceDTO;
import com.doumee.dao.dto.DirectionInfoDTO;
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;
@@ -18,6 +30,7 @@
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.*;
@@ -53,6 +66,24 @@
    @Autowired
    private MemberService memberService;
    @Autowired
    private NoticeService noticeService;
    @Autowired
    private AppVersionService appVersionService;
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @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({
@@ -75,6 +106,15 @@
    })
    public ApiResponse<List<Banner>> getBannerList(@RequestParam Integer position) {
        return ApiResponse.success("操作成功", bannerService.findListByPosition(position));
    }
    @ApiOperation(value = "获取轮播图详情", notes = "根据ID返回轮播图详情,含图片全路径")
    @GetMapping("/getBannerDetail")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "轮播图主键", required = true)
    })
    public ApiResponse<Banner> getBannerDetail(@RequestParam Integer id) {
        return ApiResponse.success("查询成功", bannerService.findById(id));
    }
    @ApiOperation(value = "获取城市已开通物品尺寸", notes = "根据城市主键查询已开通的物品尺寸(category type=4)")
@@ -133,5 +173,122 @@
        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);
        PageData<Notice> pageData = noticeService.findPage(pageWrap);
        noticeService.readAllNotice(0, this.getMemberId());
        return ApiResponse.success("查询成功", pageData);
    }
    @LoginShopRequired
    @ApiOperation(value = "门店通知消息分页", notes = "未读优先,时间倒序")
    @PostMapping("/shopNoticePage")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse<PageData<Notice>> shopNoticePage(@RequestBody PageWrap<Notice> pageWrap) {
        if (pageWrap.getModel() == null) {
            pageWrap.setModel(new Notice());
        }
        pageWrap.getModel().setUserId(this.getShopId());
        pageWrap.getModel().setUserType(Constants.TWO);
        PageData<Notice> pageData = noticeService.findPage(pageWrap);
        noticeService.readAllNotice(Constants.TWO, this.getShopId());
        return ApiResponse.success("查询成功", pageData);
    }
    @LoginShopRequired
    @ApiOperation(value = "门店标记全部已读", notes = "标记当前用户所有未读通知为已读")
    @PostMapping("/shopReadAllNotice")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse shopReadAllNotice() {
        noticeService.readAllNotice(Constants.TWO, this.getShopId());
        return ApiResponse.success("操作成功");
    }
    @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("操作成功");
    }
    @LoginDriverRequired
    @ApiOperation(value = "司机通知消息分页", notes = "未读优先,时间倒序")
    @PostMapping("/driverNoticePage")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse<PageData<Notice>> driverNoticePage(@RequestBody PageWrap<Notice> pageWrap) {
        if (pageWrap.getModel() == null) {
            pageWrap.setModel(new Notice());
        }
        pageWrap.getModel().setUserId(this.getDriverId());
        pageWrap.getModel().setUserType(Constants.ONE);
        PageData<Notice> pageData = noticeService.findPage(pageWrap);
        noticeService.readAllNotice(Constants.ONE, this.getDriverId());
        return ApiResponse.success("查询成功", pageData);
    }
    @LoginDriverRequired
    @ApiOperation(value = "路径规划", notes = "调用高德地图路径规划接口,返回路线信息")
    @PostMapping("/directionInfo")
    public ApiResponse<JSONObject> directionInfo(@RequestBody @Valid DirectionInfoDTO dto) {
        return ApiResponse.success("操作成功", MapUtil.directionInfo(dto.getMode(), dto.getFrom(), dto.getTo()));
    }
    @LoginDriverRequired
    @ApiOperation(value = "司机标记全部已读", notes = "标记当前用户所有未读通知为已读")
    @PostMapping("/driverReadAllNotice")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse driverReadAllNotice() {
        noticeService.readAllNotice(Constants.ONE, this.getDriverId());
        return ApiResponse.success("操作成功");
    }
    @ApiOperation(value = "获取最新APP版本")
    @GetMapping("/getApiVersion")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "平台类型 0=Android 1=IOS", required = true)
    })
    public ApiResponse<AppVersion> getApiVersion(@RequestParam Integer type) {
        AppVersion appVersion = appVersionService.getLatestVersion(type);
        appVersion.setFileUrl("http://llfc.lmpro.cn/apkversion/gtxljc.apk");
        return ApiResponse.success("查询成功", appVersion);
    }
}