Commit cbcffe020e72b822ed102802c2c9c4de37027bcc
Merge branch 'master' of http://222.66.0.204:8090/panzhaov5/bsth_control
Showing
79 changed files
with
2940 additions
and
438 deletions
Too many changes to show.
To preserve performance only 79 of 174 files are displayed.
README.md
pom.xml
src/main/java/com/bsth/StartCommand.java
| ... | ... | @@ -5,8 +5,9 @@ import com.bsth.security.SecurityMetadataSourceService; |
| 5 | 5 | import com.bsth.service.realcontrol.buffer.GetSchedulePlanThread; |
| 6 | 6 | import com.bsth.service.realcontrol.buffer.SchedulePersistenceThread; |
| 7 | 7 | import com.bsth.vehicle.common.CommonRefreshThread; |
| 8 | -import com.bsth.vehicle.directive.DirectivePersistenceThread; | |
| 9 | -import com.bsth.vehicle.directive.FirstScheduleIssuedThread; | |
| 8 | +import com.bsth.vehicle.directive.thread.DirectivePersistenceThread; | |
| 9 | +import com.bsth.vehicle.directive.thread.FirstScheduleIssuedThread; | |
| 10 | +import com.bsth.vehicle.directive.thread.RevertLineThread; | |
| 10 | 11 | import com.bsth.vehicle.gpsdata.GpsArrivalStationThread; |
| 11 | 12 | import com.bsth.vehicle.gpsdata.GpsRefreshThread; |
| 12 | 13 | import org.slf4j.Logger; |
| ... | ... | @@ -32,7 +33,7 @@ public class StartCommand implements CommandLineRunner{ |
| 32 | 33 | @Autowired |
| 33 | 34 | SecurityMetadataSourceService invocationSecurityMetadataSourceService; |
| 34 | 35 | |
| 35 | - public static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(7); | |
| 36 | + public static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(8); | |
| 36 | 37 | |
| 37 | 38 | @Autowired |
| 38 | 39 | GpsRefreshThread gpsRefreshThread; |
| ... | ... | @@ -48,6 +49,8 @@ public class StartCommand implements CommandLineRunner{ |
| 48 | 49 | GpsArrivalStationThread gpsArrivalStationThread; |
| 49 | 50 | @Autowired |
| 50 | 51 | FirstScheduleIssuedThread firstScheduleIssuedThread; |
| 52 | + @Autowired | |
| 53 | + RevertLineThread revertLineThread; | |
| 51 | 54 | |
| 52 | 55 | @Override |
| 53 | 56 | public void run(String... arg0){ |
| ... | ... | @@ -60,7 +63,7 @@ public class StartCommand implements CommandLineRunner{ |
| 60 | 63 | * GPS实时数据更新 线程 |
| 61 | 64 | * 每8秒和网关HTTP接口同步一次 |
| 62 | 65 | */ |
| 63 | - scheduler.scheduleWithFixedDelay(gpsRefreshThread, 0, 8, TimeUnit.SECONDS); | |
| 66 | + //scheduler.scheduleWithFixedDelay(gpsRefreshThread, 0, 8, TimeUnit.SECONDS); | |
| 64 | 67 | |
| 65 | 68 | /** |
| 66 | 69 | * 每天 0点 抓取当天实际排班 |
| ... | ... | @@ -90,7 +93,7 @@ public class StartCommand implements CommandLineRunner{ |
| 90 | 93 | * 每15秒从数据库抓取到离站信息和班次匹配 |
| 91 | 94 | * (网关生成的到离站数据也是延迟批量入库,所以缩短该线程执行周期并不会提高 “实际到离站” 的实时性) |
| 92 | 95 | */ |
| 93 | - //scheduler.scheduleWithFixedDelay(gpsArrivalStationThread, 5, 1200, TimeUnit.SECONDS); | |
| 96 | + //scheduler.scheduleWithFixedDelay(gpsArrivalStationThread, 35, 1200, TimeUnit.SECONDS); | |
| 94 | 97 | |
| 95 | 98 | /** |
| 96 | 99 | * 首个调度指令下发(2分钟运行一次) |
| ... | ... | @@ -98,6 +101,12 @@ public class StartCommand implements CommandLineRunner{ |
| 98 | 101 | * 后续班次由 “实际终点到达” 事件触发指令下发 |
| 99 | 102 | */ |
| 100 | 103 | //scheduler.scheduleWithFixedDelay(firstScheduleIssuedThread, 60 , 60 * 2, TimeUnit.SECONDS); |
| 104 | + | |
| 105 | + /** | |
| 106 | + * 还车线程(2分钟运行一次) | |
| 107 | + * 将借出的车刷回原线路 | |
| 108 | + */ | |
| 109 | + //scheduler.scheduleWithFixedDelay(revertLineThread, 60 , 60 * 2 , TimeUnit.SECONDS); | |
| 101 | 110 | } catch (Exception e) { |
| 102 | 111 | e.printStackTrace(); |
| 103 | 112 | } | ... | ... |
src/main/java/com/bsth/WebAppConfiguration.java
| ... | ... | @@ -14,6 +14,8 @@ import org.springframework.web.socket.config.annotation.WebSocketConfigurer; |
| 14 | 14 | import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; |
| 15 | 15 | |
| 16 | 16 | import com.bsth.filter.ResourceFilter; |
| 17 | +import com.bsth.websocket.WebSocketHandshakeInterceptor; | |
| 18 | +import com.bsth.websocket.handler.RealControlSocketHandler; | |
| 17 | 19 | |
| 18 | 20 | @Configuration |
| 19 | 21 | @EnableWebSocket |
| ... | ... | @@ -61,6 +63,8 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS |
| 61 | 63 | |
| 62 | 64 | @Override |
| 63 | 65 | public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { |
| 64 | - | |
| 66 | + //线调webSocket | |
| 67 | + registry.addHandler(new RealControlSocketHandler(), "/sockjs/realcontrol").addInterceptors(new WebSocketHandshakeInterceptor()) | |
| 68 | + .withSockJS(); | |
| 65 | 69 | } |
| 66 | 70 | } | ... | ... |
src/main/java/com/bsth/common/Constants.java
src/main/java/com/bsth/controller/DownloadController.java
0 → 100644
| 1 | +package com.bsth.controller; | |
| 2 | + | |
| 3 | +import java.io.File; | |
| 4 | +import java.io.IOException; | |
| 5 | + | |
| 6 | +import org.apache.commons.io.FileUtils; | |
| 7 | +import org.springframework.context.annotation.Scope; | |
| 8 | +import org.springframework.http.HttpHeaders; | |
| 9 | +import org.springframework.http.HttpStatus; | |
| 10 | +import org.springframework.http.MediaType; | |
| 11 | +import org.springframework.http.ResponseEntity; | |
| 12 | +import org.springframework.stereotype.Component; | |
| 13 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * <一句话功能简述> | |
| 17 | + * <功能详细描述> | |
| 18 | + * | |
| 19 | + * @author Administrator | |
| 20 | + * @version [版本号, 2014年3月7日] | |
| 21 | + * @see [相关类/方法] | |
| 22 | + * @since [产品/模块版本] | |
| 23 | + */ | |
| 24 | +@Component | |
| 25 | +@Scope("prototype") | |
| 26 | +@RequestMapping("/downloadFile") | |
| 27 | +public class DownloadController | |
| 28 | +{ | |
| 29 | + | |
| 30 | + @RequestMapping("download") | |
| 31 | + public ResponseEntity<byte[]> download(String jName,String lpName) throws IOException { | |
| 32 | + String fileName = jName+lpName+".xls"; | |
| 33 | + String path="D:\\export\\target\\"+jName+".xls"; | |
| 34 | + File file=new File(path); | |
| 35 | + HttpHeaders headers = new HttpHeaders(); | |
| 36 | + String realFileName=new String(fileName.getBytes("UTF-8"),"iso-8859-1");//为了解决中文名称乱码问题 | |
| 37 | + headers.setContentDispositionFormData("attachment", realFileName); | |
| 38 | + headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); | |
| 39 | + return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file), | |
| 40 | + headers, HttpStatus.CREATED); | |
| 41 | + } | |
| 42 | +} | ... | ... |
src/main/java/com/bsth/controller/realcontrol/DeviceRevertLineController.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol; | |
| 2 | + | |
| 3 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 4 | +import org.springframework.web.bind.annotation.RestController; | |
| 5 | + | |
| 6 | +import com.bsth.controller.BaseController; | |
| 7 | +import com.bsth.entity.realcontrol.DeviceRevertLine; | |
| 8 | + | |
| 9 | +@RestController | |
| 10 | +@RequestMapping("/deviceRevert") | |
| 11 | +public class DeviceRevertLineController extends BaseController<DeviceRevertLine, Integer>{ | |
| 12 | + | |
| 13 | +} | ... | ... |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| ... | ... | @@ -12,95 +12,218 @@ import org.springframework.web.bind.annotation.RestController; |
| 12 | 12 | |
| 13 | 13 | import com.bsth.controller.BaseController; |
| 14 | 14 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 15 | +import com.bsth.security.util.SecurityUtils; | |
| 15 | 16 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 17 | +import com.bsth.service.realcontrol.buffer.ScheduleBuffer; | |
| 16 | 18 | import com.bsth.vehicle.common.CommonMapped; |
| 19 | +import com.google.common.base.Splitter; | |
| 17 | 20 | |
| 18 | 21 | @RestController |
| 19 | 22 | @RequestMapping("/realSchedule") |
| 20 | -public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long>{ | |
| 23 | +public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> { | |
| 21 | 24 | |
| 22 | 25 | @Autowired |
| 23 | 26 | ScheduleRealInfoService scheduleRealInfoService; |
| 24 | - | |
| 27 | + | |
| 25 | 28 | @RequestMapping(value = "/lines") |
| 26 | - public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines){ | |
| 29 | + public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) { | |
| 27 | 30 | return scheduleRealInfoService.findByLines(lines); |
| 28 | 31 | } |
| 29 | - | |
| 32 | + | |
| 30 | 33 | /** |
| 31 | 34 | * |
| 32 | - * @Title: outgoAdjust | |
| 33 | - * @Description: TODO(待发调整) | |
| 34 | - * @param @param id 主键 | |
| 35 | - * @param @param remarks 备注 | |
| 36 | - * @param @param dfsj 待发时间(HH:mm) | |
| 37 | - * @throws | |
| 35 | + * @Title: registerLine @Description: TODO(注册线路,后续才能收到数据推送) @param @param | |
| 36 | + * lineCodes @throws | |
| 37 | + */ | |
| 38 | + @RequestMapping(value = "/registerLine", method = RequestMethod.POST) | |
| 39 | + public int registerLine(@RequestParam String lineCodes) { | |
| 40 | + List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(lineCodes); | |
| 41 | + String userName = SecurityUtils.getCurrentUser().getUserName(); | |
| 42 | + // 注销之前的绑定 | |
| 43 | + for (String line : list) | |
| 44 | + CommonMapped.lineUserMap.get(Integer.parseInt(line)).remove(userName); | |
| 45 | + // 重新绑定 | |
| 46 | + for (String line : list) | |
| 47 | + CommonMapped.lineUserMap.put(Integer.parseInt(line), userName); | |
| 48 | + | |
| 49 | + return 0; | |
| 50 | + } | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * | |
| 54 | + * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id | |
| 55 | + * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws | |
| 38 | 56 | */ |
| 39 | 57 | @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST) |
| 40 | - public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,@RequestParam String dfsj){ | |
| 58 | + public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks, | |
| 59 | + @RequestParam String dfsj) { | |
| 41 | 60 | return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj); |
| 42 | 61 | } |
| 43 | - | |
| 62 | + | |
| 44 | 63 | /** |
| 45 | 64 | * |
| 46 | - * @Title: destroy | |
| 47 | - * @Description: TODO(销毁,烂班) | |
| 48 | - * @param @param idsStr 要烂掉的班次ID ,分隔 | |
| 49 | - * @param @param spaceAdjust 自动调整后续间隔(1 是 -1 否) | |
| 50 | - * @param @param remarks 备注 | |
| 51 | - * @param @param reason 理由 | |
| 52 | - * @param @param spaceNum 间隔(分钟) | |
| 53 | - * @throws | |
| 65 | + * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID | |
| 66 | + * ,分隔 @param @param spaceAdjust 自动调整后续间隔(1 是 -1 否) @param @param remarks | |
| 67 | + * 备注 @param @param reason 理由 @param @param spaceNum 间隔(分钟) @throws | |
| 54 | 68 | */ |
| 55 | 69 | @RequestMapping(value = "/destroy", method = RequestMethod.POST) |
| 56 | - public Map<String, Object> destroy(@RequestParam String idsStr,@RequestParam int spaceAdjust,@RequestParam String remarks,@RequestParam String reason,@RequestParam int spaceNum){ | |
| 70 | + public Map<String, Object> destroy(@RequestParam String idsStr, @RequestParam(defaultValue = "-1") int spaceAdjust, | |
| 71 | + @RequestParam String remarks, @RequestParam String reason, @RequestParam(defaultValue = "0") int spaceNum) { | |
| 57 | 72 | return scheduleRealInfoService.destroy(idsStr, spaceAdjust, remarks, reason, spaceNum); |
| 58 | 73 | } |
| 59 | - | |
| 74 | + | |
| 60 | 75 | /** |
| 61 | 76 | * |
| 62 | - * @Title: carDeviceMapp | |
| 63 | - * @Description: TODO(获取车辆自编号和设备号对照,从缓存取) | |
| 64 | - * @throws | |
| 77 | + * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws | |
| 65 | 78 | */ |
| 66 | 79 | @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET) |
| 67 | - public Map<String, String> carDeviceMapp(){ | |
| 80 | + public Map<String, String> carDeviceMapp() { | |
| 68 | 81 | return CommonMapped.vehicDeviceBiMap.inverse(); |
| 69 | 82 | } |
| 70 | - | |
| 83 | + | |
| 71 | 84 | /** |
| 72 | 85 | * |
| 73 | - * @Title: findPersionByLine | |
| 74 | - * @Description: TODO(根据线路主键获取驾驶员) | |
| 75 | - * @param @param lineId | |
| 76 | - * @throws | |
| 86 | + * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param | |
| 87 | + * lineId @throws | |
| 77 | 88 | */ |
| 78 | 89 | @RequestMapping(value = "/driver", method = RequestMethod.GET) |
| 79 | - public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode){ | |
| 90 | + public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode) { | |
| 80 | 91 | return scheduleRealInfoService.findDriverByLine(lineCode); |
| 81 | 92 | } |
| 82 | - | |
| 93 | + | |
| 83 | 94 | /** |
| 84 | 95 | * |
| 85 | - * @Title: findPersionByLine | |
| 86 | - * @Description: TODO(根据线路主键获取售票员) | |
| 87 | - * @param @param lineId | |
| 88 | - * @throws | |
| 96 | + * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param | |
| 97 | + * lineId @throws | |
| 89 | 98 | */ |
| 90 | 99 | @RequestMapping(value = "/conductor", method = RequestMethod.GET) |
| 91 | - public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode){ | |
| 100 | + public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode) { | |
| 92 | 101 | return scheduleRealInfoService.findConductorByLine(lineCode); |
| 93 | 102 | } |
| 94 | - | |
| 103 | + | |
| 95 | 104 | /** |
| 96 | 105 | * |
| 97 | - * @Title: findPersionByLine | |
| 98 | - * @Description: TODO(根据线路主键获取车辆) | |
| 99 | - * @param @param lineId | |
| 100 | - * @throws | |
| 106 | + * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param | |
| 107 | + * lineId @throws | |
| 101 | 108 | */ |
| 102 | 109 | @RequestMapping(value = "/cars", method = RequestMethod.GET) |
| 103 | - public List<Map<String, String>> findCarByLine(@RequestParam String lineCode){ | |
| 110 | + public List<Map<String, String>> findCarByLine(@RequestParam String lineCode) { | |
| 104 | 111 | return scheduleRealInfoService.findCarByLine(lineCode); |
| 105 | 112 | } |
| 113 | + | |
| 114 | + /** | |
| 115 | + * | |
| 116 | + * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws | |
| 117 | + */ | |
| 118 | + @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET) | |
| 119 | + public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) { | |
| 120 | + return scheduleRealInfoService.sreachVehic(nbbm); | |
| 121 | + } | |
| 122 | + | |
| 123 | + /** | |
| 124 | + * | |
| 125 | + * @Title: adjust @Description: TODO(调整人车) @param @param id | |
| 126 | + * 班次ID @param @param nbbm 内部编码 @param @param jsy 驾驶员 @param @param spy | |
| 127 | + * 售票员 @throws | |
| 128 | + */ | |
| 129 | + @RequestMapping(value = "/adjust", method = RequestMethod.POST) | |
| 130 | + public Map<String, Object> adjust(@RequestParam Long id, @RequestParam String nbbm, @RequestParam String jsy, | |
| 131 | + @RequestParam String spy) { | |
| 132 | + return scheduleRealInfoService.adjust(id, nbbm, jsy, spy); | |
| 133 | + } | |
| 134 | + | |
| 135 | + /** | |
| 136 | + * | |
| 137 | + * @Title: realOutAdjust | |
| 138 | + * @Description: TODO(实发调整) | |
| 139 | + * @param @param id 班次ID | |
| 140 | + * @param @param fcsjActual 实际发车时间 HH:mm | |
| 141 | + * @param @param remarks 备注 | |
| 142 | + * @throws | |
| 143 | + */ | |
| 144 | + @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST) | |
| 145 | + public Map<String, Object> realOutAdjust(@RequestParam Long id, @RequestParam String fcsjActual, | |
| 146 | + @RequestParam String remarks) { | |
| 147 | + return scheduleRealInfoService.realOutAdjust(id, fcsjActual, remarks); | |
| 148 | + } | |
| 149 | + | |
| 150 | + /** | |
| 151 | + * | |
| 152 | + * @Title: revokeDestroy | |
| 153 | + * @Description: TODO(撤销烂班) | |
| 154 | + * @param @param id | |
| 155 | + * @throws | |
| 156 | + */ | |
| 157 | + @RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST) | |
| 158 | + public Map<String, Object> revokeDestroy(@RequestParam Long id){ | |
| 159 | + return scheduleRealInfoService.revokeDestroy(id); | |
| 160 | + } | |
| 161 | + | |
| 162 | + /** | |
| 163 | + * | |
| 164 | + * @Title: revokeRealOutgo | |
| 165 | + * @Description: TODO(撤销实发) | |
| 166 | + * @param @param id | |
| 167 | + * @throws | |
| 168 | + */ | |
| 169 | + @RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST) | |
| 170 | + public Map<String, Object> revokeRealOutgo(@RequestParam Long id){ | |
| 171 | + return scheduleRealInfoService.revokeRealOutgo(id); | |
| 172 | + } | |
| 173 | + | |
| 174 | + /** | |
| 175 | + * | |
| 176 | + * @Title: spaceAdjust | |
| 177 | + * @Description: TODO(间隔调整) | |
| 178 | + * @param @param ids 要调整的班次数组ID | |
| 179 | + * @param @param space 间隔 | |
| 180 | + * @throws | |
| 181 | + */ | |
| 182 | + @RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST) | |
| 183 | + public Map<String, Object> spaceAdjust(Long[] ids, Integer space){ | |
| 184 | + return scheduleRealInfoService.spaceAdjust(ids, space); | |
| 185 | + } | |
| 186 | + | |
| 187 | + /** | |
| 188 | + * | |
| 189 | + * @Title: trustStatus @Description: TODO(线路托管状态) @param @param lineCodes | |
| 190 | + * 线路编码 @throws | |
| 191 | + */ | |
| 192 | + @RequestMapping(value = "/trustStatus") | |
| 193 | + public Map<Integer, Integer> trustStatus(@RequestParam String lineCodes) { | |
| 194 | + return scheduleRealInfoService.trustStatus(lineCodes); | |
| 195 | + } | |
| 196 | + | |
| 197 | + /** | |
| 198 | + * | |
| 199 | + * @Title: changeTrustStatus @Description: TODO(切换线路托管状态) @param @param | |
| 200 | + * lineCode 线路编码 @param @param status 托管状态 @throws | |
| 201 | + */ | |
| 202 | + @RequestMapping(value = "/trustStatus/change", method = RequestMethod.POST) | |
| 203 | + public int changeTrustStatus(@RequestParam Integer lineCode, @RequestParam Integer status) { | |
| 204 | + ScheduleBuffer.trustMap.put(lineCode, status); | |
| 205 | + return 200; | |
| 206 | + } | |
| 207 | + | |
| 208 | + @RequestMapping(value = "/queryUserInfo") | |
| 209 | + public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line, @RequestParam String date) { | |
| 210 | + return scheduleRealInfoService.queryUserInfo(line, date); | |
| 211 | + } | |
| 212 | + | |
| 213 | + @RequestMapping(value = "/exportWaybill") | |
| 214 | + public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh, | |
| 215 | + @RequestParam String lpName) { | |
| 216 | + return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName); | |
| 217 | + } | |
| 218 | + | |
| 219 | + @RequestMapping(value = "/dailyInfo") | |
| 220 | + public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date) { | |
| 221 | + return scheduleRealInfoService.dailyInfo(line, date); | |
| 222 | + } | |
| 223 | + | |
| 224 | + @RequestMapping(value = "/historyMessage") | |
| 225 | + public List<ScheduleRealInfo> historyMessage(@RequestParam String line, @RequestParam String date, | |
| 226 | + @RequestParam String code) { | |
| 227 | + return scheduleRealInfoService.historyMessage(line, date, code); | |
| 228 | + } | |
| 106 | 229 | } | ... | ... |
src/main/java/com/bsth/entity/realcontrol/DeviceRevertLine.java
0 → 100644
| 1 | +package com.bsth.entity.realcontrol; | |
| 2 | + | |
| 3 | +import java.util.Date; | |
| 4 | + | |
| 5 | +import javax.persistence.Column; | |
| 6 | +import javax.persistence.Entity; | |
| 7 | +import javax.persistence.GeneratedValue; | |
| 8 | +import javax.persistence.Id; | |
| 9 | +import javax.persistence.Table; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * | |
| 13 | + * @ClassName: VehicleRevertLine | |
| 14 | + * @Description: TODO(设备线路还原) | |
| 15 | + * @author PanZhao | |
| 16 | + * @date 2016年7月6日 下午5:31:13 | |
| 17 | + * | |
| 18 | + */ | |
| 19 | +@Entity | |
| 20 | +@Table(name = "bsth_v_line_revert") | |
| 21 | +public class DeviceRevertLine { | |
| 22 | + | |
| 23 | + @Id | |
| 24 | + @GeneratedValue | |
| 25 | + private Integer id; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 车辆内部编码 | |
| 29 | + */ | |
| 30 | + private String nbbm; | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 出借时间 | |
| 34 | + */ | |
| 35 | + private Long borrowTime; | |
| 36 | + | |
| 37 | + private String borrowTimeStr; | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 出借线路 | |
| 41 | + */ | |
| 42 | + private String borrowLine; | |
| 43 | + | |
| 44 | + /** | |
| 45 | + * 归还时间 | |
| 46 | + */ | |
| 47 | + private Long revertTime; | |
| 48 | + | |
| 49 | + private String revertTimeStr; | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 归还线路 | |
| 53 | + */ | |
| 54 | + private String revertLine; | |
| 55 | + | |
| 56 | + /** 创建日期 */ | |
| 57 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 58 | + private Date createDate; | |
| 59 | + | |
| 60 | + /** 状态 1 已还车 */ | |
| 61 | + private Integer status; | |
| 62 | + | |
| 63 | + public Integer getId() { | |
| 64 | + return id; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public void setId(Integer id) { | |
| 68 | + this.id = id; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public String getNbbm() { | |
| 72 | + return nbbm; | |
| 73 | + } | |
| 74 | + | |
| 75 | + public void setNbbm(String nbbm) { | |
| 76 | + this.nbbm = nbbm; | |
| 77 | + } | |
| 78 | + | |
| 79 | + public String getBorrowLine() { | |
| 80 | + return borrowLine; | |
| 81 | + } | |
| 82 | + | |
| 83 | + public void setBorrowLine(String borrowLine) { | |
| 84 | + this.borrowLine = borrowLine; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public String getRevertLine() { | |
| 88 | + return revertLine; | |
| 89 | + } | |
| 90 | + | |
| 91 | + public void setRevertLine(String revertLine) { | |
| 92 | + this.revertLine = revertLine; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public Long getBorrowTime() { | |
| 96 | + return borrowTime; | |
| 97 | + } | |
| 98 | + | |
| 99 | + public void setBorrowTime(Long borrowTime) { | |
| 100 | + this.borrowTime = borrowTime; | |
| 101 | + } | |
| 102 | + | |
| 103 | + public String getBorrowTimeStr() { | |
| 104 | + return borrowTimeStr; | |
| 105 | + } | |
| 106 | + | |
| 107 | + public void setBorrowTimeStr(String borrowTimeStr) { | |
| 108 | + this.borrowTimeStr = borrowTimeStr; | |
| 109 | + } | |
| 110 | + | |
| 111 | + public Long getRevertTime() { | |
| 112 | + return revertTime; | |
| 113 | + } | |
| 114 | + | |
| 115 | + public void setRevertTime(Long revertTime) { | |
| 116 | + this.revertTime = revertTime; | |
| 117 | + } | |
| 118 | + | |
| 119 | + public String getRevertTimeStr() { | |
| 120 | + return revertTimeStr; | |
| 121 | + } | |
| 122 | + | |
| 123 | + public void setRevertTimeStr(String revertTimeStr) { | |
| 124 | + this.revertTimeStr = revertTimeStr; | |
| 125 | + } | |
| 126 | + | |
| 127 | + public Date getCreateDate() { | |
| 128 | + return createDate; | |
| 129 | + } | |
| 130 | + | |
| 131 | + public void setCreateDate(Date createDate) { | |
| 132 | + this.createDate = createDate; | |
| 133 | + } | |
| 134 | + | |
| 135 | + public Integer getStatus() { | |
| 136 | + return status; | |
| 137 | + } | |
| 138 | + | |
| 139 | + public void setStatus(Integer status) { | |
| 140 | + this.status = status; | |
| 141 | + } | |
| 142 | +} | ... | ... |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| ... | ... | @@ -111,6 +111,9 @@ public class ScheduleRealInfo { |
| 111 | 111 | |
| 112 | 112 | /**班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班 */ |
| 113 | 113 | private int status; |
| 114 | + | |
| 115 | + /** 是否是临加班次 */ | |
| 116 | + private boolean sflj; | |
| 114 | 117 | |
| 115 | 118 | /** 是否误点*/ |
| 116 | 119 | private boolean isLate; |
| ... | ... | @@ -135,13 +138,19 @@ public class ScheduleRealInfo { |
| 135 | 138 | private Long dfsjT; |
| 136 | 139 | |
| 137 | 140 | /** 指令下发状态 60: 已发送, 100: 设备确认收到, 200:驾驶员确认 0:失败 */ |
| 138 | - private Integer directiveState; | |
| 141 | + private Integer directiveState = -1; | |
| 142 | + | |
| 143 | + /** 起点站计划到达时间 */ | |
| 144 | + private String qdzArrDateJH; | |
| 145 | + | |
| 146 | + /** 起点站实际到达时间 */ | |
| 147 | + private String qdzArrDateSJ; | |
| 139 | 148 | |
| 140 | 149 | public void addRemarks(String remark){ |
| 141 | 150 | String newRem = this.getRemarks(); |
| 142 | 151 | if(null == newRem) |
| 143 | 152 | newRem = ""; |
| 144 | - newRem += remark; | |
| 153 | + newRem += remark + ";"; | |
| 145 | 154 | this.setRemarks(newRem); |
| 146 | 155 | } |
| 147 | 156 | |
| ... | ... | @@ -465,10 +474,17 @@ public class ScheduleRealInfo { |
| 465 | 474 | this.dfsjT = dfsjT; |
| 466 | 475 | } |
| 467 | 476 | |
| 477 | + public void setDfsjAll(Long dfsjT) { | |
| 478 | + this.dfsjT = dfsjT; | |
| 479 | + this.dfsj = sdfHHmm.format(new Date(this.dfsjT)); | |
| 480 | + } | |
| 481 | + | |
| 468 | 482 | @Transient |
| 469 | 483 | static SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); |
| 470 | 484 | @Transient |
| 471 | 485 | static SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| 486 | + @Transient | |
| 487 | + static SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 472 | 488 | |
| 473 | 489 | /** |
| 474 | 490 | * @throws ParseException |
| ... | ... | @@ -503,4 +519,29 @@ public class ScheduleRealInfo { |
| 503 | 519 | public boolean equals(Object obj) { |
| 504 | 520 | return this.id.equals(((ScheduleRealInfo)obj).getId()); |
| 505 | 521 | } |
| 522 | + | |
| 523 | + public String getQdzArrDateJH() { | |
| 524 | + return qdzArrDateJH; | |
| 525 | + } | |
| 526 | + | |
| 527 | + public void setQdzArrDateJH(String qdzArrDateJH) { | |
| 528 | + this.qdzArrDateJH = qdzArrDateJH; | |
| 529 | + } | |
| 530 | + | |
| 531 | + public String getQdzArrDateSJ() { | |
| 532 | + return qdzArrDateSJ; | |
| 533 | + } | |
| 534 | + | |
| 535 | + public void setQdzArrDateSJ(String qdzArrDateSJ) { | |
| 536 | + this.qdzArrDateSJ = qdzArrDateSJ; | |
| 537 | + } | |
| 538 | + | |
| 539 | + public boolean isSflj() { | |
| 540 | + return sflj; | |
| 541 | + } | |
| 542 | + | |
| 543 | + public void setSflj(boolean sflj) { | |
| 544 | + this.sflj = sflj; | |
| 545 | + } | |
| 546 | + | |
| 506 | 547 | } | ... | ... |
src/main/java/com/bsth/entity/search/PredicatesBuilder.java
| ... | ... | @@ -2,6 +2,9 @@ package com.bsth.entity.search; |
| 2 | 2 | |
| 3 | 3 | import java.text.NumberFormat; |
| 4 | 4 | import java.text.ParseException; |
| 5 | +import java.text.SimpleDateFormat; | |
| 6 | +import java.util.Date; | |
| 7 | + | |
| 5 | 8 | import javax.persistence.criteria.CriteriaBuilder; |
| 6 | 9 | import javax.persistence.criteria.Path; |
| 7 | 10 | import javax.persistence.criteria.Predicate; |
| ... | ... | @@ -107,4 +110,15 @@ public class PredicatesBuilder { |
| 107 | 110 | public static Predicate ist(CriteriaBuilder cb,Path<Boolean> expression, Object object){ |
| 108 | 111 | return cb.isTrue(expression); |
| 109 | 112 | } |
| 113 | + | |
| 114 | + public static Predicate date(CriteriaBuilder cb,Path<?> expression, Object object){ | |
| 115 | + Date time = null; | |
| 116 | + try { | |
| 117 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 118 | + time = sdf.parse(object.toString()); | |
| 119 | + } catch (Exception e) { | |
| 120 | + e.printStackTrace(); | |
| 121 | + } | |
| 122 | + return cb.equal(expression, time); | |
| 123 | + } | |
| 110 | 124 | } | ... | ... |
src/main/java/com/bsth/entity/search/SearchOperator.java
src/main/java/com/bsth/repository/SectionRouteRepository.java
| ... | ... | @@ -141,4 +141,13 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int |
| 141 | 141 | */ |
| 142 | 142 | @Query(value = " select MAX(r.sectionroute_code) as sectionrouteCode from bsth_c_sectionroute r WHERE r.line=?1 and r.directions =?2 and r.sectionroute_code< ?3", nativeQuery=true) |
| 143 | 143 | List<Object[]> findUpSectionRouteCode(Integer lineId,Integer direction,Integer stationRouteCode); |
| 144 | + | |
| 145 | + @Query(value = "SELECT " + | |
| 146 | + "c.directions," + | |
| 147 | + "AsText(s.bsection_vector) as bsection_vector," + | |
| 148 | + "s.speed_limit," + | |
| 149 | + "s.section_name " + | |
| 150 | + " FROM bsth_c_sectionroute c " + | |
| 151 | + " LEFT JOIN bsth_c_section s on c.section = s.id where c.line = ?1 and c.directions = ?2", nativeQuery=true) | |
| 152 | +List<Object[]> sectionRouteVector(Integer lineId,Integer directions); | |
| 144 | 153 | } | ... | ... |
src/main/java/com/bsth/repository/realcontrol/DeviceRevertLineRepository.java
0 → 100644
| 1 | +package com.bsth.repository.realcontrol; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +import org.springframework.data.jpa.repository.Query; | |
| 6 | +import org.springframework.stereotype.Repository; | |
| 7 | + | |
| 8 | +import com.bsth.entity.realcontrol.DeviceRevertLine; | |
| 9 | +import com.bsth.repository.BaseRepository; | |
| 10 | + | |
| 11 | +@Repository | |
| 12 | +public interface DeviceRevertLineRepository extends BaseRepository<DeviceRevertLine, Integer>{ | |
| 13 | + | |
| 14 | + @Query(value = "select dr from DeviceRevertLine dr where dr.revertTime > ?1 and dr.revertTime < ?2 and dr.status = ?3") | |
| 15 | + public List<DeviceRevertLine> findByDateAndStatus(Long st, Long et, Integer status); | |
| 16 | +} | ... | ... |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| 1 | 1 | package com.bsth.repository.realcontrol; |
| 2 | 2 | |
| 3 | 3 | import java.util.List; |
| 4 | +import java.util.Map; | |
| 4 | 5 | |
| 5 | 6 | import org.springframework.data.domain.Page; |
| 6 | 7 | import org.springframework.data.domain.Pageable; |
| ... | ... | @@ -21,4 +22,16 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 21 | 22 | @EntityGraph(value = "scheduleRealInfo_childTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 22 | 23 | @Override |
| 23 | 24 | Page<ScheduleRealInfo> findAll(Specification<ScheduleRealInfo> spec, Pageable pageable); |
| 25 | + | |
| 26 | + @Query(value="select s from ScheduleRealInfo s where s.xlName = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 group by jName,clZbh,lpName") | |
| 27 | + List<ScheduleRealInfo> queryUserInfo(String line,String date); | |
| 28 | + | |
| 29 | + @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3") | |
| 30 | + List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName); | |
| 31 | + | |
| 32 | + @Query(value="select new map(clZbh,jGh,jName,sum(jhlc)) from ScheduleRealInfo s where s.xlName = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 group by clZbh,jGh") | |
| 33 | + List<Map<String, Object>> dailyInfo(String line,String date); | |
| 34 | + | |
| 35 | + @Query(value="select s from ScheduleRealInfo s where s.xlName = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.clZbh like ?3") | |
| 36 | + List<ScheduleRealInfo> historyMessage(String line,String date,String code); | |
| 24 | 37 | } | ... | ... |
src/main/java/com/bsth/security/LoginSuccessHandler.java
| ... | ... | @@ -8,6 +8,7 @@ import javax.servlet.http.HttpServletResponse; |
| 8 | 8 | import org.springframework.security.core.Authentication; |
| 9 | 9 | import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; |
| 10 | 10 | |
| 11 | +import com.bsth.common.Constants; | |
| 11 | 12 | import com.bsth.entity.sys.SysUser; |
| 12 | 13 | import com.bsth.util.IpUtils; |
| 13 | 14 | |
| ... | ... | @@ -22,6 +23,8 @@ public class LoginSuccessHandler extends SavedRequestAwareAuthenticationSuccessH |
| 22 | 23 | System.out.println("管理员 " + user.getUserName() + " 登录"); |
| 23 | 24 | System.out.println("IP :"+IpUtils.getIpAddr(request)); |
| 24 | 25 | |
| 26 | + //session里写入用户名 | |
| 27 | + request.getSession().setAttribute(Constants.SESSION_USERNAME, user.getUserName()); | |
| 25 | 28 | super.onAuthenticationSuccess(request, response, authentication); |
| 26 | 29 | } |
| 27 | 30 | ... | ... |
src/main/java/com/bsth/security/filter/LoginInterceptor.java
| ... | ... | @@ -18,6 +18,7 @@ import org.springframework.security.access.intercept.AbstractSecurityInterceptor |
| 18 | 18 | import org.springframework.security.core.Authentication; |
| 19 | 19 | import org.springframework.security.core.context.SecurityContextHolder; |
| 20 | 20 | |
| 21 | +import com.alibaba.fastjson.JSON; | |
| 21 | 22 | import com.bsth.common.Constants; |
| 22 | 23 | import com.bsth.common.ResponseCode; |
| 23 | 24 | import com.bsth.util.RequestUtils; |
| ... | ... | @@ -52,7 +53,7 @@ public class LoginInterceptor extends AbstractSecurityInterceptor implements Fil |
| 52 | 53 | Map<String, Object> map = new HashMap<>(); |
| 53 | 54 | map.put("status", |
| 54 | 55 | ResponseCode.NO_AUTHENTICATION); |
| 55 | - response.getWriter().print(map); | |
| 56 | + response.getWriter().print(JSON.toJSONString(map)); | |
| 56 | 57 | } |
| 57 | 58 | else |
| 58 | 59 | response.sendRedirect(Constants.LOGIN_PAGE); | ... | ... |
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
| ... | ... | @@ -9,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 9 | import org.springframework.stereotype.Service; |
| 10 | 10 | |
| 11 | 11 | import com.alibaba.fastjson.JSONArray; |
| 12 | -import com.alibaba.fastjson.JSONObject; | |
| 13 | 12 | import com.bsth.common.ResponseCode; |
| 14 | 13 | import com.bsth.entity.Line; |
| 15 | 14 | import com.bsth.entity.Section; |
| ... | ... | @@ -122,7 +121,7 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 122 | 121 | Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); |
| 123 | 122 | |
| 124 | 123 | // 线路ID |
| 125 | - Integer sectionRouteLine =map.get("sectionRouteLine").equals("") ? null : Integer.parseInt(map.get("sectionRouteLine").toString()); | |
| 124 | + Integer sectionRouteLine = map.get("sectionRouteLine").equals("") ? null : Integer.parseInt(map.get("sectionRouteLine").toString()); | |
| 126 | 125 | |
| 127 | 126 | // 道路编码 |
| 128 | 127 | String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); |
| ... | ... | @@ -403,16 +402,18 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 403 | 402 | // 路段路由 |
| 404 | 403 | SectionRoute sectionRoute = new SectionRoute(); |
| 405 | 404 | |
| 406 | - String sectionrouteCodeArray[] = null; | |
| 407 | - | |
| 408 | 405 | Integer routeCode = null; |
| 409 | 406 | |
| 410 | 407 | if(!sectionrouteCode.equals("")){ |
| 411 | 408 | |
| 412 | - sectionrouteCodeArray = sectionrouteCode.split("_"); | |
| 409 | + String sectionrouteCodeArray[] = sectionrouteCode.split("_"); | |
| 413 | 410 | |
| 414 | 411 | routeCode = Integer.valueOf(sectionrouteCodeArray[0])+1; |
| 415 | 412 | |
| 413 | + }else { | |
| 414 | + | |
| 415 | + routeCode = 100; | |
| 416 | + | |
| 416 | 417 | } |
| 417 | 418 | |
| 418 | 419 | sectionRoute.setSectionrouteCode(routeCode); | ... | ... |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| 1 | 1 | package com.bsth.service.impl; |
| 2 | 2 | |
| 3 | +import java.awt.Point; | |
| 3 | 4 | import java.io.ByteArrayInputStream; |
| 5 | +import java.io.File; | |
| 4 | 6 | import java.io.InputStream; |
| 5 | 7 | import java.util.ArrayList; |
| 6 | 8 | import java.util.HashMap; |
| 7 | 9 | import java.util.List; |
| 8 | 10 | import java.util.Map; |
| 11 | +import java.util.Properties; | |
| 9 | 12 | |
| 10 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 14 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -20,6 +23,8 @@ import com.bsth.repository.StationRepository; |
| 20 | 23 | import com.bsth.repository.StationRouteRepository; |
| 21 | 24 | import com.bsth.service.StationRouteService; |
| 22 | 25 | import com.bsth.util.FTPClientUtils; |
| 26 | +import com.bsth.util.Test; | |
| 27 | +import com.bsth.util.db.DBUtils_MS; | |
| 23 | 28 | |
| 24 | 29 | /** |
| 25 | 30 | * |
| ... | ... | @@ -512,106 +517,316 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 512 | 517 | // 获取线路ID |
| 513 | 518 | Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); |
| 514 | 519 | |
| 520 | + /** 查询线路信息 */ | |
| 515 | 521 | Line line = lineRepository.findOne(lineId); |
| 516 | 522 | |
| 517 | 523 | List<Object[]> objects = repository.usingSingle(lineId); |
| 518 | 524 | |
| 519 | - String stationRStr = ""; | |
| 525 | + if (objects.size()>0) { | |
| 526 | + | |
| 527 | + /** 获取配置文件里的ftp参数 */ | |
| 528 | + Map<String, Object> FTPParamMap = readPropertiesGetFTPParam(); | |
| 529 | + | |
| 530 | + // 压缩文件名 | |
| 531 | + String odlGzFileName = line.getLineCode() + ".txt.gz"; | |
| 532 | + | |
| 533 | + // text文件名 | |
| 534 | + String textFileName = line.getLineCode() + ".txt"; | |
| 535 | + | |
| 536 | + FTPClientUtils clientUtils = new FTPClientUtils(); | |
| 537 | + | |
| 538 | + String url = FTPParamMap.get("url").toString(); | |
| 539 | + | |
| 540 | + int port = Integer.valueOf(FTPParamMap.get("port").toString()); | |
| 541 | + | |
| 542 | + String username = FTPParamMap.get("username").toString(); | |
| 543 | + | |
| 544 | + String password = FTPParamMap.get("password").toString(); | |
| 545 | + | |
| 546 | + String remotePath = FTPParamMap.get("remotePath").toString(); | |
| 547 | + | |
| 548 | + /** 如果行单文件已存在则删除 */ | |
| 549 | + clientUtils.deleteFtpFile(url, port, username, password, remotePath, odlGzFileName); | |
| 550 | + | |
| 551 | + clientUtils.deleteFtpFile(url, port, username, password, remotePath, textFileName); | |
| 552 | + | |
| 553 | + String textStr = newTextFileToFTP(objects,lineId); | |
| 554 | + | |
| 555 | + /*textStr = line.getName() + "\t" + "2" + "\r\n" + textStr;*/ | |
| 556 | + | |
| 557 | + textStr = line.getName() + "\t" + "2" + "\r" + textStr; | |
| 558 | + | |
| 559 | + InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk")); | |
| 560 | + | |
| 561 | + /** 生成text文件 */ | |
| 562 | + clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input); | |
| 563 | + | |
| 564 | + Test test= new Test(); | |
| 565 | + | |
| 566 | + File textFile = clientUtils.GetFtpFile(url, port, username, password, remotePath, textFileName); | |
| 567 | + | |
| 568 | + File[] sources = new File[] {textFile}; | |
| 569 | + | |
| 570 | + File target = new File(odlGzFileName); | |
| 571 | + | |
| 572 | + File targetFile = test.pack(sources, target); | |
| 573 | + | |
| 574 | + /*clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/ | |
| 575 | + | |
| 576 | + clientUtils.testUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath); | |
| 577 | + | |
| 578 | + resultMap.put("status", ResponseCode.SUCCESS); | |
| 579 | + | |
| 580 | + }else { | |
| 581 | + | |
| 582 | + resultMap.put("status","NOTDATA"); | |
| 583 | + } | |
| 584 | + | |
| 585 | + | |
| 586 | + } catch (Exception e) { | |
| 587 | + | |
| 588 | + resultMap.put("status", ResponseCode.ERROR); | |
| 520 | 589 | |
| 521 | - // windows下的文本文件换行符 | |
| 522 | - // String enterStr = "\r\n"; | |
| 590 | + logger.error("save erro.", e); | |
| 523 | 591 | |
| 524 | - // linux/unix下的文本文件换行符 | |
| 525 | - String enterStr = "\r"; | |
| 592 | + } | |
| 593 | + return resultMap; | |
| 594 | + } | |
| 595 | + | |
| 596 | + public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { | |
| 597 | + | |
| 598 | + String stationRStr = ""; | |
| 599 | + | |
| 600 | + // windows下的文本文件换行符 | |
| 601 | + // String enterStr = "\r\n"; | |
| 602 | + | |
| 603 | + // linux/unix下的文本文件换行符 | |
| 604 | + String enterStr = "\r"; | |
| 605 | + | |
| 606 | + if(objects.size()>0) { | |
| 526 | 607 | |
| 527 | - if(objects.size()>0) { | |
| 608 | + for(int i = 0; i<objects.size();i++) { | |
| 609 | + | |
| 610 | + // 经度 | |
| 611 | + String lng = objects.get(i)[0].equals("") ? "" : objects.get(i)[0].toString(); | |
| 612 | + | |
| 613 | + // 纬度 | |
| 614 | + String lat = objects.get(i)[1].equals("") ? "" : objects.get(i)[1].toString(); | |
| 528 | 615 | |
| 529 | - for(int i = 0; i<objects.size();i++) { | |
| 616 | + lat = "\t" + lat; | |
| 617 | + | |
| 618 | + // 站点类型 | |
| 619 | + String stationMake = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); | |
| 620 | + | |
| 621 | + if(stationMake.equals("E")) { | |
| 530 | 622 | |
| 531 | - // 经度 | |
| 532 | - String lng = objects.get(i)[0].toString(); | |
| 623 | + stationMake = "\t" + "2"; | |
| 533 | 624 | |
| 534 | - // 纬度 | |
| 535 | - String lat = " " + objects.get(i)[1].toString(); | |
| 625 | + }else { | |
| 536 | 626 | |
| 537 | - // 站点类型 | |
| 538 | - String stationMake = objects.get(i)[3].toString(); | |
| 627 | + stationMake ="\t" + "1"; | |
| 539 | 628 | |
| 540 | - if(stationMake.equals("E")) { | |
| 629 | + } | |
| 630 | + | |
| 631 | + // 站点序号 | |
| 632 | + String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); | |
| 633 | + | |
| 634 | + stationNo = "\t" + stationNo; | |
| 635 | + | |
| 636 | + // 站点编码 | |
| 637 | + String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); | |
| 638 | + | |
| 639 | + stationCode = "\t" +stationCode; | |
| 640 | + | |
| 641 | + double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString()); | |
| 642 | + | |
| 643 | + double tempd = dis*1000; | |
| 644 | + | |
| 645 | + // 站点距离 | |
| 646 | + String staitondistance = "\t" + String.valueOf((int) tempd); | |
| 647 | + | |
| 648 | + // 站点名称 | |
| 649 | + String stationName = objects.get(i)[7].equals("") ? "" : objects.get(i)[7].toString(); | |
| 650 | + | |
| 651 | + // 限速 | |
| 652 | + // String sleepStr = " " + "60"; | |
| 653 | + | |
| 654 | + String sleepStr = ""; | |
| 655 | + | |
| 656 | + int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); | |
| 657 | + | |
| 658 | + List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); | |
| 659 | + | |
| 660 | + if(sobje.size()==1) { | |
| 661 | + | |
| 662 | + sleepStr = sobje.get(0)[2] == null ? "" : sobje.get(0)[2].toString(); | |
| 663 | + | |
| 664 | + sleepStr = "\t" + sleepStr; | |
| 665 | + | |
| 666 | + }else if(sobje.size()>1){ | |
| 667 | + | |
| 668 | + /** 这里暂时只根据站点名称去匹配所在路段的限速值 ,如果路段名称"至"之前的地名与站点名称等同,就认为站点在路段上。 */ | |
| 669 | + for(int j =0;j<sobje.size();j++) { | |
| 541 | 670 | |
| 542 | - stationMake = " " + "2"; | |
| 671 | + String sectionName = sobje.get(j)[3].toString(); | |
| 543 | 672 | |
| 544 | - }else { | |
| 673 | + String sectionNameA[] = sectionName.split("至"); | |
| 545 | 674 | |
| 546 | - stationMake =" " + "1"; | |
| 675 | + if(stationName.equals(sectionNameA[0])){ | |
| 676 | + | |
| 677 | + sleepStr = sobje.get(j)[2].toString(); | |
| 678 | + | |
| 679 | + sleepStr = "\t" + sleepStr; | |
| 680 | + | |
| 681 | + } | |
| 547 | 682 | |
| 548 | 683 | } |
| 549 | 684 | |
| 550 | - // 站点序号 | |
| 551 | - String stationNo = " " + objects.get(i)[4].toString(); | |
| 552 | - | |
| 553 | - // 站点编码 | |
| 554 | - String stationCode = " " + objects.get(i)[5].toString(); | |
| 685 | + /* | |
| 686 | + String bdJWPointStr = objects.get(i)[2].toString(); | |
| 555 | 687 | |
| 556 | - double tempd = Double.parseDouble(objects.get(i)[6].toString())*1000; | |
| 688 | + String bdJWPointA[] = bdJWPointStr.split(" "); | |
| 557 | 689 | |
| 558 | - // 站点距离 | |
| 559 | - String staitondistance = " " + String.valueOf((int) tempd); | |
| 690 | + Map<String, Object> pointsM = new HashMap<String,Object>(); | |
| 560 | 691 | |
| 561 | - // 限速 | |
| 562 | - String sleepStr = " " + "60"; | |
| 692 | + pointsM.put("lng", bdJWPointA[0]); | |
| 563 | 693 | |
| 564 | - // 站点名称 | |
| 565 | - String staitonName = " " + objects.get(i)[7].toString(); | |
| 694 | + pointsM.put("lat", bdJWPointA[1]); | |
| 566 | 695 | |
| 567 | - stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + staitonName + enterStr; | |
| 696 | + System.out.println(objects.get(i)[7].toString()); | |
| 568 | 697 | |
| 698 | + sleepStr = sleepStr + GetFormPointOnPolylineSeleepLimit(pointsM,sobje);*/ | |
| 569 | 699 | } |
| 570 | 700 | |
| 701 | + if(sleepStr.equals("")) | |
| 702 | + sleepStr = "\t" + "60"; | |
| 703 | + | |
| 704 | + | |
| 705 | + stationName = "\t" +stationName; | |
| 706 | + | |
| 707 | + stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; | |
| 708 | + | |
| 571 | 709 | } |
| 572 | 710 | |
| 573 | - System.out.println(stationRStr); | |
| 574 | - | |
| 575 | - FTPClientUtils ftpClientUtils = new FTPClientUtils(); | |
| 711 | + } | |
| 712 | + | |
| 713 | + return stationRStr; | |
| 714 | + | |
| 715 | + } | |
| 716 | + | |
| 717 | + public String GetFormPointOnPolylineSeleepLimit(Map<String, Object> p,List<Object[]> listObjArra) { | |
| 718 | + | |
| 719 | + String sleeplimiV = ""; | |
| 720 | + | |
| 721 | + int size = listObjArra.size(); | |
| 722 | + | |
| 723 | + if(size>0) { | |
| 576 | 724 | |
| 577 | - // ip | |
| 578 | - String url = "222.66.0.205"; | |
| 725 | + for(int i =0;i<size-1;i++) { | |
| 726 | + | |
| 727 | + System.out.println(listObjArra.get(i)[3].toString()); | |
| 728 | + | |
| 729 | + | |
| 730 | + List<Map<String, Object>> listM = new ArrayList<Map<String,Object>>(); | |
| 731 | + | |
| 732 | + String bVecotr = listObjArra.get(i)[1].toString(); | |
| 733 | + | |
| 734 | + bVecotr = bVecotr.substring(11,bVecotr.length()-1); | |
| 735 | + | |
| 736 | + String tempA [] = bVecotr.split(","); | |
| 737 | + | |
| 738 | + int len = tempA.length; | |
| 739 | + | |
| 740 | + for(int e = 0; e< len ;e++) { | |
| 741 | + | |
| 742 | + Map<String, Object> tempM = new HashMap<String,Object>(); | |
| 743 | + | |
| 744 | + String temStr = tempA[e]; | |
| 745 | + | |
| 746 | + String nextTemA[] = temStr.split(" "); | |
| 747 | + | |
| 748 | + tempM.put("lng", nextTemA[0]); | |
| 749 | + | |
| 750 | + tempM.put("lat", nextTemA[1]); | |
| 751 | + | |
| 752 | + listM.add(tempM); | |
| 753 | + | |
| 754 | + } | |
| 755 | + | |
| 756 | + if(isPointOnPolyline(p,listM)) { | |
| 757 | + | |
| 758 | + | |
| 759 | + sleeplimiV = listObjArra.get(i)[2].toString(); | |
| 760 | + } | |
| 761 | + | |
| 762 | + } | |
| 763 | + | |
| 764 | + } | |
| 765 | + | |
| 766 | + | |
| 767 | + return sleeplimiV; | |
| 768 | + } | |
| 769 | + | |
| 770 | + public boolean isPointOnPolyline (Map<String, Object> point, List<Map<String, Object>> listMap ){ | |
| 771 | + | |
| 772 | + boolean success = false; | |
| 773 | + | |
| 774 | + for(int l = 0; l < listMap.size() - 1; l ++){ | |
| 579 | 775 | |
| 580 | - // ftp端口 | |
| 581 | - int port = 21; | |
| 776 | + Map<String, Object> tempM = listMap.get(l); | |
| 582 | 777 | |
| 583 | - // 用户名 | |
| 584 | - String username = "transport"; | |
| 778 | + Map<String, Object> nextTempM = listMap.get(l+1); | |
| 585 | 779 | |
| 586 | - // 密码 | |
| 587 | - String password = "transport123"; | |
| 780 | + if (Double.valueOf(point.get("lng").toString())>= Math.min(Double.valueOf(tempM.get("lng").toString()), Double.valueOf(nextTempM.get("lng").toString())) && Double.valueOf(point.get("lng").toString()) <= Math.max(Double.valueOf(tempM.get("lng").toString()), Double.valueOf(nextTempM.get("lng").toString())) && | |
| 781 | + Double.valueOf(point.get("lat").toString()) >= Math.min(Double.valueOf(tempM.get("lat").toString()), Double.valueOf(nextTempM.get("lat").toString())) && Double.valueOf(point.get("lat").toString()) <= Math.max(Double.valueOf(tempM.get("lat").toString()), Double.valueOf(nextTempM.get("lat").toString()))){ | |
| 782 | + | |
| 783 | + | |
| 784 | + double precision = (Double.valueOf(tempM.get("lng").toString()) - Double.valueOf(point.get("lng").toString())) * (Double.valueOf(nextTempM.get("lat").toString()) - Double.valueOf(point.get("lat").toString())) - | |
| 785 | + (Double.valueOf(nextTempM.get("lng").toString()) - Double.valueOf(tempM.get("lng").toString())) * (Double.valueOf(tempM.get("lat").toString()) - Double.valueOf(nextTempM.get("lat").toString())); | |
| 786 | + | |
| 787 | + if(precision < 2e-10 && precision > -2e-10){ | |
| 788 | + | |
| 789 | + //实质判断是否接近0 | |
| 790 | + success = true; | |
| 791 | + | |
| 792 | + } | |
| 793 | + | |
| 794 | + } | |
| 588 | 795 | |
| 589 | - // 路径 | |
| 590 | - String path = "down/"; | |
| 796 | + } | |
| 797 | + | |
| 798 | + return success; | |
| 799 | + } | |
| 800 | + | |
| 801 | + public Map<String, Object> readPropertiesGetFTPParam(){ | |
| 802 | + | |
| 803 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | |
| 804 | + | |
| 805 | + Properties env = new Properties(); | |
| 806 | + | |
| 807 | + try { | |
| 591 | 808 | |
| 592 | - // 文件名 | |
| 593 | - String filename = line.getLineCode() + ".txt"; | |
| 809 | + env.load(DBUtils_MS.class.getClassLoader().getResourceAsStream("ftp.properties")); | |
| 594 | 810 | |
| 595 | - String versions = "2"; | |
| 811 | + resultMap.put("url", env.getProperty("ftp.url")); | |
| 596 | 812 | |
| 597 | - stationRStr = line.getName() + " " +versions + enterStr + stationRStr; | |
| 813 | + resultMap.put("port", env.getProperty("ftp.port")); | |
| 598 | 814 | |
| 599 | - InputStream input = new ByteArrayInputStream(stationRStr.getBytes("utf-8")); | |
| 815 | + resultMap.put("username", env.getProperty("ftp.username")); | |
| 600 | 816 | |
| 601 | - boolean b = ftpClientUtils.uploadFile(url, port, username, password, path, filename, input); | |
| 817 | + resultMap.put("password", env.getProperty("ftp.password")); | |
| 602 | 818 | |
| 603 | - resultMap.put("status", ResponseCode.SUCCESS); | |
| 819 | + resultMap.put("remotePath", env.getProperty("ftp.path")); | |
| 604 | 820 | |
| 605 | 821 | } catch (Exception e) { |
| 606 | 822 | |
| 607 | - resultMap.put("status", ResponseCode.ERROR); | |
| 823 | + e.printStackTrace(); | |
| 608 | 824 | |
| 609 | - logger.error("save erro.", e); | |
| 610 | - | |
| 611 | - } | |
| 612 | - return resultMap; | |
| 825 | + } | |
| 826 | + | |
| 827 | + return resultMap ; | |
| 613 | 828 | } |
| 614 | - | |
| 829 | + | |
| 615 | 830 | @Override |
| 616 | 831 | public List<Map<String, Object>> findStationRouteInfo(Map<String, Object> map) { |
| 617 | 832 | ... | ... |
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| ... | ... | @@ -866,25 +866,32 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 866 | 866 | Line resultLine = lineRepository.findOne(line); |
| 867 | 867 | |
| 868 | 868 | // 站点路由序号 |
| 869 | - String stationRouteCode = map.get("stationRouteCode").equals("") ? "" : map.get("stationRouteCode").toString(); | |
| 869 | + String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? "" : map.get("stationRouteCode").toString(); | |
| 870 | 870 | |
| 871 | 871 | // 站点类型 |
| 872 | 872 | String stationMark = map.get("stationMark").equals("") ? "" : map.get("stationMark").toString(); |
| 873 | 873 | |
| 874 | - String stationRouteCodeArray [] = null; | |
| 874 | + Integer stationRouteCode = null; | |
| 875 | 875 | |
| 876 | - if(stationRouteCode!="") { | |
| 876 | + if(stationRouteCodeStr!="") { | |
| 877 | + | |
| 878 | + String stationRouteCodeArray [] = stationRouteCodeStr.split("_"); | |
| 877 | 879 | |
| 878 | - stationRouteCodeArray= stationRouteCode.split("_"); | |
| 880 | + stationRouteCode = Integer.parseInt(stationRouteCodeArray[0]+1); | |
| 881 | + | |
| 882 | + | |
| 883 | + }else { | |
| 884 | + | |
| 885 | + stationRouteCode = 100; | |
| 879 | 886 | |
| 880 | 887 | } |
| 881 | 888 | |
| 882 | 889 | // 保存站点 |
| 883 | - /*repository.stationSave(stationCod, stationName, roadCoding, dbType, bJwpoints, | |
| 890 | + repository.stationSave(stationCod, stationName, roadCoding, dbType, bJwpoints, | |
| 884 | 891 | |
| 885 | 892 | gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius, |
| 886 | - | |
| 887 | - shapesType, versions, descriptions, createBy, updateBy,stationId);*/ | |
| 893 | + | |
| 894 | + shapesType, versions, descriptions, createBy, updateBy,stationId); | |
| 888 | 895 | |
| 889 | 896 | |
| 890 | 897 | |
| ... | ... | @@ -908,7 +915,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 908 | 915 | arg0.setStationCode(stationCod); |
| 909 | 916 | |
| 910 | 917 | // 站点路由序号 |
| 911 | - arg0.setStationRouteCode(Integer.parseInt(stationRouteCodeArray[0])+1); | |
| 918 | + arg0.setStationRouteCode(stationRouteCode); | |
| 912 | 919 | |
| 913 | 920 | // 站点路由类型 |
| 914 | 921 | arg0.setStationMark(stationMark); |
| ... | ... | @@ -931,7 +938,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 931 | 938 | // 站点路由说明 |
| 932 | 939 | arg0.setDescriptions(descriptions); |
| 933 | 940 | |
| 934 | - /*routeRepository.save(arg0);*/ | |
| 941 | + routeRepository.save(arg0); | |
| 935 | 942 | |
| 936 | 943 | resultMap.put("status", ResponseCode.SUCCESS); |
| 937 | 944 | ... | ... |
src/main/java/com/bsth/service/realcontrol/DeviceRevertLineService.java
0 → 100644
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| ... | ... | @@ -24,4 +24,56 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L |
| 24 | 24 | |
| 25 | 25 | List<Map<String, String>> findCarByLine(String lineCode); |
| 26 | 26 | |
| 27 | + List<Map<String, String>> sreachVehic(String nbbm); | |
| 28 | + | |
| 29 | + Map<String, Object> adjust(Long id, String nbbm, String jsy, String spy); | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * | |
| 33 | + * @Title: adjustCar | |
| 34 | + * @Description: TODO(班次调整车辆) | |
| 35 | + * @param @param schedule 班次 | |
| 36 | + * @param @param car 车辆自编号 | |
| 37 | + * @throws | |
| 38 | + */ | |
| 39 | + void adjustCar(ScheduleRealInfo schedule, String car); | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * | |
| 43 | + * @Title: adjustDriver | |
| 44 | + * @Description: TODO(班次调整驾驶员) | |
| 45 | + * @param @param schedule 班次 | |
| 46 | + * @param @param driver 驾驶员工号 | |
| 47 | + * @throws | |
| 48 | + */ | |
| 49 | + void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName); | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * | |
| 53 | + * @Title: adjustConductor | |
| 54 | + * @Description: TODO(班次调整售票员) | |
| 55 | + * @param @param schedule 班次 | |
| 56 | + * @param @param conductor 售票员工号 | |
| 57 | + * @throws | |
| 58 | + */ | |
| 59 | + void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName); | |
| 60 | + | |
| 61 | + List<ScheduleRealInfo> queryUserInfo(String line,String date); | |
| 62 | + | |
| 63 | + List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName); | |
| 64 | + | |
| 65 | + List<Map<String,Object>> dailyInfo(String line,String date); | |
| 66 | + | |
| 67 | + List<ScheduleRealInfo> historyMessage(String line,String date,String code); | |
| 68 | + | |
| 69 | + Map<Integer, Integer> trustStatus(String lineCodes); | |
| 70 | + | |
| 71 | + Map<String, Object> realOutAdjust(Long id, String fcsjActual, String remarks); | |
| 72 | + | |
| 73 | + Map<String, Object> revokeDestroy(Long id); | |
| 74 | + | |
| 75 | + Map<String, Object> revokeRealOutgo(Long id); | |
| 76 | + | |
| 77 | + Map<String, Object> spaceAdjust(Long[] ids, Integer space); | |
| 78 | + | |
| 27 | 79 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/buffer/ScheduleBuffer.java
| ... | ... | @@ -6,6 +6,7 @@ import java.util.HashMap; |
| 6 | 6 | import java.util.LinkedList; |
| 7 | 7 | import java.util.List; |
| 8 | 8 | import java.util.Map; |
| 9 | +import java.util.Set; | |
| 9 | 10 | |
| 10 | 11 | import org.slf4j.Logger; |
| 11 | 12 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -54,6 +55,12 @@ public class ScheduleBuffer { |
| 54 | 55 | */ |
| 55 | 56 | public static LinkedList<ScheduleRealInfo> persistentList; |
| 56 | 57 | |
| 58 | + /** | |
| 59 | + * 线路是否托管 | |
| 60 | + * K:线路编码 V:0 托管 1 非托管 | |
| 61 | + */ | |
| 62 | + public static Map<Integer, Integer> trustMap; | |
| 63 | + | |
| 57 | 64 | static ScheduleComparator scheduleComparator = new ScheduleComparator(); |
| 58 | 65 | |
| 59 | 66 | static{ |
| ... | ... | @@ -63,6 +70,8 @@ public class ScheduleBuffer { |
| 63 | 70 | vehLinkedMap = new HashMap<>(); |
| 64 | 71 | |
| 65 | 72 | finishLinkedMap = LinkedListMultimap.create(); |
| 73 | + | |
| 74 | + trustMap = new HashMap<>(); | |
| 66 | 75 | } |
| 67 | 76 | |
| 68 | 77 | public static int init(List<ScheduleRealInfo> list){ |
| ... | ... | @@ -83,6 +92,11 @@ public class ScheduleBuffer { |
| 83 | 92 | |
| 84 | 93 | vehLinkedMap.get(zbh).add(schedul); |
| 85 | 94 | } |
| 95 | + | |
| 96 | + //计算起点应到时间 | |
| 97 | + Set<String> codes = schedulListMap.keySet(); | |
| 98 | + for(String code : codes) | |
| 99 | + calcArrDateQd(code); | |
| 86 | 100 | }catch(Exception e){ |
| 87 | 101 | logger.error("缓存排班数据失败...", e); |
| 88 | 102 | return -1; |
| ... | ... | @@ -117,7 +131,7 @@ public class ScheduleBuffer { |
| 117 | 131 | * @Title: finishSch |
| 118 | 132 | * @Description: TODO(完成一个班次) |
| 119 | 133 | * @param @param sch |
| 120 | - * @return ScheduleRealInfo 返回 下一个待执行的班次 | |
| 134 | + * @return ScheduleRealInfo 返回 下一个未执行的班次 | |
| 121 | 135 | * @throws |
| 122 | 136 | */ |
| 123 | 137 | public static ScheduleRealInfo finishSch(ScheduleRealInfo sch){ |
| ... | ... | @@ -136,8 +150,9 @@ public class ScheduleBuffer { |
| 136 | 150 | break; |
| 137 | 151 | } |
| 138 | 152 | } |
| 139 | - | |
| 140 | - return list.getFirst(); | |
| 153 | + ScheduleRealInfo next = list.getFirst(); | |
| 154 | + next.setQdzArrDateSJ(sch.getZdsjActual()); | |
| 155 | + return next; | |
| 141 | 156 | } |
| 142 | 157 | |
| 143 | 158 | /** |
| ... | ... | @@ -150,4 +165,46 @@ public class ScheduleBuffer { |
| 150 | 165 | public static int getFinishSchNo(String nbbm){ |
| 151 | 166 | return finishLinkedMap.get(nbbm) == null ? 0 : finishLinkedMap.get(nbbm).size(); |
| 152 | 167 | } |
| 168 | + | |
| 169 | + /** | |
| 170 | + * | |
| 171 | + * @Title: calcArrDateQd | |
| 172 | + * @Description: TODO(计算计划起点时间) | |
| 173 | + * @throws | |
| 174 | + */ | |
| 175 | + public static void calcArrDateQd(String lineCode){ | |
| 176 | + List<ScheduleRealInfo> list = schedulListMap.get(lineCode); | |
| 177 | + //按车辆分组 | |
| 178 | + ArrayListMultimap<String, ScheduleRealInfo> map = ArrayListMultimap.create(); | |
| 179 | + for(ScheduleRealInfo sch : list){ | |
| 180 | + map.put(sch.getClZbh(), sch); | |
| 181 | + } | |
| 182 | + | |
| 183 | + //链接班次 | |
| 184 | + Set<String> set = map.keySet(); | |
| 185 | + List<ScheduleRealInfo> subList; | |
| 186 | + int len; | |
| 187 | + ScheduleRealInfo prve, curr; | |
| 188 | + for(String k : set){ | |
| 189 | + subList = map.get(k); | |
| 190 | + //排序 | |
| 191 | + Collections.sort(subList, scheduleComparator); | |
| 192 | + len = subList.size(); | |
| 193 | + if(len == 0) | |
| 194 | + continue; | |
| 195 | + | |
| 196 | + prve = subList.get(0); | |
| 197 | + for(int i = 1; i < len; i ++){ | |
| 198 | + curr = subList.get(i); | |
| 199 | + if(prve.getZdzName().equals(curr.getQdzName())) | |
| 200 | + curr.setQdzArrDateJH(prve.getZdsj()); | |
| 201 | + | |
| 202 | + prve = curr; | |
| 203 | + } | |
| 204 | + } | |
| 205 | + } | |
| 206 | + | |
| 207 | + public static ScheduleRealInfo findOne(Long id){ | |
| 208 | + return pkSchedulMap.get(id); | |
| 209 | + } | |
| 153 | 210 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/DeviceRevertLineServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.realcontrol.impl; | |
| 2 | + | |
| 3 | +import java.text.ParseException; | |
| 4 | +import java.text.SimpleDateFormat; | |
| 5 | +import java.util.Date; | |
| 6 | +import java.util.Map; | |
| 7 | + | |
| 8 | +import org.slf4j.Logger; | |
| 9 | +import org.slf4j.LoggerFactory; | |
| 10 | +import org.springframework.stereotype.Service; | |
| 11 | + | |
| 12 | +import com.bsth.entity.realcontrol.DeviceRevertLine; | |
| 13 | +import com.bsth.service.impl.BaseServiceImpl; | |
| 14 | +import com.bsth.service.realcontrol.DeviceRevertLineService; | |
| 15 | + | |
| 16 | +@Service | |
| 17 | +public class DeviceRevertLineServiceImpl extends BaseServiceImpl<DeviceRevertLine, Integer> implements DeviceRevertLineService { | |
| 18 | + | |
| 19 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 20 | + | |
| 21 | + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm") | |
| 22 | + ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd") | |
| 23 | + ,sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 24 | + | |
| 25 | + @Override | |
| 26 | + public Map<String, Object> save(DeviceRevertLine t) { | |
| 27 | + | |
| 28 | + String dateStr = sdfyyyyMMdd.format(new Date()); | |
| 29 | + | |
| 30 | + try { | |
| 31 | + t.setStatus(0); | |
| 32 | + t.setBorrowTime(sdfyyyyMMddHHmm.parse(dateStr + " " + t.getBorrowTimeStr()).getTime()); | |
| 33 | + t.setRevertTime(sdfyyyyMMddHHmm.parse(dateStr + " " + t.getRevertTimeStr()).getTime()); | |
| 34 | + } catch (ParseException e) { | |
| 35 | + logger.error("", e); | |
| 36 | + } | |
| 37 | + return super.save(t); | |
| 38 | + } | |
| 39 | +} | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| 1 | 1 | package com.bsth.service.realcontrol.impl; |
| 2 | 2 | |
| 3 | +import java.io.File; | |
| 3 | 4 | import java.text.SimpleDateFormat; |
| 4 | 5 | import java.util.ArrayList; |
| 5 | 6 | import java.util.Collection; |
| 7 | +import java.util.Collections; | |
| 6 | 8 | import java.util.Date; |
| 7 | 9 | import java.util.HashMap; |
| 10 | +import java.util.Iterator; | |
| 8 | 11 | import java.util.List; |
| 9 | 12 | import java.util.Map; |
| 13 | +import java.util.Set; | |
| 10 | 14 | |
| 11 | -import javax.transaction.Transactional; | |
| 12 | - | |
| 15 | +import org.apache.commons.lang3.StringUtils; | |
| 13 | 16 | import org.slf4j.Logger; |
| 14 | 17 | import org.slf4j.LoggerFactory; |
| 15 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -17,6 +20,7 @@ import org.springframework.stereotype.Service; |
| 17 | 20 | |
| 18 | 21 | import com.bsth.common.ResponseCode; |
| 19 | 22 | import com.bsth.entity.Cars; |
| 23 | +import com.bsth.entity.Line; | |
| 20 | 24 | import com.bsth.entity.Personnel; |
| 21 | 25 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 22 | 26 | import com.bsth.entity.schedule.CarConfigInfo; |
| ... | ... | @@ -29,36 +33,38 @@ import com.bsth.security.util.SecurityUtils; |
| 29 | 33 | import com.bsth.service.impl.BaseServiceImpl; |
| 30 | 34 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 31 | 35 | import com.bsth.service.realcontrol.buffer.ScheduleBuffer; |
| 36 | +import com.bsth.util.ReportUtils; | |
| 37 | +import com.bsth.vehicle.common.CommonMapped; | |
| 32 | 38 | import com.google.common.base.Splitter; |
| 33 | 39 | import com.google.common.collect.ArrayListMultimap; |
| 34 | 40 | import com.google.common.collect.Lists; |
| 35 | 41 | import com.google.common.collect.Multimap; |
| 36 | 42 | |
| 37 | 43 | @Service |
| 38 | -public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long> implements ScheduleRealInfoService{ | |
| 44 | +public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long> | |
| 45 | + implements ScheduleRealInfoService { | |
| 39 | 46 | |
| 40 | 47 | @Autowired |
| 41 | 48 | ScheduleRealInfoRepository scheduleRealInfoRepository; |
| 42 | - | |
| 49 | + | |
| 43 | 50 | @Autowired |
| 44 | 51 | EmployeeConfigInfoRepository employeeConfigInfoRepository; |
| 45 | - | |
| 52 | + | |
| 46 | 53 | @Autowired |
| 47 | 54 | CarConfigInfoRepository carConfigInfoRepository; |
| 48 | - | |
| 55 | + | |
| 49 | 56 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 50 | - | |
| 51 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd") | |
| 52 | - , sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm") | |
| 53 | - , sdfShort = new SimpleDateFormat("HH:mm"); | |
| 54 | - | |
| 57 | + | |
| 58 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 59 | + sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm"), sdfShort = new SimpleDateFormat("HH:mm"); | |
| 60 | + | |
| 55 | 61 | @Override |
| 56 | 62 | public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) { |
| 57 | 63 | List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines)); |
| 58 | - | |
| 64 | + | |
| 59 | 65 | Multimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create(); |
| 60 | - | |
| 61 | - for(String lineCode : lineList){ | |
| 66 | + | |
| 67 | + for (String lineCode : lineList) { | |
| 62 | 68 | mMap.putAll(lineCode, ScheduleBuffer.schedulListMap.get(lineCode)); |
| 63 | 69 | } |
| 64 | 70 | return mMap.asMap(); |
| ... | ... | @@ -67,19 +73,19 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 67 | 73 | @Override |
| 68 | 74 | public Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj) { |
| 69 | 75 | Map<String, Object> map = new HashMap<>(); |
| 70 | - try{ | |
| 71 | - | |
| 76 | + try { | |
| 77 | + | |
| 72 | 78 | ScheduleRealInfo schedule = ScheduleBuffer.pkSchedulMap.get(id); |
| 73 | 79 | schedule.setDfsjT(sdfMinute.parse(sdfMonth.format(new Date()) + " " + dfsj).getTime()); |
| 74 | 80 | schedule.setDfsj(dfsj); |
| 75 | - schedule.addRemarks("[待发调整] " + remarks +";"); | |
| 76 | - //持久化到数据库 | |
| 81 | + schedule.addRemarks(remarks + ";"); | |
| 82 | + // 持久化到数据库 | |
| 77 | 83 | ScheduleBuffer.persistentList.add(schedule); |
| 78 | - | |
| 84 | + | |
| 79 | 85 | map.put("status", ResponseCode.SUCCESS); |
| 80 | 86 | map.put("dfsj", dfsj); |
| 81 | 87 | map.put("remarks", schedule.getRemarks()); |
| 82 | - }catch(Exception e){ | |
| 88 | + } catch (Exception e) { | |
| 83 | 89 | logger.error("", e); |
| 84 | 90 | map.put("status", ResponseCode.ERROR); |
| 85 | 91 | } |
| ... | ... | @@ -87,88 +93,88 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 87 | 93 | } |
| 88 | 94 | |
| 89 | 95 | @Override |
| 90 | - public Map<String, Object> destroy(String idsStr, int spaceAdjust, String remarks, String reason, int spaceNum) { | |
| 91 | - | |
| 96 | + public Map<String, Object> destroy(String idsStr, int spaceAdjust, String remarks, String reason, int spaceNum) { | |
| 97 | + | |
| 92 | 98 | Map<String, Object> map = new HashMap<>(); |
| 93 | 99 | List<ScheduleRealInfo> rsList = new ArrayList<>(); |
| 94 | 100 | map.put("list", rsList); |
| 95 | - try{ | |
| 101 | + try { | |
| 96 | 102 | List<String> idList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(idsStr)); |
| 97 | - | |
| 103 | + | |
| 98 | 104 | ScheduleRealInfo schedule = null; |
| 99 | - for(String id : idList){ | |
| 105 | + for (String id : idList) { | |
| 100 | 106 | schedule = ScheduleBuffer.pkSchedulMap.get(Long.parseLong(id)); |
| 101 | - if(null != schedule){ | |
| 107 | + if (null != schedule) { | |
| 102 | 108 | schedule.setStatus(-1); |
| 103 | - schedule.setRemarks("计划烂班["+reason+"] " + remarks); | |
| 104 | - | |
| 109 | + schedule.addRemarks(remarks); | |
| 110 | + | |
| 105 | 111 | rsList.add(schedule); |
| 106 | 112 | } |
| 107 | 113 | } |
| 108 | - | |
| 109 | - //调整间隔 | |
| 110 | - if(spaceAdjust == 1){ | |
| 111 | - | |
| 114 | + | |
| 115 | + // 调整间隔 | |
| 116 | + if (spaceAdjust == 1) { | |
| 117 | + | |
| 112 | 118 | ScheduleRealInfo first = ScheduleBuffer.pkSchedulMap.get(Long.parseLong(idList.get(0))); |
| 113 | 119 | String lineCode = first.getXlBm(); |
| 114 | 120 | String upDown = first.getXlDir(); |
| 115 | - | |
| 116 | - List<ScheduleRealInfo> schList = ScheduleBuffer.schedulListMap.get(lineCode) | |
| 117 | - ,dirList = new ArrayList<>(); | |
| 118 | - //筛选走向 | |
| 119 | - for(ScheduleRealInfo s : schList){ | |
| 120 | - if(s.getXlDir().equals(upDown)){ | |
| 121 | + | |
| 122 | + List<ScheduleRealInfo> schList = ScheduleBuffer.schedulListMap.get(lineCode), | |
| 123 | + dirList = new ArrayList<>(); | |
| 124 | + // 筛选走向 | |
| 125 | + for (ScheduleRealInfo s : schList) { | |
| 126 | + if (s.getXlDir().equals(upDown)) { | |
| 121 | 127 | dirList.add(s); |
| 122 | 128 | } |
| 123 | 129 | } |
| 124 | - | |
| 130 | + | |
| 125 | 131 | int size = dirList.size(); |
| 126 | 132 | Long st = null; |
| 127 | 133 | int diff = spaceNum * 60 * 1000; |
| 128 | - for(int i = 0; i < size; i ++){ | |
| 134 | + for (int i = 0; i < size; i++) { | |
| 129 | 135 | schedule = dirList.get(i); |
| 130 | - | |
| 131 | - if(schedule.getId() == first.getId()){ | |
| 132 | - if(i == 0) | |
| 136 | + | |
| 137 | + if (schedule.getId() == first.getId()) { | |
| 138 | + if (i == 0) | |
| 133 | 139 | st = schedule.getDfsjT() - diff; |
| 134 | 140 | else |
| 135 | 141 | st = dirList.get(i - 1).getDfsjT(); |
| 136 | 142 | continue; |
| 137 | 143 | } |
| 138 | - if(null == st || schedule.getStatus() == -1) | |
| 144 | + if (null == st || schedule.getStatus() == -1) | |
| 139 | 145 | continue; |
| 140 | - | |
| 146 | + | |
| 141 | 147 | st = st + diff; |
| 142 | 148 | schedule.setDfsjT(st); |
| 143 | 149 | schedule.setDfsj(sdfShort.format(new Date(st))); |
| 144 | - | |
| 150 | + | |
| 145 | 151 | ScheduleBuffer.persistentList.add(schedule); |
| 146 | - //将调整的班次返回给页面 | |
| 152 | + // 将调整的班次返回给页面 | |
| 147 | 153 | rsList.add(schedule); |
| 148 | 154 | } |
| 149 | 155 | } |
| 150 | - | |
| 156 | + | |
| 151 | 157 | map.put("status", ResponseCode.SUCCESS); |
| 152 | - }catch(Exception e){ | |
| 158 | + } catch (Exception e) { | |
| 153 | 159 | logger.error("", e); |
| 154 | 160 | map.put("status", ResponseCode.ERROR); |
| 155 | 161 | } |
| 156 | 162 | return map; |
| 157 | 163 | } |
| 158 | 164 | |
| 159 | - //线路id获取驾驶员 | |
| 165 | + // 线路id获取驾驶员 | |
| 160 | 166 | @Override |
| 161 | 167 | public List<Map<String, String>> findDriverByLine(String lineCode) { |
| 162 | 168 | List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode); |
| 163 | - | |
| 169 | + | |
| 164 | 170 | List<Map<String, String>> rsList = new ArrayList<>(); |
| 165 | 171 | Map<String, String> map = null; |
| 166 | 172 | Personnel driver = null; |
| 167 | 173 | String code = null; |
| 168 | - | |
| 169 | - for(EmployeeConfigInfo employee : list){ | |
| 174 | + | |
| 175 | + for (EmployeeConfigInfo employee : list) { | |
| 170 | 176 | driver = employee.getJsy(); |
| 171 | - if(driver != null){ | |
| 177 | + if (driver != null) { | |
| 172 | 178 | map = new HashMap<>(); |
| 173 | 179 | code = driver.getJobCode(); |
| 174 | 180 | map.put("id", code + "/" + driver.getPersonnelName()); |
| ... | ... | @@ -179,19 +185,19 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 179 | 185 | return rsList; |
| 180 | 186 | } |
| 181 | 187 | |
| 182 | - //线路id获取售票员 | |
| 188 | + // 线路id获取售票员 | |
| 183 | 189 | @Override |
| 184 | 190 | public List<Map<String, String>> findConductorByLine(String lineCode) { |
| 185 | 191 | List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode); |
| 186 | - | |
| 192 | + | |
| 187 | 193 | List<Map<String, String>> rsList = new ArrayList<>(); |
| 188 | 194 | Map<String, String> map = null; |
| 189 | 195 | Personnel conductor = null; |
| 190 | 196 | String code = null; |
| 191 | - | |
| 192 | - for(EmployeeConfigInfo employee : list){ | |
| 197 | + | |
| 198 | + for (EmployeeConfigInfo employee : list) { | |
| 193 | 199 | conductor = employee.getSpy(); |
| 194 | - if(conductor != null){ | |
| 200 | + if (conductor != null) { | |
| 195 | 201 | code = conductor.getJobCode(); |
| 196 | 202 | map = new HashMap<>(); |
| 197 | 203 | map.put("id", code + "/" + conductor.getPersonnelName()); |
| ... | ... | @@ -204,17 +210,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 204 | 210 | |
| 205 | 211 | @Override |
| 206 | 212 | public List<Map<String, String>> findCarByLine(String lineCode) { |
| 207 | - | |
| 213 | + | |
| 208 | 214 | List<CarConfigInfo> list = carConfigInfoRepository.findBylineCode(lineCode); |
| 209 | - | |
| 215 | + | |
| 210 | 216 | List<Map<String, String>> rsList = new ArrayList<>(); |
| 211 | 217 | Map<String, String> map = null; |
| 212 | 218 | Cars car = null; |
| 213 | 219 | String code = null; |
| 214 | - | |
| 215 | - for(CarConfigInfo cci : list){ | |
| 220 | + | |
| 221 | + for (CarConfigInfo cci : list) { | |
| 216 | 222 | car = cci.getCl(); |
| 217 | - if(car != null){ | |
| 223 | + if (car != null) { | |
| 218 | 224 | code = car.getInsideCode(); |
| 219 | 225 | map = new HashMap<>(); |
| 220 | 226 | map.put("id", code); |
| ... | ... | @@ -231,15 +237,262 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 231 | 237 | @Override |
| 232 | 238 | public Map<String, Object> save(ScheduleRealInfo t) { |
| 233 | 239 | SysUser user = SecurityUtils.getCurrentUser(); |
| 234 | - | |
| 240 | + | |
| 235 | 241 | t.setScheduleDate(new Date()); |
| 236 | 242 | t.setCreateBy(user); |
| 237 | 243 | t.syncTime(); |
| 238 | - | |
| 244 | + | |
| 239 | 245 | Map<String, Object> map = super.save(t); |
| 240 | - | |
| 241 | - //加入缓存 | |
| 246 | + | |
| 247 | + // 加入缓存 | |
| 242 | 248 | ScheduleBuffer.put(t); |
| 243 | 249 | return map; |
| 244 | 250 | } |
| 251 | + | |
| 252 | + @Override | |
| 253 | + public List<Map<String, String>> sreachVehic(String nbbm) { | |
| 254 | + // 转大写 | |
| 255 | + nbbm = nbbm.toUpperCase(); | |
| 256 | + | |
| 257 | + List<Map<String, String>> list = new ArrayList<>(); | |
| 258 | + Map<String, String> map; | |
| 259 | + Set<String> allSet = CommonMapped.vehicCompanyMap.keySet(); | |
| 260 | + | |
| 261 | + Line line; | |
| 262 | + for (String k : allSet) { | |
| 263 | + if (k.indexOf(nbbm) != -1) { | |
| 264 | + // 所属线路 | |
| 265 | + map = new HashMap<>(); | |
| 266 | + line = CommonMapped.vehicLineMap.get(k); | |
| 267 | + map.put("id", k); | |
| 268 | + map.put("text", k); | |
| 269 | + if (null != line) { | |
| 270 | + map.put("lineName", line.getName()); | |
| 271 | + map.put("lineCode", line.getLineCode()); | |
| 272 | + } | |
| 273 | + | |
| 274 | + list.add(map); | |
| 275 | + } | |
| 276 | + | |
| 277 | + if (list.size() > 20) | |
| 278 | + break; | |
| 279 | + } | |
| 280 | + return list; | |
| 281 | + } | |
| 282 | + | |
| 283 | + @Override | |
| 284 | + public Map<String, Object> adjust(Long id, String nbbm, String jsy, String spy) { | |
| 285 | + // 班次 | |
| 286 | + ScheduleRealInfo schedule = ScheduleBuffer.pkSchedulMap.get(id); | |
| 287 | + | |
| 288 | + // 换车 | |
| 289 | + if (!StringUtils.isBlank(nbbm)) { | |
| 290 | + adjustCar(schedule, nbbm); | |
| 291 | + } | |
| 292 | + | |
| 293 | + List<String> tempArray; | |
| 294 | + // 换驾驶员 | |
| 295 | + if (!StringUtils.isBlank(jsy)) { | |
| 296 | + tempArray = Splitter.on("/").splitToList(jsy); | |
| 297 | + adjustDriver(schedule, tempArray.get(0), tempArray.get(1)); | |
| 298 | + } | |
| 299 | + | |
| 300 | + // 换售票员 | |
| 301 | + if (!StringUtils.isBlank(spy)) { | |
| 302 | + tempArray = Splitter.on("/").splitToList(spy); | |
| 303 | + adjustConductor(schedule, tempArray.get(0), tempArray.get(1)); | |
| 304 | + } | |
| 305 | + | |
| 306 | + ScheduleBuffer.persistentList.add(schedule); | |
| 307 | + | |
| 308 | + Map<String, Object> map = new HashMap<>(); | |
| 309 | + map.put("status", 200); | |
| 310 | + map.put("t", schedule); | |
| 311 | + return map; | |
| 312 | + } | |
| 313 | + | |
| 314 | + @Override | |
| 315 | + public void adjustCar(ScheduleRealInfo schedule, String car) { | |
| 316 | + schedule.setClZbh(car); | |
| 317 | + } | |
| 318 | + | |
| 319 | + @Override | |
| 320 | + public void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName) { | |
| 321 | + schedule.setjGh(driver); | |
| 322 | + schedule.setjName(driverName); | |
| 323 | + } | |
| 324 | + | |
| 325 | + @Override | |
| 326 | + public void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName) { | |
| 327 | + schedule.setsGh(conductor); | |
| 328 | + schedule.setsName(conductorName); | |
| 329 | + } | |
| 330 | + | |
| 331 | + @Override | |
| 332 | + public List<ScheduleRealInfo> queryUserInfo(String line, String date) { | |
| 333 | + // TODO Auto-generated method stub | |
| 334 | + return scheduleRealInfoRepository.queryUserInfo(line, date); | |
| 335 | + } | |
| 336 | + | |
| 337 | + @Override | |
| 338 | + public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName) { | |
| 339 | + ReportUtils ee = new ReportUtils(); | |
| 340 | + List<Iterator<?>> list = new ArrayList<Iterator<?>>(); | |
| 341 | + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.exportWaybill(jName, clZbh, lpName); | |
| 342 | + ScheduleRealInfo scheduleRealInfo = scheduleRealInfoRepository.findOne(scheduleRealInfos.get(0).getId()); | |
| 343 | + | |
| 344 | + File source = new File("D:\\export\\source"); | |
| 345 | + File target = new File("D:\\export\\target"); | |
| 346 | + if (!source.exists() && !source.isDirectory()) { | |
| 347 | + source.mkdirs(); | |
| 348 | + } | |
| 349 | + if (!target.exists() && !target.isDirectory()) { | |
| 350 | + target.mkdirs(); | |
| 351 | + } | |
| 352 | + | |
| 353 | + list.add(scheduleRealInfos.iterator()); | |
| 354 | + ee.excelReplace(list, new Object[] { scheduleRealInfo }, "D:\\export\\source\\waybill.xls", | |
| 355 | + "D:\\export\\target\\" + jName + ".xls"); | |
| 356 | + return scheduleRealInfos; | |
| 357 | + } | |
| 358 | + | |
| 359 | + @Override | |
| 360 | + public List<Map<String, Object>> dailyInfo(String line, String date) { | |
| 361 | + // TODO Auto-generated method stub | |
| 362 | + return scheduleRealInfoRepository.dailyInfo(line, date); | |
| 363 | + } | |
| 364 | + | |
| 365 | + @Override | |
| 366 | + public List<ScheduleRealInfo> historyMessage(String line, String date, String code) { | |
| 367 | + // TODO Auto-generated method stub | |
| 368 | + return scheduleRealInfoRepository.historyMessage(line, date, code + "%"); | |
| 369 | + } | |
| 370 | + | |
| 371 | + @Override | |
| 372 | + public Map<Integer, Integer> trustStatus(String lineStr) { | |
| 373 | + List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lineStr)); | |
| 374 | + | |
| 375 | + Map<Integer, Integer> map = new HashMap<>(); | |
| 376 | + Integer code; | |
| 377 | + for (String lineCode : lineList) { | |
| 378 | + code = Integer.parseInt(lineCode); | |
| 379 | + if (!ScheduleBuffer.trustMap.containsKey(lineCode)) | |
| 380 | + ScheduleBuffer.trustMap.put(code, 0); | |
| 381 | + | |
| 382 | + map.put(code, ScheduleBuffer.trustMap.get(code)); | |
| 383 | + } | |
| 384 | + return map; | |
| 385 | + } | |
| 386 | + | |
| 387 | + @Override | |
| 388 | + public Map<String, Object> realOutAdjust(Long id, String fcsjActual, String remarks) { | |
| 389 | + Map<String, Object> rs = new HashMap<>(); | |
| 390 | + try { | |
| 391 | + ScheduleRealInfo sch = ScheduleBuffer.findOne(id); | |
| 392 | + String rq = sdfMonth.format(sch.getScheduleDate()); | |
| 393 | + | |
| 394 | + sch.setFcsjActualTime(sdfMinute.parse(rq + " " + fcsjActual).getTime()); | |
| 395 | + sch.setFcsjActual(fcsjActual); | |
| 396 | + sch.addRemarks(remarks); | |
| 397 | + | |
| 398 | + ScheduleBuffer.persistentList.add(sch); | |
| 399 | + rs.put("status", ResponseCode.SUCCESS); | |
| 400 | + rs.put("t", sch); | |
| 401 | + } catch (Exception e) { | |
| 402 | + logger.error("", e); | |
| 403 | + rs.put("status", ResponseCode.ERROR); | |
| 404 | + } | |
| 405 | + | |
| 406 | + return rs; | |
| 407 | + } | |
| 408 | + | |
| 409 | + @Override | |
| 410 | + public Map<String, Object> revokeDestroy(Long id) { | |
| 411 | + Map<String, Object> rs = new HashMap<>(); | |
| 412 | + try { | |
| 413 | + ScheduleRealInfo sch = ScheduleBuffer.findOne(id); | |
| 414 | + if (sch.getStatus() != -1) { | |
| 415 | + rs.put("status", ResponseCode.ERROR); | |
| 416 | + rs.put("msg", "未烂班,无法撤销!"); | |
| 417 | + } else { | |
| 418 | + sch.setStatus(0); | |
| 419 | + rs.put("status", ResponseCode.SUCCESS); | |
| 420 | + rs.put("t", sch); | |
| 421 | + | |
| 422 | + // 将班次状态还原,并由子线程去匹配到离站 | |
| 423 | + } | |
| 424 | + } catch (Exception e) { | |
| 425 | + logger.error("", e); | |
| 426 | + rs.put("status", ResponseCode.ERROR); | |
| 427 | + } | |
| 428 | + return rs; | |
| 429 | + } | |
| 430 | + | |
| 431 | + @Override | |
| 432 | + public Map<String, Object> revokeRealOutgo(Long id) { | |
| 433 | + Map<String, Object> rs = new HashMap<>(); | |
| 434 | + try { | |
| 435 | + ScheduleRealInfo sch = ScheduleBuffer.findOne(id); | |
| 436 | + if (sch.getFcsjActual() == null) { | |
| 437 | + rs.put("status", ResponseCode.ERROR); | |
| 438 | + rs.put("msg", "无实发时间,无法撤销!"); | |
| 439 | + } else { | |
| 440 | + sch.setStatus(0); | |
| 441 | + sch.setFcsjActual(""); | |
| 442 | + sch.setFcsjActualTime(0L); | |
| 443 | + rs.put("status", ResponseCode.SUCCESS); | |
| 444 | + rs.put("t", sch); | |
| 445 | + | |
| 446 | + // 将班次状态还原,并由子线程去匹配到离站 | |
| 447 | + } | |
| 448 | + } catch (Exception e) { | |
| 449 | + logger.error("", e); | |
| 450 | + rs.put("status", ResponseCode.ERROR); | |
| 451 | + } | |
| 452 | + return rs; | |
| 453 | + } | |
| 454 | + | |
| 455 | + @Override | |
| 456 | + public Map<String, Object> spaceAdjust(Long[] ids, Integer space) { | |
| 457 | + | |
| 458 | + List<ScheduleRealInfo> list = new ArrayList<>(); | |
| 459 | + Map<String, Object> rs = new HashMap<>(); | |
| 460 | + try { | |
| 461 | + ScheduleRealInfo sch; | |
| 462 | + for (Long id : ids) { | |
| 463 | + sch = ScheduleBuffer.findOne(id); | |
| 464 | + if (null != sch) | |
| 465 | + list.add(sch); | |
| 466 | + } | |
| 467 | + | |
| 468 | + int size = list.size(); | |
| 469 | + if(size == 0){ | |
| 470 | + rs.put("status", ResponseCode.ERROR); | |
| 471 | + } | |
| 472 | + else{ | |
| 473 | + // 按发车时间排序 | |
| 474 | + Collections.sort(list, new ScheduleBuffer.ScheduleComparator()); | |
| 475 | + | |
| 476 | + // 以第一个待发时间为起点,调整间隔 | |
| 477 | + Long st = list.get(0).getDfsjT() | |
| 478 | + ,plus = space * 60 * 1000L; | |
| 479 | + | |
| 480 | + for(int i = 1; i < size; i ++){ | |
| 481 | + st += plus; | |
| 482 | + sch = list.get(i); | |
| 483 | + sch.setDfsjAll(st); | |
| 484 | + | |
| 485 | + ScheduleBuffer.persistentList.add(sch); | |
| 486 | + } | |
| 487 | + | |
| 488 | + rs.put("status", ResponseCode.SUCCESS); | |
| 489 | + rs.put("list", list); | |
| 490 | + } | |
| 491 | + | |
| 492 | + } catch (Exception e) { | |
| 493 | + logger.error("", e); | |
| 494 | + rs.put("status", ResponseCode.ERROR); | |
| 495 | + } | |
| 496 | + return rs; | |
| 497 | + } | |
| 245 | 498 | } | ... | ... |
src/main/java/com/bsth/util/FTPClientUtils.java
| ... | ... | @@ -4,8 +4,10 @@ import java.io.ByteArrayInputStream; |
| 4 | 4 | import java.io.File; |
| 5 | 5 | import java.io.FileInputStream; |
| 6 | 6 | import java.io.FileNotFoundException; |
| 7 | +import java.io.FileOutputStream; | |
| 7 | 8 | import java.io.IOException; |
| 8 | 9 | import java.io.InputStream; |
| 10 | +import java.io.OutputStream; | |
| 9 | 11 | import java.io.UnsupportedEncodingException; |
| 10 | 12 | |
| 11 | 13 | import org.apache.commons.net.ftp.FTPClient; |
| ... | ... | @@ -96,16 +98,16 @@ public class FTPClientUtils { |
| 96 | 98 | } |
| 97 | 99 | |
| 98 | 100 | // 将本地文件上传到FTP服务器上 |
| 99 | - public void testUpLoadFromDisk(File file,String name){ | |
| 101 | + public void testUpLoadFromDisk(File file,String name,String url, int port, String username, String password, String remotePath){ | |
| 100 | 102 | |
| 101 | 103 | try { |
| 102 | 104 | FileInputStream in=new FileInputStream(file); |
| 103 | 105 | |
| 104 | - /*boolean flag = uploadFile("192.168.168.101", 21, "testftpservice", "123", "C:/ftptest", name, in);*/ | |
| 106 | + boolean flag = uploadFile(url, port,username, password, remotePath, name, in); | |
| 105 | 107 | |
| 106 | - boolean flag = uploadFile("222.66.0.205", 21, "transport", "transport123", "ftptest/", name, in); | |
| 108 | + /* boolean flag = uploadFile("192.168.168.101", 21, "testftpservice", "123", "ftptest/", name, in);*/ | |
| 107 | 109 | |
| 108 | - System.out.println(flag); | |
| 110 | + /* boolean flag = uploadFile("222.66.0.205", 21, "transport", "transport123", "ftptest/", name, in);*/ | |
| 109 | 111 | |
| 110 | 112 | } catch (FileNotFoundException e) { |
| 111 | 113 | |
| ... | ... | @@ -124,9 +126,7 @@ public class FTPClientUtils { |
| 124 | 126 | |
| 125 | 127 | InputStream input = new ByteArrayInputStream(str.getBytes("utf-8")); |
| 126 | 128 | |
| 127 | - boolean flag = uploadFile("192.168.168.101", 21, "testftpservice", "123", "ftptest/", "test.txt", input); | |
| 128 | - | |
| 129 | - System.out.println(flag); | |
| 129 | + uploadFile("192.168.168.101", 21, "testftpservice", "123", "ftptest/", "test.txt", input); | |
| 130 | 130 | |
| 131 | 131 | } catch (UnsupportedEncodingException e) { |
| 132 | 132 | |
| ... | ... | @@ -150,11 +150,11 @@ public class FTPClientUtils { |
| 150 | 150 | */ |
| 151 | 151 | public static boolean deleteFtpFile(String url, int port, String username, String password, String remotePath, String fileName){ |
| 152 | 152 | |
| 153 | - boolean success = true; | |
| 153 | + boolean success = false; | |
| 154 | 154 | |
| 155 | 155 | FTPClient ftp = new FTPClient(); |
| 156 | 156 | |
| 157 | - try{ | |
| 157 | + try { | |
| 158 | 158 | |
| 159 | 159 | int reply; |
| 160 | 160 | |
| ... | ... | @@ -170,6 +170,8 @@ public class FTPClientUtils { |
| 170 | 170 | // 登录 |
| 171 | 171 | ftp.login(username, password); |
| 172 | 172 | |
| 173 | + | |
| 174 | + | |
| 173 | 175 | reply = ftp.getReplyCode(); |
| 174 | 176 | |
| 175 | 177 | if (!FTPReply.isPositiveCompletion(reply)) { |
| ... | ... | @@ -183,13 +185,14 @@ public class FTPClientUtils { |
| 183 | 185 | |
| 184 | 186 | ftp.changeWorkingDirectory(remotePath); |
| 185 | 187 | |
| 186 | - success = ftp.deleteFile("C:/ftptest"+ "/" + "aa.txt"); | |
| 188 | + success = ftp.deleteFile(fileName); | |
| 189 | + | |
| 190 | + ftp.logout(); | |
| 187 | 191 | |
| 188 | - ftp.logout(); | |
| 189 | 192 | } catch (IOException e){ |
| 190 | - /*logger.error("save erro.", e);*/ | |
| 191 | 193 | |
| 192 | 194 | e.printStackTrace(); |
| 195 | + | |
| 193 | 196 | success = false; |
| 194 | 197 | |
| 195 | 198 | } finally { |
| ... | ... | @@ -201,8 +204,8 @@ public class FTPClientUtils { |
| 201 | 204 | ftp.disconnect(); |
| 202 | 205 | |
| 203 | 206 | } catch (IOException e) { |
| 207 | + | |
| 204 | 208 | e.printStackTrace(); |
| 205 | - /* logger.error(EXCEPTION_NAME, e); */ | |
| 206 | 209 | |
| 207 | 210 | } |
| 208 | 211 | } |
| ... | ... | @@ -211,26 +214,119 @@ public class FTPClientUtils { |
| 211 | 214 | return success; |
| 212 | 215 | } |
| 213 | 216 | |
| 217 | + public static File GetFtpFile(String url, int port, String username, String password, String remotePath, String fileName){ | |
| 218 | + | |
| 219 | + FTPClient ftp = new FTPClient(); | |
| 220 | + | |
| 221 | + File destFile = new File(fileName); | |
| 222 | + | |
| 223 | + InputStream in = null; | |
| 224 | + | |
| 225 | + OutputStream out = null; | |
| 226 | + | |
| 227 | + try { | |
| 228 | + | |
| 229 | + int reply; | |
| 230 | + | |
| 231 | + // 连接FTP服务器 | |
| 232 | + if (port > -1) | |
| 233 | + | |
| 234 | + ftp.connect(url, port); | |
| 235 | + | |
| 236 | + else | |
| 237 | + | |
| 238 | + ftp.connect(url); | |
| 239 | + | |
| 240 | + // 登录 | |
| 241 | + ftp.login(username, password); | |
| 242 | + | |
| 243 | + reply = ftp.getReplyCode(); | |
| 244 | + | |
| 245 | + if (!FTPReply.isPositiveCompletion(reply)) { | |
| 246 | + | |
| 247 | + ftp.disconnect(); | |
| 248 | + | |
| 249 | + } | |
| 250 | + | |
| 251 | + // 转移到FTP服务器目录 | |
| 252 | + | |
| 253 | + ftp.changeWorkingDirectory(remotePath); | |
| 254 | + | |
| 255 | + File srcFile = new File(fileName); | |
| 256 | + | |
| 257 | + int byteread = 0; // 读取的字节数 | |
| 258 | + | |
| 259 | + in = ftp.retrieveFileStream(fileName); | |
| 260 | + | |
| 261 | + out = new FileOutputStream(destFile); | |
| 262 | + | |
| 263 | + byte[] buffer = new byte[1024]; | |
| 264 | + | |
| 265 | + while ((byteread = in.read(buffer)) != -1) { | |
| 266 | + | |
| 267 | + out.write(buffer, 0, byteread); | |
| 268 | + | |
| 269 | + } | |
| 270 | + | |
| 271 | + ftp.logout(); | |
| 272 | + | |
| 273 | + } catch (IOException e){ | |
| 274 | + | |
| 275 | + e.printStackTrace(); | |
| 276 | + | |
| 277 | + } finally { | |
| 278 | + | |
| 279 | + try { | |
| 280 | + | |
| 281 | + if (out != null) | |
| 282 | + | |
| 283 | + out.close(); | |
| 284 | + | |
| 285 | + if (in != null) | |
| 286 | + | |
| 287 | + in.close(); | |
| 288 | + | |
| 289 | + } catch (IOException e) { | |
| 290 | + | |
| 291 | + e.printStackTrace(); | |
| 292 | + | |
| 293 | + } | |
| 294 | + | |
| 295 | + if (ftp.isConnected()) { | |
| 296 | + | |
| 297 | + try { | |
| 298 | + | |
| 299 | + ftp.disconnect(); | |
| 300 | + | |
| 301 | + } catch (IOException e) { | |
| 302 | + | |
| 303 | + e.printStackTrace(); | |
| 304 | + | |
| 305 | + } | |
| 306 | + } | |
| 307 | + } | |
| 308 | + | |
| 309 | + return destFile; | |
| 310 | + } | |
| 311 | + | |
| 312 | + | |
| 214 | 313 | public static void main(String[] args) { |
| 215 | 314 | |
| 216 | 315 | FTPClientUtils clientUtils = new FTPClientUtils(); |
| 217 | 316 | |
| 218 | 317 | Test test= new Test(); |
| 219 | 318 | |
| 220 | - /* File[] sources = new File[] {new File("E:/20079.txt")}; | |
| 319 | + File[] sources = new File[] {new File("E:/20079.txt")}; | |
| 221 | 320 | |
| 222 | 321 | File target = new File("release_package.tar.gz"); |
| 223 | 322 | |
| 224 | 323 | File targetFile = test.pack(sources, target); |
| 225 | 324 | |
| 226 | - clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/ | |
| 325 | + /* clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/ | |
| 227 | 326 | |
| 228 | - /*, 21, , "123", "C:/ftptest", "test.txt", input*/ | |
| 229 | 327 | |
| 230 | - boolean a =clientUtils.deleteFtpFile("192.168.168.101", 21, "testftpservice", "123", "ftptest", "aa.txt"); | |
| 328 | + /** 删除文件 */ | |
| 329 | + /*boolean a =clientUtils.deleteFtpFile("192.168.168.101", 21, "testftpservice", "123", "ftptest/", "release_package.tar.gz");*/ | |
| 231 | 330 | |
| 232 | - System.out.println(a); | |
| 233 | - | |
| 234 | - | |
| 235 | 331 | } |
| 236 | 332 | } | ... | ... |
src/main/java/com/bsth/util/ReportRelatedUtils.java
0 → 100644
| 1 | +package com.bsth.util; | |
| 2 | + | |
| 3 | +import java.lang.reflect.InvocationTargetException; | |
| 4 | +import java.lang.reflect.Method; | |
| 5 | + | |
| 6 | +import com.bsth.entity.Line; | |
| 7 | + | |
| 8 | +public class ReportRelatedUtils { | |
| 9 | + public static void main(String[] args) { | |
| 10 | + try { | |
| 11 | + ReportRelatedUtils test = new ReportRelatedUtils(); | |
| 12 | + Line line = new Line(); | |
| 13 | + line.setId(10); | |
| 14 | + line.setName("abc"); | |
| 15 | + test.getValue(line, "name"); | |
| 16 | + } catch (Exception e) { | |
| 17 | + e.printStackTrace(); | |
| 18 | + } | |
| 19 | + | |
| 20 | + } | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 通过字段名取到对象中该字段的相应值 | |
| 24 | + * | |
| 25 | + * @param t | |
| 26 | + * 对象 | |
| 27 | + * @param fieldName | |
| 28 | + * 字段名 | |
| 29 | + * @return | |
| 30 | + * @throws ClassNotFoundException | |
| 31 | + * @throws IllegalAccessException | |
| 32 | + * @throws InvocationTargetException | |
| 33 | + * @throws NoSuchMethodException | |
| 34 | + * @throws NoSuchFieldException | |
| 35 | + */ | |
| 36 | + public <T> Object getValue(T t, String fieldName) | |
| 37 | + throws ClassNotFoundException, IllegalAccessException, | |
| 38 | + InvocationTargetException, NoSuchMethodException, | |
| 39 | + NoSuchFieldException { | |
| 40 | + Object value = ""; | |
| 41 | + String tmpFieldName = firstCharToUpperCase(fieldName); | |
| 42 | + Method method = null; | |
| 43 | + try { | |
| 44 | + method = t.getClass().getMethod("get" + tmpFieldName); | |
| 45 | + value = method.invoke(t); | |
| 46 | + } catch (NoSuchMethodException e) { | |
| 47 | + if(method == null){ | |
| 48 | + method = t.getClass().getMethod("get" + tmpFieldName); | |
| 49 | + } | |
| 50 | + value = method.invoke(t); | |
| 51 | + return value; | |
| 52 | + } | |
| 53 | + return value; | |
| 54 | + } | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 首字母大写 | |
| 58 | + * | |
| 59 | + * @param source | |
| 60 | + * 源字符串 | |
| 61 | + * @return | |
| 62 | + */ | |
| 63 | + private String firstCharToUpperCase(String source) { | |
| 64 | + char[] arr = source.toCharArray(); | |
| 65 | + if (arr[1] >= 'A' && arr[1] <= 'Z') { | |
| 66 | + return source; | |
| 67 | + }else{ | |
| 68 | + if (arr[0] >= 'a' && arr[0] <= 'z') { | |
| 69 | + arr[0] -= 'a' - 'A'; | |
| 70 | + } | |
| 71 | + } | |
| 72 | + return new String(arr); | |
| 73 | + } | |
| 74 | +} | ... | ... |
src/main/java/com/bsth/util/ReportUtils.java
0 → 100644
| 1 | +package com.bsth.util; | |
| 2 | + | |
| 3 | +import java.io.File; | |
| 4 | +import java.io.FileInputStream; | |
| 5 | +import java.io.FileOutputStream; | |
| 6 | +import java.util.ArrayList; | |
| 7 | +import java.util.Iterator; | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +import org.apache.poi.hssf.usermodel.HSSFCell; | |
| 11 | +import org.apache.poi.hssf.usermodel.HSSFCellStyle; | |
| 12 | +import org.apache.poi.hssf.usermodel.HSSFRow; | |
| 13 | +import org.apache.poi.hssf.usermodel.HSSFSheet; | |
| 14 | +import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |
| 15 | +import org.apache.poi.poifs.filesystem.POIFSFileSystem; | |
| 16 | +import org.apache.poi.ss.usermodel.Cell; | |
| 17 | + | |
| 18 | +import com.bsth.entity.Line; | |
| 19 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 20 | + | |
| 21 | +public class ReportUtils { | |
| 22 | + // private final String packaegName = "com.bsth.entity."; | |
| 23 | + private final String packaegName = "com.bsth.entity.realcontrol."; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * /** | |
| 27 | + * | |
| 28 | + * @param list | |
| 29 | + * 模板中,需要重复显示的行所需的数据 | |
| 30 | + * @param map | |
| 31 | + * 模板中除以上list外所有的数据 | |
| 32 | + * @param index | |
| 33 | + * 需要重复的行号,该值为行号减1 | |
| 34 | + * @param sourcePath | |
| 35 | + * 模板路径 | |
| 36 | + * @param targetPath | |
| 37 | + * 生成路径 | |
| 38 | + */ | |
| 39 | + public void excelReplace(List<Iterator<?>> list, Object[] tArray, | |
| 40 | + String sourcePath, String targetPath) { | |
| 41 | + try { | |
| 42 | + // 把源文件放入流中 | |
| 43 | + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream( | |
| 44 | + sourcePath)); | |
| 45 | + HSSFWorkbook wb = new HSSFWorkbook(fs); | |
| 46 | + HSSFSheet sheet = wb.getSheetAt(0); | |
| 47 | + HSSFRow row; | |
| 48 | + HSSFCell cell = null; | |
| 49 | + String key; | |
| 50 | + // 取得总行数 | |
| 51 | + int rowNum = sheet.getLastRowNum(); | |
| 52 | + // 取得总列数 | |
| 53 | + int cellNum = sheet.getRow(0).getLastCellNum(); | |
| 54 | + | |
| 55 | + // 遍历行 | |
| 56 | + for (int i = 0; i < rowNum; i++) { | |
| 57 | + row = sheet.getRow(i); | |
| 58 | + // 遍历列 | |
| 59 | + for (int j = 0; j < cellNum; j++) { | |
| 60 | + if (row == null) { | |
| 61 | + continue; | |
| 62 | + } | |
| 63 | + cell = row.getCell(j); | |
| 64 | + if (cell == null) { | |
| 65 | + continue; | |
| 66 | + } | |
| 67 | + // 取得每列的内容,如果列内容是$key$格式,则替换内容 | |
| 68 | + key = cell.getStringCellValue(); | |
| 69 | + if (key.indexOf("$") != -1 || key.indexOf("#list#") != -1) { | |
| 70 | + // * 列中内容有#list#,则表示该行为模板行,需要以该行为模板 | |
| 71 | + // * 例如:模板行格式 #list#0_0 $Car.id$ | |
| 72 | + // * 第一个0表示需要在list中取iterator的索引值 | |
| 73 | + // * 第二个0表示在iterator中取的第几个对象,如果不为0,则取下一个对象,而不是沿用前面获取的对象 | |
| 74 | + // * $Car.id$表示所取的对象为Car的对象,并且取值为id的值 | |
| 75 | + if (key.indexOf("#list#") != -1) { | |
| 76 | + key = key.replace("#list#", "").trim(); | |
| 77 | + String[] lists = key.split(" "); | |
| 78 | + // 取得list中的索引值 | |
| 79 | + int listIndex = Integer | |
| 80 | + .valueOf(lists[0].split("_")[0]); | |
| 81 | + Iterator<?> iterator = list.get(listIndex); | |
| 82 | + // 根据模板创建行并填弃数据,返回增加的行数 | |
| 83 | + int rowCount = iteratorFillCellValue(wb, sheet, | |
| 84 | + cell, iterator, i, rowNum, key); | |
| 85 | + rowNum += rowCount; | |
| 86 | + i += rowCount; | |
| 87 | + break; | |
| 88 | + } else { | |
| 89 | + // 直接填充数据的列,从对象数组中取得值 | |
| 90 | + getValueAndSetCellValue(cell, key, tArray); | |
| 91 | + } | |
| 92 | + } | |
| 93 | + | |
| 94 | + } | |
| 95 | + } | |
| 96 | + // 创建目标文件夹 | |
| 97 | + createFolder(targetPath); | |
| 98 | + // 输出文件 | |
| 99 | + FileOutputStream fileOut = new FileOutputStream(targetPath); | |
| 100 | + wb.write(fileOut); | |
| 101 | + fileOut.close(); | |
| 102 | + } catch (Exception e) { | |
| 103 | + e.printStackTrace(); | |
| 104 | + } | |
| 105 | + } | |
| 106 | + | |
| 107 | + /** | |
| 108 | + * 根据iterator,以及模板中的标识,填充模板 | |
| 109 | + * | |
| 110 | + * @param wb | |
| 111 | + * @param sheet | |
| 112 | + * @param cell | |
| 113 | + * @param iterator | |
| 114 | + * iterator | |
| 115 | + * @param index | |
| 116 | + * 模板行索引 | |
| 117 | + * @param rowNum | |
| 118 | + * 表格总行数 | |
| 119 | + * @param key | |
| 120 | + * 表格内容 | |
| 121 | + * @return | |
| 122 | + */ | |
| 123 | + private int iteratorFillCellValue(HSSFWorkbook wb, HSSFSheet sheet, | |
| 124 | + HSSFCell cell, Iterator<?> iterator, int index, int rowNum, | |
| 125 | + String key) { | |
| 126 | + int rowCount = 0; | |
| 127 | + Object obj = null; | |
| 128 | + int p = 0; | |
| 129 | + int i = index; | |
| 130 | + HSSFRow newRow = null; | |
| 131 | + int tmpCellNum = 0; | |
| 132 | + int k = 0; | |
| 133 | + // 取得模板行 | |
| 134 | + HSSFRow orgRow = sheet.getRow(index); | |
| 135 | + try { | |
| 136 | + while (iterator.hasNext()) { | |
| 137 | + // 取得iterator的对象 | |
| 138 | + obj = iterator.next(); | |
| 139 | + // 移动当前编辑行以下的所有行 | |
| 140 | + if (p != 0) { | |
| 141 | + rowNum += 1; | |
| 142 | + i += 1; | |
| 143 | + rowCount += 1;// 增加的总行数 | |
| 144 | + // 把当前行以下的所有行往下移动1行 | |
| 145 | + sheet.shiftRows(i, rowNum, 1); | |
| 146 | + } | |
| 147 | + p = 1; | |
| 148 | + // 创建新行 | |
| 149 | + newRow = sheet.createRow(index + k++); | |
| 150 | + // 把新行的内容换成和模板行一样 | |
| 151 | + copyRow(wb, orgRow, newRow, true); | |
| 152 | + tmpCellNum = newRow.getLastCellNum(); | |
| 153 | + for (int l = 0; l < tmpCellNum; l++) { | |
| 154 | + cell = newRow.getCell(l); | |
| 155 | + key = cell.getStringCellValue(); | |
| 156 | + /** | |
| 157 | + * 如果单无格内容为#list#,表示该行是模板行 #list#0_0 | |
| 158 | + * 第一个0表示需要在list中取iterator的索引值 | |
| 159 | + * 第二个0表示在iterator中取的第几个对象,如果不为0,则取下一个对象,而不是沿用前面获取的对象 | |
| 160 | + */ | |
| 161 | + if (key.indexOf("#list#") != -1 && key.indexOf("_0") == -1) { | |
| 162 | + if (iterator.hasNext()) { | |
| 163 | + obj = iterator.next(); | |
| 164 | + } else { | |
| 165 | + obj = null; | |
| 166 | + } | |
| 167 | + } | |
| 168 | + if (key.trim().indexOf(" ") != -1) { | |
| 169 | + key = key.split(" ")[1]; | |
| 170 | + } | |
| 171 | + getValueAndSetCellValue(cell, key, obj); | |
| 172 | + } | |
| 173 | + } | |
| 174 | + } catch (Exception e) { | |
| 175 | + e.printStackTrace(); | |
| 176 | + } | |
| 177 | + return rowCount; | |
| 178 | + } | |
| 179 | + | |
| 180 | + /** | |
| 181 | + * 取到相应的值并填入相应的列中 | |
| 182 | + * | |
| 183 | + * @param cell | |
| 184 | + * 列 | |
| 185 | + * @param key | |
| 186 | + * 列内容 | |
| 187 | + * @param obj | |
| 188 | + * 数据源对象 | |
| 189 | + */ | |
| 190 | + private void getValueAndSetCellValue(HSSFCell cell, String key, Object obj) { | |
| 191 | + try { | |
| 192 | + // 保有存单元格的内容 | |
| 193 | + String cellValue = key = key.replace("\\n", ""); | |
| 194 | + String tmpKey; | |
| 195 | + // 循环截取两个$中间的内容,反射出值 | |
| 196 | + while (key.indexOf("$") != -1) { | |
| 197 | + key = key.substring(key.indexOf("$") + 1); | |
| 198 | + // 取两个$中间的内容 | |
| 199 | + tmpKey = key.substring(0, key.indexOf("$")); | |
| 200 | + key = key.substring(key.indexOf("$") + 1); | |
| 201 | + // 如果内容是如下格式Cars.id,则从obj中值得相应的对象的值 | |
| 202 | + if (tmpKey.indexOf(".") != -1) { | |
| 203 | + String className = tmpKey.substring(0, tmpKey.indexOf(".")); | |
| 204 | + // 取得类的全限定名 | |
| 205 | + String classWholeName = packaegName + className; | |
| 206 | + String fieldName = tmpKey.substring(tmpKey.indexOf(".") + 1); | |
| 207 | + // 如果obj是数组,循环判断哪个对象是对应的 | |
| 208 | + if (obj instanceof Object[]) { | |
| 209 | + Object[] objs = (Object[]) obj; | |
| 210 | + for (int k = 0; k < objs.length; k++) { | |
| 211 | + if (objs[k].getClass().getName().equals(classWholeName)) { | |
| 212 | + cellValue = cellValue.replace("$" + tmpKey | |
| 213 | + + "$", getKeyValue(objs[k], fieldName) | |
| 214 | + + ""); | |
| 215 | + } | |
| 216 | + } | |
| 217 | + } else if (obj.getClass().getName().equals(classWholeName)) { | |
| 218 | + cellValue = cellValue.replace("$" + tmpKey + "$",getKeyValue(obj, fieldName) + ""); | |
| 219 | + } | |
| 220 | + } | |
| 221 | + } | |
| 222 | + cell.setCellValue(cellValue); | |
| 223 | + } catch (Exception e) { | |
| 224 | + e.printStackTrace(); | |
| 225 | + } | |
| 226 | + | |
| 227 | + } | |
| 228 | + | |
| 229 | + /** | |
| 230 | + * 给列填充数据 | |
| 231 | + * | |
| 232 | + * @param cell | |
| 233 | + * 列 | |
| 234 | + * @param obj | |
| 235 | + * 数据源对象 | |
| 236 | + * @param fieldName | |
| 237 | + * 需要取数据的字段 | |
| 238 | + */ | |
| 239 | + private Object getKeyValue(Object obj, String fieldName) { | |
| 240 | + Object value = ""; | |
| 241 | + try { | |
| 242 | + if (obj != null) { | |
| 243 | + ReportRelatedUtils test = new ReportRelatedUtils(); | |
| 244 | + value = test.getValue(obj, fieldName) == null ? "" : test .getValue(obj, fieldName); | |
| 245 | + } | |
| 246 | + } catch (Exception e) { | |
| 247 | + e.printStackTrace(); | |
| 248 | + } | |
| 249 | + return value; | |
| 250 | + } | |
| 251 | + | |
| 252 | + public static void main(String[] args) { | |
| 253 | + | |
| 254 | + try { | |
| 255 | + ReportUtils ee = new ReportUtils(); | |
| 256 | + List<Iterator<?>> list = new ArrayList<Iterator<?>>(); | |
| 257 | + Line line = new Line(); | |
| 258 | + line.setId(1); | |
| 259 | + line.setName("line1"); | |
| 260 | + | |
| 261 | + List<Object> dataList = new ArrayList<Object>(); | |
| 262 | + | |
| 263 | + | |
| 264 | + ScheduleRealInfo srr = new ScheduleRealInfo(); | |
| 265 | + srr.setId((long) 111); | |
| 266 | + srr.setXlName("abc11"); | |
| 267 | + | |
| 268 | + ScheduleRealInfo sr = new ScheduleRealInfo(); | |
| 269 | + sr.setId((long) 22); | |
| 270 | + sr.setXlName("abc22"); | |
| 271 | + dataList.add(sr); | |
| 272 | + sr = new ScheduleRealInfo(); | |
| 273 | + sr.setId((long) 33); | |
| 274 | + sr.setXlName("abc33"); | |
| 275 | + dataList.add(sr); | |
| 276 | + list.add(dataList.iterator()); | |
| 277 | + | |
| 278 | + ee.excelReplace(list, new Object[] { srr }, "D:\\55.xls", | |
| 279 | + "D:\\22.xls"); | |
| 280 | + System.out.println("ok"); | |
| 281 | + } catch (Exception e) { | |
| 282 | + e.printStackTrace(); | |
| 283 | + } | |
| 284 | + } | |
| 285 | + | |
| 286 | + /** | |
| 287 | + * 行复制功能 | |
| 288 | + * | |
| 289 | + * @param fromRow | |
| 290 | + * @param toRow | |
| 291 | + */ | |
| 292 | + private void copyRow(HSSFWorkbook wb, HSSFRow fromRow, HSSFRow toRow, | |
| 293 | + boolean copyValueFlag) { | |
| 294 | + for (Iterator<Cell> cellIt = fromRow.cellIterator(); cellIt.hasNext();) { | |
| 295 | + HSSFCell tmpCell = (HSSFCell) cellIt.next(); | |
| 296 | + HSSFCell newCell = toRow.createCell(tmpCell.getColumnIndex(), 0); | |
| 297 | + copyCell(wb, tmpCell, newCell, copyValueFlag); | |
| 298 | + } | |
| 299 | + } | |
| 300 | + | |
| 301 | + /** | |
| 302 | + * 复制单元格 | |
| 303 | + * | |
| 304 | + * @param srcCell | |
| 305 | + * @param distCell | |
| 306 | + * @param copyValueFlag | |
| 307 | + * true则连同cell的内容一起复制 | |
| 308 | + */ | |
| 309 | + public void copyCell(HSSFWorkbook wb, HSSFCell srcCell, HSSFCell distCell, | |
| 310 | + boolean copyValueFlag) { | |
| 311 | + HSSFCellStyle newstyle = wb.createCellStyle(); | |
| 312 | + copyCellStyle(wb, srcCell.getCellStyle(), newstyle); | |
| 313 | + // 样式 | |
| 314 | + distCell.setCellStyle(newstyle); | |
| 315 | + // 评论 | |
| 316 | + if (srcCell.getCellComment() != null) { | |
| 317 | + distCell.setCellComment(srcCell.getCellComment()); | |
| 318 | + } | |
| 319 | + // 不同数据类型处理 | |
| 320 | + int srcCellType = srcCell.getCellType(); | |
| 321 | + distCell.setCellType(srcCellType); | |
| 322 | + if (copyValueFlag) { | |
| 323 | + if (srcCellType == HSSFCell.CELL_TYPE_NUMERIC) { | |
| 324 | + distCell.setCellValue(srcCell.getDateCellValue()); | |
| 325 | + } else if (srcCellType == HSSFCell.CELL_TYPE_STRING) { | |
| 326 | + distCell.setCellValue(srcCell.getRichStringCellValue()); | |
| 327 | + } else if (srcCellType == HSSFCell.CELL_TYPE_BLANK) { | |
| 328 | + | |
| 329 | + } else if (srcCellType == HSSFCell.CELL_TYPE_BOOLEAN) { | |
| 330 | + distCell.setCellValue(srcCell.getBooleanCellValue()); | |
| 331 | + } else if (srcCellType == HSSFCell.CELL_TYPE_ERROR) { | |
| 332 | + distCell.setCellErrorValue(srcCell.getErrorCellValue()); | |
| 333 | + } else if (srcCellType == HSSFCell.CELL_TYPE_FORMULA) { | |
| 334 | + distCell.setCellFormula(srcCell.getCellFormula()); | |
| 335 | + } else { | |
| 336 | + } | |
| 337 | + } | |
| 338 | + } | |
| 339 | + | |
| 340 | + /** | |
| 341 | + * 复制一个单元格样式到目的单元格样式 | |
| 342 | + * | |
| 343 | + * @param fromStyle | |
| 344 | + * @param toStyle | |
| 345 | + */ | |
| 346 | + public void copyCellStyle(HSSFWorkbook wb, HSSFCellStyle fromStyle, | |
| 347 | + HSSFCellStyle toStyle) { | |
| 348 | + toStyle.setAlignment(fromStyle.getAlignment()); | |
| 349 | + // 边框和边框颜色 | |
| 350 | + toStyle.setBorderBottom(fromStyle.getBorderBottom()); | |
| 351 | + toStyle.setBorderLeft(fromStyle.getBorderLeft()); | |
| 352 | + toStyle.setBorderRight(fromStyle.getBorderRight()); | |
| 353 | + toStyle.setBorderTop(fromStyle.getBorderTop()); | |
| 354 | + toStyle.setTopBorderColor(fromStyle.getTopBorderColor()); | |
| 355 | + toStyle.setBottomBorderColor(fromStyle.getBottomBorderColor()); | |
| 356 | + toStyle.setRightBorderColor(fromStyle.getRightBorderColor()); | |
| 357 | + toStyle.setLeftBorderColor(fromStyle.getLeftBorderColor()); | |
| 358 | + | |
| 359 | + // 背景和前景 | |
| 360 | + toStyle.setFillBackgroundColor(fromStyle.getFillBackgroundColor()); | |
| 361 | + toStyle.setFillForegroundColor(fromStyle.getFillForegroundColor()); | |
| 362 | + | |
| 363 | + toStyle.setDataFormat(fromStyle.getDataFormat()); | |
| 364 | + toStyle.setFillPattern(fromStyle.getFillPattern()); | |
| 365 | + toStyle.setHidden(fromStyle.getHidden()); | |
| 366 | + toStyle.setIndention(fromStyle.getIndention());// 首行缩进 | |
| 367 | + toStyle.setLocked(fromStyle.getLocked()); | |
| 368 | + toStyle.setRotation(fromStyle.getRotation());// 旋转 | |
| 369 | + toStyle.setVerticalAlignment(fromStyle.getVerticalAlignment()); | |
| 370 | + toStyle.setWrapText(fromStyle.getWrapText()); | |
| 371 | + // 字体 | |
| 372 | + toStyle.setFont(fromStyle.getFont(wb)); | |
| 373 | + | |
| 374 | + } | |
| 375 | + | |
| 376 | + /** | |
| 377 | + * 创建文件夹,并删除原有文件 | |
| 378 | + * | |
| 379 | + * @param path | |
| 380 | + */ | |
| 381 | + private void createFolder(String path) { | |
| 382 | + File targetFile = null; | |
| 383 | + targetFile = new File(path); | |
| 384 | + if (targetFile.exists()) {// 删除原有文件 | |
| 385 | + targetFile.delete(); | |
| 386 | + } | |
| 387 | + // 创建目标文件夹 | |
| 388 | + targetFile = new File(path.substring(0, path.lastIndexOf("\\"))); | |
| 389 | + if (!targetFile.exists()) { | |
| 390 | + targetFile.mkdirs(); | |
| 391 | + } | |
| 392 | + } | |
| 393 | + | |
| 394 | +} | ... | ... |
src/main/java/com/bsth/util/Test.java
| ... | ... | @@ -24,35 +24,57 @@ public class Test { |
| 24 | 24 | * @throws |
| 25 | 25 | */ |
| 26 | 26 | public static File pack(File[] sources, File target){ |
| 27 | - FileOutputStream out = null; | |
| 28 | - try { | |
| 29 | - out = new FileOutputStream(target); | |
| 30 | - } catch (FileNotFoundException e1) { | |
| 31 | - e1.printStackTrace(); | |
| 32 | - } | |
| 33 | - TarArchiveOutputStream os = new TarArchiveOutputStream(out); | |
| 34 | - for (File file : sources) { | |
| 35 | - try { | |
| 36 | - os.putArchiveEntry(new TarArchiveEntry(file)); | |
| 37 | - IOUtils.copy(new FileInputStream(file), os); | |
| 38 | - os.closeArchiveEntry(); | |
| 39 | - | |
| 40 | - } catch (FileNotFoundException e) { | |
| 41 | - e.printStackTrace(); | |
| 42 | - } catch (IOException e) { | |
| 43 | - e.printStackTrace(); | |
| 44 | - } | |
| 45 | - } | |
| 46 | - if(os != null) { | |
| 47 | - try { | |
| 48 | - os.flush(); | |
| 49 | - os.close(); | |
| 50 | - } catch (IOException e) { | |
| 51 | - e.printStackTrace(); | |
| 52 | - } | |
| 53 | - } | |
| 27 | + | |
| 28 | + FileOutputStream out = null; | |
| 29 | + | |
| 30 | + try { | |
| 31 | + | |
| 32 | + out = new FileOutputStream(target); | |
| 33 | + | |
| 34 | + } catch (FileNotFoundException e1) { | |
| 35 | + | |
| 36 | + e1.printStackTrace(); | |
| 37 | + | |
| 38 | + } | |
| 39 | + | |
| 40 | + TarArchiveOutputStream os = new TarArchiveOutputStream(out); | |
| 41 | + | |
| 42 | + for (File file : sources) { | |
| 43 | + | |
| 44 | + try { | |
| 45 | + | |
| 46 | + os.putArchiveEntry(new TarArchiveEntry(file)); | |
| 47 | + | |
| 48 | + IOUtils.copy(new FileInputStream(file), os); | |
| 49 | + | |
| 50 | + os.closeArchiveEntry(); | |
| 51 | + | |
| 52 | + } catch (FileNotFoundException e) { | |
| 53 | + | |
| 54 | + e.printStackTrace(); | |
| 55 | + | |
| 56 | + } catch (IOException e) { | |
| 57 | + | |
| 58 | + e.printStackTrace(); | |
| 59 | + | |
| 60 | + } | |
| 61 | + } | |
| 62 | + if(os != null) { | |
| 63 | + | |
| 64 | + try { | |
| 65 | + | |
| 66 | + os.flush(); | |
| 67 | + | |
| 68 | + os.close(); | |
| 69 | + | |
| 70 | + } catch (IOException e) { | |
| 71 | + | |
| 72 | + e.printStackTrace(); | |
| 73 | + } | |
| 74 | + } | |
| 54 | 75 | |
| 55 | 76 | return target; |
| 77 | + | |
| 56 | 78 | } |
| 57 | 79 | |
| 58 | 80 | /** | ... | ... |
src/main/java/com/bsth/vehicle/UpstreamEntrance.java
| ... | ... | @@ -12,7 +12,7 @@ import com.alibaba.fastjson.JSON; |
| 12 | 12 | import com.alibaba.fastjson.JSONObject; |
| 13 | 13 | import com.bsth.vehicle.directive.buffer.DirectiveBuffer; |
| 14 | 14 | import com.bsth.vehicle.directive.entity.DirectiveReply; |
| 15 | -import com.bsth.vehicle.directive.entity.DriverReport; | |
| 15 | +import com.bsth.vehicle.directive.entity.Directive80; | |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * |
| ... | ... | @@ -33,7 +33,7 @@ public class UpstreamEntrance { |
| 33 | 33 | |
| 34 | 34 | @RequestMapping(value = "/upstream" , method = RequestMethod.POST) |
| 35 | 35 | public int main(@RequestParam String json){ |
| 36 | - logger.info(json); | |
| 36 | + logger.info("upstream: " + json); | |
| 37 | 37 | JSONObject jsonParam = JSONObject.parseObject(json); |
| 38 | 38 | |
| 39 | 39 | //46和47 调度指令确认 |
| ... | ... | @@ -46,11 +46,13 @@ public class UpstreamEntrance { |
| 46 | 46 | logger.error("NumberFormatException ,,,,一般是老数据,msgId太大"); |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | - //80协议,驾驶员上报 | |
| 49 | + //80协议 | |
| 50 | 50 | else if(jsonParam.getInteger("operCode") == 0X80){ |
| 51 | 51 | try{ |
| 52 | - DriverReport report = JSON.toJavaObject(jsonParam, DriverReport.class); | |
| 53 | - directiveBuffer.jsyReport(report); | |
| 52 | + Directive80 report = JSON.toJavaObject(jsonParam, Directive80.class); | |
| 53 | + //驾驶员上报 | |
| 54 | + if(report.getData().getOperCode2() == 0x26) | |
| 55 | + directiveBuffer.jsyReport(report); | |
| 54 | 56 | }catch(Exception e){ |
| 55 | 57 | logger.error("", e); |
| 56 | 58 | } | ... | ... |
src/main/java/com/bsth/vehicle/common/CommonMapped.java
| ... | ... | @@ -2,7 +2,9 @@ package com.bsth.vehicle.common; |
| 2 | 2 | |
| 3 | 3 | import java.util.Map; |
| 4 | 4 | |
| 5 | +import com.bsth.entity.Line; | |
| 5 | 6 | import com.google.common.collect.BiMap; |
| 7 | +import com.google.common.collect.TreeMultimap; | |
| 6 | 8 | |
| 7 | 9 | /** |
| 8 | 10 | * |
| ... | ... | @@ -35,9 +37,20 @@ public class CommonMapped { |
| 35 | 37 | public static Map<String , String> vehicCompanyMap; |
| 36 | 38 | |
| 37 | 39 | /** |
| 40 | + * 车辆和线路对照 | |
| 41 | + */ | |
| 42 | + public static Map<String, Line> vehicLineMap; | |
| 43 | + | |
| 44 | + /** | |
| 38 | 45 | * 站点编码和名称对照,包括停车场 |
| 39 | 46 | *(K: 站点编码 ,V:站点名称) |
| 40 | 47 | */ |
| 41 | 48 | public static Map<String, String> stationCodeMap; |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 线路和用户名对照 | |
| 52 | + * 用于webSocket定向推送消息 | |
| 53 | + */ | |
| 54 | + public static TreeMultimap<Integer, String> lineUserMap = TreeMultimap.create(); | |
| 42 | 55 | |
| 43 | 56 | } | ... | ... |
src/main/java/com/bsth/vehicle/common/CommonRefreshThread.java
| ... | ... | @@ -11,10 +11,13 @@ import org.springframework.stereotype.Component; |
| 11 | 11 | |
| 12 | 12 | import com.bsth.entity.CarPark; |
| 13 | 13 | import com.bsth.entity.Cars; |
| 14 | +import com.bsth.entity.Line; | |
| 14 | 15 | import com.bsth.entity.Station; |
| 16 | +import com.bsth.entity.schedule.CarConfigInfo; | |
| 15 | 17 | import com.bsth.repository.CarParkRepository; |
| 16 | 18 | import com.bsth.repository.CarsRepository; |
| 17 | 19 | import com.bsth.repository.StationRepository; |
| 20 | +import com.bsth.repository.schedule.CarConfigInfoRepository; | |
| 18 | 21 | import com.google.common.collect.BiMap; |
| 19 | 22 | import com.google.common.collect.HashBiMap; |
| 20 | 23 | |
| ... | ... | @@ -38,6 +41,9 @@ public class CommonRefreshThread extends Thread{ |
| 38 | 41 | @Autowired |
| 39 | 42 | CarParkRepository carParkRepository; |
| 40 | 43 | |
| 44 | + @Autowired | |
| 45 | + CarConfigInfoRepository carConfigInfoRepository; | |
| 46 | + | |
| 41 | 47 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 42 | 48 | |
| 43 | 49 | @Override |
| ... | ... | @@ -45,13 +51,33 @@ public class CommonRefreshThread extends Thread{ |
| 45 | 51 | try { |
| 46 | 52 | initVehicMapp(); |
| 47 | 53 | initStationCodeMap(); |
| 54 | + initVehicLineMap(); | |
| 48 | 55 | } catch (Exception e) { |
| 56 | + e.printStackTrace(); | |
| 49 | 57 | logger.error("", e); |
| 50 | 58 | } |
| 51 | 59 | } |
| 52 | 60 | |
| 53 | 61 | /** |
| 54 | 62 | * |
| 63 | + * @Title: initVehicLineMap | |
| 64 | + * @Description: TODO(根据车辆配置,加载车辆和线路对照数据) | |
| 65 | + * @throws | |
| 66 | + */ | |
| 67 | + private void initVehicLineMap() { | |
| 68 | + Iterator<CarConfigInfo> allIterator = carConfigInfoRepository.findAll().iterator(); | |
| 69 | + Map<String, Line> ccMap = new HashMap<>(); | |
| 70 | + | |
| 71 | + CarConfigInfo cci; | |
| 72 | + while(allIterator.hasNext()){ | |
| 73 | + cci = allIterator.next(); | |
| 74 | + ccMap.put(cci.getCl().getInsideCode(), cci.getXl()); | |
| 75 | + } | |
| 76 | + CommonMapped.vehicLineMap = ccMap; | |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * | |
| 55 | 81 | * @Title: initDeviceMapp |
| 56 | 82 | * @Description: TODO(初始化车辆相关对照) |
| 57 | 83 | */ | ... | ... |
src/main/java/com/bsth/vehicle/directive/MsgIdGenerator.java
src/main/java/com/bsth/vehicle/directive/buffer/DirectiveBuffer.java
| ... | ... | @@ -9,13 +9,20 @@ import org.slf4j.LoggerFactory; |
| 9 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 10 | import org.springframework.stereotype.Component; |
| 11 | 11 | |
| 12 | +import com.alibaba.fastjson.JSON; | |
| 12 | 13 | import com.alibaba.fastjson.JSONObject; |
| 13 | -import com.bsth.vehicle.directive.entity.Directive; | |
| 14 | +import com.bsth.service.realcontrol.buffer.ScheduleBuffer; | |
| 15 | +import com.bsth.vehicle.common.CommonMapped; | |
| 16 | +import com.bsth.vehicle.directive.entity.Directive60; | |
| 14 | 17 | import com.bsth.vehicle.directive.entity.DirectiveReply; |
| 15 | -import com.bsth.vehicle.directive.entity.DriverReport; | |
| 18 | +import com.bsth.vehicle.directive.entity.Directive80; | |
| 19 | +import com.bsth.vehicle.directive.entity.DirectiveC0; | |
| 20 | +import com.bsth.vehicle.directive.entity.DirectiveC0.DirectiveC0Data; | |
| 16 | 21 | import com.bsth.vehicle.directive.entity.LineChange; |
| 17 | -import com.bsth.vehicle.directive.repository.DriverReportRepository; | |
| 22 | +import com.bsth.vehicle.directive.repository.Directive80Repository; | |
| 18 | 23 | import com.bsth.vehicle.directive.repository.LineChangeRepository; |
| 24 | +import com.bsth.vehicle.directive.util.HttpUtils; | |
| 25 | +import com.bsth.websocket.handler.RealControlSocketHandler; | |
| 19 | 26 | import com.google.common.collect.ArrayListMultimap; |
| 20 | 27 | import com.google.common.collect.Multimap; |
| 21 | 28 | |
| ... | ... | @@ -33,15 +40,16 @@ public class DirectiveBuffer { |
| 33 | 40 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 34 | 41 | |
| 35 | 42 | @Autowired |
| 36 | - DriverReportRepository driverReportRepository; | |
| 43 | + Directive80Repository d80Repository; | |
| 37 | 44 | |
| 38 | 45 | @Autowired |
| 39 | 46 | LineChangeRepository lineChangeRepository; |
| 40 | 47 | |
| 48 | + | |
| 41 | 49 | /** |
| 42 | 50 | * 等待入库的调度指令 |
| 43 | 51 | */ |
| 44 | - public static LinkedList<Directive> transientList; | |
| 52 | + public static LinkedList<Directive60> transientList; | |
| 45 | 53 | |
| 46 | 54 | /** |
| 47 | 55 | * 等待确认的线路切换指令 |
| ... | ... | @@ -51,13 +59,16 @@ public class DirectiveBuffer { |
| 51 | 59 | /** |
| 52 | 60 | * 当日调度指令缓存 |
| 53 | 61 | */ |
| 54 | - private static Map<Integer, Directive> directiveMap; | |
| 62 | + private static Map<Integer, Directive60> directiveMap; | |
| 55 | 63 | |
| 56 | 64 | /** |
| 57 | 65 | * 驾驶员上报数据 |
| 58 | 66 | * {K: 线路编码} |
| 59 | 67 | */ |
| 60 | - private static Multimap<Integer, DriverReport> reportMultiMap; | |
| 68 | + private static Multimap<Integer, Directive80> reportMultiMap; | |
| 69 | + | |
| 70 | + @Autowired | |
| 71 | + RealControlSocketHandler socketHandler; | |
| 61 | 72 | |
| 62 | 73 | static{ |
| 63 | 74 | transientList = new LinkedList<>(); |
| ... | ... | @@ -66,7 +77,7 @@ public class DirectiveBuffer { |
| 66 | 77 | changeMap = new HashMap<>(); |
| 67 | 78 | } |
| 68 | 79 | |
| 69 | - public static void put(Directive directive){ | |
| 80 | + public static void put(Directive60 directive){ | |
| 70 | 81 | directiveMap.put(directive.getMsgId(), directive); |
| 71 | 82 | } |
| 72 | 83 | |
| ... | ... | @@ -83,7 +94,7 @@ public class DirectiveBuffer { |
| 83 | 94 | return; |
| 84 | 95 | } |
| 85 | 96 | |
| 86 | - Directive directive = directiveMap.get(msgId); | |
| 97 | + Directive60 directive = directiveMap.get(msgId); | |
| 87 | 98 | |
| 88 | 99 | if(null == directive){ |
| 89 | 100 | //无效的响应 |
| ... | ... | @@ -107,6 +118,7 @@ public class DirectiveBuffer { |
| 107 | 118 | } |
| 108 | 119 | |
| 109 | 120 | if(directive.isDispatch()){ |
| 121 | + //更新班次状态 | |
| 110 | 122 | directive.getSch().setDirectiveState(reply.getStatus() * 100); |
| 111 | 123 | } |
| 112 | 124 | transientList.add(directive); |
| ... | ... | @@ -146,10 +158,51 @@ public class DirectiveBuffer { |
| 146 | 158 | * @Description: TODO(80 驾驶员上报) |
| 147 | 159 | * @throws |
| 148 | 160 | */ |
| 149 | - public void jsyReport(DriverReport report){ | |
| 150 | - logger.info("驾驶员上报"); | |
| 161 | + public void jsyReport(Directive80 report){ | |
| 162 | + //将托管的线路自动处理掉 | |
| 163 | + Integer lineCode = report.getData().getLineId(); | |
| 164 | + Integer status = ScheduleBuffer.trustMap.get(lineCode); | |
| 165 | + //请求代码 | |
| 166 | + Short requestCode = report.getData().getRequestCode(); | |
| 167 | + //托管 | |
| 168 | + if(null == status || status == 0){ | |
| 169 | + //自动处理出场请求 | |
| 170 | + if(requestCode == 0xA3){ | |
| 171 | + DirectiveC0 c0 = createC0(report, (short)0x06); | |
| 172 | + HttpUtils.postJson(JSON.toJSONString(c0)); | |
| 173 | + report.setC0(c0); | |
| 174 | + d80Repository.save(report); | |
| 175 | + } | |
| 176 | + } | |
| 177 | + | |
| 151 | 178 | //实时入库 |
| 152 | - driverReportRepository.save(report); | |
| 153 | - reportMultiMap.put(report.getData().getLineId(), report); | |
| 179 | + d80Repository.save(report); | |
| 180 | + reportMultiMap.put(lineCode, report); | |
| 181 | + //推送到页面 | |
| 182 | + report.getData().setNbbm(CommonMapped.vehicDeviceBiMap.get(report.getDeviceId())); | |
| 183 | + JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(report)); | |
| 184 | + json.put("fn", "report80"); | |
| 185 | + socketHandler.sendMessageToLine(lineCode, json.toJSONString()); | |
| 186 | + } | |
| 187 | + | |
| 188 | + /** | |
| 189 | + * | |
| 190 | + * @Title: createC0 | |
| 191 | + * @Description: TODO(生成C0数据) | |
| 192 | + * @param @param ack | |
| 193 | + * @throws | |
| 194 | + */ | |
| 195 | + public DirectiveC0 createC0(Directive80 report, short ack){ | |
| 196 | + DirectiveC0 c0 = new DirectiveC0(); | |
| 197 | + c0.setDeviceId(report.getDeviceId()); | |
| 198 | + c0.setTimestamp(report.getTimestamp()); | |
| 199 | + c0.setOperCode((short)0xC0); | |
| 200 | + | |
| 201 | + DirectiveC0Data data = new DirectiveC0Data(); | |
| 202 | + data.setOperCode2((short)0x86); | |
| 203 | + data.setRequestAck(ack); | |
| 204 | + | |
| 205 | + c0.setData(data); | |
| 206 | + return c0; | |
| 154 | 207 | } |
| 155 | 208 | } | ... | ... |
src/main/java/com/bsth/vehicle/directive/controller/DirectiveController.java
| ... | ... | @@ -36,6 +36,18 @@ public class DirectiveController { |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * |
| 39 | + * @Title: send60Dispatch | |
| 40 | + * @Description: TODO(班次信息下发) | |
| 41 | + * @param @param id | |
| 42 | + * @throws | |
| 43 | + */ | |
| 44 | + @RequestMapping(value = "/dispatch", method = RequestMethod.POST) | |
| 45 | + public int send60Dispatch(@RequestParam Long id){ | |
| 46 | + return directiveService.send60Dispatch(id); | |
| 47 | + } | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * | |
| 39 | 51 | * @Title: lineChange |
| 40 | 52 | * @Description: TODO(切换线路) |
| 41 | 53 | * @param @param nbbm 车辆内部编码 |
| ... | ... | @@ -46,4 +58,17 @@ public class DirectiveController { |
| 46 | 58 | public int lineChange(@RequestParam String nbbm, @RequestParam Integer lineId){ |
| 47 | 59 | return directiveService.lineChange(nbbm, lineId); |
| 48 | 60 | } |
| 61 | + | |
| 62 | + /** | |
| 63 | + * | |
| 64 | + * @Title: upDownChange | |
| 65 | + * @Description: TODO(上下行切换) | |
| 66 | + * @param @param nbbm 车辆内部编码 | |
| 67 | + * @param @param upDon | |
| 68 | + * @throws | |
| 69 | + */ | |
| 70 | + @RequestMapping(value = "/upDownChange", method = RequestMethod.POST) | |
| 71 | + public int upDownChange(@RequestParam String nbbm, @RequestParam Integer upDown){ | |
| 72 | + return directiveService.upDownChange(nbbm, upDown); | |
| 73 | + } | |
| 49 | 74 | } | ... | ... |
src/main/java/com/bsth/vehicle/directive/entity/Directive.java renamed to src/main/java/com/bsth/vehicle/directive/entity/Directive60.java
| ... | ... | @@ -9,6 +9,7 @@ import javax.persistence.Table; |
| 9 | 9 | import javax.persistence.Transient; |
| 10 | 10 | |
| 11 | 11 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 12 | +import com.bsth.entity.sys.SysUser; | |
| 12 | 13 | |
| 13 | 14 | |
| 14 | 15 | /** |
| ... | ... | @@ -21,7 +22,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 21 | 22 | */ |
| 22 | 23 | @Entity |
| 23 | 24 | @Table(name = "bsth_v_directive_60") |
| 24 | -public class Directive { | |
| 25 | +public class Directive60 { | |
| 25 | 26 | |
| 26 | 27 | @Id |
| 27 | 28 | @GeneratedValue |
| ... | ... | @@ -77,6 +78,12 @@ public class Directive { |
| 77 | 78 | @ManyToOne |
| 78 | 79 | private ScheduleRealInfo sch; |
| 79 | 80 | |
| 81 | + /** | |
| 82 | + * 发送人 | |
| 83 | + */ | |
| 84 | + @ManyToOne | |
| 85 | + private SysUser sender; | |
| 86 | + | |
| 80 | 87 | @Embeddable |
| 81 | 88 | public static class DirectiveData { |
| 82 | 89 | // 公司代码 |
| ... | ... | @@ -99,7 +106,7 @@ public class Directive { |
| 99 | 106 | * 0x03表示运营状态指令(闹钟无效) |
| 100 | 107 | * 0x04表示其他指令 |
| 101 | 108 | */ |
| 102 | - private DispatchInstruct dispatchInstruct; | |
| 109 | + private Short dispatchInstruct; | |
| 103 | 110 | |
| 104 | 111 | // 唯一标识 |
| 105 | 112 | private int msgId; |
| ... | ... | @@ -145,11 +152,11 @@ public class Directive { |
| 145 | 152 | this.instructType = instructType; |
| 146 | 153 | } |
| 147 | 154 | |
| 148 | - public DispatchInstruct getDispatchInstruct() { | |
| 155 | + public Short getDispatchInstruct() { | |
| 149 | 156 | return dispatchInstruct; |
| 150 | 157 | } |
| 151 | 158 | |
| 152 | - public void setDispatchInstruct(DispatchInstruct dispatchInstruct) { | |
| 159 | + public void setDispatchInstruct(Short dispatchInstruct) { | |
| 153 | 160 | this.dispatchInstruct = dispatchInstruct; |
| 154 | 161 | } |
| 155 | 162 | |
| ... | ... | @@ -265,4 +272,12 @@ public class Directive { |
| 265 | 272 | public void setSch(ScheduleRealInfo sch) { |
| 266 | 273 | this.sch = sch; |
| 267 | 274 | } |
| 275 | + | |
| 276 | + public SysUser getSender() { | |
| 277 | + return sender; | |
| 278 | + } | |
| 279 | + | |
| 280 | + public void setSender(SysUser sender) { | |
| 281 | + this.sender = sender; | |
| 282 | + } | |
| 268 | 283 | } | ... | ... |
src/main/java/com/bsth/vehicle/directive/entity/DriverReport.java renamed to src/main/java/com/bsth/vehicle/directive/entity/Directive80.java
| ... | ... | @@ -4,7 +4,12 @@ import javax.persistence.Embeddable; |
| 4 | 4 | import javax.persistence.Entity; |
| 5 | 5 | import javax.persistence.GeneratedValue; |
| 6 | 6 | import javax.persistence.Id; |
| 7 | +import javax.persistence.NamedAttributeNode; | |
| 8 | +import javax.persistence.NamedEntityGraph; | |
| 9 | +import javax.persistence.NamedEntityGraphs; | |
| 10 | +import javax.persistence.OneToOne; | |
| 7 | 11 | import javax.persistence.Table; |
| 12 | +import javax.persistence.Transient; | |
| 8 | 13 | |
| 9 | 14 | /** |
| 10 | 15 | * |
| ... | ... | @@ -16,7 +21,12 @@ import javax.persistence.Table; |
| 16 | 21 | */ |
| 17 | 22 | @Entity |
| 18 | 23 | @Table(name = "bsth_v_report_80") |
| 19 | -public class DriverReport { | |
| 24 | +@NamedEntityGraphs({ | |
| 25 | + @NamedEntityGraph(name = "directive80_c0", attributeNodes = { | |
| 26 | + @NamedAttributeNode("c0") | |
| 27 | + }) | |
| 28 | +}) | |
| 29 | +public class Directive80 { | |
| 20 | 30 | |
| 21 | 31 | @Id |
| 22 | 32 | @GeneratedValue |
| ... | ... | @@ -33,15 +43,24 @@ public class DriverReport { |
| 33 | 43 | private Long timestamp; |
| 34 | 44 | |
| 35 | 45 | /** |
| 36 | - * 一级协议 | |
| 46 | + * 一级协议 0xC0 | |
| 37 | 47 | */ |
| 38 | 48 | private Short operCode; |
| 39 | 49 | |
| 40 | 50 | private DriverReportData data; |
| 51 | + | |
| 52 | + /** | |
| 53 | + * c0 回复 | |
| 54 | + */ | |
| 55 | + @OneToOne | |
| 56 | + private DirectiveC0 c0; | |
| 41 | 57 | |
| 42 | 58 | @Embeddable |
| 43 | 59 | public static class DriverReportData { |
| 44 | 60 | |
| 61 | + /** | |
| 62 | + * 0x86 | |
| 63 | + */ | |
| 45 | 64 | private Short operCode2; |
| 46 | 65 | |
| 47 | 66 | /** |
| ... | ... | @@ -54,7 +73,13 @@ public class DriverReport { |
| 54 | 73 | * 线路编码 |
| 55 | 74 | */ |
| 56 | 75 | private Integer lineId; |
| 57 | - | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 车辆内部编码 | |
| 79 | + */ | |
| 80 | + @Transient | |
| 81 | + private String nbbm; | |
| 82 | + | |
| 58 | 83 | public Short getOperCode2() { |
| 59 | 84 | return operCode2; |
| 60 | 85 | } |
| ... | ... | @@ -78,6 +103,14 @@ public class DriverReport { |
| 78 | 103 | public void setLineId(Integer lineId) { |
| 79 | 104 | this.lineId = lineId; |
| 80 | 105 | } |
| 106 | + | |
| 107 | + public String getNbbm() { | |
| 108 | + return nbbm; | |
| 109 | + } | |
| 110 | + | |
| 111 | + public void setNbbm(String nbbm) { | |
| 112 | + this.nbbm = nbbm; | |
| 113 | + } | |
| 81 | 114 | } |
| 82 | 115 | |
| 83 | 116 | public Integer getId() { |
| ... | ... | @@ -119,4 +152,12 @@ public class DriverReport { |
| 119 | 152 | public void setData(DriverReportData data) { |
| 120 | 153 | this.data = data; |
| 121 | 154 | } |
| 155 | + | |
| 156 | + public DirectiveC0 getC0() { | |
| 157 | + return c0; | |
| 158 | + } | |
| 159 | + | |
| 160 | + public void setC0(DirectiveC0 c0) { | |
| 161 | + this.c0 = c0; | |
| 162 | + } | |
| 122 | 163 | } | ... | ... |
src/main/java/com/bsth/vehicle/directive/entity/DirectiveC0.java
0 → 100644
| 1 | +package com.bsth.vehicle.directive.entity; | |
| 2 | + | |
| 3 | +import javax.persistence.Embeddable; | |
| 4 | +import javax.persistence.Entity; | |
| 5 | +import javax.persistence.GeneratedValue; | |
| 6 | +import javax.persistence.Id; | |
| 7 | +import javax.persistence.OneToOne; | |
| 8 | +import javax.persistence.Table; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * | |
| 12 | + * @ClassName: DirectiveC0 | |
| 13 | + * @Description: TODO(C0协议,回复驾驶员上报) | |
| 14 | + * @author PanZhao | |
| 15 | + * @date 2016年7月8日 上午10:19:23 | |
| 16 | + * | |
| 17 | + */ | |
| 18 | +@Entity | |
| 19 | +@Table(name = "bsth_v_C0") | |
| 20 | +public class DirectiveC0 { | |
| 21 | + | |
| 22 | + @Id | |
| 23 | + @GeneratedValue | |
| 24 | + private Integer id; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 设备号 | |
| 28 | + */ | |
| 29 | + private String deviceId; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 时间戳 | |
| 33 | + */ | |
| 34 | + private Long timestamp; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 一级协议 | |
| 38 | + */ | |
| 39 | + private Short operCode; | |
| 40 | + | |
| 41 | + private DirectiveC0Data data; | |
| 42 | + | |
| 43 | + @Embeddable | |
| 44 | + public static class DirectiveC0Data { | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 二级协议 | |
| 48 | + */ | |
| 49 | + private Short operCode2; | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 请求应答字 0x06同意 0x15不同意 | |
| 53 | + */ | |
| 54 | + private Short requestAck; | |
| 55 | + | |
| 56 | + public Short getOperCode2() { | |
| 57 | + return operCode2; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public void setOperCode2(Short operCode2) { | |
| 61 | + this.operCode2 = operCode2; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public Short getRequestAck() { | |
| 65 | + return requestAck; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public void setRequestAck(Short requestAck) { | |
| 69 | + this.requestAck = requestAck; | |
| 70 | + } | |
| 71 | + } | |
| 72 | + | |
| 73 | + public Integer getId() { | |
| 74 | + return id; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void setId(Integer id) { | |
| 78 | + this.id = id; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public String getDeviceId() { | |
| 82 | + return deviceId; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public void setDeviceId(String deviceId) { | |
| 86 | + this.deviceId = deviceId; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public Long getTimestamp() { | |
| 90 | + return timestamp; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public void setTimestamp(Long timestamp) { | |
| 94 | + this.timestamp = timestamp; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public Short getOperCode() { | |
| 98 | + return operCode; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public void setOperCode(Short operCode) { | |
| 102 | + this.operCode = operCode; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public DirectiveC0Data getData() { | |
| 106 | + return data; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public void setData(DirectiveC0Data data) { | |
| 110 | + this.data = data; | |
| 111 | + } | |
| 112 | +} | ... | ... |
src/main/java/com/bsth/vehicle/directive/entity/DispatchInstruct.java deleted
100644 → 0
| 1 | -package com.bsth.vehicle.directive.entity; | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * | |
| 5 | - * @ClassName: DispatchInstruct | |
| 6 | - * @Description: TODO(调度指令类型) | |
| 7 | - * @author PanZhao | |
| 8 | - * @date 2016年6月7日 下午2:15:10 | |
| 9 | - * | |
| 10 | - */ | |
| 11 | -public enum DispatchInstruct { | |
| 12 | - /** | |
| 13 | - * 信息短语 | |
| 14 | - */ | |
| 15 | - PHRASE((byte) 0x00), | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * 取消上次指令+调度指令(闹钟有效) | |
| 19 | - */ | |
| 20 | - CANCEL_AND_CLOCK_ON((byte) 0x01), | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 调度指令(闹钟有效) | |
| 24 | - */ | |
| 25 | - DISPATCH_CLOCK_ON((byte) 0x02), | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 运营状态指令(闹钟无效) | |
| 29 | - */ | |
| 30 | - OPERATE_CLOCK_OFF((byte) 0x03), | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 其他 | |
| 34 | - */ | |
| 35 | - OTHER((byte) 0x04); | |
| 36 | - | |
| 37 | - private final byte value; | |
| 38 | - | |
| 39 | - DispatchInstruct(byte value) { | |
| 40 | - this.value = value; | |
| 41 | - } | |
| 42 | - | |
| 43 | - public byte getValue() { | |
| 44 | - return value; | |
| 45 | - } | |
| 46 | -} |
src/main/java/com/bsth/vehicle/directive/repository/DirectiveRepository.java renamed to src/main/java/com/bsth/vehicle/directive/repository/Directive60Repository.java
| ... | ... | @@ -3,9 +3,9 @@ package com.bsth.vehicle.directive.repository; |
| 3 | 3 | import org.springframework.stereotype.Repository; |
| 4 | 4 | |
| 5 | 5 | import com.bsth.repository.BaseRepository; |
| 6 | -import com.bsth.vehicle.directive.entity.Directive; | |
| 6 | +import com.bsth.vehicle.directive.entity.Directive60; | |
| 7 | 7 | |
| 8 | 8 | @Repository |
| 9 | -public interface DirectiveRepository extends BaseRepository<Directive, Integer>{ | |
| 9 | +public interface Directive60Repository extends BaseRepository<Directive60, Integer>{ | |
| 10 | 10 | |
| 11 | 11 | } | ... | ... |
src/main/java/com/bsth/vehicle/directive/repository/Directive80Repository.java
0 → 100644
| 1 | +package com.bsth.vehicle.directive.repository; | |
| 2 | + | |
| 3 | +import org.springframework.data.domain.Page; | |
| 4 | +import org.springframework.data.domain.Pageable; | |
| 5 | +import org.springframework.data.jpa.domain.Specification; | |
| 6 | +import org.springframework.data.jpa.repository.EntityGraph; | |
| 7 | +import org.springframework.stereotype.Repository; | |
| 8 | + | |
| 9 | +import com.bsth.repository.BaseRepository; | |
| 10 | +import com.bsth.vehicle.directive.entity.Directive80; | |
| 11 | + | |
| 12 | +@Repository | |
| 13 | +public interface Directive80Repository extends BaseRepository<Directive80, Integer>{ | |
| 14 | + | |
| 15 | + @EntityGraph(value = "directive80_c0", type = EntityGraph.EntityGraphType.FETCH) | |
| 16 | + @Override | |
| 17 | + Page<Directive80> findAll(Specification<Directive80> spec, Pageable pageable); | |
| 18 | +} | ... | ... |
src/main/java/com/bsth/vehicle/directive/repository/DriverReportRepository.java renamed to src/main/java/com/bsth/vehicle/directive/repository/DirectiveC0Repository.java
| ... | ... | @@ -3,9 +3,9 @@ package com.bsth.vehicle.directive.repository; |
| 3 | 3 | import org.springframework.stereotype.Repository; |
| 4 | 4 | |
| 5 | 5 | import com.bsth.repository.BaseRepository; |
| 6 | -import com.bsth.vehicle.directive.entity.DriverReport; | |
| 6 | +import com.bsth.vehicle.directive.entity.DirectiveC0; | |
| 7 | 7 | |
| 8 | 8 | @Repository |
| 9 | -public interface DriverReportRepository extends BaseRepository<DriverReport, Integer>{ | |
| 9 | +public interface DirectiveC0Repository extends BaseRepository<DirectiveC0, Integer>{ | |
| 10 | 10 | |
| 11 | 11 | } | ... | ... |
src/main/java/com/bsth/vehicle/directive/service/DirectiveService.java
| ... | ... | @@ -3,9 +3,9 @@ package com.bsth.vehicle.directive.service; |
| 3 | 3 | |
| 4 | 4 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 5 | 5 | import com.bsth.service.BaseService; |
| 6 | -import com.bsth.vehicle.directive.entity.Directive; | |
| 6 | +import com.bsth.vehicle.directive.entity.Directive60; | |
| 7 | 7 | |
| 8 | -public interface DirectiveService extends BaseService<Directive, Integer>{ | |
| 8 | +public interface DirectiveService extends BaseService<Directive60, Integer>{ | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * |
| ... | ... | @@ -28,6 +28,15 @@ public interface DirectiveService extends BaseService<Directive, Integer>{ |
| 28 | 28 | */ |
| 29 | 29 | int send60Dispatch(ScheduleRealInfo sch, int finish); |
| 30 | 30 | |
| 31 | + /** | |
| 32 | + * | |
| 33 | + * @Title: send60Dispatch | |
| 34 | + * @Description: TODO(调度指令下发) | |
| 35 | + * @param @param id 班次ID | |
| 36 | + * @throws | |
| 37 | + */ | |
| 38 | + int send60Dispatch(Long id); | |
| 39 | + | |
| 31 | 40 | //60营运指令 |
| 32 | 41 | int send60Operation(String nbbm, int state, int upDown); |
| 33 | 42 | |
| ... | ... | @@ -40,4 +49,14 @@ public interface DirectiveService extends BaseService<Directive, Integer>{ |
| 40 | 49 | * @throws |
| 41 | 50 | */ |
| 42 | 51 | int lineChange(String nbbm, Integer lineId); |
| 52 | + | |
| 53 | + /** | |
| 54 | + * | |
| 55 | + * @Title: upDownChange | |
| 56 | + * @Description: TODO(切换上下行) | |
| 57 | + * @param @param nbbm 车辆内部编码 | |
| 58 | + * @param @param upDonw 上下行 0 上行 1 下行 | |
| 59 | + * @throws | |
| 60 | + */ | |
| 61 | + int upDownChange(String nbbm, Integer upDown); | |
| 43 | 62 | } | ... | ... |
src/main/java/com/bsth/vehicle/directive/service/DirectiveServiceImpl.java
| 1 | 1 | package com.bsth.vehicle.directive.service; |
| 2 | 2 | |
| 3 | -import java.io.IOException; | |
| 4 | 3 | import java.text.SimpleDateFormat; |
| 5 | 4 | import java.util.Date; |
| 5 | +import java.util.HashMap; | |
| 6 | +import java.util.Map; | |
| 6 | 7 | |
| 7 | -import org.apache.http.client.methods.CloseableHttpResponse; | |
| 8 | -import org.apache.http.client.methods.HttpPost; | |
| 9 | -import org.apache.http.entity.StringEntity; | |
| 10 | -import org.apache.http.impl.client.CloseableHttpClient; | |
| 11 | -import org.apache.http.impl.client.HttpClients; | |
| 12 | -import org.apache.http.util.EntityUtils; | |
| 13 | 8 | import org.slf4j.Logger; |
| 14 | 9 | import org.slf4j.LoggerFactory; |
| 15 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -19,27 +14,29 @@ import com.alibaba.fastjson.JSON; |
| 19 | 14 | import com.alibaba.fastjson.JSONObject; |
| 20 | 15 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 21 | 16 | import com.bsth.service.impl.BaseServiceImpl; |
| 17 | +import com.bsth.service.realcontrol.buffer.ScheduleBuffer; | |
| 22 | 18 | import com.bsth.vehicle.common.CommonMapped; |
| 23 | 19 | import com.bsth.vehicle.directive.Consts; |
| 24 | 20 | import com.bsth.vehicle.directive.MsgIdGenerator; |
| 25 | 21 | import com.bsth.vehicle.directive.buffer.DirectiveBuffer; |
| 26 | -import com.bsth.vehicle.directive.entity.Directive; | |
| 27 | -import com.bsth.vehicle.directive.entity.Directive.DirectiveData; | |
| 28 | -import com.bsth.vehicle.directive.entity.DispatchInstruct; | |
| 22 | +import com.bsth.vehicle.directive.entity.Directive60; | |
| 23 | +import com.bsth.vehicle.directive.entity.Directive60.DirectiveData; | |
| 29 | 24 | import com.bsth.vehicle.directive.entity.LineChange; |
| 30 | 25 | import com.bsth.vehicle.directive.entity.LineChange.LineChangeData; |
| 31 | -import com.bsth.vehicle.directive.repository.DirectiveRepository; | |
| 26 | +import com.bsth.vehicle.directive.repository.Directive60Repository; | |
| 32 | 27 | import com.bsth.vehicle.directive.repository.LineChangeRepository; |
| 28 | +import com.bsth.vehicle.directive.util.HttpUtils; | |
| 33 | 29 | import com.bsth.vehicle.gpsdata.buffer.GpsRealDataBuffer; |
| 34 | 30 | import com.bsth.vehicle.gpsdata.entity.GpsRealData; |
| 31 | +import com.bsth.websocket.handler.RealControlSocketHandler; | |
| 35 | 32 | |
| 36 | 33 | @Service |
| 37 | -public class DirectiveServiceImpl extends BaseServiceImpl<Directive, Integer> implements DirectiveService{ | |
| 34 | +public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> implements DirectiveService{ | |
| 38 | 35 | |
| 39 | 36 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 40 | 37 | |
| 41 | 38 | @Autowired |
| 42 | - DirectiveRepository directiveRepository; | |
| 39 | + Directive60Repository directiveRepository; | |
| 43 | 40 | |
| 44 | 41 | @Autowired |
| 45 | 42 | GpsRealDataBuffer gpsRealDataBuffer; |
| ... | ... | @@ -47,15 +44,21 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive, Integer> im |
| 47 | 44 | @Autowired |
| 48 | 45 | LineChangeRepository lineChangeRepository; |
| 49 | 46 | |
| 47 | + @Autowired | |
| 48 | + RealControlSocketHandler socketHandler; | |
| 49 | + | |
| 50 | 50 | SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH点mm分"); |
| 51 | 51 | |
| 52 | - static Long schDiff = 1000 * 60 * 6L; | |
| 52 | + static Long schDiff = 1000 * 60 * 30L; | |
| 53 | + | |
| 54 | + //城市代码 | |
| 55 | + static final short cityCode = 22; | |
| 53 | 56 | |
| 54 | 57 | @Override |
| 55 | 58 | public int send60Phrase(String nbbm, String text) { |
| 56 | - Directive directive = null; | |
| 59 | + Directive60 directive = null; | |
| 57 | 60 | try { |
| 58 | - directive = create60Data(nbbm, text, DispatchInstruct.PHRASE); | |
| 61 | + directive = create60Data(nbbm, text, (short)0x00, null); | |
| 59 | 62 | } catch (Exception e) { |
| 60 | 63 | logger.error("发送消息短语出现异常", e); |
| 61 | 64 | return -1; |
| ... | ... | @@ -65,7 +68,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive, Integer> im |
| 65 | 68 | return -1; |
| 66 | 69 | |
| 67 | 70 | //发送指令 |
| 68 | - int code = postJson(JSON.toJSONString(directive)); | |
| 71 | + int code = HttpUtils.postJson(JSON.toJSONString(directive)); | |
| 69 | 72 | |
| 70 | 73 | if(code == 0){ |
| 71 | 74 | //添加到缓存,等待入库 |
| ... | ... | @@ -78,18 +81,18 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive, Integer> im |
| 78 | 81 | |
| 79 | 82 | @Override |
| 80 | 83 | public int send60Dispatch(ScheduleRealInfo sch, int finish) { |
| 81 | - Directive directive = null; | |
| 84 | + Directive60 directive = null; | |
| 82 | 85 | try { |
| 83 | 86 | //如果发车时间距当前时间较远,则不发送 |
| 84 | - if(Math.abs(sch.getFcsjT() - System.currentTimeMillis()) > schDiff){ | |
| 87 | + /*if(Math.abs(sch.getFcsjT() - System.currentTimeMillis()) > schDiff){ | |
| 85 | 88 | return 0; |
| 86 | - } | |
| 89 | + }*/ | |
| 87 | 90 | |
| 88 | 91 | String text = "已完成" + finish + "个班次,下一发车时间" + sdfHHmm.format(new Date(sch.getFcsjT())) |
| 89 | 92 | + ",由" + sch.getQdzName() + "发往" + sch.getZdzName(); |
| 90 | 93 | |
| 91 | 94 | //目前使用短语协议下发调度指令 |
| 92 | - directive = create60Data(sch.getClZbh(), text, DispatchInstruct.PHRASE); | |
| 95 | + directive = create60Data(sch.getClZbh(), text, (short)0x00, sch); | |
| 93 | 96 | } catch (Exception e) { |
| 94 | 97 | logger.error("生成调度指令时出现异常", e); |
| 95 | 98 | return -1; |
| ... | ... | @@ -99,7 +102,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive, Integer> im |
| 99 | 102 | return -1; |
| 100 | 103 | |
| 101 | 104 | //发送指令 |
| 102 | - int code = postJson(JSON.toJSONString(directive)); | |
| 105 | + int code = HttpUtils.postJson(JSON.toJSONString(directive)); | |
| 103 | 106 | |
| 104 | 107 | if(code == 0){ |
| 105 | 108 | sch.setDirectiveState(60); |
| ... | ... | @@ -107,12 +110,37 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive, Integer> im |
| 107 | 110 | directive.setDispatch(true); |
| 108 | 111 | directive.setSch(sch); |
| 109 | 112 | DirectiveBuffer.put(directive); |
| 113 | + | |
| 114 | + //通知页面,消息已发出 | |
| 115 | + sendDirectiveState(sch); | |
| 110 | 116 | }else{ |
| 111 | 117 | logger.error("send60Phrase error, code: " + code); |
| 112 | 118 | } |
| 113 | 119 | return code; |
| 114 | 120 | } |
| 121 | + | |
| 122 | + /** | |
| 123 | + * | |
| 124 | + * @Title: sendDirectiveState | |
| 125 | + * @Description: TODO(向页面推送班次指令状态) | |
| 126 | + * @throws | |
| 127 | + */ | |
| 128 | + public void sendDirectiveState(ScheduleRealInfo sch){ | |
| 129 | + JSONObject json = new JSONObject(); | |
| 130 | + json.put("fn", "directive"); | |
| 131 | + json.put("t", sch); | |
| 132 | + socketHandler.sendMessageToLine(Integer.parseInt(sch.getXlBm()), json.toJSONString()); | |
| 133 | + } | |
| 115 | 134 | |
| 135 | + | |
| 136 | + @Override | |
| 137 | + public int send60Dispatch(Long id) { | |
| 138 | + ScheduleRealInfo sch = ScheduleBuffer.findOne(id); | |
| 139 | + //车辆已完成班次 | |
| 140 | + int finish = ScheduleBuffer.getFinishSchNo(sch.getClZbh()); | |
| 141 | + return send60Dispatch(sch, finish); | |
| 142 | + } | |
| 143 | + | |
| 116 | 144 | @Override |
| 117 | 145 | public int send60Operation(String nbbm, int state, int upDown) { |
| 118 | 146 | return 0; |
| ... | ... | @@ -128,8 +156,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive, Integer> im |
| 128 | 156 | |
| 129 | 157 | LineChange change = new LineChange(); |
| 130 | 158 | LineChangeData data = new LineChangeData(); |
| 131 | - //暂时写死,没什么用 | |
| 132 | - data.setCityCode((short) 22); | |
| 159 | + data.setCityCode(cityCode); | |
| 133 | 160 | data.setDeviceId(deviceId); |
| 134 | 161 | data.setLineId(String.valueOf(lineId)); |
| 135 | 162 | |
| ... | ... | @@ -138,11 +165,13 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive, Integer> im |
| 138 | 165 | change.setTimestamp(t); |
| 139 | 166 | change.setData(data); |
| 140 | 167 | |
| 141 | - int code = postJson(JSON.toJSONString(change)); | |
| 168 | + int code = HttpUtils.postJson(JSON.toJSONString(change)); | |
| 142 | 169 | if(code == 0){ |
| 143 | 170 | //入库 |
| 144 | 171 | lineChangeRepository.save(change); |
| 145 | 172 | DirectiveBuffer.changeMap.put(deviceId + '_' + t , change); |
| 173 | + //通知设备刷新线路文件,忽略结果 | |
| 174 | + HttpUtils.postJson(createDeviceRefreshData(deviceId, lineId)); | |
| 146 | 175 | }else{ |
| 147 | 176 | logger.error("send60Phrase error, code: " + code); |
| 148 | 177 | } |
| ... | ... | @@ -150,28 +179,39 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive, Integer> im |
| 150 | 179 | } |
| 151 | 180 | |
| 152 | 181 | |
| 153 | - public Directive create60Data(String nbbm, String text, DispatchInstruct dispatchInstruct){ | |
| 182 | + public Directive60 create60Data(String nbbm, String text, Short dispatchInstruct, ScheduleRealInfo sch){ | |
| 154 | 183 | Long timestamp = System.currentTimeMillis(); |
| 155 | 184 | |
| 156 | - //向测试设备发送 | |
| 185 | + /*//向测试设备发送 | |
| 157 | 186 | String deviceId = "ABCDFEGH"; |
| 158 | - Short company = 5; | |
| 187 | + Short company = 5;*/ | |
| 159 | 188 | |
| 160 | - /*String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); | |
| 189 | + String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); | |
| 161 | 190 | Short company = Short.parseShort(CommonMapped.vehicCompanyMap.get(nbbm)); |
| 162 | 191 | if(null == deviceId){ |
| 163 | 192 | logger.error("没有设备号对照的车辆:" + nbbm); |
| 164 | 193 | return null; |
| 165 | - }*/ | |
| 166 | - GpsRealData gpsData = gpsRealDataBuffer.findOneByDeviceId(deviceId); | |
| 167 | - if(null == gpsData){ | |
| 168 | - logger.error("没有找到gps对照,无法确认营运状态和上下行:" + nbbm); | |
| 169 | - return null; | |
| 194 | + } | |
| 195 | + //上下行和营运状态 | |
| 196 | + Integer upDown = null, state = null; | |
| 197 | + if(null == sch){ | |
| 198 | + GpsRealData gpsData = gpsRealDataBuffer.findOneByDeviceId(deviceId); | |
| 199 | + if(null == gpsData){ | |
| 200 | + logger.error("没有找到gps对照,无法确认营运状态和上下行:" + nbbm); | |
| 201 | + return null; | |
| 202 | + } | |
| 203 | + upDown = gpsData.getUpDown(); | |
| 204 | + state = gpsData.getState(); | |
| 205 | + } | |
| 206 | + else{ | |
| 207 | + upDown = Integer.parseInt(sch.getXlDir()); | |
| 208 | + state = 0; | |
| 170 | 209 | } |
| 171 | 210 | |
| 211 | + | |
| 172 | 212 | int msgId = MsgIdGenerator.getMsgId(); |
| 173 | 213 | |
| 174 | - Directive directive = new Directive(); | |
| 214 | + Directive60 directive = new Directive60(); | |
| 175 | 215 | DirectiveData data = new DirectiveData(); |
| 176 | 216 | //一级协议 |
| 177 | 217 | directive.setOperCode((short) 0x60); |
| ... | ... | @@ -189,7 +229,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive, Integer> im |
| 189 | 229 | directive.setData(data); |
| 190 | 230 | long serviceState; |
| 191 | 231 | try{ |
| 192 | - serviceState = Consts.SERVICE_STATE[gpsData.getUpDown()][gpsData.getState()]; | |
| 232 | + serviceState = Consts.SERVICE_STATE[upDown][state]; | |
| 193 | 233 | }catch(IndexOutOfBoundsException e){ |
| 194 | 234 | //未知营运状态的直接默认为上行非营运 |
| 195 | 235 | serviceState = Consts.SERVICE_STATE[0][1]; |
| ... | ... | @@ -200,33 +240,76 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive, Integer> im |
| 200 | 240 | return directive; |
| 201 | 241 | } |
| 202 | 242 | |
| 203 | - public int postJson(String jsonStr){ | |
| 204 | - CloseableHttpClient httpClient = null; | |
| 205 | - int code = -1; | |
| 243 | + @Override | |
| 244 | + public int upDownChange(String nbbm, Integer upDown) { | |
| 245 | + //构造数据 | |
| 246 | + String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); | |
| 247 | + Short company = Short.parseShort(CommonMapped.vehicCompanyMap.get(nbbm)); | |
| 248 | + Long timestamp = System.currentTimeMillis(); | |
| 249 | + int msgId = MsgIdGenerator.getMsgId(); | |
| 250 | + Directive60 directive = new Directive60(); | |
| 251 | + DirectiveData data = new DirectiveData(); | |
| 252 | + //一级协议 | |
| 253 | + directive.setOperCode((short) 0x60); | |
| 254 | + //设备号 | |
| 255 | + directive.setDeviceId(deviceId); | |
| 256 | + //时间戳 | |
| 257 | + directive.setTimestamp(timestamp); | |
| 258 | + directive.setMsgId(msgId); | |
| 259 | + //构造数据 | |
| 260 | + data.setDeviceId(deviceId); | |
| 261 | + data.setDispatchInstruct((short)0x03); | |
| 262 | + data.setTimestamp(timestamp); | |
| 263 | + data.setCompanyCode(company); | |
| 264 | + data.setMsgId(msgId); | |
| 265 | + data.setTxtContent(nbbm + "_" + upDown); | |
| 266 | + directive.setData(data); | |
| 267 | + | |
| 268 | + long serviceState; | |
| 206 | 269 | try{ |
| 207 | - httpClient = HttpClients.createDefault(); | |
| 208 | - | |
| 209 | - HttpPost post = new HttpPost(Consts.SEND_DIRECTIVE_URL); | |
| 210 | - | |
| 211 | - post.setEntity(new StringEntity(jsonStr, "utf-8")); | |
| 270 | + serviceState = Consts.SERVICE_STATE[upDown][0]; | |
| 271 | + }catch(IndexOutOfBoundsException e){ | |
| 272 | + logger.error("upDonw: " + upDown, e); | |
| 273 | + return -1; | |
| 274 | + } | |
| 275 | + data.setServiceState(serviceState); | |
| 212 | 276 | |
| 213 | - CloseableHttpResponse response = httpClient.execute(post); | |
| 214 | - | |
| 215 | - JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity())); | |
| 216 | - if(null != json && json.getInteger("errCode") == 0) | |
| 217 | - code = 0; | |
| 218 | - else | |
| 219 | - logger.error("和网关http通讯失败,rs: " + json); | |
| 220 | - }catch(Exception e){ | |
| 221 | - logger.error("", e); | |
| 222 | - }finally { | |
| 223 | - try { | |
| 224 | - if(httpClient != null) | |
| 225 | - httpClient.close(); | |
| 226 | - } catch (IOException e) { | |
| 227 | - logger.error("", e); | |
| 228 | - } | |
| 277 | + int code = HttpUtils.postJson(JSON.toJSONString(directive)); | |
| 278 | + if(code == 0){ | |
| 279 | + //添加到缓存,等待入库 | |
| 280 | + DirectiveBuffer.put(directive); | |
| 281 | + }else{ | |
| 282 | + logger.error("send60 upDownChange error, code: " + code); | |
| 229 | 283 | } |
| 230 | - return code; | |
| 284 | + return 0; | |
| 285 | + } | |
| 286 | + | |
| 287 | + /** | |
| 288 | + * | |
| 289 | + * @Title: createDeviceRefreshData | |
| 290 | + * @Description: TODO(生成设备线路刷新数据包) | |
| 291 | + * @param @return 设定文件 | |
| 292 | + * @return String 返回类型 | |
| 293 | + * @throws | |
| 294 | + */ | |
| 295 | + public String createDeviceRefreshData(String deviceId, Integer lineId){ | |
| 296 | + Long t = System.currentTimeMillis(); | |
| 297 | + Map<String, Object> param = new HashMap<String, Object>(); | |
| 298 | + param.put("deviceId", deviceId); | |
| 299 | + param.put("timestamp", t); | |
| 300 | + param.put("operCode", 0Xc0); | |
| 301 | + | |
| 302 | + Map<String, Object> data = new HashMap<String, Object>(); | |
| 303 | + data.put("operCode", 0xa1); | |
| 304 | + data.put("cityCode", cityCode); | |
| 305 | + data.put("deviceId", deviceId); | |
| 306 | + data.put("timestamp", t); | |
| 307 | + data.put("centerId", 1); | |
| 308 | + data.put("lineId", lineId); | |
| 309 | + data.put("lineVersion", 0); | |
| 310 | + data.put("carparkDataVersion", 0); | |
| 311 | + param.put("data", data); | |
| 312 | + | |
| 313 | + return JSON.toJSONString(param); | |
| 231 | 314 | } |
| 232 | 315 | } | ... | ... |
src/main/java/com/bsth/vehicle/directive/DirectivePersistenceThread.java renamed to src/main/java/com/bsth/vehicle/directive/thread/DirectivePersistenceThread.java
| 1 | -package com.bsth.vehicle.directive; | |
| 1 | +package com.bsth.vehicle.directive.thread; | |
| 2 | 2 | |
| 3 | 3 | import java.util.LinkedList; |
| 4 | 4 | |
| ... | ... | @@ -8,8 +8,8 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 8 | import org.springframework.stereotype.Component; |
| 9 | 9 | |
| 10 | 10 | import com.bsth.vehicle.directive.buffer.DirectiveBuffer; |
| 11 | -import com.bsth.vehicle.directive.entity.Directive; | |
| 12 | -import com.bsth.vehicle.directive.repository.DirectiveRepository; | |
| 11 | +import com.bsth.vehicle.directive.entity.Directive60; | |
| 12 | +import com.bsth.vehicle.directive.repository.Directive60Repository; | |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * |
| ... | ... | @@ -23,15 +23,15 @@ import com.bsth.vehicle.directive.repository.DirectiveRepository; |
| 23 | 23 | public class DirectivePersistenceThread extends Thread{ |
| 24 | 24 | |
| 25 | 25 | @Autowired |
| 26 | - DirectiveRepository directiveRepository; | |
| 26 | + Directive60Repository directiveRepository; | |
| 27 | 27 | |
| 28 | 28 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 29 | 29 | |
| 30 | 30 | @Override |
| 31 | 31 | public void run() { |
| 32 | - LinkedList<Directive> list = DirectiveBuffer.transientList; | |
| 32 | + LinkedList<Directive60> list = DirectiveBuffer.transientList; | |
| 33 | 33 | |
| 34 | - Directive directive; | |
| 34 | + Directive60 directive; | |
| 35 | 35 | for(int i = 0; i < 1000; i ++){ |
| 36 | 36 | directive = list.poll(); |
| 37 | 37 | ... | ... |
src/main/java/com/bsth/vehicle/directive/FirstScheduleIssuedThread.java renamed to src/main/java/com/bsth/vehicle/directive/thread/FirstScheduleIssuedThread.java
src/main/java/com/bsth/vehicle/directive/thread/RevertLineThread.java
0 → 100644
| 1 | +package com.bsth.vehicle.directive.thread; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 6 | +import org.springframework.stereotype.Component; | |
| 7 | + | |
| 8 | +import com.bsth.entity.realcontrol.DeviceRevertLine; | |
| 9 | +import com.bsth.repository.realcontrol.DeviceRevertLineRepository; | |
| 10 | +import com.bsth.vehicle.directive.service.DirectiveService; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * | |
| 14 | + * @ClassName: DeviceRevertLineThread | |
| 15 | + * @Description: TODO(设备线路还原线程, 将借出的车还原到原线路) | |
| 16 | + * @author PanZhao | |
| 17 | + * @date 2016年7月7日 上午11:30:38 | |
| 18 | + * | |
| 19 | + */ | |
| 20 | +@Component | |
| 21 | +public class RevertLineThread extends Thread{ | |
| 22 | + | |
| 23 | + @Autowired | |
| 24 | + DeviceRevertLineRepository deviceRevertLineRepository; | |
| 25 | + | |
| 26 | + @Autowired | |
| 27 | + DirectiveService directiveService; | |
| 28 | + | |
| 29 | + @Override | |
| 30 | + public void run() { | |
| 31 | + Long et = System.currentTimeMillis() | |
| 32 | + ,st = et - (1000 * 60 * 5); | |
| 33 | + | |
| 34 | + List<DeviceRevertLine> list = deviceRevertLineRepository.findByDateAndStatus(st, et, 0); | |
| 35 | + | |
| 36 | + if(list.size() == 0) | |
| 37 | + return; | |
| 38 | + | |
| 39 | + int code; | |
| 40 | + for(DeviceRevertLine revertLine : list){ | |
| 41 | + //还车 | |
| 42 | + code = directiveService.lineChange(revertLine.getNbbm(), Integer.parseInt(revertLine.getRevertLine())); | |
| 43 | + | |
| 44 | + if(code == 0){ | |
| 45 | + //改变状态 | |
| 46 | + revertLine.setStatus(1); | |
| 47 | + deviceRevertLineRepository.save(revertLine); | |
| 48 | + } | |
| 49 | + } | |
| 50 | + } | |
| 51 | +} | ... | ... |
src/main/java/com/bsth/vehicle/directive/util/HttpUtils.java
0 → 100644
| 1 | +package com.bsth.vehicle.directive.util; | |
| 2 | + | |
| 3 | +import java.io.IOException; | |
| 4 | + | |
| 5 | +import org.apache.http.client.methods.CloseableHttpResponse; | |
| 6 | +import org.apache.http.client.methods.HttpPost; | |
| 7 | +import org.apache.http.entity.StringEntity; | |
| 8 | +import org.apache.http.impl.client.CloseableHttpClient; | |
| 9 | +import org.apache.http.impl.client.HttpClients; | |
| 10 | +import org.apache.http.util.EntityUtils; | |
| 11 | +import org.slf4j.Logger; | |
| 12 | +import org.slf4j.LoggerFactory; | |
| 13 | + | |
| 14 | +import com.alibaba.fastjson.JSONObject; | |
| 15 | +import com.bsth.vehicle.directive.Consts; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * | |
| 19 | + * @ClassName: HttpUtils | |
| 20 | + * @Description: TODO(和网关HTTP通讯工具类) | |
| 21 | + * @author PanZhao | |
| 22 | + * @date 2016年7月8日 上午10:38:10 | |
| 23 | + * | |
| 24 | + */ | |
| 25 | +public class HttpUtils { | |
| 26 | + | |
| 27 | + static Logger logger = LoggerFactory.getLogger(HttpUtils.class); | |
| 28 | + | |
| 29 | + public static int postJson(String jsonStr){ | |
| 30 | + logger.info("send : " + jsonStr); | |
| 31 | + | |
| 32 | + CloseableHttpClient httpClient = null; | |
| 33 | + int code = -1; | |
| 34 | + try{ | |
| 35 | + httpClient = HttpClients.createDefault(); | |
| 36 | + | |
| 37 | + HttpPost post = new HttpPost(Consts.SEND_DIRECTIVE_URL); | |
| 38 | + | |
| 39 | + post.setEntity(new StringEntity(jsonStr, "utf-8")); | |
| 40 | + | |
| 41 | + CloseableHttpResponse response = httpClient.execute(post); | |
| 42 | + | |
| 43 | + JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity())); | |
| 44 | + if(null != json && json.getInteger("errCode") == 0) | |
| 45 | + code = 0; | |
| 46 | + else | |
| 47 | + logger.error("和网关http通讯失败,rs: " + json); | |
| 48 | + }catch(Exception e){ | |
| 49 | + logger.error("", e); | |
| 50 | + }finally { | |
| 51 | + try { | |
| 52 | + if(httpClient != null) | |
| 53 | + httpClient.close(); | |
| 54 | + } catch (IOException e) { | |
| 55 | + logger.error("", e); | |
| 56 | + } | |
| 57 | + } | |
| 58 | + return code; | |
| 59 | + } | |
| 60 | +} | ... | ... |
src/main/java/com/bsth/vehicle/gpsdata/GpsArrivalStationThread.java
| ... | ... | @@ -7,6 +7,7 @@ import java.text.ParseException; |
| 7 | 7 | import java.text.SimpleDateFormat; |
| 8 | 8 | import java.util.ArrayList; |
| 9 | 9 | import java.util.Calendar; |
| 10 | +import java.util.Date; | |
| 10 | 11 | import java.util.Iterator; |
| 11 | 12 | import java.util.List; |
| 12 | 13 | import java.util.Set; |
| ... | ... | @@ -16,6 +17,7 @@ import org.slf4j.LoggerFactory; |
| 16 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | 18 | import org.springframework.stereotype.Component; |
| 18 | 19 | |
| 20 | +import com.alibaba.fastjson.JSONObject; | |
| 19 | 21 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 20 | 22 | import com.bsth.service.realcontrol.buffer.ScheduleBuffer; |
| 21 | 23 | import com.bsth.util.DateUtils; |
| ... | ... | @@ -23,6 +25,7 @@ import com.bsth.util.db.DBUtils_MS; |
| 23 | 25 | import com.bsth.vehicle.directive.service.DirectiveService; |
| 24 | 26 | import com.bsth.vehicle.gpsdata.buffer.GpsArrivalDataBuffer; |
| 25 | 27 | import com.bsth.vehicle.gpsdata.entity.ArrivalInfo; |
| 28 | +import com.bsth.websocket.handler.RealControlSocketHandler; | |
| 26 | 29 | |
| 27 | 30 | /** |
| 28 | 31 | * |
| ... | ... | @@ -41,6 +44,9 @@ public class GpsArrivalStationThread extends Thread{ |
| 41 | 44 | @Autowired |
| 42 | 45 | DirectiveService directiveService; |
| 43 | 46 | |
| 47 | + @Autowired | |
| 48 | + RealControlSocketHandler socketHandler; | |
| 49 | + | |
| 44 | 50 | private static int diff = 1000 * 60 * 20; |
| 45 | 51 | |
| 46 | 52 | @Override |
| ... | ... | @@ -93,7 +99,7 @@ public class GpsArrivalStationThread extends Thread{ |
| 93 | 99 | //匹配起点 |
| 94 | 100 | matchStart(scInfo, arr); |
| 95 | 101 | |
| 96 | - //计划终点 | |
| 102 | + //匹配终点 | |
| 97 | 103 | matchEnd(scInfo, arr); |
| 98 | 104 | }catch(Exception e){ |
| 99 | 105 | e.printStackTrace(); |
| ... | ... | @@ -123,10 +129,26 @@ public class GpsArrivalStationThread extends Thread{ |
| 123 | 129 | //班次状态改为正在执行 |
| 124 | 130 | scInfo.setStatus(1); |
| 125 | 131 | ScheduleBuffer.persistentList.add(scInfo); |
| 132 | + //推送到页面 | |
| 133 | + sendFcsj(scInfo); | |
| 126 | 134 | } |
| 127 | 135 | } |
| 128 | 136 | |
| 129 | 137 | /** |
| 138 | + * @Title: sendFcsj | |
| 139 | + * @Description: TODO(推送发车信息) | |
| 140 | + * @param @param schedule 班次 | |
| 141 | + * @throws | |
| 142 | + */ | |
| 143 | + public void sendFcsj(ScheduleRealInfo schedule){ | |
| 144 | + JSONObject json = new JSONObject(); | |
| 145 | + json.put("fn", "faChe"); | |
| 146 | + json.put("t", schedule); | |
| 147 | + json.put("dataStr", sdf.format(new Date())); | |
| 148 | + socketHandler.sendMessageToLine(Integer.parseInt(schedule.getXlBm()), json.toJSONString()); | |
| 149 | + } | |
| 150 | + | |
| 151 | + /** | |
| 130 | 152 | * |
| 131 | 153 | * @Title: matchEnd |
| 132 | 154 | * @Description: TODO(匹配终点 进站时间) |
| ... | ... | @@ -148,11 +170,31 @@ public class GpsArrivalStationThread extends Thread{ |
| 148 | 170 | //完成当前班次 |
| 149 | 171 | ScheduleRealInfo nextSch = ScheduleBuffer.finishSch(scInfo); |
| 150 | 172 | //到达终点,发送下一班次的调度指令 |
| 151 | - directiveService.send60Dispatch(nextSch, ScheduleBuffer.getFinishSchNo(nextSch.getClZbh())); | |
| 173 | + int finish = ScheduleBuffer.getFinishSchNo(nextSch.getClZbh()); | |
| 174 | + directiveService.send60Dispatch(nextSch, finish); | |
| 175 | + //推送到页面 | |
| 176 | + sendZdsj(scInfo, nextSch, finish); | |
| 152 | 177 | } |
| 153 | 178 | } |
| 154 | 179 | |
| 155 | 180 | /** |
| 181 | + * @Title: sendFcsj | |
| 182 | + * @Description: TODO(推送到达终点时间) | |
| 183 | + * @param @param schedule 班次 | |
| 184 | + * @throws | |
| 185 | + */ | |
| 186 | + public void sendZdsj(ScheduleRealInfo schedule,ScheduleRealInfo nextSch, int finish){ | |
| 187 | + JSONObject json = new JSONObject(); | |
| 188 | + json.put("fn", "zhongDian"); | |
| 189 | + json.put("t", schedule); | |
| 190 | + json.put("nt", nextSch); | |
| 191 | + json.put("finish", finish); | |
| 192 | + json.put("dataStr", sdf.format(new Date())); | |
| 193 | + | |
| 194 | + socketHandler.sendMessageToLine(Integer.parseInt(schedule.getXlBm()), json.toJSONString()); | |
| 195 | + } | |
| 196 | + | |
| 197 | + /** | |
| 156 | 198 | * @throws ParseException |
| 157 | 199 | * |
| 158 | 200 | * @Title: loadData |
| ... | ... | @@ -170,7 +212,7 @@ public class GpsArrivalStationThread extends Thread{ |
| 170 | 212 | GpsArrivalDataBuffer.markTime = DateUtils.getTimesmorning() * 1000L; |
| 171 | 213 | } |
| 172 | 214 | |
| 173 | - String sql = "select * from bsth_c_arrival_info where weeks_year=? and create_date > ?"; | |
| 215 | + String sql = "select * from bsth_c_arrival_info where weeks_year=? and create_date > ? order by ts"; | |
| 174 | 216 | |
| 175 | 217 | List<ArrivalInfo> list = new ArrayList<>(); |
| 176 | 218 | Connection conn = null; |
| ... | ... | @@ -179,8 +221,8 @@ public class GpsArrivalStationThread extends Thread{ |
| 179 | 221 | try { |
| 180 | 222 | conn = DBUtils_MS.getConnection(); |
| 181 | 223 | ps = conn.prepareStatement(sql); |
| 182 | - ps.setInt(1, weeks_year); | |
| 183 | - ps.setLong(2, /*GpsArrivalDataBuffer.markTime*/1467099600000L); | |
| 224 | + ps.setInt(1, /*weeks_year*/28); | |
| 225 | + ps.setLong(2, /*GpsArrivalDataBuffer.markTime*/1467853749000L); | |
| 184 | 226 | |
| 185 | 227 | Long t = System.currentTimeMillis(); |
| 186 | 228 | rs = ps.executeQuery(); |
| ... | ... | @@ -215,7 +257,7 @@ public class GpsArrivalStationThread extends Thread{ |
| 215 | 257 | Long t = System.currentTimeMillis(); |
| 216 | 258 | for(ScheduleRealInfo sch : allList){ |
| 217 | 259 | if(Math.abs(sch.getFcsjT() - t) < rang |
| 218 | - || Math.abs(sch.getZdsjT()) - t < rang){ | |
| 260 | + || (sch.getZdsjT() != null && Math.abs(sch.getZdsjT()) - t < rang)){ | |
| 219 | 261 | subList.add(sch); |
| 220 | 262 | } |
| 221 | 263 | } | ... | ... |
src/main/java/com/bsth/vehicle/gpsdata/buffer/GpsRealDataBuffer.java
src/main/java/com/bsth/websocket/WebSocketHandshakeInterceptor.java
0 → 100644
| 1 | +package com.bsth.websocket; | |
| 2 | + | |
| 3 | +import java.util.Map; | |
| 4 | + | |
| 5 | +import javax.servlet.http.HttpSession; | |
| 6 | + | |
| 7 | +import org.springframework.http.server.ServerHttpRequest; | |
| 8 | +import org.springframework.http.server.ServerHttpResponse; | |
| 9 | +import org.springframework.http.server.ServletServerHttpRequest; | |
| 10 | +import org.springframework.stereotype.Component; | |
| 11 | +import org.springframework.web.socket.WebSocketHandler; | |
| 12 | +import org.springframework.web.socket.server.HandshakeInterceptor; | |
| 13 | + | |
| 14 | +import com.bsth.common.Constants; | |
| 15 | + | |
| 16 | +@Component | |
| 17 | +public class WebSocketHandshakeInterceptor implements HandshakeInterceptor { | |
| 18 | + | |
| 19 | + @Override | |
| 20 | + public void afterHandshake(ServerHttpRequest request, | |
| 21 | + ServerHttpResponse arg1, WebSocketHandler arg2, Exception arg3) { | |
| 22 | + } | |
| 23 | + | |
| 24 | + @Override | |
| 25 | + public boolean beforeHandshake(ServerHttpRequest request, | |
| 26 | + ServerHttpResponse arg1, WebSocketHandler arg2, | |
| 27 | + Map<String, Object> attributes) throws Exception { | |
| 28 | + if (request instanceof ServletServerHttpRequest) { | |
| 29 | + ServletServerHttpRequest servletRequest = (ServletServerHttpRequest) request; | |
| 30 | + HttpSession session = servletRequest.getServletRequest() | |
| 31 | + .getSession(false); | |
| 32 | + if (session != null) { | |
| 33 | + // 使用SESSION_USERNAME区分WebSocketHandler,以便定向发送消息 | |
| 34 | + String userName = session.getAttribute(Constants.SESSION_USERNAME).toString(); | |
| 35 | + attributes.put(Constants.SESSION_USERNAME, userName); | |
| 36 | + } | |
| 37 | + } | |
| 38 | + return true; | |
| 39 | + } | |
| 40 | +} | ... | ... |
src/main/java/com/bsth/websocket/handler/RealControlSocketHandler.java
0 → 100644
| 1 | +package com.bsth.websocket.handler; | |
| 2 | + | |
| 3 | +import java.io.IOException; | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.Set; | |
| 6 | + | |
| 7 | +import org.springframework.stereotype.Component; | |
| 8 | +import org.springframework.web.socket.CloseStatus; | |
| 9 | +import org.springframework.web.socket.TextMessage; | |
| 10 | +import org.springframework.web.socket.WebSocketHandler; | |
| 11 | +import org.springframework.web.socket.WebSocketMessage; | |
| 12 | +import org.springframework.web.socket.WebSocketSession; | |
| 13 | + | |
| 14 | +import com.bsth.common.Constants; | |
| 15 | +import com.bsth.vehicle.common.CommonMapped; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * 驾驶员上报80指令推送 | |
| 19 | + * 注意:在sendMsg时,多线程状态下有几率出现连接状态脏读,建议 synchronized | |
| 20 | + * @author PanZhao | |
| 21 | + */ | |
| 22 | +@Component | |
| 23 | +public class RealControlSocketHandler implements WebSocketHandler { | |
| 24 | + | |
| 25 | + private static final ArrayList<WebSocketSession> users; | |
| 26 | + | |
| 27 | + static { | |
| 28 | + users = new ArrayList<WebSocketSession>(); | |
| 29 | + } | |
| 30 | + | |
| 31 | + @Override | |
| 32 | + public void afterConnectionClosed(WebSocketSession session, CloseStatus arg1) | |
| 33 | + throws Exception { | |
| 34 | + users.remove(session); | |
| 35 | + } | |
| 36 | + | |
| 37 | + @Override | |
| 38 | + public void afterConnectionEstablished(WebSocketSession session) | |
| 39 | + throws Exception { | |
| 40 | + users.add(session); | |
| 41 | + } | |
| 42 | + | |
| 43 | + @Override | |
| 44 | + public void handleMessage(WebSocketSession arg0, WebSocketMessage<?> arg1) | |
| 45 | + throws Exception { | |
| 46 | + } | |
| 47 | + | |
| 48 | + @Override | |
| 49 | + public void handleTransportError(WebSocketSession session, Throwable arg1) | |
| 50 | + throws Exception { | |
| 51 | + if(session.isOpen()){ | |
| 52 | + session.close(); | |
| 53 | + } | |
| 54 | + users.remove(session); | |
| 55 | + } | |
| 56 | + | |
| 57 | + @Override | |
| 58 | + public boolean supportsPartialMessages() { | |
| 59 | + return false; | |
| 60 | + } | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * 给所有在线用户发送消息 | |
| 64 | + * | |
| 65 | + * @param message | |
| 66 | + */ | |
| 67 | + public synchronized void sendMessageToUsers(TextMessage message) { | |
| 68 | + for (WebSocketSession user : users) { | |
| 69 | + try { | |
| 70 | + if (user.isOpen()) { | |
| 71 | + user.sendMessage(message); | |
| 72 | + } | |
| 73 | + } catch (IOException e) { | |
| 74 | + e.printStackTrace(); | |
| 75 | + } | |
| 76 | + } | |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 给某些用户发送消息 | |
| 81 | + * | |
| 82 | + * @param userId | |
| 83 | + * @param message | |
| 84 | + */ | |
| 85 | + public synchronized void sendMessageToUser(Set<String> uids, String msg) { | |
| 86 | + TextMessage message = new TextMessage(msg.getBytes()); | |
| 87 | + for (WebSocketSession user : users) { | |
| 88 | + if (uids.contains(user.getAttributes().get(Constants.SESSION_USERNAME))) { | |
| 89 | + try { | |
| 90 | + if (user.isOpen()) { | |
| 91 | + user.sendMessage(message); | |
| 92 | + } | |
| 93 | + } catch (IOException e) { | |
| 94 | + e.printStackTrace(); | |
| 95 | + } | |
| 96 | + } | |
| 97 | + } | |
| 98 | + } | |
| 99 | + | |
| 100 | + /** | |
| 101 | + * 根据线路推送消息 | |
| 102 | + * | |
| 103 | + * @param userId | |
| 104 | + * @param message | |
| 105 | + */ | |
| 106 | + public synchronized void sendMessageToLine(Integer lineCode, String msg) { | |
| 107 | + Set<String> uids = CommonMapped.lineUserMap.get(lineCode); | |
| 108 | + if(null == uids || uids.size() == 0) | |
| 109 | + return; | |
| 110 | + | |
| 111 | + TextMessage message = new TextMessage(msg.getBytes()); | |
| 112 | + for (WebSocketSession user : users) { | |
| 113 | + if (uids.contains(user.getAttributes().get(Constants.SESSION_USERNAME))) { | |
| 114 | + try { | |
| 115 | + if (user.isOpen()) { | |
| 116 | + user.sendMessage(message); | |
| 117 | + } | |
| 118 | + } catch (IOException e) { | |
| 119 | + e.printStackTrace(); | |
| 120 | + } | |
| 121 | + } | |
| 122 | + } | |
| 123 | + } | |
| 124 | +} | ... | ... |
src/main/resources/application.properties
| ... | ... | @@ -19,6 +19,12 @@ spring.datasource.max-idle=8 |
| 19 | 19 | spring.datasource.min-idle=8 |
| 20 | 20 | spring.datasource.initial-size=5 |
| 21 | 21 | |
| 22 | +spring.datasource.test-on-borrow=true | |
| 23 | +spring.datasource.test-on-connect=true | |
| 24 | +spring.datasource.test-on-return=true | |
| 25 | +spring.datasource.test-while-idle=true | |
| 26 | +spring.datasource.validation-query=select 1 | |
| 27 | + | |
| 22 | 28 | spring.view.suffix=.html |
| 23 | 29 | |
| 24 | 30 | server.session-timeout=-1 | ... | ... |
src/main/resources/fatso/start.js
src/main/resources/ftp.properties
0 → 100644
src/main/resources/static/assets/img/button_login.png
0 → 100644
2.61 KB
src/main/resources/static/assets/img/button_pwd.png
0 → 100644
1.74 KB
src/main/resources/static/assets/img/button_user.png
0 → 100644
1.87 KB
src/main/resources/static/assets/img/login_bgbg.png
0 → 100644
1.41 KB
src/main/resources/static/assets/img/login_bgcenter.png
0 → 100644
37.4 KB
src/main/resources/static/assets/js/common.js
| ... | ... | @@ -21,20 +21,26 @@ function removeConfirm(text, url, success) { |
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | function successHandle(json, handle){ |
| 24 | - if(!json.status){ | |
| 24 | + var status = json.status; | |
| 25 | + if(status == 407){ | |
| 26 | + alert('被注销的登录'); | |
| 27 | + return; | |
| 28 | + } | |
| 29 | + | |
| 30 | + if(!status){ | |
| 25 | 31 | handle && handle(json); |
| 26 | 32 | return ; |
| 27 | 33 | } |
| 28 | 34 | |
| 29 | - if(json.status == 'ERROR') | |
| 30 | - layer.alert(json.msg, {icon: 2, title: '操作失败'}); | |
| 35 | + if(status == 'ERROR') | |
| 36 | + layer.alert(json.msg?json.msg:'未知异常', {icon: 2, title: '操作失败'}); | |
| 31 | 37 | else |
| 32 | 38 | handle && handle(json); |
| 33 | 39 | } |
| 34 | 40 | |
| 35 | 41 | function ajaxComplete(xhr, ts, succ){ |
| 36 | 42 | if(ts == 'success'){ |
| 37 | - successHandle(xhr.responseJSON, succ); | |
| 43 | + successHandle(JSON.parse(xhr.responseText), succ); | |
| 38 | 44 | } |
| 39 | 45 | else if(ts == 'error'){ |
| 40 | 46 | layer.alert(xhr.responseText, {icon: 2, title: '操作失败'}); |
| ... | ... | @@ -139,4 +145,49 @@ function createTreeData(arr){ |
| 139 | 145 | } |
| 140 | 146 | } |
| 141 | 147 | return treeData; |
| 148 | +} | |
| 149 | + | |
| 150 | + | |
| 151 | +function createVehSearch($e){ | |
| 152 | + //车辆内部编码下拉搜索框 | |
| 153 | + $e.select2({ | |
| 154 | + placeholder: '搜索车辆...', | |
| 155 | + ajax: { | |
| 156 | + url: '/realSchedule/sreachVehic', | |
| 157 | + dataType: 'json', | |
| 158 | + delay: 150, | |
| 159 | + data: function(params){ | |
| 160 | + return{nbbm: params.term}; | |
| 161 | + }, | |
| 162 | + processResults: function (data) { | |
| 163 | + return { | |
| 164 | + results: data | |
| 165 | + }; | |
| 166 | + }, | |
| 167 | + cache: true | |
| 168 | + }, | |
| 169 | + templateResult: function(repo){ | |
| 170 | + if (repo.loading) return repo.text; | |
| 171 | + var h = '<span>'+repo.text+'</span>'; | |
| 172 | + h += (repo.lineName?' <span class="select2-desc">'+repo.lineName+'</span>':''); | |
| 173 | + return h; | |
| 174 | + }, | |
| 175 | + escapeMarkup: function (markup) { return markup; }, | |
| 176 | + minimumInputLength: 1, | |
| 177 | + templateSelection: function(repo){ | |
| 178 | + return repo.text; | |
| 179 | + }, | |
| 180 | + language: { | |
| 181 | + noResults: function(){ | |
| 182 | + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>'; | |
| 183 | + }, | |
| 184 | + inputTooShort : function(e) { | |
| 185 | + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>'; | |
| 186 | + }, | |
| 187 | + searching : function() { | |
| 188 | + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>'; | |
| 189 | + } | |
| 190 | + } | |
| 191 | + }) | |
| 192 | + return $e; | |
| 142 | 193 | } |
| 143 | 194 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/js/sockjs.min.js
0 → 100644
| 1 | +/* sockjs-client v1.1.1 | http://sockjs.org | MIT license */ | |
| 2 | +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SockJS=t()}}(function(){var t;return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(t,e){(function(n){"use strict";var r=t("./transport-list");e.exports=t("./main")(r),"_sockjs_onload"in n&&setTimeout(n._sockjs_onload,1)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./main":14,"./transport-list":16}],2:[function(t,e){"use strict";function n(){i.call(this),this.initEvent("close",!1,!1),this.wasClean=!1,this.code=0,this.reason=""}var r=t("inherits"),i=t("./event");r(n,i),e.exports=n},{"./event":4,inherits:54}],3:[function(t,e){"use strict";function n(){i.call(this)}var r=t("inherits"),i=t("./eventtarget");r(n,i),n.prototype.removeAllListeners=function(t){t?delete this._listeners[t]:this._listeners={}},n.prototype.once=function(t,e){function n(){r.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}var r=this,i=!1;this.on(t,n)},n.prototype.emit=function(){var t=arguments[0],e=this._listeners[t];if(e){for(var n=arguments.length,r=new Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];for(var o=0;o<e.length;o++)e[o].apply(this,r)}},n.prototype.on=n.prototype.addListener=i.prototype.addEventListener,n.prototype.removeListener=i.prototype.removeEventListener,e.exports.EventEmitter=n},{"./eventtarget":5,inherits:54}],4:[function(t,e){"use strict";function n(t){this.type=t}n.prototype.initEvent=function(t,e,n){return this.type=t,this.bubbles=e,this.cancelable=n,this.timeStamp=+new Date,this},n.prototype.stopPropagation=function(){},n.prototype.preventDefault=function(){},n.CAPTURING_PHASE=1,n.AT_TARGET=2,n.BUBBLING_PHASE=3,e.exports=n},{}],5:[function(t,e){"use strict";function n(){this._listeners={}}n.prototype.addEventListener=function(t,e){t in this._listeners||(this._listeners[t]=[]);var n=this._listeners[t];-1===n.indexOf(e)&&(n=n.concat([e])),this._listeners[t]=n},n.prototype.removeEventListener=function(t,e){var n=this._listeners[t];if(n){var r=n.indexOf(e);return-1!==r?void(n.length>1?this._listeners[t]=n.slice(0,r).concat(n.slice(r+1)):delete this._listeners[t]):void 0}},n.prototype.dispatchEvent=function(){var t=arguments[0],e=t.type,n=1===arguments.length?[t]:Array.apply(null,arguments);if(this["on"+e]&&this["on"+e].apply(this,n),e in this._listeners)for(var r=this._listeners[e],i=0;i<r.length;i++)r[i].apply(this,n)},e.exports=n},{}],6:[function(t,e){"use strict";function n(t){i.call(this),this.initEvent("message",!1,!1),this.data=t}var r=t("inherits"),i=t("./event");r(n,i),e.exports=n},{"./event":4,inherits:54}],7:[function(t,e){"use strict";function n(t){this._transport=t,t.on("message",this._transportMessage.bind(this)),t.on("close",this._transportClose.bind(this))}var r=t("json3"),i=t("./utils/iframe");n.prototype._transportClose=function(t,e){i.postMessage("c",r.stringify([t,e]))},n.prototype._transportMessage=function(t){i.postMessage("t",t)},n.prototype._send=function(t){this._transport.send(t)},n.prototype._close=function(){this._transport.close(),this._transport.removeAllListeners()},e.exports=n},{"./utils/iframe":47,json3:55}],8:[function(t,e){"use strict";var n=t("./utils/url"),r=t("./utils/event"),i=t("json3"),o=t("./facade"),s=t("./info-iframe-receiver"),a=t("./utils/iframe"),u=t("./location");e.exports=function(t,e){var l={};e.forEach(function(t){t.facadeTransport&&(l[t.facadeTransport.transportName]=t.facadeTransport)}),l[s.transportName]=s;var c;t.bootstrap_iframe=function(){var e;a.currentWindowId=u.hash.slice(1);var s=function(r){if(r.source===parent&&("undefined"==typeof c&&(c=r.origin),r.origin===c)){var s;try{s=i.parse(r.data)}catch(f){return}if(s.windowId===a.currentWindowId)switch(s.type){case"s":var h;try{h=i.parse(s.data)}catch(f){break}var d=h[0],p=h[1],v=h[2],m=h[3];if(d!==t.version)throw new Error('Incompatible SockJS! Main site uses: "'+d+'", the iframe: "'+t.version+'".');if(!n.isOriginEqual(v,u.href)||!n.isOriginEqual(m,u.href))throw new Error("Can't connect to different domain from within an iframe. ("+u.href+", "+v+", "+m+")");e=new o(new l[p](v,m));break;case"m":e._send(s.data);break;case"c":e&&e._close(),e=null}}};r.attachEvent("message",s),a.postMessage("s")}}},{"./facade":7,"./info-iframe-receiver":10,"./location":13,"./utils/event":46,"./utils/iframe":47,"./utils/url":52,debug:void 0,json3:55}],9:[function(t,e){"use strict";function n(t,e){r.call(this);var n=this,i=+new Date;this.xo=new e("GET",t),this.xo.once("finish",function(t,e){var r,a;if(200===t){if(a=+new Date-i,e)try{r=o.parse(e)}catch(u){}s.isObject(r)||(r={})}n.emit("finish",r,a),n.removeAllListeners()})}var r=t("events").EventEmitter,i=t("inherits"),o=t("json3"),s=t("./utils/object");i(n,r),n.prototype.close=function(){this.removeAllListeners(),this.xo.close()},e.exports=n},{"./utils/object":49,debug:void 0,events:3,inherits:54,json3:55}],10:[function(t,e){"use strict";function n(t){var e=this;i.call(this),this.ir=new a(t,s),this.ir.once("finish",function(t,n){e.ir=null,e.emit("message",o.stringify([t,n]))})}var r=t("inherits"),i=t("events").EventEmitter,o=t("json3"),s=t("./transport/sender/xhr-local"),a=t("./info-ajax");r(n,i),n.transportName="iframe-info-receiver",n.prototype.close=function(){this.ir&&(this.ir.close(),this.ir=null),this.removeAllListeners()},e.exports=n},{"./info-ajax":9,"./transport/sender/xhr-local":37,events:3,inherits:54,json3:55}],11:[function(t,e){(function(n){"use strict";function r(t,e){var r=this;i.call(this);var o=function(){var n=r.ifr=new u(l.transportName,e,t);n.once("message",function(t){if(t){var e;try{e=s.parse(t)}catch(n){return r.emit("finish"),void r.close()}var i=e[0],o=e[1];r.emit("finish",i,o)}r.close()}),n.once("close",function(){r.emit("finish"),r.close()})};n.document.body?o():a.attachEvent("load",o)}var i=t("events").EventEmitter,o=t("inherits"),s=t("json3"),a=t("./utils/event"),u=t("./transport/iframe"),l=t("./info-iframe-receiver");o(r,i),r.enabled=function(){return u.enabled()},r.prototype.close=function(){this.ifr&&this.ifr.close(),this.removeAllListeners(),this.ifr=null},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./info-iframe-receiver":10,"./transport/iframe":22,"./utils/event":46,debug:void 0,events:3,inherits:54,json3:55}],12:[function(t,e){"use strict";function n(t,e){var n=this;r.call(this),setTimeout(function(){n.doXhr(t,e)},0)}var r=t("events").EventEmitter,i=t("inherits"),o=t("./utils/url"),s=t("./transport/sender/xdr"),a=t("./transport/sender/xhr-cors"),u=t("./transport/sender/xhr-local"),l=t("./transport/sender/xhr-fake"),c=t("./info-iframe"),f=t("./info-ajax");i(n,r),n._getReceiver=function(t,e,n){return n.sameOrigin?new f(e,u):a.enabled?new f(e,a):s.enabled&&n.sameScheme?new f(e,s):c.enabled()?new c(t,e):new f(e,l)},n.prototype.doXhr=function(t,e){var r=this,i=o.addPath(t,"/info");this.xo=n._getReceiver(t,i,e),this.timeoutRef=setTimeout(function(){r._cleanup(!1),r.emit("finish")},n.timeout),this.xo.once("finish",function(t,e){r._cleanup(!0),r.emit("finish",t,e)})},n.prototype._cleanup=function(t){clearTimeout(this.timeoutRef),this.timeoutRef=null,!t&&this.xo&&this.xo.close(),this.xo=null},n.prototype.close=function(){this.removeAllListeners(),this._cleanup(!1)},n.timeout=8e3,e.exports=n},{"./info-ajax":9,"./info-iframe":11,"./transport/sender/xdr":34,"./transport/sender/xhr-cors":35,"./transport/sender/xhr-fake":36,"./transport/sender/xhr-local":37,"./utils/url":52,debug:void 0,events:3,inherits:54}],13:[function(t,e){(function(t){"use strict";e.exports=t.location||{origin:"http://localhost:80",protocol:"http",host:"localhost",port:80,href:"http://localhost/",hash:""}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(t,e){(function(n){"use strict";function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);if(arguments.length<1)throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");b.call(this),this.readyState=r.CONNECTING,this.extensions="",this.protocol="",n=n||{},n.protocols_whitelist&&m.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead."),this._transportsWhitelist=n.transports,this._transportOptions=n.transportOptions||{};var i=n.sessionId||8;if("function"==typeof i)this._generateSessionId=i;else{if("number"!=typeof i)throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");this._generateSessionId=function(){return l.string(i)}}this._server=n.server||l.numberString(1e3);var o=new s(t);if(!o.host||!o.protocol)throw new SyntaxError("The URL '"+t+"' is invalid");if(o.hash)throw new SyntaxError("The URL must not contain a fragment");if("http:"!==o.protocol&&"https:"!==o.protocol)throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '"+o.protocol+"' is not allowed.");var a="https:"===o.protocol;if("https"===g.protocol&&!a)throw new Error("SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS");e?Array.isArray(e)||(e=[e]):e=[];var u=e.sort();u.forEach(function(t,e){if(!t)throw new SyntaxError("The protocols entry '"+t+"' is invalid.");if(e<u.length-1&&t===u[e+1])throw new SyntaxError("The protocols entry '"+t+"' is duplicated.")});var c=f.getOrigin(g.href);this._origin=c?c.toLowerCase():null,o.set("pathname",o.pathname.replace(/\/+$/,"")),this.url=o.href,this._urlInfo={nullOrigin:!v.hasDomain(),sameOrigin:f.isOriginEqual(this.url,g.href),sameScheme:f.isSchemeEqual(this.url,g.href)},this._ir=new _(this.url,this._urlInfo),this._ir.once("finish",this._receiveInfo.bind(this))}function i(t){return 1e3===t||t>=3e3&&4999>=t}t("./shims");var o,s=t("url-parse"),a=t("inherits"),u=t("json3"),l=t("./utils/random"),c=t("./utils/escape"),f=t("./utils/url"),h=t("./utils/event"),d=t("./utils/transport"),p=t("./utils/object"),v=t("./utils/browser"),m=t("./utils/log"),y=t("./event/event"),b=t("./event/eventtarget"),g=t("./location"),w=t("./event/close"),x=t("./event/trans-message"),_=t("./info-receiver");a(r,b),r.prototype.close=function(t,e){if(t&&!i(t))throw new Error("InvalidAccessError: Invalid code");if(e&&e.length>123)throw new SyntaxError("reason argument has an invalid length");if(this.readyState!==r.CLOSING&&this.readyState!==r.CLOSED){var n=!0;this._close(t||1e3,e||"Normal closure",n)}},r.prototype.send=function(t){if("string"!=typeof t&&(t=""+t),this.readyState===r.CONNECTING)throw new Error("InvalidStateError: The connection has not been established yet");this.readyState===r.OPEN&&this._transport.send(c.quote(t))},r.version=t("./version"),r.CONNECTING=0,r.OPEN=1,r.CLOSING=2,r.CLOSED=3,r.prototype._receiveInfo=function(t,e){if(this._ir=null,!t)return void this._close(1002,"Cannot connect to server");this._rto=this.countRTO(e),this._transUrl=t.base_url?t.base_url:this.url,t=p.extend(t,this._urlInfo);var n=o.filterToEnabled(this._transportsWhitelist,t);this._transports=n.main,this._connect()},r.prototype._connect=function(){for(var t=this._transports.shift();t;t=this._transports.shift()){if(t.needBody&&(!n.document.body||"undefined"!=typeof n.document.readyState&&"complete"!==n.document.readyState&&"interactive"!==n.document.readyState))return this._transports.unshift(t),void h.attachEvent("load",this._connect.bind(this));var e=this._rto*t.roundTrips||5e3;this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),e);var r=f.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId()),i=this._transportOptions[t.transportName],o=new t(r,this._transUrl,i);return o.on("message",this._transportMessage.bind(this)),o.once("close",this._transportClose.bind(this)),o.transportName=t.transportName,void(this._transport=o)}this._close(2e3,"All transports failed",!1)},r.prototype._transportTimeout=function(){this.readyState===r.CONNECTING&&this._transportClose(2007,"Transport timed out")},r.prototype._transportMessage=function(t){var e,n=this,r=t.slice(0,1),i=t.slice(1);switch(r){case"o":return void this._open();case"h":return void this.dispatchEvent(new y("heartbeat"))}if(i)try{e=u.parse(i)}catch(o){}if("undefined"!=typeof e)switch(r){case"a":Array.isArray(e)&&e.forEach(function(t){n.dispatchEvent(new x(t))});break;case"m":this.dispatchEvent(new x(e));break;case"c":Array.isArray(e)&&2===e.length&&this._close(e[0],e[1],!0)}},r.prototype._transportClose=function(t,e){return this._transport&&(this._transport.removeAllListeners(),this._transport=null,this.transport=null),i(t)||2e3===t||this.readyState!==r.CONNECTING?void this._close(t,e):void this._connect()},r.prototype._open=function(){this.readyState===r.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=r.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new y("open"))):this._close(1006,"Server lost session")},r.prototype._close=function(t,e,n){var i=!1;if(this._ir&&(i=!0,this._ir.close(),this._ir=null),this._transport&&(this._transport.close(),this._transport=null,this.transport=null),this.readyState===r.CLOSED)throw new Error("InvalidStateError: SockJS has already been closed");this.readyState=r.CLOSING,setTimeout(function(){this.readyState=r.CLOSED,i&&this.dispatchEvent(new y("error"));var o=new w("close");o.wasClean=n||!1,o.code=t||1e3,o.reason=e,this.dispatchEvent(o),this.onmessage=this.onclose=this.onerror=null}.bind(this),0)},r.prototype.countRTO=function(t){return t>100?4*t:300+t},e.exports=function(e){return o=d(e),t("./iframe-bootstrap")(r,e),r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./event/close":2,"./event/event":4,"./event/eventtarget":5,"./event/trans-message":6,"./iframe-bootstrap":8,"./info-receiver":12,"./location":13,"./shims":15,"./utils/browser":44,"./utils/escape":45,"./utils/event":46,"./utils/log":48,"./utils/object":49,"./utils/random":50,"./utils/transport":51,"./utils/url":52,"./version":53,debug:void 0,inherits:54,json3:55,"url-parse":56}],15:[function(){"use strict";function t(t){var e=+t;return e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function e(t){return t>>>0}function n(){}var r,i=Array.prototype,o=Object.prototype,s=Function.prototype,a=String.prototype,u=i.slice,l=o.toString,c=function(t){return"[object Function]"===o.toString.call(t)},f=function(t){return"[object Array]"===l.call(t)},h=function(t){return"[object String]"===l.call(t)},d=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}();r=d?function(t,e,n,r){!r&&e in t||Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(t,e,n,r){!r&&e in t||(t[e]=n)};var p=function(t,e,n){for(var i in e)o.hasOwnProperty.call(e,i)&&r(t,i,e[i],n)},v=function(t){if(null==t)throw new TypeError("can't convert "+t+" to object");return Object(t)};p(s,{bind:function(t){var e=this;if(!c(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r=u.call(arguments,1),i=function(){if(this instanceof l){var n=e.apply(this,r.concat(u.call(arguments)));return Object(n)===n?n:this}return e.apply(t,r.concat(u.call(arguments)))},o=Math.max(0,e.length-r.length),s=[],a=0;o>a;a++)s.push("$"+a);var l=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this, arguments); }")(i);return e.prototype&&(n.prototype=e.prototype,l.prototype=new n,n.prototype=null),l}}),p(Array,{isArray:f});var m=Object("a"),y="a"!==m[0]||!(0 in m),b=function(t){var e=!0,n=!0;return t&&(t.call("foo",function(t,n,r){"object"!=typeof r&&(e=!1)}),t.call([1],function(){n="string"==typeof this},"x")),!!t&&e&&n};p(i,{forEach:function(t){var e=v(this),n=y&&h(this)?this.split(""):e,r=arguments[1],i=-1,o=n.length>>>0;if(!c(t))throw new TypeError;for(;++i<o;)i in n&&t.call(r,n[i],i,e)}},!b(i.forEach));var g=Array.prototype.indexOf&&-1!==[0,1].indexOf(1,2);p(i,{indexOf:function(e){var n=y&&h(this)?this.split(""):v(this),r=n.length>>>0;if(!r)return-1;var i=0;for(arguments.length>1&&(i=t(arguments[1])),i=i>=0?i:Math.max(0,r+i);r>i;i++)if(i in n&&n[i]===e)return i;return-1}},g);var w=a.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?!function(){var t=void 0===/()??/.exec("")[1];a.split=function(n,r){var o=this;if(void 0===n&&0===r)return[];if("[object RegExp]"!==l.call(n))return w.call(this,n,r);var s,a,u,c,f=[],h=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.extended?"x":"")+(n.sticky?"y":""),d=0;for(n=new RegExp(n.source,h+"g"),o+="",t||(s=new RegExp("^"+n.source+"$(?!\\s)",h)),r=void 0===r?-1>>>0:e(r);(a=n.exec(o))&&(u=a.index+a[0].length,!(u>d&&(f.push(o.slice(d,a.index)),!t&&a.length>1&&a[0].replace(s,function(){for(var t=1;t<arguments.length-2;t++)void 0===arguments[t]&&(a[t]=void 0)}),a.length>1&&a.index<o.length&&i.push.apply(f,a.slice(1)),c=a[0].length,d=u,f.length>=r)));)n.lastIndex===a.index&&n.lastIndex++;return d===o.length?(c||!n.test(""))&&f.push(""):f.push(o.slice(d)),f.length>r?f.slice(0,r):f}}():"0".split(void 0,0).length&&(a.split=function(t,e){return void 0===t&&0===e?[]:w.call(this,t,e)});var x=" \n\f\r \u2028\u2029",_="",E="["+x+"]",j=new RegExp("^"+E+E+"*"),T=new RegExp(E+E+"*$"),S=a.trim&&(x.trim()||!_.trim());p(a,{trim:function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(j,"").replace(T,"")}},S);var O=a.substr,C="".substr&&"b"!=="0b".substr(-1);p(a,{substr:function(t,e){return O.call(this,0>t&&(t=this.length+t)<0?0:t,e)}},C)},{}],16:[function(t,e){"use strict";e.exports=[t("./transport/websocket"),t("./transport/xhr-streaming"),t("./transport/xdr-streaming"),t("./transport/eventsource"),t("./transport/lib/iframe-wrap")(t("./transport/eventsource")),t("./transport/htmlfile"),t("./transport/lib/iframe-wrap")(t("./transport/htmlfile")),t("./transport/xhr-polling"),t("./transport/xdr-polling"),t("./transport/lib/iframe-wrap")(t("./transport/xhr-polling")),t("./transport/jsonp-polling")]},{"./transport/eventsource":20,"./transport/htmlfile":21,"./transport/jsonp-polling":23,"./transport/lib/iframe-wrap":26,"./transport/websocket":38,"./transport/xdr-polling":39,"./transport/xdr-streaming":40,"./transport/xhr-polling":41,"./transport/xhr-streaming":42}],17:[function(t,e){(function(n){"use strict";function r(t,e,n,r){var o=this;i.call(this),setTimeout(function(){o._start(t,e,n,r)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/url"),u=n.XMLHttpRequest;o(r,i),r.prototype._start=function(t,e,n,i){var o=this;try{this.xhr=new u}catch(l){}if(!this.xhr)return this.emit("finish",0,"no xhr support"),void this._cleanup();e=a.addQuery(e,"t="+ +new Date),this.unloadRef=s.unloadAdd(function(){o._cleanup(!0)});try{this.xhr.open(t,e,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){o.emit("finish",0,""),o._cleanup(!1)})}catch(c){return this.emit("finish",0,""),void this._cleanup(!1)}if(i&&i.noCredentials||!r.supportsCORS||(this.xhr.withCredentials="true"),i&&i.headers)for(var f in i.headers)this.xhr.setRequestHeader(f,i.headers[f]);this.xhr.onreadystatechange=function(){if(o.xhr){var t,e,n=o.xhr;switch(n.readyState){case 3:try{e=n.status,t=n.responseText}catch(r){}1223===e&&(e=204),200===e&&t&&t.length>0&&o.emit("chunk",e,t);break;case 4:e=n.status,1223===e&&(e=204),(12005===e||12029===e)&&(e=0),o.emit("finish",e,n.responseText),o._cleanup(!1)}}};try{o.xhr.send(n)}catch(c){o.emit("finish",0,""),o._cleanup(!1)}},r.prototype._cleanup=function(t){if(this.xhr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xhr.onreadystatechange=function(){},this.xhr.ontimeout&&(this.xhr.ontimeout=null),t)try{this.xhr.abort()}catch(e){}this.unloadRef=this.xhr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!!u;var l=["Active"].concat("Object").join("X");!r.enabled&&l in n&&(u=function(){try{return new n[l]("Microsoft.XMLHTTP")}catch(t){return null}},r.enabled=!!new u);var c=!1;try{c="withCredentials"in new u}catch(f){}r.supportsCORS=c,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],18:[function(t,e){(function(t){e.exports=t.EventSource}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(t,e){(function(t){"use strict";var n=t.WebSocket||t.MozWebSocket;n&&(e.exports=function(t){return new n(t)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],20:[function(t,e){"use strict";function n(t){if(!n.enabled())throw new Error("Transport created when disabled");i.call(this,t,"/eventsource",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/eventsource"),s=t("./sender/xhr-cors"),a=t("eventsource");r(n,i),n.enabled=function(){return!!a},n.transportName="eventsource",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/eventsource":29,"./sender/xhr-cors":35,eventsource:18,inherits:54}],21:[function(t,e){"use strict";function n(t){if(!i.enabled)throw new Error("Transport created when disabled");s.call(this,t,"/htmlfile",i,o)}var r=t("inherits"),i=t("./receiver/htmlfile"),o=t("./sender/xhr-local"),s=t("./lib/ajax-based");r(n,s),n.enabled=function(t){return i.enabled&&t.sameOrigin},n.transportName="htmlfile",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/htmlfile":30,"./sender/xhr-local":37,inherits:54}],22:[function(t,e){"use strict";function n(t,e,r){if(!n.enabled())throw new Error("Transport created when disabled");o.call(this);var i=this;this.origin=a.getOrigin(r),this.baseUrl=r,this.transUrl=e,this.transport=t,this.windowId=c.string(8);var s=a.addPath(r,"/iframe.html")+"#"+this.windowId;this.iframeObj=u.createIframe(s,function(t){i.emit("close",1006,"Unable to load an iframe ("+t+")"),i.close()}),this.onmessageCallback=this._message.bind(this),l.attachEvent("message",this.onmessageCallback)}var r=t("inherits"),i=t("json3"),o=t("events").EventEmitter,s=t("../version"),a=t("../utils/url"),u=t("../utils/iframe"),l=t("../utils/event"),c=t("../utils/random");r(n,o),n.prototype.close=function(){if(this.removeAllListeners(),this.iframeObj){l.detachEvent("message",this.onmessageCallback);try{this.postMessage("c")}catch(t){}this.iframeObj.cleanup(),this.iframeObj=null,this.onmessageCallback=this.iframeObj=null}},n.prototype._message=function(t){if(a.isOriginEqual(t.origin,this.origin)){var e;try{e=i.parse(t.data)}catch(n){return}if(e.windowId===this.windowId)switch(e.type){case"s":this.iframeObj.loaded(),this.postMessage("s",i.stringify([s,this.transport,this.transUrl,this.baseUrl]));break;case"t":this.emit("message",e.data);break;case"c":var r;try{r=i.parse(e.data)}catch(n){return}this.emit("close",r[0],r[1]),this.close()}}},n.prototype.postMessage=function(t,e){this.iframeObj.post(i.stringify({windowId:this.windowId,type:t,data:e||""}),this.origin)},n.prototype.send=function(t){this.postMessage("m",t)},n.enabled=function(){return u.iframeEnabled},n.transportName="iframe",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/iframe":47,"../utils/random":50,"../utils/url":52,"../version":53,debug:void 0,events:3,inherits:54,json3:55}],23:[function(t,e){(function(n){"use strict";function r(t){if(!r.enabled())throw new Error("Transport created when disabled");o.call(this,t,"/jsonp",a,s)}var i=t("inherits"),o=t("./lib/sender-receiver"),s=t("./receiver/jsonp"),a=t("./sender/jsonp");i(r,o),r.enabled=function(){return!!n.document},r.transportName="jsonp-polling",r.roundTrips=1,r.needBody=!0,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/sender-receiver":28,"./receiver/jsonp":31,"./sender/jsonp":33,inherits:54}],24:[function(t,e){"use strict";function n(t){return function(e,n,r){var i={};"string"==typeof n&&(i.headers={"Content-type":"text/plain"});var s=o.addPath(e,"/xhr_send"),a=new t("POST",s,n,i);return a.once("finish",function(t){return a=null,200!==t&&204!==t?r(new Error("http status "+t)):void r()}),function(){a.close(),a=null;var t=new Error("Aborted");t.code=1e3,r(t)}}}function r(t,e,r,i){s.call(this,t,e,n(i),r,i)}var i=t("inherits"),o=t("../../utils/url"),s=t("./sender-receiver");i(r,s),e.exports=r},{"../../utils/url":52,"./sender-receiver":28,debug:void 0,inherits:54}],25:[function(t,e){"use strict";function n(t,e){i.call(this),this.sendBuffer=[],this.sender=e,this.url=t}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype.send=function(t){this.sendBuffer.push(t),this.sendStop||this.sendSchedule()},n.prototype.sendScheduleWait=function(){var t,e=this;this.sendStop=function(){e.sendStop=null,clearTimeout(t)},t=setTimeout(function(){e.sendStop=null,e.sendSchedule()},25)},n.prototype.sendSchedule=function(){var t=this;if(this.sendBuffer.length>0){var e="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,e,function(e){t.sendStop=null,e?(t.emit("close",e.code||1006,"Sending error: "+e),t._cleanup()):t.sendScheduleWait()}),this.sendBuffer=[]}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.stop=function(){this._cleanup(),this.sendStop&&(this.sendStop(),this.sendStop=null)},e.exports=n},{debug:void 0,events:3,inherits:54}],26:[function(t,e){(function(n){"use strict";var r=t("inherits"),i=t("../iframe"),o=t("../../utils/object");e.exports=function(t){function e(e,n){i.call(this,t.transportName,e,n)}return r(e,i),e.enabled=function(e,r){if(!n.document)return!1;var s=o.extend({},r);return s.sameOrigin=!0,t.enabled(s)&&i.enabled()},e.transportName="iframe-"+t.transportName,e.needBody=!0,e.roundTrips=i.roundTrips+t.roundTrips-1,e.facadeTransport=t,e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/object":49,"../iframe":22,inherits:54}],27:[function(t,e){"use strict";function n(t,e,n){i.call(this),this.Receiver=t,this.receiveUrl=e,this.AjaxObject=n,this._scheduleReceiver()}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._scheduleReceiver=function(){var t=this,e=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);e.on("message",function(e){t.emit("message",e)}),e.once("close",function(n,r){t.poll=e=null,t.pollIsClosing||("network"===r?t._scheduleReceiver():(t.emit("close",n||1006,r),t.removeAllListeners()))})},n.prototype.abort=function(){this.removeAllListeners(),this.pollIsClosing=!0,this.poll&&this.poll.abort()},e.exports=n},{debug:void 0,events:3,inherits:54}],28:[function(t,e){"use strict";function n(t,e,n,r,a){var u=i.addPath(t,e),l=this;o.call(this,t,n),this.poll=new s(r,u,a),this.poll.on("message",function(t){l.emit("message",t)}),this.poll.once("close",function(t,e){l.poll=null,l.emit("close",t,e),l.close()})}var r=t("inherits"),i=t("../../utils/url"),o=t("./buffered-sender"),s=t("./polling");r(n,o),n.prototype.close=function(){this.removeAllListeners(),this.poll&&(this.poll.abort(),this.poll=null),this.stop()},e.exports=n},{"../../utils/url":52,"./buffered-sender":25,"./polling":27,debug:void 0,inherits:54}],29:[function(t,e){"use strict";function n(t){i.call(this);var e=this,n=this.es=new o(t);n.onmessage=function(t){e.emit("message",decodeURI(t.data))},n.onerror=function(t){var r=2!==n.readyState?"network":"permanent";e._cleanup(),e._close(r)}}var r=t("inherits"),i=t("events").EventEmitter,o=t("eventsource");r(n,i),n.prototype.abort=function(){this._cleanup(),this._close("user")},n.prototype._cleanup=function(){var t=this.es;t&&(t.onmessage=t.onerror=null,t.close(),this.es=null)},n.prototype._close=function(t){var e=this;setTimeout(function(){e.emit("close",null,t),e.removeAllListeners()},200)},e.exports=n},{debug:void 0,events:3,eventsource:18,inherits:54}],30:[function(t,e){(function(n){"use strict";function r(t){a.call(this);var e=this;o.polluteGlobalNamespace(),this.id="a"+u.string(6),t=s.addQuery(t,"c="+decodeURIComponent(o.WPrefix+"."+this.id));var i=r.htmlfileEnabled?o.createHtmlfile:o.createIframe;n[o.WPrefix][this.id]={start:function(){e.iframeObj.loaded()},message:function(t){e.emit("message",t)},stop:function(){e._cleanup(),e._close("network")}},this.iframeObj=i(t,function(){e._cleanup(),e._close("permanent")})}var i=t("inherits"),o=t("../../utils/iframe"),s=t("../../utils/url"),a=t("events").EventEmitter,u=t("../../utils/random");i(r,a),r.prototype.abort=function(){this._cleanup(),this._close("user")},r.prototype._cleanup=function(){this.iframeObj&&(this.iframeObj.cleanup(),this.iframeObj=null),delete n[o.WPrefix][this.id]},r.prototype._close=function(t){this.emit("close",null,t),this.removeAllListeners()},r.htmlfileEnabled=!1;var l=["Active"].concat("Object").join("X");if(l in n)try{r.htmlfileEnabled=!!new n[l]("htmlfile")}catch(c){}r.enabled=r.htmlfileEnabled||o.iframeEnabled,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],31:[function(t,e){(function(n){"use strict";function r(t){var e=this;l.call(this),i.polluteGlobalNamespace(),this.id="a"+o.string(6);var s=a.addQuery(t,"c="+encodeURIComponent(i.WPrefix+"."+this.id));n[i.WPrefix][this.id]=this._callback.bind(this),this._createScript(s),this.timeoutId=setTimeout(function(){e._abort(new Error("JSONP script loaded abnormally (timeout)"))},r.timeout)}var i=t("../../utils/iframe"),o=t("../../utils/random"),s=t("../../utils/browser"),a=t("../../utils/url"),u=t("inherits"),l=t("events").EventEmitter;u(r,l),r.prototype.abort=function(){if(n[i.WPrefix][this.id]){var t=new Error("JSONP user aborted read");t.code=1e3,this._abort(t)}},r.timeout=35e3,r.scriptErrorTimeout=1e3,r.prototype._callback=function(t){this._cleanup(),this.aborting||(t&&this.emit("message",t),this.emit("close",null,"network"),this.removeAllListeners())},r.prototype._abort=function(t){this._cleanup(),this.aborting=!0,this.emit("close",t.code,t.message),this.removeAllListeners()},r.prototype._cleanup=function(){if(clearTimeout(this.timeoutId),this.script2&&(this.script2.parentNode.removeChild(this.script2),this.script2=null),this.script){var t=this.script;t.parentNode.removeChild(t),t.onreadystatechange=t.onerror=t.onload=t.onclick=null,this.script=null}delete n[i.WPrefix][this.id]},r.prototype._scriptError=function(){var t=this;this.errorTimer||(this.errorTimer=setTimeout(function(){t.loadedOkay||t._abort(new Error("JSONP script loaded abnormally (onerror)"))},r.scriptErrorTimeout))},r.prototype._createScript=function(t){var e,r=this,i=this.script=n.document.createElement("script");if(i.id="a"+o.string(8),i.src=t,i.type="text/javascript",i.charset="UTF-8",i.onerror=this._scriptError.bind(this),i.onload=function(){r._abort(new Error("JSONP script loaded abnormally (onload)"))},i.onreadystatechange=function(){if(/loaded|closed/.test(i.readyState)){if(i&&i.htmlFor&&i.onclick){r.loadedOkay=!0;try{i.onclick()}catch(t){}}i&&r._abort(new Error("JSONP script loaded abnormally (onreadystatechange)")) | |
| 3 | +}},"undefined"==typeof i.async&&n.document.attachEvent)if(s.isOpera())e=this.script2=n.document.createElement("script"),e.text="try{var a = document.getElementById('"+i.id+"'); if(a)a.onerror();}catch(x){};",i.async=e.async=!1;else{try{i.htmlFor=i.id,i.event="onclick"}catch(a){}i.async=!0}"undefined"!=typeof i.async&&(i.async=!0);var u=n.document.getElementsByTagName("head")[0];u.insertBefore(i,u.firstChild),e&&u.insertBefore(e,u.firstChild)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],32:[function(t,e){"use strict";function n(t,e){i.call(this);var n=this;this.bufferPosition=0,this.xo=new e("POST",t,null),this.xo.on("chunk",this._chunkHandler.bind(this)),this.xo.once("finish",function(t,e){n._chunkHandler(t,e),n.xo=null;var r=200===t?"network":"permanent";n.emit("close",null,r),n._cleanup()})}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._chunkHandler=function(t,e){if(200===t&&e)for(var n=-1;;this.bufferPosition+=n+1){var r=e.slice(this.bufferPosition);if(n=r.indexOf("\n"),-1===n)break;var i=r.slice(0,n);i&&this.emit("message",i)}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.abort=function(){this.xo&&(this.xo.close(),this.emit("close",null,"user"),this.xo=null),this._cleanup()},e.exports=n},{debug:void 0,events:3,inherits:54}],33:[function(t,e){(function(n){"use strict";function r(t){try{return n.document.createElement('<iframe name="'+t+'">')}catch(e){var r=n.document.createElement("iframe");return r.name=t,r}}function i(){o=n.document.createElement("form"),o.style.display="none",o.style.position="absolute",o.method="POST",o.enctype="application/x-www-form-urlencoded",o.acceptCharset="UTF-8",s=n.document.createElement("textarea"),s.name="d",o.appendChild(s),n.document.body.appendChild(o)}var o,s,a=t("../../utils/random"),u=t("../../utils/url");e.exports=function(t,e,n){o||i();var l="a"+a.string(8);o.target=l,o.action=u.addQuery(u.addPath(t,"/jsonp_send"),"i="+l);var c=r(l);c.id=l,c.style.display="none",o.appendChild(c);try{s.value=e}catch(f){}o.submit();var h=function(t){c.onerror&&(c.onreadystatechange=c.onerror=c.onload=null,setTimeout(function(){c.parentNode.removeChild(c),c=null},500),s.value="",n(t))};return c.onerror=function(){h()},c.onload=function(){h()},c.onreadystatechange=function(t){"complete"===c.readyState&&h()},function(){h(new Error("Aborted"))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/random":50,"../../utils/url":52,debug:void 0}],34:[function(t,e){(function(n){"use strict";function r(t,e,n){var r=this;i.call(this),setTimeout(function(){r._start(t,e,n)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/browser"),u=t("../../utils/url");o(r,i),r.prototype._start=function(t,e,r){var i=this,o=new n.XDomainRequest;e=u.addQuery(e,"t="+ +new Date),o.onerror=function(){i._error()},o.ontimeout=function(){i._error()},o.onprogress=function(){i.emit("chunk",200,o.responseText)},o.onload=function(){i.emit("finish",200,o.responseText),i._cleanup(!1)},this.xdr=o,this.unloadRef=s.unloadAdd(function(){i._cleanup(!0)});try{this.xdr.open(t,e),this.timeout&&(this.xdr.timeout=this.timeout),this.xdr.send(r)}catch(a){this._error()}},r.prototype._error=function(){this.emit("finish",0,""),this._cleanup(!1)},r.prototype._cleanup=function(t){if(this.xdr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xdr.ontimeout=this.xdr.onerror=this.xdr.onprogress=this.xdr.onload=null,t)try{this.xdr.abort()}catch(e){}this.unloadRef=this.xdr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!(!n.XDomainRequest||!a.hasDomain()),e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],35:[function(t,e){"use strict";function n(t,e,n,r){i.call(this,t,e,n,r)}var r=t("inherits"),i=t("../driver/xhr");r(n,i),n.enabled=i.enabled&&i.supportsCORS,e.exports=n},{"../driver/xhr":17,inherits:54}],36:[function(t,e){"use strict";function n(){var t=this;r.call(this),this.to=setTimeout(function(){t.emit("finish",200,"{}")},n.timeout)}var r=t("events").EventEmitter,i=t("inherits");i(n,r),n.prototype.close=function(){clearTimeout(this.to)},n.timeout=2e3,e.exports=n},{events:3,inherits:54}],37:[function(t,e){"use strict";function n(t,e,n){i.call(this,t,e,n,{noCredentials:!0})}var r=t("inherits"),i=t("../driver/xhr");r(n,i),n.enabled=i.enabled,e.exports=n},{"../driver/xhr":17,inherits:54}],38:[function(t,e){"use strict";function n(t,e,o){if(!n.enabled())throw new Error("Transport created when disabled");s.call(this);var u=this,l=i.addPath(t,"/websocket");l="https"===l.slice(0,5)?"wss"+l.slice(5):"ws"+l.slice(4),this.url=l,this.ws=new a(this.url,[],o),this.ws.onmessage=function(t){u.emit("message",t.data)},this.unloadRef=r.unloadAdd(function(){u.ws.close()}),this.ws.onclose=function(t){u.emit("close",t.code,t.reason),u._cleanup()},this.ws.onerror=function(t){u.emit("close",1006,"WebSocket connection broken"),u._cleanup()}}var r=t("../utils/event"),i=t("../utils/url"),o=t("inherits"),s=t("events").EventEmitter,a=t("./driver/websocket");o(n,s),n.prototype.send=function(t){var e="["+t+"]";this.ws.send(e)},n.prototype.close=function(){this.ws&&this.ws.close(),this._cleanup()},n.prototype._cleanup=function(){var t=this.ws;t&&(t.onmessage=t.onclose=t.onerror=null),r.unloadDel(this.unloadRef),this.unloadRef=this.ws=null,this.removeAllListeners()},n.enabled=function(){return!!a},n.transportName="websocket",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/url":52,"./driver/websocket":19,debug:void 0,events:3,inherits:54}],39:[function(t,e){"use strict";function n(t){if(!a.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr",s,a)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./xdr-streaming"),s=t("./receiver/xhr"),a=t("./sender/xdr");r(n,i),n.enabled=o.enabled,n.transportName="xdr-polling",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xdr":34,"./xdr-streaming":40,inherits:54}],40:[function(t,e){"use strict";function n(t){if(!s.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr_streaming",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/xhr"),s=t("./sender/xdr");r(n,i),n.enabled=function(t){return t.cookie_needed||t.nullOrigin?!1:s.enabled&&t.sameScheme},n.transportName="xdr-streaming",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xdr":34,inherits:54}],41:[function(t,e){"use strict";function n(t){if(!a.enabled&&!s.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/xhr"),s=t("./sender/xhr-cors"),a=t("./sender/xhr-local");r(n,i),n.enabled=function(t){return t.nullOrigin?!1:a.enabled&&t.sameOrigin?!0:s.enabled},n.transportName="xhr-polling",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xhr-cors":35,"./sender/xhr-local":37,inherits:54}],42:[function(t,e){(function(n){"use strict";function r(t){if(!u.enabled&&!a.enabled)throw new Error("Transport created when disabled");o.call(this,t,"/xhr_streaming",s,a)}var i=t("inherits"),o=t("./lib/ajax-based"),s=t("./receiver/xhr"),a=t("./sender/xhr-cors"),u=t("./sender/xhr-local"),l=t("../utils/browser");i(r,o),r.enabled=function(t){return t.nullOrigin?!1:l.isOpera()?!1:a.enabled},r.transportName="xhr-streaming",r.roundTrips=2,r.needBody=!!n.document,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/browser":44,"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xhr-cors":35,"./sender/xhr-local":37,inherits:54}],43:[function(t,e){(function(t){"use strict";e.exports.randomBytes=t.crypto&&t.crypto.getRandomValues?function(e){var n=new Uint8Array(e);return t.crypto.getRandomValues(n),n}:function(t){for(var e=new Array(t),n=0;t>n;n++)e[n]=Math.floor(256*Math.random());return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],44:[function(t,e){(function(t){"use strict";e.exports={isOpera:function(){return t.navigator&&/opera/i.test(t.navigator.userAgent)},isKonqueror:function(){return t.navigator&&/konqueror/i.test(t.navigator.userAgent)},hasDomain:function(){if(!t.document)return!0;try{return!!t.document.domain}catch(e){return!1}}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],45:[function(t,e){"use strict";var n,r=t("json3"),i=/[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g,o=function(t){var e,n={},r=[];for(e=0;65536>e;e++)r.push(String.fromCharCode(e));return t.lastIndex=0,r.join("").replace(t,function(t){return n[t]="\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4),""}),t.lastIndex=0,n};e.exports={quote:function(t){var e=r.stringify(t);return i.lastIndex=0,i.test(e)?(n||(n=o(i)),e.replace(i,function(t){return n[t]})):e}}},{json3:55}],46:[function(t,e){(function(n){"use strict";var r=t("./random"),i={},o=!1,s=n.chrome&&n.chrome.app&&n.chrome.app.runtime;e.exports={attachEvent:function(t,e){"undefined"!=typeof n.addEventListener?n.addEventListener(t,e,!1):n.document&&n.attachEvent&&(n.document.attachEvent("on"+t,e),n.attachEvent("on"+t,e))},detachEvent:function(t,e){"undefined"!=typeof n.addEventListener?n.removeEventListener(t,e,!1):n.document&&n.detachEvent&&(n.document.detachEvent("on"+t,e),n.detachEvent("on"+t,e))},unloadAdd:function(t){if(s)return null;var e=r.string(8);return i[e]=t,o&&setTimeout(this.triggerUnloadCallbacks,0),e},unloadDel:function(t){t in i&&delete i[t]},triggerUnloadCallbacks:function(){for(var t in i)i[t](),delete i[t]}};var a=function(){o||(o=!0,e.exports.triggerUnloadCallbacks())};s||e.exports.attachEvent("unload",a)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./random":50}],47:[function(t,e){(function(n){"use strict";var r=t("./event"),i=t("json3"),o=t("./browser");e.exports={WPrefix:"_jp",currentWindowId:null,polluteGlobalNamespace:function(){e.exports.WPrefix in n||(n[e.exports.WPrefix]={})},postMessage:function(t,r){n.parent!==n&&n.parent.postMessage(i.stringify({windowId:e.exports.currentWindowId,type:t,data:r||""}),"*")},createIframe:function(t,e){var i,o,s=n.document.createElement("iframe"),a=function(){clearTimeout(i);try{s.onload=null}catch(t){}s.onerror=null},u=function(){s&&(a(),setTimeout(function(){s&&s.parentNode.removeChild(s),s=null},0),r.unloadDel(o))},l=function(t){s&&(u(),e(t))},c=function(t,e){try{setTimeout(function(){s&&s.contentWindow&&s.contentWindow.postMessage(t,e)},0)}catch(n){}};return s.src=t,s.style.display="none",s.style.position="absolute",s.onerror=function(){l("onerror")},s.onload=function(){clearTimeout(i),i=setTimeout(function(){l("onload timeout")},2e3)},n.document.body.appendChild(s),i=setTimeout(function(){l("timeout")},15e3),o=r.unloadAdd(u),{post:c,cleanup:u,loaded:a}},createHtmlfile:function(t,i){var o,s,a,u=["Active"].concat("Object").join("X"),l=new n[u]("htmlfile"),c=function(){clearTimeout(o),a.onerror=null},f=function(){l&&(c(),r.unloadDel(s),a.parentNode.removeChild(a),a=l=null,CollectGarbage())},h=function(t){l&&(f(),i(t))},d=function(t,e){try{setTimeout(function(){a&&a.contentWindow&&a.contentWindow.postMessage(t,e)},0)}catch(n){}};l.open(),l.write('<html><script>document.domain="'+n.document.domain+'";</script></html>'),l.close(),l.parentWindow[e.exports.WPrefix]=n[e.exports.WPrefix];var p=l.createElement("div");return l.body.appendChild(p),a=l.createElement("iframe"),p.appendChild(a),a.src=t,a.onerror=function(){h("onerror")},o=setTimeout(function(){h("timeout")},15e3),s=r.unloadAdd(f),{post:d,cleanup:f,loaded:c}}},e.exports.iframeEnabled=!1,n.document&&(e.exports.iframeEnabled=("function"==typeof n.postMessage||"object"==typeof n.postMessage)&&!o.isKonqueror())}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./browser":44,"./event":46,debug:void 0,json3:55}],48:[function(t,e){(function(t){"use strict";var n={};["log","debug","warn"].forEach(function(e){var r;try{r=t.console&&t.console[e]&&t.console[e].apply}catch(i){}n[e]=r?function(){return t.console[e].apply(t.console,arguments)}:"log"===e?function(){}:n.log}),e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],49:[function(t,e){"use strict";e.exports={isObject:function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},extend:function(t){if(!this.isObject(t))return t;for(var e,n,r=1,i=arguments.length;i>r;r++){e=arguments[r];for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}}},{}],50:[function(t,e){"use strict";var n=t("crypto"),r="abcdefghijklmnopqrstuvwxyz012345";e.exports={string:function(t){for(var e=r.length,i=n.randomBytes(t),o=[],s=0;t>s;s++)o.push(r.substr(i[s]%e,1));return o.join("")},number:function(t){return Math.floor(Math.random()*t)},numberString:function(t){var e=(""+(t-1)).length,n=new Array(e+1).join("0");return(n+this.number(t)).slice(-e)}}},{crypto:43}],51:[function(t,e){"use strict";e.exports=function(t){return{filterToEnabled:function(e,n){var r={main:[],facade:[]};return e?"string"==typeof e&&(e=[e]):e=[],t.forEach(function(t){t&&("websocket"!==t.transportName||n.websocket!==!1)&&(e.length&&-1===e.indexOf(t.transportName)||t.enabled(n)&&(r.main.push(t),t.facadeTransport&&r.facade.push(t.facadeTransport)))}),r}}}},{debug:void 0}],52:[function(t,e){"use strict";var n=t("url-parse");e.exports={getOrigin:function(t){if(!t)return null;var e=new n(t);if("file:"===e.protocol)return null;var r=e.port;return r||(r="https:"===e.protocol?"443":"80"),e.protocol+"//"+e.hostname+":"+r},isOriginEqual:function(t,e){var n=this.getOrigin(t)===this.getOrigin(e);return n},isSchemeEqual:function(t,e){return t.split(":")[0]===e.split(":")[0]},addPath:function(t,e){var n=t.split("?");return n[0]+e+(n[1]?"?"+n[1]:"")},addQuery:function(t,e){return t+(-1===t.indexOf("?")?"?"+e:"&"+e)}}},{debug:void 0,"url-parse":56}],53:[function(t,e){e.exports="1.1.1"},{}],54:[function(t,e){e.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],55:[function(e,n,r){(function(e){(function(){function i(t,e){function n(t){if(n[t]!==m)return n[t];var i;if("bug-string-char-index"==t)i="a"!="a"[0];else if("json"==t)i=n("json-stringify")&&n("json-parse");else{var s,a='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==t){var u=e.stringify,c="function"==typeof u&&g;if(c){(s=function(){return 1}).toJSON=s;try{c="0"===u(0)&&"0"===u(new r)&&'""'==u(new o)&&u(b)===m&&u(m)===m&&u()===m&&"1"===u(s)&&"[1]"==u([s])&&"[null]"==u([m])&&"null"==u(null)&&"[null,null,null]"==u([m,b,null])&&u({a:[s,!0,!1,null,"\x00\b\n\f\r "]})==a&&"1"===u(null,s)&&"[\n 1,\n 2\n]"==u([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==u(new l(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==u(new l(864e13))&&'"-000001-01-01T00:00:00.000Z"'==u(new l(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==u(new l(-1))}catch(f){c=!1}}i=c}if("json-parse"==t){var h=e.parse;if("function"==typeof h)try{if(0===h("0")&&!h(!1)){s=h(a);var d=5==s.a.length&&1===s.a[0];if(d){try{d=!h('" "')}catch(f){}if(d)try{d=1!==h("01")}catch(f){}if(d)try{d=1!==h("1.")}catch(f){}}}}catch(f){d=!1}i=d}}return n[t]=!!i}t||(t=u.Object()),e||(e=u.Object());var r=t.Number||u.Number,o=t.String||u.String,a=t.Object||u.Object,l=t.Date||u.Date,c=t.SyntaxError||u.SyntaxError,f=t.TypeError||u.TypeError,h=t.Math||u.Math,d=t.JSON||u.JSON;"object"==typeof d&&d&&(e.stringify=d.stringify,e.parse=d.parse);var p,v,m,y=a.prototype,b=y.toString,g=new l(-0xc782b5b800cec);try{g=-109252==g.getUTCFullYear()&&0===g.getUTCMonth()&&1===g.getUTCDate()&&10==g.getUTCHours()&&37==g.getUTCMinutes()&&6==g.getUTCSeconds()&&708==g.getUTCMilliseconds()}catch(w){}if(!n("json")){var x="[object Function]",_="[object Date]",E="[object Number]",j="[object String]",T="[object Array]",S="[object Boolean]",O=n("bug-string-char-index");if(!g)var C=h.floor,A=[0,31,59,90,120,151,181,212,243,273,304,334],N=function(t,e){return A[e]+365*(t-1970)+C((t-1969+(e=+(e>1)))/4)-C((t-1901+e)/100)+C((t-1601+e)/400)};if((p=y.hasOwnProperty)||(p=function(t){var e,n={};return(n.__proto__=null,n.__proto__={toString:1},n).toString!=b?p=function(t){var e=this.__proto__,n=t in(this.__proto__=null,this);return this.__proto__=e,n}:(e=n.constructor,p=function(t){var n=(this.constructor||e).prototype;return t in this&&!(t in n&&this[t]===n[t])}),n=null,p.call(this,t)}),v=function(t,e){var n,r,i,o=0;(n=function(){this.valueOf=0}).prototype.valueOf=0,r=new n;for(i in r)p.call(r,i)&&o++;return n=r=null,o?v=2==o?function(t,e){var n,r={},i=b.call(t)==x;for(n in t)i&&"prototype"==n||p.call(r,n)||!(r[n]=1)||!p.call(t,n)||e(n)}:function(t,e){var n,r,i=b.call(t)==x;for(n in t)i&&"prototype"==n||!p.call(t,n)||(r="constructor"===n)||e(n);(r||p.call(t,n="constructor"))&&e(n)}:(r=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],v=function(t,e){var n,i,o=b.call(t)==x,a=!o&&"function"!=typeof t.constructor&&s[typeof t.hasOwnProperty]&&t.hasOwnProperty||p;for(n in t)o&&"prototype"==n||!a.call(t,n)||e(n);for(i=r.length;n=r[--i];a.call(t,n)&&e(n));}),v(t,e)},!n("json-stringify")){var k={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},I="000000",P=function(t,e){return(I+(e||0)).slice(-t)},L="\\u00",R=function(t){for(var e='"',n=0,r=t.length,i=!O||r>10,o=i&&(O?t.split(""):t);r>n;n++){var s=t.charCodeAt(n);switch(s){case 8:case 9:case 10:case 12:case 13:case 34:case 92:e+=k[s];break;default:if(32>s){e+=L+P(2,s.toString(16));break}e+=i?o[n]:t.charAt(n)}}return e+'"'},U=function(t,e,n,r,i,o,s){var a,u,l,c,h,d,y,g,w,x,O,A,k,I,L,M;try{a=e[t]}catch(q){}if("object"==typeof a&&a)if(u=b.call(a),u!=_||p.call(a,"toJSON"))"function"==typeof a.toJSON&&(u!=E&&u!=j&&u!=T||p.call(a,"toJSON"))&&(a=a.toJSON(t));else if(a>-1/0&&1/0>a){if(N){for(h=C(a/864e5),l=C(h/365.2425)+1970-1;N(l+1,0)<=h;l++);for(c=C((h-N(l,0))/30.42);N(l,c+1)<=h;c++);h=1+h-N(l,c),d=(a%864e5+864e5)%864e5,y=C(d/36e5)%24,g=C(d/6e4)%60,w=C(d/1e3)%60,x=d%1e3}else l=a.getUTCFullYear(),c=a.getUTCMonth(),h=a.getUTCDate(),y=a.getUTCHours(),g=a.getUTCMinutes(),w=a.getUTCSeconds(),x=a.getUTCMilliseconds();a=(0>=l||l>=1e4?(0>l?"-":"+")+P(6,0>l?-l:l):P(4,l))+"-"+P(2,c+1)+"-"+P(2,h)+"T"+P(2,y)+":"+P(2,g)+":"+P(2,w)+"."+P(3,x)+"Z"}else a=null;if(n&&(a=n.call(e,t,a)),null===a)return"null";if(u=b.call(a),u==S)return""+a;if(u==E)return a>-1/0&&1/0>a?""+a:"null";if(u==j)return R(""+a);if("object"==typeof a){for(I=s.length;I--;)if(s[I]===a)throw f();if(s.push(a),O=[],L=o,o+=i,u==T){for(k=0,I=a.length;I>k;k++)A=U(k,a,n,r,i,o,s),O.push(A===m?"null":A);M=O.length?i?"[\n"+o+O.join(",\n"+o)+"\n"+L+"]":"["+O.join(",")+"]":"[]"}else v(r||a,function(t){var e=U(t,a,n,r,i,o,s);e!==m&&O.push(R(t)+":"+(i?" ":"")+e)}),M=O.length?i?"{\n"+o+O.join(",\n"+o)+"\n"+L+"}":"{"+O.join(",")+"}":"{}";return s.pop(),M}};e.stringify=function(t,e,n){var r,i,o,a;if(s[typeof e]&&e)if((a=b.call(e))==x)i=e;else if(a==T){o={};for(var u,l=0,c=e.length;c>l;u=e[l++],a=b.call(u),(a==j||a==E)&&(o[u]=1));}if(n)if((a=b.call(n))==E){if((n-=n%1)>0)for(r="",n>10&&(n=10);r.length<n;r+=" ");}else a==j&&(r=n.length<=10?n:n.slice(0,10));return U("",(u={},u[""]=t,u),i,o,r,"",[])}}if(!n("json-parse")){var M,q,D=o.fromCharCode,W={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:"\n",102:"\f",114:"\r"},J=function(){throw M=q=null,c()},B=function(){for(var t,e,n,r,i,o=q,s=o.length;s>M;)switch(i=o.charCodeAt(M)){case 9:case 10:case 13:case 32:M++;break;case 123:case 125:case 91:case 93:case 58:case 44:return t=O?o.charAt(M):o[M],M++,t;case 34:for(t="@",M++;s>M;)if(i=o.charCodeAt(M),32>i)J();else if(92==i)switch(i=o.charCodeAt(++M)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:t+=W[i],M++;break;case 117:for(e=++M,n=M+4;n>M;M++)i=o.charCodeAt(M),i>=48&&57>=i||i>=97&&102>=i||i>=65&&70>=i||J();t+=D("0x"+o.slice(e,M));break;default:J()}else{if(34==i)break;for(i=o.charCodeAt(M),e=M;i>=32&&92!=i&&34!=i;)i=o.charCodeAt(++M);t+=o.slice(e,M)}if(34==o.charCodeAt(M))return M++,t;J();default:if(e=M,45==i&&(r=!0,i=o.charCodeAt(++M)),i>=48&&57>=i){for(48==i&&(i=o.charCodeAt(M+1),i>=48&&57>=i)&&J(),r=!1;s>M&&(i=o.charCodeAt(M),i>=48&&57>=i);M++);if(46==o.charCodeAt(M)){for(n=++M;s>n&&(i=o.charCodeAt(n),i>=48&&57>=i);n++);n==M&&J(),M=n}if(i=o.charCodeAt(M),101==i||69==i){for(i=o.charCodeAt(++M),(43==i||45==i)&&M++,n=M;s>n&&(i=o.charCodeAt(n),i>=48&&57>=i);n++);n==M&&J(),M=n}return+o.slice(e,M)}if(r&&J(),"true"==o.slice(M,M+4))return M+=4,!0;if("false"==o.slice(M,M+5))return M+=5,!1;if("null"==o.slice(M,M+4))return M+=4,null;J()}return"$"},G=function(t){var e,n;if("$"==t&&J(),"string"==typeof t){if("@"==(O?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(e=[];t=B(),"]"!=t;n||(n=!0))n&&(","==t?(t=B(),"]"==t&&J()):J()),","==t&&J(),e.push(G(t));return e}if("{"==t){for(e={};t=B(),"}"!=t;n||(n=!0))n&&(","==t?(t=B(),"}"==t&&J()):J()),(","==t||"string"!=typeof t||"@"!=(O?t.charAt(0):t[0])||":"!=B())&&J(),e[t.slice(1)]=G(B());return e}J()}return t},F=function(t,e,n){var r=H(t,e,n);r===m?delete t[e]:t[e]=r},H=function(t,e,n){var r,i=t[e];if("object"==typeof i&&i)if(b.call(i)==T)for(r=i.length;r--;)F(i,r,n);else v(i,function(t){F(i,t,n)});return n.call(t,e,i)};e.parse=function(t,e){var n,r;return M=0,q=""+t,n=G(B()),"$"!=B()&&J(),M=q=null,e&&b.call(e)==x?H((r={},r[""]=n,r),"",e):n}}}return e.runInContext=i,e}var o="function"==typeof t&&t.amd,s={"function":!0,object:!0},a=s[typeof r]&&r&&!r.nodeType&&r,u=s[typeof window]&&window||this,l=a&&s[typeof n]&&n&&!n.nodeType&&"object"==typeof e&&e;if(!l||l.global!==l&&l.window!==l&&l.self!==l||(u=l),a&&!o)i(u,a);else{var c=u.JSON,f=u.JSON3,h=!1,d=i(u,u.JSON3={noConflict:function(){return h||(h=!0,u.JSON=c,u.JSON3=f,c=f=null),d}});u.JSON={parse:d.parse,stringify:d.stringify}}o&&t(function(){return d})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],56:[function(t,e){"use strict";function n(t){var e=u.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],rest:e[3]?e[3]:""}}function r(t,e,u){if(!(this instanceof r))return new r(t,e,u);var c,f,h,d,p=a.test(t),v=typeof e,m=this,y=0;"object"!==v&&"string"!==v&&(u=e,e=null),u&&"function"!=typeof u&&(u=s.parse),e=o(e);var b=n(t);for(m.protocol=b.protocol||e.protocol||"",m.slashes=b.slashes||e.slashes,t=b.rest;y<l.length;y++)f=l[y],c=f[0],d=f[1],c!==c?m[d]=t:"string"==typeof c?~(h=t.indexOf(c))&&("number"==typeof f[2]?(m[d]=t.slice(0,h),t=t.slice(h+f[2])):(m[d]=t.slice(h),t=t.slice(0,h))):(h=c.exec(t))&&(m[d]=h[1],t=t.slice(0,t.length-h[0].length)),m[d]=m[d]||(f[3]||"port"===d&&p?e[d]||"":""),f[4]&&(m[d]=m[d].toLowerCase());u&&(m.query=u(m.query)),i(m.port,m.protocol)||(m.host=m.hostname,m.port=""),m.username=m.password="",m.auth&&(f=m.auth.split(":"),m.username=f[0]||"",m.password=f[1]||""),m.href=m.toString()}var i=t("requires-port"),o=t("./lolcation"),s=t("querystringify"),a=/^\/(?!\/)/,u=/^([a-z0-9.+-]+:)?(\/\/)?(.*)$/i,l=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[0/0,"host",void 0,1,1],[/\:(\d+)$/,"port"],[0/0,"hostname",void 0,1,1]];r.prototype.set=function(t,e,n){var r=this;return"query"===t?("string"==typeof e&&e.length&&(e=(n||s.parse)(e)),r[t]=e):"port"===t?(r[t]=e,i(e,r.protocol)?e&&(r.host=r.hostname+":"+e):(r.host=r.hostname,r[t]="")):"hostname"===t?(r[t]=e,r.port&&(e+=":"+r.port),r.host=e):"host"===t?(r[t]=e,/\:\d+/.test(e)&&(e=e.split(":"),r.hostname=e[0],r.port=e[1])):"protocol"===t?(r.protocol=e,r.slashes=!n):r[t]=e,r.href=r.toString(),r},r.prototype.toString=function(t){t&&"function"==typeof t||(t=s.stringify);var e,n=this,r=n.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var i=r+(n.slashes?"//":"");return n.username&&(i+=n.username,n.password&&(i+=":"+n.password),i+="@"),i+=n.hostname,n.port&&(i+=":"+n.port),i+=n.pathname,e="object"==typeof n.query?t(n.query):n.query,e&&(i+="?"!==e.charAt(0)?"?"+e:e),n.hash&&(i+=n.hash),i},r.qs=s,r.location=o,e.exports=r},{"./lolcation":57,querystringify:58,"requires-port":59}],57:[function(t,e){(function(n){"use strict";var r,i=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,o={hash:1,query:1};e.exports=function(e){e=e||n.location||{},r=r||t("./");var s,a={},u=typeof e;if("blob:"===e.protocol)a=new r(unescape(e.pathname),{});else if("string"===u){a=new r(e,{});for(s in o)delete a[s]}else if("object"===u){for(s in e)s in o||(a[s]=e[s]);void 0===a.slashes&&(a.slashes=i.test(e.href))}return a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./":56}],58:[function(t,e,n){"use strict";function r(t){for(var e,n=/([^=?&]+)=([^&]*)/g,r={};e=n.exec(t);r[decodeURIComponent(e[1])]=decodeURIComponent(e[2]));return r}function i(t,e){e=e||"";var n=[];"string"!=typeof e&&(e="?");for(var r in t)o.call(t,r)&&n.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return n.length?e+n.join("&"):""}var o=Object.prototype.hasOwnProperty;n.stringify=i,n.parse=r},{}],59:[function(t,e){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],t=+t,!t)return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}]},{},[1])(1)}); | |
| 0 | 4 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/plugins/layer-v2.2/doc/layer交流.url deleted
100644 → 0
src/main/resources/static/assets/plugins/layer-v2.2/doc/layer官网.url deleted
100644 → 0
src/main/resources/static/assets/plugins/layer-v2.2/layer/extend/layer.ext.js deleted
100644 → 0
| 1 | -/*! layer弹层组件拓展类 */ | |
| 2 | -;!function(){layer.use("skin/layer.ext.css",function(){layer.layui_layer_extendlayerextjs=!0});var a=layer.cache||{},b=function(b){return a.skin?" "+a.skin+" "+a.skin+"-"+b:""};layer.prompt=function(a,c){a=a||{},"function"==typeof a&&(c=a);var d,e=2==a.formType?'<textarea class="layui-layer-input">'+(a.value||"")+"</textarea>":function(){return'<input type="'+(1==a.formType?"password":"text")+'" class="layui-layer-input" value="'+(a.value||"")+'">'}();return layer.open($.extend({btn:["确定","取消"],content:e,skin:"layui-layer-prompt"+b("prompt"),success:function(a){d=a.find(".layui-layer-input"),d.focus()},yes:function(b){var e=d.val();""===e?d.focus():e.length>(a.maxlength||500)?layer.tips("最多输入"+(a.maxlength||500)+"个字数",d,{tips:1}):c&&c(e,b,d)}},a))},layer.tab=function(a){a=a||{};var c=a.tab||{};return layer.open($.extend({type:1,skin:"layui-layer-tab"+b("tab"),title:function(){var a=c.length,b=1,d="";if(a>0)for(d='<span class="layui-layer-tabnow">'+c[0].title+"</span>";a>b;b++)d+="<span>"+c[b].title+"</span>";return d}(),content:'<ul class="layui-layer-tabmain">'+function(){var a=c.length,b=1,d="";if(a>0)for(d='<li class="layui-layer-tabli xubox_tab_layer">'+(c[0].content||"no content")+"</li>";a>b;b++)d+='<li class="layui-layer-tabli">'+(c[b].content||"no content")+"</li>";return d}()+"</ul>",success:function(b){var c=b.find(".layui-layer-title").children(),d=b.find(".layui-layer-tabmain").children();c.on("mousedown",function(b){b.stopPropagation?b.stopPropagation():b.cancelBubble=!0;var c=$(this),e=c.index();c.addClass("layui-layer-tabnow").siblings().removeClass("layui-layer-tabnow"),d.eq(e).show().siblings().hide(),"function"==typeof a.change&&a.change(e)})}},a))},layer.photos=function(a,c,d){function e(a,b,c){var d=new Image;d.onload=function(){d.onload=null,b(d)},d.onerror=function(a){d.onerror=null,c(a)},d.src=a}var f={};if(a=a||{},a.photos){var g=a.photos.constructor===Object,h=g?a.photos:{},i=h.data||[],j=h.start||0;if(f.imgIndex=j+1,g){if(0===i.length)return layer.msg("没有图片")}else{var k=$(a.photos),l=function(){return i=[],k.find(a.img||"img").each(function(a){var b=$(this);i.push({alt:b.attr("alt"),pid:b.attr("layer-pid"),src:b.attr("layer-src")||b.attr("src"),thumb:b.attr("src")})}),arguments.callee}();if(0===i.length)return;if(c||k.on("click",a.img||"img",function(){var b=$(this),c=b.index();l(),layer.photos($.extend(a,{photos:{start:c,data:i,tab:a.tab},full:a.full}),!0)}),!c)return}f.imgprev=function(a){f.imgIndex--,f.imgIndex<1&&(f.imgIndex=i.length),f.tabimg(a)},f.imgnext=function(a,b){f.imgIndex++,f.imgIndex>i.length&&(f.imgIndex=1,b)||f.tabimg(a)},f.keyup=function(a){if(!f.end){var b=a.keyCode;a.preventDefault(),37===b?f.imgprev(!0):39===b?f.imgnext(!0):27===b&&layer.close(f.index)}},f.tabimg=function(b){i.length<=1||(h.start=f.imgIndex-1,layer.close(f.index),layer.photos(a,!0,b))},f.event=function(){f.bigimg.hover(function(){f.imgsee.show()},function(){f.imgsee.hide()}),f.bigimg.find(".layui-layer-imgprev").on("click",function(a){a.preventDefault(),f.imgprev()}),f.bigimg.find(".layui-layer-imgnext").on("click",function(a){a.preventDefault(),f.imgnext()}),$(document).on("keyup",f.keyup)},f.loadi=layer.load(1,{shade:"shade"in a?!1:.9,scrollbar:!1}),e(i[j].src,function(c){layer.close(f.loadi),f.index=layer.open($.extend({type:1,area:function(){var b=[c.width,c.height],d=[$(window).width()-100,$(window).height()-100];return!a.full&&b[0]>d[0]&&(b[0]=d[0],b[1]=b[0]*d[1]/b[0]),[b[0]+"px",b[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,shift:5*Math.random()|0,skin:"layui-layer-photos"+b("photos"),content:'<div class="layui-layer-phimg"><img src="'+i[j].src+'" alt="'+(i[j].alt||"")+'" layer-pid="'+i[j].pid+'"><div class="layui-layer-imgsee">'+(i.length>1?'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>':"")+'<div class="layui-layer-imgbar" style="display:'+(d?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(i[j].alt||"")+"</a><em>"+f.imgIndex+"/"+i.length+"</em></span></div></div></div>",success:function(b,c){f.bigimg=b.find(".layui-layer-phimg"),f.imgsee=b.find(".layui-layer-imguide,.layui-layer-imgbar"),f.event(b),a.tab&&a.tab(i[j],b)},end:function(){f.end=!0,$(document).off("keyup",f.keyup)}},a))},function(){layer.close(f.loadi),layer.msg("当前图片地址异常<br>是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){i.length>1&&f.imgnext(!0,!0)}})})}}}(); | |
| 3 | 0 | \ No newline at end of file |
src/main/resources/static/assets/plugins/layer-v2.2/layer/layer.js deleted
100644 → 0
| 1 | -/*! layer-v2.2 弹层组件 License LGPL http://layer.layui.com/ By 贤心 */ | |
| 2 | -;!function(a,b){"use strict";var c,d,e={getPath:function(){var a=document.scripts,b=a[a.length-1],c=b.src;if(!b.getAttribute("merge"))return c.substring(0,c.lastIndexOf("/")+1)}(),enter:function(a){13===a.keyCode&&a.preventDefault()},config:{},end:{},btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"]},f={v:"2.2",ie6:!!a.ActiveXObject&&!a.XMLHttpRequest,index:0,path:e.getPath,config:function(a,b){var d=0;return a=a||{},f.cache=e.config=c.extend(e.config,a),f.path=e.config.path||f.path,"string"==typeof a.extend&&(a.extend=[a.extend]),f.use("skin/layer.css",a.extend&&a.extend.length>0?function g(){var c=a.extend;f.use(c[c[d]?d:d-1],d<c.length?function(){return++d,g}():b)}():b),this},use:function(a,b,d){var e=c("head")[0],a=a.replace(/\s/g,""),g=/\.css$/.test(a),h=document.createElement(g?"link":"script"),i="layui_layer_"+a.replace(/\.|\//g,"");return f.path?(g&&(h.rel="stylesheet"),h[g?"href":"src"]=/^http:\/\//.test(a)?a:f.path+a,h.id=i,c("#"+i)[0]||e.appendChild(h),function j(){(g?1989===parseInt(c("#"+i).css("width")):f[d||i])?function(){b&&b();try{g||e.removeChild(h)}catch(a){}}():setTimeout(j,100)}(),this):void 0},ready:function(a,b){var d="function"==typeof a;return d&&(b=a),f.config(c.extend(e.config,function(){return d?{}:{path:a}}()),b),this},alert:function(a,b,d){var e="function"==typeof b;return e&&(d=b),f.open(c.extend({content:a,yes:d},e?{}:b))},confirm:function(a,b,d,g){var h="function"==typeof b;return h&&(g=d,d=b),f.open(c.extend({content:a,btn:e.btn,yes:d,cancel:g},h?{}:b))},msg:function(a,d,g){var i="function"==typeof d,j=e.config.skin,k=(j?j+" "+j+"-msg":"")||"layui-layer-msg",l=h.anim.length-1;return i&&(g=d),f.open(c.extend({content:a,time:3e3,shade:!1,skin:k,title:!1,closeBtn:!1,btn:!1,end:g},i&&!e.config.skin?{skin:k+" layui-layer-hui",shift:l}:function(){return d=d||{},(-1===d.icon||d.icon===b&&!e.config.skin)&&(d.skin=k+" "+(d.skin||"layui-layer-hui")),d}()))},load:function(a,b){return f.open(c.extend({type:3,icon:a||0,shade:.01},b))},tips:function(a,b,d){return f.open(c.extend({type:4,content:[a,b],closeBtn:!1,time:3e3,shade:!1,maxWidth:210},d))}},g=function(a){var b=this;b.index=++f.index,b.config=c.extend({},b.config,e.config,a),b.creat()};g.pt=g.prototype;var h=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];h.anim=["layui-anim","layui-anim-01","layui-anim-02","layui-anim-03","layui-anim-04","layui-anim-05","layui-anim-06"],g.pt.config={type:0,shade:.3,fix:!0,move:h[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,shift:0,icon:-1,scrollbar:!0,tips:2},g.pt.vessel=function(a,b){var c=this,d=c.index,f=c.config,g=f.zIndex+d,i="object"==typeof f.title,j=f.maxmin&&(1===f.type||2===f.type),k=f.title?'<div class="layui-layer-title" style="'+(i?f.title[1]:"")+'">'+(i?f.title[0]:f.title)+"</div>":"";return f.zIndex=g,b([f.shade?'<div class="layui-layer-shade" id="layui-layer-shade'+d+'" times="'+d+'" style="'+("z-index:"+(g-1)+"; background-color:"+(f.shade[1]||"#000")+"; opacity:"+(f.shade[0]||f.shade)+"; filter:alpha(opacity="+(100*f.shade[0]||100*f.shade)+");")+'"></div>':"",'<div class="'+h[0]+" "+(h.anim[f.shift]||"")+(" layui-layer-"+e.type[f.type])+(0!=f.type&&2!=f.type||f.shade?"":" layui-layer-border")+" "+(f.skin||"")+'" id="'+h[0]+d+'" type="'+e.type[f.type]+'" times="'+d+'" showtime="'+f.time+'" conType="'+(a?"object":"string")+'" style="z-index: '+g+"; width:"+f.area[0]+";height:"+f.area[1]+(f.fix?"":";position:absolute;")+'">'+(a&&2!=f.type?"":k)+'<div id="'+(f.id||"")+'" class="layui-layer-content'+(0==f.type&&-1!==f.icon?" layui-layer-padding":"")+(3==f.type?" layui-layer-loading"+f.icon:"")+'">'+(0==f.type&&-1!==f.icon?'<i class="layui-layer-ico layui-layer-ico'+f.icon+'"></i>':"")+(1==f.type&&a?"":f.content||"")+'</div><span class="layui-layer-setwin">'+function(){var a=j?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return f.closeBtn&&(a+='<a class="layui-layer-ico '+h[7]+" "+h[7]+(f.title?f.closeBtn:4==f.type?"1":"2")+'" href="javascript:;"></a>'),a}()+"</span>"+(f.btn?function(){var a="";"string"==typeof f.btn&&(f.btn=[f.btn]);for(var b=0,c=f.btn.length;c>b;b++)a+='<a class="'+h[6]+b+'">'+f.btn[b]+"</a>";return'<div class="'+h[6]+'">'+a+"</div>"}():"")+"</div>"],k),c},g.pt.creat=function(){var a=this,b=a.config,g=a.index,i=b.content,j="object"==typeof i;if(!c("#"+b.id)[0]){switch("string"==typeof b.area&&(b.area="auto"===b.area?["",""]:[b.area,""]),b.type){case 0:b.btn="btn"in b?b.btn:e.btn[0],f.closeAll("dialog");break;case 2:var i=b.content=j?b.content:[b.content||"http://layer.layui.com","auto"];b.content='<iframe scrolling="'+(b.content[1]||"auto")+'" allowtransparency="true" id="'+h[4]+g+'" name="'+h[4]+g+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+b.content[0]+'"></iframe>';break;case 3:b.title=!1,b.closeBtn=!1,-1===b.icon&&0===b.icon,f.closeAll("loading");break;case 4:j||(b.content=[b.content,"body"]),b.follow=b.content[1],b.content=b.content[0]+'<i class="layui-layer-TipsG"></i>',b.title=!1,b.fix=!1,b.tips="object"==typeof b.tips?b.tips:[b.tips,!0],b.tipsMore||f.closeAll("tips")}a.vessel(j,function(d,e){c("body").append(d[0]),j?function(){2==b.type||4==b.type?function(){c("body").append(d[1])}():function(){i.parents("."+h[0])[0]||(i.show().addClass("layui-layer-wrap").wrap(d[1]),c("#"+h[0]+g).find("."+h[5]).before(e))}()}():c("body").append(d[1]),a.layero=c("#"+h[0]+g),b.scrollbar||h.html.css("overflow","hidden").attr("layer-full",g)}).auto(g),2==b.type&&f.ie6&&a.layero.find("iframe").attr("src",i[0]),c(document).off("keydown",e.enter).on("keydown",e.enter),a.layero.on("keydown",function(a){c(document).off("keydown",e.enter)}),4==b.type?a.tips():a.offset(),b.fix&&d.on("resize",function(){a.offset(),(/^\d+%$/.test(b.area[0])||/^\d+%$/.test(b.area[1]))&&a.auto(g),4==b.type&&a.tips()}),b.time<=0||setTimeout(function(){f.close(a.index)},b.time),a.move().callback()}},g.pt.auto=function(a){function b(a){a=g.find(a),a.height(i[1]-j-k-2*(0|parseFloat(a.css("padding"))))}var e=this,f=e.config,g=c("#"+h[0]+a);""===f.area[0]&&f.maxWidth>0&&(/MSIE 7/.test(navigator.userAgent)&&f.btn&&g.width(g.innerWidth()),g.outerWidth()>f.maxWidth&&g.width(f.maxWidth));var i=[g.innerWidth(),g.innerHeight()],j=g.find(h[1]).outerHeight()||0,k=g.find("."+h[6]).outerHeight()||0;switch(f.type){case 2:b("iframe");break;default:""===f.area[1]?f.fix&&i[1]>=d.height()&&(i[1]=d.height(),b("."+h[5])):b("."+h[5])}return e},g.pt.offset=function(){var a=this,b=a.config,c=a.layero,e=[c.outerWidth(),c.outerHeight()],f="object"==typeof b.offset;a.offsetTop=(d.height()-e[1])/2,a.offsetLeft=(d.width()-e[0])/2,f?(a.offsetTop=b.offset[0],a.offsetLeft=b.offset[1]||a.offsetLeft):"auto"!==b.offset&&(a.offsetTop=b.offset,"rb"===b.offset&&(a.offsetTop=d.height()-e[1],a.offsetLeft=d.width()-e[0])),b.fix||(a.offsetTop=/%$/.test(a.offsetTop)?d.height()*parseFloat(a.offsetTop)/100:parseFloat(a.offsetTop),a.offsetLeft=/%$/.test(a.offsetLeft)?d.width()*parseFloat(a.offsetLeft)/100:parseFloat(a.offsetLeft),a.offsetTop+=d.scrollTop(),a.offsetLeft+=d.scrollLeft()),c.css({top:a.offsetTop,left:a.offsetLeft})},g.pt.tips=function(){var a=this,b=a.config,e=a.layero,f=[e.outerWidth(),e.outerHeight()],g=c(b.follow);g[0]||(g=c("body"));var i={width:g.outerWidth(),height:g.outerHeight(),top:g.offset().top,left:g.offset().left},j=e.find(".layui-layer-TipsG"),k=b.tips[0];b.tips[1]||j.remove(),i.autoLeft=function(){i.left+f[0]-d.width()>0?(i.tipLeft=i.left+i.width-f[0],j.css({right:12,left:"auto"})):i.tipLeft=i.left},i.where=[function(){i.autoLeft(),i.tipTop=i.top-f[1]-10,j.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",b.tips[1])},function(){i.tipLeft=i.left+i.width+10,i.tipTop=i.top,j.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",b.tips[1])},function(){i.autoLeft(),i.tipTop=i.top+i.height+10,j.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",b.tips[1])},function(){i.tipLeft=i.left-f[0]-10,i.tipTop=i.top,j.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",b.tips[1])}],i.where[k-1](),1===k?i.top-(d.scrollTop()+f[1]+16)<0&&i.where[2]():2===k?d.width()-(i.left+i.width+f[0]+16)>0||i.where[3]():3===k?i.top-d.scrollTop()+i.height+f[1]+16-d.height()>0&&i.where[0]():4===k&&f[0]+16-i.left>0&&i.where[1](),e.find("."+h[5]).css({"background-color":b.tips[1],"padding-right":b.closeBtn?"30px":""}),e.css({left:i.tipLeft,top:i.tipTop})},g.pt.move=function(){var a=this,b=a.config,e={setY:0,moveLayer:function(){var a=e.layero,b=parseInt(a.css("margin-left")),c=parseInt(e.move.css("left"));0===b||(c-=b),"fixed"!==a.css("position")&&(c-=a.parent().offset().left,e.setY=0),a.css({left:c,top:parseInt(e.move.css("top"))-e.setY})}},f=a.layero.find(b.move);return b.move&&f.attr("move","ok"),f.css({cursor:b.move?"move":"auto"}),c(b.move).on("mousedown",function(a){if(a.preventDefault(),"ok"===c(this).attr("move")){e.ismove=!0,e.layero=c(this).parents("."+h[0]);var f=e.layero.offset().left,g=e.layero.offset().top,i=e.layero.outerWidth()-6,j=e.layero.outerHeight()-6;c("#layui-layer-moves")[0]||c("body").append('<div id="layui-layer-moves" class="layui-layer-moves" style="left:'+f+"px; top:"+g+"px; width:"+i+"px; height:"+j+'px; z-index:2147483584"></div>'),e.move=c("#layui-layer-moves"),b.moveType&&e.move.css({visibility:"hidden"}),e.moveX=a.pageX-e.move.position().left,e.moveY=a.pageY-e.move.position().top,"fixed"!==e.layero.css("position")||(e.setY=d.scrollTop())}}),c(document).mousemove(function(a){if(e.ismove){var c=a.pageX-e.moveX,f=a.pageY-e.moveY;if(a.preventDefault(),!b.moveOut){e.setY=d.scrollTop();var g=d.width()-e.move.outerWidth(),h=e.setY;0>c&&(c=0),c>g&&(c=g),h>f&&(f=h),f>d.height()-e.move.outerHeight()+e.setY&&(f=d.height()-e.move.outerHeight()+e.setY)}e.move.css({left:c,top:f}),b.moveType&&e.moveLayer(),c=f=g=h=null}}).mouseup(function(){try{e.ismove&&(e.moveLayer(),e.move.remove(),b.moveEnd&&b.moveEnd()),e.ismove=!1}catch(a){e.ismove=!1}}),a},g.pt.callback=function(){function a(){var a=g.cancel&&g.cancel(b.index);a===!1||f.close(b.index)}var b=this,d=b.layero,g=b.config;b.openLayer(),g.success&&(2==g.type?d.find("iframe").on("load",function(){g.success(d,b.index)}):g.success(d,b.index)),f.ie6&&b.IE6(d),d.find("."+h[6]).children("a").on("click",function(){var e=c(this).index();g["btn"+(e+1)]&&g["btn"+(e+1)](b.index,d),0===e?g.yes?g.yes(b.index,d):f.close(b.index):1===e?a():g["btn"+(e+1)]||f.close(b.index)}),d.find("."+h[7]).on("click",a),g.shadeClose&&c("#layui-layer-shade"+b.index).on("click",function(){f.close(b.index)}),d.find(".layui-layer-min").on("click",function(){f.min(b.index,g),g.min&&g.min(d)}),d.find(".layui-layer-max").on("click",function(){c(this).hasClass("layui-layer-maxmin")?(f.restore(b.index),g.restore&&g.restore(d)):(f.full(b.index,g),g.full&&g.full(d))}),g.end&&(e.end[b.index]=g.end)},e.reselect=function(){c.each(c("select"),function(a,b){var d=c(this);d.parents("."+h[0])[0]||1==d.attr("layer")&&c("."+h[0]).length<1&&d.removeAttr("layer").show(),d=null})},g.pt.IE6=function(a){function b(){a.css({top:f+(e.config.fix?d.scrollTop():0)})}var e=this,f=a.offset().top;b(),d.scroll(b),c("select").each(function(a,b){var d=c(this);d.parents("."+h[0])[0]||"none"===d.css("display")||d.attr({layer:"1"}).hide(),d=null})},g.pt.openLayer=function(){var a=this;f.zIndex=a.config.zIndex,f.setTop=function(a){var b=function(){f.zIndex++,a.css("z-index",f.zIndex+1)};return f.zIndex=parseInt(a[0].style.zIndex),a.on("mousedown",b),f.zIndex}},e.record=function(a){var b=[a.outerWidth(),a.outerHeight(),a.position().top,a.position().left+parseFloat(a.css("margin-left"))];a.find(".layui-layer-max").addClass("layui-layer-maxmin"),a.attr({area:b})},e.rescollbar=function(a){h.html.attr("layer-full")==a&&(h.html[0].style.removeProperty?h.html[0].style.removeProperty("overflow"):h.html[0].style.removeAttribute("overflow"),h.html.removeAttr("layer-full"))},a.layer=f,f.getChildFrame=function(a,b){return b=b||c("."+h[4]).attr("times"),c("#"+h[0]+b).find("iframe").contents().find(a)},f.getFrameIndex=function(a){return c("#"+a).parents("."+h[4]).attr("times")},f.iframeAuto=function(a){if(a){var b=f.getChildFrame("html",a).outerHeight(),d=c("#"+h[0]+a),e=d.find(h[1]).outerHeight()||0,g=d.find("."+h[6]).outerHeight()||0;d.css({height:b+e+g}),d.find("iframe").css({height:b})}},f.iframeSrc=function(a,b){c("#"+h[0]+a).find("iframe").attr("src",b)},f.style=function(a,b){var d=c("#"+h[0]+a),f=d.attr("type"),g=d.find(h[1]).outerHeight()||0,i=d.find("."+h[6]).outerHeight()||0;(f===e.type[1]||f===e.type[2])&&(d.css(b),f===e.type[2]&&d.find("iframe").css({height:parseFloat(b.height)-g-i}))},f.min=function(a,b){var d=c("#"+h[0]+a),g=d.find(h[1]).outerHeight()||0;e.record(d),f.style(a,{width:180,height:g,overflow:"hidden"}),d.find(".layui-layer-min").hide(),"page"===d.attr("type")&&d.find(h[4]).hide(),e.rescollbar(a)},f.restore=function(a){var b=c("#"+h[0]+a),d=b.attr("area").split(",");b.attr("type");f.style(a,{width:parseFloat(d[0]),height:parseFloat(d[1]),top:parseFloat(d[2]),left:parseFloat(d[3]),overflow:"visible"}),b.find(".layui-layer-max").removeClass("layui-layer-maxmin"),b.find(".layui-layer-min").show(),"page"===b.attr("type")&&b.find(h[4]).show(),e.rescollbar(a)},f.full=function(a){var b,g=c("#"+h[0]+a);e.record(g),h.html.attr("layer-full")||h.html.css("overflow","hidden").attr("layer-full",a),clearTimeout(b),b=setTimeout(function(){var b="fixed"===g.css("position");f.style(a,{top:b?0:d.scrollTop(),left:b?0:d.scrollLeft(),width:d.width(),height:d.height()}),g.find(".layui-layer-min").hide()},100)},f.title=function(a,b){var d=c("#"+h[0]+(b||f.index)).find(h[1]);d.html(a)},f.close=function(a){var b=c("#"+h[0]+a),d=b.attr("type");if(b[0]){if(d===e.type[1]&&"object"===b.attr("conType")){b.children(":not(."+h[5]+")").remove();for(var g=0;2>g;g++)b.find(".layui-layer-wrap").unwrap().hide()}else{if(d===e.type[2])try{var i=c("#"+h[4]+a)[0];i.contentWindow.document.write(""),i.contentWindow.close(),b.find("."+h[5])[0].removeChild(i)}catch(j){}b[0].innerHTML="",b.remove()}c("#layui-layer-moves, #layui-layer-shade"+a).remove(),f.ie6&&e.reselect(),e.rescollbar(a),c(document).off("keydown",e.enter),"function"==typeof e.end[a]&&e.end[a](),delete e.end[a]}},f.closeAll=function(a){c.each(c("."+h[0]),function(){var b=c(this),d=a?b.attr("type")===a:1;d&&f.close(b.attr("times")),d=null})},e.run=function(){c=jQuery,d=c(a),h.html=c("html"),f.open=function(a){var b=new g(a);return b.index}},"function"==typeof define?define(function(){return e.run(),f}):function(){e.run(),f.use("skin/layer.css")}()}(window); | |
| 3 | 0 | \ No newline at end of file |
src/main/resources/static/assets/plugins/layer-v2.2/layer/skin/layer.css deleted
100644 → 0
| 1 | -/*! | |
| 2 | - | |
| 3 | - @Name: layer's style | |
| 4 | - @Author: 贤心 | |
| 5 | - @Blog: sentsin.com | |
| 6 | - | |
| 7 | - */*html{background-image:url(about:blank);background-attachment:fixed}html #layui_layer_skinlayercss{display:none;position:absolute;width:1989px}.layui-layer,.layui-layer-shade{position:fixed;_position:absolute;pointer-events:auto}.layui-layer-shade{top:0;left:0;width:100%;height:100%;_height:expression(document.body.offsetHeight+"px")}.layui-layer{top:150px;left:50%;margin:0;padding:0;background-color:#fff;-webkit-background-clip:content;box-shadow:1px 1px 50px rgba(0,0,0,.3);border-radius:2px;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.3s;animation-duration:.3s}.layui-layer-close{position:absolute}.layui-layer-content{position:relative}.layui-layer-border{border:1px solid #B2B2B2;border:1px solid rgba(0,0,0,.3);box-shadow:1px 1px 5px rgba(0,0,0,.2)}.layui-layer-moves{position:absolute;border:3px solid #666;border:3px solid rgba(0,0,0,.5);cursor:move;background-color:#fff;background-color:rgba(255,255,255,.3);filter:alpha(opacity=50)}.layui-layer-load{background:url(default/loading-0.gif) center center no-repeat #fff}.layui-layer-ico{background:url(default/icon.png) no-repeat}.layui-layer-btn a,.layui-layer-dialog .layui-layer-ico,.layui-layer-setwin a{display:inline-block;*display:inline;*zoom:1;vertical-align:top}@-webkit-keyframes bounceIn{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes bounceIn{0%{opacity:0;-webkit-transform:scale(.5);-ms-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layui-anim{-webkit-animation-name:bounceIn;animation-name:bounceIn}@-webkit-keyframes bounceOut{100%{opacity:0;-webkit-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.03);transform:scale(1.03)}0%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes bounceOut{100%{opacity:0;-webkit-transform:scale(.7);-ms-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.03);-ms-transform:scale(1.03);transform:scale(1.03)}0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layui-anim-close{-webkit-animation-name:bounceOut;animation-name:bounceOut;-webkit-animation-duration:.2s;animation-duration:.2s}@-webkit-keyframes zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layui-anim-01{-webkit-animation-name:zoomInDown;animation-name:zoomInDown}@-webkit-keyframes fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layui-anim-02{-webkit-animation-name:fadeInUpBig;animation-name:fadeInUpBig}@-webkit-keyframes zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layui-anim-03{-webkit-animation-name:zoomInLeft;animation-name:zoomInLeft}@-webkit-keyframes rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}@keyframes rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);-ms-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}.layui-anim-04{-webkit-animation-name:rollIn;animation-name:rollIn}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}.layui-anim-05{-webkit-animation-name:fadeIn;animation-name:fadeIn}@-webkit-keyframes shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layui-anim-06{-webkit-animation-name:shake;animation-name:shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}.layui-layer-title{padding:0 80px 0 20px;height:42px;line-height:42px;border-bottom:1px solid #eee;font-size:14px;color:#333;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background-color:#F8F8F8;border-radius:2px 2px 0 0}.layui-layer-setwin{position:absolute;right:15px;*right:0;top:15px;font-size:0;line-height:initial}.layui-layer-setwin a{position:relative;width:16px;height:16px;margin-left:10px;font-size:12px;_overflow:hidden}.layui-layer-setwin .layui-layer-min cite{position:absolute;width:14px;height:2px;left:0;top:50%;margin-top:-1px;background-color:#2E2D3C;cursor:pointer;_overflow:hidden}.layui-layer-setwin .layui-layer-min:hover cite{background-color:#2D93CA}.layui-layer-setwin .layui-layer-max{background-position:-32px -40px}.layui-layer-setwin .layui-layer-max:hover{background-position:-16px -40px}.layui-layer-setwin .layui-layer-maxmin{background-position:-65px -40px}.layui-layer-setwin .layui-layer-maxmin:hover{background-position:-49px -40px}.layui-layer-setwin .layui-layer-close1{background-position:0 -40px;cursor:pointer}.layui-layer-setwin .layui-layer-close1:hover{opacity:.7}.layui-layer-setwin .layui-layer-close2{position:absolute;right:-28px;top:-28px;width:30px;height:30px;margin-left:0;background-position:-149px -31px;*right:-18px;_display:none}.layui-layer-setwin .layui-layer-close2:hover{background-position:-180px -31px}.layui-layer-btn{text-align:right;padding:0 10px 12px;pointer-events:auto}.layui-layer-btn a{height:28px;line-height:28px;margin:0 6px;padding:0 15px;border:1px solid #dedede;background-color:#f1f1f1;color:#333;border-radius:2px;font-weight:400;cursor:pointer;text-decoration:none}.layui-layer-btn a:hover{opacity:.9;text-decoration:none}.layui-layer-btn a:active{opacity:.7}.layui-layer-btn .layui-layer-btn0{border-color:#4898d5;background-color:#2e8ded;color:#fff}.layui-layer-dialog{min-width:260px}.layui-layer-dialog .layui-layer-content{position:relative;padding:20px;line-height:24px;word-break:break-all;font-size:14px;overflow:auto}.layui-layer-dialog .layui-layer-content .layui-layer-ico{position:absolute;top:16px;left:15px;_left:-40px;width:30px;height:30px}.layui-layer-ico1{background-position:-30px 0}.layui-layer-ico2{background-position:-60px 0}.layui-layer-ico3{background-position:-90px 0}.layui-layer-ico4{background-position:-120px 0}.layui-layer-ico5{background-position:-150px 0}.layui-layer-ico6{background-position:-180px 0}.layui-layer-rim{border:6px solid #8D8D8D;border:6px solid rgba(0,0,0,.3);border-radius:5px;box-shadow:none}.layui-layer-msg{min-width:180px;border:1px solid #D3D4D3;box-shadow:none}.layui-layer-hui{min-width:100px;background-color:#000;filter:alpha(opacity=60);background-color:rgba(0,0,0,.6);color:#fff;border:none}.layui-layer-hui .layui-layer-content{padding:12px 25px;text-align:center}.layui-layer-dialog .layui-layer-padding{padding:20px 20px 20px 55px;text-align:left}.layui-layer-page .layui-layer-content{position:relative;overflow:auto}.layui-layer-iframe .layui-layer-btn,.layui-layer-page .layui-layer-btn{padding-top:10px}.layui-layer-nobg{background:0 0}.layui-layer-iframe .layui-layer-content{overflow:hidden}.layui-layer-iframe iframe{display:block;width:100%}.layui-layer-loading{border-radius:100%;background:0 0;box-shadow:none;border:none}.layui-layer-loading .layui-layer-content{width:60px;height:24px;background:url(default/loading-0.gif) no-repeat}.layui-layer-loading .layui-layer-loading1{width:37px;height:37px;background:url(default/loading-1.gif) no-repeat}.layui-layer-ico16,.layui-layer-loading .layui-layer-loading2{width:32px;height:32px;background:url(default/loading-2.gif) no-repeat}.layui-layer-tips{background:0 0;box-shadow:none;border:none}.layui-layer-tips .layui-layer-content{position:relative;line-height:22px;min-width:12px;padding:5px 10px;font-size:12px;_float:left;border-radius:3px;box-shadow:1px 1px 3px rgba(0,0,0,.3);background-color:#F90;color:#fff}.layui-layer-tips .layui-layer-close{right:-2px;top:-1px}.layui-layer-tips i.layui-layer-TipsG{position:absolute;width:0;height:0;border-width:8px;border-color:transparent;border-style:dashed;*overflow:hidden}.layui-layer-tips i.layui-layer-TipsB,.layui-layer-tips i.layui-layer-TipsT{left:5px;border-right-style:solid;border-right-color:#F90}.layui-layer-tips i.layui-layer-TipsT{bottom:-8px}.layui-layer-tips i.layui-layer-TipsB{top:-8px}.layui-layer-tips i.layui-layer-TipsL,.layui-layer-tips i.layui-layer-TipsR{top:1px;border-bottom-style:solid;border-bottom-color:#F90}.layui-layer-tips i.layui-layer-TipsR{left:-8px}.layui-layer-tips i.layui-layer-TipsL{right:-8px}.layui-layer-lan[type=dialog]{min-width:280px}.layui-layer-lan .layui-layer-title{background:#4476A7;color:#fff;border:none}.layui-layer-lan .layui-layer-btn{padding:10px;text-align:right;border-top:1px solid #E9E7E7}.layui-layer-lan .layui-layer-btn a{background:#BBB5B5;border:none}.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5}.layui-layer-molv .layui-layer-title{background:#009f95;color:#fff;border:none}.layui-layer-molv .layui-layer-btn a{background:#009f95}.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1} | |
| 8 | 0 | \ No newline at end of file |
src/main/resources/static/assets/plugins/layer-v2.2/layer/skin/layer.ext.css deleted
100644 → 0
| 1 | -/*! | |
| 2 | - | |
| 3 | - @Name: layer拓展样式 | |
| 4 | - @Date: 2012.12.13 | |
| 5 | - @Author: 贤心 | |
| 6 | - @blog: sentsin.com | |
| 7 | - | |
| 8 | - */.layui-layer-imgbar,.layui-layer-imgtit a,.layui-layer-tab .layui-layer-title span{text-overflow:ellipsis;white-space:nowrap}.layui-layer-iconext{background:url(default/icon-ext.png) no-repeat}html #layui_layer_skinlayerextcss{display:none;position:absolute;width:1989px}.layui-layer-prompt .layui-layer-input{display:block;width:220px;height:30px;margin:0 auto;line-height:30px;padding:0 5px;border:1px solid #ccc;box-shadow:1px 1px 5px rgba(0,0,0,.1) inset;color:#333}.layui-layer-prompt textarea.layui-layer-input{width:300px;height:100px;line-height:20px}.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4)}.layui-layer-tab .layui-layer-title{padding-left:0;border-bottom:1px solid #ccc;background-color:#eee;overflow:visible}.layui-layer-tab .layui-layer-title span{position:relative;float:left;min-width:80px;max-width:260px;padding:0 20px;text-align:center;cursor:default;overflow:hidden}.layui-layer-tab .layui-layer-title span.layui-layer-tabnow{height:43px;border-left:1px solid #ccc;border-right:1px solid #ccc;background-color:#fff;z-index:10}.layui-layer-tab .layui-layer-title span:first-child{border-left:none}.layui-layer-tabmain{line-height:24px;clear:both}.layui-layer-tabmain .layui-layer-tabli{display:none}.layui-layer-tabmain .layui-layer-tabli.xubox_tab_layer{display:block}.xubox_tabclose{position:absolute;right:10px;top:5px;cursor:pointer}.layui-layer-photos{-webkit-animation-duration:1s;animation-duration:1s}.layui-layer-photos .layui-layer-content{overflow:hidden;text-align:center}.layui-layer-photos .layui-layer-phimg img{position:relative;width:100%;display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-imgbar,.layui-layer-imguide{display:none}.layui-layer-imgnext,.layui-layer-imgprev{position:absolute;top:50%;width:27px;_width:44px;height:44px;margin-top:-22px;outline:0;blr:expression(this.onFocus=this.blur())}.layui-layer-imgprev{left:10px;background-position:-5px -5px;_background-position:-70px -5px}.layui-layer-imgprev:hover{background-position:-33px -5px;_background-position:-120px -5px}.layui-layer-imgnext{right:10px;_right:8px;background-position:-5px -50px;_background-position:-70px -50px}.layui-layer-imgnext:hover{background-position:-33px -50px;_background-position:-120px -50px}.layui-layer-imgbar{position:absolute;left:0;bottom:0;width:100%;height:32px;line-height:32px;background-color:rgba(0,0,0,.8);background-color:#000\9;filter:Alpha(opacity=80);color:#fff;overflow:hidden;font-size:0}.layui-layer-imgtit *{display:inline-block;*display:inline;*zoom:1;vertical-align:top;font-size:12px}.layui-layer-imgtit a{max-width:65%;overflow:hidden;color:#fff}.layui-layer-imgtit a:hover{color:#fff;text-decoration:underline}.layui-layer-imgtit em{padding-left:10px;font-style:normal} | |
| 9 | 0 | \ No newline at end of file |
src/main/resources/static/assets/plugins/layer-v2.4/demo.html
0 → 100644
| 1 | +<!doctype html> | |
| 2 | +<html> | |
| 3 | +<head> | |
| 4 | +<meta charset="utf-8"> | |
| 5 | +<title>layer-更懂你的web弹窗解决方案</title> | |
| 6 | +<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script> | |
| 7 | +<script src="layer/layer.js"></script> | |
| 8 | + | |
| 9 | +<style> | |
| 10 | +html{background-color:#E3E3E3; font-size:14px; color:#000; font-family:'微软雅黑'} | |
| 11 | +a,a:hover{ text-decoration:none;} | |
| 12 | +pre{font-family:'微软雅黑'} | |
| 13 | +.box{padding:20px; background-color:#fff; margin:50px 100px; border-radius:5px;} | |
| 14 | +.box a{padding-right:15px;} | |
| 15 | +#about_hide{display:none} | |
| 16 | +.layer_text{background-color:#fff; padding:20px;} | |
| 17 | +.layer_text p{margin-bottom: 10px; text-indent: 2em; line-height: 23px;} | |
| 18 | +.button{display:inline-block; *display:inline; *zoom:1; line-height:30px; padding:0 20px; background-color:#56B4DC; color:#fff; font-size:14px; border-radius:3px; cursor:pointer; font-weight:normal;} | |
| 19 | +.photos-demo img{width:200px;} | |
| 20 | +</style> | |
| 21 | +</head> | |
| 22 | +<body> | |
| 23 | +<div class="box"> | |
| 24 | +<pre> | |
| 25 | + @Name:layer-v<script>document.write(layer.v)</script> 弹层组件说明 | |
| 26 | + @Author:贤心 | |
| 27 | + @Site:<a href="http://layer.layui.com/?form=local" target="_blank">http://layer.layui.com</a> | |
| 28 | + @Github:<a href="https://github.com/sentsin/layer" target="_blank">https://github.com/sentsin/layer</a> | |
| 29 | + | |
| 30 | + | |
| 31 | +<strong>【注意事项】</strong> | |
| 32 | +一、使用时,请把文件夹layer整个放置在您站点的任何一个目录,只需引入layer.js即可,除jQuery外,其它文件无需再引入。 | |
| 33 | +二、如果您的js引入是通过合并处理或者您不想采用layer自动获取的绝对路径,您可以通过layer.config()来配置(详见官网API页) | |
| 34 | +三、jQuery最低要求1.8 | |
| 35 | +四、更多使用说明与演示,请参见layer官网。 | |
| 36 | +五、请勿用于虚假诈骗、及违反我国法律的Web平台。这一点非常重要非常的重要! | |
| 37 | +六、layer遵循LGPL协议,将永久性提供无偿服务。版权最终解释权:贤心。 | |
| 38 | +</pre> | |
| 39 | +</div> | |
| 40 | + | |
| 41 | +<div class="box"> | |
| 42 | + <h2 style="padding-bottom:20px;">扩展模块:图片查看器(相册层)</h2> | |
| 43 | + <div id="photosDemo" class="photos-demo"> | |
| 44 | + <!-- layer-src表示大图 layer-pid表示图片id src表示缩略图--> | |
| 45 | + | |
| 46 | + <img layer-src="http://static.oschina.net/uploads/space/2014/0516/012728_nAh8_1168184.jpg" layer-pid="" src="http://static.oschina.net/uploads/space/2014/0516/012728_nAh8_1168184.jpg" alt="layer宣传图"> | |
| 47 | + <img layer-src="http://sentsin.qiniudn.com/sentsinmy5.jpg" layer-pid="" src="http://sentsin.qiniudn.com/sentsinmy5.jpg" alt="我入互联网这五年"> | |
| 48 | + <img layer-src="" layer-pid="" src="http://sentsin.qiniudn.com/sentsin_39101a660cf4671b7ec297a74cc652c74152104f.jpg" alt="微摄影"> | |
| 49 | + <img layer-src="http://sentsin.qiniudn.com/sentsinsan01.jpg" layer-pid="" src="http://sentsin.qiniudn.com/sentsinsan01.jpg" alt="三清山"> | |
| 50 | + <img layer-src="http://ww2.sinaimg.cn/mw1024/5db11ff4jw1ehcyirr6quj20q00ex42w.jpg" layer-pid="" src="http://ww2.sinaimg.cn/mw1024/5db11ff4jw1ehcyirr6quj20q00ex42w.jpg" alt="国足"> | |
| 51 | + </div> | |
| 52 | + | |
| 53 | +</div> | |
| 54 | + | |
| 55 | + | |
| 56 | +<div class="box" style="text-align:center"> | |
| 57 | + <a href="http://layer.layui.com/?form=local" target="_blank">更多示例</a> | |
| 58 | + <a href="http://layer.layui.com/api.html" target="_blank">使用文档</a> | |
| 59 | + <a href="http://fly.layui.com" target="_blank" title="Fly">交流反馈</a> | |
| 60 | + <a href="javascript:;" id="about">关于</a> | |
| 61 | +</div> | |
| 62 | + | |
| 63 | +<script> | |
| 64 | +;!function(){ | |
| 65 | + | |
| 66 | +//页面一打开就执行,放入ready是为了layer所需配件(css、扩展模块)加载完毕 | |
| 67 | +layer.ready(function(){ | |
| 68 | + //官网欢迎页 | |
| 69 | + layer.open({ | |
| 70 | + type: 2, | |
| 71 | + //skin: 'layui-layer-lan', | |
| 72 | + title: 'layer弹层组件', | |
| 73 | + fix: false, | |
| 74 | + shadeClose: true, | |
| 75 | + maxmin: true, | |
| 76 | + area: ['1000px', '500px'], | |
| 77 | + content: 'http://layer.layui.com/?form=local', | |
| 78 | + end: function(){ | |
| 79 | + layer.tips('试试相册模块?', '#photosDemo', {tips: 1}) | |
| 80 | + } | |
| 81 | + }); | |
| 82 | + | |
| 83 | + //layer.msg('欢迎使用layer'); | |
| 84 | + | |
| 85 | + //使用相册 | |
| 86 | + layer.photos({ | |
| 87 | + photos: '#photosDemo' | |
| 88 | + }); | |
| 89 | +}); | |
| 90 | + | |
| 91 | +//关于 | |
| 92 | +$('#about').on('click', function(){ | |
| 93 | + layer.alert(layer.v + ' - 贤心出品'); | |
| 94 | +}); | |
| 95 | + | |
| 96 | +}(); | |
| 97 | +</script> | |
| 98 | +</body> | |
| 99 | +</html> | |
| 0 | 100 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/plugins/layer-v2.4/layer/layer.js
0 → 100644
| 1 | +/*! layer-v2.4 弹层组件 License LGPL http://layer.layui.com/ By 贤心 */ | |
| 2 | +;!function(a,b){"use strict";var c,d,e={getPath:function(){var a=document.scripts,b=a[a.length-1],c=b.src;if(!b.getAttribute("merge"))return c.substring(0,c.lastIndexOf("/")+1)}(),enter:function(a){13===a.keyCode&&a.preventDefault()},config:{},end:{},btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"]},f={v:"2.4",ie6:!!a.ActiveXObject&&!a.XMLHttpRequest,index:0,path:e.getPath,config:function(a,b){var d=0;return a=a||{},f.cache=e.config=c.extend(e.config,a),f.path=e.config.path||f.path,"string"==typeof a.extend&&(a.extend=[a.extend]),f.use("skin/layer.css",a.extend&&a.extend.length>0?function g(){var c=a.extend;f.use(c[c[d]?d:d-1],d<c.length?function(){return++d,g}():b)}():b),this},use:function(a,b,d){var e=c("head")[0],a=a.replace(/\s/g,""),g=/\.css$/.test(a),h=document.createElement(g?"link":"script"),i="layui_layer_"+a.replace(/\.|\//g,"");return f.path?(g&&(h.rel="stylesheet"),h[g?"href":"src"]=/^http:\/\//.test(a)?a:f.path+a,h.id=i,c("#"+i)[0]||e.appendChild(h),function j(){(g?1989===parseInt(c("#"+i).css("width")):f[d||i])?function(){b&&b();try{g||e.removeChild(h)}catch(a){}}():setTimeout(j,100)}(),this):void 0},ready:function(a,b){var d="function"==typeof a;return d&&(b=a),f.config(c.extend(e.config,function(){return d?{}:{path:a}}()),b),this},alert:function(a,b,d){var e="function"==typeof b;return e&&(d=b),f.open(c.extend({content:a,yes:d},e?{}:b))},confirm:function(a,b,d,g){var h="function"==typeof b;return h&&(g=d,d=b),f.open(c.extend({content:a,btn:e.btn,yes:d,btn2:g},h?{}:b))},msg:function(a,d,g){var i="function"==typeof d,j=e.config.skin,k=(j?j+" "+j+"-msg":"")||"layui-layer-msg",l=h.anim.length-1;return i&&(g=d),f.open(c.extend({content:a,time:3e3,shade:!1,skin:k,title:!1,closeBtn:!1,btn:!1,end:g},i&&!e.config.skin?{skin:k+" layui-layer-hui",shift:l}:function(){return d=d||{},(-1===d.icon||d.icon===b&&!e.config.skin)&&(d.skin=k+" "+(d.skin||"layui-layer-hui")),d}()))},load:function(a,b){return f.open(c.extend({type:3,icon:a||0,shade:.01},b))},tips:function(a,b,d){return f.open(c.extend({type:4,content:[a,b],closeBtn:!1,time:3e3,shade:!1,fix:!1,maxWidth:210},d))}},g=function(a){var b=this;b.index=++f.index,b.config=c.extend({},b.config,e.config,a),b.creat()};g.pt=g.prototype;var h=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];h.anim=["layer-anim","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],g.pt.config={type:0,shade:.3,fix:!0,move:h[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,shift:0,icon:-1,scrollbar:!0,tips:2},g.pt.vessel=function(a,b){var c=this,d=c.index,f=c.config,g=f.zIndex+d,i="object"==typeof f.title,j=f.maxmin&&(1===f.type||2===f.type),k=f.title?'<div class="layui-layer-title" style="'+(i?f.title[1]:"")+'">'+(i?f.title[0]:f.title)+"</div>":"";return f.zIndex=g,b([f.shade?'<div class="layui-layer-shade" id="layui-layer-shade'+d+'" times="'+d+'" style="'+("z-index:"+(g-1)+"; background-color:"+(f.shade[1]||"#000")+"; opacity:"+(f.shade[0]||f.shade)+"; filter:alpha(opacity="+(100*f.shade[0]||100*f.shade)+");")+'"></div>':"",'<div class="'+h[0]+(" layui-layer-"+e.type[f.type])+(0!=f.type&&2!=f.type||f.shade?"":" layui-layer-border")+" "+(f.skin||"")+'" id="'+h[0]+d+'" type="'+e.type[f.type]+'" times="'+d+'" showtime="'+f.time+'" conType="'+(a?"object":"string")+'" style="z-index: '+g+"; width:"+f.area[0]+";height:"+f.area[1]+(f.fix?"":";position:absolute;")+'">'+(a&&2!=f.type?"":k)+'<div id="'+(f.id||"")+'" class="layui-layer-content'+(0==f.type&&-1!==f.icon?" layui-layer-padding":"")+(3==f.type?" layui-layer-loading"+f.icon:"")+'">'+(0==f.type&&-1!==f.icon?'<i class="layui-layer-ico layui-layer-ico'+f.icon+'"></i>':"")+(1==f.type&&a?"":f.content||"")+'</div><span class="layui-layer-setwin">'+function(){var a=j?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return f.closeBtn&&(a+='<a class="layui-layer-ico '+h[7]+" "+h[7]+(f.title?f.closeBtn:4==f.type?"1":"2")+'" href="javascript:;"></a>'),a}()+"</span>"+(f.btn?function(){var a="";"string"==typeof f.btn&&(f.btn=[f.btn]);for(var b=0,c=f.btn.length;c>b;b++)a+='<a class="'+h[6]+b+'">'+f.btn[b]+"</a>";return'<div class="'+h[6]+'">'+a+"</div>"}():"")+"</div>"],k),c},g.pt.creat=function(){var a=this,b=a.config,g=a.index,i=b.content,j="object"==typeof i;if(!c("#"+b.id)[0]){switch("string"==typeof b.area&&(b.area="auto"===b.area?["",""]:[b.area,""]),b.type){case 0:b.btn="btn"in b?b.btn:e.btn[0],f.closeAll("dialog");break;case 2:var i=b.content=j?b.content:[b.content||"http://layer.layui.com","auto"];b.content='<iframe scrolling="'+(b.content[1]||"auto")+'" allowtransparency="true" id="'+h[4]+g+'" name="'+h[4]+g+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+b.content[0]+'"></iframe>';break;case 3:b.title=!1,b.closeBtn=!1,-1===b.icon&&0===b.icon,f.closeAll("loading");break;case 4:j||(b.content=[b.content,"body"]),b.follow=b.content[1],b.content=b.content[0]+'<i class="layui-layer-TipsG"></i>',b.title=!1,b.tips="object"==typeof b.tips?b.tips:[b.tips,!0],b.tipsMore||f.closeAll("tips")}a.vessel(j,function(d,e){c("body").append(d[0]),j?function(){2==b.type||4==b.type?function(){c("body").append(d[1])}():function(){i.parents("."+h[0])[0]||(i.show().addClass("layui-layer-wrap").wrap(d[1]),c("#"+h[0]+g).find("."+h[5]).before(e))}()}():c("body").append(d[1]),a.layero=c("#"+h[0]+g),b.scrollbar||h.html.css("overflow","hidden").attr("layer-full",g)}).auto(g),2==b.type&&f.ie6&&a.layero.find("iframe").attr("src",i[0]),c(document).off("keydown",e.enter).on("keydown",e.enter),a.layero.on("keydown",function(a){c(document).off("keydown",e.enter)}),4==b.type?a.tips():a.offset(),b.fix&&d.on("resize",function(){a.offset(),(/^\d+%$/.test(b.area[0])||/^\d+%$/.test(b.area[1]))&&a.auto(g),4==b.type&&a.tips()}),b.time<=0||setTimeout(function(){f.close(a.index)},b.time),a.move().callback(),h.anim[b.shift]&&a.layero.addClass(h.anim[b.shift])}},g.pt.auto=function(a){function b(a){a=g.find(a),a.height(i[1]-j-k-2*(0|parseFloat(a.css("padding"))))}var e=this,f=e.config,g=c("#"+h[0]+a);""===f.area[0]&&f.maxWidth>0&&(/MSIE 7/.test(navigator.userAgent)&&f.btn&&g.width(g.innerWidth()),g.outerWidth()>f.maxWidth&&g.width(f.maxWidth));var i=[g.innerWidth(),g.innerHeight()],j=g.find(h[1]).outerHeight()||0,k=g.find("."+h[6]).outerHeight()||0;switch(f.type){case 2:b("iframe");break;default:""===f.area[1]?f.fix&&i[1]>=d.height()&&(i[1]=d.height(),b("."+h[5])):b("."+h[5])}return e},g.pt.offset=function(){var a=this,b=a.config,c=a.layero,e=[c.outerWidth(),c.outerHeight()],f="object"==typeof b.offset;a.offsetTop=(d.height()-e[1])/2,a.offsetLeft=(d.width()-e[0])/2,f?(a.offsetTop=b.offset[0],a.offsetLeft=b.offset[1]||a.offsetLeft):"auto"!==b.offset&&(a.offsetTop=b.offset,"rb"===b.offset&&(a.offsetTop=d.height()-e[1],a.offsetLeft=d.width()-e[0])),b.fix||(a.offsetTop=/%$/.test(a.offsetTop)?d.height()*parseFloat(a.offsetTop)/100:parseFloat(a.offsetTop),a.offsetLeft=/%$/.test(a.offsetLeft)?d.width()*parseFloat(a.offsetLeft)/100:parseFloat(a.offsetLeft),a.offsetTop+=d.scrollTop(),a.offsetLeft+=d.scrollLeft()),c.css({top:a.offsetTop,left:a.offsetLeft})},g.pt.tips=function(){var a=this,b=a.config,e=a.layero,f=[e.outerWidth(),e.outerHeight()],g=c(b.follow);g[0]||(g=c("body"));var i={width:g.outerWidth(),height:g.outerHeight(),top:g.offset().top,left:g.offset().left},j=e.find(".layui-layer-TipsG"),k=b.tips[0];b.tips[1]||j.remove(),i.autoLeft=function(){i.left+f[0]-d.width()>0?(i.tipLeft=i.left+i.width-f[0],j.css({right:12,left:"auto"})):i.tipLeft=i.left},i.where=[function(){i.autoLeft(),i.tipTop=i.top-f[1]-10,j.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",b.tips[1])},function(){i.tipLeft=i.left+i.width+10,i.tipTop=i.top,j.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",b.tips[1])},function(){i.autoLeft(),i.tipTop=i.top+i.height+10,j.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",b.tips[1])},function(){i.tipLeft=i.left-f[0]-10,i.tipTop=i.top,j.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",b.tips[1])}],i.where[k-1](),1===k?i.top-(d.scrollTop()+f[1]+16)<0&&i.where[2]():2===k?d.width()-(i.left+i.width+f[0]+16)>0||i.where[3]():3===k?i.top-d.scrollTop()+i.height+f[1]+16-d.height()>0&&i.where[0]():4===k&&f[0]+16-i.left>0&&i.where[1](),e.find("."+h[5]).css({"background-color":b.tips[1],"padding-right":b.closeBtn?"30px":""}),e.css({left:i.tipLeft-(b.fix?d.scrollLeft():0),top:i.tipTop-(b.fix?d.scrollTop():0)})},g.pt.move=function(){var a=this,b=a.config,e={setY:0,moveLayer:function(){var a=e.layero,b=parseInt(a.css("margin-left")),c=parseInt(e.move.css("left"));0===b||(c-=b),"fixed"!==a.css("position")&&(c-=a.parent().offset().left,e.setY=0),a.css({left:c,top:parseInt(e.move.css("top"))-e.setY})}},f=a.layero.find(b.move);return b.move&&f.attr("move","ok"),f.css({cursor:b.move?"move":"auto"}),c(b.move).on("mousedown",function(a){if(a.preventDefault(),"ok"===c(this).attr("move")){e.ismove=!0,e.layero=c(this).parents("."+h[0]);var f=e.layero.offset().left,g=e.layero.offset().top,i=e.layero.outerWidth()-6,j=e.layero.outerHeight()-6;c("#layui-layer-moves")[0]||c("body").append('<div id="layui-layer-moves" class="layui-layer-moves" style="left:'+f+"px; top:"+g+"px; width:"+i+"px; height:"+j+'px; z-index:2147483584"></div>'),e.move=c("#layui-layer-moves"),b.moveType&&e.move.css({visibility:"hidden"}),e.moveX=a.pageX-e.move.position().left,e.moveY=a.pageY-e.move.position().top,"fixed"!==e.layero.css("position")||(e.setY=d.scrollTop())}}),c(document).mousemove(function(a){if(e.ismove){var c=a.pageX-e.moveX,f=a.pageY-e.moveY;if(a.preventDefault(),!b.moveOut){e.setY=d.scrollTop();var g=d.width()-e.move.outerWidth(),h=e.setY;0>c&&(c=0),c>g&&(c=g),h>f&&(f=h),f>d.height()-e.move.outerHeight()+e.setY&&(f=d.height()-e.move.outerHeight()+e.setY)}e.move.css({left:c,top:f}),b.moveType&&e.moveLayer(),c=f=g=h=null}}).mouseup(function(){try{e.ismove&&(e.moveLayer(),e.move.remove(),b.moveEnd&&b.moveEnd()),e.ismove=!1}catch(a){e.ismove=!1}}),a},g.pt.callback=function(){function a(){var a=g.cancel&&g.cancel(b.index,d);a===!1||f.close(b.index)}var b=this,d=b.layero,g=b.config;b.openLayer(),g.success&&(2==g.type?d.find("iframe").on("load",function(){g.success(d,b.index)}):g.success(d,b.index)),f.ie6&&b.IE6(d),d.find("."+h[6]).children("a").on("click",function(){var a=c(this).index();if(0===a)g.yes?g.yes(b.index,d):g.btn1?g.btn1(b.index,d):f.close(b.index);else{var e=g["btn"+(a+1)]&&g["btn"+(a+1)](b.index,d);e===!1||f.close(b.index)}}),d.find("."+h[7]).on("click",a),g.shadeClose&&c("#layui-layer-shade"+b.index).on("click",function(){f.close(b.index)}),d.find(".layui-layer-min").on("click",function(){var a=g.min&&g.min(d);a===!1||f.min(b.index,g)}),d.find(".layui-layer-max").on("click",function(){c(this).hasClass("layui-layer-maxmin")?(f.restore(b.index),g.restore&&g.restore(d)):(f.full(b.index,g),setTimeout(function(){g.full&&g.full(d)},100))}),g.end&&(e.end[b.index]=g.end)},e.reselect=function(){c.each(c("select"),function(a,b){var d=c(this);d.parents("."+h[0])[0]||1==d.attr("layer")&&c("."+h[0]).length<1&&d.removeAttr("layer").show(),d=null})},g.pt.IE6=function(a){function b(){a.css({top:f+(e.config.fix?d.scrollTop():0)})}var e=this,f=a.offset().top;b(),d.scroll(b),c("select").each(function(a,b){var d=c(this);d.parents("."+h[0])[0]||"none"===d.css("display")||d.attr({layer:"1"}).hide(),d=null})},g.pt.openLayer=function(){var a=this;f.zIndex=a.config.zIndex,f.setTop=function(a){var b=function(){f.zIndex++,a.css("z-index",f.zIndex+1)};return f.zIndex=parseInt(a[0].style.zIndex),a.on("mousedown",b),f.zIndex}},e.record=function(a){var b=[a.width(),a.height(),a.position().top,a.position().left+parseFloat(a.css("margin-left"))];a.find(".layui-layer-max").addClass("layui-layer-maxmin"),a.attr({area:b})},e.rescollbar=function(a){h.html.attr("layer-full")==a&&(h.html[0].style.removeProperty?h.html[0].style.removeProperty("overflow"):h.html[0].style.removeAttribute("overflow"),h.html.removeAttr("layer-full"))},a.layer=f,f.getChildFrame=function(a,b){return b=b||c("."+h[4]).attr("times"),c("#"+h[0]+b).find("iframe").contents().find(a)},f.getFrameIndex=function(a){return c("#"+a).parents("."+h[4]).attr("times")},f.iframeAuto=function(a){if(a){var b=f.getChildFrame("html",a).outerHeight(),d=c("#"+h[0]+a),e=d.find(h[1]).outerHeight()||0,g=d.find("."+h[6]).outerHeight()||0;d.css({height:b+e+g}),d.find("iframe").css({height:b})}},f.iframeSrc=function(a,b){c("#"+h[0]+a).find("iframe").attr("src",b)},f.style=function(a,b){var d=c("#"+h[0]+a),f=d.attr("type"),g=d.find(h[1]).outerHeight()||0,i=d.find("."+h[6]).outerHeight()||0;(f===e.type[1]||f===e.type[2])&&(d.css(b),f===e.type[2]&&d.find("iframe").css({height:parseFloat(b.height)-g-i}))},f.min=function(a,b){var d=c("#"+h[0]+a),g=d.find(h[1]).outerHeight()||0;e.record(d),f.style(a,{width:180,height:g,overflow:"hidden"}),d.find(".layui-layer-min").hide(),"page"===d.attr("type")&&d.find(h[4]).hide(),e.rescollbar(a)},f.restore=function(a){var b=c("#"+h[0]+a),d=b.attr("area").split(",");b.attr("type");f.style(a,{width:parseFloat(d[0]),height:parseFloat(d[1]),top:parseFloat(d[2]),left:parseFloat(d[3]),overflow:"visible"}),b.find(".layui-layer-max").removeClass("layui-layer-maxmin"),b.find(".layui-layer-min").show(),"page"===b.attr("type")&&b.find(h[4]).show(),e.rescollbar(a)},f.full=function(a){var b,g=c("#"+h[0]+a);e.record(g),h.html.attr("layer-full")||h.html.css("overflow","hidden").attr("layer-full",a),clearTimeout(b),b=setTimeout(function(){var b="fixed"===g.css("position");f.style(a,{top:b?0:d.scrollTop(),left:b?0:d.scrollLeft(),width:d.width(),height:d.height()}),g.find(".layui-layer-min").hide()},100)},f.title=function(a,b){var d=c("#"+h[0]+(b||f.index)).find(h[1]);d.html(a)},f.close=function(a){var b=c("#"+h[0]+a),d=b.attr("type");if(b[0]){if(d===e.type[1]&&"object"===b.attr("conType")){b.children(":not(."+h[5]+")").remove();for(var g=0;2>g;g++)b.find(".layui-layer-wrap").unwrap().hide()}else{if(d===e.type[2])try{var i=c("#"+h[4]+a)[0];i.contentWindow.document.write(""),i.contentWindow.close(),b.find("."+h[5])[0].removeChild(i)}catch(j){}b[0].innerHTML="",b.remove()}c("#layui-layer-moves, #layui-layer-shade"+a).remove(),f.ie6&&e.reselect(),e.rescollbar(a),c(document).off("keydown",e.enter),"function"==typeof e.end[a]&&e.end[a](),delete e.end[a]}},f.closeAll=function(a){c.each(c("."+h[0]),function(){var b=c(this),d=a?b.attr("type")===a:1;d&&f.close(b.attr("times")),d=null})};var i=f.cache||{},j=function(a){return i.skin?" "+i.skin+" "+i.skin+"-"+a:""};f.prompt=function(a,b){a=a||{},"function"==typeof a&&(b=a);var d,e=2==a.formType?'<textarea class="layui-layer-input">'+(a.value||"")+"</textarea>":function(){return'<input type="'+(1==a.formType?"password":"text")+'" class="layui-layer-input" value="'+(a.value||"")+'">'}();return f.open(c.extend({btn:["确定","取消"],content:e,skin:"layui-layer-prompt"+j("prompt"),success:function(a){d=a.find(".layui-layer-input"),d.focus()},yes:function(c){var e=d.val();""===e?d.focus():e.length>(a.maxlength||500)?f.tips("最多输入"+(a.maxlength||500)+"个字数",d,{tips:1}):b&&b(e,c,d)}},a))},f.tab=function(a){a=a||{};var b=a.tab||{};return f.open(c.extend({type:1,skin:"layui-layer-tab"+j("tab"),title:function(){var a=b.length,c=1,d="";if(a>0)for(d='<span class="layui-layer-tabnow">'+b[0].title+"</span>";a>c;c++)d+="<span>"+b[c].title+"</span>";return d}(),content:'<ul class="layui-layer-tabmain">'+function(){var a=b.length,c=1,d="";if(a>0)for(d='<li class="layui-layer-tabli xubox_tab_layer">'+(b[0].content||"no content")+"</li>";a>c;c++)d+='<li class="layui-layer-tabli">'+(b[c].content||"no content")+"</li>";return d}()+"</ul>",success:function(b){var d=b.find(".layui-layer-title").children(),e=b.find(".layui-layer-tabmain").children();d.on("mousedown",function(b){b.stopPropagation?b.stopPropagation():b.cancelBubble=!0;var d=c(this),f=d.index();d.addClass("layui-layer-tabnow").siblings().removeClass("layui-layer-tabnow"),e.eq(f).show().siblings().hide(),"function"==typeof a.change&&a.change(f)})}},a))},f.photos=function(b,d,e){function g(a,b,c){var d=new Image;return d.src=a,d.complete?b(d):(d.onload=function(){d.onload=null,b(d)},void(d.onerror=function(a){d.onerror=null,c(a)}))}var h={};if(b=b||{},b.photos){var i=b.photos.constructor===Object,k=i?b.photos:{},l=k.data||[],m=k.start||0;if(h.imgIndex=(0|m)+1,b.img=b.img||"img",i){if(0===l.length)return f.msg("没有图片")}else{var n=c(b.photos),o=function(){l=[],n.find(b.img).each(function(a){var b=c(this);b.attr("layer-index",a),l.push({alt:b.attr("alt"),pid:b.attr("layer-pid"),src:b.attr("layer-src")||b.attr("src"),thumb:b.attr("src")})})};if(o(),0===l.length)return;if(d||n.on("click",b.img,function(){var a=c(this),d=a.attr("layer-index");f.photos(c.extend(b,{photos:{start:d,data:l,tab:b.tab},full:b.full}),!0),o()}),!d)return}h.imgprev=function(a){h.imgIndex--,h.imgIndex<1&&(h.imgIndex=l.length),h.tabimg(a)},h.imgnext=function(a,b){h.imgIndex++,h.imgIndex>l.length&&(h.imgIndex=1,b)||h.tabimg(a)},h.keyup=function(a){if(!h.end){var b=a.keyCode;a.preventDefault(),37===b?h.imgprev(!0):39===b?h.imgnext(!0):27===b&&f.close(h.index)}},h.tabimg=function(a){l.length<=1||(k.start=h.imgIndex-1,f.close(h.index),f.photos(b,!0,a))},h.event=function(){h.bigimg.hover(function(){h.imgsee.show()},function(){h.imgsee.hide()}),h.bigimg.find(".layui-layer-imgprev").on("click",function(a){a.preventDefault(),h.imgprev()}),h.bigimg.find(".layui-layer-imgnext").on("click",function(a){a.preventDefault(),h.imgnext()}),c(document).on("keyup",h.keyup)},h.loadi=f.load(1,{shade:"shade"in b?!1:.9,scrollbar:!1}),g(l[m].src,function(d){f.close(h.loadi),h.index=f.open(c.extend({type:1,area:function(){var e=[d.width,d.height],f=[c(a).width()-50,c(a).height()-50];return!b.full&&e[0]>f[0]&&(e[0]=f[0],e[1]=e[0]*d.height/d.width),[e[0]+"px",e[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,shift:5*Math.random()|0,skin:"layui-layer-photos"+j("photos"),content:'<div class="layui-layer-phimg"><img src="'+l[m].src+'" alt="'+(l[m].alt||"")+'" layer-pid="'+l[m].pid+'"><div class="layui-layer-imgsee">'+(l.length>1?'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>':"")+'<div class="layui-layer-imgbar" style="display:'+(e?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(l[m].alt||"")+"</a><em>"+h.imgIndex+"/"+l.length+"</em></span></div></div></div>",success:function(a,c){h.bigimg=a.find(".layui-layer-phimg"),h.imgsee=a.find(".layui-layer-imguide,.layui-layer-imgbar"),h.event(a),b.tab&&b.tab(l[m],a)},end:function(){h.end=!0,c(document).off("keyup",h.keyup)}},b))},function(){f.close(h.loadi),f.msg("当前图片地址异常<br>是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){l.length>1&&h.imgnext(!0,!0)}})})}},e.run=function(){c=jQuery,d=c(a),h.html=c("html"),f.open=function(a){var b=new g(a);return b.index}},"function"==typeof define?define(function(){return e.run(),f}):function(){e.run(),f.use("skin/layer.css")}()}(window); | |
| 0 | 3 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/plugins/layer-v2.2/layer/skin/default/icon-ext.png renamed to src/main/resources/static/assets/plugins/layer-v2.4/layer/skin/default/icon-ext.png
5.77 KB
src/main/resources/static/assets/plugins/layer-v2.2/layer/skin/default/icon.png renamed to src/main/resources/static/assets/plugins/layer-v2.4/layer/skin/default/icon.png
11.2 KB
src/main/resources/static/assets/plugins/layer-v2.2/layer/skin/default/loading-0.gif renamed to src/main/resources/static/assets/plugins/layer-v2.4/layer/skin/default/loading-0.gif
5.66 KB
src/main/resources/static/assets/plugins/layer-v2.2/layer/skin/default/loading-1.gif renamed to src/main/resources/static/assets/plugins/layer-v2.4/layer/skin/default/loading-1.gif
701 Bytes
src/main/resources/static/assets/plugins/layer-v2.2/layer/skin/default/loading-2.gif renamed to src/main/resources/static/assets/plugins/layer-v2.4/layer/skin/default/loading-2.gif
1.75 KB
src/main/resources/static/assets/plugins/layer-v2.4/layer/skin/layer.css
0 → 100644
| 1 | +/*! | |
| 2 | + | |
| 3 | + @Name: layer's style | |
| 4 | + @Author: 贤心 | |
| 5 | + @Blog: sentsin.com | |
| 6 | + | |
| 7 | + */.layui-layer-imgbar,.layui-layer-imgtit a,.layui-layer-tab .layui-layer-title span,.layui-layer-title{text-overflow:ellipsis;white-space:nowrap}*html{background-image:url(about:blank);background-attachment:fixed}html #layui_layer_skinlayercss{display:none;position:absolute;width:1989px}.layui-layer,.layui-layer-shade{position:fixed;_position:absolute;pointer-events:auto}.layui-layer-shade{top:0;left:0;width:100%;height:100%;_height:expression(document.body.offsetHeight+"px")}.layui-layer{-webkit-overflow-scrolling:touch;top:150px;left:0;margin:0;padding:0;background-color:#fff;-webkit-background-clip:content;box-shadow:1px 1px 50px rgba(0,0,0,.3);border-radius:2px;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.3s;animation-duration:.3s}.layui-layer-close{position:absolute}.layui-layer-content{position:relative}.layui-layer-border{border:1px solid #B2B2B2;border:1px solid rgba(0,0,0,.3);box-shadow:1px 1px 5px rgba(0,0,0,.2)}.layui-layer-moves{position:absolute;border:3px solid #666;border:3px solid rgba(0,0,0,.5);cursor:move;background-color:#fff;background-color:rgba(255,255,255,.3);filter:alpha(opacity=50)}.layui-layer-load{background:url(default/loading-0.gif) center center no-repeat #fff}.layui-layer-ico{background:url(default/icon.png) no-repeat}.layui-layer-btn a,.layui-layer-dialog .layui-layer-ico,.layui-layer-setwin a{display:inline-block;*display:inline;*zoom:1;vertical-align:top}@-webkit-keyframes bounceIn{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes bounceIn{0%{opacity:0;-webkit-transform:scale(.5);-ms-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim{-webkit-animation-name:bounceIn;animation-name:bounceIn}@-webkit-keyframes bounceOut{100%{opacity:0;-webkit-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.03);transform:scale(1.03)}0%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes bounceOut{100%{opacity:0;-webkit-transform:scale(.7);-ms-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.03);-ms-transform:scale(1.03);transform:scale(1.03)}0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-close{-webkit-animation-name:bounceOut;animation-name:bounceOut;-webkit-animation-duration:.2s;animation-duration:.2s}@-webkit-keyframes zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:zoomInDown;animation-name:zoomInDown}@-webkit-keyframes fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layer-anim-02{-webkit-animation-name:fadeInUpBig;animation-name:fadeInUpBig}@-webkit-keyframes zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-03{-webkit-animation-name:zoomInLeft;animation-name:zoomInLeft}@-webkit-keyframes rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}@keyframes rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);-ms-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}.layer-anim-04{-webkit-animation-name:rollIn;animation-name:rollIn}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}.layer-anim-05{-webkit-animation-name:fadeIn;animation-name:fadeIn}@-webkit-keyframes shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:shake;animation-name:shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}.layui-layer-title{padding:0 80px 0 20px;height:42px;line-height:42px;border-bottom:1px solid #eee;font-size:14px;color:#333;overflow:hidden;background-color:#F8F8F8;border-radius:2px 2px 0 0}.layui-layer-setwin{position:absolute;right:15px;*right:0;top:15px;font-size:0;line-height:initial}.layui-layer-setwin a{position:relative;width:16px;height:16px;margin-left:10px;font-size:12px;_overflow:hidden}.layui-layer-setwin .layui-layer-min cite{position:absolute;width:14px;height:2px;left:0;top:50%;margin-top:-1px;background-color:#2E2D3C;cursor:pointer;_overflow:hidden}.layui-layer-setwin .layui-layer-min:hover cite{background-color:#2D93CA}.layui-layer-setwin .layui-layer-max{background-position:-32px -40px}.layui-layer-setwin .layui-layer-max:hover{background-position:-16px -40px}.layui-layer-setwin .layui-layer-maxmin{background-position:-65px -40px}.layui-layer-setwin .layui-layer-maxmin:hover{background-position:-49px -40px}.layui-layer-setwin .layui-layer-close1{background-position:0 -40px;cursor:pointer}.layui-layer-setwin .layui-layer-close1:hover{opacity:.7}.layui-layer-setwin .layui-layer-close2{position:absolute;right:-28px;top:-28px;width:30px;height:30px;margin-left:0;background-position:-149px -31px;*right:-18px;_display:none}.layui-layer-setwin .layui-layer-close2:hover{background-position:-180px -31px}.layui-layer-btn{text-align:right;padding:0 10px 12px;pointer-events:auto}.layui-layer-btn a{height:28px;line-height:28px;margin:0 6px;padding:0 15px;border:1px solid #dedede;background-color:#f1f1f1;color:#333;border-radius:2px;font-weight:400;cursor:pointer;text-decoration:none}.layui-layer-btn a:hover{opacity:.9;text-decoration:none}.layui-layer-btn a:active{opacity:.7}.layui-layer-btn .layui-layer-btn0{border-color:#4898d5;background-color:#2e8ded;color:#fff}.layui-layer-dialog{min-width:260px}.layui-layer-dialog .layui-layer-content{position:relative;padding:20px;line-height:24px;word-break:break-all;overflow:hidden;font-size:14px;overflow-x:hidden;overflow-y:auto}.layui-layer-dialog .layui-layer-content .layui-layer-ico{position:absolute;top:16px;left:15px;_left:-40px;width:30px;height:30px}.layui-layer-ico1{background-position:-30px 0}.layui-layer-ico2{background-position:-60px 0}.layui-layer-ico3{background-position:-90px 0}.layui-layer-ico4{background-position:-120px 0}.layui-layer-ico5{background-position:-150px 0}.layui-layer-ico6{background-position:-180px 0}.layui-layer-rim{border:6px solid #8D8D8D;border:6px solid rgba(0,0,0,.3);border-radius:5px;box-shadow:none}.layui-layer-msg{min-width:180px;border:1px solid #D3D4D3;box-shadow:none}.layui-layer-hui{min-width:100px;background-color:#000;filter:alpha(opacity=60);background-color:rgba(0,0,0,.6);color:#fff;border:none}.layui-layer-hui .layui-layer-content{padding:12px 25px;text-align:center}.layui-layer-dialog .layui-layer-padding{padding:20px 20px 20px 55px;text-align:left}.layui-layer-page .layui-layer-content{position:relative;overflow:auto}.layui-layer-iframe .layui-layer-btn,.layui-layer-page .layui-layer-btn{padding-top:10px}.layui-layer-nobg{background:0 0}.layui-layer-iframe .layui-layer-content{overflow:hidden}.layui-layer-iframe iframe{display:block;width:100%}.layui-layer-loading{border-radius:100%;background:0 0;box-shadow:none;border:none}.layui-layer-loading .layui-layer-content{width:60px;height:24px;background:url(default/loading-0.gif) no-repeat}.layui-layer-loading .layui-layer-loading1{width:37px;height:37px;background:url(default/loading-1.gif) no-repeat}.layui-layer-ico16,.layui-layer-loading .layui-layer-loading2{width:32px;height:32px;background:url(default/loading-2.gif) no-repeat}.layui-layer-tips{background:0 0;box-shadow:none;border:none}.layui-layer-tips .layui-layer-content{position:relative;line-height:22px;min-width:12px;padding:5px 10px;font-size:12px;_float:left;border-radius:3px;box-shadow:1px 1px 3px rgba(0,0,0,.3);background-color:#F90;color:#fff}.layui-layer-tips .layui-layer-close{right:-2px;top:-1px}.layui-layer-tips i.layui-layer-TipsG{position:absolute;width:0;height:0;border-width:8px;border-color:transparent;border-style:dashed;*overflow:hidden}.layui-layer-tips i.layui-layer-TipsB,.layui-layer-tips i.layui-layer-TipsT{left:5px;border-right-style:solid;border-right-color:#F90}.layui-layer-tips i.layui-layer-TipsT{bottom:-8px}.layui-layer-tips i.layui-layer-TipsB{top:-8px}.layui-layer-tips i.layui-layer-TipsL,.layui-layer-tips i.layui-layer-TipsR{top:1px;border-bottom-style:solid;border-bottom-color:#F90}.layui-layer-tips i.layui-layer-TipsR{left:-8px}.layui-layer-tips i.layui-layer-TipsL{right:-8px}.layui-layer-lan[type=dialog]{min-width:280px}.layui-layer-lan .layui-layer-title{background:#4476A7;color:#fff;border:none}.layui-layer-lan .layui-layer-btn{padding:10px;text-align:right;border-top:1px solid #E9E7E7}.layui-layer-lan .layui-layer-btn a{background:#BBB5B5;border:none}.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5}.layui-layer-molv .layui-layer-title{background:#009f95;color:#fff;border:none}.layui-layer-molv .layui-layer-btn a{background:#009f95}.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1}.layui-layer-iconext{background:url(default/icon-ext.png) no-repeat}.layui-layer-prompt .layui-layer-input{display:block;width:220px;height:30px;margin:0 auto;line-height:30px;padding:0 5px;border:1px solid #ccc;box-shadow:1px 1px 5px rgba(0,0,0,.1) inset;color:#333}.layui-layer-prompt textarea.layui-layer-input{width:300px;height:100px;line-height:20px}.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4)}.layui-layer-tab .layui-layer-title{padding-left:0;border-bottom:1px solid #ccc;background-color:#eee;overflow:visible}.layui-layer-tab .layui-layer-title span{position:relative;float:left;min-width:80px;max-width:260px;padding:0 20px;text-align:center;cursor:default;overflow:hidden}.layui-layer-tab .layui-layer-title span.layui-layer-tabnow{height:43px;border-left:1px solid #ccc;border-right:1px solid #ccc;background-color:#fff;z-index:10}.layui-layer-tab .layui-layer-title span:first-child{border-left:none}.layui-layer-tabmain{line-height:24px;clear:both}.layui-layer-tabmain .layui-layer-tabli{display:none}.layui-layer-tabmain .layui-layer-tabli.xubox_tab_layer{display:block}.xubox_tabclose{position:absolute;right:10px;top:5px;cursor:pointer}.layui-layer-photos{-webkit-animation-duration:1s;animation-duration:1s}.layui-layer-photos .layui-layer-content{overflow:hidden;text-align:center}.layui-layer-photos .layui-layer-phimg img{position:relative;width:100%;display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-imgbar,.layui-layer-imguide{display:none}.layui-layer-imgnext,.layui-layer-imgprev{position:absolute;top:50%;width:27px;_width:44px;height:44px;margin-top:-22px;outline:0;blr:expression(this.onFocus=this.blur())}.layui-layer-imgprev{left:10px;background-position:-5px -5px;_background-position:-70px -5px}.layui-layer-imgprev:hover{background-position:-33px -5px;_background-position:-120px -5px}.layui-layer-imgnext{right:10px;_right:8px;background-position:-5px -50px;_background-position:-70px -50px}.layui-layer-imgnext:hover{background-position:-33px -50px;_background-position:-120px -50px}.layui-layer-imgbar{position:absolute;left:0;bottom:0;width:100%;height:32px;line-height:32px;background-color:rgba(0,0,0,.8);background-color:#000\9;filter:Alpha(opacity=80);color:#fff;overflow:hidden;font-size:0}.layui-layer-imgtit *{display:inline-block;*display:inline;*zoom:1;vertical-align:top;font-size:12px}.layui-layer-imgtit a{max-width:65%;overflow:hidden;color:#fff}.layui-layer-imgtit a:hover{color:#fff;text-decoration:underline}.layui-layer-imgtit em{padding-left:10px;font-style:normal} | |
| 0 | 8 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/plugins/layer-v2.2/doc/jquery下载.url renamed to src/main/resources/static/assets/plugins/layer-v2.4/layim.url
src/main/resources/static/assets/plugins/layer-v2.2/更新日志.txt renamed to src/main/resources/static/assets/plugins/layer-v2.4/更新日志.txt
| 1 | 1 | |
| 2 | -(2.x对1.9+版本无缝兼容,可直接全文件覆盖升级。) | |
| 2 | +(可直接全文件覆盖升级。) | |
| 3 | + | |
| 4 | +# v2.4(2016.07.03) | |
| 5 | +* 兼容jQuery3.0 | |
| 6 | +* 优化tips,可支持配置参数fix(之前是强制fix: false),用于决定是固定的tips还是非固定的。 | |
| 7 | +* min回调可通过return false来设定不执行默认最小化。 | |
| 8 | +* 修复在移动端使用iframe,IOS下无法滑动的bug。 | |
| 9 | +* 细节优化及样式微调 | |
| 10 | + | |
| 11 | +【2.3】2016.05.18 | |
| 12 | +1. 通过对使用频率的调查,将layer.ext.js(拓展模块)合并到了layer.js,即不用再通过layer.config来加载调用。 | |
| 13 | +2. cancel回调不再对第二个按钮有效,只作为右上角关闭按钮触发。并且除yes回调外,所以按钮的回调都可以通过return false来设定不默认关闭。 | |
| 14 | +3. 修复相册层,点击任意图片查看,弹出的并非当前图片的bug。 | |
| 15 | +4. 修复相册层在移动端显示不佳的bug。 | |
| 16 | +5. 修复msg、alert等对话框类型的弹层,在手机使用时未水平居中的bug。 | |
| 17 | + | |
| 3 | 18 | |
| 4 | 19 | 【2.2】2016.03.18 |
| 5 | 20 | > 增加参数id,用于控制弹层唯一标识。如不想重复弹出,可设置该值。 | ... | ... |
src/main/resources/static/index.html
| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | <!-- MULTI-select 多选下拉框美化 --> |
| 20 | 20 | <link href="/metronic_v4.5.4/plugins/jquery-multi-select/css/multi-select.css" rel="stylesheet" type="text/css" /> |
| 21 | 21 | <!-- METRONIC style --> |
| 22 | -<link href="/metronic_v4.5.4/layout4/css/themes/default.min.css" rel="stylesheet" type="text/css" id="style_color" /> | |
| 22 | +<link href="/metronic_v4.5.4/layout4/css/themes/light.min.css" rel="stylesheet" type="text/css" id="style_color" /> | |
| 23 | 23 | <link href="/metronic_v4.5.4/css/components.css" rel="stylesheet" type="text/css" /> |
| 24 | 24 | <link href="/metronic_v4.5.4/css/plugins.css" rel="stylesheet" type="text/css" /> |
| 25 | 25 | <link href="/metronic_v4.5.4/layout4/css/layout.min.css" rel="stylesheet" type="text/css" /> |
| ... | ... | @@ -28,7 +28,7 @@ |
| 28 | 28 | <link href="/metronic_v4.5.4/plugins/select2/css/select2.min.css" rel="stylesheet" type="text/css" /> |
| 29 | 29 | <link href="/metronic_v4.5.4/plugins/select2/css/select2-bootstrap.min.css" rel="stylesheet" type="text/css" /> |
| 30 | 30 | <!-- layer 弹层 插件 --> |
| 31 | -<link href="/assets/plugins/layer-v2.2/layer/skin/layer.css" rel="stylesheet" type="text/css" /> | |
| 31 | +<link href="/assets/plugins/layer-v2.4/layer/skin/layer.css" rel="stylesheet" type="text/css" /> | |
| 32 | 32 | <!-- iCheck 单选框和复选框 --> |
| 33 | 33 | <link href="/metronic_v4.5.4/plugins/icheck/skins/all.css" rel="stylesheet" type="text/css" /> |
| 34 | 34 | <!-- 日期控件 --> |
| ... | ... | @@ -237,6 +237,8 @@ tr.row-active td { |
| 237 | 237 | <script src="/metronic_v4.5.4/plugins/jquery.min.js" data-exclude=1></script> |
| 238 | 238 | <!-- bootstrap --> |
| 239 | 239 | <script src="/metronic_v4.5.4/plugins/bootstrap/js/bootstrap.min.js" data-exclude=1></script> |
| 240 | +<script src="/pages/forms/statement/js/jquery.autocompleter.js"></script> | |
| 241 | +<script src="/pages/forms/statement/js/jquery.PrintArea.js"></script> | |
| 240 | 242 | <!-- MTRONIC JS --> |
| 241 | 243 | <script src="/metronic_v4.5.4/scripts/app.min.js" data-exclude=1></script> |
| 242 | 244 | <script src="/metronic_v4.5.4/layout4/scripts/layout.min.js" data-exclude=1></script> |
| ... | ... | @@ -260,7 +262,7 @@ tr.row-active td { |
| 260 | 262 | <!-- PJAX --> |
| 261 | 263 | <script src="/assets/plugins/jquery.pjax.js"></script> |
| 262 | 264 | <!-- layer 弹层 --> |
| 263 | -<script src="/assets/plugins/layer-v2.2/layer/layer.js" data-exclude=1></script> | |
| 265 | +<script src="/assets/plugins/layer-v2.4/layer/layer.js" data-exclude=1></script> | |
| 264 | 266 | <!-- jquery.purl URL解析 --> |
| 265 | 267 | <script src="/assets/plugins/purl.js"></script> |
| 266 | 268 | <!-- jquery.serializejson JSON序列化插件 --> |
| ... | ... | @@ -291,6 +293,8 @@ tr.row-active td { |
| 291 | 293 | <script src="/assets/js/dictionary.js"></script> |
| 292 | 294 | <!-- d3 --> |
| 293 | 295 | <script src="/assets/js/d3.min.js" data-exclude=1></script> |
| 296 | +<!-- webSocket JS --> | |
| 297 | +<script src="/assets/js/sockjs.min.js"></script> | |
| 294 | 298 | |
| 295 | 299 | <!-- TODO:angularJS相关库 --> |
| 296 | 300 | ... | ... |