Commit fb672d594b776cf7cce4241759cef2f6b4c26a1c
1 parent
99e42dcd
接入统一登陆平台
Showing
18 changed files
with
238 additions
and
136 deletions
pom.xml
| @@ -464,6 +464,12 @@ | @@ -464,6 +464,12 @@ | ||
| 464 | <version>4.3.2-1.5.5</version> | 464 | <version>4.3.2-1.5.5</version> |
| 465 | <classifier>${javacpp.platform}</classifier> | 465 | <classifier>${javacpp.platform}</classifier> |
| 466 | </dependency> | 466 | </dependency> |
| 467 | + | ||
| 468 | + <dependency> | ||
| 469 | + <groupId>cn.hutool</groupId> | ||
| 470 | + <artifactId>hutool-all</artifactId> | ||
| 471 | + <version>4.6.3</version> | ||
| 472 | + </dependency> | ||
| 467 | </dependencies> | 473 | </dependencies> |
| 468 | 474 | ||
| 469 | <dependencyManagement> | 475 | <dependencyManagement> |
src/main/java/com/bsth/XDApplication.java
| @@ -187,10 +187,10 @@ public class XDApplication implements CommandLineRunner { | @@ -187,10 +187,10 @@ public class XDApplication implements CommandLineRunner { | ||
| 187 | //log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | 187 | //log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); |
| 188 | //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | 188 | //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); |
| 189 | //计算油、公里加注 | 189 | //计算油、公里加注 |
| 190 | - sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | 190 | + //scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); |
| 191 | 191 | ||
| 192 | //线路版本更新 | 192 | //线路版本更新 |
| 193 | - sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); | 193 | + //sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); |
| 194 | 194 | ||
| 195 | //线路版本更新 | 195 | //线路版本更新 |
| 196 | //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); | 196 | //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); |
| @@ -201,12 +201,12 @@ public class XDApplication implements CommandLineRunner { | @@ -201,12 +201,12 @@ public class XDApplication implements CommandLineRunner { | ||
| 201 | ScheduledExecutorService sexec = Application.mainServices; | 201 | ScheduledExecutorService sexec = Application.mainServices; |
| 202 | 202 | ||
| 203 | 203 | ||
| 204 | - //安全驾驶 | 204 | +/* //安全驾驶 |
| 205 | sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS); | 205 | sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS); |
| 206 | //智能调度 | 206 | //智能调度 |
| 207 | sexec.scheduleWithFixedDelay(znddThread, 30, 30, TimeUnit.SECONDS); | 207 | sexec.scheduleWithFixedDelay(znddThread, 30, 30, TimeUnit.SECONDS); |
| 208 | //智能调度 | 208 | //智能调度 |
| 209 | - sexec.scheduleWithFixedDelay(ZnddtwoThread, 30, 60, TimeUnit.SECONDS); | 209 | + sexec.scheduleWithFixedDelay(ZnddtwoThread, 30, 60, TimeUnit.SECONDS);*/ |
| 210 | //响应式公交自动对接订单 --暂时关闭等待博协调整后再开启 | 210 | //响应式公交自动对接订单 --暂时关闭等待博协调整后再开启 |
| 211 | //sexec.scheduleWithFixedDelay(orderListThread, 120, 60 * 30, TimeUnit.SECONDS); | 211 | //sexec.scheduleWithFixedDelay(orderListThread, 120, 60 * 30, TimeUnit.SECONDS); |
| 212 | GpsDataLoaderThread.setFlag(-1); | 212 | GpsDataLoaderThread.setFlag(-1); |
| @@ -236,12 +236,12 @@ public class XDApplication implements CommandLineRunner { | @@ -236,12 +236,12 @@ public class XDApplication implements CommandLineRunner { | ||
| 236 | 236 | ||
| 237 | //运管处静态数据提交 | 237 | //运管处静态数据提交 |
| 238 | log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | 238 | log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); |
| 239 | - sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | 239 | + //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); |
| 240 | //计算油、公里加注 | 240 | //计算油、公里加注 |
| 241 | - sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | 241 | + //.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); |
| 242 | 242 | ||
| 243 | //线路版本更新 | 243 | //线路版本更新 |
| 244 | - sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); | 244 | + // sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); |
| 245 | 245 | ||
| 246 | //线路版本更新 | 246 | //线路版本更新 |
| 247 | //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); | 247 | //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); |
| @@ -251,14 +251,14 @@ public class XDApplication implements CommandLineRunner { | @@ -251,14 +251,14 @@ public class XDApplication implements CommandLineRunner { | ||
| 251 | log.info("testInit..."); | 251 | log.info("testInit..."); |
| 252 | ScheduledExecutorService sexec = Application.mainServices; | 252 | ScheduledExecutorService sexec = Application.mainServices; |
| 253 | //安全驾驶 | 253 | //安全驾驶 |
| 254 | - sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS); | 254 | + /*sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS); |
| 255 | 255 | ||
| 256 | //智能调度 | 256 | //智能调度 |
| 257 | sexec.scheduleWithFixedDelay(znddThread, 30, 30, TimeUnit.SECONDS); | 257 | sexec.scheduleWithFixedDelay(znddThread, 30, 30, TimeUnit.SECONDS); |
| 258 | //智能调度 | 258 | //智能调度 |
| 259 | sexec.scheduleWithFixedDelay(ZnddtwoThread, 30, 60, TimeUnit.SECONDS); | 259 | sexec.scheduleWithFixedDelay(ZnddtwoThread, 30, 60, TimeUnit.SECONDS); |
| 260 | //响应式公交自动对接订单 | 260 | //响应式公交自动对接订单 |
| 261 | - sexec.scheduleWithFixedDelay(orderListThread, 120, 60 * 30, TimeUnit.SECONDS); | 261 | + sexec.scheduleWithFixedDelay(orderListThread, 120, 60 * 30, TimeUnit.SECONDS);*/ |
| 262 | 262 | ||
| 263 | GpsDataLoaderThread.setFlag(-1); | 263 | GpsDataLoaderThread.setFlag(-1); |
| 264 | //dayOfSchedule.dataRecovery(); | 264 | //dayOfSchedule.dataRecovery(); |
| @@ -290,10 +290,10 @@ public class XDApplication implements CommandLineRunner { | @@ -290,10 +290,10 @@ public class XDApplication implements CommandLineRunner { | ||
| 290 | //log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | 290 | //log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); |
| 291 | //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | 291 | //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); |
| 292 | //计算油、公里加注 | 292 | //计算油、公里加注 |
| 293 | - sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | 293 | + //sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); |
| 294 | 294 | ||
| 295 | //线路版本更新 | 295 | //线路版本更新 |
| 296 | - sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); | 296 | + //sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); |
| 297 | 297 | ||
| 298 | //线路版本更新 | 298 | //线路版本更新 |
| 299 | //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); | 299 | //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); |
| @@ -334,12 +334,12 @@ public class XDApplication implements CommandLineRunner { | @@ -334,12 +334,12 @@ public class XDApplication implements CommandLineRunner { | ||
| 334 | 334 | ||
| 335 | //运管处静态数据提交 | 335 | //运管处静态数据提交 |
| 336 | log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | 336 | log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); |
| 337 | - sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | 337 | + //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); |
| 338 | //计算油、公里加注 | 338 | //计算油、公里加注 |
| 339 | - sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | 339 | + //sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); |
| 340 | 340 | ||
| 341 | //线路版本更新 | 341 | //线路版本更新 |
| 342 | - sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); | 342 | + //sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); |
| 343 | 343 | ||
| 344 | //线路版本更新 | 344 | //线路版本更新 |
| 345 | //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); | 345 | //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); |
src/main/java/com/bsth/controller/sys/UserController.java
| 1 | package com.bsth.controller.sys; | 1 | package com.bsth.controller.sys; |
| 2 | 2 | ||
| 3 | +import cn.hutool.http.HttpRequest; | ||
| 4 | +import cn.hutool.http.HttpResponse; | ||
| 5 | +import com.alibaba.fastjson.JSONObject; | ||
| 3 | import com.bsth.common.Constants; | 6 | import com.bsth.common.Constants; |
| 4 | import com.bsth.common.ResponseCode; | 7 | import com.bsth.common.ResponseCode; |
| 5 | import com.bsth.controller.BaseController; | 8 | import com.bsth.controller.BaseController; |
| @@ -12,7 +15,6 @@ import com.bsth.security.SsoConfig; | @@ -12,7 +15,6 @@ import com.bsth.security.SsoConfig; | ||
| 12 | import com.bsth.security.util.SecurityUtils; | 15 | import com.bsth.security.util.SecurityUtils; |
| 13 | import com.bsth.service.sys.CompanyAuthorityService; | 16 | import com.bsth.service.sys.CompanyAuthorityService; |
| 14 | import com.bsth.service.sys.SysUserService; | 17 | import com.bsth.service.sys.SysUserService; |
| 15 | -import com.bsth.util.HttpClientUtils; | ||
| 16 | import com.fasterxml.jackson.databind.ObjectMapper; | 18 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 17 | import com.google.common.collect.ArrayListMultimap; | 19 | import com.google.common.collect.ArrayListMultimap; |
| 18 | import org.apache.commons.lang3.StringUtils; | 20 | import org.apache.commons.lang3.StringUtils; |
| @@ -25,7 +27,6 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -25,7 +27,6 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
| 25 | import org.springframework.security.authentication.BadCredentialsException; | 27 | import org.springframework.security.authentication.BadCredentialsException; |
| 26 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | 28 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| 27 | import org.springframework.security.web.authentication.session.SessionAuthenticationException; | 29 | import org.springframework.security.web.authentication.session.SessionAuthenticationException; |
| 28 | -import org.springframework.util.Assert; | ||
| 29 | import org.springframework.web.bind.annotation.RequestMapping; | 30 | import org.springframework.web.bind.annotation.RequestMapping; |
| 30 | import org.springframework.web.bind.annotation.RequestMethod; | 31 | import org.springframework.web.bind.annotation.RequestMethod; |
| 31 | import org.springframework.web.bind.annotation.RequestParam; | 32 | import org.springframework.web.bind.annotation.RequestParam; |
| @@ -76,54 +77,70 @@ public class UserController extends BaseController<SysUser, Integer> { | @@ -76,54 +77,70 @@ public class UserController extends BaseController<SysUser, Integer> { | ||
| 76 | public static Map<String, Long> USER_LOCKTIME = new HashMap<>(); | 77 | public static Map<String, Long> USER_LOCKTIME = new HashMap<>(); |
| 77 | 78 | ||
| 78 | @RequestMapping(value = "/login/token") | 79 | @RequestMapping(value = "/login/token") |
| 79 | - public void login(@RequestParam String token, HttpServletRequest request, HttpServletResponse response) throws Exception { | ||
| 80 | - response.addHeader("Content-Type", "text/html;charset=UTF-8"); | ||
| 81 | - if (!ssoConfig.isSsoEnabled()) { | ||
| 82 | - response.getWriter().write("系统未开启统一登录配置,请联系管理员"); | ||
| 83 | - return; | ||
| 84 | - } | ||
| 85 | - if (token == null) { | ||
| 86 | - throw new IllegalArgumentException("请检查参数"); | ||
| 87 | - } | 80 | + public void login(@RequestParam String satoken, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| 81 | + try { | ||
| 82 | + response.addHeader("Content-Type", "text/html;charset=UTF-8"); | ||
| 83 | + if (!ssoConfig.isSsoEnabled()) { | ||
| 84 | + response.getWriter().write("系统未开启统一登录配置,请联系管理员"); | ||
| 85 | + return; | ||
| 86 | + } | ||
| 87 | + if (satoken == null) { | ||
| 88 | + throw new IllegalArgumentException("请检查参数"); | ||
| 89 | + } | ||
| 88 | 90 | ||
| 89 | - Map<String, Object> param = new HashMap<>(), user = new HashMap<>(); | ||
| 90 | - param.put("token", token); | ||
| 91 | - param.put("sysCode", ssoConfig.getSystemCode()); | ||
| 92 | - StringBuilder sb = HttpClientUtils.post(ssoConfig.getSsoAuthUrl(), HttpClientUtils.createFormEntity(param), HttpClientUtils.createFormHeader()); | ||
| 93 | - | ||
| 94 | - Assert.notNull(sb, "统一登录平台验证数据不为空"); | ||
| 95 | - logger.info(String.format("统一登录平台:%s", sb.toString())); | ||
| 96 | - param = mapper.readValue(sb.toString(), Map.class); | ||
| 97 | - if (200 == (int) param.get("code")) { | ||
| 98 | - param = mapper.readValue(mapper.writeValueAsString(param.get("data")), Map.class); | ||
| 99 | - if ("9999".equals(param.get("code")) || "9998".equals(param.get("code"))) { | ||
| 100 | - response.getWriter().write(param.get("msg").toString()); | 91 | + logger.info(">>>>>>>>>>>>>>>>>>>>>>>"+satoken); |
| 92 | + logger.info(">>>>>>>>>>>>>>>>>>>>>>>"+ssoConfig.getSsoAuthUrl()); | ||
| 93 | +/* | ||
| 94 | + Map<String, Object> requestBody = new HashMap<>(); | ||
| 95 | + | ||
| 96 | + JSONObject userInfoJSON = Forest.post(ssoConfig.getSsoAuthUrl()) | ||
| 97 | + .contentType("application/json") | ||
| 98 | + .addHeader("Content-Type", "application/json") | ||
| 99 | + .addHeader("Satoken", satoken) // 增加请求头信息 | ||
| 100 | + .addBody(requestBody) // 增加请求荷载 | ||
| 101 | + .execute(JSONObject.class); | ||
| 102 | +*/ | ||
| 103 | + | ||
| 104 | + JSONObject json = new JSONObject(); | ||
| 105 | + HttpResponse resp = HttpRequest.post(ssoConfig.getSsoAuthUrl()) | ||
| 106 | + .header("Content-Type", "application/json") | ||
| 107 | + .header("Satoken", satoken) | ||
| 108 | + .body(json.toString()) // 将JSON对象转为字符串 | ||
| 109 | + .execute(); | ||
| 110 | + JSONObject userInfoJSON=JSONObject.parseObject(resp.body()); | ||
| 111 | + logger.info(">>>>>>>>>>>>>>>>>>>>>>>"+resp.body()); | ||
| 112 | + if (!userInfoJSON.getBoolean("success")) { | ||
| 113 | + response.getWriter().write("用户验证失败,请联系管理员"); | ||
| 101 | return; | 114 | return; |
| 102 | - } else { | ||
| 103 | - param = mapper.readValue(mapper.writeValueAsString(param.get("data")), Map.class); | ||
| 104 | } | 115 | } |
| 105 | - } else { | ||
| 106 | - response.getWriter().write(param.get("msg").toString()); | ||
| 107 | - return; | ||
| 108 | - } | ||
| 109 | - String userName = (String) param.get("userName"); | ||
| 110 | - user.put("userName_eq", userName); | ||
| 111 | - user.put("enabled", true); | ||
| 112 | - | ||
| 113 | - Iterator<SysUser> userIterator = sysUserService.list(user).iterator(); | ||
| 114 | - SysUser sysUser = null; | ||
| 115 | - while (userIterator.hasNext()) { | ||
| 116 | - sysUser = userIterator.next(); | ||
| 117 | - break; | ||
| 118 | - } | 116 | + String userName = userInfoJSON.getJSONObject("result").getString("userid"); |
| 117 | + Map<String, Object> user = new HashMap<>(); | ||
| 118 | + user.put("userName_eq", userName); | ||
| 119 | + user.put("enabled", true); | ||
| 120 | + | ||
| 121 | + Iterator<SysUser> userIterator = sysUserService.list(user).iterator(); | ||
| 122 | + SysUser sysUser = null; | ||
| 123 | + while (userIterator.hasNext()) { | ||
| 124 | + sysUser = userIterator.next(); | ||
| 125 | + break; | ||
| 126 | + } | ||
| 119 | 127 | ||
| 120 | - if (sysUser != null) { | 128 | + if(sysUser==null){ |
| 129 | + sysUser=new SysUser(); | ||
| 130 | + sysUser.setUserName(userName); | ||
| 131 | + sysUser.setName(userName); | ||
| 132 | + Map<String, Object> map=sysUserService.createUser(sysUser); | ||
| 133 | + if(!"200".equals(((ResponseCode) map.get("status")).toString())){ | ||
| 134 | + response.getWriter().write("用户创建失败,请联系管理员"); | ||
| 135 | + return; | ||
| 136 | + } | ||
| 137 | + } | ||
| 121 | HttpSession session = request.getSession(); | 138 | HttpSession session = request.getSession(); |
| 122 | // 登录 | 139 | // 登录 |
| 123 | SecurityUtils.login(sysUser, request); | 140 | SecurityUtils.login(sysUser, request); |
| 124 | sysUserService.recordLoginDate(sysUser.getUserName()); | 141 | sysUserService.recordLoginDate(sysUser.getUserName()); |
| 125 | //session里写入用户名,webSocket连接时标识身份用 | 142 | //session里写入用户名,webSocket连接时标识身份用 |
| 126 | - session.setAttribute(Constants.SSO_TOKEN, token); | 143 | + session.setAttribute(Constants.SSO_TOKEN, satoken); |
| 127 | session.setAttribute(Constants.SESSION_USERNAME, sysUser.getUserName()); | 144 | session.setAttribute(Constants.SESSION_USERNAME, sysUser.getUserName()); |
| 128 | //session.setAttribute(Constants.RESOURCE_AUTHORITYS, sysUser.getLinks()); | 145 | //session.setAttribute(Constants.RESOURCE_AUTHORITYS, sysUser.getLinks()); |
| 129 | //获取公司权限数据 | 146 | //获取公司权限数据 |
| @@ -131,10 +148,12 @@ public class UserController extends BaseController<SysUser, Integer> { | @@ -131,10 +148,12 @@ public class UserController extends BaseController<SysUser, Integer> { | ||
| 131 | session.setAttribute(Constants.COMPANY_AUTHORITYS, cmyAuths); | 148 | session.setAttribute(Constants.COMPANY_AUTHORITYS, cmyAuths); |
| 132 | 149 | ||
| 133 | USER_ERRTIMES.remove(sysUser.getUserName()); | 150 | USER_ERRTIMES.remove(sysUser.getUserName()); |
| 134 | - logger.error(String.format("用户: %s登录, token: %s",sysUser.getUserName(), token)); | 151 | + logger.error(String.format("用户: %s登录, token: %s",sysUser.getUserName(), satoken)); |
| 135 | response.sendRedirect("/pages/home.html"); | 152 | response.sendRedirect("/pages/home.html"); |
| 136 | - } else { | ||
| 137 | - response.getWriter().write("未找到有效的用户,请联系管理员"); | 153 | + } catch (Exception e) { |
| 154 | + logger.error("", e); | ||
| 155 | + response.getWriter().write("服务器出现异常,请联系管理员"); | ||
| 156 | + return; | ||
| 138 | } | 157 | } |
| 139 | } | 158 | } |
| 140 | 159 |
src/main/java/com/bsth/data/commonData/SyncData.java
| @@ -26,7 +26,7 @@ public class SyncData extends Thread{ | @@ -26,7 +26,7 @@ public class SyncData extends Thread{ | ||
| 26 | 26 | ||
| 27 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 27 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 28 | 28 | ||
| 29 | - JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource()); | 29 | + |
| 30 | 30 | ||
| 31 | @Autowired | 31 | @Autowired |
| 32 | private BusinessService businessService; | 32 | private BusinessService businessService; |
| @@ -92,7 +92,6 @@ public class SyncData extends Thread{ | @@ -92,7 +92,6 @@ public class SyncData extends Thread{ | ||
| 92 | BasicData.BasicDataLoader basicDataLoader; | 92 | BasicData.BasicDataLoader basicDataLoader; |
| 93 | 93 | ||
| 94 | @Scheduled(cron = "0 1 * * * ?") | 94 | @Scheduled(cron = "0 1 * * * ?") |
| 95 | - @Transactional() | ||
| 96 | public void SyncData(){ | 95 | public void SyncData(){ |
| 97 | syncBusiness(); | 96 | syncBusiness(); |
| 98 | syncCarPark(); | 97 | syncCarPark(); |
| @@ -112,6 +111,7 @@ public class SyncData extends Thread{ | @@ -112,6 +111,7 @@ public class SyncData extends Thread{ | ||
| 112 | 111 | ||
| 113 | public void syncBusiness(){ | 112 | public void syncBusiness(){ |
| 114 | try { | 113 | try { |
| 114 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource()); | ||
| 115 | String sql = "select * from common_bus_company"; | 115 | String sql = "select * from common_bus_company"; |
| 116 | List<BusCompany> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusCompany.class)); | 116 | List<BusCompany> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusCompany.class)); |
| 117 | List<Business> businesses=BusCompany.convert(list); | 117 | List<Business> businesses=BusCompany.convert(list); |
| @@ -131,6 +131,7 @@ public class SyncData extends Thread{ | @@ -131,6 +131,7 @@ public class SyncData extends Thread{ | ||
| 131 | 131 | ||
| 132 | public void syncCarPark(){ | 132 | public void syncCarPark(){ |
| 133 | try { | 133 | try { |
| 134 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource()); | ||
| 134 | String sql2 = "select *,ST_AsText(b_park_point) b_park_point_wkt,ST_AsText(g_park_point) g_park_point_wkt from common_bus_park"; | 135 | String sql2 = "select *,ST_AsText(b_park_point) b_park_point_wkt,ST_AsText(g_park_point) g_park_point_wkt from common_bus_park"; |
| 135 | List<BusPark> list2 = jdbcTemp.query(sql2, new BeanPropertyRowMapper(BusPark.class)); | 136 | List<BusPark> list2 = jdbcTemp.query(sql2, new BeanPropertyRowMapper(BusPark.class)); |
| 136 | List<CarPark> carParks=BusPark.convert(list2); | 137 | List<CarPark> carParks=BusPark.convert(list2); |
| @@ -150,6 +151,7 @@ public class SyncData extends Thread{ | @@ -150,6 +151,7 @@ public class SyncData extends Thread{ | ||
| 150 | 151 | ||
| 151 | public void syncLine(){ | 152 | public void syncLine(){ |
| 152 | try { | 153 | try { |
| 154 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource()); | ||
| 153 | String sql = "select * from common_bus_line_base"; | 155 | String sql = "select * from common_bus_line_base"; |
| 154 | List<BusLineBase> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusLineBase.class)); | 156 | List<BusLineBase> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusLineBase.class)); |
| 155 | List<Line> lines=BusLineBase.convert(list); | 157 | List<Line> lines=BusLineBase.convert(list); |
| @@ -200,6 +202,7 @@ public class SyncData extends Thread{ | @@ -200,6 +202,7 @@ public class SyncData extends Thread{ | ||
| 200 | 202 | ||
| 201 | public void syncLineInformation(){ | 203 | public void syncLineInformation(){ |
| 202 | try { | 204 | try { |
| 205 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource()); | ||
| 203 | String sql = "select * from common_bus_line_operations"; | 206 | String sql = "select * from common_bus_line_operations"; |
| 204 | List<BusLineOperations> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusLineOperations.class)); | 207 | List<BusLineOperations> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusLineOperations.class)); |
| 205 | List<LineInformation> lineInformations=BusLineOperations.convert(list); | 208 | List<LineInformation> lineInformations=BusLineOperations.convert(list); |
| @@ -219,6 +222,7 @@ public class SyncData extends Thread{ | @@ -219,6 +222,7 @@ public class SyncData extends Thread{ | ||
| 219 | 222 | ||
| 220 | public void syncCar(){ | 223 | public void syncCar(){ |
| 221 | try { | 224 | try { |
| 225 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource()); | ||
| 222 | String sql = "select * from common_bus_veh"; | 226 | String sql = "select * from common_bus_veh"; |
| 223 | List<BusVeh> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusVeh.class)); | 227 | List<BusVeh> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusVeh.class)); |
| 224 | List<Cars> cars=BusVeh.convert(list); | 228 | List<Cars> cars=BusVeh.convert(list); |
| @@ -238,6 +242,7 @@ public class SyncData extends Thread{ | @@ -238,6 +242,7 @@ public class SyncData extends Thread{ | ||
| 238 | 242 | ||
| 239 | public void syncPersonnel(){ | 243 | public void syncPersonnel(){ |
| 240 | try { | 244 | try { |
| 245 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource()); | ||
| 241 | String sql = "select * from common_bus_staff"; | 246 | String sql = "select * from common_bus_staff"; |
| 242 | List<BusStaff> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusStaff.class)); | 247 | List<BusStaff> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusStaff.class)); |
| 243 | List<Personnel> personnels=BusStaff.convert(list); | 248 | List<Personnel> personnels=BusStaff.convert(list); |
| @@ -257,6 +262,7 @@ public class SyncData extends Thread{ | @@ -257,6 +262,7 @@ public class SyncData extends Thread{ | ||
| 257 | 262 | ||
| 258 | public void syncStation(){ | 263 | public void syncStation(){ |
| 259 | try { | 264 | try { |
| 265 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource()); | ||
| 260 | String sql = "select *,ST_AsText(center_point) center_point_wkt from common_bus_stop"; | 266 | String sql = "select *,ST_AsText(center_point) center_point_wkt from common_bus_stop"; |
| 261 | List<BusStop> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusStop.class)); | 267 | List<BusStop> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusStop.class)); |
| 262 | List<Station> stations=BusStop.convert(list); | 268 | List<Station> stations=BusStop.convert(list); |
| @@ -277,6 +283,7 @@ public class SyncData extends Thread{ | @@ -277,6 +283,7 @@ public class SyncData extends Thread{ | ||
| 277 | 283 | ||
| 278 | public void syncStationRoute(){ | 284 | public void syncStationRoute(){ |
| 279 | try { | 285 | try { |
| 286 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource()); | ||
| 280 | String sql = "select *,ST_AsText(center_point) center_point_wkt,ST_AsText(buffer_polygon) buffer_polygon_wkt from common_bus_stoplevel"; | 287 | String sql = "select *,ST_AsText(center_point) center_point_wkt,ST_AsText(buffer_polygon) buffer_polygon_wkt from common_bus_stoplevel"; |
| 281 | List<BusStopLevel> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusStopLevel.class)); | 288 | List<BusStopLevel> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusStopLevel.class)); |
| 282 | List<StationRoute> stationRoutes=BusStopLevel.convert(list); | 289 | List<StationRoute> stationRoutes=BusStopLevel.convert(list); |
| @@ -296,6 +303,7 @@ public class SyncData extends Thread{ | @@ -296,6 +303,7 @@ public class SyncData extends Thread{ | ||
| 296 | 303 | ||
| 297 | private void syncSection(){ | 304 | private void syncSection(){ |
| 298 | try { | 305 | try { |
| 306 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource()); | ||
| 299 | String sql = "select *,ST_AsText(bsection_vector) bsectionVectorWkt from common_road_section"; | 307 | String sql = "select *,ST_AsText(bsection_vector) bsectionVectorWkt from common_road_section"; |
| 300 | List<RoadSection> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(RoadSection.class)); | 308 | List<RoadSection> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(RoadSection.class)); |
| 301 | List<Section> sections=RoadSection.convert(list); | 309 | List<Section> sections=RoadSection.convert(list); |
| @@ -315,6 +323,7 @@ public class SyncData extends Thread{ | @@ -315,6 +323,7 @@ public class SyncData extends Thread{ | ||
| 315 | 323 | ||
| 316 | private void syncSectionRoute(){ | 324 | private void syncSectionRoute(){ |
| 317 | try { | 325 | try { |
| 326 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource()); | ||
| 318 | String sql = "select * from common_road_sectionlevel where destroy=0"; | 327 | String sql = "select * from common_road_sectionlevel where destroy=0"; |
| 319 | List<RoadSectionLevel> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(RoadSectionLevel.class)); | 328 | List<RoadSectionLevel> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(RoadSectionLevel.class)); |
| 320 | List<SectionRoute> sectionRoutes=RoadSectionLevel.convert(list); | 329 | List<SectionRoute> sectionRoutes=RoadSectionLevel.convert(list); |
src/main/java/com/bsth/data/forecast/ArrivalDataLoader.java
| @@ -4,6 +4,7 @@ import com.bsth.data.BasicData; | @@ -4,6 +4,7 @@ import com.bsth.data.BasicData; | ||
| 4 | import com.bsth.data.LineConfigData; | 4 | import com.bsth.data.LineConfigData; |
| 5 | import com.bsth.data.forecast.entity.ArrivalEntity; | 5 | import com.bsth.data.forecast.entity.ArrivalEntity; |
| 6 | import com.bsth.util.db.DBUtils_MS; | 6 | import com.bsth.util.db.DBUtils_MS; |
| 7 | +import org.joda.time.DateTime; | ||
| 7 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -145,24 +146,32 @@ public class ArrivalDataLoader { | @@ -145,24 +146,32 @@ public class ArrivalDataLoader { | ||
| 145 | * @Description: TODO(根据线路,走向和时间戳加载数据) | 146 | * @Description: TODO(根据线路,走向和时间戳加载数据) |
| 146 | */ | 147 | */ |
| 147 | public List<ArrivalEntity> loadByLineAndTime(String lineCode, int updown, long st, long et){ | 148 | public List<ArrivalEntity> loadByLineAndTime(String lineCode, int updown, long st, long et){ |
| 149 | + DateTime start = new DateTime(st), end = new DateTime(et); | ||
| 150 | + if (start.getYear() != end.getYear()) { | ||
| 151 | + throw new IllegalArgumentException("请选择同一年"); | ||
| 152 | + } | ||
| 153 | + if (et - st > 14 * 24 * 60 * 60 * 1000) { | ||
| 154 | + throw new IllegalArgumentException("时间区间过长"); | ||
| 155 | + } | ||
| 148 | Calendar cal = Calendar.getInstance(); | 156 | Calendar cal = Calendar.getInstance(); |
| 149 | cal.setTimeInMillis(st); | 157 | cal.setTimeInMillis(st); |
| 150 | - int weeks_year = cal.get(Calendar.WEEK_OF_YEAR); | 158 | + int weeksYear1 = cal.get(Calendar.WEEK_OF_YEAR), weeksYear2 = cal.get(Calendar.WEEK_OF_YEAR); |
| 151 | 159 | ||
| 152 | Connection conn = null; | 160 | Connection conn = null; |
| 153 | PreparedStatement ps = null; | 161 | PreparedStatement ps = null; |
| 154 | ResultSet rs = null; | 162 | ResultSet rs = null; |
| 155 | 163 | ||
| 156 | List<ArrivalEntity> list = new ArrayList<>(); | 164 | List<ArrivalEntity> list = new ArrayList<>(); |
| 157 | - String sql = "select * from bsth_c_arrival_info where weeks_year=? and line_id=? and up_down=? and in_out=0 AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by ts"; | 165 | + String sql = "select * from bsth_c_arrival_info_" + start.getYear() + " where weeks_year in (?, ?) and line_id=? and up_down=? and in_out=0 AND create_timestamp BETWEEN ? AND ? AND ABS(create_timestamp - ts) < 3600000 order by ts"; |
| 158 | try{ | 166 | try{ |
| 159 | conn = DBUtils_MS.getConnection(); | 167 | conn = DBUtils_MS.getConnection(); |
| 160 | ps = conn.prepareStatement(sql); | 168 | ps = conn.prepareStatement(sql); |
| 161 | - ps.setInt(1, weeks_year); | ||
| 162 | - ps.setString(2, lineCode); | ||
| 163 | - ps.setInt(3, updown); | ||
| 164 | - ps.setLong(4, st); | ||
| 165 | - ps.setLong(5, et); | 169 | + ps.setInt(1, weeksYear1); |
| 170 | + ps.setInt(2, weeksYear2); | ||
| 171 | + ps.setString(3, lineCode); | ||
| 172 | + ps.setInt(4, updown); | ||
| 173 | + ps.setLong(5, st); | ||
| 174 | + ps.setLong(6, et); | ||
| 166 | rs = ps.executeQuery(); | 175 | rs = ps.executeQuery(); |
| 167 | 176 | ||
| 168 | list = resultSet2Set(rs); | 177 | list = resultSet2Set(rs); |
src/main/java/com/bsth/service/schedule/datasync/VehicleDataSyncTaskServiceImpl.java
| @@ -46,7 +46,7 @@ public class VehicleDataSyncTaskServiceImpl extends BServiceImpl<VehicleDataSync | @@ -46,7 +46,7 @@ public class VehicleDataSyncTaskServiceImpl extends BServiceImpl<VehicleDataSync | ||
| 46 | /** bean是否销毁(用于优雅退出) */ | 46 | /** bean是否销毁(用于优雅退出) */ |
| 47 | private volatile boolean beanDestroy = false; | 47 | private volatile boolean beanDestroy = false; |
| 48 | 48 | ||
| 49 | - @PostConstruct | 49 | + //@PostConstruct |
| 50 | public void init() { | 50 | public void init() { |
| 51 | LOG.info("车辆数据同步服务启动!"); | 51 | LOG.info("车辆数据同步服务启动!"); |
| 52 | // 创建队列,指定长度100 | 52 | // 创建队列,指定长度100 |
src/main/java/com/bsth/service/sys/SysUserService.java
| @@ -27,4 +27,6 @@ public interface SysUserService extends BaseService<SysUser, Integer>{ | @@ -27,4 +27,6 @@ public interface SysUserService extends BaseService<SysUser, Integer>{ | ||
| 27 | Map<String, Object> resetPassword(Integer id, Integer pwdValidPeriod); | 27 | Map<String, Object> resetPassword(Integer id, Integer pwdValidPeriod); |
| 28 | 28 | ||
| 29 | void recordLoginDate(String userName); | 29 | void recordLoginDate(String userName); |
| 30 | + | ||
| 31 | + Map<String, Object> createUser(SysUser u); | ||
| 30 | } | 32 | } |
src/main/java/com/bsth/service/sys/impl/SysUserServiceImpl.java
| @@ -5,6 +5,7 @@ import com.bsth.controller.sys.util.RSAUtils; | @@ -5,6 +5,7 @@ import com.bsth.controller.sys.util.RSAUtils; | ||
| 5 | import com.bsth.email.entity.EmailBean; | 5 | import com.bsth.email.entity.EmailBean; |
| 6 | import com.bsth.entity.sys.Role; | 6 | import com.bsth.entity.sys.Role; |
| 7 | import com.bsth.entity.sys.SysUser; | 7 | import com.bsth.entity.sys.SysUser; |
| 8 | +import com.bsth.repository.sys.RoleRepository; | ||
| 8 | import com.bsth.repository.sys.SysUserRepository; | 9 | import com.bsth.repository.sys.SysUserRepository; |
| 9 | import com.bsth.security.util.SecurityUtils; | 10 | import com.bsth.security.util.SecurityUtils; |
| 10 | import com.bsth.service.impl.BaseServiceImpl; | 11 | import com.bsth.service.impl.BaseServiceImpl; |
| @@ -23,11 +24,7 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | @@ -23,11 +24,7 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
| 23 | import org.springframework.stereotype.Service; | 24 | import org.springframework.stereotype.Service; |
| 24 | import org.springframework.transaction.annotation.Transactional; | 25 | import org.springframework.transaction.annotation.Transactional; |
| 25 | 26 | ||
| 26 | -import java.util.ArrayList; | ||
| 27 | -import java.util.HashMap; | ||
| 28 | -import java.util.Iterator; | ||
| 29 | -import java.util.List; | ||
| 30 | -import java.util.Map; | 27 | +import java.util.*; |
| 31 | 28 | ||
| 32 | @Service | 29 | @Service |
| 33 | public class SysUserServiceImpl extends BaseServiceImpl<SysUser, Integer> implements SysUserService{ | 30 | public class SysUserServiceImpl extends BaseServiceImpl<SysUser, Integer> implements SysUserService{ |
| @@ -42,6 +39,10 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUser, Integer> implem | @@ -42,6 +39,10 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUser, Integer> implem | ||
| 42 | @Autowired | 39 | @Autowired |
| 43 | private MailUtils mailUtils; | 40 | private MailUtils mailUtils; |
| 44 | 41 | ||
| 42 | + @Autowired | ||
| 43 | + RoleRepository roleRepository; | ||
| 44 | + | ||
| 45 | + | ||
| 45 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 46 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 46 | 47 | ||
| 47 | @Override | 48 | @Override |
| @@ -232,4 +233,37 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUser, Integer> implem | @@ -232,4 +233,37 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUser, Integer> implem | ||
| 232 | public void recordLoginDate(String userName) { | 233 | public void recordLoginDate(String userName) { |
| 233 | sysUserRepository.recordLoginDate(userName); | 234 | sysUserRepository.recordLoginDate(userName); |
| 234 | } | 235 | } |
| 236 | + | ||
| 237 | + @Override | ||
| 238 | + public Map<String, Object> createUser(SysUser u) { | ||
| 239 | + Map<String, Object> rs = new HashMap(); | ||
| 240 | + try { | ||
| 241 | + Role role=roleService.findById(136); | ||
| 242 | + if(role==null){ | ||
| 243 | + rs.put("status", ResponseCode.ERROR); | ||
| 244 | + rs.put("msg", "用户权限不够,请联系管理员!"); | ||
| 245 | + return rs; | ||
| 246 | + } | ||
| 247 | + Set<Role> roleSet=new HashSet<>(); | ||
| 248 | + roleSet.add(role); | ||
| 249 | + u.setRoles(roleSet); | ||
| 250 | + u.setUserName(u.getUserName()); | ||
| 251 | + u.setPassword("Bsth#1234"); | ||
| 252 | + u.setCreateDate(new Date()); | ||
| 253 | + u.setUpdateDate(new Date()); | ||
| 254 | + u.setLastPwdDate(new Date()); | ||
| 255 | + u.setPwdValidPeriod(9999); | ||
| 256 | + u.setAgencies("嘉定公交"); | ||
| 257 | + u.setEnabled(true); | ||
| 258 | + u.setPassword(new BCryptPasswordEncoder(4).encode(u.getPassword())); | ||
| 259 | + rs = super.save(u); | ||
| 260 | + logger.info("首次登陆创建用户:"+u.getUserName()); | ||
| 261 | + } catch (Exception e) { | ||
| 262 | + logger.error("", e); | ||
| 263 | + rs.put("status", ResponseCode.ERROR); | ||
| 264 | + rs.put("msg", e.getMessage()); | ||
| 265 | + } | ||
| 266 | + return rs; | ||
| 267 | + } | ||
| 268 | + | ||
| 235 | } | 269 | } |
src/main/resources/application-dev.properties
| 1 | server.port=9088 | 1 | server.port=9088 |
| 2 | 2 | ||
| 3 | -# dubbo服务化使用开关flag | 3 | +# dubbo\uFFFD\uFFFD\uFFFD\uFFFD\u02B9\uFFFD\u00FF\uFFFD\uFFFD\uFFFDflag |
| 4 | dubbo.use=false | 4 | dubbo.use=false |
| 5 | 5 | ||
| 6 | #JPA | 6 | #JPA |
| @@ -9,21 +9,17 @@ spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.Im | @@ -9,21 +9,17 @@ spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.Im | ||
| 9 | spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy | 9 | spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy |
| 10 | spring.jpa.database= MYSQL | 10 | spring.jpa.database= MYSQL |
| 11 | spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true | 11 | spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true |
| 12 | -spring.jpa.show-sql= true | 12 | +spring.jpa.show-sql= false |
| 13 | spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect | 13 | spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect |
| 14 | 14 | ||
| 15 | #DATABASE | 15 | #DATABASE |
| 16 | -spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 17 | -#spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 18 | -##spring.datasource.url= jdbc:mysql://192.168.168.222/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | 16 | +spring.datasource.driver-class-name= com.mysql.cj.jdbc.Driver |
| 17 | +#spring.datasource.url= jdbc:mysql://10.10.150.101/lg_control?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai | ||
| 19 | #spring.datasource.username= root | 18 | #spring.datasource.username= root |
| 20 | -#spring.datasource.password= | ||
| 21 | -spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 22 | -spring.datasource.username= root | ||
| 23 | -spring.datasource.password= root | ||
| 24 | -#spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 25 | -#spring.datasource.username= root | ||
| 26 | -#spring.datasource.password= root | 19 | +#spring.datasource.password= A123456ab |
| 20 | +spring.datasource.url= jdbc:mysql://192.168.9.210:3307/control?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai | ||
| 21 | +spring.datasource.username= tuohua | ||
| 22 | +spring.datasource.password= )eE6E5B- | ||
| 27 | spring.datasource.type= com.zaxxer.hikari.HikariDataSource | 23 | spring.datasource.type= com.zaxxer.hikari.HikariDataSource |
| 28 | 24 | ||
| 29 | #DATASOURCE SETTING | 25 | #DATASOURCE SETTING |
| @@ -40,9 +36,19 @@ spring.datasource.hikari.register-mbeans=true | @@ -40,9 +36,19 @@ spring.datasource.hikari.register-mbeans=true | ||
| 40 | 36 | ||
| 41 | sso.enabled= true | 37 | sso.enabled= true |
| 42 | sso.systemcode = SYSUS023 | 38 | sso.systemcode = SYSUS023 |
| 43 | -sso.http.url.login= http://10.10.200.142:9112/login?redirect=%2Findex | ||
| 44 | -sso.http.url.logout= http://10.10.200.142:9112/login?redirect=%2Findex | ||
| 45 | -sso.http.url.auth= http://10.10.200.142:9112/prod-api/system/utilitySystem/checkToken | 39 | +sso.http.url.login= http://192.168.9.71:8080/workbench |
| 40 | +sso.http.url.logout= http://192.168.9.71:9999/sso/logout | ||
| 41 | +sso.http.url.auth= http://192.168.9.71:9109/user-server/auth/getUserInfo | ||
| 42 | + | ||
| 43 | +dc.imgurl= /home/control/klimg | ||
| 44 | +dc.profile= profile | ||
| 45 | + | ||
| 46 | +baidu.ak=YIT2mnCsfWkpbYnlLLqJ18ravGLs3OJS | ||
| 47 | +passengerFlow.url = http://127.0.0.1:9999/images/ | ||
| 48 | +baidu.akyd=WnSDHZgtPbSbw2LfsH3KO3DDKWONmlYK | ||
| 49 | +electricity.importFile.path= E:/elecImportFile | ||
| 50 | + | ||
| 51 | +report_register.complaint.url= http://192.168.168.172:8080/complaint/TsReport/input.do | ||
| 46 | 52 | ||
| 47 | -path.speech.common = D:/speech/common/ | ||
| 48 | -path.speech.line = D:/speech/%s/ | ||
| 49 | \ No newline at end of file | 53 | \ No newline at end of file |
| 54 | +path.speech.common = /home/control/speech/common/ | ||
| 55 | +path.speech.line = /home/control/speech/%s/ | ||
| 50 | \ No newline at end of file | 56 | \ No newline at end of file |
src/main/resources/application-prod.properties
| @@ -13,10 +13,13 @@ spring.jpa.show-sql= false | @@ -13,10 +13,13 @@ spring.jpa.show-sql= false | ||
| 13 | spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect | 13 | spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect |
| 14 | 14 | ||
| 15 | #DATABASE | 15 | #DATABASE |
| 16 | -spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 17 | -spring.datasource.url= jdbc:mysql://10.10.150.103:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai | ||
| 18 | -spring.datasource.username= root | ||
| 19 | -spring.datasource.password= fsodlgjiuigAQF2$9fs9 | 16 | +#spring.datasource.driver-class-name= com.mysql.cj.jdbc.Driver |
| 17 | +#spring.datasource.url= jdbc:mysql://127.0.0.1/lg_control?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai | ||
| 18 | +#spring.datasource.username= root | ||
| 19 | +#spring.datasource.password= 123456 | ||
| 20 | +spring.datasource.url= jdbc:mysql://192.168.9.210:3307/control?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai | ||
| 21 | +spring.datasource.username= tuohua | ||
| 22 | +spring.datasource.password= )eE6E5B- | ||
| 20 | spring.datasource.type= com.zaxxer.hikari.HikariDataSource | 23 | spring.datasource.type= com.zaxxer.hikari.HikariDataSource |
| 21 | 24 | ||
| 22 | #DATASOURCE SETTING | 25 | #DATASOURCE SETTING |
| @@ -33,19 +36,19 @@ spring.datasource.hikari.register-mbeans=true | @@ -33,19 +36,19 @@ spring.datasource.hikari.register-mbeans=true | ||
| 33 | 36 | ||
| 34 | sso.enabled= true | 37 | sso.enabled= true |
| 35 | sso.systemcode = SYSUS023 | 38 | sso.systemcode = SYSUS023 |
| 36 | -sso.http.url.login= http://10.10.200.142:9112/login?redirect=%2Findex | ||
| 37 | -sso.http.url.logout= http://10.10.200.142:9112/login?redirect=%2Findex | ||
| 38 | -sso.http.url.auth= http://10.10.200.142:9112/prod-api/system/utilitySystem/checkToken | 39 | +sso.http.url.login= http://192.168.9.71:8080/workbench |
| 40 | +sso.http.url.logout= http://192.168.9.71:9999/sso/logout | ||
| 41 | +sso.http.url.auth= http://192.168.9.71:9109/user-server/auth/getUserInfo | ||
| 39 | 42 | ||
| 40 | dc.imgurl= /home/control/klimg | 43 | dc.imgurl= /home/control/klimg |
| 41 | dc.profile= profile | 44 | dc.profile= profile |
| 42 | 45 | ||
| 43 | -baidu.ak=AYiBOs3f9qBQFhdKFsaboX6CfObmKwRP | ||
| 44 | -passengerFlow.url = http://192.168.168.32:9999/images/ | ||
| 45 | - | ||
| 46 | -electricity.importFile.path= /home/control/elecImportFile | 46 | +baidu.ak=YIT2mnCsfWkpbYnlLLqJ18ravGLs3OJS |
| 47 | +passengerFlow.url = http://127.0.0.1:9999/images/ | ||
| 47 | baidu.akyd=WnSDHZgtPbSbw2LfsH3KO3DDKWONmlYK | 48 | baidu.akyd=WnSDHZgtPbSbw2LfsH3KO3DDKWONmlYK |
| 48 | -report_register.complaint.url= http://10.10.200.113:8060/complaint/TsReport/input.do | 49 | +electricity.importFile.path= E:/elecImportFile |
| 50 | + | ||
| 51 | +report_register.complaint.url= http://192.168.168.172:8080/complaint/TsReport/input.do | ||
| 49 | 52 | ||
| 50 | path.speech.common = /home/control/speech/common/ | 53 | path.speech.common = /home/control/speech/common/ |
| 51 | path.speech.line = /home/control/speech/%s/ | 54 | path.speech.line = /home/control/speech/%s/ |
src/main/resources/application-test.properties
| @@ -14,9 +14,9 @@ spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MyS | @@ -14,9 +14,9 @@ spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MyS | ||
| 14 | 14 | ||
| 15 | #DATABASE | 15 | #DATABASE |
| 16 | spring.datasource.driver-class-name= com.mysql.cj.jdbc.Driver | 16 | spring.datasource.driver-class-name= com.mysql.cj.jdbc.Driver |
| 17 | -spring.datasource.url= jdbc:mysql://10.10.150.101/lg_control?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai | 17 | +spring.datasource.url= jdbc:mysql://127.0.0.1/lg_control?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai |
| 18 | spring.datasource.username= root | 18 | spring.datasource.username= root |
| 19 | -spring.datasource.password= A123456ab | 19 | +spring.datasource.password= 123456 |
| 20 | spring.datasource.type= com.zaxxer.hikari.HikariDataSource | 20 | spring.datasource.type= com.zaxxer.hikari.HikariDataSource |
| 21 | 21 | ||
| 22 | #DATASOURCE SETTING | 22 | #DATASOURCE SETTING |
| @@ -33,14 +33,14 @@ spring.datasource.hikari.register-mbeans=true | @@ -33,14 +33,14 @@ spring.datasource.hikari.register-mbeans=true | ||
| 33 | 33 | ||
| 34 | sso.enabled= true | 34 | sso.enabled= true |
| 35 | sso.systemcode = SYSUS023 | 35 | sso.systemcode = SYSUS023 |
| 36 | -sso.http.url.login= http://10.10.200.142:9112/login?redirect=%2Findex | ||
| 37 | -sso.http.url.logout= http://10.10.200.142:9112/login?redirect=%2Findex | ||
| 38 | -sso.http.url.auth= http://10.10.200.142:9112/prod-api/system/utilitySystem/checkToken | 36 | +sso.http.url.login= http://192.168.9.71:8080/workbench |
| 37 | +sso.http.url.logout= http://192.168.9.71:9999/sso/logout | ||
| 38 | +sso.http.url.auth= http://192.168.9.71:9109/user-server/auth/getUserInfo | ||
| 39 | 39 | ||
| 40 | dc.imgurl= E:/klimg | 40 | dc.imgurl= E:/klimg |
| 41 | dc.profile= profile | 41 | dc.profile= profile |
| 42 | 42 | ||
| 43 | -baidu.ak=AYiBOs3f9qBQFhdKFsaboX6CfObmKwRP | 43 | +baidu.ak=YIT2mnCsfWkpbYnlLLqJ18ravGLs3OJS |
| 44 | passengerFlow.url = http://127.0.0.1:9999/images/ | 44 | passengerFlow.url = http://127.0.0.1:9999/images/ |
| 45 | baidu.akyd=WnSDHZgtPbSbw2LfsH3KO3DDKWONmlYK | 45 | baidu.akyd=WnSDHZgtPbSbw2LfsH3KO3DDKWONmlYK |
| 46 | electricity.importFile.path= E:/elecImportFile | 46 | electricity.importFile.path= E:/elecImportFile |
src/main/resources/application.properties
src/main/resources/fatso/handle_real_ctl.js
| @@ -34,9 +34,7 @@ var realCtl = { | @@ -34,9 +34,7 @@ var realCtl = { | ||
| 34 | //处理main.html | 34 | //处理main.html |
| 35 | var data = fs.readFileSync(mainFile, 'utf-8'), | 35 | var data = fs.readFileSync(mainFile, 'utf-8'), |
| 36 | $ = cheerio.load(data); | 36 | $ = cheerio.load(data); |
| 37 | - handleCss($, function () { | ||
| 38 | - handleJs($, mainFile, cb); | ||
| 39 | - }); | 37 | + handleJs($, mainFile, cb); |
| 40 | 38 | ||
| 41 | 39 | ||
| 42 | }, | 40 | }, |
| @@ -49,9 +47,7 @@ var realCtl = { | @@ -49,9 +47,7 @@ var realCtl = { | ||
| 49 | var data = fs.readFileSync(mapFile, 'utf-8') | 47 | var data = fs.readFileSync(mapFile, 'utf-8') |
| 50 | , $ = cheerio.load(data); | 48 | , $ = cheerio.load(data); |
| 51 | 49 | ||
| 52 | - handleCss($, function () { | ||
| 53 | - handleJs($, mapFile, cb); | ||
| 54 | - }); | 50 | + handleJs($, mapFile, cb); |
| 55 | }, | 51 | }, |
| 56 | /** | 52 | /** |
| 57 | * 处理单屏地图页面 | 53 | * 处理单屏地图页面 |
| @@ -60,9 +56,7 @@ var realCtl = { | @@ -60,9 +56,7 @@ var realCtl = { | ||
| 60 | handleAlonePage: function (cb) { | 56 | handleAlonePage: function (cb) { |
| 61 | var data = fs.readFileSync(aloneMapWrapFile, 'utf-8'); | 57 | var data = fs.readFileSync(aloneMapWrapFile, 'utf-8'); |
| 62 | var $ = cheerio.load(data); | 58 | var $ = cheerio.load(data); |
| 63 | - handleCss($, function () { | ||
| 64 | - handleJs($, aloneMapWrapFile, cb); | ||
| 65 | - }); | 59 | + handleJs($, aloneMapWrapFile, cb); |
| 66 | }, | 60 | }, |
| 67 | /** | 61 | /** |
| 68 | * 处理单屏主页 | 62 | * 处理单屏主页 |
| @@ -71,9 +65,7 @@ var realCtl = { | @@ -71,9 +65,7 @@ var realCtl = { | ||
| 71 | handleAloneHomePage: function (cb) { | 65 | handleAloneHomePage: function (cb) { |
| 72 | var data = fs.readFileSync(aloneHomeWrapFile, 'utf-8'); | 66 | var data = fs.readFileSync(aloneHomeWrapFile, 'utf-8'); |
| 73 | var $ = cheerio.load(data); | 67 | var $ = cheerio.load(data); |
| 74 | - handleCss($, function () { | ||
| 75 | - handleJs($, aloneHomeWrapFile, cb); | ||
| 76 | - }); | 68 | + handleJs($, aloneHomeWrapFile, cb); |
| 77 | } | 69 | } |
| 78 | 70 | ||
| 79 | }; | 71 | }; |
src/main/resources/fatso/start.js
| @@ -16,7 +16,7 @@ var platform = process.platform; | @@ -16,7 +16,7 @@ var platform = process.platform; | ||
| 16 | var iswin = platform == 'win32'; | 16 | var iswin = platform == 'win32'; |
| 17 | var sp = platform == 'win32' ? '\\' : '/'; | 17 | var sp = platform == 'win32' ? '\\' : '/'; |
| 18 | //不参与的目录 | 18 | //不参与的目录 |
| 19 | -var excludes = ['scheduleApp', 'trafficManage', 'control', 'permission' + sp + 'authorize_all','permission' + sp + 'user', 'summary', 'history_sch', 'report' + sp + 'oil', 'base' + sp + 'geo_data_edit', 'base' + sp + 'carpark', 'forms', 'mforms', 'report', 'punctual', 'base' + sp + 'timesmodel', 'base' + sp + 'stationroute'] | 19 | +var excludes = ['scheduleApp', 'trafficManage', 'control', 'permission' + sp + 'authorize_all','permission' + sp + 'user', 'summary', 'history_sch', 'report' + sp + 'oil', 'base' + sp + 'geo_data_edit', 'base' + sp + 'carpark', 'forms', 'mforms', 'report', 'punctual', 'base' + sp + 'timesmodel', 'base' + sp + 'stationroute','zndd_yuan','call','base' + sp + 'region',] |
| 20 | , ep = new EventProxy() | 20 | , ep = new EventProxy() |
| 21 | , pName = 'bsth_control' | 21 | , pName = 'bsth_control' |
| 22 | , path = process.cwd() | 22 | , path = process.cwd() |
src/main/resources/jiaDingBus-jdbc.properties
| 1 | jiaDingBus.mysql.driver= com.mysql.jdbc.Driver | 1 | jiaDingBus.mysql.driver= com.mysql.jdbc.Driver |
| 2 | -jiaDingBus.mysql.url= jdbc:mysql://127.0.0.1/jiading_bus?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai | ||
| 3 | -jiaDingBus.mysql.username= root | ||
| 4 | -jiaDingBus.mysql.password= 123456 | ||
| 5 | \ No newline at end of file | 2 | \ No newline at end of file |
| 3 | +#jiaDingBus.mysql.url= jdbc:mysql://127.0.0.1/jiading_bus?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai | ||
| 4 | +#jiaDingBus.mysql.username= root | ||
| 5 | +#jiaDingBus.mysql.password= 123456 | ||
| 6 | +jiaDingBus.mysql.url= jdbc:mysql://192.168.9.210:3307/jiading_bus?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai | ||
| 7 | +jiaDingBus.mysql.username= tuohua | ||
| 8 | +jiaDingBus.mysql.password= )eE6E5B- | ||
| 6 | \ No newline at end of file | 9 | \ No newline at end of file |
src/main/resources/ms-jdbc.properties
| @@ -4,6 +4,9 @@ | @@ -4,6 +4,9 @@ | ||
| 4 | #ms.mysql.password= 123456 | 4 | #ms.mysql.password= 123456 |
| 5 | 5 | ||
| 6 | ms.mysql.driver= com.mysql.jdbc.Driver | 6 | ms.mysql.driver= com.mysql.jdbc.Driver |
| 7 | -ms.mysql.url= jdbc:mysql://10.10.150.103/ms?useUnicode=true&characterEncoding=utf-8 | ||
| 8 | -ms.mysql.username= root | ||
| 9 | -ms.mysql.password= fsodlgjiuigAQF2$9fs9 | ||
| 10 | \ No newline at end of file | 7 | \ No newline at end of file |
| 8 | +#ms.mysql.url= jdbc:mysql://127.0.0.1/ms?useUnicode=true&characterEncoding=utf-8 | ||
| 9 | +#ms.mysql.username= root | ||
| 10 | +#ms.mysql.password= 123456 | ||
| 11 | +ms.mysql.url= jdbc:mysql://192.168.9.210:3307/ms?useUnicode=true&characterEncoding=utf-8 | ||
| 12 | +ms.mysql.username= tuohua | ||
| 13 | +ms.mysql.password= )eE6E5B- | ||
| 11 | \ No newline at end of file | 14 | \ No newline at end of file |
src/main/resources/static/index.html
| @@ -579,7 +579,25 @@ | @@ -579,7 +579,25 @@ | ||
| 579 | function setTitle(menuItem){ | 579 | function setTitle(menuItem){ |
| 580 | document.title = $('span.title', menuItem).text(); | 580 | document.title = $('span.title', menuItem).text(); |
| 581 | } | 581 | } |
| 582 | - getCSS(); | 582 | + if(window.localStorage.getItem('system_style')=='dark'){ |
| 583 | + var elements = document.getElementsByName("default"); | ||
| 584 | + for (var i = 0; i < elements.length; i++) { | ||
| 585 | + elements[i].disabled = true; | ||
| 586 | + } | ||
| 587 | + elements = document.getElementsByName("dark"); | ||
| 588 | + for (var i = 0; i < elements.length; i++) { | ||
| 589 | + elements[i].disabled = false; | ||
| 590 | + } | ||
| 591 | + }else { | ||
| 592 | + var elements = document.getElementsByName("dark"); | ||
| 593 | + for (var i = 0; i < elements.length; i++) { | ||
| 594 | + elements[i].disabled = true; | ||
| 595 | + } | ||
| 596 | + elements = document.getElementsByName("default"); | ||
| 597 | + for (var i = 0; i < elements.length; i++) { | ||
| 598 | + elements[i].disabled = false; | ||
| 599 | + } | ||
| 600 | + } | ||
| 583 | //切换主题 | 601 | //切换主题 |
| 584 | $('#changeStyle').on('click', function () { | 602 | $('#changeStyle').on('click', function () { |
| 585 | if(window.localStorage.getItem('system_style')=='dark'){ | 603 | if(window.localStorage.getItem('system_style')=='dark'){ |
src/main/resources/traffic-jdbc.properties
| 1 | -#ms.mysql.driver= com.mysql.jdbc.Driver | ||
| 2 | -#ms.mysql.url= jdbc:mysql://127.0.0.1/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | 1 | +ms.mysql.driver= com.mysql.jdbc.Driver |
| 2 | +#ms.mysql.url= jdbc:mysql://127.0.0.1/ms?useUnicode=true&characterEncoding=utf-8 | ||
| 3 | #ms.mysql.username= root | 3 | #ms.mysql.username= root |
| 4 | #ms.mysql.password= 123456 | 4 | #ms.mysql.password= 123456 |
| 5 | - | ||
| 6 | -ms.mysql.driver= com.mysql.jdbc.Driver | ||
| 7 | -ms.mysql.url= jdbc:mysql://10.10.150.103/ms?useUnicode=true&characterEncoding=utf-8 | ||
| 8 | -ms.mysql.username= root | ||
| 9 | -ms.mysql.password= fsodlgjiuigAQF2$9fs9 | ||
| 10 | \ No newline at end of file | 5 | \ No newline at end of file |
| 6 | +ms.mysql.url= jdbc:mysql://192.168.9.210:3307/ms?useUnicode=true&characterEncoding=utf-8 | ||
| 7 | +ms.mysql.username= tuohua | ||
| 8 | +ms.mysql.password= )eE6E5B- | ||
| 11 | \ No newline at end of file | 9 | \ No newline at end of file |