From b77c1869930d044db13a0d4a672bf98da1cab2c2 Mon Sep 17 00:00:00 2001 From: zhibing.pu <393733352@qq.com> Date: 星期四, 22 八月 2024 12:00:07 +0800 Subject: [PATCH] 修改bug --- UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java | 88 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 86 insertions(+), 2 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..45b01c4 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; @@ -25,6 +26,8 @@ import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -50,6 +53,8 @@ @RestController @RequestMapping("") public class UserInfoController { + + Logger log = LoggerFactory.getLogger(UserInfoController.class); @Autowired private IUserInfoService userInfoService; @@ -81,6 +86,9 @@ private ITransactionDetailsService transactionDetailsService; @Autowired private IPaymentRecordService paymentRecordService; + + @Autowired + private FleetEngineUtil fleetEngineUtil; @@ -193,7 +201,32 @@ return ResultUtil.paranErr(); } } - + + + /** + * 短信回调通知 + * @param request + */ + @ResponseBody + @PostMapping("/base/sendCellulantMessageCallback") + public void sendCellulantMessageCallback(HttpServletRequest request){ + try { + StringBuilder sb = new StringBuilder(); + InputStream inputStream = request.getInputStream(); + String s; + BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); + while ((s = in.readLine()) != null) { + sb.append(s); + } + in.close(); + inputStream.close(); + log.info("短信通知回调:" + sb.toString()); + }catch (Exception e){ + e.printStackTrace(); + } + } + + @ResponseBody @PostMapping("/base/sedEmail") @ApiOperation(value = "获取邮箱验证码【1.0】", tags = {"用户端-登录"}, notes = "") @@ -713,8 +746,9 @@ Map<String, Object> map = userInfoService.queryUser(language, phone); if(null != map){ return ResultUtil.success(UserInfoWarpper.getUserInfoWarpper(map)); + }else{ + return ResultUtil.error(language == 1 ? "此账号不存在" : language == 2 ? "The account does not exist" : "Ce compte n’existe pas"); } - return ResultUtil.success(new JSONObject()); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); @@ -1330,4 +1364,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