package com.stylefeng.guns.modular.api; import com.stylefeng.guns.modular.system.model.Phone; import com.stylefeng.guns.modular.system.service.IPhoneService; import com.stylefeng.guns.modular.system.service.IUserInfoService; import com.stylefeng.guns.modular.system.util.ResultUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import java.util.List; import java.util.Map; /** * 系统电话控制器 */ @Api @RestController @RequestMapping("/base/phone") public class PhoneController { @Autowired private IPhoneService phoneService; @Autowired private IUserInfoService userInfoService; /** * 获取系统所有电话 * @return */ @ResponseBody @PostMapping("/queryPhones") @ApiOperation(value = "获取首页电话【1.0】", tags = {"用户端-首页", "用户端-包车"}, notes = "type=1(报警电话),type=2(投诉电话),type=3(包车调度电话)") @ApiImplicitParams({ @ApiImplicitParam(value = "定位经度", name = "lat", required = true, dataType = "double"), @ApiImplicitParam(value = "定位维度", name = "lnt", required = true, dataType = "double") }) public ResultUtil queryPhones(Double lat, Double lnt, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); List phones = phoneService.queryPhones(uid, lat, lnt); return ResultUtil.success(phones); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 获取个人中心的客服电话 * @return */ @ResponseBody @PostMapping("/queryCustomerPhone") @ApiOperation(value = "获取个人中心的客服电话【1.0】", tags = {"用户端-个人中心"}, notes = "platform(平台电话),company(本地电话)") @ApiImplicitParams({ @ApiImplicitParam(value = "定位经度", name = "lat", required = true, dataType = "double"), @ApiImplicitParam(value = "定位维度", name = "lnt", required = true, dataType = "double"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil queryCustomerPhone(Double lat, Double lnt, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); Map map = phoneService.queryCustomerPhone(uid, lat, lnt); return ResultUtil.success(map); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } }