| | |
| | | |
| | | import com.stylefeng.guns.modular.system.service.IOpenCityBusinessService; |
| | | import com.stylefeng.guns.modular.system.service.IOpenCityService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | @Autowired |
| | | private IOpenCityBusinessService openCityBusinessService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取开通城市列表 |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryOpenCity") |
| | | @ApiOperation(value = "获取开通城市列表", tags = {"用户端-首页"}, notes = "") |
| | | @ApiOperation(value = "获取开通城市列表【1.0】", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "语言(1=中文,2=英文,3=法语)", name = "language", required = false, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = false, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<BaseWarpper>> queryOpenCity(){ |
| | | public ResultUtil<List<BaseWarpper>> queryOpenCity(Integer language, HttpServletRequest request){ |
| | | try { |
| | | List<BaseWarpper> list = openCityService.queryOpenCity(); |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | List<BaseWarpper> list = openCityService.queryOpenCity(uid, language); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据当前定位获取对应的业务类型 |
| | | * @param province |
| | | * @param city |
| | | * @param district |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryBusiness") |
| | | @ApiOperation(value = "根据当前定位获取业务类型", tags = {"用户端-首页"}, notes = "") |
| | | @ApiOperation(value = "根据当前定位获取业务类型【1.0】", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "省名称", name = "province", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "市名称", name = "city", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "区县名称", name = "district", required = true, dataType = "String") |
| | | @ApiImplicitParam(value = "纬度", name = "lat", required = true, dataType = "double"), |
| | | @ApiImplicitParam(value = "经度", name = "lnt", required = true, dataType = "double"), |
| | | }) |
| | | public ResultUtil<List<BaseWarpper>> queryBusiness(String province, String city, String district){ |
| | | public ResultUtil<List<BaseWarpper>> queryBusiness(Double lat, Double lnt){ |
| | | try { |
| | | List<BaseWarpper> list = openCityBusinessService.queryBusiness(province, city, district); |
| | | List<BaseWarpper> list = openCityBusinessService.queryBusiness(lat, lnt); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | |
| | | /** |
| | | * 判断开通城市 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/openCity") |
| | | @ApiOperation(value = "判断当前是否是开通城市", tags = {"用户端-首页"}, notes = "open=1(是),open=2(否)") |
| | | @ApiOperation(value = "判断当前是否是开通城市【1.0】", tags = {"用户端-首页"}, notes = "open=1(是),open=2(否)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "当前定位城市code", name = "code", required = true, dataType = "String") |
| | | @ApiImplicitParam(value = "纬度", name = "lat", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "经度", name = "lnt", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil openCity(String code){ |
| | | public ResultUtil openCity(Double lat, Double lnt){ |
| | | try { |
| | | boolean b = openCityService.openCity(code); |
| | | boolean b = openCityService.openCity(lat, lnt); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("open", b ? 1 : 2); |
| | | return ResultUtil.success(map); |