From 287cbb376dea7b3972e5f38a38fad043aa4d3b68 Mon Sep 17 00:00:00 2001 From: zhibing.pu <393733352@qq.com> Date: 星期四, 01 八月 2024 16:05:33 +0800 Subject: [PATCH] 修改2.0 bug --- UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 54 insertions(+), 0 deletions(-) diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java index 436ecf1..2fc2388 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java @@ -13,6 +13,7 @@ import com.stylefeng.guns.modular.system.model.UserInfo; import com.stylefeng.guns.modular.system.service.*; import com.stylefeng.guns.modular.system.util.*; +import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; import com.stylefeng.guns.modular.system.warpper.*; import com.stylefeng.guns.modular.taxi.model.TransactionDetails; @@ -81,6 +82,9 @@ private ITransactionDetailsService transactionDetailsService; @Autowired private IPaymentRecordService paymentRecordService; + + @Autowired + private FleetEngineUtil fleetEngineUtil; @@ -1330,4 +1334,54 @@ } } } + + + + @ResponseBody + @PostMapping("/api/user/getFleetEngineAuth") + @ApiOperation(value = "获取google地图授权token", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "行程id", name = "tripId", required = true, dataType = "string"), + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResultUtil<Map<String, Object>> getFleetEngineAuth(String tripId, HttpServletRequest request){ + try { + Integer uid = userInfoService.getUserIdFormRedis(request); + if(null == uid){ + return ResultUtil.tokenErr(); + } + Map<String, Object> s = fleetEngineUtil.fleetEngineAuth(1, tripId); + return ResultUtil.success(s); + }catch (Exception e){ + e.printStackTrace(); + return ResultUtil.runErr(); + } + } + + + @ResponseBody + @PostMapping("/base/user/textToSpeech") + public String textToSpeech(String languageCode, String text, String fileName){ + try { + String s = TextToSpeechUtil.create(languageCode, text, fileName + ".mp3"); + //定时任务删除语音文件 + new Timer().schedule(new TimerTask() { + @Override + public void run() { + Process process = null; + try { + process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName + ".mp3"); + } catch (IOException e) { + throw new RuntimeException(e); + } + if (process != null) { + process.destroy(); + } + } + }, 30000); + return s; + } catch (Exception e) { + throw new RuntimeException(e); + } + } } -- Gitblit v1.7.1