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.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 java.util.List; import java.util.Map; /** * 系统电话控制器 */ @Api @RestController @RequestMapping("/base/phone") public class PhoneController { @Autowired private IPhoneService phoneService; /** * 获取系统所有电话 * @return */ @ResponseBody @PostMapping("/queryPhones") @ApiOperation(value = "获取首页电话", tags = {"用户端-首页", "用户端-公务用车"}, notes = "type=1(报警电话),type=2(投诉电话),type=3(公务用车调度电话)") @ApiImplicitParams({ @ApiImplicitParam(value = "当前定位行政区域编号", name = "code", required = true, dataType = "string") }) public ResultUtil queryPhones(String code){ try { List phones = phoneService.queryPhones(code); return ResultUtil.success(phones); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 获取个人中心的客服电话 * @param code * @return */ @ResponseBody @PostMapping("/queryCustomerPhone") @ApiOperation(value = "获取个人中心的客服电话", tags = {"用户端-个人中心"}, notes = "platform(平台电话),company(本地电话)") @ApiImplicitParams({ @ApiImplicitParam(value = "当前定位行政区域编号", name = "code", required = true, dataType = "string"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil queryCustomerPhone(String code){ try { Map map = phoneService.queryCustomerPhone(code); return ResultUtil.success(map); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } }