From 5a14be81e62c77c4e1276514b1f000b7ad19170b Mon Sep 17 00:00:00 2001 From: Lemon Date: Sat, 14 Oct 2023 09:30:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsowell/api/uniapp/JumpController.java | 195 +++++++++--------- 1 file changed, 98 insertions(+), 97 deletions(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/JumpController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/JumpController.java index ec332ca7c..a16b753d6 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/JumpController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/JumpController.java @@ -27,106 +27,107 @@ import java.util.List; @RequestMapping("/app-xcx-h5") public class JumpController extends BaseController { - @Autowired - private PileService pileService; + @Autowired + private PileService pileService; - @Autowired - private IPileBasicInfoService pileBasicInfoService; + @Autowired + private IPileBasicInfoService pileBasicInfoService; - /** - * 查询充电桩详情 - * http://localhost:8080/app-xcx-h5/pile/pileDetail/{pileSn} - */ - @GetMapping("/pile/pileDetail/{pileSn}") - public RestApiResponse getPileDetail(HttpServletRequest request, @PathVariable("pileSn") String pileSn) { - // logger.info("app-xcx-h5查询充电桩详情 param:{}", pileSn); - logger.info("User-Agent:{}", request.getHeader("user-agent")); - RestApiResponse response = null; - try { - PileConnectorVO vo = pileService.getPileDetailByPileSn(pileSn); - response = new RestApiResponse<>(vo); - } catch (BusinessException e) { - logger.warn("app-xcx-h5查询充电桩详情 warn", e); - response = new RestApiResponse<>(e.getCode(), e.getMessage()); - } catch (Exception e) { - logger.error("app-xcx-h5查询充电桩详情 error", e); - response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_PILE_DETAIL_ERROR); - } - logger.info("app-xcx-h5查询充电桩详情 param:{}, result:{}", pileSn, JSONObject.toJSONString(response)); - return response; - } + /** + * 查询充电桩详情 + * http://localhost:8080/app-xcx-h5/pile/pileDetail/{pileSn} + */ + @GetMapping("/pile/pileDetail/{pileSn}") + public RestApiResponse getPileDetail(HttpServletRequest request, @PathVariable("pileSn") String pileSn) { + // logger.info("app-xcx-h5查询充电桩详情 param:{}", pileSn); + logger.info("User-Agent:{}", request.getHeader("user-agent")); + RestApiResponse response = null; + try { + PileConnectorVO vo = pileService.getPileDetailByPileSn(pileSn); + response = new RestApiResponse<>(vo); + } catch (BusinessException e) { + logger.warn("app-xcx-h5查询充电桩详情 warn", e); + response = new RestApiResponse<>(e.getCode(), e.getMessage()); + } catch (Exception e) { + logger.error("app-xcx-h5查询充电桩详情 error", e); + response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_PILE_DETAIL_ERROR); + } + logger.info("app-xcx-h5查询充电桩详情 param:{}, result:{}", pileSn, JSONObject.toJSONString(response)); + return response; + } - /** - * 查询充电枪口详情 - * http://localhost:8080/app-xcx-h5/pile/connectorDetail/{pileConnectorCode} - */ - @GetMapping("/pile/connectorDetail/{pileConnectorCode}") - public RestApiResponse getConnectorDetail(HttpServletRequest request, @PathVariable("pileConnectorCode") String pileConnectorCode) { - // logger.info("app-xcx-h5查询充电枪口详情 param:{}", pileConnectorCode); - logger.info("User-Agent:{}", request.getHeader("user-agent")); - RestApiResponse response = null; - try { - PileConnectorVO vo = pileService.getConnectorDetail(pileConnectorCode); - response = new RestApiResponse<>(vo); - } catch (BusinessException e) { - logger.warn("app-xcx-h5查询充电枪口详情 warn param:{}", pileConnectorCode, e); - response = new RestApiResponse<>(e.getCode(), e.getMessage()); - } catch (Exception e) { - logger.error("app-xcx-h5查询充电枪口详情 error param:{}", pileConnectorCode, e); - response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_PILE_DETAIL_ERROR); - } - logger.info("app-xcx-h5查询充电枪口详情 param:{} result:{}", pileConnectorCode, JSONObject.toJSONString(response)); - return response; - } + /** + * 查询充电枪口详情 + * http://localhost:8080/app-xcx-h5/pile/connectorDetail/{pileConnectorCode} + */ + @GetMapping("/pile/connectorDetail/{pileConnectorCode}") + public RestApiResponse getConnectorDetail(HttpServletRequest request, @PathVariable("pileConnectorCode") String pileConnectorCode) { + // logger.info("app-xcx-h5查询充电枪口详情 param:{}", pileConnectorCode); + logger.info("User-Agent:{}", request.getHeader("user-agent")); + RestApiResponse response = null; + try { + PileConnectorVO vo = pileService.getConnectorDetail(pileConnectorCode); + response = new RestApiResponse<>(vo); + } catch (BusinessException e) { + logger.warn("app-xcx-h5查询充电枪口详情 warn param:{}", pileConnectorCode, e); + response = new RestApiResponse<>(e.getCode(), e.getMessage()); + } catch (Exception e) { + logger.error("app-xcx-h5查询充电枪口详情 error param:{}", pileConnectorCode, e); + response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_PILE_DETAIL_ERROR); + } + logger.info("app-xcx-h5查询充电枪口详情 param:{} result:{}", pileConnectorCode, JSONObject.toJSONString(response)); + return response; + } - /** - * 上传到阿里云oss - * http://localhost:8080/app-xcx-h5/uploadOSS - * @param file - * @return - */ - @CrossOrigin - @PostMapping("/uploadOSS") - public AjaxResult uploadFileOSS(MultipartFile file) { - try { - String url = AliyunOssUploadUtils.uploadFile(file); - AjaxResult ajax = AjaxResult.success(); - ajax.put("url", url); - ajax.put("fileName", FileUtils.getName(url)); - ajax.put("newFileName", FileUtils.getName(url)); - ajax.put("originalFilename", file.getOriginalFilename()); - return ajax; - }catch (Exception e){ - return AjaxResult.error(e.getMessage()); - } - } + /** + * 上传到阿里云oss + * http://localhost:8080/app-xcx-h5/uploadOSS + * + * @param file + * @return + */ + @CrossOrigin + @PostMapping("/uploadOSS") + public AjaxResult uploadFileOSS(MultipartFile file) { + try { + String url = AliyunOssUploadUtils.uploadFile(file); + AjaxResult ajax = AjaxResult.success(); + ajax.put("url", url); + ajax.put("fileName", FileUtils.getName(url)); + ajax.put("newFileName", FileUtils.getName(url)); + ajax.put("originalFilename", file.getOriginalFilename()); + return ajax; + } catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } + } - /** - * 获取地锁列表信息 - * http://localhost:8080/app-xcx-h5/getGroundLockInfo/{stationId} - * @param stationId - * @return - */ - @GetMapping("/getGroundLockInfo/{stationId}") - public RestApiResponse getGroundLockInfo(@PathVariable("stationId") String stationId, HttpServletRequest request) { - logger.info("获取地锁列表信息 params:{}", stationId); - RestApiResponse response = null; - try { - String memberId = getMemberIdByAuthorization(request); - if (StringUtils.isBlank(memberId)) { - throw new BusinessException(ReturnCodeEnum.CODE_TOKEN_ERROR); - } - List list = pileBasicInfoService.getGroundLockInfo(stationId); - response = new RestApiResponse<>(list); - }catch (BusinessException e) { - logger.error("获取地锁列表信息 error,", e); - response = new RestApiResponse<>(e.getCode(), e.getMessage()); - } - catch (Exception e) { - logger.error("获取地锁列表信息 error, ", e); - response = new RestApiResponse<>(e); - } - logger.info("获取地锁列表信息 result:{}", response); - return response; - } + /** + * 获取地锁列表信息 + * http://localhost:8080/app-xcx-h5/getGroundLockInfo/{stationId} + * + * @param stationId + * @return + */ + @GetMapping("/getGroundLockInfo/{stationId}") + public RestApiResponse getGroundLockInfo(@PathVariable("stationId") String stationId, HttpServletRequest request) { + logger.info("获取地锁列表信息 params:{}", stationId); + RestApiResponse response = null; + try { + String memberId = getMemberIdByAuthorization(request); + if (StringUtils.isBlank(memberId)) { + throw new BusinessException(ReturnCodeEnum.CODE_TOKEN_ERROR); + } + List list = pileBasicInfoService.getGroundLockInfo(stationId); + response = new RestApiResponse<>(list); + } catch (BusinessException e) { + logger.error("获取地锁列表信息 error,", e); + response = new RestApiResponse<>(e.getCode(), e.getMessage()); + } catch (Exception e) { + logger.error("获取地锁列表信息 error, ", e); + response = new RestApiResponse<>(e); + } + logger.info("获取地锁列表信息 result:{}", response); + return response; + } }