Commit de8460740d6878bef5daaa57d68352c2b05c06c2
Merge branch 'minhang' of http://222.66.0.204:8090//panzhaov5/bsth_control into minhang
Showing
36 changed files
with
3282 additions
and
79 deletions
src/main/java/com/bsth/controller/excep/NowAbnormalController.java
0 → 100644
| 1 | +package com.bsth.controller.excep; | |
| 2 | + | |
| 3 | +import java.util.HashMap; | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 10 | +import org.springframework.web.bind.annotation.RestController; | |
| 11 | + | |
| 12 | +import com.bsth.controller.BaseController; | |
| 13 | +import com.bsth.entity.excep.Abnormal; | |
| 14 | +import com.bsth.entity.sys.SysUser; | |
| 15 | +import com.bsth.service.excep.NowAbnormalService; | |
| 16 | +import com.bsth.util.PageObject; | |
| 17 | + | |
| 18 | +@RestController | |
| 19 | +@RequestMapping("nowabnormal") | |
| 20 | +public class NowAbnormalController extends BaseController<SysUser, Integer>{ | |
| 21 | + @Autowired | |
| 22 | + private NowAbnormalService nowAbnormalService; | |
| 23 | + | |
| 24 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | |
| 25 | + public PageObject<Abnormal> pagequery(@RequestParam Map<String, Object> map){ | |
| 26 | + PageObject<Abnormal> pageObject = null; | |
| 27 | + map.put("curPage", map.get("page").toString()); | |
| 28 | + map.put("pageData","10"); | |
| 29 | + pageObject=nowAbnormalService.Pagequery(map); | |
| 30 | + return pageObject; | |
| 31 | + | |
| 32 | + } | |
| 33 | + | |
| 34 | + | |
| 35 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | |
| 36 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | |
| 37 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | |
| 38 | + try { | |
| 39 | + map.put("isShow", 1); | |
| 40 | +// modelMap = offlineService.getReport(map); | |
| 41 | + } catch (Exception e) { | |
| 42 | + e.printStackTrace(); | |
| 43 | + } | |
| 44 | + return modelMap; | |
| 45 | + } | |
| 46 | + | |
| 47 | + | |
| 48 | +} | ... | ... |
src/main/java/com/bsth/controller/excep/NowOfflineController.java
0 → 100644
| 1 | +package com.bsth.controller.excep; | |
| 2 | + | |
| 3 | +import java.util.HashMap; | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 10 | +import org.springframework.web.bind.annotation.RestController; | |
| 11 | + | |
| 12 | +import com.bsth.controller.BaseController; | |
| 13 | +import com.bsth.entity.excep.Offline; | |
| 14 | +import com.bsth.entity.sys.SysUser; | |
| 15 | +import com.bsth.service.excep.NowOfflineService; | |
| 16 | +import com.bsth.util.PageObject; | |
| 17 | + | |
| 18 | +@RestController | |
| 19 | +@RequestMapping("nowoffline") | |
| 20 | +public class NowOfflineController extends BaseController<SysUser, Integer>{ | |
| 21 | + @Autowired | |
| 22 | + private NowOfflineService nowOfflineService; | |
| 23 | + | |
| 24 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | |
| 25 | + public PageObject<Offline> pagequery(@RequestParam Map<String, Object> map){ | |
| 26 | + PageObject<Offline> pageObject = null; | |
| 27 | + map.put("curPage", map.get("page").toString()); | |
| 28 | + map.put("pageData","10"); | |
| 29 | + pageObject=nowOfflineService.Pagequery(map); | |
| 30 | + return pageObject; | |
| 31 | + | |
| 32 | + } | |
| 33 | + | |
| 34 | + | |
| 35 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | |
| 36 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | |
| 37 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | |
| 38 | + try { | |
| 39 | + map.put("isShow", 1); | |
| 40 | + modelMap = nowOfflineService.getReport(map); | |
| 41 | + } catch (Exception e) { | |
| 42 | + e.printStackTrace(); | |
| 43 | + } | |
| 44 | + return modelMap; | |
| 45 | + } | |
| 46 | + | |
| 47 | + | |
| 48 | +} | ... | ... |
src/main/java/com/bsth/controller/excep/NowOutboundController.java
0 → 100644
| 1 | +package com.bsth.controller.excep; | |
| 2 | + | |
| 3 | +import java.util.HashMap; | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 10 | +import org.springframework.web.bind.annotation.RestController; | |
| 11 | + | |
| 12 | +import com.bsth.controller.BaseController; | |
| 13 | +import com.bsth.entity.excep.Outbound; | |
| 14 | +import com.bsth.entity.sys.SysUser; | |
| 15 | +import com.bsth.service.excep.NowOutboundService; | |
| 16 | +import com.bsth.util.PageObject; | |
| 17 | + | |
| 18 | +@RestController | |
| 19 | +@RequestMapping("nowbound") | |
| 20 | +public class NowOutboundController extends BaseController<SysUser, Integer>{ | |
| 21 | + @Autowired | |
| 22 | + private NowOutboundService nowOutboundService; | |
| 23 | + | |
| 24 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | |
| 25 | + public PageObject<Outbound> pagequery(@RequestParam Map<String, Object> map){ | |
| 26 | + PageObject<Outbound> pageObject = null; | |
| 27 | + map.put("curPage", map.get("page").toString()); | |
| 28 | + map.put("pageData","10"); | |
| 29 | + pageObject=nowOutboundService.Pagequery(map); | |
| 30 | + return pageObject; | |
| 31 | + | |
| 32 | + } | |
| 33 | + | |
| 34 | + | |
| 35 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | |
| 36 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | |
| 37 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | |
| 38 | + try { | |
| 39 | + map.put("isShow", 1); | |
| 40 | + modelMap = nowOutboundService.getReport(map); | |
| 41 | + } catch (Exception e) { | |
| 42 | + e.printStackTrace(); | |
| 43 | + } | |
| 44 | + return modelMap; | |
| 45 | + } | |
| 46 | + | |
| 47 | + | |
| 48 | +} | ... | ... |
src/main/java/com/bsth/controller/excep/NowSpeedingController.java
0 → 100644
| 1 | +package com.bsth.controller.excep; | |
| 2 | + | |
| 3 | +import java.text.ParseException; | |
| 4 | +import java.util.HashMap; | |
| 5 | +import java.util.List; | |
| 6 | +import java.util.Map; | |
| 7 | + | |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 12 | +import org.springframework.web.bind.annotation.RestController; | |
| 13 | + | |
| 14 | +import com.bsth.controller.BaseController; | |
| 15 | +import com.bsth.data.BasicData; | |
| 16 | +import com.bsth.entity.excep.Speeding; | |
| 17 | +import com.bsth.entity.sys.SysUser; | |
| 18 | +import com.bsth.service.excep.NowSpeedingService; | |
| 19 | +import com.bsth.util.PageObject; | |
| 20 | + | |
| 21 | +@RestController | |
| 22 | +@RequestMapping("nowspeeding") | |
| 23 | +public class NowSpeedingController extends BaseController<SysUser, Integer>{ | |
| 24 | + | |
| 25 | + @Autowired | |
| 26 | + private NowSpeedingService nowSpeedingService; | |
| 27 | + | |
| 28 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | |
| 29 | + public PageObject<Speeding> pagequery(@RequestParam Map<String, Object> map){ | |
| 30 | + PageObject<Speeding> pageObject = null; | |
| 31 | + map.put("curPage", map.get("page").toString()); | |
| 32 | + map.put("pageData","10"); | |
| 33 | + pageObject=nowSpeedingService.Pagequery(map); | |
| 34 | + return pageObject; | |
| 35 | + } | |
| 36 | + | |
| 37 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | |
| 38 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | |
| 39 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | |
| 40 | + try { | |
| 41 | + map.put("isShow", 1); | |
| 42 | + modelMap = nowSpeedingService.getReport(map); | |
| 43 | + } catch (Exception e) { | |
| 44 | + e.printStackTrace(); | |
| 45 | + } | |
| 46 | + return modelMap; | |
| 47 | + } | |
| 48 | + | |
| 49 | + @RequestMapping(value = "/findPosition", method = RequestMethod.GET) | |
| 50 | + public List<Speeding> findPosition(@RequestParam String vehicle,@RequestParam String startdate,@RequestParam String enddate) throws ParseException { | |
| 51 | + String deviceid = BasicData.deviceId2NbbmMap.inverse().get(vehicle); | |
| 52 | + List<Speeding> listSpeeding = nowSpeedingService.findPosition(deviceid,startdate,enddate); | |
| 53 | + return listSpeeding; | |
| 54 | + } | |
| 55 | + | |
| 56 | +} | ... | ... |
src/main/java/com/bsth/controller/excep/SpeedingController.java
| 1 | 1 | package com.bsth.controller.excep; |
| 2 | 2 | |
| 3 | 3 | import java.text.ParseException; |
| 4 | -import java.util.ArrayList; | |
| 5 | 4 | import java.util.HashMap; |
| 6 | 5 | import java.util.List; |
| 7 | 6 | import java.util.Map; |
| ... | ... | @@ -10,17 +9,13 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
| 11 | 10 | import org.springframework.web.bind.annotation.RequestMethod; |
| 12 | 11 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | -import org.springframework.web.bind.annotation.ResponseBody; | |
| 14 | 12 | import org.springframework.web.bind.annotation.RestController; |
| 15 | 13 | |
| 16 | 14 | import com.bsth.controller.BaseController; |
| 17 | 15 | import com.bsth.data.BasicData; |
| 18 | -import com.bsth.entity.excep.Offline; | |
| 19 | 16 | import com.bsth.entity.excep.Speeding; |
| 20 | 17 | import com.bsth.entity.sys.SysUser; |
| 21 | -import com.bsth.service.excep.OfflineService; | |
| 22 | 18 | import com.bsth.service.excep.SpeedingService; |
| 23 | -import com.bsth.service.gps.entity.GpsSpeed; | |
| 24 | 19 | import com.bsth.util.PageObject; |
| 25 | 20 | |
| 26 | 21 | @RestController | ... | ... |
src/main/java/com/bsth/data/BasicData.java
| ... | ... | @@ -169,8 +169,6 @@ public class BasicData implements CommandLineRunner { |
| 169 | 169 | geoCacheData.loadData(); |
| 170 | 170 | station2ParkBuffer.saveAll(); |
| 171 | 171 | logger.info("加载基础数据成功!,"); |
| 172 | - //人员拼音转换 | |
| 173 | - persionPinYinBuffer.refresh(); | |
| 174 | 172 | } catch (Exception e) { |
| 175 | 173 | logger.error("加载基础数据时出现异常,", e); |
| 176 | 174 | } |
| ... | ... | @@ -355,6 +353,9 @@ public class BasicData implements CommandLineRunner { |
| 355 | 353 | //spyMap = spyTempMap; |
| 356 | 354 | allPerson = allPersonMap; |
| 357 | 355 | perMap = perTempMap; |
| 356 | + | |
| 357 | + //人员拼音转换 | |
| 358 | + persionPinYinBuffer.refresh(); | |
| 358 | 359 | } |
| 359 | 360 | } |
| 360 | 361 | } | ... | ... |
src/main/java/com/bsth/data/LineConfigData.java
| ... | ... | @@ -64,7 +64,7 @@ public class LineConfigData implements CommandLineRunner { |
| 64 | 64 | */ |
| 65 | 65 | public long applyOut(ScheduleRealInfo sch, Long timestamp) { |
| 66 | 66 | LineConfig config = lineConfMap.get(sch.getXlBm()); |
| 67 | - int diff = sch.getXlDir()=="0"?config.getUpOutDiff():config.getDownOutDiff(); | |
| 67 | + int diff = sch.getXlDir().equals("0")?config.getUpOutDiff():config.getDownOutDiff(); | |
| 68 | 68 | return timestamp - (diff * 1000); |
| 69 | 69 | } |
| 70 | 70 | |
| ... | ... | @@ -76,7 +76,7 @@ public class LineConfigData implements CommandLineRunner { |
| 76 | 76 | */ |
| 77 | 77 | public long applyIn(ScheduleRealInfo sch, Long timestamp){ |
| 78 | 78 | LineConfig config = lineConfMap.get(sch.getXlBm()); |
| 79 | - int diff = sch.getXlDir()=="0"?config.getUpInDiff():config.getDownInDiff(); | |
| 79 | + int diff = sch.getXlDir().equals("0")?config.getUpInDiff():config.getDownInDiff(); | |
| 80 | 80 | return timestamp - (diff * 1000); |
| 81 | 81 | } |
| 82 | 82 | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/CorrectSignalHandle.java
| ... | ... | @@ -53,18 +53,18 @@ public class CorrectSignalHandle extends SignalHandle { |
| 53 | 53 | |
| 54 | 54 | //(转发的数据不管) |
| 55 | 55 | if(gps.getSource() != 0){ |
| 56 | - //gps=非营运 && 班次=非空驶 ;切换到营运状态 | |
| 57 | - if(!gps.isService() && | |
| 56 | + //gps=非营运 或走向不对 && 班次=非空驶 ;切换到营运状态 | |
| 57 | + if((!gps.isService() || gps.getUpDown() != updown) && | |
| 58 | 58 | !dayOfSchedule.emptyService(task)){ |
| 59 | - gpsStatusManager.changeServiceState(gps.getNbbm(), updown, 0, null); | |
| 59 | + gpsStatusManager.changeServiceState(gps.getNbbm(), updown, 0, "同步@系统"); | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | //需要切换线路 |
| 63 | 63 | if(!task.getXlBm().equals(gps.getLineId())){ |
| 64 | - gpsStatusManager.changeLine(gps.getNbbm(), task.getXlBm(), null); | |
| 64 | + gpsStatusManager.changeLine(gps.getNbbm(), task.getXlBm(), "同步@系统"); | |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | return true; |
| 69 | 69 | } |
| 70 | -} | |
| 70 | +} | |
| 71 | 71 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
| ... | ... | @@ -2,6 +2,7 @@ package com.bsth.data.gpsdata.arrival.handlers; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.data.LineConfigData; |
| 4 | 4 | import com.bsth.data.gpsdata.GpsEntity; |
| 5 | +import com.bsth.data.gpsdata.arrival.GeoCacheData; | |
| 5 | 6 | import com.bsth.data.gpsdata.arrival.SignalHandle; |
| 6 | 7 | import com.bsth.data.gpsdata.arrival.utils.CircleQueue; |
| 7 | 8 | import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState; |
| ... | ... | @@ -178,7 +179,7 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 178 | 179 | outStationAndOutPark(sch); |
| 179 | 180 | logger.info("车辆:" + sch.getClZbh() + " 班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual()); |
| 180 | 181 | } |
| 181 | - else if(sch.getBcType().equals("out")){ | |
| 182 | + else if(isOutSch(sch)){ | |
| 182 | 183 | //有出场动作(起点站覆盖停车场时,并且不设置出站既出场,逻辑可能会走到这里) |
| 183 | 184 | try{ |
| 184 | 185 | if(isOutPark(gps, prev)){ |
| ... | ... | @@ -364,7 +365,7 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 364 | 365 | } |
| 365 | 366 | */ |
| 366 | 367 | //被起点站覆盖的情况下进场,没有设置出站既是出场,逻辑会走到这里(模拟进站信号) |
| 367 | - if(sch.getBcType().equals("in")){ | |
| 368 | + if(isInSch(sch)){ | |
| 368 | 369 | try{ |
| 369 | 370 | if(isInPark(gps, prev)){ |
| 370 | 371 | if(gps.getCarparkNo().equals(sch.getZdzCode())){ |
| ... | ... | @@ -505,4 +506,12 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 505 | 506 | return true; |
| 506 | 507 | return false; |
| 507 | 508 | } |
| 509 | + | |
| 510 | + private boolean isOutSch(ScheduleRealInfo sch){ | |
| 511 | + return sch.getBcType().equals("out") || GeoCacheData.tccMap.keySet().contains(sch.getQdzCode()); | |
| 512 | + } | |
| 513 | + | |
| 514 | + private boolean isInSch(ScheduleRealInfo sch){ | |
| 515 | + return sch.getBcType().equals("in") || GeoCacheData.tccMap.keySet().contains(sch.getZdzCode()); | |
| 516 | + } | |
| 508 | 517 | } |
| 509 | 518 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/data/gpsdata/status_manager/gps_line_state/LineStateHandle.java
| ... | ... | @@ -31,7 +31,7 @@ public class LineStateHandle { |
| 31 | 31 | /** 重发次数 */ |
| 32 | 32 | private final static int MAX_SEND_COUNT=3; |
| 33 | 33 | /** 重发间隔 */ |
| 34 | - private final static int SEND_SPACE=1000 * 60 * 5; | |
| 34 | + private final static int SEND_SPACE=1000 * 60 * 4; | |
| 35 | 35 | /** 最大有效时间 */ |
| 36 | 36 | private final static int MAX_AVAIL_TIME=1000 * 60 * 60 * 2; |
| 37 | 37 | ... | ... |
src/main/java/com/bsth/data/gpsdata/status_manager/gps_service_state/ServiceStateHandle.java
| ... | ... | @@ -13,7 +13,7 @@ import java.util.Collection; |
| 13 | 13 | import java.util.concurrent.ConcurrentHashMap; |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * 设备营运状态处理 | |
| 16 | + * 设备营运状态/上下行 处理 | |
| 17 | 17 | * Created by panzhao on 2017/7/13. |
| 18 | 18 | */ |
| 19 | 19 | @Component |
| ... | ... | @@ -31,9 +31,9 @@ public class ServiceStateHandle { |
| 31 | 31 | /** 重发次数 */ |
| 32 | 32 | private final static int MAX_SEND_COUNT=3; |
| 33 | 33 | /** 重发间隔 */ |
| 34 | - private final static int SEND_SPACE=1000 * 60 * 4; | |
| 34 | + private final static int SEND_SPACE=1000 * 60 * 3; | |
| 35 | 35 | /** 最大有效时间 */ |
| 36 | - private final static int MAX_AVAIL_TIME=1000 * 60 * 60; | |
| 36 | + private final static int MAX_AVAIL_TIME=1000 * 60 * 50; | |
| 37 | 37 | |
| 38 | 38 | static{ |
| 39 | 39 | map = new ConcurrentHashMap(); |
| ... | ... | @@ -67,9 +67,9 @@ public class ServiceStateHandle { |
| 67 | 67 | if(gps == null) |
| 68 | 68 | return; |
| 69 | 69 | |
| 70 | - if(gps.getState().equals(sb.getState())){ | |
| 70 | + if(gps.getState().equals(sb.getState()) && gps.getUpDown() == sb.getUpDown()){ | |
| 71 | 71 | map.remove(sb.getNbbm()); |
| 72 | - logger.info("营运状态切换成功," + sb.getNbbm() + "、" + sb.getState()); | |
| 72 | + logger.info("状态切换成功," + sb.getNbbm() + "、" + sb.getState() + "、" + sb.getUpDown()); | |
| 73 | 73 | } |
| 74 | 74 | else |
| 75 | 75 | reSend(sb); |
| ... | ... | @@ -88,14 +88,14 @@ public class ServiceStateHandle { |
| 88 | 88 | long diff = System.currentTimeMillis() - sb.getSt(); |
| 89 | 89 | if(diff >= MAX_AVAIL_TIME){ |
| 90 | 90 | map.remove(sb.getNbbm()); |
| 91 | - logger.info("营运状态切换超过有效时间," + sb.getNbbm() + "、" + sb.getState() + "、" + sb.getSt()); | |
| 91 | + logger.info("状态切换超过有效时间," + sb.getNbbm() + "、" + sb.getState() + "、" + sb.getSt()); | |
| 92 | 92 | return; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | if(diff >= SEND_SPACE){ |
| 96 | 96 | sb.setSender("补发@系统"); |
| 97 | 97 | changeState(sb); |
| 98 | - logger.info("重发营运状态切换指令," + sb.getNbbm() + "、" + sb.getState()); | |
| 98 | + logger.info("重发状态切换指令," + sb.getNbbm() + "、" + sb.getState() + "、" + sb.getUpDown()); | |
| 99 | 99 | return; |
| 100 | 100 | } |
| 101 | 101 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/thread/GpsDataLoaderThread.java
| ... | ... | @@ -154,6 +154,7 @@ public class GpsDataLoaderThread extends Thread { |
| 154 | 154 | CloseableHttpResponse response = null; |
| 155 | 155 | |
| 156 | 156 | try { |
| 157 | + logger.error("load start..."); | |
| 157 | 158 | httpClient = HttpClients.createDefault(); |
| 158 | 159 | HttpGet get = new HttpGet(clientUrl); |
| 159 | 160 | //超时时间 |
| ... | ... | @@ -174,6 +175,7 @@ public class GpsDataLoaderThread extends Thread { |
| 174 | 175 | |
| 175 | 176 | list = JSON.parseArray(stringBuffer.toString(), GpsEntity.class); |
| 176 | 177 | String nbbm; |
| 178 | + logger.error("load end!"); | |
| 177 | 179 | for (GpsEntity gps : list) { |
| 178 | 180 | |
| 179 | 181 | //没有设备号 | ... | ... |
src/main/java/com/bsth/entity/search/PredicatesBuilder.java
| ... | ... | @@ -34,7 +34,16 @@ public class PredicatesBuilder { |
| 34 | 34 | Class<?> leftType = expression.getJavaType(); |
| 35 | 35 | Class<?> rightType = object.getClass(); |
| 36 | 36 | |
| 37 | - if (Number.class.isAssignableFrom(leftType) && | |
| 37 | + if(Date.class.isAssignableFrom(leftType) && | |
| 38 | + String.class.isAssignableFrom(rightType)){ | |
| 39 | + DateTime dateTime = new DateTime(object); | |
| 40 | + return cb.equal(expression, dateTime.toDate()); | |
| 41 | + } | |
| 42 | + else { | |
| 43 | + return cb.equal(expression, object); | |
| 44 | + } | |
| 45 | + | |
| 46 | + /*if (Number.class.isAssignableFrom(leftType) && | |
| 38 | 47 | (Number.class.isAssignableFrom(rightType) || String.class.isAssignableFrom(rightType))) { // Number == Number/String |
| 39 | 48 | return cb.equal(expression, object); |
| 40 | 49 | } else if (String.class.isAssignableFrom(leftType) && |
| ... | ... | @@ -52,8 +61,7 @@ public class PredicatesBuilder { |
| 52 | 61 | return cb.equal(expression, dateTime.toDate()); |
| 53 | 62 | } else { |
| 54 | 63 | throw new RuntimeException("eq 不支持类型组合:" + expression.getJavaType() + "==" + object.getClass()); |
| 55 | - } | |
| 56 | - | |
| 64 | + }*/ | |
| 57 | 65 | } |
| 58 | 66 | |
| 59 | 67 | public static Predicate ne(CriteriaBuilder cb,Path<?> expression, Object object){ | ... | ... |
src/main/java/com/bsth/service/excep/NowAbnormalService.java
0 → 100644
src/main/java/com/bsth/service/excep/NowOfflineService.java
0 → 100644
| 1 | +package com.bsth.service.excep; | |
| 2 | + | |
| 3 | +import java.sql.ResultSet; | |
| 4 | +import java.sql.SQLException; | |
| 5 | +import java.util.List; | |
| 6 | +import java.util.Map; | |
| 7 | + | |
| 8 | +import com.bsth.entity.excep.Offline; | |
| 9 | +import com.bsth.util.PageObject; | |
| 10 | + | |
| 11 | +public interface NowOfflineService { | |
| 12 | +// List<Offline> findAll(Map<String, Object> map); | |
| 13 | + PageObject <Offline> Pagequery(Map<String, Object> map) ; | |
| 14 | +// List<Offline> resultSet2Set(ResultSet rs) throws SQLException; | |
| 15 | + Map<String, Object> getReport( Map<String, Object> map); | |
| 16 | +} | ... | ... |
src/main/java/com/bsth/service/excep/NowOutboundService.java
0 → 100644
| 1 | +package com.bsth.service.excep; | |
| 2 | + | |
| 3 | +import java.util.Map; | |
| 4 | + | |
| 5 | +import com.bsth.entity.excep.Outbound; | |
| 6 | +import com.bsth.util.PageObject; | |
| 7 | + | |
| 8 | +public interface NowOutboundService { | |
| 9 | + PageObject <Outbound> Pagequery(Map<String, Object> map) ; | |
| 10 | + Map<String, Object> getReport( Map<String, Object> map); | |
| 11 | +} | ... | ... |
src/main/java/com/bsth/service/excep/NowSpeedingService.java
0 → 100644
| 1 | +package com.bsth.service.excep; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import java.util.Map; | |
| 5 | +import com.bsth.entity.excep.Speeding; | |
| 6 | +import com.bsth.util.PageObject; | |
| 7 | + | |
| 8 | +public interface NowSpeedingService { | |
| 9 | + PageObject <Speeding> Pagequery(Map<String, Object> map); | |
| 10 | + Map<String, Object> getReport( Map<String, Object> map); | |
| 11 | + List<Speeding> findPosition(String deviceid, String startdate, | |
| 12 | + String enddate); | |
| 13 | + | |
| 14 | +} | ... | ... |
src/main/java/com/bsth/service/excep/impl/NowAbnormalServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.excep.impl; | |
| 2 | + | |
| 3 | +import java.sql.Connection; | |
| 4 | +import java.sql.PreparedStatement; | |
| 5 | +import java.sql.ResultSet; | |
| 6 | +import java.sql.SQLException; | |
| 7 | +import java.util.ArrayList; | |
| 8 | +import java.util.List; | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 11 | +import org.springframework.stereotype.Service; | |
| 12 | + | |
| 13 | +import com.bsth.entity.excep.Abnormal; | |
| 14 | +import com.bsth.service.excep.AbnormalService; | |
| 15 | +import com.bsth.service.excep.NowAbnormalService; | |
| 16 | +import com.bsth.util.PageHelper; | |
| 17 | +import com.bsth.util.PageObject; | |
| 18 | +import com.bsth.util.db.DBUtils_MS; | |
| 19 | + | |
| 20 | +@Service | |
| 21 | +public class NowAbnormalServiceImpl implements NowAbnormalService { | |
| 22 | + | |
| 23 | + static List<Abnormal> findAll(Map<String, Object> map) { | |
| 24 | + // TODO Auto-generated method stub | |
| 25 | + | |
| 26 | + //查询条件 | |
| 27 | + | |
| 28 | + Connection conn = null; | |
| 29 | + PreparedStatement ps = null; | |
| 30 | + ResultSet rs = null; | |
| 31 | + int page=Integer.parseInt(map.get("page").toString()); | |
| 32 | + List<Abnormal> list=new ArrayList<Abnormal>(); | |
| 33 | + /* | |
| 34 | + String sql="SELECT * FROM (SELECT A.*,ROWNUM R FROM ( " | |
| 35 | + + "select * from bsth_c_offline) A " | |
| 36 | + + "WHERE ROWNUM <= ? ) B WHERE R >?";*/ | |
| 37 | + String sql="select * from bsth_c_device_abnormal where 1=1 "; | |
| 38 | + Object nbbm=map.get("nbbm"); | |
| 39 | + | |
| 40 | + if(nbbm!=null){ | |
| 41 | + if(nbbm.toString()!="") | |
| 42 | + sql +=" and vehicle like '%"+nbbm+"%'"; | |
| 43 | + } | |
| 44 | + | |
| 45 | + sql +=" order by id limit ?,?"; | |
| 46 | + | |
| 47 | + try { | |
| 48 | + conn = DBUtils_MS.getConnection(); | |
| 49 | + ps = conn.prepareStatement(sql); | |
| 50 | + ps.setInt(1, page*10); // O-最大条数 -- M-起始条数 | |
| 51 | + ps.setInt(2, 10); // O-最小条数 -- M-显示条数 | |
| 52 | + rs = ps.executeQuery(); | |
| 53 | + list = resultSet2Set(rs); | |
| 54 | + } catch (SQLException e) { | |
| 55 | + // TODO Auto-generated catch block | |
| 56 | + e.printStackTrace(); | |
| 57 | + }finally { | |
| 58 | + DBUtils_MS.close(rs, ps, conn); | |
| 59 | + } | |
| 60 | + | |
| 61 | + return list; | |
| 62 | + } | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 数据转换 | |
| 66 | + */ | |
| 67 | +// @Override | |
| 68 | + static List<Abnormal> resultSet2Set(ResultSet rs) throws SQLException{ | |
| 69 | + // TODO Auto-generated method stub | |
| 70 | + List<Abnormal> list=new ArrayList<Abnormal>(); | |
| 71 | + Abnormal abnormal; | |
| 72 | + while(rs.next()){ | |
| 73 | + abnormal=new Abnormal(); | |
| 74 | + abnormal.setId(Integer.valueOf(rs.getObject("id").toString())); | |
| 75 | + abnormal.setDrift(Integer.valueOf(rs.getObject("drift").toString())); | |
| 76 | + abnormal.setOffline(Integer.valueOf(rs.getObject("offline").toString())); | |
| 77 | + abnormal.setProtocol(Integer.valueOf(rs.getObject("protocol").toString())); | |
| 78 | + abnormal.setVehicle(rs.getObject("vehicle").toString()); | |
| 79 | + list.add(abnormal); | |
| 80 | + } | |
| 81 | + return list; | |
| 82 | + } | |
| 83 | + | |
| 84 | + @Override | |
| 85 | + public PageObject<Abnormal> Pagequery(Map<String, Object> map) { | |
| 86 | + // TODO Auto-generated method stub | |
| 87 | + String sql="select count(*) record from bsth_c_device_abnormal where 1=1 "; | |
| 88 | + Object nbbm=map.get("nbbm"); | |
| 89 | + if(nbbm!=null){ | |
| 90 | + if(nbbm.toString()!="") | |
| 91 | + sql +=" and vehicle like '%"+nbbm+"%'"; | |
| 92 | + } | |
| 93 | + Connection conn = null; | |
| 94 | + PreparedStatement ps = null; | |
| 95 | + ResultSet rs = null; | |
| 96 | + int totalData = 0; | |
| 97 | + try { | |
| 98 | + conn = DBUtils_MS.getConnection(); | |
| 99 | + ps = conn.prepareStatement(sql); | |
| 100 | + rs = ps.executeQuery(); | |
| 101 | + if(rs.next()){ | |
| 102 | + totalData=rs.getInt("record"); | |
| 103 | + } | |
| 104 | + } catch (SQLException e) { | |
| 105 | + // TODO Auto-generated catch block | |
| 106 | + e.printStackTrace(); | |
| 107 | + }finally { | |
| 108 | + DBUtils_MS.close(rs, ps, conn); | |
| 109 | + } | |
| 110 | + PageHelper pageHelper = new PageHelper(totalData, map); | |
| 111 | +// List<T> list = this.baseDao.queryByObject(pageHelper.getMap()); | |
| 112 | + List<Abnormal> list=findAll(pageHelper.getMap()); | |
| 113 | + PageObject<Abnormal> pageObject = pageHelper.getPageObject(); | |
| 114 | + pageObject.setDataList(list); | |
| 115 | + return pageObject; | |
| 116 | + } | |
| 117 | + | |
| 118 | +} | ... | ... |
src/main/java/com/bsth/service/excep/impl/NowOfflineServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.excep.impl; | |
| 2 | + | |
| 3 | +import java.sql.Connection; | |
| 4 | +import java.sql.PreparedStatement; | |
| 5 | +import java.sql.ResultSet; | |
| 6 | +import java.sql.SQLException; | |
| 7 | +import java.text.DateFormat; | |
| 8 | +import java.text.ParseException; | |
| 9 | +import java.text.SimpleDateFormat; | |
| 10 | +import java.util.ArrayList; | |
| 11 | +import java.util.Date; | |
| 12 | +import java.util.HashMap; | |
| 13 | +import java.util.List; | |
| 14 | +import java.util.Map; | |
| 15 | + | |
| 16 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 17 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 18 | +import org.springframework.jdbc.core.RowMapper; | |
| 19 | +import org.springframework.stereotype.Service; | |
| 20 | + | |
| 21 | +import com.bsth.data.BasicData; | |
| 22 | +import com.bsth.entity.excep.Offline; | |
| 23 | +import com.bsth.entity.oil.Ylb; | |
| 24 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 25 | +import com.bsth.service.excep.NowOfflineService; | |
| 26 | +import com.bsth.service.excep.OfflineService; | |
| 27 | +import com.bsth.util.EchartConver; | |
| 28 | +import com.bsth.util.PageHelper; | |
| 29 | +import com.bsth.util.PageObject; | |
| 30 | +import com.bsth.util.db.DBUtils_MS; | |
| 31 | +import com.github.abel533.echarts.Option; | |
| 32 | +import com.google.gson.Gson; | |
| 33 | + | |
| 34 | +@Service | |
| 35 | +public class NowOfflineServiceImpl implements NowOfflineService { | |
| 36 | + | |
| 37 | + @Autowired | |
| 38 | + JdbcTemplate jdbcTemplate; | |
| 39 | + public List<Offline> findGPS(Map<String, Object> map) { | |
| 40 | + Connection conn = null; | |
| 41 | + PreparedStatement ps = null; | |
| 42 | + ResultSet rs = null; | |
| 43 | + List<Offline> list=new ArrayList<Offline>(); | |
| 44 | + String days_year=map.get("days_year").toString(); | |
| 45 | + String line_id=map.get("line_id").toString(); | |
| 46 | + String device_id=map.get("device_id").toString(); | |
| 47 | + String ts=map.get("ts").toString(); | |
| 48 | + String sql="SELECT t.line_id,t.device_id,MIN(ts) as ts,days_year FROM bsth_c_gps_info t " | |
| 49 | + + " WHERE t.line_id='"+line_id+"' and t.device_id='"+device_id+"' and t.days_year='"+days_year+"' and t.ts>='"+ts+"' " | |
| 50 | + + " GROUP BY t.device_id,t.line_id "; | |
| 51 | + sql +=" order by ts "; | |
| 52 | + try { | |
| 53 | + conn = DBUtils_MS.getConnection(); | |
| 54 | + ps = conn.prepareStatement(sql); | |
| 55 | +// ps.setInt(1,0*10); // O-最大条数 -- M-起始条数 | |
| 56 | +// ps.setInt(2, 1000000); // O-最小条数 -- M-显示条数 | |
| 57 | + rs = ps.executeQuery(); | |
| 58 | + list = resultSet(rs); | |
| 59 | + } catch (SQLException e) { | |
| 60 | + // TODO Auto-generated catch block | |
| 61 | + e.printStackTrace(); | |
| 62 | + }finally { | |
| 63 | + DBUtils_MS.close(rs, ps, conn); | |
| 64 | + } | |
| 65 | + | |
| 66 | + return list; | |
| 67 | + } | |
| 68 | + | |
| 69 | + // @Override | |
| 70 | + static List<Offline> findAll(Map<String, Object> map) { | |
| 71 | + // TODO Auto-generated method stub | |
| 72 | + | |
| 73 | + //查询条件 | |
| 74 | + | |
| 75 | + Connection conn = null; | |
| 76 | + PreparedStatement ps = null; | |
| 77 | + ResultSet rs = null; | |
| 78 | + int page=Integer.parseInt(map.get("page").toString()); | |
| 79 | + List<Offline> list=new ArrayList<Offline>(); | |
| 80 | + /* | |
| 81 | + String sql="SELECT * FROM (SELECT A.*,ROWNUM R FROM ( " | |
| 82 | + + "select * from bsth_c_offline) A " | |
| 83 | + + "WHERE ROWNUM <= ? ) B WHERE R >?";*/ | |
| 84 | + String sql="select * from bsth_c_offline where 1=1 "; | |
| 85 | + Object line=map.get("line"); | |
| 86 | + Object nbbm=map.get("nbbm"); | |
| 87 | + Object updown=map.get("updown"); | |
| 88 | + Object date=map.get("date"); | |
| 89 | + | |
| 90 | + if(line!=null){ | |
| 91 | + sql +=" and line like'%"+line.toString().trim()+"%'"; | |
| 92 | + } | |
| 93 | + | |
| 94 | + if(nbbm!=null){ | |
| 95 | + nbbm=BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 96 | + if(nbbm!=null) | |
| 97 | + sql +=" and vehicle like '%"+nbbm+"%'"; | |
| 98 | + } | |
| 99 | + | |
| 100 | + if(updown!=null){ | |
| 101 | + sql +="and up_down like '%"+updown.toString()+"%'"; | |
| 102 | + } | |
| 103 | + if(date!=null){ | |
| 104 | + if (date.toString().length()>0) { | |
| 105 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 106 | + try { | |
| 107 | + Long t1=sdf.parse(date.toString()+" 00:00:00").getTime(); | |
| 108 | + Long t2=sdf.parse(date.toString()+" 23:59:59").getTime(); | |
| 109 | + sql += " and timestamp >="+t1 +" and timestamp <="+t2; | |
| 110 | + } catch (ParseException e) { | |
| 111 | + // TODO Auto-generated catch block | |
| 112 | + e.printStackTrace(); | |
| 113 | + } | |
| 114 | + } | |
| 115 | + | |
| 116 | + } | |
| 117 | + sql +=" order by id limit ?,?"; | |
| 118 | + | |
| 119 | + try { | |
| 120 | + conn = DBUtils_MS.getConnection(); | |
| 121 | + ps = conn.prepareStatement(sql); | |
| 122 | + ps.setInt(1, page*10); // O-最大条数 -- M-起始条数 | |
| 123 | + ps.setInt(2, 10); // O-最小条数 -- M-显示条数 | |
| 124 | + rs = ps.executeQuery(); | |
| 125 | + list = resultSet2Set(rs); | |
| 126 | + } catch (SQLException e) { | |
| 127 | + // TODO Auto-generated catch block | |
| 128 | + e.printStackTrace(); | |
| 129 | + }finally { | |
| 130 | + DBUtils_MS.close(rs, ps, conn); | |
| 131 | + } | |
| 132 | + | |
| 133 | + return list; | |
| 134 | + } | |
| 135 | + public List<Offline> resultSet(ResultSet rs) throws SQLException{ | |
| 136 | + // TODO Auto-generated method stub | |
| 137 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); | |
| 138 | + List<Offline> list=new ArrayList<Offline>(); | |
| 139 | + Offline offline; | |
| 140 | + while(rs.next()){ | |
| 141 | + offline=new Offline(); | |
| 142 | + offline.setTs(Long.parseLong(rs.getObject("ts").toString())); | |
| 143 | + list.add(offline); | |
| 144 | + } | |
| 145 | + return list; | |
| 146 | + } | |
| 147 | + /** | |
| 148 | + * 数据转换 | |
| 149 | + */ | |
| 150 | +// @Override | |
| 151 | + static List<Offline> resultSet2Set(ResultSet rs) throws SQLException{ | |
| 152 | + // TODO Auto-generated method stub | |
| 153 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); | |
| 154 | + List<Offline> list=new ArrayList<Offline>(); | |
| 155 | + Offline offline; | |
| 156 | + while(rs.next()){ | |
| 157 | + offline=new Offline(); | |
| 158 | + offline.setId(Integer.valueOf(rs.getObject("id").toString())); | |
| 159 | + offline.setLat(Float.valueOf(rs.getObject("lat").toString())); | |
| 160 | + offline.setLine(Integer.valueOf(rs.getObject("line").toString())); | |
| 161 | + //run 时注解 | |
| 162 | + offline.setLineName(BasicData.lineCode2NameMap.get(offline.getLine().toString())); | |
| 163 | + offline.setLon(Float.valueOf(rs.getObject("lon").toString())); | |
| 164 | + offline.setTimestamp(Long.valueOf(rs.getObject("timestamp").toString())); | |
| 165 | + offline.setTimestampDate(sdf.format(new Date(offline.getTimestamp()))); | |
| 166 | + offline.setUpDown(Integer.valueOf(rs.getObject("up_down").toString())); | |
| 167 | + offline.setVehicle(BasicData.deviceId2NbbmMap.get(rs.getObject("vehicle").toString())); | |
| 168 | + offline.setDeviceid(rs.getObject("vehicle").toString()); | |
| 169 | + list.add(offline); | |
| 170 | + } | |
| 171 | + return list; | |
| 172 | + } | |
| 173 | + | |
| 174 | + | |
| 175 | + @SuppressWarnings("unchecked") | |
| 176 | + public PageObject <Offline> Pagequery(Map<String, Object> map) { | |
| 177 | + // TODO Auto-generated method stub | |
| 178 | + | |
| 179 | + String sql="select count(*) record from bsth_c_offline where 1=1 "; | |
| 180 | + | |
| 181 | + Object line=map.get("line"); | |
| 182 | + Object nbbm=map.get("nbbm"); | |
| 183 | + Object updown=map.get("updown"); | |
| 184 | + | |
| 185 | + Object date=map.get("date"); | |
| 186 | + | |
| 187 | + if(line!=null){ | |
| 188 | + sql +=" and line like'%"+line.toString().trim()+"%'"; | |
| 189 | + } | |
| 190 | + | |
| 191 | + if(nbbm!=null){ | |
| 192 | + nbbm=BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 193 | + if(nbbm!=null) | |
| 194 | + sql +=" and vehicle like '%"+nbbm+"%'"; | |
| 195 | + } | |
| 196 | + | |
| 197 | + if(updown!=null){ | |
| 198 | + sql +="and up_down like '%"+updown.toString()+"%'"; | |
| 199 | + } | |
| 200 | + if(date!=null){ | |
| 201 | + if (date.toString().length()>0) { | |
| 202 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 203 | + try { | |
| 204 | + Long t1=sdf.parse(date.toString()+" 00:00:00").getTime(); | |
| 205 | + Long t2=sdf.parse(date.toString()+" 23:59:59").getTime(); | |
| 206 | + sql += " and timestamp >="+t1 +" and timestamp <="+t2; | |
| 207 | + } catch (ParseException e) { | |
| 208 | + // TODO Auto-generated catch block | |
| 209 | + e.printStackTrace(); | |
| 210 | + } | |
| 211 | + } | |
| 212 | + | |
| 213 | + } | |
| 214 | + | |
| 215 | + Connection conn = null; | |
| 216 | + PreparedStatement ps = null; | |
| 217 | + ResultSet rs = null; | |
| 218 | + int totalData = 0; | |
| 219 | + | |
| 220 | + try { | |
| 221 | + conn = DBUtils_MS.getConnection(); | |
| 222 | + ps = conn.prepareStatement(sql); | |
| 223 | + rs = ps.executeQuery(); | |
| 224 | + if(rs.next()){ | |
| 225 | + totalData=rs.getInt("record"); | |
| 226 | + } | |
| 227 | + } catch (SQLException e) { | |
| 228 | + // TODO Auto-generated catch block | |
| 229 | + e.printStackTrace(); | |
| 230 | + }finally { | |
| 231 | + DBUtils_MS.close(rs, ps, conn); | |
| 232 | + } | |
| 233 | + PageHelper pageHelper = new PageHelper(totalData, map); | |
| 234 | +// List<T> list = this.baseDao.queryByObject(pageHelper.getMap()); | |
| 235 | + List<Offline> list=findAll(pageHelper.getMap()); | |
| 236 | + for (int i = 0; i < list.size(); i++) { | |
| 237 | + int lineid= list.get(i).getLine(); | |
| 238 | + String nbbm2=list.get(i).getVehicle(); | |
| 239 | + String deviceid=list.get(i).getDeviceid(); | |
| 240 | + Long d1=list.get(i).getTimestamp(); | |
| 241 | + Date datess = new Date(d1); | |
| 242 | + String dates=new SimpleDateFormat("yyyy-MM-dd").format(datess); | |
| 243 | + String sk=new SimpleDateFormat("HH:mm").format(datess); | |
| 244 | + String sqlPbb="SELECT * FROM ( select lp_name,cl_zbh,j_gh,j_name,MIN(fcsj) as fcsj,MAX(zdsj) as ddsj" | |
| 245 | + + " from bsth_c_s_sp_info_real where cl_zbh='"+nbbm2+"' and" | |
| 246 | + + " real_exec_date='"+dates+"' GROUP BY cl_zbh,lp_name,j_gh,j_name ) t WHERE t.fcsj<='"+sk+"' AND t.ddsj>='"+sk+"' " ; | |
| 247 | + List<ScheduleRealInfo> pbb =jdbcTemplate.query(sqlPbb, | |
| 248 | + new RowMapper<ScheduleRealInfo>(){ | |
| 249 | + @Override | |
| 250 | + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 251 | + ScheduleRealInfo s = new ScheduleRealInfo(); | |
| 252 | + s.setjGh(rs.getString("j_gh")); | |
| 253 | + s.setjName(rs.getString("j_name")); | |
| 254 | + s.setLpName(rs.getString("lp_name")); | |
| 255 | + return s; | |
| 256 | + } | |
| 257 | + }); | |
| 258 | + Map<String, Object> gpsmap=new HashMap<>(); | |
| 259 | + String str = String.format("%tj",datess); | |
| 260 | + gpsmap.put("device_id",deviceid ); | |
| 261 | + gpsmap.put("line_id", lineid); | |
| 262 | + gpsmap.put("days_year", str); | |
| 263 | + gpsmap.put("ts", d1); | |
| 264 | + List<Offline> gps=findGPS(gpsmap); | |
| 265 | + if(gps.size()>0){ | |
| 266 | + Long ts= gps.get(0).getTs(); | |
| 267 | + String ts1 =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(ts)); | |
| 268 | + list.get(0).setTsdate(ts1); | |
| 269 | + } | |
| 270 | + if(pbb.size()>0){ | |
| 271 | + list.get(i).setJsy(pbb.get(0).getjGh()+"/"+pbb.get(0).getjName()); | |
| 272 | + list.get(i).setLpname(pbb.get(0).getLpName()); | |
| 273 | + } | |
| 274 | + | |
| 275 | + } | |
| 276 | + | |
| 277 | + PageObject<Offline> pageObject = pageHelper.getPageObject(); | |
| 278 | + pageObject.setDataList(list); | |
| 279 | + | |
| 280 | + return pageObject; | |
| 281 | + } | |
| 282 | + public static void main(String[] args) { | |
| 283 | + // TODO Auto-generated method stub | |
| 284 | + Map<String, Object> map=new HashMap<String,Object>(); | |
| 285 | + map.put("pageData","20"); | |
| 286 | + map.put("curPage", "1"); | |
| 287 | + String sql="select count(*) record from bsth_c_offline"; | |
| 288 | + Connection conn = null; | |
| 289 | + PreparedStatement ps = null; | |
| 290 | + ResultSet rs = null; | |
| 291 | + int totalData = 0; | |
| 292 | + | |
| 293 | + try { | |
| 294 | + conn = DBUtils_MS.getConnection(); | |
| 295 | + ps = conn.prepareStatement(sql); | |
| 296 | + rs = ps.executeQuery(); | |
| 297 | + if(rs.next()){ | |
| 298 | + totalData=rs.getInt("record"); | |
| 299 | + } | |
| 300 | + } catch (SQLException e) { | |
| 301 | + // TODO Auto-generated catch block | |
| 302 | + e.printStackTrace(); | |
| 303 | + }finally { | |
| 304 | + DBUtils_MS.close(rs, ps, conn); | |
| 305 | + } | |
| 306 | + PageHelper pageHelper = new PageHelper(totalData, map); | |
| 307 | +// List<T> list = this.baseDao.queryByObject(pageHelper.getMap()); | |
| 308 | + List<Offline> list=findAll(pageHelper.getMap()); | |
| 309 | + PageObject<Offline> pageObject = pageHelper.getPageObject(); | |
| 310 | + pageObject.setDataList(list); | |
| 311 | + System.out.println(""); | |
| 312 | + } | |
| 313 | + | |
| 314 | + @Override | |
| 315 | + public Map<String, Object> getReport(Map<String, Object> map) { | |
| 316 | + // TODO Auto-generated method stub | |
| 317 | + String chartStr = ""; | |
| 318 | + Map<String, Object> mapValue = new HashMap<String, Object>(); | |
| 319 | + try { | |
| 320 | + String xAxisName = map.get("xAxisName").toString(); | |
| 321 | + String legendName = map.get("legendName").toString(); | |
| 322 | + String xAxisItem = ""; | |
| 323 | + String xAxisOrderBy = ""; | |
| 324 | + String legendItem = ""; | |
| 325 | + String legendOrderBy = ""; | |
| 326 | + if(xAxisName!=null){ | |
| 327 | + String [] xaxis = xAxisName.split(":"); | |
| 328 | + if(xaxis.length>1 && xaxis[1].toLowerCase().contains("date")){ | |
| 329 | + //本来还要判断下日期格式是否标准 | |
| 330 | + xAxisItem = "to_char("+xaxis[0]+",'"+xaxis[2]+"') "; | |
| 331 | + xAxisOrderBy = (xaxis.length>3?xaxis[3]:""); | |
| 332 | + }else{ | |
| 333 | + xAxisItem = xaxis[0]; | |
| 334 | + } | |
| 335 | + } | |
| 336 | + if(legendName!=null){ | |
| 337 | + String [] legend = legendName.split(":"); | |
| 338 | + if(legend.length>1 && legend[1].toLowerCase().contains("date")){ | |
| 339 | + //本来还要判断下日期格式是否标准 | |
| 340 | + legendItem = "to_char("+legend[0]+",'"+legend[2]+"') "; | |
| 341 | + legendOrderBy = (legend[3].length()>3?legend[3]:""); | |
| 342 | + }else{ | |
| 343 | + legendItem = legend[0]; | |
| 344 | + } | |
| 345 | + } | |
| 346 | + map.put("xAxisItem", xAxisItem); | |
| 347 | + map.put("xAxisOrderBy", xAxisOrderBy); | |
| 348 | + map.put("legendItem", legendItem); | |
| 349 | + map.put("legendOrderBy", legendOrderBy); | |
| 350 | + List dataList = new ArrayList(); | |
| 351 | + dataList =getReportList(map); | |
| 352 | + EchartConver echart = new EchartConver(map); | |
| 353 | + Option option = echart.getOption(dataList); | |
| 354 | + Gson gson = new Gson(); | |
| 355 | + chartStr = gson.toJsonTree(option).toString(); | |
| 356 | + mapValue.put("dataList", dataList); | |
| 357 | + mapValue.put("option", chartStr); | |
| 358 | + } catch (Exception e) { | |
| 359 | + e.printStackTrace(); | |
| 360 | + } | |
| 361 | + return mapValue; | |
| 362 | + } | |
| 363 | + | |
| 364 | + static List getReportList(Map<String, Object> map) { | |
| 365 | + List dataList = new ArrayList(); | |
| 366 | + String times=""; | |
| 367 | + Object dataTime=map.get("dataTime"); | |
| 368 | + Object line=map.get("line"); | |
| 369 | + String addSql=""; | |
| 370 | + if(line !=null){ | |
| 371 | + if(line.toString()!=""){ | |
| 372 | + addSql =" and line =" +line; | |
| 373 | + } | |
| 374 | + } | |
| 375 | + if(dataTime!=null){ | |
| 376 | + times=dataTime.toString(); | |
| 377 | + } | |
| 378 | + if(times.equals("")){ | |
| 379 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 380 | + times=sdf.format(new Date()); | |
| 381 | + } | |
| 382 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 383 | + String times1=times+" 00:00:01"; | |
| 384 | + String times2=times+" 23:59:59"; | |
| 385 | + | |
| 386 | + Connection conn = null; | |
| 387 | + PreparedStatement ps = null; | |
| 388 | + ResultSet rs = null; | |
| 389 | + try { | |
| 390 | + Long t1=simpleDateFormat.parse(times1).getTime(); | |
| 391 | + Long t2=simpleDateFormat.parse(times2).getTime(); | |
| 392 | + String sql="SELECT up_down xAxis , line legend,count(*) series"+ | |
| 393 | + " FROM bsth_c_offline "+ | |
| 394 | + "where timestamp>? and timestamp<? "+addSql+" group by xAxis ,legend"; | |
| 395 | + conn = DBUtils_MS.getConnection(); | |
| 396 | + ps = conn.prepareStatement(sql); | |
| 397 | + ps.setLong(1, t1); | |
| 398 | + ps.setLong(2, t2); | |
| 399 | + rs = ps.executeQuery(); | |
| 400 | + while(rs.next()){ | |
| 401 | + Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 402 | + if(rs.getObject("xAxis").toString().equals("0")) | |
| 403 | + newMap.put("xAxis", "上行"); | |
| 404 | + else if(rs.getObject("xAxis").toString().equals("1")) | |
| 405 | + newMap.put("xAxis", "下行"); | |
| 406 | + else | |
| 407 | + newMap.put("xAxis", "无效"); | |
| 408 | + | |
| 409 | + if(BasicData.lineCode2NameMap.get(rs.getObject("legend").toString())!=null && BasicData.lineCode2NameMap.get(rs.getObject("legend").toString())!="" ) | |
| 410 | + newMap.put("legend", BasicData.lineCode2NameMap.get(rs.getObject("legend").toString())); | |
| 411 | + else | |
| 412 | + newMap.put("legend", "编码"+rs.getObject("legend").toString()); | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + newMap.put("series", Integer.parseInt(rs.getObject("series").toString())); | |
| 417 | + dataList.add(newMap); | |
| 418 | + } | |
| 419 | + | |
| 420 | + } catch (SQLException e) { | |
| 421 | + // TODO Auto-generated catch block | |
| 422 | + e.printStackTrace(); | |
| 423 | + }catch (ParseException e1) { | |
| 424 | + // TODO Auto-generated catch block | |
| 425 | + e1.printStackTrace(); | |
| 426 | + }finally { | |
| 427 | + DBUtils_MS.close(rs, ps, conn); | |
| 428 | + } | |
| 429 | + | |
| 430 | + return dataList; | |
| 431 | + } | |
| 432 | + | |
| 433 | +} | ... | ... |
src/main/java/com/bsth/service/excep/impl/NowOutboundServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.excep.impl; | |
| 2 | + | |
| 3 | +import java.sql.Connection; | |
| 4 | +import java.sql.PreparedStatement; | |
| 5 | +import java.sql.ResultSet; | |
| 6 | +import java.sql.SQLException; | |
| 7 | +import java.text.ParseException; | |
| 8 | +import java.text.SimpleDateFormat; | |
| 9 | +import java.util.ArrayList; | |
| 10 | +import java.util.Date; | |
| 11 | +import java.util.HashMap; | |
| 12 | +import java.util.List; | |
| 13 | +import java.util.Map; | |
| 14 | + | |
| 15 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 16 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 17 | +import org.springframework.jdbc.core.RowMapper; | |
| 18 | +import org.springframework.stereotype.Service; | |
| 19 | + | |
| 20 | +import com.bsth.data.BasicData; | |
| 21 | +import com.bsth.entity.excep.Outbound; | |
| 22 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 23 | +import com.bsth.service.excep.NowOutboundService; | |
| 24 | +import com.bsth.util.EchartConver; | |
| 25 | +import com.bsth.util.PageHelper; | |
| 26 | +import com.bsth.util.PageObject; | |
| 27 | +import com.bsth.util.db.DBUtils_MS; | |
| 28 | +import com.github.abel533.echarts.Option; | |
| 29 | +import com.google.gson.Gson; | |
| 30 | +@Service | |
| 31 | +public class NowOutboundServiceImpl implements NowOutboundService{ | |
| 32 | + @Autowired | |
| 33 | + JdbcTemplate jdbcTemplate; | |
| 34 | + static List<Outbound> findAll(Map<String, Object> map) { | |
| 35 | + Connection conn = null; | |
| 36 | + PreparedStatement ps = null; | |
| 37 | + ResultSet rs = null; | |
| 38 | + int page=Integer.parseInt(map.get("page").toString()); | |
| 39 | + List<Outbound> list=new ArrayList<Outbound>(); | |
| 40 | + String sql="select * from bsth_c_outbound where 1=1 "; | |
| 41 | + Object line=map.get("line"); | |
| 42 | + Object nbbm=map.get("nbbm"); | |
| 43 | + Object updown=map.get("updown"); | |
| 44 | + Object date=map.get("date"); | |
| 45 | + if(line!=null){ | |
| 46 | + sql +=" and line like'%"+line.toString().trim()+"%'"; | |
| 47 | + } | |
| 48 | + | |
| 49 | + if(nbbm!=null){ | |
| 50 | + nbbm=BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 51 | + if(nbbm!=null) | |
| 52 | + sql +=" and vehicle like '%"+nbbm.toString()+"%'"; | |
| 53 | + } | |
| 54 | + | |
| 55 | + if(updown!=null){ | |
| 56 | + sql +="and up_down like '%"+updown.toString()+"%'"; | |
| 57 | + } | |
| 58 | + if(date!=null){ | |
| 59 | + if (date.toString().length()>0) { | |
| 60 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 61 | + try { | |
| 62 | + Long t1=sdf.parse(date.toString()+" 00:00:00").getTime(); | |
| 63 | + Long t2=sdf.parse(date.toString()+" 23:59:59").getTime(); | |
| 64 | + sql += " and timestamp >="+t1 +" and timestamp <="+t2; | |
| 65 | + } catch (ParseException e) { | |
| 66 | + // TODO Auto-generated catch block | |
| 67 | + e.printStackTrace(); | |
| 68 | + } | |
| 69 | + } | |
| 70 | + | |
| 71 | + } | |
| 72 | + // sql +=" order by id limit ?,?"; | |
| 73 | + sql +=" order by timestamp limit ?,?"; | |
| 74 | + | |
| 75 | + try { | |
| 76 | + conn = DBUtils_MS.getConnection(); | |
| 77 | + ps = conn.prepareStatement(sql); | |
| 78 | + ps.setInt(1, page*10); // O-最大条数 -- M-起始条数 | |
| 79 | + ps.setInt(2, 10); // O-最小条数 -- M-显示条数 | |
| 80 | + rs = ps.executeQuery(); | |
| 81 | + list = resultSet2Set(rs); | |
| 82 | + } catch (SQLException e) { | |
| 83 | + // TODO Auto-generated catch block | |
| 84 | + e.printStackTrace(); | |
| 85 | + }finally { | |
| 86 | + DBUtils_MS.close(rs, ps, conn); | |
| 87 | + } | |
| 88 | + | |
| 89 | + return list; | |
| 90 | + } | |
| 91 | + | |
| 92 | + static List<Outbound> resultSet2Set(ResultSet rs) throws SQLException{ | |
| 93 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); | |
| 94 | + List<Outbound> list=new ArrayList<Outbound>(); | |
| 95 | + Outbound outbound; | |
| 96 | + while(rs.next()){ | |
| 97 | + outbound=new Outbound(); | |
| 98 | + // outbound.setId(Integer.valueOf(rs.getObject("id").toString())); | |
| 99 | + outbound.setLine(Integer.valueOf(rs.getObject("line").toString())); | |
| 100 | + outbound.setUpDown(Integer.valueOf(rs.getObject("up_down").toString())); | |
| 101 | + outbound.setLon(Float.valueOf(rs.getObject("lon").toString())); | |
| 102 | + outbound.setLat(Float.valueOf(rs.getObject("lat").toString())); | |
| 103 | + //run 时注解 | |
| 104 | + outbound.setLineName(BasicData.lineCode2NameMap.get(outbound.getLine().toString())); | |
| 105 | + outbound.setTimestamp((Long.valueOf(rs.getObject("timestamp").toString()))); | |
| 106 | + outbound.setTimestampDate(sdf.format(new Date(outbound.getTimestamp()))); | |
| 107 | + outbound.setVehicle(BasicData.deviceId2NbbmMap.get(rs.getObject("vehicle").toString())); | |
| 108 | +// outbound.setLocation(rs.getObject("location")==null?"":rs.getObject("location").toString()); | |
| 109 | + list.add(outbound); | |
| 110 | + } | |
| 111 | + return list; | |
| 112 | + } | |
| 113 | + | |
| 114 | + @Override | |
| 115 | + public PageObject<Outbound> Pagequery(Map<String, Object> map) { | |
| 116 | + // TODO Auto-generated method stub PageObject<Outbound> Pagequery | |
| 117 | + String sql="select count(*) record from bsth_c_outbound where 1=1 "; | |
| 118 | + Object line=map.get("line"); | |
| 119 | + Object nbbm=map.get("nbbm"); | |
| 120 | + Object updown=map.get("updown"); | |
| 121 | + Object date=map.get("date"); | |
| 122 | + if(line!=null){ | |
| 123 | + sql +=" and line like '%"+line.toString().trim()+"%'"; | |
| 124 | + | |
| 125 | + } | |
| 126 | + | |
| 127 | + if(nbbm!=null){ | |
| 128 | + nbbm=BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 129 | + if(nbbm!=null) | |
| 130 | + sql +=" and vehicle like '%"+nbbm.toString()+"%'"; | |
| 131 | + } | |
| 132 | + | |
| 133 | + if(updown!=null){ | |
| 134 | + sql +=" and up_down like '%"+updown.toString()+"%'"; | |
| 135 | + } | |
| 136 | + if(date!=null){ | |
| 137 | + if (date.toString().length()>0) { | |
| 138 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 139 | + try { | |
| 140 | + Long t1=sdf.parse(date.toString()+" 00:00:00").getTime(); | |
| 141 | + Long t2=sdf.parse(date.toString()+" 23:59:59").getTime(); | |
| 142 | + sql += " and timestamp >="+t1 +" and timestamp <="+t2; | |
| 143 | + } catch (ParseException e) { | |
| 144 | + // TODO Auto-generated catch block | |
| 145 | + e.printStackTrace(); | |
| 146 | + } | |
| 147 | + } | |
| 148 | + | |
| 149 | + } | |
| 150 | + Connection conn = null; | |
| 151 | + PreparedStatement ps = null; | |
| 152 | + ResultSet rs = null; | |
| 153 | + int totalData = 0; | |
| 154 | + | |
| 155 | + try { | |
| 156 | + conn = DBUtils_MS.getConnection(); | |
| 157 | + ps = conn.prepareStatement(sql); | |
| 158 | + rs = ps.executeQuery(); | |
| 159 | + if(rs.next()){ | |
| 160 | + totalData=rs.getInt("record"); | |
| 161 | + } | |
| 162 | + } catch (SQLException e) { | |
| 163 | + // TODO Auto-generated catch block | |
| 164 | + e.printStackTrace(); | |
| 165 | + }finally { | |
| 166 | + DBUtils_MS.close(rs, ps, conn); | |
| 167 | + } | |
| 168 | + | |
| 169 | + PageHelper pageHelper = new PageHelper(totalData, map); | |
| 170 | + List<Outbound> list=findAll(pageHelper.getMap()); | |
| 171 | + for (int i = 0; i < list.size(); i++) { | |
| 172 | + String nbbm2=list.get(i).getVehicle() ; | |
| 173 | + Long d1=list.get(i).getTimestamp(); | |
| 174 | + Date datess = new Date(d1); | |
| 175 | + String dates=new SimpleDateFormat("yyyy-MM-dd").format(datess); | |
| 176 | + String sk=new SimpleDateFormat("HH:mm").format(datess); | |
| 177 | + String sqlPbb="SELECT * FROM ( select lp_name,cl_zbh,j_gh,j_name,MIN(fcsj) as fcsj,MAX(zdsj) as ddsj" | |
| 178 | + + " from bsth_c_s_sp_info_real where cl_zbh='"+nbbm2+"' and" | |
| 179 | + + " real_exec_date='"+dates+"' GROUP BY cl_zbh,lp_name,j_gh,j_name ) t WHERE t.fcsj<='"+sk+"' AND t.ddsj>='"+sk+"' " ; | |
| 180 | + List<ScheduleRealInfo> pbb =jdbcTemplate.query(sqlPbb, | |
| 181 | + new RowMapper<ScheduleRealInfo>(){ | |
| 182 | + @Override | |
| 183 | + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 184 | + ScheduleRealInfo s = new ScheduleRealInfo(); | |
| 185 | + s.setjGh(rs.getString("j_gh")); | |
| 186 | + s.setjName(rs.getString("j_name")); | |
| 187 | + s.setLpName(rs.getString("lp_name")); | |
| 188 | + return s; | |
| 189 | + } | |
| 190 | + }); | |
| 191 | + if(pbb.size()>0){ | |
| 192 | + list.get(i).setJsy(pbb.get(0).getjGh()+"/"+pbb.get(0).getjName()); | |
| 193 | + list.get(i).setLpname(pbb.get(0).getLpName()); | |
| 194 | + | |
| 195 | + } | |
| 196 | + | |
| 197 | + } | |
| 198 | + PageObject<Outbound> pageObject = pageHelper.getPageObject(); | |
| 199 | + pageObject.setDataList(list); | |
| 200 | + return pageObject; | |
| 201 | + } | |
| 202 | + | |
| 203 | + | |
| 204 | + @Override | |
| 205 | + public Map<String, Object> getReport(Map<String, Object> map) { | |
| 206 | + // TODO Auto-generated method stub | |
| 207 | + String chartStr = ""; | |
| 208 | + Map<String, Object> mapValue = new HashMap<String, Object>(); | |
| 209 | + try { | |
| 210 | + String xAxisName = map.get("xAxisName").toString(); | |
| 211 | + String legendName = map.get("legendName").toString(); | |
| 212 | + String xAxisItem = ""; | |
| 213 | + String xAxisOrderBy = ""; | |
| 214 | + String legendItem = ""; | |
| 215 | + String legendOrderBy = ""; | |
| 216 | + if(xAxisName!=null){ | |
| 217 | + String [] xaxis = xAxisName.split(":"); | |
| 218 | + if(xaxis.length>1 && xaxis[1].toLowerCase().contains("date")){ | |
| 219 | + //本来还要判断下日期格式是否标准 | |
| 220 | + xAxisItem = "to_char("+xaxis[0]+",'"+xaxis[2]+"') "; | |
| 221 | + xAxisOrderBy = (xaxis.length>3?xaxis[3]:""); | |
| 222 | + }else{ | |
| 223 | + xAxisItem = xaxis[0]; | |
| 224 | + } | |
| 225 | + } | |
| 226 | + if(legendName!=null){ | |
| 227 | + String [] legend = legendName.split(":"); | |
| 228 | + if(legend.length>1 && legend[1].toLowerCase().contains("date")){ | |
| 229 | + //本来还要判断下日期格式是否标准 | |
| 230 | + legendItem = "to_char("+legend[0]+",'"+legend[2]+"') "; | |
| 231 | + legendOrderBy = (legend[3].length()>3?legend[3]:""); | |
| 232 | + }else{ | |
| 233 | + legendItem = legend[0]; | |
| 234 | + } | |
| 235 | + } | |
| 236 | + map.put("xAxisItem", xAxisItem); | |
| 237 | + map.put("xAxisOrderBy", xAxisOrderBy); | |
| 238 | + map.put("legendItem", legendItem); | |
| 239 | + map.put("legendOrderBy", legendOrderBy); | |
| 240 | + List dataList = new ArrayList(); | |
| 241 | + dataList =getReportList(map); | |
| 242 | + EchartConver echart = new EchartConver(map); | |
| 243 | + Option option = echart.getOption(dataList); | |
| 244 | + Gson gson = new Gson(); | |
| 245 | + chartStr = gson.toJsonTree(option).toString(); | |
| 246 | + mapValue.put("dataList", dataList); | |
| 247 | + mapValue.put("option", chartStr); | |
| 248 | + } catch (Exception e) { | |
| 249 | + e.printStackTrace(); | |
| 250 | + } | |
| 251 | + return mapValue; | |
| 252 | + } | |
| 253 | + | |
| 254 | + static List getReportList(Map<String, Object> map) { | |
| 255 | + List dataList = new ArrayList(); | |
| 256 | + String times=""; | |
| 257 | + Object dataTime=map.get("dataTime"); | |
| 258 | + Object line=map.get("line"); | |
| 259 | + String addSql=""; | |
| 260 | + if(line !=null){ | |
| 261 | + if(line.toString()!=""){ | |
| 262 | + addSql =" and line =" +line; | |
| 263 | + } | |
| 264 | + } | |
| 265 | + if(dataTime!=null){ | |
| 266 | + times=dataTime.toString(); | |
| 267 | + } | |
| 268 | + if(times.equals("")){ | |
| 269 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 270 | + times=sdf.format(new Date()); | |
| 271 | + } | |
| 272 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 273 | + String times1=times+" 00:00:00"; | |
| 274 | + String times2=times+" 23:59:59"; | |
| 275 | + | |
| 276 | + Connection conn = null; | |
| 277 | + PreparedStatement ps = null; | |
| 278 | + ResultSet rs = null; | |
| 279 | + try { | |
| 280 | + Long t1=simpleDateFormat.parse(times1).getTime(); | |
| 281 | + Long t2=simpleDateFormat.parse(times2).getTime(); | |
| 282 | + String sql="SELECT up_down xAxis , line legend,count(*) series"+ | |
| 283 | + " FROM bsth_c_outbound "+ | |
| 284 | + "where timestamp>? and timestamp<? "+addSql+" group by xAxis ,legend"; | |
| 285 | + conn = DBUtils_MS.getConnection(); | |
| 286 | + ps = conn.prepareStatement(sql); | |
| 287 | + ps.setLong(1, t1); | |
| 288 | + ps.setLong(2, t2); | |
| 289 | + rs = ps.executeQuery(); | |
| 290 | + while(rs.next()){ | |
| 291 | + Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 292 | + if(rs.getObject("xAxis").toString().equals("0")) | |
| 293 | + newMap.put("xAxis", "上行"); | |
| 294 | + else if(rs.getObject("xAxis").toString().equals("1")) | |
| 295 | + newMap.put("xAxis", "下行"); | |
| 296 | + else | |
| 297 | + newMap.put("xAxis", "无效"); | |
| 298 | + | |
| 299 | + if(BasicData.lineCode2NameMap.get(rs.getObject("legend").toString())!=null && BasicData.lineCode2NameMap.get(rs.getObject("legend").toString())!="" ) | |
| 300 | + newMap.put("legend", BasicData.lineCode2NameMap.get(rs.getObject("legend").toString())); | |
| 301 | + else | |
| 302 | + newMap.put("legend", "编码"+rs.getObject("legend").toString()); | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + newMap.put("series", Integer.parseInt(rs.getObject("series").toString())); | |
| 307 | + dataList.add(newMap); | |
| 308 | + } | |
| 309 | + | |
| 310 | + } catch (SQLException e) { | |
| 311 | + // TODO Auto-generated catch block | |
| 312 | + e.printStackTrace(); | |
| 313 | + }catch (ParseException e1) { | |
| 314 | + // TODO Auto-generated catch block | |
| 315 | + e1.printStackTrace(); | |
| 316 | + }finally { | |
| 317 | + DBUtils_MS.close(rs, ps, conn); | |
| 318 | + } | |
| 319 | + | |
| 320 | + return dataList; | |
| 321 | + } | |
| 322 | +} | ... | ... |
src/main/java/com/bsth/service/excep/impl/NowSpeedingServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.excep.impl; | |
| 2 | + | |
| 3 | +import java.sql.Connection; | |
| 4 | +import java.sql.PreparedStatement; | |
| 5 | +import java.sql.ResultSet; | |
| 6 | +import java.sql.SQLException; | |
| 7 | +import java.text.ParseException; | |
| 8 | +import java.text.SimpleDateFormat; | |
| 9 | +import java.util.ArrayList; | |
| 10 | +import java.util.Date; | |
| 11 | +import java.util.HashMap; | |
| 12 | +import java.util.List; | |
| 13 | +import java.util.Map; | |
| 14 | + | |
| 15 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 16 | +import org.springframework.stereotype.Service; | |
| 17 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 18 | + | |
| 19 | +import com.bsth.data.BasicData; | |
| 20 | +import com.bsth.entity.excep.Speeding; | |
| 21 | +import com.bsth.service.excep.NowSpeedingService; | |
| 22 | +import com.bsth.util.EchartConver; | |
| 23 | +import com.bsth.util.PageHelper; | |
| 24 | +import com.bsth.util.PageObject; | |
| 25 | +import com.bsth.util.TransGPS; | |
| 26 | +import com.bsth.util.TransGPS.Location; | |
| 27 | +import com.bsth.util.db.DBUtils_MS; | |
| 28 | +import com.github.abel533.echarts.Option; | |
| 29 | +import com.google.gson.Gson; | |
| 30 | + | |
| 31 | +@Service | |
| 32 | +public class NowSpeedingServiceImpl implements NowSpeedingService { | |
| 33 | + | |
| 34 | + @Autowired | |
| 35 | + JdbcTemplate jdbcTemplate; | |
| 36 | + static List<Speeding> findAll(Map<String, Object> map) { | |
| 37 | + Connection conn = null; | |
| 38 | + PreparedStatement ps = null; | |
| 39 | + ResultSet rs = null; | |
| 40 | + int page=Integer.parseInt(map.get("page").toString()); | |
| 41 | + List<Speeding> list=new ArrayList<Speeding>(); | |
| 42 | + String sql="select * from bsth_c_speedingmh where 1=1 "; | |
| 43 | + Object line=map.get("line"); | |
| 44 | + Object updown=map.get("updown"); | |
| 45 | + Object startDate=map.get("startDate"); | |
| 46 | + Object endDate=map.get("endDate"); | |
| 47 | + Object times=map.get("times"); | |
| 48 | + | |
| 49 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 50 | + if(line!=null){ | |
| 51 | + sql +=" and line like'%"+line.toString().trim()+"%'"; | |
| 52 | + } | |
| 53 | + if(updown!=null){ | |
| 54 | + sql +="and up_down like '%"+updown.toString()+"%'"; | |
| 55 | + } | |
| 56 | + if(startDate!=null){ | |
| 57 | + if (startDate.toString().length()>0) { | |
| 58 | + try { | |
| 59 | + Long t1=sdf.parse(startDate.toString()+" 00:00:00").getTime(); | |
| 60 | + sql += " and startTimestamp >="+t1; | |
| 61 | + } catch (ParseException e) { | |
| 62 | + e.printStackTrace(); | |
| 63 | + } | |
| 64 | + } | |
| 65 | + } | |
| 66 | + if(endDate!=null){ | |
| 67 | + if (endDate.toString().length()>0) { | |
| 68 | + try { | |
| 69 | + Long t2=sdf.parse(endDate.toString()+" 23:59:59").getTime(); | |
| 70 | + sql += " and endTimestamp <="+t2; | |
| 71 | + } catch (ParseException e) { | |
| 72 | + e.printStackTrace(); | |
| 73 | + } | |
| 74 | + } | |
| 75 | + | |
| 76 | + } | |
| 77 | + | |
| 78 | + if(times!=null && times.toString().length()>0){ | |
| 79 | + sql +=" and (endTimestamp-startTimestamp) >="+Integer.valueOf(times.toString())*1000; | |
| 80 | + } | |
| 81 | + | |
| 82 | + sql +=" order by startTimestamp limit ?,?"; | |
| 83 | + | |
| 84 | + try { | |
| 85 | + conn = DBUtils_MS.getConnection(); | |
| 86 | + ps = conn.prepareStatement(sql); | |
| 87 | + ps.setInt(1, page*10); // O-最大条数 -- M-起始条数 | |
| 88 | + ps.setInt(2, 10); // O-最小条数 -- M-显示条数 | |
| 89 | + rs = ps.executeQuery(); | |
| 90 | + list = resultSet2Set(rs); | |
| 91 | + } catch (SQLException e) { | |
| 92 | + e.printStackTrace(); | |
| 93 | + }finally { | |
| 94 | + DBUtils_MS.close(rs, ps, conn); | |
| 95 | + } | |
| 96 | + return list; | |
| 97 | + } | |
| 98 | + | |
| 99 | + static List<Speeding> resultSet2Set(ResultSet rs) throws SQLException{ | |
| 100 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 101 | + List<Speeding> list=new ArrayList<Speeding>(); | |
| 102 | + Speeding speeding; | |
| 103 | + Location location; | |
| 104 | + while(rs.next()){ | |
| 105 | + speeding=new Speeding(); | |
| 106 | + speeding.setId(rs.getInt("id")); | |
| 107 | + speeding.setVehicle(BasicData.deviceId2NbbmMap.get(rs.getObject("vehicle").toString())); | |
| 108 | + speeding.setLine(rs.getInt("line")); | |
| 109 | + //run 时注解 | |
| 110 | + speeding.setLineName(BasicData.lineCode2NameMap.get(speeding.getLine().toString())); | |
| 111 | + speeding.setLineId(BasicData.lineId2CodeMap.inverse().get(speeding.getLine().toString())); | |
| 112 | + speeding.setUpDown(rs.getInt("up_down")); | |
| 113 | + //将gps的经纬度转成百度的经纬度 | |
| 114 | + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(rs.getFloat("startLon"), rs.getFloat("startLat")))); | |
| 115 | + speeding.setLon((float)location.getLng()); | |
| 116 | + speeding.setLat((float)location.getLat()); | |
| 117 | + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(rs.getFloat("endLon"), rs.getFloat("endLat")))); | |
| 118 | + speeding.setEndlon((float)location.getLng()); | |
| 119 | + speeding.setEndlat((float)location.getLat()); | |
| 120 | + speeding.setTimestamp((Long.valueOf(rs.getObject("startTimestamp").toString()))); | |
| 121 | + speeding.setTimestampDate(sdf.format(new Date(speeding.getTimestamp()))); | |
| 122 | + speeding.setEndtimestamp((Long.valueOf(rs.getObject("endTimestamp").toString()))); | |
| 123 | + speeding.setEndtimestampDate(sdf.format(new Date(speeding.getEndtimestamp()))); | |
| 124 | + list.add(speeding); | |
| 125 | + } | |
| 126 | + return list; | |
| 127 | + } | |
| 128 | + | |
| 129 | + @Override | |
| 130 | + public PageObject<Speeding> Pagequery(Map<String, Object> map) { | |
| 131 | + String sql="select count(*) record from bsth_c_speedingmh where 1=1 "; | |
| 132 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 133 | + Object line=map.get("line"); | |
| 134 | + Object updown=map.get("updown"); | |
| 135 | + Object startDate=map.get("startDate"); | |
| 136 | + Object endDate=map.get("endDate"); | |
| 137 | + Object times=map.get("times"); | |
| 138 | + | |
| 139 | + if(line!=null){ | |
| 140 | + sql +=" and line like'%"+line.toString().trim()+"%'"; | |
| 141 | + } | |
| 142 | + if(updown!=null){ | |
| 143 | + sql +="and up_down like '%"+updown.toString()+"%'"; | |
| 144 | + } | |
| 145 | + if(startDate!=null){ | |
| 146 | + if (startDate.toString().length()>0) { | |
| 147 | + try { | |
| 148 | + Long t1 = sdf.parse(startDate.toString()+" 00:00:00").getTime(); | |
| 149 | + sql += " and startTimestamp >="+t1; | |
| 150 | + } catch (ParseException e) { | |
| 151 | + e.printStackTrace(); | |
| 152 | + } | |
| 153 | + } | |
| 154 | + } | |
| 155 | + if(endDate!=null){ | |
| 156 | + if (endDate.toString().length()>0) { | |
| 157 | + try { | |
| 158 | + Long t2=sdf.parse(endDate.toString()+" 23:59:59").getTime(); | |
| 159 | + sql += " and endTimestamp <="+t2; | |
| 160 | + } catch (ParseException e) { | |
| 161 | + e.printStackTrace(); | |
| 162 | + } | |
| 163 | + } | |
| 164 | + } | |
| 165 | + | |
| 166 | + if(times!=null && times.toString().length()>0){ | |
| 167 | + sql +=" and (endTimestamp-startTimestamp) >="+Integer.valueOf(times.toString())*1000; | |
| 168 | + } | |
| 169 | + | |
| 170 | + Connection conn = null; | |
| 171 | + PreparedStatement ps = null; | |
| 172 | + ResultSet rs = null; | |
| 173 | + int totalData = 0; | |
| 174 | + try { | |
| 175 | + conn = DBUtils_MS.getConnection(); | |
| 176 | + ps = conn.prepareStatement(sql); | |
| 177 | + rs = ps.executeQuery(); | |
| 178 | + if(rs.next()){ | |
| 179 | + totalData=rs.getInt("record"); | |
| 180 | + } | |
| 181 | + } catch (SQLException e) { | |
| 182 | + e.printStackTrace(); | |
| 183 | + }finally { | |
| 184 | + DBUtils_MS.close(rs, ps, conn); | |
| 185 | + } | |
| 186 | + PageHelper pageHelper = new PageHelper(totalData, map); | |
| 187 | + List<Speeding> list=findAll(pageHelper.getMap()); | |
| 188 | + PageObject<Speeding> pageObject = pageHelper.getPageObject(); | |
| 189 | + pageObject.setDataList(list); | |
| 190 | + return pageObject; | |
| 191 | + } | |
| 192 | + | |
| 193 | + @Override | |
| 194 | + public Map<String, Object> getReport(Map<String, Object> map) { | |
| 195 | + String chartStr = ""; | |
| 196 | + Map<String, Object> mapValue = new HashMap<String, Object>(); | |
| 197 | + try { | |
| 198 | + String xAxisName = map.get("xAxisName").toString(); | |
| 199 | + String legendName = map.get("legendName").toString(); | |
| 200 | + String xAxisItem = ""; | |
| 201 | + String xAxisOrderBy = ""; | |
| 202 | + String legendItem = ""; | |
| 203 | + String legendOrderBy = ""; | |
| 204 | + if(xAxisName!=null){ | |
| 205 | + String [] xaxis = xAxisName.split(":"); | |
| 206 | + if(xaxis.length>1 && xaxis[1].toLowerCase().contains("date")){ | |
| 207 | + //本来还要判断下日期格式是否标准 | |
| 208 | + xAxisItem = "to_char("+xaxis[0]+",'"+xaxis[2]+"') "; | |
| 209 | + xAxisOrderBy = (xaxis.length>3?xaxis[3]:""); | |
| 210 | + }else{ | |
| 211 | + xAxisItem = xaxis[0]; | |
| 212 | + } | |
| 213 | + } | |
| 214 | + if(legendName!=null){ | |
| 215 | + String [] legend = legendName.split(":"); | |
| 216 | + if(legend.length>1 && legend[1].toLowerCase().contains("date")){ | |
| 217 | + //本来还要判断下日期格式是否标准 | |
| 218 | + legendItem = "to_char("+legend[0]+",'"+legend[2]+"') "; | |
| 219 | + legendOrderBy = (legend[3].length()>3?legend[3]:""); | |
| 220 | + }else{ | |
| 221 | + legendItem = legend[0]; | |
| 222 | + } | |
| 223 | + } | |
| 224 | + map.put("xAxisItem", xAxisItem); | |
| 225 | + map.put("xAxisOrderBy", xAxisOrderBy); | |
| 226 | + map.put("legendItem", legendItem); | |
| 227 | + map.put("legendOrderBy", legendOrderBy); | |
| 228 | + List dataList = new ArrayList(); | |
| 229 | + dataList =getReportList(map); | |
| 230 | + EchartConver echart = new EchartConver(map); | |
| 231 | + Option option = echart.getOption(dataList); | |
| 232 | + Gson gson = new Gson(); | |
| 233 | + chartStr = gson.toJsonTree(option).toString(); | |
| 234 | + mapValue.put("dataList", dataList); | |
| 235 | + mapValue.put("option", chartStr); | |
| 236 | + } catch (Exception e) { | |
| 237 | + e.printStackTrace(); | |
| 238 | + } | |
| 239 | + return mapValue; | |
| 240 | + } | |
| 241 | + static List getReportList(Map<String, Object> map) { | |
| 242 | + List dataList = new ArrayList(); | |
| 243 | + String times=""; | |
| 244 | + Object dataTime=map.get("dataTime"); | |
| 245 | + Object line=map.get("line"); | |
| 246 | + String addSql=""; | |
| 247 | + if(line !=null){ | |
| 248 | + if(line.toString()!=""){ | |
| 249 | + addSql =" and line =" +line; | |
| 250 | + } | |
| 251 | + } | |
| 252 | + if(dataTime!=null){ | |
| 253 | + times=dataTime.toString(); | |
| 254 | + } | |
| 255 | + if(times.equals("")){ | |
| 256 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 257 | + times=sdf.format(new Date()); | |
| 258 | + } | |
| 259 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 260 | + String times1=times+" 00:00:00"; | |
| 261 | + String times2=times+" 23:59:59"; | |
| 262 | + | |
| 263 | + Connection conn = null; | |
| 264 | + PreparedStatement ps = null; | |
| 265 | + ResultSet rs = null; | |
| 266 | + try { | |
| 267 | + Long t1=simpleDateFormat.parse(times1).getTime(); | |
| 268 | + Long t2=simpleDateFormat.parse(times2).getTime(); | |
| 269 | + String sql="SELECT up_down xAxis , line legend,count(*) series"+ | |
| 270 | + " FROM bsth_c_speeding "+ | |
| 271 | + "where timestamp>? and timestamp<? "+addSql+" group by xAxis ,legend"; | |
| 272 | + conn = DBUtils_MS.getConnection(); | |
| 273 | + ps = conn.prepareStatement(sql); | |
| 274 | + ps.setLong(1, t1); | |
| 275 | + ps.setLong(2, t2); | |
| 276 | + rs = ps.executeQuery(); | |
| 277 | + while(rs.next()){ | |
| 278 | + Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 279 | + if(rs.getObject("xAxis").toString().equals("0")) | |
| 280 | + newMap.put("xAxis", "上行"); | |
| 281 | + else if(rs.getObject("xAxis").toString().equals("1")) | |
| 282 | + newMap.put("xAxis", "下行"); | |
| 283 | + else | |
| 284 | + newMap.put("xAxis", "无效"); | |
| 285 | + | |
| 286 | + if(BasicData.lineCode2NameMap.get(rs.getObject("legend").toString())!=null && BasicData.lineCode2NameMap.get(rs.getObject("legend").toString())!="" ) | |
| 287 | + newMap.put("legend", BasicData.lineCode2NameMap.get(rs.getObject("legend").toString())); | |
| 288 | + else | |
| 289 | + newMap.put("legend", "编码"+rs.getObject("legend").toString()); | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + newMap.put("series", Integer.parseInt(rs.getObject("series").toString())); | |
| 294 | + dataList.add(newMap); | |
| 295 | + } | |
| 296 | + | |
| 297 | + } catch (SQLException e) { | |
| 298 | + e.printStackTrace(); | |
| 299 | + }catch (ParseException e1) { | |
| 300 | + e1.printStackTrace(); | |
| 301 | + }finally { | |
| 302 | + DBUtils_MS.close(rs, ps, conn); | |
| 303 | + } | |
| 304 | + | |
| 305 | + return dataList; | |
| 306 | + } | |
| 307 | + | |
| 308 | + | |
| 309 | + @Override | |
| 310 | + public List<Speeding> findPosition(String deviceid, String startdate, | |
| 311 | + String enddate){ | |
| 312 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 313 | + String sql = "select id,vehicle,line,up_down,lon,lat,speed,timestamp from bsth_c_speeding where vehicle = ? and timestamp >= ? and timestamp <= ? order by timestamp "; | |
| 314 | + Connection conn = null; | |
| 315 | + PreparedStatement ps = null; | |
| 316 | + ResultSet rs = null; | |
| 317 | + List<Speeding> listResult = new ArrayList<Speeding>(); | |
| 318 | + Speeding speed = null; | |
| 319 | + try { | |
| 320 | + conn = DBUtils_MS.getConnection(); | |
| 321 | + ps = conn.prepareStatement(sql); | |
| 322 | + long startTime = sdf.parse(startdate).getTime(); | |
| 323 | + long endTime = sdf.parse(enddate).getTime(); | |
| 324 | + ps.setString(1, deviceid); | |
| 325 | + ps.setLong(2,startTime); | |
| 326 | + ps.setLong(3,endTime); | |
| 327 | + rs = ps.executeQuery(); | |
| 328 | + Location location; | |
| 329 | + while (rs.next()) { | |
| 330 | + speed = new Speeding(); | |
| 331 | + speed.setVehicle(BasicData.deviceId2NbbmMap.get(rs.getObject("vehicle").toString())); | |
| 332 | + // speed.setVehicle(rs.getString("vehicle")); | |
| 333 | + location = TransGPS.LocationMake(rs.getFloat("lon"), rs.getFloat("lat")); | |
| 334 | + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(location)); | |
| 335 | + speed.setLon((float)location.getLng()); | |
| 336 | + speed.setLat((float)location.getLat()); | |
| 337 | + speed.setSpeed(rs.getFloat("speed")); | |
| 338 | + speed.setTimestamp(rs.getLong("timestamp")); | |
| 339 | + // 上下行 | |
| 340 | + listResult.add(speed); | |
| 341 | + } | |
| 342 | + } catch (Exception e) { | |
| 343 | + e.printStackTrace(); | |
| 344 | + } finally { | |
| 345 | + DBUtils_MS.close(rs, ps, conn); | |
| 346 | + } | |
| 347 | + return listResult; | |
| 348 | + | |
| 349 | + } | |
| 350 | +} | ... | ... |
src/main/java/com/bsth/service/excep/impl/SpeedingServiceImpl.java
| ... | ... | @@ -7,10 +7,8 @@ import java.sql.SQLException; |
| 7 | 7 | import java.text.ParseException; |
| 8 | 8 | import java.text.SimpleDateFormat; |
| 9 | 9 | import java.util.ArrayList; |
| 10 | -import java.util.Calendar; | |
| 11 | 10 | import java.util.Date; |
| 12 | 11 | import java.util.HashMap; |
| 13 | -import java.util.Iterator; | |
| 14 | 12 | import java.util.List; |
| 15 | 13 | import java.util.Map; |
| 16 | 14 | |
| ... | ... | @@ -19,10 +17,9 @@ import org.springframework.stereotype.Service; |
| 19 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 20 | 18 | |
| 21 | 19 | import com.bsth.data.BasicData; |
| 22 | -import com.bsth.entity.excep.Outbound; | |
| 23 | 20 | import com.bsth.entity.excep.Speeding; |
| 21 | +import com.bsth.service.excep.NowSpeedingService; | |
| 24 | 22 | import com.bsth.service.excep.SpeedingService; |
| 25 | -import com.bsth.service.gps.entity.GpsSpeed; | |
| 26 | 23 | import com.bsth.util.EchartConver; |
| 27 | 24 | import com.bsth.util.PageHelper; |
| 28 | 25 | import com.bsth.util.PageObject; |
| ... | ... | @@ -349,8 +346,6 @@ public class SpeedingServiceImpl implements SpeedingService { |
| 349 | 346 | DBUtils_MS.close(rs, ps, conn); |
| 350 | 347 | } |
| 351 | 348 | return listResult; |
| 352 | - | |
| 353 | 349 | } |
| 354 | - | |
| 355 | - | |
| 350 | + | |
| 356 | 351 | } | ... | ... |
src/main/java/com/bsth/service/forecast/SampleServiceImpl.java
| ... | ... | @@ -37,10 +37,12 @@ public class SampleServiceImpl extends BaseServiceImpl<Sample, Long> implements |
| 37 | 37 | //转换站点名称 |
| 38 | 38 | Iterator<Sample> iterator = rs.iterator(); |
| 39 | 39 | Sample s; |
| 40 | + String prefix; | |
| 40 | 41 | while(iterator.hasNext()){ |
| 41 | 42 | s = iterator.next(); |
| 42 | - s.setsName(BasicData.stationCode2NameMap.get(s.getsStation())); | |
| 43 | - s.seteName(BasicData.stationCode2NameMap.get(s.geteStation())); | |
| 43 | + prefix = s.getLineCode() + "_" + s.getUpdown() + "_"; | |
| 44 | + s.setsName(BasicData.getStationNameByCode(s.getsStation(), prefix)); | |
| 45 | + s.seteName(BasicData.getStationNameByCode(s.geteStation(), prefix)); | |
| 44 | 46 | |
| 45 | 47 | rsList.add(s); |
| 46 | 48 | } | ... | ... |
src/main/resources/static/pages/base/line/add.html
src/main/resources/static/pages/base/line/details.html
| ... | ... | @@ -282,14 +282,21 @@ |
| 282 | 282 | </div> |
| 283 | 283 | <!-- 线路规划类型 (* 必填项) END --> |
| 284 | 284 | |
| 285 | - <!-- 开辟日期 START --> | |
| 285 | + <!--大间隔等级 START --> | |
| 286 | 286 | <div class="col-md-6"> |
| 287 | - <label class="control-label col-md-5"> 开辟日期 : </label> | |
| 287 | + <label class="control-label col-md-5"> 大间隔等级 : </label> | |
| 288 | 288 | <div class="col-md-4"> |
| 289 | - <input type="text" class="form-control" name="openDate" id="openDateInput" placeholder="开辟日期"> | |
| 289 | + <select name="spacGrade" class="form-control" id="spacGradeSelect"> | |
| 290 | + <option value="">-- 请选择大间隔等级 --</option> | |
| 291 | + <option value="1">一级</option> | |
| 292 | + <option value="2">二级</option> | |
| 293 | + <option value="3">三级</option> | |
| 294 | + <option value="4">四级</option> | |
| 295 | + <option value="5">五级</option> | |
| 296 | + </select> | |
| 290 | 297 | </div> |
| 291 | 298 | </div> |
| 292 | - <!-- 开辟日期 END --> | |
| 299 | + <!-- 大间隔等级END --> | |
| 293 | 300 | </div> |
| 294 | 301 | <!-- 表单分组组件 form-group START --> |
| 295 | 302 | |
| ... | ... | @@ -391,6 +398,14 @@ |
| 391 | 398 | </div> |
| 392 | 399 | </div> |
| 393 | 400 | <!-- 空调车辆数 END --> |
| 401 | + <!-- 开辟日期 START --> | |
| 402 | + <div class="col-md-6"> | |
| 403 | + <label class="control-label col-md-5"> 开辟日期 : </label> | |
| 404 | + <div class="col-md-4"> | |
| 405 | + <input type="text" class="form-control" name="openDate" id="openDateInput" placeholder="开辟日期"> | |
| 406 | + </div> | |
| 407 | + </div> | |
| 408 | + <!-- 开辟日期 END --> | |
| 394 | 409 | </div> |
| 395 | 410 | <!-- 表单分组组件 form-group END --> |
| 396 | 411 | ... | ... |
src/main/resources/static/pages/base/line/edit.html
| ... | ... | @@ -290,14 +290,21 @@ |
| 290 | 290 | </div> |
| 291 | 291 | <!-- 线路规划类型 (* 必填项) END --> |
| 292 | 292 | |
| 293 | - <!-- 开辟日期 START --> | |
| 293 | + <!--大间隔等级 START --> | |
| 294 | 294 | <div class="col-md-6"> |
| 295 | - <label class="control-label col-md-5"> 开辟日期 : </label> | |
| 295 | + <label class="control-label col-md-5"> 大间隔等级 : </label> | |
| 296 | 296 | <div class="col-md-4"> |
| 297 | - <input type="text" class="form-control" name="openDate" id="openDateInput" placeholder="开辟日期"> | |
| 297 | + <select name="spacGrade" class="form-control" id="spacGradeSelect"> | |
| 298 | + <option value="">-- 请选择大间隔等级 --</option> | |
| 299 | + <option value="1">一级</option> | |
| 300 | + <option value="2">二级</option> | |
| 301 | + <option value="3">三级</option> | |
| 302 | + <option value="4">四级</option> | |
| 303 | + <option value="5">五级</option> | |
| 304 | + </select> | |
| 298 | 305 | </div> |
| 299 | 306 | </div> |
| 300 | - <!-- 开辟日期 END --> | |
| 307 | + <!-- 大间隔等级END --> | |
| 301 | 308 | </div> |
| 302 | 309 | <!-- 表单分组组件 form-group START --> |
| 303 | 310 | |
| ... | ... | @@ -399,6 +406,14 @@ |
| 399 | 406 | </div> |
| 400 | 407 | </div> |
| 401 | 408 | <!-- 空调车辆数 END --> |
| 409 | + <!-- 开辟日期 START --> | |
| 410 | + <div class="col-md-6"> | |
| 411 | + <label class="control-label col-md-5"> 开辟日期 : </label> | |
| 412 | + <div class="col-md-4"> | |
| 413 | + <input type="text" class="form-control" name="openDate" id="openDateInput" placeholder="开辟日期"> | |
| 414 | + </div> | |
| 415 | + </div> | |
| 416 | + <!-- 开辟日期 END --> | |
| 402 | 417 | </div> |
| 403 | 418 | <!-- 表单分组组件 form-group END --> |
| 404 | 419 | ... | ... |
src/main/resources/static/pages/excep/boundList.html
| ... | ... | @@ -161,7 +161,7 @@ $(function(){ |
| 161 | 161 | var toDay = new Date(); |
| 162 | 162 | var year = toDay.getFullYear(); |
| 163 | 163 | var Month = toDay.getMonth()+1>10?toDay.getMonth()+1:"0"+(toDay.getMonth()+1); |
| 164 | - var Day = toDay.getDate()>10?toDay.getDate():"0"+toDay.getDate(); | |
| 164 | + var Day = toDay.getDate()>9?toDay.getDate():"0"+toDay.getDate(); | |
| 165 | 165 | var date = year+"-"+Month+"-"+Day; |
| 166 | 166 | //时间表单默认选择当日时间。 |
| 167 | 167 | $("input[name='date']")[0].value = date; | ... | ... |
src/main/resources/static/pages/excep/mhspeedingList.html
0 → 100644
| 1 | +<div class="page-head"> | |
| 2 | + <div class="page-title"> | |
| 3 | + <h1>超速异常</h1> | |
| 4 | + </div> | |
| 5 | +</div> | |
| 6 | + | |
| 7 | +<ul class="page-breadcrumb breadcrumb"> | |
| 8 | + <li><a href="/pages/home.html" data-pjax>主页</a> <i class="fa fa-circle"></i></li> | |
| 9 | + <li><span class="active">异常查看</span> <i class="fa fa-circle"></i></li> | |
| 10 | + <li><span class="active">超速异常</span></li> | |
| 11 | +</ul> | |
| 12 | + | |
| 13 | +<div class="row"> | |
| 14 | + <div class="col-md-12"> | |
| 15 | + <!-- Begin: life time stats --> | |
| 16 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | |
| 17 | + <div class="portlet-title"> | |
| 18 | + <div class="caption"> | |
| 19 | + <i class="fa fa-times-circle"></i> <span | |
| 20 | + class="caption-subject font-dark sbold uppercase">超速异常数据表</span> | |
| 21 | + </div> | |
| 22 | + <div class="actions"> | |
| 23 | + </div> | |
| 24 | + </div> | |
| 25 | + <div class="portlet-body"> | |
| 26 | + <div class="table-container" style="margin-top: 10px"> | |
| 27 | + <table | |
| 28 | + class="table table-striped table-bordered table-hover table-checkable" | |
| 29 | + id="datatable_speeding"> | |
| 30 | + <thead> | |
| 31 | + <tr role="row" class="heading"> | |
| 32 | + <th width="3%">#</th> | |
| 33 | + <th width="4%">线路</th> | |
| 34 | + <th width="6%">车辆自编号</th> | |
| 35 | + <th width="8%">上下行</th> | |
| 36 | + <th width="10%">开始时间</th> | |
| 37 | + <th width="10%">结束时间</th> | |
| 38 | + <th width="8%">持续时间</th> | |
| 39 | + <th width="8%">查看轨迹</th> | |
| 40 | + <th width="6%">操作</th> | |
| 41 | + </tr> | |
| 42 | + <tr role="row" class="filter"> | |
| 43 | + <td></td> | |
| 44 | + <td> | |
| 45 | + <select class="form-control" name="line" id="line" style="width: 100px;"></select> | |
| 46 | + </td> | |
| 47 | + <td> | |
| 48 | + <select class="form-control" name="nbbm" id="nbbm" style="width: 100px;"></select> | |
| 49 | + </td> | |
| 50 | + <!-- <td> | |
| 51 | + | |
| 52 | + </td> | |
| 53 | + <td> | |
| 54 | + </td> --> | |
| 55 | + <td> | |
| 56 | + <select class="form-control form-filter " name="updown" style="width: 90px;"> | |
| 57 | + <option value="">请选择...</option> | |
| 58 | + <option value="0">上行</option> | |
| 59 | + <option value="1">下行</option> | |
| 60 | + <option value="-1">无效</option> | |
| 61 | + </select> | |
| 62 | + </td> | |
| 63 | + <td> | |
| 64 | + <input class="form-control" type="date" name="startDate" /> | |
| 65 | + </td> | |
| 66 | + <td> | |
| 67 | + <input class="form-control" type="date" name="endDate" /> | |
| 68 | + </td> | |
| 69 | + <td> | |
| 70 | + >=<input class="form-control" type="text" name="times" style="width:50px;display:inline!important" | |
| 71 | + onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"/> | |
| 72 | + </td> | |
| 73 | + <td> | |
| 74 | + </td> | |
| 75 | + <td> | |
| 76 | + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" > | |
| 77 | + <i class="fa fa-search"></i> 搜索</button> | |
| 78 | + | |
| 79 | + <button class="btn btn-sm red btn-outline filter-cancel"> | |
| 80 | + <i class="fa fa-times"></i> 重置</button> | |
| 81 | + </td> | |
| 82 | + </tr> | |
| 83 | + </thead> | |
| 84 | + <tbody></tbody> | |
| 85 | + </table> | |
| 86 | + <div style="text-align: right;"> | |
| 87 | + <ul id="pagination" class="pagination"></ul> | |
| 88 | + </div> | |
| 89 | + </div> | |
| 90 | + </div> | |
| 91 | + </div> | |
| 92 | + </div> | |
| 93 | +</div> | |
| 94 | + | |
| 95 | +<script id="speeding_list_temp" type="text/html"> | |
| 96 | +{{each list as obj i}} | |
| 97 | +<tr> | |
| 98 | + <td style="vertical-align: middle;"> | |
| 99 | + <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}"> | |
| 100 | + </td> | |
| 101 | + <td> | |
| 102 | + {{obj.lineName}} | |
| 103 | + </td> | |
| 104 | + <td> | |
| 105 | + {{obj.vehicle}} | |
| 106 | + </td> | |
| 107 | + <td> | |
| 108 | + {{if obj.upDown==0}} | |
| 109 | + 上行 | |
| 110 | + {{else if obj.upDown==1}} | |
| 111 | + 下行 | |
| 112 | + {{else}} | |
| 113 | + 无效 | |
| 114 | + {{/if}} | |
| 115 | + </td> | |
| 116 | + <td> | |
| 117 | + {{obj.timestampDate}} | |
| 118 | + </td> | |
| 119 | + <td> | |
| 120 | + {{obj.endtimestampDate}} | |
| 121 | + </td> | |
| 122 | + <td> | |
| 123 | + {{(obj.endtimestamp-obj.timestamp)/1000}}秒 | |
| 124 | + </td> | |
| 125 | + <td> | |
| 126 | + <a class="btn default blue-stripe btn-sm lookTrajectory" data-vehicle ="{{obj.vehicle}}" | |
| 127 | + data-startdate="{{obj.timestampDate}}" data-enddate="{{obj.endtimestampDate}}" | |
| 128 | + data-lon="{{obj.lon}}" data-lat="{{obj.lat}}" data-endlon="{{obj.endlon}}" | |
| 129 | + data-endlat="{{obj.endlat}}" data-lineid="{{obj.lineId}}" data-updown="{{obj.upDown}}"> | |
| 130 | + 查看轨迹 | |
| 131 | + </a> | |
| 132 | + </td> | |
| 133 | + <td> | |
| 134 | + | |
| 135 | + </td> | |
| 136 | +</tr> | |
| 137 | +{{/each}} | |
| 138 | +{{if list.length == 0}} | |
| 139 | +<tr> | |
| 140 | + <td colspan=8><h6 class="muted">没有找到相关数据</h6></td> | |
| 141 | +</tr> | |
| 142 | +{{/if}} | |
| 143 | +</script> | |
| 144 | + | |
| 145 | +<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script> | |
| 146 | + | |
| 147 | +<script> | |
| 148 | +$(function(){ | |
| 149 | + var page = 0, initPagination; | |
| 150 | + var icheckOptions = { | |
| 151 | + checkboxClass: 'icheckbox_flat-blue', | |
| 152 | + increaseArea: '20%' | |
| 153 | + } | |
| 154 | + | |
| 155 | + var date = new Date(); | |
| 156 | + var week = date.getDay();//表明今天是周几。0-6表示周日到周六 | |
| 157 | + var dateTime = date.getTime();//当前时间的时间戳,单位秒。 | |
| 158 | + | |
| 159 | + var endTime = dateTime-week*24*3600*1000;//上周末、格式为时间戳。 | |
| 160 | + var startTime = endTime-6*24*3600*1000;//上周一、格式为时间戳。 | |
| 161 | + var endDate = timeToData(endTime); | |
| 162 | + var startDate = timeToData(startTime); | |
| 163 | + //表单默认选择上周一到上周日的超速信息。 | |
| 164 | + $("input[name='endDate']")[0].value = endDate; | |
| 165 | + $("input[name='startDate']")[0].value = startDate; | |
| 166 | + var parameter = new Object(); | |
| 167 | + parameter.endDate = $("input[name='endDate']")[0].value; | |
| 168 | + parameter.startDate = $("input[name='startDate']")[0].value; | |
| 169 | + jsDoQuery(parameter, true); | |
| 170 | + //搜索线路 | |
| 171 | + $.get('/basic/lineCode2Name',function(result){ | |
| 172 | + var data=[]; | |
| 173 | + data.push({id: " ", text: "全部线路"}); | |
| 174 | + for(var code in result){ | |
| 175 | + data.push({id: code, text: result[code]}); | |
| 176 | + } | |
| 177 | + initPinYinSelect2('#line',data,''); | |
| 178 | + }); | |
| 179 | + | |
| 180 | + //时间戳转换为年月日 | |
| 181 | + function timeToData(time){ | |
| 182 | + var date = new Date(time); | |
| 183 | + var year = date.getFullYear(); | |
| 184 | + var Month = date.getMonth()+1>10?date.getMonth()+1:"0"+(date.getMonth()+1); | |
| 185 | + var Day = date.getDate()>9?date.getDate():"0"+date.getDate(); | |
| 186 | + return year+"-"+Month+"-"+Day; | |
| 187 | + } | |
| 188 | + | |
| 189 | + //重置 | |
| 190 | + $('tr.filter .filter-cancel').on('click', function(){ | |
| 191 | + $('tr.filter input, select').val('').change(); | |
| 192 | + jsDoQuery(null, true); | |
| 193 | + }); | |
| 194 | + | |
| 195 | + //提交 | |
| 196 | + $('tr.filter .filter-submit').on('click', function(){ | |
| 197 | + var cells = $('tr.filter')[0].cells | |
| 198 | + ,params = {} | |
| 199 | + ,name; | |
| 200 | + $.each(cells, function(i, cell){ | |
| 201 | + var items = $('input,select', cell); | |
| 202 | + for(var j = 0, item; item = items[j++];){ | |
| 203 | + name = $(item).attr('name'); | |
| 204 | + if(name){ | |
| 205 | + params[name] = $(item).val(); | |
| 206 | + } | |
| 207 | + } | |
| 208 | + }); | |
| 209 | + page = 0; | |
| 210 | + jsDoQuery(params, true); | |
| 211 | + }); | |
| 212 | + | |
| 213 | + /* | |
| 214 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | |
| 215 | + */ | |
| 216 | + function jsDoQuery(p, pagination){ | |
| 217 | + var params = {}; | |
| 218 | + if(p) | |
| 219 | + params = p; | |
| 220 | + //更新时间排序 | |
| 221 | + params['order'] = 'lastLoginDate'; | |
| 222 | + params['page'] = page; | |
| 223 | + var i = layer.load(2); | |
| 224 | + $get('/nowspeeding/pagequery' ,params, function(data){ | |
| 225 | + var bodyHtm = template('speeding_list_temp', {list: data.dataList}); | |
| 226 | + $('#datatable_speeding tbody').html(bodyHtm) | |
| 227 | + .find('.icheck').iCheck(icheckOptions) | |
| 228 | + .on('ifChanged', iCheckChange); | |
| 229 | + if(pagination && data.dataList.length > 0){ | |
| 230 | + //重新分页 | |
| 231 | + initPagination = true; | |
| 232 | + showPagination(data); | |
| 233 | + } | |
| 234 | + layer.close(i); | |
| 235 | + $(".lookTrajectory").click(function(){ | |
| 236 | + var vehicle = $(this).data('vehicle'); | |
| 237 | + var startDate = $(this).data('startdate'); | |
| 238 | + var endDate = $(this).data('enddate'); | |
| 239 | + var lon = $(this).data('lon'); | |
| 240 | + var lat = $(this).data('lat'); | |
| 241 | + var endLon = $(this).data('endlon'); | |
| 242 | + var endLat = $(this).data('endlat'); | |
| 243 | + var lineid = $(this).data('lineid'); | |
| 244 | + var upDown = $(this).data('updown'); | |
| 245 | + var storage = window.localStorage; | |
| 246 | + storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat+","+lineid+","+upDown); | |
| 247 | + $.get('/pages/excep/speedingMap.html?',function (result) { | |
| 248 | + layer.open({ | |
| 249 | + type: 1, | |
| 250 | + title:'<i class="uk-icon-play-circle"></i>轨迹回放', | |
| 251 | + shadeClose: true, | |
| 252 | + shade: true, | |
| 253 | + scrollbar: false, | |
| 254 | + maxmin: false, //开启最大化最小化按钮 | |
| 255 | + area: ['100%', '100%'], | |
| 256 | + content:result,//内容 | |
| 257 | + }); | |
| 258 | + }); | |
| 259 | + }) | |
| 260 | + }); | |
| 261 | + } | |
| 262 | + | |
| 263 | + function iCheckChange(){ | |
| 264 | + var tr = $(this).parents('tr'); | |
| 265 | + if(this.checked) | |
| 266 | + tr.addClass('row-active'); | |
| 267 | + else | |
| 268 | + tr.removeClass('row-active'); | |
| 269 | + | |
| 270 | + if($('#datatable_resource input.icheck:checked').length == 1) | |
| 271 | + $('#removeButton').removeAttr('disabled'); | |
| 272 | + else | |
| 273 | + $('#removeButton').attr('disabled', 'disabled'); | |
| 274 | + } | |
| 275 | + | |
| 276 | + function showPagination(data){ | |
| 277 | + //分页 | |
| 278 | + $('#pagination').jqPaginator({ | |
| 279 | + totalPages: data.totalPage,//总页数 | |
| 280 | + visiblePages: 6,// 中间显示页数 | |
| 281 | + currentPage: page + 1, | |
| 282 | + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | |
| 283 | + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | |
| 284 | + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | |
| 285 | + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | |
| 286 | + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | |
| 287 | + onPageChange: function (num, type) { | |
| 288 | + if(initPagination){ | |
| 289 | + initPagination = false; | |
| 290 | + return; | |
| 291 | + } | |
| 292 | + var cells = $('tr.filter')[0].cells | |
| 293 | + ,params = {} | |
| 294 | + ,name; | |
| 295 | + $.each(cells, function(i, cell){ | |
| 296 | + var items = $('input,select', cell); | |
| 297 | + for(var j = 0, item; item = items[j++];){ | |
| 298 | + name = $(item).attr('name'); | |
| 299 | + if(name){ | |
| 300 | + params[name] = $(item).val(); | |
| 301 | + } | |
| 302 | + } | |
| 303 | + }); | |
| 304 | + page = num - 1; | |
| 305 | + jsDoQuery(params, false); | |
| 306 | + } | |
| 307 | + }); | |
| 308 | + } | |
| 309 | + | |
| 310 | + //删除 | |
| 311 | + $('#removeButton').on('click', function(){ | |
| 312 | + if($(this).attr('disabled')) | |
| 313 | + return; | |
| 314 | + | |
| 315 | + var id = $('#datatable_resource input.icheck:checked').data('id'); | |
| 316 | + | |
| 317 | + removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){ | |
| 318 | + $('tr.filter .filter-submit').click(); | |
| 319 | + }); | |
| 320 | + }); | |
| 321 | + | |
| 322 | +$("#line").on("change",initXl); | |
| 323 | +function initXl(){ | |
| 324 | +$('#nbbm').select2({ | |
| 325 | + placeholder: '搜索车辆...', | |
| 326 | + ajax: { | |
| 327 | + url: '/report/carList', | |
| 328 | + dataType: 'json', | |
| 329 | + delay: 150, | |
| 330 | + data: function (params) { | |
| 331 | + return {nbbm: params.term, | |
| 332 | + gsbm:"", | |
| 333 | + fgsbm:"", | |
| 334 | + xlbm:$('#line').val()}; | |
| 335 | + }, | |
| 336 | + processResults: function (data) { | |
| 337 | + return { | |
| 338 | + results: data | |
| 339 | + }; | |
| 340 | + }, | |
| 341 | + cache: true | |
| 342 | + }, | |
| 343 | + templateResult: function (repo) { | |
| 344 | + if (repo.loading) return repo.text; | |
| 345 | + var h = '<span>' + repo.text + '</span>'; | |
| 346 | + h += (repo.lineName ? ' <span class="select2-desc">' + repo.lineName + '</span>' : ''); | |
| 347 | + return h; | |
| 348 | + }, | |
| 349 | + escapeMarkup: function (markup) { | |
| 350 | + return markup; | |
| 351 | + }, | |
| 352 | + minimumInputLength: 1, | |
| 353 | + templateSelection: function (repo) { | |
| 354 | + return repo.text; | |
| 355 | + }, | |
| 356 | + language: { | |
| 357 | + noResults: function () { | |
| 358 | + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>'; | |
| 359 | + }, | |
| 360 | + inputTooShort: function (e) { | |
| 361 | + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>'; | |
| 362 | + }, | |
| 363 | + searching: function () { | |
| 364 | + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>'; | |
| 365 | + } | |
| 366 | + } | |
| 367 | +}); | |
| 368 | +} | |
| 369 | + | |
| 370 | + | |
| 371 | +//改变状态 | |
| 372 | +function changeEnabled(id,enabled){ | |
| 373 | + $get('/user/changeEnabled',{id:id,enabled:enabled},function(result){ | |
| 374 | + jsDoQuery(null, true); | |
| 375 | + }) | |
| 376 | +} | |
| 377 | +}); | |
| 378 | +</script> | |
| 0 | 379 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/excep/offlineList.html
| ... | ... | @@ -165,7 +165,7 @@ $(function(){ |
| 165 | 165 | var toDay = new Date(); |
| 166 | 166 | var year = toDay.getFullYear(); |
| 167 | 167 | var Month = toDay.getMonth()+1>10?toDay.getMonth()+1:"0"+(toDay.getMonth()+1); |
| 168 | - var Day = toDay.getDate()>10?toDay.getDate():"0"+toDay.getDate(); | |
| 168 | + var Day = toDay.getDate()>9?toDay.getDate():"0"+toDay.getDate(); | |
| 169 | 169 | var date = year+"-"+Month+"-"+Day; |
| 170 | 170 | //时间表单默认选择当日时间。 |
| 171 | 171 | $("input[name='date']")[0].value = date; | ... | ... |
src/main/resources/static/pages/excep/pdabnormalList.html
0 → 100644
| 1 | +<div class="page-head"> | |
| 2 | + <div class="page-title"> | |
| 3 | + <h1>设备异常</h1> | |
| 4 | + </div> | |
| 5 | +</div> | |
| 6 | + | |
| 7 | +<ul class="page-breadcrumb breadcrumb"> | |
| 8 | + <li><a href="/pages/home.html" data-pjax>主页</a> <i class="fa fa-circle"></i></li> | |
| 9 | + <li><span class="active">异常查看</span> <i class="fa fa-circle"></i></li> | |
| 10 | + <li><span class="active">设备异常</span></li> | |
| 11 | +</ul> | |
| 12 | + | |
| 13 | +<div class="row"> | |
| 14 | + <div class="col-md-12"> | |
| 15 | + <!-- Begin: life time stats --> | |
| 16 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | |
| 17 | + <div class="portlet-title"> | |
| 18 | + <div class="caption"> | |
| 19 | + <i class="fa fa-times-circle"></i> <span | |
| 20 | + class="caption-subject font-dark sbold uppercase">设备异常数据表</span> | |
| 21 | + </div> | |
| 22 | + <div class="actions"> | |
| 23 | +<!-- <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加用户</a> --> | |
| 24 | + <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> ɾ���û�</button> --> | |
| 25 | + <!-- <div class="btn-group"> | |
| 26 | + <a class="btn red btn-outline btn-circle" href="javascript:;" | |
| 27 | + data-toggle="dropdown"> <i class="fa fa-share"></i> <span | |
| 28 | + class="hidden-xs"> 系统工具</span> <i class="fa fa-angle-down"></i> | |
| 29 | + </a> | |
| 30 | + <ul class="dropdown-menu pull-right" id="datatable_ajax_tools"> | |
| 31 | + <li><a href="javascript:;" data-action="0" | |
| 32 | + class="tool-action"> <i class="fa fa-print"></i>打印 | |
| 33 | + </a></li> | |
| 34 | + <li><a href="javascript:;" data-action="1" | |
| 35 | + class="tool-action"> <i class="fa fa-copy"></i> 复制 | |
| 36 | + </a></li> | |
| 37 | + <li><a href="javascript:;" data-action="3" | |
| 38 | + class="tool-action"> <i class="fa fa-file-excel-o"></i> | |
| 39 | + 导出Excel | |
| 40 | + </a></li> | |
| 41 | + <li class="divider"></li> | |
| 42 | + <li><a href="javascript:;" data-action="5" | |
| 43 | + class="tool-action"> <i class="fa fa-refresh"></i> 刷新数据 | |
| 44 | + </a></li> | |
| 45 | + </ul> | |
| 46 | + </div> --> | |
| 47 | + </div> | |
| 48 | + </div> | |
| 49 | + <div class="portlet-body"> | |
| 50 | + <div class="table-container" style="margin-top: 10px"> | |
| 51 | + <table | |
| 52 | + class="table table-striped table-bordered table-hover table-checkable" | |
| 53 | + id="datatable_abnormal"> | |
| 54 | + <thead> | |
| 55 | + <tr role="row" class="heading"> | |
| 56 | + <th width="3%">#</th> | |
| 57 | + <th width="20%">内部编码</th> | |
| 58 | + <th width="20%">离线次数</th> | |
| 59 | + <th width="20%">流动次数</th> | |
| 60 | + <th width="20%">协议错误次数</th> | |
| 61 | + <th width="17%">操作</th> | |
| 62 | + </tr> | |
| 63 | + <tr role="row" class="filter"> | |
| 64 | + <td></td> | |
| 65 | + <td> | |
| 66 | + <input type="text" class="form-control form-filter input-sm" name="nbbm"> | |
| 67 | + </td> | |
| 68 | + <td> | |
| 69 | + | |
| 70 | + </td> | |
| 71 | + <td> | |
| 72 | + </td> | |
| 73 | + | |
| 74 | + <td></td> | |
| 75 | + <td> | |
| 76 | + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" > | |
| 77 | + <i class="fa fa-search"></i> 搜索</button> | |
| 78 | + | |
| 79 | + <button class="btn btn-sm red btn-outline filter-cancel"> | |
| 80 | + <i class="fa fa-times"></i> 重置</button> | |
| 81 | + </td> | |
| 82 | + </tr> | |
| 83 | + </thead> | |
| 84 | + <tbody></tbody> | |
| 85 | + </table> | |
| 86 | + <div style="text-align: right;"> | |
| 87 | + <ul id="pagination" class="pagination"></ul> | |
| 88 | + </div> | |
| 89 | + </div> | |
| 90 | + </div> | |
| 91 | + </div> | |
| 92 | + </div> | |
| 93 | +</div> | |
| 94 | + | |
| 95 | +<script id="abnormal_list_temp" type="text/html"> | |
| 96 | +{{each list as obj i}} | |
| 97 | +<tr> | |
| 98 | + <td style="vertical-align: middle;"> | |
| 99 | + <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}"> | |
| 100 | + </td> | |
| 101 | + <td> | |
| 102 | + {{obj.vehicle}} | |
| 103 | + </td> | |
| 104 | + <td> | |
| 105 | + {{obj.offline}} | |
| 106 | + </td> | |
| 107 | + | |
| 108 | + <td> | |
| 109 | + {{obj.drift}} | |
| 110 | + </td> | |
| 111 | + <td> | |
| 112 | + {{obj.protocol}} | |
| 113 | + </td> | |
| 114 | + | |
| 115 | + <td> | |
| 116 | + | |
| 117 | + </td> | |
| 118 | +</tr> | |
| 119 | +{{/each}} | |
| 120 | +{{if list.length == 0}} | |
| 121 | +<tr> | |
| 122 | + <td colspan=8><h6 class="muted">没有找到相关数据</h6></td> | |
| 123 | +</tr> | |
| 124 | +{{/if}} | |
| 125 | +</script> | |
| 126 | + | |
| 127 | +<script> | |
| 128 | +$(function(){ | |
| 129 | + var page = 0, initPagination; | |
| 130 | + var icheckOptions = { | |
| 131 | + checkboxClass: 'icheckbox_flat-blue', | |
| 132 | + increaseArea: '20%' | |
| 133 | + } | |
| 134 | + | |
| 135 | + jsDoQuery(null,true); | |
| 136 | + | |
| 137 | + //重置 | |
| 138 | + $('tr.filter .filter-cancel').on('click', function(){ | |
| 139 | + $('tr.filter input, select').val('').change(); | |
| 140 | + jsDoQuery(null, true); | |
| 141 | + }); | |
| 142 | + | |
| 143 | + //提交 | |
| 144 | + $('tr.filter .filter-submit').on('click', function(){ | |
| 145 | + var cells = $('tr.filter')[0].cells | |
| 146 | + ,params = {} | |
| 147 | + ,name; | |
| 148 | + $.each(cells, function(i, cell){ | |
| 149 | + var items = $('input,select', cell); | |
| 150 | + for(var j = 0, item; item = items[j++];){ | |
| 151 | + name = $(item).attr('name'); | |
| 152 | + if(name){ | |
| 153 | + params[name] = $(item).val(); | |
| 154 | + } | |
| 155 | + } | |
| 156 | + }); | |
| 157 | + page = 0; | |
| 158 | + jsDoQuery(params, true); | |
| 159 | + }); | |
| 160 | + | |
| 161 | + /* | |
| 162 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | |
| 163 | + */ | |
| 164 | + function jsDoQuery(p, pagination){ | |
| 165 | + var params = {}; | |
| 166 | + if(p) | |
| 167 | + params = p; | |
| 168 | + //更新时间排序 | |
| 169 | + params['order'] = 'lastLoginDate'; | |
| 170 | + params['page'] = page; | |
| 171 | + var i = layer.load(2); | |
| 172 | + $get('/nowabnormal/pagequery' ,params, function(data){ | |
| 173 | +// $.each(data.content, function(i, obj) { | |
| 174 | +// obj.lastLoginDate = moment(obj.lastLoginDate).format("YYYY-MM-DD HH:mm:ss"); | |
| 175 | +// }); | |
| 176 | + var bodyHtm = template('abnormal_list_temp', {list: data.dataList}); | |
| 177 | + $('#datatable_abnormal tbody').html(bodyHtm) | |
| 178 | + .find('.icheck').iCheck(icheckOptions) | |
| 179 | + .on('ifChanged', iCheckChange); | |
| 180 | + if(pagination && data.dataList.length > 0){ | |
| 181 | + //重新分页 | |
| 182 | + initPagination = true; | |
| 183 | + showPagination(data); | |
| 184 | + } | |
| 185 | + layer.close(i); | |
| 186 | + }); | |
| 187 | + } | |
| 188 | + | |
| 189 | + function iCheckChange(){ | |
| 190 | + var tr = $(this).parents('tr'); | |
| 191 | + if(this.checked) | |
| 192 | + tr.addClass('row-active'); | |
| 193 | + else | |
| 194 | + tr.removeClass('row-active'); | |
| 195 | + | |
| 196 | + if($('#datatable_resource input.icheck:checked').length == 1) | |
| 197 | + $('#removeButton').removeAttr('disabled'); | |
| 198 | + else | |
| 199 | + $('#removeButton').attr('disabled', 'disabled'); | |
| 200 | + } | |
| 201 | + | |
| 202 | + function showPagination(data){ | |
| 203 | + //分页 | |
| 204 | + $('#pagination').jqPaginator({ | |
| 205 | + totalPages: data.totalPage, | |
| 206 | + visiblePages: 6, | |
| 207 | + currentPage: page + 1, | |
| 208 | + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | |
| 209 | + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | |
| 210 | + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | |
| 211 | + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | |
| 212 | + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | |
| 213 | + onPageChange: function (num, type) { | |
| 214 | + if(initPagination){ | |
| 215 | + initPagination = false; | |
| 216 | + return; | |
| 217 | + } | |
| 218 | + page = num - 1; | |
| 219 | + jsDoQuery(null, false); | |
| 220 | + } | |
| 221 | + }); | |
| 222 | + } | |
| 223 | + | |
| 224 | +}); | |
| 225 | +//改变状态 | |
| 226 | +function changeEnabled(id,enabled){ | |
| 227 | + debugger | |
| 228 | + $get('/user/changeEnabled',{id:id,enabled:enabled},function(result){ | |
| 229 | + jsDoQuery(null, true); | |
| 230 | + }) | |
| 231 | +} | |
| 232 | +</script> | |
| 0 | 233 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/excep/pdboundList.html
0 → 100644
| 1 | +<div class="page-head"> | |
| 2 | + <div class="page-title"> | |
| 3 | + <h1>越界异常</h1> | |
| 4 | + </div> | |
| 5 | +</div> | |
| 6 | + | |
| 7 | +<ul class="page-breadcrumb breadcrumb"> | |
| 8 | + <li><a href="/pages/home.html" data-pjax>主页</a> <i class="fa fa-circle"></i></li> | |
| 9 | + <li><span class="active">异常查看</span> <i class="fa fa-circle"></i></li> | |
| 10 | + <li><span class="active">越界异常</span></li> | |
| 11 | +</ul> | |
| 12 | + | |
| 13 | +<div class="row"> | |
| 14 | + <div class="col-md-12"> | |
| 15 | + <!-- Begin: life time stats --> | |
| 16 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | |
| 17 | + <div class="portlet-title"> | |
| 18 | + <div class="caption"> | |
| 19 | + <i class="fa fa-times-circle"></i> <span | |
| 20 | + class="caption-subject font-dark sbold uppercase">越界异常数据表</span> | |
| 21 | + </div> | |
| 22 | + <div class="actions"> | |
| 23 | +<!-- <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加用户</a> --> | |
| 24 | + <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> ɾ���û�</button> --> | |
| 25 | + <!--<div class="btn-group"> | |
| 26 | + <a class="btn red btn-outline btn-circle" href="javascript:;" | |
| 27 | + data-toggle="dropdown"> <i class="fa fa-share"></i> <span | |
| 28 | + class="hidden-xs"> 系统工具</span> <i class="fa fa-angle-down"></i> | |
| 29 | + </a> | |
| 30 | + <ul class="dropdown-menu pull-right" id="datatable_ajax_tools"> | |
| 31 | + <li><a href="javascript:;" data-action="0" | |
| 32 | + class="tool-action"> <i class="fa fa-print"></i>打印 | |
| 33 | + </a></li> | |
| 34 | + <li><a href="javascript:;" data-action="1" | |
| 35 | + class="tool-action"> <i class="fa fa-copy"></i> 复制 | |
| 36 | + </a></li> | |
| 37 | + <li><a href="javascript:;" data-action="3" | |
| 38 | + class="tool-action"> <i class="fa fa-file-excel-o"></i> | |
| 39 | + 导出Excel | |
| 40 | + </a></li> | |
| 41 | + <li class="divider"></li> | |
| 42 | + <li><a href="javascript:;" data-action="5" | |
| 43 | + class="tool-action"> <i class="fa fa-refresh"></i> 刷新数据 | |
| 44 | + </a></li> | |
| 45 | + </ul> | |
| 46 | + </div>--> | |
| 47 | + </div> | |
| 48 | + </div> | |
| 49 | + <div class="portlet-body"> | |
| 50 | + <div class="table-container" style="margin-top: 10px"> | |
| 51 | + <table | |
| 52 | + class="table table-striped table-bordered table-hover table-checkable" | |
| 53 | + id="datatable_bound"> | |
| 54 | + <thead> | |
| 55 | + <tr role="row" class="heading"> | |
| 56 | + <th width="3%">#</th> | |
| 57 | + <th width="15%">线路</th> | |
| 58 | + <th width="13%">车辆自编号</th> | |
| 59 | + <th width="100">车辆坐标</th> | |
| 60 | + <th width="11%">路牌名</th> | |
| 61 | + <th width="10%">上下行</th> | |
| 62 | + <th width="18%">时间</th> | |
| 63 | + <th width="18%">操作</th> | |
| 64 | + </tr> | |
| 65 | + <tr role="row" class="filter"> | |
| 66 | + <td></td> | |
| 67 | + <td> | |
| 68 | +<!-- <input type="text" class="form-control form-filter input-sm" name="userName_like"> --> | |
| 69 | + <select class="form-control" name="line" id="line" style="width: 150px;"></select> | |
| 70 | + </td> | |
| 71 | + <td> | |
| 72 | +<!-- <input type="text" class="form-control form-filter input-sm" name="nbbm"> --> | |
| 73 | + <select class="form-control" name="nbbm" id="nbbm" style="width: 150px;"></select> | |
| 74 | + </td> | |
| 75 | + <td> | |
| 76 | + </td> | |
| 77 | + <td></td> | |
| 78 | + <td> | |
| 79 | + <select class="form-control form-filter " name="updown"> | |
| 80 | + <option value="">请选择...</option> | |
| 81 | + <option value="0">上行</option> | |
| 82 | + <option value="1">下行</option> | |
| 83 | + <option value="-1">无效</option> | |
| 84 | + </select> | |
| 85 | + </td> | |
| 86 | + <td> | |
| 87 | + <input class="form-control" type="date" name="date" /> | |
| 88 | + </td> | |
| 89 | + <td> | |
| 90 | + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" > | |
| 91 | + <i class="fa fa-search"></i> 搜索</button> | |
| 92 | + | |
| 93 | + <button class="btn btn-sm red btn-outline filter-cancel"> | |
| 94 | + <i class="fa fa-times"></i> 重置</button> | |
| 95 | + </td> | |
| 96 | + </tr> | |
| 97 | + </thead> | |
| 98 | + <tbody></tbody> | |
| 99 | + </table> | |
| 100 | + <div style="text-align: right;"> | |
| 101 | + <ul id="pagination" class="pagination"></ul> | |
| 102 | + </div> | |
| 103 | + </div> | |
| 104 | + </div> | |
| 105 | + </div> | |
| 106 | + </div> | |
| 107 | +</div> | |
| 108 | + | |
| 109 | +<script id="bound_list_temp" type="text/html"> | |
| 110 | +{{each list as obj i}} | |
| 111 | +<tr> | |
| 112 | + <td style="vertical-align: middle;"> | |
| 113 | + <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}"> | |
| 114 | + </td> | |
| 115 | + <td> | |
| 116 | + {{obj.lineName}} | |
| 117 | + </td> | |
| 118 | + <td> | |
| 119 | + {{obj.vehicle}} | |
| 120 | + </td> | |
| 121 | + <td> | |
| 122 | + <a href="/pages/excep/outBoundMap.html?no={{obj.line}},{{obj.upDown}},{{obj.lon}},{{obj.lat}}" | |
| 123 | + class="btn default blue-stripe btn-sm" data-pjax> | |
| 124 | + 查看车辆位置 | |
| 125 | + </a> | |
| 126 | + </td> | |
| 127 | + <td> | |
| 128 | + {{obj.lpname}} | |
| 129 | + </td> | |
| 130 | + <td> | |
| 131 | + {{if obj.upDown==0}} | |
| 132 | + 上行 | |
| 133 | + {{else if obj.upDown==1}} | |
| 134 | + 下行 | |
| 135 | + {{else}} | |
| 136 | + 无效 | |
| 137 | + {{/if}} | |
| 138 | + </td> | |
| 139 | + <td> | |
| 140 | + {{obj.timestampDate}} | |
| 141 | + </td> | |
| 142 | + <td> | |
| 143 | + | |
| 144 | + </td> | |
| 145 | +</tr> | |
| 146 | +{{/each}} | |
| 147 | +{{if list.length == 0}} | |
| 148 | +<tr> | |
| 149 | + <td colspan=8><h6 class="muted">没有找到相关数据</h6></td> | |
| 150 | +</tr> | |
| 151 | +{{/if}} | |
| 152 | +</script> | |
| 153 | + | |
| 154 | +<script> | |
| 155 | +$(function(){ | |
| 156 | + var page = 0, initPagination; | |
| 157 | + var icheckOptions = { | |
| 158 | + checkboxClass: 'icheckbox_flat-blue', | |
| 159 | + increaseArea: '20%' | |
| 160 | + } | |
| 161 | + var toDay = new Date(); | |
| 162 | + var year = toDay.getFullYear(); | |
| 163 | + var Month = toDay.getMonth()+1>10?toDay.getMonth()+1:"0"+(toDay.getMonth()+1); | |
| 164 | + var Day = toDay.getDate()>9?toDay.getDate():"0"+toDay.getDate(); | |
| 165 | + var date = year+"-"+Month+"-"+Day; | |
| 166 | + //时间表单默认选择当日时间。 | |
| 167 | + $("input[name='date']")[0].value = date; | |
| 168 | + var parameter = new Object(); | |
| 169 | + parameter.date = $("input[name='date']")[0].value; | |
| 170 | + jsDoQuery(parameter,true); | |
| 171 | + //重置 | |
| 172 | + $('tr.filter .filter-cancel').on('click', function(){ | |
| 173 | + debugger; | |
| 174 | + $('tr.filter input, select').val('').change(); | |
| 175 | + jsDoQuery(null, true); | |
| 176 | + }); | |
| 177 | + | |
| 178 | + //提交 | |
| 179 | + $('tr.filter .filter-submit').on('click', function(){ | |
| 180 | + var cells = $('tr.filter')[0].cells | |
| 181 | + ,params = {} | |
| 182 | + ,name; | |
| 183 | + $.each(cells, function(i, cell){ | |
| 184 | + var items = $('input,select', cell); | |
| 185 | + for(var j = 0, item; item = items[j++];){ | |
| 186 | + name = $(item).attr('name'); | |
| 187 | + if(name){ | |
| 188 | + params[name] = $(item).val(); | |
| 189 | + } | |
| 190 | + } | |
| 191 | + }); | |
| 192 | + page = 0; | |
| 193 | + jsDoQuery(params, true); | |
| 194 | + }); | |
| 195 | + | |
| 196 | + /* | |
| 197 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | |
| 198 | + */ | |
| 199 | + function jsDoQuery(p, pagination){ | |
| 200 | + var params = {}; | |
| 201 | + if(p) | |
| 202 | + params = p; | |
| 203 | + //更新时间排序 | |
| 204 | + params['order'] = 'lastLoginDate'; | |
| 205 | + params['page'] = page; | |
| 206 | + var i = layer.load(2); | |
| 207 | + $get('/nowbound/pagequery' ,params, function(data){ | |
| 208 | +// $.each(data.content, function(i, obj) { | |
| 209 | +// obj.lastLoginDate = moment(obj.lastLoginDate).format("YYYY-MM-DD HH:mm:ss"); | |
| 210 | +// }); | |
| 211 | + var bodyHtm = template('bound_list_temp', {list: data.dataList}); | |
| 212 | + $('#datatable_bound tbody').html(bodyHtm) | |
| 213 | + .find('.icheck').iCheck(icheckOptions) | |
| 214 | + .on('ifChanged', iCheckChange); | |
| 215 | + if(pagination && data.dataList.length > 0){ | |
| 216 | + //重新分页 | |
| 217 | + initPagination = true; | |
| 218 | + showPagination(data); | |
| 219 | + } | |
| 220 | + layer.close(i); | |
| 221 | + }); | |
| 222 | + } | |
| 223 | + | |
| 224 | + function iCheckChange(){ | |
| 225 | + var tr = $(this).parents('tr'); | |
| 226 | + if(this.checked) | |
| 227 | + tr.addClass('row-active'); | |
| 228 | + else | |
| 229 | + tr.removeClass('row-active'); | |
| 230 | + | |
| 231 | + if($('#datatable_resource input.icheck:checked').length == 1) | |
| 232 | + $('#removeButton').removeAttr('disabled'); | |
| 233 | + else | |
| 234 | + $('#removeButton').attr('disabled', 'disabled'); | |
| 235 | + } | |
| 236 | + | |
| 237 | + function showPagination(data){ | |
| 238 | + //分页 | |
| 239 | + $('#pagination').jqPaginator({ | |
| 240 | + totalPages: data.totalPage, | |
| 241 | + visiblePages: 6, | |
| 242 | + currentPage: page + 1, | |
| 243 | + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | |
| 244 | + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | |
| 245 | + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | |
| 246 | + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | |
| 247 | + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | |
| 248 | + onPageChange: function (num, type) { | |
| 249 | + if(initPagination){ | |
| 250 | + initPagination = false; | |
| 251 | + return; | |
| 252 | + } | |
| 253 | + var cells = $('tr.filter')[0].cells | |
| 254 | + ,params = {} | |
| 255 | + ,name; | |
| 256 | + $.each(cells, function(i, cell){ | |
| 257 | + var items = $('input,select', cell); | |
| 258 | + for(var j = 0, item; item = items[j++];){ | |
| 259 | + name = $(item).attr('name'); | |
| 260 | + if(name){ | |
| 261 | + params[name] = $(item).val(); | |
| 262 | + } | |
| 263 | + } | |
| 264 | + }); | |
| 265 | + page = num - 1; | |
| 266 | + jsDoQuery(params, false); | |
| 267 | + } | |
| 268 | + }); | |
| 269 | + } | |
| 270 | + | |
| 271 | + | |
| 272 | + //删除 | |
| 273 | + $('#removeButton').on('click', function(){ | |
| 274 | + if($(this).attr('disabled')) | |
| 275 | + return; | |
| 276 | + | |
| 277 | + var id = $('#datatable_resource input.icheck:checked').data('id'); | |
| 278 | + | |
| 279 | + removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){ | |
| 280 | + $('tr.filter .filter-submit').click(); | |
| 281 | + }); | |
| 282 | + }); | |
| 283 | + | |
| 284 | + //搜索线路 | |
| 285 | + $.get('/basic/lineCode2Name',function(result){ | |
| 286 | + var data=[]; | |
| 287 | + data.push({id: " ", text: "全部线路"}); | |
| 288 | + for(var code in result){ | |
| 289 | + data.push({id: code, text: result[code]}); | |
| 290 | + } | |
| 291 | + initPinYinSelect2('#line',data,''); | |
| 292 | + | |
| 293 | + }); | |
| 294 | + | |
| 295 | + $("#line").on("change",initXl); | |
| 296 | + | |
| 297 | +function initXl(){ | |
| 298 | +$('#nbbm').select2({ | |
| 299 | + placeholder: '搜索车辆...', | |
| 300 | + ajax: { | |
| 301 | + url: '/report/carList', | |
| 302 | + dataType: 'json', | |
| 303 | + delay: 150, | |
| 304 | + data: function (params) { | |
| 305 | + return {nbbm: params.term, | |
| 306 | + gsbm:" ", | |
| 307 | + fgsbm:" ", | |
| 308 | + xlbm:$('#line').val()}; | |
| 309 | + }, | |
| 310 | + processResults: function (data) { | |
| 311 | + return { | |
| 312 | + results: data | |
| 313 | + }; | |
| 314 | + }, | |
| 315 | + cache: true | |
| 316 | + }, | |
| 317 | + templateResult: function (repo) { | |
| 318 | + if (repo.loading) return repo.text; | |
| 319 | + var h = '<span>' + repo.text + '</span>'; | |
| 320 | + h += (repo.lineName ? ' <span class="select2-desc">' + repo.lineName + '</span>' : ''); | |
| 321 | + return h; | |
| 322 | + }, | |
| 323 | + escapeMarkup: function (markup) { | |
| 324 | + return markup; | |
| 325 | + }, | |
| 326 | + minimumInputLength: 1, | |
| 327 | + templateSelection: function (repo) { | |
| 328 | + return repo.text; | |
| 329 | + }, | |
| 330 | + language: { | |
| 331 | + noResults: function () { | |
| 332 | + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>'; | |
| 333 | + }, | |
| 334 | + inputTooShort: function (e) { | |
| 335 | + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>'; | |
| 336 | + }, | |
| 337 | + searching: function () { | |
| 338 | + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>'; | |
| 339 | + } | |
| 340 | + } | |
| 341 | +}) | |
| 342 | +}; | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | +//改变状态 | |
| 347 | +function changeEnabled(id,enabled){ | |
| 348 | + debugger | |
| 349 | + $get('/user/changeEnabled',{id:id,enabled:enabled},function(result){ | |
| 350 | + jsDoQuery(null, true); | |
| 351 | + }) | |
| 352 | +} | |
| 353 | +}); | |
| 354 | +</script> | |
| 0 | 355 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/excep/pdofflineList.html
0 → 100644
| 1 | +<div class="page-head"> | |
| 2 | + <div class="page-title"> | |
| 3 | + <h1>掉线异常</h1> | |
| 4 | + </div> | |
| 5 | +</div> | |
| 6 | + | |
| 7 | +<ul class="page-breadcrumb breadcrumb"> | |
| 8 | + <li><a href="/pages/home.html" data-pjax>主页</a> <i class="fa fa-circle"></i></li> | |
| 9 | + <li><span class="active">异常查看</span> <i class="fa fa-circle"></i></li> | |
| 10 | + <li><span class="active">掉线异常</span></li> | |
| 11 | +</ul> | |
| 12 | + | |
| 13 | +<div class="row"> | |
| 14 | + <div class="col-md-12"> | |
| 15 | + <!-- Begin: life time stats --> | |
| 16 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | |
| 17 | + <div class="portlet-title"> | |
| 18 | + <div class="caption"> | |
| 19 | + <i class="fa fa-times-circle"></i> <span | |
| 20 | + class="caption-subject font-dark sbold uppercase">掉线异常数据表</span> | |
| 21 | + </div> | |
| 22 | + <div class="actions"> | |
| 23 | +<!-- <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加用户</a> --> | |
| 24 | + <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> ɾ���û�</button> --> | |
| 25 | + <!-- <div class="btn-group"> | |
| 26 | + <a class="btn red btn-outline btn-circle" href="javascript:;" | |
| 27 | + data-toggle="dropdown"> <i class="fa fa-share"></i> <span | |
| 28 | + class="hidden-xs"> 系统工具</span> <i class="fa fa-angle-down"></i> | |
| 29 | + </a> | |
| 30 | + <ul class="dropdown-menu pull-right" id="datatable_ajax_tools"> | |
| 31 | + <li><a href="javascript:;" data-action="0" | |
| 32 | + class="tool-action"> <i class="fa fa-print"></i>打印 | |
| 33 | + </a></li> | |
| 34 | + <li><a href="javascript:;" data-action="1" | |
| 35 | + class="tool-action"> <i class="fa fa-copy"></i> 复制 | |
| 36 | + </a></li> | |
| 37 | + <li><a href="javascript:;" data-action="3" | |
| 38 | + class="tool-action"> <i class="fa fa-file-excel-o"></i> | |
| 39 | + 导出Excel | |
| 40 | + </a></li> | |
| 41 | + <li class="divider"></li> | |
| 42 | + <li><a href="javascript:;" data-action="5" | |
| 43 | + class="tool-action"> <i class="fa fa-refresh"></i> 刷新数据 | |
| 44 | + </a></li> | |
| 45 | + </ul> | |
| 46 | + </div> --> | |
| 47 | + </div> | |
| 48 | + </div> | |
| 49 | + <div class="portlet-body"> | |
| 50 | + <div class="table-container" style="margin-top: 10px"> | |
| 51 | + <table | |
| 52 | + class="table table-striped table-bordered table-hover table-checkable" | |
| 53 | + id="datatable_offline"> | |
| 54 | + <thead> | |
| 55 | + <tr role="row" class="heading"> | |
| 56 | + <th width="3%">#</th> | |
| 57 | + <th width="15%">线路</th> | |
| 58 | + <th width="13%">车辆自编号</th> | |
| 59 | + <th width="10%">工号/名字</th> | |
| 60 | + <th width="11%">路牌名</th> | |
| 61 | + <th width="10%">上下行</th> | |
| 62 | + <th width="18%">掉线时间</th> | |
| 63 | + <th width="18%">恢复时间</th> | |
| 64 | + <th width="20%">操作</th> | |
| 65 | + </tr> | |
| 66 | + <tr role="row" class="filter"> | |
| 67 | + <td></td> | |
| 68 | + <td> | |
| 69 | +<!-- <input type="text" class="form-control form-filter input-sm" name="userName_like"> --> | |
| 70 | + <select class="form-control" name="line" id="line" style="width: 150px;"></select> | |
| 71 | + </td> | |
| 72 | + <td> | |
| 73 | +<!-- <input type="text" class="form-control form-filter input-sm" name="nbbm" id="nbbm"> --> | |
| 74 | + | |
| 75 | + <select class="form-control" name="nbbm" id="nbbm" style="width: 150px;"></select> | |
| 76 | + </td> | |
| 77 | + <td> | |
| 78 | + </td> | |
| 79 | + <td></td> | |
| 80 | + <td> | |
| 81 | + <select class="form-control form-filter " name="updown"> | |
| 82 | + <option value="">请选择...</option> | |
| 83 | + <option value="0">上行</option> | |
| 84 | + <option value="1">下行</option> | |
| 85 | + <option value="-1">无效</option> | |
| 86 | + </select> | |
| 87 | + </td> | |
| 88 | + <td> | |
| 89 | + <input class="form-control" type="date" name="date" /> | |
| 90 | + </td> | |
| 91 | + <td></td> | |
| 92 | + <td> | |
| 93 | + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" > | |
| 94 | + <i class="fa fa-search"></i> 搜索</button> | |
| 95 | + <br> | |
| 96 | + <button class="btn btn-sm red btn-outline filter-cancel "> | |
| 97 | + <i class="fa fa-times"></i> 重置</button> | |
| 98 | + </td> | |
| 99 | + </tr> | |
| 100 | + </thead> | |
| 101 | + <tbody></tbody> | |
| 102 | + </table> | |
| 103 | + <div style="text-align: right;"> | |
| 104 | + <ul id="pagination" class="pagination"></ul> | |
| 105 | + </div> | |
| 106 | + </div> | |
| 107 | + </div> | |
| 108 | + </div> | |
| 109 | + </div> | |
| 110 | +</div> | |
| 111 | + | |
| 112 | +<script id="offline_list_temp" type="text/html"> | |
| 113 | +{{each list as obj i}} | |
| 114 | +<tr> | |
| 115 | + <td style="vertical-align: middle;"> | |
| 116 | + <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}"> | |
| 117 | + </td> | |
| 118 | + <td> | |
| 119 | + {{obj.lineName}} | |
| 120 | + </td> | |
| 121 | + <td> | |
| 122 | + {{obj.vehicle}} | |
| 123 | + </td> | |
| 124 | + | |
| 125 | + <td> | |
| 126 | + {{obj.jsy}} | |
| 127 | + </td> | |
| 128 | + <td> | |
| 129 | + {{obj.lpname}} | |
| 130 | + </td> | |
| 131 | + <td> | |
| 132 | + {{if obj.upDown==0}} | |
| 133 | + 上行 | |
| 134 | + {{else if obj.upDown==1}} | |
| 135 | + 下行 | |
| 136 | + {{else}} | |
| 137 | + 无效 | |
| 138 | + {{/if}} | |
| 139 | + </td> | |
| 140 | + <td> | |
| 141 | + {{obj.timestampDate}} | |
| 142 | + </td> | |
| 143 | + <td> | |
| 144 | + {{obj.tsdate}} | |
| 145 | + </td> | |
| 146 | + <td> | |
| 147 | + | |
| 148 | + </td> | |
| 149 | +</tr> | |
| 150 | +{{/each}} | |
| 151 | +{{if list.length == 0}} | |
| 152 | +<tr> | |
| 153 | + <td colspan=8><h6 class="muted">没有找到相关数据</h6></td> | |
| 154 | +</tr> | |
| 155 | +{{/if}} | |
| 156 | +</script> | |
| 157 | + | |
| 158 | +<script> | |
| 159 | +$(function(){ | |
| 160 | + var page = 0, initPagination; | |
| 161 | + var icheckOptions = { | |
| 162 | + checkboxClass: 'icheckbox_flat-blue', | |
| 163 | + increaseArea: '20%' | |
| 164 | + }; | |
| 165 | + var toDay = new Date(); | |
| 166 | + var year = toDay.getFullYear(); | |
| 167 | + var Month = toDay.getMonth()+1>10?toDay.getMonth()+1:"0"+(toDay.getMonth()+1); | |
| 168 | + var Day = toDay.getDate()>9?toDay.getDate():"0"+toDay.getDate(); | |
| 169 | + var date = year+"-"+Month+"-"+Day; | |
| 170 | + //时间表单默认选择当日时间。 | |
| 171 | + $("input[name='date']")[0].value = date; | |
| 172 | + var parameter = new Object(); | |
| 173 | + parameter.date = $("input[name='date']")[0].value; | |
| 174 | + jsDoQuery(parameter,true); | |
| 175 | + | |
| 176 | + //重置 | |
| 177 | + $('tr.filter .filter-cancel').on('click', function(){ | |
| 178 | + $('tr.filter input, select').val('').change(); | |
| 179 | + jsDoQuery(null, true); | |
| 180 | + }); | |
| 181 | + | |
| 182 | + //提交 | |
| 183 | + $('tr.filter .filter-submit').on('click', function(){ | |
| 184 | + var cells = $('tr.filter')[0].cells | |
| 185 | + ,params = {} | |
| 186 | + ,name; | |
| 187 | + $.each(cells, function(i, cell){ | |
| 188 | + var items = $('input,select', cell); | |
| 189 | + for(var j = 0, item; item = items[j++];){ | |
| 190 | + name = $(item).attr('name'); | |
| 191 | + if(name){ | |
| 192 | + params[name] = $(item).val(); | |
| 193 | + } | |
| 194 | + } | |
| 195 | + }); | |
| 196 | + page = 0; | |
| 197 | + jsDoQuery(params, true); | |
| 198 | + }); | |
| 199 | + | |
| 200 | + /* | |
| 201 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | |
| 202 | + */ | |
| 203 | + function jsDoQuery(p, pagination){ | |
| 204 | + var params = {}; | |
| 205 | + if(p) | |
| 206 | + params = p; | |
| 207 | + //更新时间排序 | |
| 208 | + params['order'] = 'lastLoginDate'; | |
| 209 | + params['page'] = page; | |
| 210 | + var i = layer.load(2); | |
| 211 | + $get('/nowoffline/pagequery' ,params, function(data){ | |
| 212 | + var bodyHtm = template('offline_list_temp', {list: data.dataList}); | |
| 213 | + | |
| 214 | + $('#datatable_offline tbody').html(bodyHtm) | |
| 215 | + .find('.icheck').iCheck(icheckOptions) | |
| 216 | + .on('ifChanged', iCheckChange); | |
| 217 | + if(pagination && data.dataList.length > 0){ | |
| 218 | + //重新分页 | |
| 219 | + initPagination = true; | |
| 220 | + showPagination(data); | |
| 221 | + } | |
| 222 | + layer.close(i); | |
| 223 | + }); | |
| 224 | + } | |
| 225 | + | |
| 226 | + function iCheckChange(){ | |
| 227 | + var tr = $(this).parents('tr'); | |
| 228 | + if(this.checked) | |
| 229 | + tr.addClass('row-active'); | |
| 230 | + else | |
| 231 | + tr.removeClass('row-active'); | |
| 232 | + | |
| 233 | + if($('#datatable_resource input.icheck:checked').length == 1) | |
| 234 | + $('#removeButton').removeAttr('disabled'); | |
| 235 | + else | |
| 236 | + $('#removeButton').attr('disabled', 'disabled'); | |
| 237 | + } | |
| 238 | + | |
| 239 | + function showPagination(data){ | |
| 240 | + //分页 | |
| 241 | + $('#pagination').jqPaginator({ | |
| 242 | + totalPages: data.totalPage, | |
| 243 | + visiblePages: 6, | |
| 244 | + currentPage: page + 1, | |
| 245 | + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | |
| 246 | + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | |
| 247 | + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | |
| 248 | + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | |
| 249 | + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | |
| 250 | + onPageChange: function (num, type) { | |
| 251 | + if(initPagination){ | |
| 252 | + initPagination = false; | |
| 253 | + return; | |
| 254 | + } | |
| 255 | + page = num - 1; | |
| 256 | + var cells = $('tr.filter')[0].cells | |
| 257 | + ,params = {} | |
| 258 | + ,name; | |
| 259 | + $.each(cells, function(i, cell){ | |
| 260 | + var items = $('input,select', cell); | |
| 261 | + for(var j = 0, item; item = items[j++];){ | |
| 262 | + name = $(item).attr('name'); | |
| 263 | + if(name){ | |
| 264 | + params[name] = $(item).val(); | |
| 265 | + } | |
| 266 | + } | |
| 267 | + }); | |
| 268 | + jsDoQuery(params, false); | |
| 269 | + } | |
| 270 | + }); | |
| 271 | + } | |
| 272 | + | |
| 273 | + | |
| 274 | + //删除 | |
| 275 | + $('#removeButton').on('click', function(){ | |
| 276 | + if($(this).attr('disabled')) | |
| 277 | + return; | |
| 278 | + | |
| 279 | + var id = $('#datatable_resource input.icheck:checked').data('id'); | |
| 280 | + | |
| 281 | + removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){ | |
| 282 | + $('tr.filter .filter-submit').click(); | |
| 283 | + }); | |
| 284 | + }); | |
| 285 | + | |
| 286 | + //搜索线路 | |
| 287 | + | |
| 288 | + $.get('/basic/lineCode2Name',function(result){ | |
| 289 | + var data=[]; | |
| 290 | + data.push({id: " ", text: "全部线路"}); | |
| 291 | + for(var code in result){ | |
| 292 | + data.push({id: code, text: result[code]}); | |
| 293 | + } | |
| 294 | + initPinYinSelect2('#line',data,''); | |
| 295 | + | |
| 296 | + }); | |
| 297 | + | |
| 298 | + $("#line").on("change",initXl); | |
| 299 | + function initXl(){ | |
| 300 | + $('#nbbm').select2({ | |
| 301 | + placeholder: '搜索车辆...', | |
| 302 | + ajax: { | |
| 303 | + url: '/report/carList', | |
| 304 | + dataType: 'json', | |
| 305 | + delay: 150, | |
| 306 | + data: function (params) { | |
| 307 | + return {nbbm: params.term, | |
| 308 | + gsbm:"", | |
| 309 | + fgsbm:"", | |
| 310 | + xlbm:$('#line').val()}; | |
| 311 | + }, | |
| 312 | + processResults: function (data) { | |
| 313 | + return { | |
| 314 | + results: data | |
| 315 | + }; | |
| 316 | + }, | |
| 317 | + cache: true | |
| 318 | + }, | |
| 319 | + templateResult: function (repo) { | |
| 320 | + if (repo.loading) return repo.text; | |
| 321 | + var h = '<span>' + repo.text + '</span>'; | |
| 322 | + h += (repo.lineName ? ' <span class="select2-desc">' + repo.lineName + '</span>' : ''); | |
| 323 | + return h; | |
| 324 | + }, | |
| 325 | + escapeMarkup: function (markup) { | |
| 326 | + return markup; | |
| 327 | + }, | |
| 328 | + minimumInputLength: 1, | |
| 329 | + templateSelection: function (repo) { | |
| 330 | + return repo.text; | |
| 331 | + }, | |
| 332 | + language: { | |
| 333 | + noResults: function () { | |
| 334 | + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>'; | |
| 335 | + }, | |
| 336 | + inputTooShort: function (e) { | |
| 337 | + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>'; | |
| 338 | + }, | |
| 339 | + searching: function () { | |
| 340 | + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>'; | |
| 341 | + } | |
| 342 | + } | |
| 343 | + }); | |
| 344 | + } | |
| 345 | + | |
| 346 | +}); | |
| 347 | +</script> | |
| 0 | 348 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/excep/pdspeedingList.html
0 → 100644
| 1 | +<div class="page-head"> | |
| 2 | + <div class="page-title"> | |
| 3 | + <h1>超速异常</h1> | |
| 4 | + </div> | |
| 5 | +</div> | |
| 6 | + | |
| 7 | +<ul class="page-breadcrumb breadcrumb"> | |
| 8 | + <li><a href="/pages/home.html" data-pjax>主页</a> <i class="fa fa-circle"></i></li> | |
| 9 | + <li><span class="active">异常查看</span> <i class="fa fa-circle"></i></li> | |
| 10 | + <li><span class="active">超速异常</span></li> | |
| 11 | +</ul> | |
| 12 | + | |
| 13 | +<div class="row"> | |
| 14 | + <div class="col-md-12"> | |
| 15 | + <!-- Begin: life time stats --> | |
| 16 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | |
| 17 | + <div class="portlet-title"> | |
| 18 | + <div class="caption"> | |
| 19 | + <i class="fa fa-times-circle"></i> <span | |
| 20 | + class="caption-subject font-dark sbold uppercase">超速异常数据表</span> | |
| 21 | + </div> | |
| 22 | + <div class="actions"> | |
| 23 | + </div> | |
| 24 | + </div> | |
| 25 | + <div class="portlet-body"> | |
| 26 | + <div class="table-container" style="margin-top: 10px"> | |
| 27 | + <table | |
| 28 | + class="table table-striped table-bordered table-hover table-checkable" | |
| 29 | + id="datatable_speeding"> | |
| 30 | + <thead> | |
| 31 | + <tr role="row" class="heading"> | |
| 32 | + <th width="3%">#</th> | |
| 33 | + <th width="4%">线路</th> | |
| 34 | + <th width="6%">车辆自编号</th> | |
| 35 | + <th width="8%">上下行</th> | |
| 36 | + <th width="10%">开始时间</th> | |
| 37 | + <th width="10%">结束时间</th> | |
| 38 | + <th width="8%">持续时间</th> | |
| 39 | + <th width="8%">查看轨迹</th> | |
| 40 | + <th width="6%">操作</th> | |
| 41 | + </tr> | |
| 42 | + <tr role="row" class="filter"> | |
| 43 | + <td></td> | |
| 44 | + <td> | |
| 45 | + <select class="form-control" name="line" id="line" style="width: 100px;"></select> | |
| 46 | + </td> | |
| 47 | + <td> | |
| 48 | + <select class="form-control" name="nbbm" id="nbbm" style="width: 100px;"></select> | |
| 49 | + </td> | |
| 50 | + <!-- <td> | |
| 51 | + | |
| 52 | + </td> | |
| 53 | + <td> | |
| 54 | + </td> --> | |
| 55 | + <td> | |
| 56 | + <select class="form-control form-filter " name="updown" style="width: 90px;"> | |
| 57 | + <option value="">请选择...</option> | |
| 58 | + <option value="0">上行</option> | |
| 59 | + <option value="1">下行</option> | |
| 60 | + <option value="-1">无效</option> | |
| 61 | + </select> | |
| 62 | + </td> | |
| 63 | + <td> | |
| 64 | + <input class="form-control" type="date" name="startDate" /> | |
| 65 | + </td> | |
| 66 | + <td> | |
| 67 | + <input class="form-control" type="date" name="endDate" /> | |
| 68 | + </td> | |
| 69 | + <td> | |
| 70 | + >=<input class="form-control" type="text" name="times" style="width:50px;display:inline!important" | |
| 71 | + onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"/> | |
| 72 | + </td> | |
| 73 | + <td> | |
| 74 | + </td> | |
| 75 | + <td> | |
| 76 | + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" > | |
| 77 | + <i class="fa fa-search"></i> 搜索</button> | |
| 78 | + | |
| 79 | + <button class="btn btn-sm red btn-outline filter-cancel"> | |
| 80 | + <i class="fa fa-times"></i> 重置</button> | |
| 81 | + </td> | |
| 82 | + </tr> | |
| 83 | + </thead> | |
| 84 | + <tbody></tbody> | |
| 85 | + </table> | |
| 86 | + <div style="text-align: right;"> | |
| 87 | + <ul id="pagination" class="pagination"></ul> | |
| 88 | + </div> | |
| 89 | + </div> | |
| 90 | + </div> | |
| 91 | + </div> | |
| 92 | + </div> | |
| 93 | +</div> | |
| 94 | + | |
| 95 | +<script id="speeding_list_temp" type="text/html"> | |
| 96 | +{{each list as obj i}} | |
| 97 | +<tr> | |
| 98 | + <td style="vertical-align: middle;"> | |
| 99 | + <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}"> | |
| 100 | + </td> | |
| 101 | + <td> | |
| 102 | + {{obj.lineName}} | |
| 103 | + </td> | |
| 104 | + <td> | |
| 105 | + {{obj.vehicle}} | |
| 106 | + </td> | |
| 107 | + <td> | |
| 108 | + {{if obj.upDown==0}} | |
| 109 | + 上行 | |
| 110 | + {{else if obj.upDown==1}} | |
| 111 | + 下行 | |
| 112 | + {{else}} | |
| 113 | + 无效 | |
| 114 | + {{/if}} | |
| 115 | + </td> | |
| 116 | + <td> | |
| 117 | + {{obj.timestampDate}} | |
| 118 | + </td> | |
| 119 | + <td> | |
| 120 | + {{obj.endtimestampDate}} | |
| 121 | + </td> | |
| 122 | + <td> | |
| 123 | + {{(obj.endtimestamp-obj.timestamp)/1000}}秒 | |
| 124 | + </td> | |
| 125 | + <td> | |
| 126 | + <a class="btn default blue-stripe btn-sm lookTrajectory" data-vehicle ="{{obj.vehicle}}" | |
| 127 | + data-startdate="{{obj.timestampDate}}" data-enddate="{{obj.endtimestampDate}}" | |
| 128 | + data-lon="{{obj.lon}}" data-lat="{{obj.lat}}" data-endlon="{{obj.endlon}}" | |
| 129 | + data-endlat="{{obj.endlat}}" data-lineid="{{obj.lineId}}" data-updown="{{obj.upDown}}"> | |
| 130 | + 查看轨迹 | |
| 131 | + </a> | |
| 132 | + </td> | |
| 133 | + <td> | |
| 134 | + | |
| 135 | + </td> | |
| 136 | +</tr> | |
| 137 | +{{/each}} | |
| 138 | +{{if list.length == 0}} | |
| 139 | +<tr> | |
| 140 | + <td colspan=8><h6 class="muted">没有找到相关数据</h6></td> | |
| 141 | +</tr> | |
| 142 | +{{/if}} | |
| 143 | +</script> | |
| 144 | + | |
| 145 | +<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script> | |
| 146 | + | |
| 147 | +<script> | |
| 148 | +$(function(){ | |
| 149 | + var page = 0, initPagination; | |
| 150 | + var icheckOptions = { | |
| 151 | + checkboxClass: 'icheckbox_flat-blue', | |
| 152 | + increaseArea: '20%' | |
| 153 | + } | |
| 154 | + | |
| 155 | + var date = new Date(); | |
| 156 | + var week = date.getDay();//表明今天是周几。0-6表示周日到周六 | |
| 157 | + var dateTime = date.getTime();//当前时间的时间戳,单位秒。 | |
| 158 | + | |
| 159 | + var endTime = dateTime-week*24*3600*1000;//上周末、格式为时间戳。 | |
| 160 | + var startTime = endTime-6*24*3600*1000;//上周一、格式为时间戳。 | |
| 161 | + var endDate = timeToData(endTime); | |
| 162 | + var startDate = timeToData(startTime); | |
| 163 | + //表单默认选择上周一到上周日的超速信息。 | |
| 164 | + $("input[name='endDate']")[0].value = endDate; | |
| 165 | + $("input[name='startDate']")[0].value = startDate; | |
| 166 | + var parameter = new Object(); | |
| 167 | + parameter.endDate = $("input[name='endDate']")[0].value; | |
| 168 | + parameter.startDate = $("input[name='startDate']")[0].value; | |
| 169 | + jsDoQuery(parameter, true); | |
| 170 | + //搜索线路 | |
| 171 | + $.get('/basic/lineCode2Name',function(result){ | |
| 172 | + var data=[]; | |
| 173 | + data.push({id: " ", text: "全部线路"}); | |
| 174 | + for(var code in result){ | |
| 175 | + data.push({id: code, text: result[code]}); | |
| 176 | + } | |
| 177 | + initPinYinSelect2('#line',data,''); | |
| 178 | + }); | |
| 179 | + | |
| 180 | + //时间戳转换为年月日 | |
| 181 | + function timeToData(time){ | |
| 182 | + var date = new Date(time); | |
| 183 | + var year = date.getFullYear(); | |
| 184 | + var Month = date.getMonth()+1>10?date.getMonth()+1:"0"+(date.getMonth()+1); | |
| 185 | + var Day = date.getDate()>9?date.getDate():"0"+date.getDate(); | |
| 186 | + return year+"-"+Month+"-"+Day; | |
| 187 | + } | |
| 188 | + | |
| 189 | + //重置 | |
| 190 | + $('tr.filter .filter-cancel').on('click', function(){ | |
| 191 | + $('tr.filter input, select').val('').change(); | |
| 192 | + jsDoQuery(null, true); | |
| 193 | + }); | |
| 194 | + | |
| 195 | + //提交 | |
| 196 | + $('tr.filter .filter-submit').on('click', function(){ | |
| 197 | + var cells = $('tr.filter')[0].cells | |
| 198 | + ,params = {} | |
| 199 | + ,name; | |
| 200 | + $.each(cells, function(i, cell){ | |
| 201 | + var items = $('input,select', cell); | |
| 202 | + for(var j = 0, item; item = items[j++];){ | |
| 203 | + name = $(item).attr('name'); | |
| 204 | + if(name){ | |
| 205 | + params[name] = $(item).val(); | |
| 206 | + } | |
| 207 | + } | |
| 208 | + }); | |
| 209 | + page = 0; | |
| 210 | + jsDoQuery(params, true); | |
| 211 | + }); | |
| 212 | + | |
| 213 | + /* | |
| 214 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | |
| 215 | + */ | |
| 216 | + function jsDoQuery(p, pagination){ | |
| 217 | + var params = {}; | |
| 218 | + if(p) | |
| 219 | + params = p; | |
| 220 | + //更新时间排序 | |
| 221 | + params['order'] = 'lastLoginDate'; | |
| 222 | + params['page'] = page; | |
| 223 | + var i = layer.load(2); | |
| 224 | + $get('/nowspeeding/pagequery' ,params, function(data){ | |
| 225 | + var bodyHtm = template('speeding_list_temp', {list: data.dataList}); | |
| 226 | + $('#datatable_speeding tbody').html(bodyHtm) | |
| 227 | + .find('.icheck').iCheck(icheckOptions) | |
| 228 | + .on('ifChanged', iCheckChange); | |
| 229 | + if(pagination && data.dataList.length > 0){ | |
| 230 | + //重新分页 | |
| 231 | + initPagination = true; | |
| 232 | + showPagination(data); | |
| 233 | + } | |
| 234 | + layer.close(i); | |
| 235 | + $(".lookTrajectory").click(function(){ | |
| 236 | + var vehicle = $(this).data('vehicle'); | |
| 237 | + var startDate = $(this).data('startdate'); | |
| 238 | + var endDate = $(this).data('enddate'); | |
| 239 | + var lon = $(this).data('lon'); | |
| 240 | + var lat = $(this).data('lat'); | |
| 241 | + var endLon = $(this).data('endlon'); | |
| 242 | + var endLat = $(this).data('endlat'); | |
| 243 | + var lineid = $(this).data('lineid'); | |
| 244 | + var upDown = $(this).data('updown'); | |
| 245 | + var storage = window.localStorage; | |
| 246 | + storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat+","+lineid+","+upDown); | |
| 247 | + $.get('/pages/excep/speedingMap.html?',function (result) { | |
| 248 | + layer.open({ | |
| 249 | + type: 1, | |
| 250 | + title:'<i class="uk-icon-play-circle"></i>轨迹回放', | |
| 251 | + shadeClose: true, | |
| 252 | + shade: true, | |
| 253 | + scrollbar: false, | |
| 254 | + maxmin: false, //开启最大化最小化按钮 | |
| 255 | + area: ['100%', '100%'], | |
| 256 | + content:result,//内容 | |
| 257 | + }); | |
| 258 | + }); | |
| 259 | + }) | |
| 260 | + }); | |
| 261 | + } | |
| 262 | + | |
| 263 | + function iCheckChange(){ | |
| 264 | + var tr = $(this).parents('tr'); | |
| 265 | + if(this.checked) | |
| 266 | + tr.addClass('row-active'); | |
| 267 | + else | |
| 268 | + tr.removeClass('row-active'); | |
| 269 | + | |
| 270 | + if($('#datatable_resource input.icheck:checked').length == 1) | |
| 271 | + $('#removeButton').removeAttr('disabled'); | |
| 272 | + else | |
| 273 | + $('#removeButton').attr('disabled', 'disabled'); | |
| 274 | + } | |
| 275 | + | |
| 276 | + function showPagination(data){ | |
| 277 | + //分页 | |
| 278 | + $('#pagination').jqPaginator({ | |
| 279 | + totalPages: data.totalPage,//总页数 | |
| 280 | + visiblePages: 6,// 中间显示页数 | |
| 281 | + currentPage: page + 1, | |
| 282 | + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | |
| 283 | + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | |
| 284 | + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | |
| 285 | + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | |
| 286 | + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | |
| 287 | + onPageChange: function (num, type) { | |
| 288 | + if(initPagination){ | |
| 289 | + initPagination = false; | |
| 290 | + return; | |
| 291 | + } | |
| 292 | + var cells = $('tr.filter')[0].cells | |
| 293 | + ,params = {} | |
| 294 | + ,name; | |
| 295 | + $.each(cells, function(i, cell){ | |
| 296 | + var items = $('input,select', cell); | |
| 297 | + for(var j = 0, item; item = items[j++];){ | |
| 298 | + name = $(item).attr('name'); | |
| 299 | + if(name){ | |
| 300 | + params[name] = $(item).val(); | |
| 301 | + } | |
| 302 | + } | |
| 303 | + }); | |
| 304 | + page = num - 1; | |
| 305 | + jsDoQuery(params, false); | |
| 306 | + } | |
| 307 | + }); | |
| 308 | + } | |
| 309 | + | |
| 310 | + //删除 | |
| 311 | + $('#removeButton').on('click', function(){ | |
| 312 | + if($(this).attr('disabled')) | |
| 313 | + return; | |
| 314 | + | |
| 315 | + var id = $('#datatable_resource input.icheck:checked').data('id'); | |
| 316 | + | |
| 317 | + removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){ | |
| 318 | + $('tr.filter .filter-submit').click(); | |
| 319 | + }); | |
| 320 | + }); | |
| 321 | + | |
| 322 | +$("#line").on("change",initXl); | |
| 323 | +function initXl(){ | |
| 324 | +$('#nbbm').select2({ | |
| 325 | + placeholder: '搜索车辆...', | |
| 326 | + ajax: { | |
| 327 | + url: '/report/carList', | |
| 328 | + dataType: 'json', | |
| 329 | + delay: 150, | |
| 330 | + data: function (params) { | |
| 331 | + return {nbbm: params.term, | |
| 332 | + gsbm:"", | |
| 333 | + fgsbm:"", | |
| 334 | + xlbm:$('#line').val()}; | |
| 335 | + }, | |
| 336 | + processResults: function (data) { | |
| 337 | + return { | |
| 338 | + results: data | |
| 339 | + }; | |
| 340 | + }, | |
| 341 | + cache: true | |
| 342 | + }, | |
| 343 | + templateResult: function (repo) { | |
| 344 | + if (repo.loading) return repo.text; | |
| 345 | + var h = '<span>' + repo.text + '</span>'; | |
| 346 | + h += (repo.lineName ? ' <span class="select2-desc">' + repo.lineName + '</span>' : ''); | |
| 347 | + return h; | |
| 348 | + }, | |
| 349 | + escapeMarkup: function (markup) { | |
| 350 | + return markup; | |
| 351 | + }, | |
| 352 | + minimumInputLength: 1, | |
| 353 | + templateSelection: function (repo) { | |
| 354 | + return repo.text; | |
| 355 | + }, | |
| 356 | + language: { | |
| 357 | + noResults: function () { | |
| 358 | + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>'; | |
| 359 | + }, | |
| 360 | + inputTooShort: function (e) { | |
| 361 | + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>'; | |
| 362 | + }, | |
| 363 | + searching: function () { | |
| 364 | + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>'; | |
| 365 | + } | |
| 366 | + } | |
| 367 | +}); | |
| 368 | +} | |
| 369 | + | |
| 370 | + | |
| 371 | +//改变状态 | |
| 372 | +function changeEnabled(id,enabled){ | |
| 373 | + $get('/user/changeEnabled',{id:id,enabled:enabled},function(result){ | |
| 374 | + jsDoQuery(null, true); | |
| 375 | + }) | |
| 376 | +} | |
| 377 | +}); | |
| 378 | +</script> | |
| 0 | 379 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/excep/speedingList.html
| ... | ... | @@ -59,15 +59,16 @@ |
| 59 | 59 | <option value="1">下行</option> |
| 60 | 60 | <option value="-1">无效</option> |
| 61 | 61 | </select> |
| 62 | - </td> | |
| 62 | + </td> | |
| 63 | 63 | <td> |
| 64 | 64 | <input class="form-control" type="date" name="startDate" /> |
| 65 | - - | |
| 66 | - <input class="form-control" type="date" name="endDate" /> | |
| 67 | 65 | </td> |
| 68 | 66 | <td> |
| 67 | + <input class="form-control" type="date" name="endDate" /> | |
| 69 | 68 | </td> |
| 70 | 69 | <td> |
| 70 | + >=<input class="form-control" type="text" name="times" style="width:50px;display:inline!important" | |
| 71 | + onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"/> | |
| 71 | 72 | </td> |
| 72 | 73 | <td> |
| 73 | 74 | </td> |
| ... | ... | @@ -104,9 +105,9 @@ |
| 104 | 105 | {{obj.vehicle}} |
| 105 | 106 | </td> |
| 106 | 107 | <td> |
| 107 | - {{if obj.up_down==0}} | |
| 108 | + {{if obj.upDown==0}} | |
| 108 | 109 | 上行 |
| 109 | - {{else if obj.up_down==1}} | |
| 110 | + {{else if obj.upDown==1}} | |
| 110 | 111 | 下行 |
| 111 | 112 | {{else}} |
| 112 | 113 | 无效 |
| ... | ... | @@ -124,9 +125,9 @@ |
| 124 | 125 | <td> |
| 125 | 126 | <a class="btn default blue-stripe btn-sm lookTrajectory" data-vehicle ="{{obj.vehicle}}" |
| 126 | 127 | data-startdate="{{obj.timestampDate}}" data-enddate="{{obj.endtimestampDate}}" |
| 127 | - data-lon="{{obj.lon}}" data-lat="{{obj.lat}}" | |
| 128 | - data-endlon="{{obj.endlon}}" data-endlat="{{obj.endlat}}" > | |
| 129 | - 查看轨迹 | |
| 128 | + data-lon="{{obj.lon}}" data-lat="{{obj.lat}}" data-endlon="{{obj.endlon}}" | |
| 129 | + data-endlat="{{obj.endlat}}" data-lineid="{{obj.lineId}}" data-updown="{{obj.upDown}}"> | |
| 130 | + 查看轨迹 | |
| 130 | 131 | </a> |
| 131 | 132 | </td> |
| 132 | 133 | <td> |
| ... | ... | @@ -165,7 +166,7 @@ $(function(){ |
| 165 | 166 | var parameter = new Object(); |
| 166 | 167 | parameter.endDate = $("input[name='endDate']")[0].value; |
| 167 | 168 | parameter.startDate = $("input[name='startDate']")[0].value; |
| 168 | - | |
| 169 | + jsDoQuery(parameter, true); | |
| 169 | 170 | //搜索线路 |
| 170 | 171 | $.get('/basic/lineCode2Name',function(result){ |
| 171 | 172 | var data=[]; |
| ... | ... | @@ -173,11 +174,7 @@ $(function(){ |
| 173 | 174 | for(var code in result){ |
| 174 | 175 | data.push({id: code, text: result[code]}); |
| 175 | 176 | } |
| 176 | - initPinYinSelect2($('#line'),data,function(ldmcSelector) { | |
| 177 | - ldmcSelector.select2("val",data[1].id);//因为数据量太大,所以默认一条线路作为查询参数 | |
| 178 | - }); | |
| 179 | - parameter.line = data[1].id; | |
| 180 | - jsDoQuery(parameter,true); | |
| 177 | + initPinYinSelect2('#line',data,''); | |
| 181 | 178 | }); |
| 182 | 179 | |
| 183 | 180 | //时间戳转换为年月日 |
| ... | ... | @@ -224,12 +221,12 @@ $(function(){ |
| 224 | 221 | params['order'] = 'lastLoginDate'; |
| 225 | 222 | params['page'] = page; |
| 226 | 223 | var i = layer.load(2); |
| 227 | - $.get('/gps/pagequery' ,params, function(data){ | |
| 228 | - var bodyHtm = template('speeding_list_temp', {list: data.list}); | |
| 224 | + $get('/speeding/pagequery' ,params, function(data){ | |
| 225 | + var bodyHtm = template('speeding_list_temp', {list: data.dataList}); | |
| 229 | 226 | $('#datatable_speeding tbody').html(bodyHtm) |
| 230 | 227 | .find('.icheck').iCheck(icheckOptions) |
| 231 | 228 | .on('ifChanged', iCheckChange); |
| 232 | - if(pagination){ | |
| 229 | + if(pagination && data.dataList.length > 0){ | |
| 233 | 230 | //重新分页 |
| 234 | 231 | initPagination = true; |
| 235 | 232 | showPagination(data); |
| ... | ... | @@ -243,8 +240,10 @@ $(function(){ |
| 243 | 240 | var lat = $(this).data('lat'); |
| 244 | 241 | var endLon = $(this).data('endlon'); |
| 245 | 242 | var endLat = $(this).data('endlat'); |
| 243 | + var lineid = $(this).data('lineid'); | |
| 244 | + var upDown = $(this).data('updown'); | |
| 246 | 245 | var storage = window.localStorage; |
| 247 | - storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat); | |
| 246 | + storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat+","+lineid+","+upDown); | |
| 248 | 247 | $.get('/pages/excep/speedingMap.html?',function (result) { |
| 249 | 248 | layer.open({ |
| 250 | 249 | type: 1, |
| ... | ... | @@ -290,25 +289,24 @@ $(function(){ |
| 290 | 289 | initPagination = false; |
| 291 | 290 | return; |
| 292 | 291 | } |
| 293 | - page = num - 1; | |
| 294 | 292 | var cells = $('tr.filter')[0].cells |
| 295 | 293 | ,params = {} |
| 296 | 294 | ,name; |
| 297 | - $.each(cells, function(i, cell){ | |
| 298 | - var items = $('input,select', cell); | |
| 299 | - for(var j = 0, item; item = items[j++];){ | |
| 300 | - name = $(item).attr('name'); | |
| 301 | - if(name){ | |
| 302 | - params[name] = $(item).val(); | |
| 303 | - } | |
| 295 | + $.each(cells, function(i, cell){ | |
| 296 | + var items = $('input,select', cell); | |
| 297 | + for(var j = 0, item; item = items[j++];){ | |
| 298 | + name = $(item).attr('name'); | |
| 299 | + if(name){ | |
| 300 | + params[name] = $(item).val(); | |
| 304 | 301 | } |
| 305 | - }); | |
| 306 | - jsDoQuery(params, false); | |
| 302 | + } | |
| 303 | + }); | |
| 304 | + page = num - 1; | |
| 305 | + jsDoQuery(params, false); | |
| 307 | 306 | } |
| 308 | 307 | }); |
| 309 | 308 | } |
| 310 | 309 | |
| 311 | - | |
| 312 | 310 | //删除 |
| 313 | 311 | $('#removeButton').on('click', function(){ |
| 314 | 312 | if($(this).attr('disabled')) |
| ... | ... | @@ -336,7 +334,6 @@ $('#nbbm').select2({ |
| 336 | 334 | xlbm:$('#line').val()}; |
| 337 | 335 | }, |
| 338 | 336 | processResults: function (data) { |
| 339 | - console.log(data); | |
| 340 | 337 | return { |
| 341 | 338 | results: data |
| 342 | 339 | }; | ... | ... |
src/main/resources/static/pages/excep/speedingMap.html
| ... | ... | @@ -40,7 +40,7 @@ $(function(){ |
| 40 | 40 | $.ajax({ |
| 41 | 41 | type: "GET", |
| 42 | 42 | async:false, |
| 43 | - url: '/speeding/findPosition', | |
| 43 | + url: '/nowspeeding/findPosition', | |
| 44 | 44 | data: {vehicle:vehicle,startdate:startdate,enddate:enddate}, |
| 45 | 45 | success: function(data){ |
| 46 | 46 | $.each(data,function(i,item){ | ... | ... |
src/main/resources/static/pages/summary/work_hours/list.html
| ... | ... | @@ -263,8 +263,8 @@ |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | //日期选择器 |
| 266 | - $('[name=rq_eq]', f).val('2017-07-25'); | |
| 267 | - flatpickr('.ct_search_form_wrap [name=rq_eq]', {"locale": "zh", maxDate: '2017-07-25', minDate: '2017-07-01'}); | |
| 266 | + $('[name=rq_eq]', f).val('2017-07-27'); | |
| 267 | + flatpickr('.ct_search_form_wrap [name=rq_eq]', {"locale": "zh", maxDate: '2017-07-27', minDate: '2017-07-01'}); | |
| 268 | 268 | |
| 269 | 269 | var comps; |
| 270 | 270 | //构建公司级联下拉框 | ... | ... |