From 36626552d5323fb5f5fdd6121140b7cdb1755216 Mon Sep 17 00:00:00 2001 From: zhangjunwen Date: Fri, 20 Sep 2024 11:14:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E9=97=AD=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BF=AE=E6=94=B9influxdb=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=97=B6=E9=97=B4=E8=BD=AC=E6=8D=A2=E7=B2=BE=E5=BA=A6?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=90=8E=E9=87=8D=E5=AE=9A=E5=90=91404?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/common/util/date/DateUtils.java | 7 +- .../module/data/service/DataQueryService.java | 3 +- .../service/auth/AdminAuthServiceImpl.java | 4 +- imt-ui/src/permission.js | 88 +++++++++++-------- 4 files changed, 60 insertions(+), 42 deletions(-) diff --git a/imt-server/imt-framework/imt-common/src/main/java/com/inspur/framework/common/util/date/DateUtils.java b/imt-server/imt-framework/imt-common/src/main/java/com/inspur/framework/common/util/date/DateUtils.java index 1adc592..01cffb0 100644 --- a/imt-server/imt-framework/imt-common/src/main/java/com/inspur/framework/common/util/date/DateUtils.java +++ b/imt-server/imt-framework/imt-common/src/main/java/com/inspur/framework/common/util/date/DateUtils.java @@ -151,7 +151,12 @@ public class DateUtils { } public static String tranUTC2LocalDateTime(String utcTimeString) throws ParseException { - SimpleDateFormat utcFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); + String[] times = utcTimeString.split("\\."); + String format = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; + if(times.length <= 1) { + format = "yyyy-MM-dd'T'HH:mm:ss'Z'"; + } + SimpleDateFormat utcFormat =new SimpleDateFormat(format); utcFormat.setTimeZone(TimeZone.getTimeZone("UTC")); // 设置UTC时区 Date utcDate = utcFormat.parse(utcTimeString); // 解析UTC时间 SimpleDateFormat localFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); diff --git a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/DataQueryService.java b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/DataQueryService.java index 7605504..865049b 100644 --- a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/DataQueryService.java +++ b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/DataQueryService.java @@ -34,7 +34,8 @@ public class DataQueryService implements IDataQueryService{ List> dataList = queryDataByTime(tableName, null, startTime, endTime, pageNum, pageSize); dataList.forEach(map -> { try { - map.put("time", DateUtils.tranUTC2LocalDateTime(map.get("time").toString())); + String time = map.get("time").toString(); + map.put("time", DateUtils.tranUTC2LocalDateTime(time)); } catch (ParseException e) { throw new RuntimeException(e); } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/auth/AdminAuthServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/auth/AdminAuthServiceImpl.java index cb99c4d..b104331 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/auth/AdminAuthServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/auth/AdminAuthServiceImpl.java @@ -67,9 +67,9 @@ public class AdminAuthServiceImpl implements AdminAuthService { private SmsCodeApi smsCodeApi; /** - * 验证码的开关,默认为 true + * 验证码的开关,默认为 false */ - @Value("${imt.captcha.enable:true}") + @Value("${imt.captcha.enable:false}") private Boolean captchaEnable; @Override diff --git a/imt-ui/src/permission.js b/imt-ui/src/permission.js index 301fee6..190b9a5 100644 --- a/imt-ui/src/permission.js +++ b/imt-ui/src/permission.js @@ -1,61 +1,73 @@ -import router from './router' -import store from './store' -import { Message } from 'element-ui' -import NProgress from 'nprogress' -import 'nprogress/nprogress.css' -import { getAccessToken } from '@/utils/auth' -import { isRelogin } from '@/utils/request' +import router from "./router"; +import store from "./store"; +import { Message } from "element-ui"; +import NProgress from "nprogress"; +import "nprogress/nprogress.css"; +import { getAccessToken } from "@/utils/auth"; +import { isRelogin } from "@/utils/request"; -NProgress.configure({ showSpinner: false }) +NProgress.configure({ showSpinner: false }); -// 增加三方登陆 update by 芋艿 -const whiteList = ['/login', '/social-login', '/auth-redirect', '/bind', '/register', '/oauthLogin/gitee'] +// 增加三方登陆 +const whiteList = [ + "/login", + "/social-login", + "/auth-redirect", + "/bind", + "/register", + "/oauthLogin/gitee", +]; router.beforeEach((to, from, next) => { - NProgress.start() + NProgress.start(); if (getAccessToken()) { - to.meta.title && store.dispatch('settings/setTitle', to.meta.title) + to.meta.title && store.dispatch("settings/setTitle", to.meta.title); /* has token*/ - if (to.path === '/login') { - next({ path: '/' }) - NProgress.done() + if (to.path === "/login") { + next({ path: "/" }); + NProgress.done(); } else { if (store.getters.roles.length === 0) { - isRelogin.show = true + isRelogin.show = true; // 获取字典数据 add by 芋艿 - store.dispatch('dict/loadDictDatas') + store.dispatch("dict/loadDictDatas"); // 判断当前用户是否已拉取完 user_info 信息 - store.dispatch('GetInfo').then(userInfo => { - isRelogin.show = false - // 触发 GenerateRoutes 事件时,将 menus 菜单树传递进去 - store.dispatch('GenerateRoutes', userInfo.menus).then(accessRoutes => { - // 根据 roles 权限生成可访问的路由表 - router.addRoutes(accessRoutes) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 + store + .dispatch("GetInfo") + .then((userInfo) => { + isRelogin.show = false; + // 触发 GenerateRoutes 事件时,将 menus 菜单树传递进去 + store + .dispatch("GenerateRoutes", userInfo.menus) + .then((accessRoutes) => { + // 根据 roles 权限生成可访问的路由表 + router.addRoutes(accessRoutes); // 动态添加可访问路由表 + next({ ...to, replace: true }); // hack方法 确保addRoutes已完成 + }); }) - }).catch(err => { - store.dispatch('LogOut').then(() => { - Message.error(err) - next({ path: '/' }) - }) - }) + .catch((err) => { + store.dispatch("LogOut").then(() => { + Message.error(err); + next({ path: "/" }); + }); + }); } else { - next() + next(); } } } else { // 没有token if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入 - next() + next(); } else { - const redirect = encodeURIComponent(to.fullPath) // 编码 URI,保证参数跳转回去后,可以继续带上 - next(`/login?redirect=${redirect}`) // 否则全部重定向到登录页 - NProgress.done() + const redirect = encodeURIComponent(to.fullPath); // 编码 URI,保证参数跳转回去后,可以继续带上 + next(`/login?redirect=${redirect}`); // 否则全部重定向到登录页 + NProgress.done(); } } -}) +}); router.afterEach(() => { - NProgress.done() -}) + NProgress.done(); +});