Commit df28ac5cd341a580766a0c0f3f8b56f9d15dac42
1 parent
6e357b38
update...
Showing
3 changed files
with
32 additions
and
29 deletions
src/main/java/com/bsth/data/gpsdata_v2/cache/GeoCacheData.java
| @@ -21,6 +21,8 @@ import org.springframework.stereotype.Component; | @@ -21,6 +21,8 @@ import org.springframework.stereotype.Component; | ||
| 21 | import java.sql.ResultSet; | 21 | import java.sql.ResultSet; |
| 22 | import java.sql.SQLException; | 22 | import java.sql.SQLException; |
| 23 | import java.util.*; | 23 | import java.util.*; |
| 24 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 25 | +import java.util.concurrent.ConcurrentMap; | ||
| 24 | 26 | ||
| 25 | /** | 27 | /** |
| 26 | * 空间数据缓存 | 28 | * 空间数据缓存 |
| @@ -38,7 +40,7 @@ public class GeoCacheData { | @@ -38,7 +40,7 @@ public class GeoCacheData { | ||
| 38 | /** | 40 | /** |
| 39 | * 路段编码和名称对照 | 41 | * 路段编码和名称对照 |
| 40 | */ | 42 | */ |
| 41 | - private static Map<String, String> sectionCode2Name; | 43 | + private static ConcurrentMap<String, String> sectionCode2Name; |
| 42 | /** | 44 | /** |
| 43 | * 线路站点路由 | 45 | * 线路站点路由 |
| 44 | */ | 46 | */ |
| @@ -50,15 +52,15 @@ public class GeoCacheData { | @@ -50,15 +52,15 @@ public class GeoCacheData { | ||
| 50 | /** | 52 | /** |
| 51 | * 线路_上下行_站点编码 ——> 站点 | 53 | * 线路_上下行_站点编码 ——> 站点 |
| 52 | */ | 54 | */ |
| 53 | - private static Map<String, StationRoute> routeCodeMap; | 55 | + private static ConcurrentMap<String, StationRoute> routeCodeMap; |
| 54 | /** | 56 | /** |
| 55 | * 停车场 | 57 | * 停车场 |
| 56 | */ | 58 | */ |
| 57 | - public static Map<String, Polygon> tccMap; | 59 | + public static ConcurrentMap<String, Polygon> tccMap; |
| 58 | /** | 60 | /** |
| 59 | * 线路限速信息 | 61 | * 线路限速信息 |
| 60 | */ | 62 | */ |
| 61 | - private static Map<String, Double> speedLimitMap; | 63 | + private static ConcurrentMap<String, Double> speedLimitMap; |
| 62 | 64 | ||
| 63 | @Autowired | 65 | @Autowired |
| 64 | JdbcTemplate jdbcTemplate; | 66 | JdbcTemplate jdbcTemplate; |
| @@ -118,7 +120,7 @@ public class GeoCacheData { | @@ -118,7 +120,7 @@ public class GeoCacheData { | ||
| 118 | //按线路和走向分组 | 120 | //按线路和走向分组 |
| 119 | if (routeList.size() > 0) { | 121 | if (routeList.size() > 0) { |
| 120 | ArrayListMultimap<String, StationRoute> tempMap = ArrayListMultimap.create(); | 122 | ArrayListMultimap<String, StationRoute> tempMap = ArrayListMultimap.create(); |
| 121 | - Map<String, StationRoute> codeMap = new HashMap<>(routeList.size()); | 123 | + ConcurrentMap<String, StationRoute> codeMap = new ConcurrentHashMap<>(routeList.size()); |
| 122 | for (StationRoute sr : routeList) { | 124 | for (StationRoute sr : routeList) { |
| 123 | tempMap.put(sr.getLineCode() + "_" + sr.getDirections(), sr); | 125 | tempMap.put(sr.getLineCode() + "_" + sr.getDirections(), sr); |
| 124 | //站点编码 ——> 和路由顺序对照 | 126 | //站点编码 ——> 和路由顺序对照 |
| @@ -141,7 +143,7 @@ public class GeoCacheData { | @@ -141,7 +143,7 @@ public class GeoCacheData { | ||
| 141 | //加载停车场数据 | 143 | //加载停车场数据 |
| 142 | String sql = "select PARK_CODE, ST_AsText(G_PARK_POINT) as G_PARK_POINT from bsth_c_car_park where park_code is not null and b_park_point is not null and destroy=0"; | 144 | String sql = "select PARK_CODE, ST_AsText(G_PARK_POINT) as G_PARK_POINT from bsth_c_car_park where park_code is not null and b_park_point is not null and destroy=0"; |
| 143 | List<Map<String, Object>> tccList = jdbcTemplate.queryForList(sql); | 145 | List<Map<String, Object>> tccList = jdbcTemplate.queryForList(sql); |
| 144 | - Map<String, Polygon> tccTempMap = new HashMap<>(); | 146 | + ConcurrentMap<String, Polygon> tccTempMap = new ConcurrentHashMap<>(); |
| 145 | 147 | ||
| 146 | Polygon polygon; | 148 | Polygon polygon; |
| 147 | for (Map<String, Object> tMap : tccList) { | 149 | for (Map<String, Object> tMap : tccList) { |
| @@ -163,7 +165,7 @@ public class GeoCacheData { | @@ -163,7 +165,7 @@ public class GeoCacheData { | ||
| 163 | //加载线路限速信息 | 165 | //加载线路限速信息 |
| 164 | String sql = "select l.LINE_CODE,i.SPEEDING from bsth_c_line_information i left join bsth_c_line l on i.line=l.id where i.speed_limit is not null"; | 166 | String sql = "select l.LINE_CODE,i.SPEEDING from bsth_c_line_information i left join bsth_c_line l on i.line=l.id where i.speed_limit is not null"; |
| 165 | List<Map<String, Object>> speedMap = jdbcTemplate.queryForList(sql); | 167 | List<Map<String, Object>> speedMap = jdbcTemplate.queryForList(sql); |
| 166 | - Map<String, Double> speedTempMap = new HashMap<>(); | 168 | + ConcurrentMap<String, Double> speedTempMap = new ConcurrentHashMap(); |
| 167 | for (Map<String, Object> tMap : speedMap) { | 169 | for (Map<String, Object> tMap : speedMap) { |
| 168 | try { | 170 | try { |
| 169 | speedTempMap.put(tMap.get("LINE_CODE").toString(), Double.parseDouble(tMap.get("SPEEDING").toString())); | 171 | speedTempMap.put(tMap.get("LINE_CODE").toString(), Double.parseDouble(tMap.get("SPEEDING").toString())); |
| @@ -208,7 +210,7 @@ public class GeoCacheData { | @@ -208,7 +210,7 @@ public class GeoCacheData { | ||
| 208 | if(sectionCacheTempMap.size() > 0) | 210 | if(sectionCacheTempMap.size() > 0) |
| 209 | sectionCacheMap = sectionCacheTempMap; | 211 | sectionCacheMap = sectionCacheTempMap; |
| 210 | 212 | ||
| 211 | - Map<String, String> sectionCode2NameTemp = new HashMap<>(); | 213 | + ConcurrentMap<String, String> sectionCode2NameTemp = new ConcurrentHashMap<>(); |
| 212 | 214 | ||
| 213 | //加载全量路段编码和名称对照 | 215 | //加载全量路段编码和名称对照 |
| 214 | sql = "select SECTION_CODE,SECTION_NAME,CROSES_ROAD from bsth_c_section"; | 216 | sql = "select SECTION_CODE,SECTION_NAME,CROSES_ROAD from bsth_c_section"; |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -38,6 +38,7 @@ import java.text.SimpleDateFormat; | @@ -38,6 +38,7 @@ import java.text.SimpleDateFormat; | ||
| 38 | import java.util.*; | 38 | import java.util.*; |
| 39 | import java.util.concurrent.ConcurrentHashMap; | 39 | import java.util.concurrent.ConcurrentHashMap; |
| 40 | import java.util.concurrent.ConcurrentLinkedQueue; | 40 | import java.util.concurrent.ConcurrentLinkedQueue; |
| 41 | +import java.util.concurrent.ConcurrentMap; | ||
| 41 | 42 | ||
| 42 | /** | 43 | /** |
| 43 | * @author PanZhao | 44 | * @author PanZhao |
| @@ -63,10 +64,10 @@ public class DayOfSchedule { | @@ -63,10 +64,10 @@ public class DayOfSchedule { | ||
| 63 | private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap; | 64 | private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap; |
| 64 | 65 | ||
| 65 | // 班次主键映射 | 66 | // 班次主键映射 |
| 66 | - private static Map<Long, ScheduleRealInfo> id2SchedulMap; | 67 | + private static ConcurrentMap<Long, ScheduleRealInfo> id2SchedulMap; |
| 67 | 68 | ||
| 68 | //车辆 ——> 当前执行班次 | 69 | //车辆 ——> 当前执行班次 |
| 69 | - private static Map<String, ScheduleRealInfo> carExecutePlanMap; | 70 | + private static ConcurrentMap<String, ScheduleRealInfo> carExecutePlanMap; |
| 70 | 71 | ||
| 71 | // 持久化 | 72 | // 持久化 |
| 72 | public static ConcurrentLinkedQueue<ScheduleRealInfo> pstBuffer; | 73 | public static ConcurrentLinkedQueue<ScheduleRealInfo> pstBuffer; |
| @@ -1098,7 +1099,7 @@ public class DayOfSchedule { | @@ -1098,7 +1099,7 @@ public class DayOfSchedule { | ||
| 1098 | */ | 1099 | */ |
| 1099 | public int reCalcIdMaps(){ | 1100 | public int reCalcIdMaps(){ |
| 1100 | Collection<ScheduleRealInfo> all = findAll(); | 1101 | Collection<ScheduleRealInfo> all = findAll(); |
| 1101 | - Map<Long, ScheduleRealInfo> id2SchedulMapCopy = new ConcurrentHashMap<>(); | 1102 | + ConcurrentMap<Long, ScheduleRealInfo> id2SchedulMapCopy = new ConcurrentHashMap<>(); |
| 1102 | 1103 | ||
| 1103 | for(ScheduleRealInfo sch : all){ | 1104 | for(ScheduleRealInfo sch : all){ |
| 1104 | id2SchedulMapCopy.put(sch.getId(), sch); | 1105 | id2SchedulMapCopy.put(sch.getId(), sch); |
src/main/resources/fatso/package.json
| 1 | -{ | ||
| 2 | - "name": "fatso", | ||
| 3 | - "version": "1.0.0", | ||
| 4 | - "description": "子页面js检查、合并、压缩等处理", | ||
| 5 | - "main": "start.js", | ||
| 6 | - "scripts": { | ||
| 7 | - "test": "echo \"Error: no test specified\" && exit 1" | ||
| 8 | - }, | ||
| 9 | - "author": "panzhaov5", | ||
| 10 | - "license": "ISC", | ||
| 11 | - "dependencies": { | ||
| 12 | - "cheerio": "^0.20.0", | ||
| 13 | - "clean-css": "^4.0.12", | ||
| 14 | - "colors": "^1.1.2", | ||
| 15 | - "eventproxy": "^0.3.4", | ||
| 16 | - "uglify-js": "^2.6.2" | ||
| 17 | - } | ||
| 18 | -} | 1 | +{ |
| 2 | + "name": "fatso", | ||
| 3 | + "version": "1.0.0", | ||
| 4 | + "description": "子页面js检查、合并、压缩等处理", | ||
| 5 | + "main": "start.js", | ||
| 6 | + "scripts": { | ||
| 7 | + "test": "echo \"Error: no test specified\" && exit 1" | ||
| 8 | + }, | ||
| 9 | + "author": "panzhaov5", | ||
| 10 | + "license": "ISC", | ||
| 11 | + "dependencies": { | ||
| 12 | + "cheerio": "^0.20.0", | ||
| 13 | + "clean-css": "^4.0.12", | ||
| 14 | + "colors": "^1.1.2", | ||
| 15 | + "eventproxy": "^0.3.4", | ||
| 16 | + "uglify-js": "^2.6.2" | ||
| 17 | + } | ||
| 18 | +} | ||
| 19 | \ No newline at end of file | 19 | \ No newline at end of file |