Commit fb672d594b776cf7cce4241759cef2f6b4c26a1c

Authored by yiming
1 parent 99e42dcd

接入统一登陆平台

... ... @@ -464,6 +464,12 @@
464 464 <version>4.3.2-1.5.5</version>
465 465 <classifier>${javacpp.platform}</classifier>
466 466 </dependency>
  467 +
  468 + <dependency>
  469 + <groupId>cn.hutool</groupId>
  470 + <artifactId>hutool-all</artifactId>
  471 + <version>4.6.3</version>
  472 + </dependency>
467 473 </dependencies>
468 474  
469 475 <dependencyManagement>
... ...
src/main/java/com/bsth/XDApplication.java
... ... @@ -187,10 +187,10 @@ public class XDApplication implements CommandLineRunner {
187 187 //log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处");
188 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 196 //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS);
... ... @@ -201,12 +201,12 @@ public class XDApplication implements CommandLineRunner {
201 201 ScheduledExecutorService sexec = Application.mainServices;
202 202  
203 203  
204   - //安全驾驶
  204 +/* //安全驾驶
205 205 sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS);
206 206 //智能调度
207 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 211 //sexec.scheduleWithFixedDelay(orderListThread, 120, 60 * 30, TimeUnit.SECONDS);
212 212 GpsDataLoaderThread.setFlag(-1);
... ... @@ -236,12 +236,12 @@ public class XDApplication implements CommandLineRunner {
236 236  
237 237 //运管处静态数据提交
238 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 247 //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS);
... ... @@ -251,14 +251,14 @@ public class XDApplication implements CommandLineRunner {
251 251 log.info("testInit...");
252 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 257 sexec.scheduleWithFixedDelay(znddThread, 30, 30, TimeUnit.SECONDS);
258 258 //智能调度
259 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 263 GpsDataLoaderThread.setFlag(-1);
264 264 //dayOfSchedule.dataRecovery();
... ... @@ -290,10 +290,10 @@ public class XDApplication implements CommandLineRunner {
290 290 //log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处");
291 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 299 //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS);
... ... @@ -334,12 +334,12 @@ public class XDApplication implements CommandLineRunner {
334 334  
335 335 //运管处静态数据提交
336 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 345 //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS);
... ...
src/main/java/com/bsth/controller/sys/UserController.java
1 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 6 import com.bsth.common.Constants;
4 7 import com.bsth.common.ResponseCode;
5 8 import com.bsth.controller.BaseController;
... ... @@ -12,7 +15,6 @@ import com.bsth.security.SsoConfig;
12 15 import com.bsth.security.util.SecurityUtils;
13 16 import com.bsth.service.sys.CompanyAuthorityService;
14 17 import com.bsth.service.sys.SysUserService;
15   -import com.bsth.util.HttpClientUtils;
16 18 import com.fasterxml.jackson.databind.ObjectMapper;
17 19 import com.google.common.collect.ArrayListMultimap;
18 20 import org.apache.commons.lang3.StringUtils;
... ... @@ -25,7 +27,6 @@ import org.springframework.beans.factory.annotation.Autowired;
25 27 import org.springframework.security.authentication.BadCredentialsException;
26 28 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
27 29 import org.springframework.security.web.authentication.session.SessionAuthenticationException;
28   -import org.springframework.util.Assert;
29 30 import org.springframework.web.bind.annotation.RequestMapping;
30 31 import org.springframework.web.bind.annotation.RequestMethod;
31 32 import org.springframework.web.bind.annotation.RequestParam;
... ... @@ -76,54 +77,70 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; {
76 77 public static Map<String, Long> USER_LOCKTIME = new HashMap<>();
77 78  
78 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 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 138 HttpSession session = request.getSession();
122 139 // 登录
123 140 SecurityUtils.login(sysUser, request);
124 141 sysUserService.recordLoginDate(sysUser.getUserName());
125 142 //session里写入用户名,webSocket连接时标识身份用
126   - session.setAttribute(Constants.SSO_TOKEN, token);
  143 + session.setAttribute(Constants.SSO_TOKEN, satoken);
127 144 session.setAttribute(Constants.SESSION_USERNAME, sysUser.getUserName());
128 145 //session.setAttribute(Constants.RESOURCE_AUTHORITYS, sysUser.getLinks());
129 146 //获取公司权限数据
... ... @@ -131,10 +148,12 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; {
131 148 session.setAttribute(Constants.COMPANY_AUTHORITYS, cmyAuths);
132 149  
133 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 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 26  
27 27 Logger logger = LoggerFactory.getLogger(this.getClass());
28 28  
29   - JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource());
  29 +
30 30  
31 31 @Autowired
32 32 private BusinessService businessService;
... ... @@ -92,7 +92,6 @@ public class SyncData extends Thread{
92 92 BasicData.BasicDataLoader basicDataLoader;
93 93  
94 94 @Scheduled(cron = "0 1 * * * ?")
95   - @Transactional()
96 95 public void SyncData(){
97 96 syncBusiness();
98 97 syncCarPark();
... ... @@ -112,6 +111,7 @@ public class SyncData extends Thread{
112 111  
113 112 public void syncBusiness(){
114 113 try {
  114 + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource());
115 115 String sql = "select * from common_bus_company";
116 116 List<BusCompany> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusCompany.class));
117 117 List<Business> businesses=BusCompany.convert(list);
... ... @@ -131,6 +131,7 @@ public class SyncData extends Thread{
131 131  
132 132 public void syncCarPark(){
133 133 try {
  134 + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource());
134 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 136 List<BusPark> list2 = jdbcTemp.query(sql2, new BeanPropertyRowMapper(BusPark.class));
136 137 List<CarPark> carParks=BusPark.convert(list2);
... ... @@ -150,6 +151,7 @@ public class SyncData extends Thread{
150 151  
151 152 public void syncLine(){
152 153 try {
  154 + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource());
153 155 String sql = "select * from common_bus_line_base";
154 156 List<BusLineBase> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusLineBase.class));
155 157 List<Line> lines=BusLineBase.convert(list);
... ... @@ -200,6 +202,7 @@ public class SyncData extends Thread{
200 202  
201 203 public void syncLineInformation(){
202 204 try {
  205 + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource());
203 206 String sql = "select * from common_bus_line_operations";
204 207 List<BusLineOperations> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusLineOperations.class));
205 208 List<LineInformation> lineInformations=BusLineOperations.convert(list);
... ... @@ -219,6 +222,7 @@ public class SyncData extends Thread{
219 222  
220 223 public void syncCar(){
221 224 try {
  225 + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource());
222 226 String sql = "select * from common_bus_veh";
223 227 List<BusVeh> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusVeh.class));
224 228 List<Cars> cars=BusVeh.convert(list);
... ... @@ -238,6 +242,7 @@ public class SyncData extends Thread{
238 242  
239 243 public void syncPersonnel(){
240 244 try {
  245 + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource());
241 246 String sql = "select * from common_bus_staff";
242 247 List<BusStaff> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusStaff.class));
243 248 List<Personnel> personnels=BusStaff.convert(list);
... ... @@ -257,6 +262,7 @@ public class SyncData extends Thread{
257 262  
258 263 public void syncStation(){
259 264 try {
  265 + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource());
260 266 String sql = "select *,ST_AsText(center_point) center_point_wkt from common_bus_stop";
261 267 List<BusStop> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusStop.class));
262 268 List<Station> stations=BusStop.convert(list);
... ... @@ -277,6 +283,7 @@ public class SyncData extends Thread{
277 283  
278 284 public void syncStationRoute(){
279 285 try {
  286 + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource());
280 287 String sql = "select *,ST_AsText(center_point) center_point_wkt,ST_AsText(buffer_polygon) buffer_polygon_wkt from common_bus_stoplevel";
281 288 List<BusStopLevel> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(BusStopLevel.class));
282 289 List<StationRoute> stationRoutes=BusStopLevel.convert(list);
... ... @@ -296,6 +303,7 @@ public class SyncData extends Thread{
296 303  
297 304 private void syncSection(){
298 305 try {
  306 + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource());
299 307 String sql = "select *,ST_AsText(bsection_vector) bsectionVectorWkt from common_road_section";
300 308 List<RoadSection> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(RoadSection.class));
301 309 List<Section> sections=RoadSection.convert(list);
... ... @@ -315,6 +323,7 @@ public class SyncData extends Thread{
315 323  
316 324 private void syncSectionRoute(){
317 325 try {
  326 + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_jiaDingBus.getDataSource());
318 327 String sql = "select * from common_road_sectionlevel where destroy=0";
319 328 List<RoadSectionLevel> list = jdbcTemp.query(sql, new BeanPropertyRowMapper(RoadSectionLevel.class));
320 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 4 import com.bsth.data.LineConfigData;
5 5 import com.bsth.data.forecast.entity.ArrivalEntity;
6 6 import com.bsth.util.db.DBUtils_MS;
  7 +import org.joda.time.DateTime;
7 8 import org.slf4j.Logger;
8 9 import org.slf4j.LoggerFactory;
9 10 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -145,24 +146,32 @@ public class ArrivalDataLoader {
145 146 * @Description: TODO(根据线路,走向和时间戳加载数据)
146 147 */
147 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 156 Calendar cal = Calendar.getInstance();
149 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 160 Connection conn = null;
153 161 PreparedStatement ps = null;
154 162 ResultSet rs = null;
155 163  
156 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 166 try{
159 167 conn = DBUtils_MS.getConnection();
160 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 175 rs = ps.executeQuery();
167 176  
168 177 list = resultSet2Set(rs);
... ...
src/main/java/com/bsth/service/schedule/datasync/VehicleDataSyncTaskServiceImpl.java
... ... @@ -46,7 +46,7 @@ public class VehicleDataSyncTaskServiceImpl extends BServiceImpl&lt;VehicleDataSync
46 46 /** bean是否销毁(用于优雅退出) */
47 47 private volatile boolean beanDestroy = false;
48 48  
49   - @PostConstruct
  49 + //@PostConstruct
50 50 public void init() {
51 51 LOG.info("车辆数据同步服务启动!");
52 52 // 创建队列,指定长度100
... ...
src/main/java/com/bsth/service/sys/SysUserService.java
... ... @@ -27,4 +27,6 @@ public interface SysUserService extends BaseService&lt;SysUser, Integer&gt;{
27 27 Map<String, Object> resetPassword(Integer id, Integer pwdValidPeriod);
28 28  
29 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 5 import com.bsth.email.entity.EmailBean;
6 6 import com.bsth.entity.sys.Role;
7 7 import com.bsth.entity.sys.SysUser;
  8 +import com.bsth.repository.sys.RoleRepository;
8 9 import com.bsth.repository.sys.SysUserRepository;
9 10 import com.bsth.security.util.SecurityUtils;
10 11 import com.bsth.service.impl.BaseServiceImpl;
... ... @@ -23,11 +24,7 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
23 24 import org.springframework.stereotype.Service;
24 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 29 @Service
33 30 public class SysUserServiceImpl extends BaseServiceImpl<SysUser, Integer> implements SysUserService{
... ... @@ -42,6 +39,10 @@ public class SysUserServiceImpl extends BaseServiceImpl&lt;SysUser, Integer&gt; implem
42 39 @Autowired
43 40 private MailUtils mailUtils;
44 41  
  42 + @Autowired
  43 + RoleRepository roleRepository;
  44 +
  45 +
45 46 Logger logger = LoggerFactory.getLogger(this.getClass());
46 47  
47 48 @Override
... ... @@ -232,4 +233,37 @@ public class SysUserServiceImpl extends BaseServiceImpl&lt;SysUser, Integer&gt; implem
232 233 public void recordLoginDate(String userName) {
233 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 1 server.port=9088
2 2  
3   -# dubbo服务化使用开关flag
  3 +# dubbo\uFFFD\uFFFD\uFFFD\uFFFD\u02B9\uFFFD\u00FF\uFFFD\uFFFD\uFFFDflag
4 4 dubbo.use=false
5 5  
6 6 #JPA
... ... @@ -9,21 +9,17 @@ spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.Im
9 9 spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
10 10 spring.jpa.database= MYSQL
11 11 spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
12   -spring.jpa.show-sql= true
  12 +spring.jpa.show-sql= false
13 13 spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect
14 14  
15 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 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 23 spring.datasource.type= com.zaxxer.hikari.HikariDataSource
28 24  
29 25 #DATASOURCE SETTING
... ... @@ -40,9 +36,19 @@ spring.datasource.hikari.register-mbeans=true
40 36  
41 37 sso.enabled= true
42 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 53 \ No newline at end of file
  54 +path.speech.common = /home/control/speech/common/
  55 +path.speech.line = /home/control/speech/%s/
50 56 \ No newline at end of file
... ...
src/main/resources/application-prod.properties
... ... @@ -13,10 +13,13 @@ spring.jpa.show-sql= false
13 13 spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect
14 14  
15 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 23 spring.datasource.type= com.zaxxer.hikari.HikariDataSource
21 24  
22 25 #DATASOURCE SETTING
... ... @@ -33,19 +36,19 @@ spring.datasource.hikari.register-mbeans=true
33 36  
34 37 sso.enabled= true
35 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 43 dc.imgurl= /home/control/klimg
41 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 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 53 path.speech.common = /home/control/speech/common/
51 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 14  
15 15 #DATABASE
16 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 18 spring.datasource.username= root
19   -spring.datasource.password= A123456ab
  19 +spring.datasource.password= 123456
20 20 spring.datasource.type= com.zaxxer.hikari.HikariDataSource
21 21  
22 22 #DATASOURCE SETTING
... ... @@ -33,14 +33,14 @@ spring.datasource.hikari.register-mbeans=true
33 33  
34 34 sso.enabled= true
35 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 40 dc.imgurl= E:/klimg
41 41 dc.profile= profile
42 42  
43   -baidu.ak=AYiBOs3f9qBQFhdKFsaboX6CfObmKwRP
  43 +baidu.ak=YIT2mnCsfWkpbYnlLLqJ18ravGLs3OJS
44 44 passengerFlow.url = http://127.0.0.1:9999/images/
45 45 baidu.akyd=WnSDHZgtPbSbw2LfsH3KO3DDKWONmlYK
46 46 electricity.importFile.path= E:/elecImportFile
... ...
src/main/resources/application.properties
1   -spring.profiles.active = test
  1 +spring.profiles.active = prod
2 2  
3 3 spring.view.suffix=.html
4 4 server.session-timeout=-1
... ...
src/main/resources/fatso/handle_real_ctl.js
... ... @@ -34,9 +34,7 @@ var realCtl = {
34 34 //处理main.html
35 35 var data = fs.readFileSync(mainFile, 'utf-8'),
36 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 47 var data = fs.readFileSync(mapFile, 'utf-8')
50 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 56 handleAlonePage: function (cb) {
61 57 var data = fs.readFileSync(aloneMapWrapFile, 'utf-8');
62 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 65 handleAloneHomePage: function (cb) {
72 66 var data = fs.readFileSync(aloneHomeWrapFile, 'utf-8');
73 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 16 var iswin = platform == 'win32';
17 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 20 , ep = new EventProxy()
21 21 , pName = 'bsth_control'
22 22 , path = process.cwd()
... ...
src/main/resources/jiaDingBus-jdbc.properties
1 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 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 9 \ No newline at end of file
... ...
src/main/resources/ms-jdbc.properties
... ... @@ -4,6 +4,9 @@
4 4 #ms.mysql.password= 123456
5 5  
6 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 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 14 \ No newline at end of file
... ...
src/main/resources/static/index.html
... ... @@ -579,7 +579,25 @@
579 579 function setTitle(menuItem){
580 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 602 $('#changeStyle').on('click', function () {
585 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 3 #ms.mysql.username= root
4 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 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 9 \ No newline at end of file
... ...