package com.doumee.api.web; import com.doumee.config.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.web.dto.AreasDto; import com.doumee.dao.web.dto.shop.Position; import com.doumee.dao.web.response.HotCityResponse; import com.doumee.dao.web.response.LabelsResponse; 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.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import java.util.List; /** * Created by IntelliJ IDEA. * * @Author : Rk * @create 2023/3/23 10:54 */ @Api(tags = "工具库") @Trace(exclude = true) @RestController @RequestMapping("/web/util") @Slf4j public class UtilApi extends ApiController { @LoginRequired @ApiOperation(value = "获取常用城市", notes = "小程序端") @GetMapping("/getHotCityResponseList") @ApiImplicitParams({ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) }) @Transactional(rollbackFor = Exception.class) public ApiResponse> getHotCityResponseList() { return ApiResponse.success("查询成功",hotCityService.getHotCityResponseList()); } @LoginRequired @ApiOperation(value = "获取城市信息", notes = "小程序端") @PostMapping("/getCityInfoList") @ApiImplicitParams({ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), }) public ApiResponse> getCityInfoList(@RequestBody Areas areas) { return ApiResponse.success("查询成功",areasService.getCityList(areas)); } @ApiOperation("全部树形查询") @PostMapping("/treeList") // @RequiresPermissions("business:areas:query") public ApiResponse> treeList (@RequestBody AreasDto pageWrap) { Areas a = new Areas(); BeanUtils.copyProperties(pageWrap,a); return ApiResponse.success(areasService.findList(a)); } @LoginRequired @ApiOperation(value = "获取标签信息", notes = "小程序端") @GetMapping("/getLabelsResponseList") @ApiImplicitParams({ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "类型0商品分类 1商品品牌 2商家标签 3快递 4退货选项 5换货选项 6退款选项 7取消订单选项 8咖啡百科分类 9咨 询分类 10活动赛事分类 11达人探店分类", required = true), @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "module", value = "所属模块 0平台商城 1咖豆商城", required = false), @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "parentId", value = "父级编码(自关联)", required = false), }) public ApiResponse> getLabelsResponseList(@RequestParam Integer type , Integer module , Integer parentId ) { return ApiResponse.success("查询成功",labelsService.getLabelsResponse(type,module,parentId)); } /** * 根据经纬度获取地址 同时跟新用户所在城市 * @param position * @return */ @LoginRequired @ApiOperation(value = "根据经纬度获取地址", notes = "小程序端") @PostMapping("/getAreasByPosition") public ApiResponse getAreasByPosition(@RequestBody Position position){ return ApiResponse.success(areasService.getAreasByPosition(position)); } @ApiOperation("根据父节点和类型查询") @PostMapping("/listByParentId") // @RequiresPermissions("business:areas:query") public ApiResponse> listByParentId (@RequestBody AreasDto pageWrap) { return ApiResponse.success(areasService.findByParentId(pageWrap.getParentId(),pageWrap.getType(),pageWrap.getFlag()) ); } }