Commit f66adf3d3ca4b9e4e254db64ff09d9c84e3dc003
Merge branch 'minhang' of
http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
Showing
57 changed files
with
537 additions
and
2963 deletions
Too many changes to show.
To preserve performance only 57 of 85 files are displayed.
src/main/java/com/bsth/controller/CarParkController.java
| ... | ... | @@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.*; |
| 15 | 15 | @RestController |
| 16 | 16 | @RequestMapping("carpark") |
| 17 | 17 | public class CarParkController extends BaseController<CarPark, Integer> { |
| 18 | - | |
| 19 | 18 | @Autowired |
| 20 | 19 | CarParkService service; |
| 21 | 20 | |
| ... | ... | @@ -26,16 +25,10 @@ public class CarParkController extends BaseController<CarPark, Integer> { |
| 26 | 25 | */ |
| 27 | 26 | @RequestMapping(value="getCarParkCode" , method = RequestMethod.GET) |
| 28 | 27 | public Map<String, Object> getStationCode() { |
| 29 | - | |
| 30 | 28 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 31 | - | |
| 32 | - resultMap.put("carParkCode", "FFFF" + GetUIDAndCode.getCarParkId()); | |
| 33 | - | |
| 29 | + resultMap.put("carParkCode", "FFFFFF" + GetUIDAndCode.getCarParkId()); | |
| 34 | 30 | return resultMap; |
| 35 | - | |
| 36 | 31 | } |
| 37 | - | |
| 38 | - | |
| 39 | 32 | /** |
| 40 | 33 | * 新增停车场信息 |
| 41 | 34 | * |
| ... | ... | @@ -53,21 +46,14 @@ public class CarParkController extends BaseController<CarPark, Integer> { |
| 53 | 46 | */ |
| 54 | 47 | @RequestMapping(value="carParkSave" , method = RequestMethod.POST) |
| 55 | 48 | public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) { |
| 56 | - | |
| 57 | 49 | map.put("createBy", ""); |
| 58 | - | |
| 59 | 50 | map.put("updateBy", ""); |
| 60 | - | |
| 61 | 51 | return service.carParkSave(map); |
| 62 | - | |
| 63 | 52 | } |
| 64 | - | |
| 65 | 53 | @RequestMapping(value = "findCarParkInfoFormId",method = RequestMethod.GET) |
| 66 | 54 | public List<Map<String, Object>> findCarParkInfoFormId(@RequestParam Map<String, Object> map) { |
| 67 | - | |
| 68 | 55 | return service.findCarParkInfoFormId(map); |
| 69 | 56 | } |
| 70 | - | |
| 71 | 57 | /** |
| 72 | 58 | * 修改停车场信息 |
| 73 | 59 | * |
| ... | ... | @@ -85,11 +71,12 @@ public class CarParkController extends BaseController<CarPark, Integer> { |
| 85 | 71 | */ |
| 86 | 72 | @RequestMapping(value="carParkUpdate" , method = RequestMethod.POST) |
| 87 | 73 | public Map<String, Object> carParkUpdate(@RequestParam Map<String, Object> map) { |
| 88 | - | |
| 89 | 74 | map.put("updateBy", ""); |
| 90 | - | |
| 91 | 75 | return service.carParkUpdate(map); |
| 92 | - | |
| 93 | 76 | } |
| 94 | 77 | |
| 78 | + @RequestMapping(value="isHaveParkCode",method=RequestMethod.GET) | |
| 79 | + public boolean isHaveParkCode(@RequestParam Map<String,Object> map) { | |
| 80 | + return service.selectTccInfoByCode(map); | |
| 81 | + } | |
| 95 | 82 | } | ... | ... |
src/main/java/com/bsth/controller/realcontrol/anomalyCheckController.java
src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
| ... | ... | @@ -101,10 +101,10 @@ public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo { |
| 101 | 101 | ps.setString(1, sch.getScheduleDateStr()); |
| 102 | 102 | ps.setString(2, sch.getXlBm()); |
| 103 | 103 | ps.setString(3, sch.getXlName()); |
| 104 | - ps.setString(4, sch.getLpName()); | |
| 105 | - ps.setInt(5, sch.getFcno()); | |
| 106 | - ps.setString(6, sch.getDfsj()); | |
| 107 | - ps.setString(7, sch.getClZbh()); | |
| 104 | + ps.setString(4, /*sch.getLpName()*/"0"); | |
| 105 | + ps.setInt(5, sch.getFcno()==null?-1:sch.getFcno()); | |
| 106 | + ps.setString(6, sch.getDfsj().replace(":", "")); | |
| 107 | + ps.setString(7, sch.getClZbh().replace("-", "")); | |
| 108 | 108 | ps.setString(8, BasicData.nbbmCompanyPlateMap.get(sch.getClZbh())); |
| 109 | 109 | ps.setString(9, bcTypeMap.containsKey(sch.getBcType()) ? bcTypeMap.get(sch.getBcType()) : sch.getBcType()); |
| 110 | 110 | ps.setString(10, sch.getZdzName()); | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| 1 | 1 | package com.bsth.data.gpsdata; |
| 2 | 2 | |
| 3 | -import com.bsth.Application; | |
| 4 | 3 | import com.bsth.data.BasicData; |
| 5 | 4 | import com.bsth.data.forecast.ForecastRealServer; |
| 6 | -import com.bsth.data.gpsdata.client.ClientApp; | |
| 7 | 5 | import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; |
| 8 | 6 | import com.bsth.data.gpsdata.thread.OfflineMonitorThread; |
| 9 | 7 | import com.bsth.data.schedule.DayOfSchedule; |
| ... | ... | @@ -17,7 +15,8 @@ import org.springframework.boot.CommandLineRunner; |
| 17 | 15 | import org.springframework.stereotype.Component; |
| 18 | 16 | |
| 19 | 17 | import java.util.*; |
| 20 | -import java.util.concurrent.TimeUnit; | |
| 18 | +import java.util.concurrent.ConcurrentHashMap; | |
| 19 | +import java.util.concurrent.ConcurrentMap; | |
| 21 | 20 | |
| 22 | 21 | /** |
| 23 | 22 | * @author PanZhao |
| ... | ... | @@ -30,7 +29,7 @@ public class GpsRealData implements CommandLineRunner { |
| 30 | 29 | |
| 31 | 30 | static Logger logger = LoggerFactory.getLogger(GpsRealData.class); |
| 32 | 31 | |
| 33 | - private static Map<String, GpsEntity> gpsMap; | |
| 32 | + private static ConcurrentMap<String, GpsEntity> gpsMap; | |
| 34 | 33 | |
| 35 | 34 | //按线路分组设备号 |
| 36 | 35 | private static TreeMultimap<String, String> lineCode2Devices; |
| ... | ... | @@ -51,22 +50,17 @@ public class GpsRealData implements CommandLineRunner { |
| 51 | 50 | * 构造函数 |
| 52 | 51 | */ |
| 53 | 52 | public GpsRealData() { |
| 54 | - gpsMap = new HashMap<>(); | |
| 53 | + gpsMap = new ConcurrentHashMap<>(); | |
| 55 | 54 | lineCode2Devices = TreeMultimap.create(); |
| 56 | 55 | } |
| 57 | 56 | |
| 58 | - @Autowired | |
| 59 | - ClientApp clientApp; | |
| 60 | 57 | @Override |
| 61 | 58 | public void run(String... arg0) throws Exception { |
| 62 | 59 | logger.info("gpsDataLoader,20,3"); |
| 63 | - //定时从网关http形式获取GPS数据 --- 已弃用,现socket客户端接入数据 | |
| 64 | - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 3, TimeUnit.SECONDS); | |
| 60 | + //http形式获取GPS数据 | |
| 61 | + //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 2, TimeUnit.SECONDS); | |
| 65 | 62 | //定时扫描掉离线 |
| 66 | - Application.mainServices.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); | |
| 67 | - | |
| 68 | - //gps 客户端 | |
| 69 | - //clientApp.init(); | |
| 63 | + //Application.mainServices.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); | |
| 70 | 64 | } |
| 71 | 65 | |
| 72 | 66 | ... | ... |
src/main/java/com/bsth/data/gpsdata/SignalStateData.java
| ... | ... | @@ -23,9 +23,9 @@ public class SignalStateData { |
| 23 | 23 | private static ArrayListMultimap<String, SignalState> listMultimap = ArrayListMultimap.create(); |
| 24 | 24 | |
| 25 | 25 | public void put(SignalState state){ |
| 26 | - listMultimap.put(state.getLineCode(), state); | |
| 26 | + //listMultimap.put(state.getLineCode(), state); | |
| 27 | 27 | //推送到客户端 |
| 28 | - sendUtils.sendSignalState(state); | |
| 28 | + //sendUtils.sendSignalState(state); | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public List<SignalState> get(String idx){ | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/GpsRealAnalyse.java
| ... | ... | @@ -11,6 +11,8 @@ import org.slf4j.LoggerFactory; |
| 11 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | 12 | import org.springframework.stereotype.Component; |
| 13 | 13 | |
| 14 | +import java.util.Collections; | |
| 15 | +import java.util.Comparator; | |
| 14 | 16 | import java.util.List; |
| 15 | 17 | import java.util.Set; |
| 16 | 18 | import java.util.concurrent.CountDownLatch; |
| ... | ... | @@ -42,25 +44,26 @@ public class GpsRealAnalyse { |
| 42 | 44 | @Autowired |
| 43 | 45 | GpsRealData gpsRealData; |
| 44 | 46 | |
| 45 | - //50个线程 | |
| 46 | - static ExecutorService threadPool = Executors.newFixedThreadPool(50); | |
| 47 | + static ExecutorService threadPool = Executors.newFixedThreadPool(100); | |
| 47 | 48 | |
| 48 | 49 | public void analyse(List<GpsEntity> list) { |
| 49 | 50 | //如果正在恢复数据 |
| 50 | 51 | if (GpsDataRecovery.run) |
| 51 | 52 | return; |
| 53 | + | |
| 54 | + long t = System.currentTimeMillis(); | |
| 52 | 55 | logger.info("analyse gps size: " + list.size()); |
| 53 | - //按车辆分组gps | |
| 56 | + //按线路分组gps | |
| 54 | 57 | ArrayListMultimap multimap = ArrayListMultimap.create(); |
| 55 | 58 | for(GpsEntity gps : list){ |
| 56 | - multimap.put(gps.getNbbm(), gps); | |
| 59 | + multimap.put(gps.getLineId(), gps); | |
| 57 | 60 | } |
| 58 | 61 | |
| 59 | 62 | Set<String> ks = multimap.keySet(); |
| 60 | 63 | CountDownLatch count = new CountDownLatch(ks.size()); |
| 61 | 64 | |
| 62 | - for(String nbbm : ks){ | |
| 63 | - threadPool.execute(new SignalHandleThread(multimap.get(nbbm), count)); | |
| 65 | + for(String lineCode : ks){ | |
| 66 | + threadPool.execute(new SignalHandleThread(multimap.get(lineCode), count)); | |
| 64 | 67 | } |
| 65 | 68 | |
| 66 | 69 | try { |
| ... | ... | @@ -70,11 +73,15 @@ public class GpsRealAnalyse { |
| 70 | 73 | //加入实时gps对照 |
| 71 | 74 | for(GpsEntity gps: list) |
| 72 | 75 | gpsRealData.put(gps); |
| 76 | + | |
| 77 | + logger.info("time , " + (System.currentTimeMillis() - t)); | |
| 73 | 78 | } catch (InterruptedException e) { |
| 74 | 79 | logger.error("", e); |
| 75 | 80 | } |
| 76 | 81 | } |
| 77 | 82 | |
| 83 | + static GpsComp comp = new GpsComp(); | |
| 84 | + | |
| 78 | 85 | public class SignalHandleThread implements Runnable { |
| 79 | 86 | |
| 80 | 87 | List<GpsEntity> list; |
| ... | ... | @@ -89,6 +96,7 @@ public class GpsRealAnalyse { |
| 89 | 96 | public void run() { |
| 90 | 97 | |
| 91 | 98 | try { |
| 99 | + Collections.sort(list, comp); | |
| 92 | 100 | for(GpsEntity gps : list){ |
| 93 | 101 | //是否有任务 |
| 94 | 102 | boolean task; |
| ... | ... | @@ -119,4 +127,12 @@ public class GpsRealAnalyse { |
| 119 | 127 | } |
| 120 | 128 | } |
| 121 | 129 | } |
| 130 | + | |
| 131 | + public static class GpsComp implements Comparator<GpsEntity> { | |
| 132 | + | |
| 133 | + @Override | |
| 134 | + public int compare(GpsEntity g1, GpsEntity g2) { | |
| 135 | + return g1.getTimestamp().compareTo(g2.getTimestamp()); | |
| 136 | + } | |
| 137 | + } | |
| 122 | 138 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/ReverseSignalHandle.java
src/main/java/com/bsth/data/gpsdata/client/ClientApp.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client; | |
| 2 | - | |
| 3 | -import com.bsth.data.gpsdata.client.pd.codec.PdMessageCodecFactory; | |
| 4 | -import com.bsth.data.gpsdata.client.pd.handler.PdClientHandler; | |
| 5 | -import com.bsth.data.gpsdata.client.pd.protocol.Pd_31_0; | |
| 6 | -import com.bsth.data.gpsdata.client.pf.codec.PfMessageCodecFactory; | |
| 7 | -import com.bsth.data.gpsdata.client.pf.handler.PfClientHandler; | |
| 8 | -import com.bsth.util.ConfigUtil; | |
| 9 | -import org.apache.mina.core.future.ConnectFuture; | |
| 10 | -import org.apache.mina.core.future.WriteFuture; | |
| 11 | -import org.apache.mina.core.session.IdleStatus; | |
| 12 | -import org.apache.mina.core.session.IoSession; | |
| 13 | -import org.apache.mina.core.session.IoSessionConfig; | |
| 14 | -import org.apache.mina.filter.codec.ProtocolCodecFilter; | |
| 15 | -import org.apache.mina.filter.logging.LogLevel; | |
| 16 | -import org.apache.mina.filter.logging.LoggingFilter; | |
| 17 | -import org.apache.mina.transport.socket.nio.NioSocketConnector; | |
| 18 | -import org.slf4j.Logger; | |
| 19 | -import org.slf4j.LoggerFactory; | |
| 20 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 21 | -import org.springframework.stereotype.Component; | |
| 22 | - | |
| 23 | -import java.net.InetSocketAddress; | |
| 24 | - | |
| 25 | -/** | |
| 26 | - * Created by panzhao on 2017/5/4. | |
| 27 | - */ | |
| 28 | -@Component | |
| 29 | -public class ClientApp { | |
| 30 | - | |
| 31 | - private static NioSocketConnector pdDataConnector; | |
| 32 | - private static NioSocketConnector pfDataConnector; | |
| 33 | - | |
| 34 | - @Autowired | |
| 35 | - private PdClientHandler pdClient; | |
| 36 | - @Autowired | |
| 37 | - private PfClientHandler pfClient; | |
| 38 | - @Autowired | |
| 39 | - GpsBeforeBuffer gpsBeforeBuffer; | |
| 40 | - | |
| 41 | - static Logger logger = LoggerFactory.getLogger(ClientApp.class); | |
| 42 | - | |
| 43 | - public static boolean dconnect(String device) { | |
| 44 | - boolean flag = false; | |
| 45 | - try { | |
| 46 | - ConnectFuture con = pdDataConnector.connect(new InetSocketAddress(ConfigUtil.get("gps.server.pd"), Integer.parseInt(ConfigUtil.get("gps.port.pd")))); | |
| 47 | - con.awaitUninterruptibly(); | |
| 48 | - IoSession session = con.getSession(); | |
| 49 | - session.setAttribute("deviceId", device); | |
| 50 | - com.bsth.data.gpsdata.client.pd.protocol.PdMessage msg = new com.bsth.data.gpsdata.client.pd.protocol.PdMessage(); | |
| 51 | - Pd_31_0 body = new Pd_31_0(); | |
| 52 | - body.setFunCode((short)0x15); | |
| 53 | - body.setLineId(0); | |
| 54 | - body.setDeviceId(device); | |
| 55 | - msg.setMessageBody(body); | |
| 56 | - msg.setVersion((short)1); | |
| 57 | - msg.setSerialNo((short)1); | |
| 58 | - msg.setCommandType((short)0x31); | |
| 59 | - byte[] bytes = msg.write(); | |
| 60 | - WriteFuture write = session.write(bytes); | |
| 61 | - write.awaitUninterruptibly(); | |
| 62 | - flag = true; | |
| 63 | - | |
| 64 | - logger.info("dconnect..."); | |
| 65 | - //SessionManager.getInstance().register(device, session); | |
| 66 | - } catch (Exception e) { | |
| 67 | - e.printStackTrace(); | |
| 68 | - } | |
| 69 | - return flag; | |
| 70 | - } | |
| 71 | - | |
| 72 | - public static boolean fconnect(String device) { | |
| 73 | - boolean flag = false; | |
| 74 | - try { | |
| 75 | - ConnectFuture con = pfDataConnector.connect(new InetSocketAddress(ConfigUtil.get("gps.server.pf"), Integer.parseInt(ConfigUtil.get("gps.port.pf")))); | |
| 76 | - con.awaitUninterruptibly(); | |
| 77 | - IoSession session = con.getSession(); | |
| 78 | - session.setAttribute("deviceId", device); | |
| 79 | - flag = true; | |
| 80 | - | |
| 81 | - logger.info("fconnect..."); | |
| 82 | - } catch (Exception e) { | |
| 83 | - e.printStackTrace(); | |
| 84 | - } | |
| 85 | - return flag; | |
| 86 | - } | |
| 87 | - | |
| 88 | - public void init() { | |
| 89 | - //exec = Executors.newFixedThreadPool(4); | |
| 90 | - //sexec.scheduleAtFixedRate(new SessionChecker(), 1, 1, TimeUnit.MINUTES); | |
| 91 | - /*******************************浦东********************************/ | |
| 92 | - pdDataConnector = new NioSocketConnector(); | |
| 93 | - | |
| 94 | - LoggingFilter log = new LoggingFilter(); | |
| 95 | - log.setMessageReceivedLogLevel(LogLevel.DEBUG); | |
| 96 | - pdDataConnector.getFilterChain().addLast("logger", log); | |
| 97 | - | |
| 98 | - pdDataConnector.getFilterChain().addLast("codec", | |
| 99 | - new ProtocolCodecFilter(new PdMessageCodecFactory())); | |
| 100 | - | |
| 101 | - IoSessionConfig config = pdDataConnector.getSessionConfig(); | |
| 102 | - | |
| 103 | - config.setReadBufferSize(4096); | |
| 104 | - config.setWriteTimeout(10000); | |
| 105 | - config.setWriterIdleTime(60000); | |
| 106 | - | |
| 107 | - config.setIdleTime(IdleStatus.BOTH_IDLE, 60); | |
| 108 | - | |
| 109 | - pdDataConnector.setHandler(pdClient); | |
| 110 | - | |
| 111 | - dconnect(ConfigUtil.get("forward.device.name")); | |
| 112 | - /*******************************浦东转发********************************/ | |
| 113 | - pfDataConnector = new NioSocketConnector(); | |
| 114 | - | |
| 115 | - LoggingFilter log1 = new LoggingFilter(); | |
| 116 | - log1.setMessageReceivedLogLevel(LogLevel.DEBUG); | |
| 117 | - pfDataConnector.getFilterChain().addLast("logger", log1); | |
| 118 | - | |
| 119 | - pfDataConnector.getFilterChain().addLast("codec", | |
| 120 | - new ProtocolCodecFilter(new PfMessageCodecFactory())); | |
| 121 | - | |
| 122 | - IoSessionConfig config1 = pfDataConnector.getSessionConfig(); | |
| 123 | - | |
| 124 | - config1.setReadBufferSize(4096); | |
| 125 | - config1.setWriteTimeout(10000); | |
| 126 | - config1.setWriterIdleTime(60000); | |
| 127 | - | |
| 128 | - config1.setIdleTime(IdleStatus.BOTH_IDLE, 60); | |
| 129 | - | |
| 130 | - pfDataConnector.setHandler(pfClient); | |
| 131 | - fconnect(ConfigUtil.get("forward.device.name")); | |
| 132 | - | |
| 133 | - | |
| 134 | - gpsBeforeBuffer.init(); | |
| 135 | - } | |
| 136 | -} | |
| 137 | 0 | \ No newline at end of file |
src/main/java/com/bsth/data/gpsdata/client/GpsBeforeBuffer.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client; | |
| 2 | - | |
| 3 | -import com.bsth.Application; | |
| 4 | -import com.bsth.data.BasicData; | |
| 5 | -import com.bsth.data.gpsdata.GpsEntity; | |
| 6 | -import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; | |
| 7 | -import com.bsth.data.gpsdata.client.pd.protocol.BasicInfo; | |
| 8 | -import org.apache.commons.lang3.StringUtils; | |
| 9 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | -import org.springframework.stereotype.Component; | |
| 11 | - | |
| 12 | -import java.util.ArrayList; | |
| 13 | -import java.util.LinkedList; | |
| 14 | -import java.util.List; | |
| 15 | -import java.util.concurrent.TimeUnit; | |
| 16 | - | |
| 17 | -/** | |
| 18 | - * 从 socket client 到 .. 的缓冲 | |
| 19 | - * Created by panzhao on 2017/5/4. | |
| 20 | - */ | |
| 21 | -@Component | |
| 22 | -public class GpsBeforeBuffer { | |
| 23 | - | |
| 24 | - static LinkedList<GpsEntity> linkedList = new LinkedList<>(); | |
| 25 | - | |
| 26 | - @Autowired | |
| 27 | - GpsHandleThread gpsHandleThread; | |
| 28 | - | |
| 29 | - public void put(BasicInfo basicInfo){ | |
| 30 | - //放弃补发数据 | |
| 31 | - byte cacheData = getCacheState(basicInfo.getServiceState()); | |
| 32 | - if(cacheData == 1) | |
| 33 | - return; | |
| 34 | - GpsEntity gps = new GpsEntity(); | |
| 35 | - | |
| 36 | - gps.setDeviceId(basicInfo.getDeviceId()); | |
| 37 | - gps.setTimestamp(basicInfo.getTimestamp()); | |
| 38 | - gps.setLat(basicInfo.getLat()); | |
| 39 | - gps.setLon(basicInfo.getLon()); | |
| 40 | - gps.setDirection((float)basicInfo.getDirection() / 10); | |
| 41 | - gps.setValid(basicInfo.getGpsValid()); | |
| 42 | - gps.setCompanyCode(basicInfo.getCompanyCode()); | |
| 43 | - gps.setStopNo(basicInfo.getStopNo()); | |
| 44 | - gps.setUpDown(basicInfo.getUpOrDown()); | |
| 45 | - gps.setSpeed((float)basicInfo.getSpeedGps() / 10); | |
| 46 | - gps.setLineId(String.valueOf(basicInfo.getLineId())); | |
| 47 | - gps.setState((int) getService(basicInfo.getServiceState())); | |
| 48 | - //没有设备号 | |
| 49 | - if (StringUtils.isBlank(gps.getDeviceId())) | |
| 50 | - return; | |
| 51 | - | |
| 52 | - String nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); | |
| 53 | - if (StringUtils.isBlank(nbbm)) | |
| 54 | - gps.setIncomplete(true); | |
| 55 | - else | |
| 56 | - gps.setNbbm(nbbm); | |
| 57 | - | |
| 58 | - linkedList.addLast(gps); | |
| 59 | - } | |
| 60 | - | |
| 61 | - public byte getCacheState(long serviceState) { | |
| 62 | - return (byte)(((serviceState & 0x00100000) == 0x00100000) ? 1 : 0); | |
| 63 | - } | |
| 64 | - | |
| 65 | - public void init(){ | |
| 66 | - Application.mainServices.scheduleWithFixedDelay(gpsHandleThread, 20 * 1000, 1100, TimeUnit.MILLISECONDS); | |
| 67 | - } | |
| 68 | - | |
| 69 | - @Component | |
| 70 | - public static class GpsHandleThread extends Thread{ | |
| 71 | - | |
| 72 | - List<GpsEntity> list; | |
| 73 | - | |
| 74 | - @Autowired | |
| 75 | - GpsRealAnalyse gpsRealAnalyse; | |
| 76 | - | |
| 77 | - @Override | |
| 78 | - public void run() { | |
| 79 | - list = new ArrayList<>(100); | |
| 80 | - | |
| 81 | - GpsEntity gps; | |
| 82 | - for(int i = 0; i < 2000; i ++){ | |
| 83 | - gps = linkedList.poll(); | |
| 84 | - if(gps == null) | |
| 85 | - break; | |
| 86 | - list.add(gps); | |
| 87 | - } | |
| 88 | - | |
| 89 | - gpsRealAnalyse.analyse(list); | |
| 90 | - } | |
| 91 | - } | |
| 92 | - | |
| 93 | - /** | |
| 94 | - * 获取运营状态 | |
| 95 | - * | |
| 96 | - * @return -1无效 0运营 1未运营 | |
| 97 | - */ | |
| 98 | - public static byte getService(long serviceState) { | |
| 99 | - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000) | |
| 100 | - return -1; | |
| 101 | - return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0); | |
| 102 | - } | |
| 103 | -} | |
| 104 | 0 | \ No newline at end of file |
src/main/java/com/bsth/data/gpsdata/client/common/ExceptionUtil.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.common; | |
| 2 | - | |
| 3 | -public class ExceptionUtil { | |
| 4 | - | |
| 5 | - public static String getTrace(Throwable e) { | |
| 6 | - StringBuilder sb = new StringBuilder(); | |
| 7 | - sb.append(e.toString()); | |
| 8 | - for (StackTraceElement ste : e.getStackTrace()) { | |
| 9 | - sb.append(ste).append("\r\n"); | |
| 10 | - } | |
| 11 | - return sb.toString(); | |
| 12 | - } | |
| 13 | -} |
src/main/java/com/bsth/data/gpsdata/client/common/Protocol2BizUtil.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.common; | |
| 2 | - | |
| 3 | -//import com.bsth.data.gpsdata.socket_client_001.pd.protocol.BasicInfo; | |
| 4 | -//import com.bsth.data.gpsdata.socket_client_001.pf.protocol.PfMessage; | |
| 5 | -//import com.bsth.data.gpsdata.socket_client_001.pf.protocol.Pf_1_0; | |
| 6 | - | |
| 7 | -import com.bsth.data.gpsdata.client.pd.protocol.BasicInfo; | |
| 8 | -import com.bsth.data.gpsdata.client.pf.protocol.PfMessage; | |
| 9 | -import com.bsth.data.gpsdata.client.pf.protocol.Pf_1_0; | |
| 10 | -import org.slf4j.Logger; | |
| 11 | -import org.slf4j.LoggerFactory; | |
| 12 | - | |
| 13 | -public class Protocol2BizUtil { | |
| 14 | - | |
| 15 | - private final static Logger log = LoggerFactory.getLogger(Protocol2BizUtil.class); | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * 从协议数据中获得基本数据 | |
| 19 | - */ | |
| 20 | - public static BasicInfo getBasicInfoFromMsg(PfMessage msg) { | |
| 21 | - if (msg == null) return null; | |
| 22 | - BasicInfo info = null; | |
| 23 | - if (msg.getCommandType() == 0x01) { | |
| 24 | - Pf_1_0 pf_1_0 = (Pf_1_0)msg.getMessageBody(); | |
| 25 | - info = new BasicInfo(); | |
| 26 | - info.setLineId(pf_1_0.getXldm()); | |
| 27 | - info.setDeviceId(pf_1_0.getMtd()); | |
| 28 | - info.setDriverEmpNo(Integer.parseInt(pf_1_0.getDriver().trim())); | |
| 29 | - info.setCarparkNo(pf_1_0.getTccbh()); | |
| 30 | - info.setStopNo(pf_1_0.getZdbh()); | |
| 31 | - double lon = pf_1_0.getLon()/1000000, lat = pf_1_0.getLat()/1000000; | |
| 32 | - info.setCarLon(((long)lon) * 1000000 + (long)((lon - (long)lon) * 600000)); | |
| 33 | - info.setCarLat(((int)lat) * 1000000 + (int)((lat - (int)lat) * 600000)); | |
| 34 | - info.setTimestamp(pf_1_0.getFssj().getTime()); | |
| 35 | - info.setSpeedGps((short)pf_1_0.getSpeed()); | |
| 36 | - info.setSpeedSensor((short)(pf_1_0.getSpeed())); | |
| 37 | - info.setDirection((short)(pf_1_0.getFx())); | |
| 38 | - info.setServiceState(0); | |
| 39 | - info.setService(pf_1_0.getYyzt() == 0 ? true : false); | |
| 40 | - info.setUpOrDown(pf_1_0.getSxxzt() == 0 ? true : false); | |
| 41 | - | |
| 42 | - info.setLon(Float.parseFloat(String.valueOf(lon))); | |
| 43 | - info.setLat(Float.parseFloat(String.valueOf(lat))); | |
| 44 | - } | |
| 45 | - | |
| 46 | - return info; | |
| 47 | - } | |
| 48 | -} |
src/main/java/com/bsth/data/gpsdata/client/common/ThreadLocalDateUtil.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.common; | |
| 2 | - | |
| 3 | -import java.text.DateFormat; | |
| 4 | -import java.text.ParseException; | |
| 5 | -import java.text.SimpleDateFormat; | |
| 6 | -import java.util.Date; | |
| 7 | - | |
| 8 | -public class ThreadLocalDateUtil { | |
| 9 | - private static final String date_format = "yyyyMMddHHmmss"; | |
| 10 | - private static ThreadLocal<DateFormat> threadLocal = new ThreadLocal<DateFormat>(); | |
| 11 | - | |
| 12 | - public static DateFormat getDateFormat() | |
| 13 | - { | |
| 14 | - DateFormat df = threadLocal.get(); | |
| 15 | - if(df==null){ | |
| 16 | - df = new SimpleDateFormat(date_format); | |
| 17 | - threadLocal.set(df); | |
| 18 | - } | |
| 19 | - return df; | |
| 20 | - } | |
| 21 | - | |
| 22 | - public static String formatDate(Date date) throws ParseException { | |
| 23 | - return getDateFormat().format(date); | |
| 24 | - } | |
| 25 | - | |
| 26 | - public static Date parse(String strDate) throws ParseException { | |
| 27 | - return getDateFormat().parse(strDate); | |
| 28 | - } | |
| 29 | -} |
src/main/java/com/bsth/data/gpsdata/client/msg/IMessage.java deleted
100644 → 0
src/main/java/com/bsth/data/gpsdata/client/msg/IMessageBody.java deleted
100644 → 0
src/main/java/com/bsth/data/gpsdata/client/msg/IMessageIO.java deleted
100644 → 0
src/main/java/com/bsth/data/gpsdata/client/pd/codec/MessageDecoder.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pd.codec; | |
| 2 | - | |
| 3 | -import com.bsth.data.gpsdata.client.pd.protocol.PdMessage; | |
| 4 | -import org.apache.mina.core.buffer.IoBuffer; | |
| 5 | -import org.apache.mina.core.session.IoSession; | |
| 6 | -import org.apache.mina.filter.codec.CumulativeProtocolDecoder; | |
| 7 | -import org.apache.mina.filter.codec.ProtocolDecoderOutput; | |
| 8 | - | |
| 9 | - | |
| 10 | -public class MessageDecoder extends CumulativeProtocolDecoder { | |
| 11 | - | |
| 12 | - @Override | |
| 13 | - protected boolean doDecode(IoSession session, IoBuffer in, | |
| 14 | - ProtocolDecoderOutput out) throws Exception { | |
| 15 | - // TODO Auto-generated method stub | |
| 16 | - while (in.remaining() > 3) { | |
| 17 | - in.mark(); | |
| 18 | - byte head1 = in.get(), head2 = in.get(), lenh = in.get(), lenl = in.get(); | |
| 19 | - int len = ((lenh & 0xff) << 8) + (lenl & 0xff); | |
| 20 | - if ((head1 & 0xff) == 0xfa && (head2 & 0xff) == 0xf5) { | |
| 21 | - if (in.remaining() > len) { | |
| 22 | - byte[] bytes = new byte[len + 1]; | |
| 23 | - in.get(bytes); | |
| 24 | - PdMessage msg = new PdMessage(); | |
| 25 | - msg.read(bytes); | |
| 26 | - out.write(msg); | |
| 27 | - /*if ("true".equals(ConfigUtil.getProperty("protocolup", "true"))) { | |
| 28 | - UpProtocolDataService.getInstance().write(new byte[]{ head1, head2, lenh, lenl }); | |
| 29 | - UpProtocolDataService.getInstance().write(bytes); | |
| 30 | - }*/ | |
| 31 | - } else { | |
| 32 | - in.reset(); | |
| 33 | - return false; | |
| 34 | - } | |
| 35 | - } | |
| 36 | - } | |
| 37 | - return false; | |
| 38 | - } | |
| 39 | - | |
| 40 | - /*private static String toHexString(byte[] bytes) { | |
| 41 | - StringBuilder sb = new StringBuilder(); | |
| 42 | - for (byte b : bytes) { | |
| 43 | - sb.append(Integer.toHexString(b & 0xff) + "|"); | |
| 44 | - } | |
| 45 | - return sb.toString(); | |
| 46 | - }*/ | |
| 47 | -} |
src/main/java/com/bsth/data/gpsdata/client/pd/codec/MessageEncoder.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pd.codec; | |
| 2 | - | |
| 3 | -import org.apache.mina.core.buffer.IoBuffer; | |
| 4 | -import org.apache.mina.core.session.IoSession; | |
| 5 | -import org.apache.mina.filter.codec.ProtocolEncoderAdapter; | |
| 6 | -import org.apache.mina.filter.codec.ProtocolEncoderOutput; | |
| 7 | - | |
| 8 | - | |
| 9 | -public class MessageEncoder extends ProtocolEncoderAdapter { | |
| 10 | - | |
| 11 | - @Override | |
| 12 | - public void encode(IoSession session, Object message, | |
| 13 | - ProtocolEncoderOutput out) throws Exception { | |
| 14 | - // TODO Auto-generated method stub | |
| 15 | - IoBuffer buf = IoBuffer.allocate(1024).setAutoExpand(true); | |
| 16 | - buf.put((byte[])message); | |
| 17 | - buf.flip(); | |
| 18 | - out.write(buf); | |
| 19 | - /*if ("true".equals(ConfigUtil.getProperty("protocoldown", "true"))) { | |
| 20 | - DownProtocolDataService.getInstance().write((byte[])message); | |
| 21 | - }*/ | |
| 22 | - } | |
| 23 | - | |
| 24 | -} |
src/main/java/com/bsth/data/gpsdata/client/pd/codec/PdMessageCodecFactory.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pd.codec; | |
| 2 | - | |
| 3 | -import org.apache.mina.core.session.IoSession; | |
| 4 | -import org.apache.mina.filter.codec.ProtocolCodecFactory; | |
| 5 | -import org.apache.mina.filter.codec.ProtocolDecoder; | |
| 6 | -import org.apache.mina.filter.codec.ProtocolEncoder; | |
| 7 | - | |
| 8 | -public class PdMessageCodecFactory implements ProtocolCodecFactory { | |
| 9 | - | |
| 10 | - private ProtocolEncoder encoder; | |
| 11 | - private ProtocolDecoder decoder; | |
| 12 | - | |
| 13 | - public PdMessageCodecFactory() { | |
| 14 | - encoder = new MessageEncoder(); | |
| 15 | - decoder = new MessageDecoder(); | |
| 16 | - } | |
| 17 | - | |
| 18 | - @Override | |
| 19 | - public ProtocolEncoder getEncoder(IoSession session) throws Exception { | |
| 20 | - // TODO Auto-generated method stub | |
| 21 | - return encoder; | |
| 22 | - } | |
| 23 | - | |
| 24 | - @Override | |
| 25 | - public ProtocolDecoder getDecoder(IoSession session) throws Exception { | |
| 26 | - // TODO Auto-generated method stub | |
| 27 | - return decoder; | |
| 28 | - } | |
| 29 | - | |
| 30 | -} |
src/main/java/com/bsth/data/gpsdata/client/pd/common/ConvertUtil.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pd.common; | |
| 2 | - | |
| 3 | -import com.bsth.data.gpsdata.client.common.ThreadLocalDateUtil; | |
| 4 | -import org.slf4j.Logger; | |
| 5 | -import org.slf4j.LoggerFactory; | |
| 6 | - | |
| 7 | -import java.text.ParseException; | |
| 8 | -import java.util.Arrays; | |
| 9 | -import java.util.Calendar; | |
| 10 | -import java.util.Date; | |
| 11 | - | |
| 12 | - | |
| 13 | -public class ConvertUtil { | |
| 14 | - | |
| 15 | - private final static Logger log = LoggerFactory.getLogger(ConvertUtil.class); | |
| 16 | - | |
| 17 | - public static int bcd2int(byte[] bytes, int start, int len) { | |
| 18 | - if (len > 4 || len == 0) | |
| 19 | - throw new IllegalArgumentException("bcd2int 字节数不符合要求"); | |
| 20 | - String temp = ""; | |
| 21 | - for (int i = 0;i < len;i++) { | |
| 22 | - int val = bytes[start + i] & 0xff; | |
| 23 | - if (val < 10) temp += 0; | |
| 24 | - temp += Integer.toHexString(val); | |
| 25 | - } | |
| 26 | - return Integer.parseInt(temp); | |
| 27 | - } | |
| 28 | - | |
| 29 | - public static byte[] int2bcd(int val, int len) { | |
| 30 | - if (len > 4 || len == 0) | |
| 31 | - throw new IllegalArgumentException("int2bcd 字节数不符合要求"); | |
| 32 | - byte[] result = new byte[len]; | |
| 33 | - for (int i = len - 1;i > -1;i--) { | |
| 34 | - result[i] = (byte)Integer.parseInt(val%100 + "", 16); | |
| 35 | - val = val/100; | |
| 36 | - } | |
| 37 | - return result; | |
| 38 | - } | |
| 39 | - | |
| 40 | - public static long bcd2long(byte[] bytes, int start, int len) { | |
| 41 | - if (len > 8 || len == 0) | |
| 42 | - throw new IllegalArgumentException("bcd2long 字节数不符合要求"); | |
| 43 | - String temp = ""; | |
| 44 | - for (int i = 0;i < len;i++) { | |
| 45 | - int val = bytes[start + i] & 0xff; | |
| 46 | - if (val < 10) temp += 0; | |
| 47 | - temp += Integer.toHexString(val); | |
| 48 | - } | |
| 49 | - return Long.parseLong(temp); | |
| 50 | - } | |
| 51 | - | |
| 52 | - public static byte[] long2bcd(long val, int len) { | |
| 53 | - if (len > 8 || len == 0) | |
| 54 | - throw new IllegalArgumentException("long2bcd 字节数不符合要求"); | |
| 55 | - byte[] result = new byte[len]; | |
| 56 | - for (int i = len - 1;i > -1;i--) { | |
| 57 | - result[i] = (byte)Integer.parseInt(val%100 + "", 16); | |
| 58 | - val = val/100; | |
| 59 | - } | |
| 60 | - return result; | |
| 61 | - } | |
| 62 | - | |
| 63 | - public static String ascii2string(byte[] bytes, int start, int len) { | |
| 64 | - return new String(Arrays.copyOfRange(bytes, start, start + len)); | |
| 65 | - } | |
| 66 | - | |
| 67 | - public static byte[] string2ascii(String val, int len) { | |
| 68 | - byte[] result = new byte[len]; | |
| 69 | - byte[] bytes = val.getBytes(); | |
| 70 | - if (bytes.length > len && len != 0) | |
| 71 | - throw new IllegalArgumentException("string2ascii 参数不符合要求"); | |
| 72 | - if (len != 0) | |
| 73 | - for (int i = 0, l = bytes.length;i < l;i++) result[i] = bytes[i]; | |
| 74 | - else return bytes; | |
| 75 | - return result; | |
| 76 | - } | |
| 77 | - | |
| 78 | - public static long bcd2timestamp(byte[] bytes, int start) { | |
| 79 | - String temp = "20"; | |
| 80 | - for (int i = 0;i < 6;i++) { | |
| 81 | - int val = bytes[start + i] & 0xff; | |
| 82 | - if (val < 10) temp += 0; | |
| 83 | - temp += Integer.toHexString(val); | |
| 84 | - } | |
| 85 | - Date date = null; | |
| 86 | - try { | |
| 87 | - date = ThreadLocalDateUtil.parse(temp); | |
| 88 | - } catch (ParseException e) { | |
| 89 | - log.error("协议中时间数据异常:" + temp); | |
| 90 | - } | |
| 91 | - if (date != null) return date.getTime(); | |
| 92 | - return -1; | |
| 93 | - } | |
| 94 | - | |
| 95 | - public static byte[] timestamp2bcd(long val) { | |
| 96 | - byte[] result = new byte[6]; | |
| 97 | - Calendar c = Calendar.getInstance(); | |
| 98 | - c.setTime(new Date(val)); | |
| 99 | - result[0] = (byte)(Integer.parseInt(c.get(Calendar.YEAR)%100 + "", 16)); | |
| 100 | - result[1] = (byte)(Integer.parseInt(c.get(Calendar.MONTH) + 1 + "", 16)); | |
| 101 | - result[2] = (byte)Integer.parseInt(c.get(Calendar.DAY_OF_MONTH) + "", 16); | |
| 102 | - result[3] = (byte)Integer.parseInt(c.get(Calendar.HOUR_OF_DAY) + "", 16); | |
| 103 | - result[4] = (byte)Integer.parseInt(c.get(Calendar.MINUTE) + "", 16); | |
| 104 | - result[5] = (byte)Integer.parseInt(c.get(Calendar.SECOND) + "", 16); | |
| 105 | - return result; | |
| 106 | - } | |
| 107 | - | |
| 108 | - public static byte[] int2hex(int val, int len) { | |
| 109 | - if (len < 1) | |
| 110 | - throw new IllegalArgumentException("int2hex len 参数不符合要求"); | |
| 111 | - byte[] result = new byte[len]; | |
| 112 | - for (int i = 0;i < len;i++) { | |
| 113 | - result[len - 1 - i] = (byte)(val%100); | |
| 114 | - val = val/100; | |
| 115 | - } | |
| 116 | - | |
| 117 | - return result; | |
| 118 | - } | |
| 119 | - | |
| 120 | - public static int bytes2int(byte[] bytes, int start, int len) { | |
| 121 | - int val = 0; | |
| 122 | - for (int i = 0; i < len; i++) { | |
| 123 | - int shift = (len - 1 - i) * 8; | |
| 124 | - val += (bytes[start + i] & 0x0000FF) << shift; | |
| 125 | - } | |
| 126 | - | |
| 127 | - return val; | |
| 128 | - } | |
| 129 | -} |
src/main/java/com/bsth/data/gpsdata/client/pd/handler/PdClientHandler.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pd.handler; | |
| 2 | - | |
| 3 | -import com.bsth.data.gpsdata.client.ClientApp; | |
| 4 | -import com.bsth.data.gpsdata.client.GpsBeforeBuffer; | |
| 5 | -import com.bsth.data.gpsdata.client.msg.IMessageBody; | |
| 6 | -import com.bsth.data.gpsdata.client.pd.protocol.PdMessage; | |
| 7 | -import com.bsth.data.gpsdata.client.pd.protocol.Pd_41_0; | |
| 8 | -import com.bsth.data.gpsdata.client.pd.protocol.Pd_42_0; | |
| 9 | -import org.apache.mina.core.service.IoHandlerAdapter; | |
| 10 | -import org.apache.mina.core.session.IdleStatus; | |
| 11 | -import org.apache.mina.core.session.IoSession; | |
| 12 | -import org.apache.mina.transport.socket.SocketSessionConfig; | |
| 13 | -import org.slf4j.Logger; | |
| 14 | -import org.slf4j.LoggerFactory; | |
| 15 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 16 | -import org.springframework.stereotype.Service; | |
| 17 | - | |
| 18 | -import java.io.IOException; | |
| 19 | - | |
| 20 | - | |
| 21 | -@Service | |
| 22 | -public class PdClientHandler extends IoHandlerAdapter{ | |
| 23 | - | |
| 24 | - private final static Logger log = LoggerFactory.getLogger(PdClientHandler.class); | |
| 25 | - | |
| 26 | - @Autowired | |
| 27 | - GpsBeforeBuffer gpsBeforeBuffer; | |
| 28 | - | |
| 29 | - @Override | |
| 30 | - public void sessionCreated(IoSession session) throws Exception { | |
| 31 | - SocketSessionConfig cfg = (SocketSessionConfig) session.getConfig(); | |
| 32 | - cfg.setSoLinger(0); | |
| 33 | - } | |
| 34 | - | |
| 35 | - @Override | |
| 36 | - public void sessionOpened(IoSession session) throws Exception { | |
| 37 | - | |
| 38 | - } | |
| 39 | - | |
| 40 | - @Override | |
| 41 | - public void sessionClosed(IoSession session) throws Exception { | |
| 42 | - String deviceId = (String)session.getAttribute("deviceId"); | |
| 43 | - if (deviceId != null) { | |
| 44 | - //SessionManager.getInstance().unregister(deviceId); | |
| 45 | - log.info("连网关设备编号:" + deviceId + "断开连接"); | |
| 46 | - log.warn(deviceId + "网关设备注销"); | |
| 47 | - | |
| 48 | - ClientApp.dconnect(deviceId); | |
| 49 | - } else { | |
| 50 | - log.info("连网关设备编号:" + deviceId + "断开连接"); | |
| 51 | - } | |
| 52 | - } | |
| 53 | - | |
| 54 | - @Override | |
| 55 | - public void sessionIdle(IoSession session, IdleStatus status) throws Exception { | |
| 56 | - session.closeNow(); | |
| 57 | - } | |
| 58 | - | |
| 59 | - @Override | |
| 60 | - public void exceptionCaught(IoSession session, Throwable cause) throws Exception { | |
| 61 | - if (cause instanceof IOException) session.closeNow(); | |
| 62 | - log.error("PdClientHandler异常:", cause); | |
| 63 | - } | |
| 64 | - | |
| 65 | - @Override | |
| 66 | - public void messageReceived(IoSession session, Object message) throws Exception { | |
| 67 | - PdMessage msg = (PdMessage)message; | |
| 68 | - IMessageBody body = msg.getMessageBody(); | |
| 69 | - if (body != null) { | |
| 70 | - //String deviceId = body.getDeviceId(); | |
| 71 | - if (0x31 == msg.getCommandType()) { | |
| 72 | - //IoSession regSession = SessionManager.getInstance().getSession(deviceId); | |
| 73 | - //if (regSession != null) regSession.closeNow(); | |
| 74 | - //SessionManager.getInstance().register(deviceId, session); | |
| 75 | - log.debug("设备编号:" + body.getDeviceId() + "建立连接"); | |
| 76 | - } | |
| 77 | - else if(0x41 == msg.getCommandType()){ | |
| 78 | - Pd_41_0 pd41 = (Pd_41_0)msg.getMessageBody(); | |
| 79 | - gpsBeforeBuffer.put(pd41.getInfo()); | |
| 80 | - } | |
| 81 | - else if(0x42 == msg.getCommandType()){ | |
| 82 | - Pd_42_0 pd42 = (Pd_42_0)msg.getMessageBody(); | |
| 83 | - gpsBeforeBuffer.put(pd42.getInfo()); | |
| 84 | - } | |
| 85 | - } | |
| 86 | - } | |
| 87 | - | |
| 88 | - @Override | |
| 89 | - public void messageSent(IoSession session, Object message) throws Exception { | |
| 90 | - | |
| 91 | - } | |
| 92 | -} |
src/main/java/com/bsth/data/gpsdata/client/pd/protocol/BasicInfo.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pd.protocol; | |
| 2 | - | |
| 3 | - | |
| 4 | -import com.bsth.data.gpsdata.client.pd.common.ConvertUtil; | |
| 5 | - | |
| 6 | -import java.nio.ByteBuffer; | |
| 7 | -import java.util.Date; | |
| 8 | - | |
| 9 | - | |
| 10 | -public class BasicInfo { | |
| 11 | - | |
| 12 | - private int cityCode; | |
| 13 | - private short industryCode; | |
| 14 | - private short companyCode; | |
| 15 | - private String deviceId; | |
| 16 | - private int lineId; | |
| 17 | - private int driverEmpNo; | |
| 18 | - private short carparkSerialNo; | |
| 19 | - private String carparkNo; | |
| 20 | - private short stopSerialNo; | |
| 21 | - private String stopNo; | |
| 22 | - // 经度 bcd 5 0121245333表示经度为121度24.5333分 | |
| 23 | - private long carLon; | |
| 24 | - // 维度 | |
| 25 | - private int carLat; | |
| 26 | - private long timestamp; | |
| 27 | - // 速度(传感器)bcd 2 保留一位小数 km/h | |
| 28 | - private short speedSensor; | |
| 29 | - // 速度(gps)bcd 2 保留一位小数 km/h | |
| 30 | - private short speedGps; | |
| 31 | - // 方向 bcd 2 0-359.5 保留一位小数 | |
| 32 | - private short direction; | |
| 33 | - // 车内温度 bcd 2 第一字节为符号 00为正 01为负 后一字节为温度 | |
| 34 | - private short inTemp; | |
| 35 | - // 营运状态 hex 4高位在前 | |
| 36 | - // 第一字节位 7 GPS有/无效|6 场外/内|5 起终点站外/内|4 上/下行|3 已知/未知|2站外/站内|1 营运/非营运|0 在线路上/不在 | |
| 37 | - // 7=1时其它位无效|0=1时3,4,5无效 第二字节6,7无效|3=1时2,4无效 第二字节6,7无效 | |
| 38 | - // 第二字节位 7 非/标杆点|6 非/中途校时点|5 点/熄火|4 实时/缓存数据|3 门开/关|2 预留|1 非/包车|0预留 | |
| 39 | - // 1=1时 第一字节0-6无效 6,7无效 | |
| 40 | - // 后两个字节保留 | |
| 41 | - private long serviceState; | |
| 42 | - // 调控状态 | |
| 43 | - private long controlState; | |
| 44 | - // 累计里程 km 保留两位小数 | |
| 45 | - private int totalMiles; | |
| 46 | - // 水温 | |
| 47 | - private byte waterTemp; | |
| 48 | - // 油耗 (第一个字节 + 第二个字节/10)升/百公里 | |
| 49 | - private int oilConsumption; | |
| 50 | - // 发动机转速 100转/秒 | |
| 51 | - private int engineSpeed; | |
| 52 | - private float lon; | |
| 53 | - private float lat; | |
| 54 | - | |
| 55 | - private boolean inOutStopFlag = false; | |
| 56 | - | |
| 57 | - public void read(byte[] bytes, int idx) { | |
| 58 | - // TODO Auto-generated method stub | |
| 59 | - ByteBuffer buf = ByteBuffer.wrap(bytes); | |
| 60 | - cityCode = ConvertUtil.bcd2int(bytes, idx, 3); idx += 3; | |
| 61 | - industryCode = (short)(bytes[idx] & 0xff); idx++; | |
| 62 | - companyCode = (short)(bytes[idx] & 0xff); idx++; | |
| 63 | - deviceId = ConvertUtil.ascii2string(bytes, idx, 8); idx += 8; | |
| 64 | - lineId = ConvertUtil.bcd2int(bytes, idx, 3); idx += 3; | |
| 65 | - driverEmpNo = ConvertUtil.bcd2int(bytes, idx, 4); idx +=4; | |
| 66 | - carparkSerialNo = (short)(bytes[idx] & 0xff); idx++; | |
| 67 | - carparkNo = ConvertUtil.ascii2string(bytes, idx, 8); idx += 8; | |
| 68 | - stopSerialNo = (short)(bytes[idx] & 0xff); idx++; | |
| 69 | - stopNo = ConvertUtil.ascii2string(bytes, idx, 8).trim(); idx += 8; | |
| 70 | - carLon = ConvertUtil.bcd2long(bytes, idx, 5); lon = (int)(carLon/1000000) + carLon%1000000/600000f; idx += 5; | |
| 71 | - carLat = ConvertUtil.bcd2int(bytes, idx, 4); lat = carLat/1000000 + carLat%1000000/600000f; idx += 4; | |
| 72 | - timestamp = ConvertUtil.bcd2timestamp(bytes, idx); idx += 6; | |
| 73 | - speedSensor = (short)ConvertUtil.bcd2int(bytes, idx, 2); idx += 2; | |
| 74 | - speedGps = (short)ConvertUtil.bcd2int(bytes, idx, 2); idx += 2; | |
| 75 | - direction = (short)(ConvertUtil.bcd2int(bytes, idx, 2)); idx += 2; | |
| 76 | - inTemp = (short)ConvertUtil.bcd2int(bytes, idx, 2); idx += 2; | |
| 77 | - serviceState = buf.getInt(idx) & 0xffffffff; idx += 4; | |
| 78 | - controlState = buf.getInt(idx) & 0xffffffff; idx += 4; | |
| 79 | - totalMiles = ConvertUtil.bcd2int(bytes, idx, 4); idx += 4; | |
| 80 | - waterTemp = bytes[idx]; idx++; | |
| 81 | - oilConsumption = ConvertUtil.bcd2int(bytes, idx, 4); idx += 4; | |
| 82 | - engineSpeed = buf.getShort(idx) & 0xffff; idx += 2; | |
| 83 | - } | |
| 84 | - | |
| 85 | - public byte[] write() { | |
| 86 | - ByteBuffer buf = ByteBuffer.allocate(80); | |
| 87 | - buf.put(ConvertUtil.int2bcd(cityCode, 3)); | |
| 88 | - buf.put((byte)industryCode); | |
| 89 | - buf.put((byte)companyCode); | |
| 90 | - buf.put(ConvertUtil.string2ascii(deviceId, 8)); | |
| 91 | - buf.put(ConvertUtil.int2bcd(lineId, 3)); | |
| 92 | - buf.put(ConvertUtil.int2bcd(driverEmpNo, 4)); | |
| 93 | - buf.put((byte)carparkSerialNo); | |
| 94 | - buf.put(ConvertUtil.string2ascii(carparkNo, 8)); | |
| 95 | - buf.put((byte)stopSerialNo); | |
| 96 | - buf.put(ConvertUtil.string2ascii(stopNo, 8)); | |
| 97 | - buf.put(ConvertUtil.long2bcd(carLon, 5)); | |
| 98 | - buf.put(ConvertUtil.long2bcd(carLat, 4)); | |
| 99 | - buf.put(ConvertUtil.timestamp2bcd(timestamp)); | |
| 100 | - buf.put(ConvertUtil.int2bcd(speedSensor, 2)); | |
| 101 | - buf.put(ConvertUtil.int2bcd(speedGps, 2)); | |
| 102 | - buf.put(ConvertUtil.int2bcd(direction, 2)); | |
| 103 | - buf.put(ConvertUtil.int2bcd(inTemp, 2)); | |
| 104 | - buf.putInt((int)serviceState); | |
| 105 | - buf.putInt((int)controlState); | |
| 106 | - buf.put(ConvertUtil.int2bcd(totalMiles, 4)); | |
| 107 | - buf.put(waterTemp); | |
| 108 | - buf.put(ConvertUtil.int2bcd(oilConsumption, 2)); | |
| 109 | - buf.putShort((short)engineSpeed); | |
| 110 | - | |
| 111 | - return buf.array(); | |
| 112 | - } | |
| 113 | - | |
| 114 | - public String getDeviceId() { | |
| 115 | - // TODO Auto-generated method stub | |
| 116 | - return deviceId; | |
| 117 | - } | |
| 118 | - | |
| 119 | - public int getCityCode() { | |
| 120 | - return cityCode; | |
| 121 | - } | |
| 122 | - | |
| 123 | - public short getIndustryCode() { | |
| 124 | - return industryCode; | |
| 125 | - } | |
| 126 | - | |
| 127 | - public short getCompanyCode() { | |
| 128 | - return companyCode; | |
| 129 | - } | |
| 130 | - | |
| 131 | - public int getLineId() { | |
| 132 | - return lineId; | |
| 133 | - } | |
| 134 | - | |
| 135 | - public int getDriverEmpNo() { | |
| 136 | - return driverEmpNo; | |
| 137 | - } | |
| 138 | - | |
| 139 | - public short getCarparkSerialNo() { | |
| 140 | - return carparkSerialNo; | |
| 141 | - } | |
| 142 | - | |
| 143 | - public String getCarparkNo() { | |
| 144 | - return carparkNo; | |
| 145 | - } | |
| 146 | - | |
| 147 | - public short getStopSerialNo() { | |
| 148 | - return stopSerialNo; | |
| 149 | - } | |
| 150 | - | |
| 151 | - public String getStopNo() { | |
| 152 | - return stopNo; | |
| 153 | - } | |
| 154 | - | |
| 155 | - public long getCarLon() { | |
| 156 | - return carLon; | |
| 157 | - } | |
| 158 | - | |
| 159 | - public int getCarLat() { | |
| 160 | - return carLat; | |
| 161 | - } | |
| 162 | - | |
| 163 | - public long getTimestamp() { | |
| 164 | - return timestamp; | |
| 165 | - } | |
| 166 | - | |
| 167 | - public short getSpeedSensor() { | |
| 168 | - return speedSensor; | |
| 169 | - } | |
| 170 | - | |
| 171 | - public short getSpeedGps() { | |
| 172 | - return speedGps; | |
| 173 | - } | |
| 174 | - | |
| 175 | - public short getDirection() { | |
| 176 | - return direction; | |
| 177 | - } | |
| 178 | - | |
| 179 | - public short getInTemp() { | |
| 180 | - return inTemp; | |
| 181 | - } | |
| 182 | - | |
| 183 | - public long getServiceState() { | |
| 184 | - return serviceState; | |
| 185 | - } | |
| 186 | - | |
| 187 | - public long getControlState() { | |
| 188 | - return controlState; | |
| 189 | - } | |
| 190 | - | |
| 191 | - public int getTotalMiles() { | |
| 192 | - return totalMiles; | |
| 193 | - } | |
| 194 | - | |
| 195 | - public byte getWaterTemp() { | |
| 196 | - return waterTemp; | |
| 197 | - } | |
| 198 | - | |
| 199 | - public int getOilConsumption() { | |
| 200 | - return oilConsumption; | |
| 201 | - } | |
| 202 | - | |
| 203 | - public int getEngineSpeed() { | |
| 204 | - return engineSpeed; | |
| 205 | - } | |
| 206 | - | |
| 207 | - public float getLon() { | |
| 208 | - return lon; | |
| 209 | - } | |
| 210 | - | |
| 211 | - public void setLon(float lon) { | |
| 212 | - this.lon = lon; | |
| 213 | - } | |
| 214 | - | |
| 215 | - public float getLat() { | |
| 216 | - return lat; | |
| 217 | - } | |
| 218 | - | |
| 219 | - public void setLat(float lat) { | |
| 220 | - this.lat = lat; | |
| 221 | - } | |
| 222 | - | |
| 223 | - public void setStopNo(String stopNo) { | |
| 224 | - this.stopNo = stopNo; | |
| 225 | - } | |
| 226 | - | |
| 227 | - public byte getGpsValid() { | |
| 228 | - return (byte)(((serviceState & 0x80000000) == 0x80000000) ? 1 : 0); | |
| 229 | - } | |
| 230 | - | |
| 231 | - /** | |
| 232 | - * 获取车辆在场外/内 | |
| 233 | - * @return -1无效 0场外1场内 | |
| 234 | - */ | |
| 235 | - public byte getInOrOutCarpark() { | |
| 236 | - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000 | |
| 237 | - || (serviceState & 0x01000000) == 0x01000000) return -1; | |
| 238 | - return (byte)(((serviceState & 0x40000000) == 0x40000000) ? 1 : 0); | |
| 239 | - } | |
| 240 | - | |
| 241 | - public void setInOrOutCarpark(boolean inOutFlag) { | |
| 242 | - if (inOutFlag) serviceState |= 0x40000000; | |
| 243 | - else serviceState &= 0xbfffffff; | |
| 244 | - } | |
| 245 | - | |
| 246 | - /** | |
| 247 | - * 获取车辆在起终点站外/内 | |
| 248 | - * @return -1无效 0起终点站外1起终点站内 | |
| 249 | - */ | |
| 250 | - public byte getInOrOutStartEnd() { | |
| 251 | - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000 | |
| 252 | - || (serviceState & 0x01000000) == 0x01000000) return -1; | |
| 253 | - return (byte)(((serviceState & 0x20000000) == 0x20000000) ? 1 : 0); | |
| 254 | - } | |
| 255 | - | |
| 256 | - /** | |
| 257 | - * 获取车辆线路上下行 | |
| 258 | - * @return -1无效 0上行 1下行 | |
| 259 | - */ | |
| 260 | - public byte getUpOrDown() { | |
| 261 | - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000 | |
| 262 | - || (serviceState & 0x01000000) == 0x01000000 | |
| 263 | - || (serviceState & 0x08000000) == 0x08000000) return -1; | |
| 264 | - return (byte)(((serviceState & 0x10000000) == 0x10000000) ? 1 : 0); | |
| 265 | - } | |
| 266 | - | |
| 267 | - public void setUpOrDown(boolean upOrDown) { | |
| 268 | - if (!upOrDown) serviceState |= 0x10000000; | |
| 269 | - else serviceState &= 0xefffffff; | |
| 270 | - } | |
| 271 | - | |
| 272 | - /** | |
| 273 | - * 获取车辆在站外/内 | |
| 274 | - * @return -1无效 0站外 1站内 | |
| 275 | - */ | |
| 276 | - public byte getInOrOutStop() { | |
| 277 | - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000 | |
| 278 | - || (serviceState & 0x01000000) == 0x01000000 | |
| 279 | - || (serviceState & 0x08000000) == 0x08000000) return -1; | |
| 280 | - return (byte)(((serviceState & 0x04000000) == 0x04000000) ? 1 : 0); | |
| 281 | - } | |
| 282 | - | |
| 283 | - public void setInOrOutStop(boolean isInOrOutStop) { | |
| 284 | - inOutStopFlag = true; | |
| 285 | - if (isInOrOutStop) serviceState |= 0x04000000; | |
| 286 | - else serviceState &= 0xfbffffff; | |
| 287 | - } | |
| 288 | - | |
| 289 | - /** | |
| 290 | - * 获取运营状态 | |
| 291 | - * @return -1无效 0运营 1未运营 | |
| 292 | - */ | |
| 293 | - public byte getService() { | |
| 294 | - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000) return -1; | |
| 295 | - return (byte)(((serviceState & 0x02000000) == 0x02000000) ? 1 : 0); | |
| 296 | - } | |
| 297 | - | |
| 298 | - public void setService(boolean service) { | |
| 299 | - if (!service) serviceState |= 0x02000000; | |
| 300 | - else serviceState &= 0xfdffffff; | |
| 301 | - } | |
| 302 | - | |
| 303 | - /** | |
| 304 | - * 获得车辆状态 | |
| 305 | - * @return 0点火 1熄火 | |
| 306 | - */ | |
| 307 | - public byte getVehicleState() { | |
| 308 | - return (byte)(((serviceState & 0x00200000) == 0x00200000) ? 1 : 0); | |
| 309 | - } | |
| 310 | - | |
| 311 | - public void setInOutStopFlag(boolean inOutStopFlag) { | |
| 312 | - this.inOutStopFlag = inOutStopFlag; | |
| 313 | - } | |
| 314 | - | |
| 315 | - public boolean getInOutStopFlag() { | |
| 316 | - return inOutStopFlag; | |
| 317 | - } | |
| 318 | - | |
| 319 | - public String toString() { | |
| 320 | - Date d = new Date();d.setTime(timestamp); | |
| 321 | - StringBuilder sb = new StringBuilder(); | |
| 322 | - sb.append("城市代码:").append(cityCode) | |
| 323 | - .append("行业代码:").append(industryCode) | |
| 324 | - .append("公司代码:").append(companyCode) | |
| 325 | - .append("设备号:").append(deviceId) | |
| 326 | - .append("线路编号:").append(lineId) | |
| 327 | - .append("驾驶员工号:").append(driverEmpNo) | |
| 328 | - .append("停车场序列号:").append(carparkSerialNo) | |
| 329 | - .append("停车场编号:").append(carparkNo) | |
| 330 | - .append("站点序列号").append(stopSerialNo) | |
| 331 | - .append("站点编号:").append(stopNo) | |
| 332 | - .append("经度:").append(carLon) | |
| 333 | - .append("维度:").append(carLat) | |
| 334 | - .append("时间戳:").append(d) | |
| 335 | - .append("速度(传感器):").append(speedSensor) | |
| 336 | - .append("速度(gps)").append(speedGps) | |
| 337 | - .append("方向:").append(direction) | |
| 338 | - .append("车内温度:").append(inTemp) | |
| 339 | - .append("营运状态:").append(serviceState) | |
| 340 | - .append("调控状态:").append(controlState) | |
| 341 | - .append("总里程:").append(totalMiles) | |
| 342 | - .append("水温:").append(waterTemp) | |
| 343 | - .append("油耗:").append(oilConsumption) | |
| 344 | - .append("发动机速度:").append(engineSpeed); | |
| 345 | - | |
| 346 | - return sb.toString(); | |
| 347 | - } | |
| 348 | - /* ----------------------------------------------------- */ | |
| 349 | - | |
| 350 | - public void setCityCode(int cityCode) { | |
| 351 | - this.cityCode = cityCode; | |
| 352 | - } | |
| 353 | - | |
| 354 | - public void setIndustryCode(short industryCode) { | |
| 355 | - this.industryCode = industryCode; | |
| 356 | - } | |
| 357 | - | |
| 358 | - public void setCompanyCode(short companyCode) { | |
| 359 | - this.companyCode = companyCode; | |
| 360 | - } | |
| 361 | - | |
| 362 | - public void setDeviceId(String deviceId) { | |
| 363 | - this.deviceId = deviceId; | |
| 364 | - } | |
| 365 | - | |
| 366 | - public void setLineId(int lineId) { | |
| 367 | - this.lineId = lineId; | |
| 368 | - } | |
| 369 | - | |
| 370 | - public void setDriverEmpNo(int driverEmpNo) { | |
| 371 | - this.driverEmpNo = driverEmpNo; | |
| 372 | - } | |
| 373 | - | |
| 374 | - public void setCarparkSerialNo(short carparkSerialNo) { | |
| 375 | - this.carparkSerialNo = carparkSerialNo; | |
| 376 | - } | |
| 377 | - | |
| 378 | - public void setCarparkNo(String carparkNo) { | |
| 379 | - this.carparkNo = carparkNo; | |
| 380 | - } | |
| 381 | - | |
| 382 | - public void setStopSerialNo(short stopSerialNo) { | |
| 383 | - this.stopSerialNo = stopSerialNo; | |
| 384 | - } | |
| 385 | - | |
| 386 | - public void setCarLon(long carLon) { | |
| 387 | - this.carLon = carLon; | |
| 388 | - } | |
| 389 | - | |
| 390 | - public void setCarLat(int carLat) { | |
| 391 | - this.carLat = carLat; | |
| 392 | - } | |
| 393 | - | |
| 394 | - public void setTimestamp(long timestamp) { | |
| 395 | - this.timestamp = timestamp; | |
| 396 | - } | |
| 397 | - | |
| 398 | - public void setSpeedSensor(short speedSensor) { | |
| 399 | - this.speedSensor = speedSensor; | |
| 400 | - } | |
| 401 | - | |
| 402 | - public void setSpeedGps(short speedGps) { | |
| 403 | - this.speedGps = speedGps; | |
| 404 | - } | |
| 405 | - | |
| 406 | - public void setDirection(short direction) { | |
| 407 | - this.direction = direction; | |
| 408 | - } | |
| 409 | - | |
| 410 | - public void setInTemp(short inTemp) { | |
| 411 | - this.inTemp = inTemp; | |
| 412 | - } | |
| 413 | - | |
| 414 | - public void setServiceState(long serviceState) { | |
| 415 | - this.serviceState = serviceState; | |
| 416 | - } | |
| 417 | - | |
| 418 | - public void setControlState(long controlState) { | |
| 419 | - this.controlState = controlState; | |
| 420 | - } | |
| 421 | - | |
| 422 | - public void setTotalMiles(int totalMiles) { | |
| 423 | - this.totalMiles = totalMiles; | |
| 424 | - } | |
| 425 | - | |
| 426 | - public void setWaterTemp(byte waterTemp) { | |
| 427 | - this.waterTemp = waterTemp; | |
| 428 | - } | |
| 429 | - | |
| 430 | - public void setOilConsumption(int oilConsumption) { | |
| 431 | - this.oilConsumption = oilConsumption; | |
| 432 | - } | |
| 433 | - | |
| 434 | - public void setEngineSpeed(int engineSpeed) { | |
| 435 | - this.engineSpeed = engineSpeed; | |
| 436 | - } | |
| 437 | -} |
src/main/java/com/bsth/data/gpsdata/client/pd/protocol/PdFactory.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pd.protocol; | |
| 2 | - | |
| 3 | - | |
| 4 | -import com.bsth.data.gpsdata.client.msg.IMessageBody; | |
| 5 | - | |
| 6 | -public class PdFactory { | |
| 7 | - | |
| 8 | - public static IMessageBody create(int commandType, byte[] data) { | |
| 9 | - String pkgName = PdFactory.class.getPackage().getName(); | |
| 10 | - IMessageBody body = null; | |
| 11 | - try { | |
| 12 | - Class<?> cls = Class.forName(pkgName + ".Pd_" + Integer.toHexString(commandType).toUpperCase() + "_0"); | |
| 13 | - body = (IMessageBody)cls.newInstance(); | |
| 14 | - body.read(data); | |
| 15 | - } catch (ClassNotFoundException e) { | |
| 16 | - // TODO Auto-generated catch block | |
| 17 | - //e.printStackTrace(); | |
| 18 | - } catch (InstantiationException e) { | |
| 19 | - // TODO Auto-generated catch block | |
| 20 | - e.printStackTrace(); | |
| 21 | - } catch (IllegalAccessException e) { | |
| 22 | - // TODO Auto-generated catch block | |
| 23 | - e.printStackTrace(); | |
| 24 | - } | |
| 25 | - return body; | |
| 26 | - } | |
| 27 | -} |
src/main/java/com/bsth/data/gpsdata/client/pd/protocol/PdMessage.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pd.protocol; | |
| 2 | - | |
| 3 | - | |
| 4 | -import com.bsth.data.gpsdata.client.msg.IMessage; | |
| 5 | -import com.bsth.data.gpsdata.client.msg.IMessageBody; | |
| 6 | - | |
| 7 | -import java.nio.ByteBuffer; | |
| 8 | -import java.util.Arrays; | |
| 9 | - | |
| 10 | -public class PdMessage implements IMessage { | |
| 11 | - | |
| 12 | - private short version; | |
| 13 | - private short serialNo; | |
| 14 | - private short commandType; | |
| 15 | - private IMessageBody messageBody; | |
| 16 | - private byte checkSum; | |
| 17 | - | |
| 18 | - public short getVersion() { | |
| 19 | - return version; | |
| 20 | - } | |
| 21 | - | |
| 22 | - public void setVersion(short version) { | |
| 23 | - this.version = version; | |
| 24 | - } | |
| 25 | - | |
| 26 | - public short getSerialNo() { | |
| 27 | - return serialNo; | |
| 28 | - } | |
| 29 | - | |
| 30 | - public void setSerialNo(short serialNo) { | |
| 31 | - this.serialNo = serialNo; | |
| 32 | - } | |
| 33 | - | |
| 34 | - public short getCommandType() { | |
| 35 | - return commandType; | |
| 36 | - } | |
| 37 | - | |
| 38 | - public void setCommandType(short commandType) { | |
| 39 | - this.commandType = commandType; | |
| 40 | - } | |
| 41 | - | |
| 42 | - public IMessageBody getMessageBody() { | |
| 43 | - return messageBody; | |
| 44 | - } | |
| 45 | - | |
| 46 | - public void setMessageBody(IMessageBody messageBody) { | |
| 47 | - this.messageBody = messageBody; | |
| 48 | - } | |
| 49 | - | |
| 50 | - public byte getCheckSum() { | |
| 51 | - return checkSum; | |
| 52 | - } | |
| 53 | - | |
| 54 | - public void setCheckSum(byte checkSum) { | |
| 55 | - this.checkSum = checkSum; | |
| 56 | - } | |
| 57 | - | |
| 58 | - public void read(byte[] data) { | |
| 59 | - int idx = 0, len = data.length; | |
| 60 | - version = (short)(data[idx] & 0xff); idx++; | |
| 61 | - serialNo = (short)(data[idx] & 0xff); idx++; | |
| 62 | - commandType = (short)(data[idx] & 0xff); idx++; | |
| 63 | - byte[] temp = Arrays.copyOfRange(data, idx, len - 1); | |
| 64 | - checkSum = data[len - 1]; | |
| 65 | - byte sum = 0; | |
| 66 | - for (int i = 0;i < len - 1;i++) { | |
| 67 | - sum += data[i]; | |
| 68 | - } | |
| 69 | - if (sum == checkSum) { | |
| 70 | - messageBody = PdFactory.create(commandType, temp); | |
| 71 | - } | |
| 72 | - } | |
| 73 | - | |
| 74 | - public byte[] write() { | |
| 75 | - byte[] bytes = messageBody.write(); | |
| 76 | - ByteBuffer buf = ByteBuffer.allocate(bytes.length + 8); | |
| 77 | - buf.put(new byte[] { (byte)0xfa, (byte)0xf5 }); | |
| 78 | - buf.putShort((short)(bytes.length + 3)); | |
| 79 | - buf.put((byte)version); | |
| 80 | - buf.put((byte)serialNo); | |
| 81 | - buf.put((byte)commandType); | |
| 82 | - buf.put(bytes); | |
| 83 | - checkSum = 0; | |
| 84 | - checkSum += (byte)version; | |
| 85 | - checkSum += (byte)serialNo; | |
| 86 | - checkSum += (byte)commandType; | |
| 87 | - for (byte b : bytes) { | |
| 88 | - checkSum += b; | |
| 89 | - } | |
| 90 | - buf.put(checkSum); | |
| 91 | - return buf.array(); | |
| 92 | - } | |
| 93 | - | |
| 94 | - public String toString() { | |
| 95 | - StringBuilder sb = new StringBuilder(); | |
| 96 | - sb.append("报文版本号:").append(version) | |
| 97 | - .append("报文序列号:").append(serialNo) | |
| 98 | - .append("报文命令字:0x").append(Integer.toHexString(commandType)) | |
| 99 | - .append("报文主体:(").append(messageBody).append(")") | |
| 100 | - .append("报文校验和:").append(checkSum); | |
| 101 | - | |
| 102 | - return sb.toString(); | |
| 103 | - } | |
| 104 | -} |
src/main/java/com/bsth/data/gpsdata/client/pd/protocol/Pd_31_0.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pd.protocol; | |
| 2 | - | |
| 3 | - | |
| 4 | -import com.bsth.data.gpsdata.client.msg.IMessageBody; | |
| 5 | -import com.bsth.data.gpsdata.client.pd.common.ConvertUtil; | |
| 6 | - | |
| 7 | -import java.nio.ByteBuffer; | |
| 8 | -import java.util.Date; | |
| 9 | - | |
| 10 | - | |
| 11 | -public class Pd_31_0 implements IMessageBody { | |
| 12 | - | |
| 13 | - // bcd 1 | |
| 14 | - private short funCode; | |
| 15 | - // bcd 3 | |
| 16 | - private int lineId; | |
| 17 | - // ascii 8 | |
| 18 | - private String deviceId; | |
| 19 | - // bcd 6 yyMMddhhmmss | |
| 20 | - private long timestamp; | |
| 21 | - // hex 8 | |
| 22 | - private String reserved; | |
| 23 | - | |
| 24 | - @Override | |
| 25 | - public void read(byte[] bytes) { | |
| 26 | - // TODO Auto-generated method stub | |
| 27 | - int idx = 0; | |
| 28 | - funCode = (short)(bytes[idx] & 0xff);idx++; | |
| 29 | - lineId = ConvertUtil.bcd2int(bytes, idx, 3);idx += 3; | |
| 30 | - deviceId = ConvertUtil.ascii2string(bytes, idx, 8);idx += 8; | |
| 31 | - timestamp = ConvertUtil.bcd2timestamp(bytes, idx);idx += 6; | |
| 32 | - reserved = ConvertUtil.ascii2string(bytes, idx, 8);idx += 8; | |
| 33 | - } | |
| 34 | - | |
| 35 | - @Override | |
| 36 | - public byte[] write() { | |
| 37 | - // TODO Auto-generated method stub | |
| 38 | - ByteBuffer buf = ByteBuffer.allocate(26); | |
| 39 | - buf.put((byte)funCode); | |
| 40 | - buf.put(ConvertUtil.int2bcd(lineId, 3)); | |
| 41 | - buf.put(deviceId.getBytes()); | |
| 42 | - buf.put(ConvertUtil.timestamp2bcd(timestamp)); | |
| 43 | - buf.put(new byte[]{0,0,0,0,0,0,0,0}); | |
| 44 | - return buf.array(); | |
| 45 | - } | |
| 46 | - | |
| 47 | - public short getFunCode() { | |
| 48 | - return funCode; | |
| 49 | - } | |
| 50 | - | |
| 51 | - public int getLineId() { | |
| 52 | - return lineId; | |
| 53 | - } | |
| 54 | - | |
| 55 | - public String getDeviceId() { | |
| 56 | - return deviceId; | |
| 57 | - } | |
| 58 | - | |
| 59 | - public long getTimestamp() { | |
| 60 | - return timestamp; | |
| 61 | - } | |
| 62 | - | |
| 63 | - public String getReserved() { | |
| 64 | - return reserved; | |
| 65 | - } | |
| 66 | - | |
| 67 | - public void setFunCode(short funCode) { | |
| 68 | - this.funCode = funCode; | |
| 69 | - } | |
| 70 | - | |
| 71 | - public void setLineId(int lineId) { | |
| 72 | - this.lineId = lineId; | |
| 73 | - } | |
| 74 | - | |
| 75 | - public void setDeviceId(String deviceId) { | |
| 76 | - this.deviceId = deviceId; | |
| 77 | - } | |
| 78 | - | |
| 79 | - public void setTimeStamp(long timestamp) { | |
| 80 | - this.timestamp = timestamp; | |
| 81 | - } | |
| 82 | - | |
| 83 | - public void setReserved(String reserved) { | |
| 84 | - this.reserved = reserved; | |
| 85 | - } | |
| 86 | - | |
| 87 | - public String toString() { | |
| 88 | - Date d = new Date(); | |
| 89 | - d.setTime(timestamp); | |
| 90 | - StringBuilder sb = new StringBuilder(); | |
| 91 | - sb.append("功能号:").append(Integer.toHexString(funCode)) | |
| 92 | - .append("线路编号:").append(lineId) | |
| 93 | - .append("设备编号:").append(deviceId) | |
| 94 | - .append("时间戳:").append(d); | |
| 95 | - return sb.toString(); | |
| 96 | - } | |
| 97 | -} |
src/main/java/com/bsth/data/gpsdata/client/pd/protocol/Pd_41_0.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pd.protocol; | |
| 2 | - | |
| 3 | - | |
| 4 | -import com.bsth.data.gpsdata.client.msg.IMessageBody; | |
| 5 | -import com.bsth.data.gpsdata.client.pd.common.ConvertUtil; | |
| 6 | - | |
| 7 | -import java.nio.ByteBuffer; | |
| 8 | - | |
| 9 | - | |
| 10 | -public class Pd_41_0 implements IMessageBody { | |
| 11 | - | |
| 12 | - private BasicInfo info; | |
| 13 | - private short leaveStopDis; | |
| 14 | - | |
| 15 | - public BasicInfo getInfo() { | |
| 16 | - return info; | |
| 17 | - } | |
| 18 | - | |
| 19 | - public void setInfo(BasicInfo info) { | |
| 20 | - this.info = info; | |
| 21 | - } | |
| 22 | - | |
| 23 | - public short getLeaveStopDis() { | |
| 24 | - return leaveStopDis; | |
| 25 | - } | |
| 26 | - | |
| 27 | - public void setLeaveStopDis(short leaveStopDis) { | |
| 28 | - this.leaveStopDis = leaveStopDis; | |
| 29 | - } | |
| 30 | - | |
| 31 | - @Override | |
| 32 | - public void read(byte[] bytes) { | |
| 33 | - // TODO Auto-generated method stub | |
| 34 | - int idx = 0; | |
| 35 | - info = new BasicInfo(); | |
| 36 | - info.read(bytes, idx); idx += 80; | |
| 37 | - leaveStopDis = (short) ConvertUtil.bcd2int(bytes, idx, 2); idx += 2; | |
| 38 | - } | |
| 39 | - | |
| 40 | - @Override | |
| 41 | - public byte[] write() { | |
| 42 | - // TODO Auto-generated method stub | |
| 43 | - ByteBuffer buf = ByteBuffer.allocate(82); | |
| 44 | - buf.put(info.write()); | |
| 45 | - buf.put(ConvertUtil.int2bcd(leaveStopDis, 2)); | |
| 46 | - | |
| 47 | - return buf.array(); | |
| 48 | - } | |
| 49 | - | |
| 50 | - @Override | |
| 51 | - public String getDeviceId() { | |
| 52 | - // TODO Auto-generated method stub | |
| 53 | - return info.getDeviceId(); | |
| 54 | - } | |
| 55 | - | |
| 56 | - public String toString() { | |
| 57 | - StringBuilder sb = new StringBuilder(); | |
| 58 | - sb.append("基本数据:").append(info.toString()) | |
| 59 | - .append("离站距离:").append(leaveStopDis); | |
| 60 | - | |
| 61 | - return sb.toString(); | |
| 62 | - } | |
| 63 | - | |
| 64 | - @Override | |
| 65 | - public long getTimestamp() { | |
| 66 | - // TODO Auto-generated method stub | |
| 67 | - return info.getTimestamp(); | |
| 68 | - } | |
| 69 | -} |
src/main/java/com/bsth/data/gpsdata/client/pd/protocol/Pd_42_0.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pd.protocol; | |
| 2 | - | |
| 3 | -import com.bsth.data.gpsdata.client.msg.IMessageBody; | |
| 4 | -import com.bsth.data.gpsdata.client.pd.common.ConvertUtil; | |
| 5 | - | |
| 6 | -import java.nio.ByteBuffer; | |
| 7 | - | |
| 8 | -public class Pd_42_0 implements IMessageBody { | |
| 9 | - | |
| 10 | - private BasicInfo info; | |
| 11 | - // 站间里程 保留两位小数 km | |
| 12 | - private short stopBetMiles; | |
| 13 | - private short frontDoorUp; | |
| 14 | - private short frontDoorDown; | |
| 15 | - private short backDoorUp; | |
| 16 | - private short backDoorDown; | |
| 17 | - // 本站留车人数 | |
| 18 | - private int stay; | |
| 19 | - // 本站刷卡次数 | |
| 20 | - private short cardCount; | |
| 21 | - // 本站刷卡金额 | |
| 22 | - private int cardMoney; | |
| 23 | - // 免费刷卡次数 | |
| 24 | - private short freeCardCount; | |
| 25 | - // 免费刷卡金额 | |
| 26 | - private int freeCardMoney; | |
| 27 | - // 总刷卡次数 | |
| 28 | - private int totalCardCount; | |
| 29 | - // 总数卡金额 | |
| 30 | - private long totalCardMoney; | |
| 31 | - // 总免费刷卡次数 | |
| 32 | - private int totalFreeCardCount; | |
| 33 | - // 总免费刷卡金额 | |
| 34 | - private long totalFreeCardMoney; | |
| 35 | - // 客流站号 | |
| 36 | - private short passengerStopNo; | |
| 37 | - | |
| 38 | - @Override | |
| 39 | - public void read(byte[] bytes) { | |
| 40 | - // TODO Auto-generated method stub | |
| 41 | - ByteBuffer buf = ByteBuffer.wrap(bytes); | |
| 42 | - int idx = 0; | |
| 43 | - info = new BasicInfo(); | |
| 44 | - info.read(bytes, idx); idx += 80; | |
| 45 | - stopBetMiles = (short) ConvertUtil.bcd2int(bytes, idx, 2); idx += 2; | |
| 46 | - frontDoorUp = (short)(buf.get(idx) & 0xff); idx++; | |
| 47 | - frontDoorDown = (short)(buf.get(idx) & 0xff); idx++; | |
| 48 | - backDoorUp = (short)(buf.get(idx) & 0xff); idx++; | |
| 49 | - backDoorDown = (short)(buf.get(idx) & 0xff); idx++; | |
| 50 | - stay = buf.getShort(idx) & 0xffff; idx += 2; | |
| 51 | - cardCount = (short)(buf.get(idx) & 0xff); idx++; | |
| 52 | - cardMoney = buf.getShort(idx) & 0xffff; idx += 2; | |
| 53 | - freeCardCount = (short)(buf.get(idx) & 0xff); idx++; | |
| 54 | - freeCardMoney = buf.getShort(idx) & 0xffff; idx += 2; | |
| 55 | - totalCardCount = buf.getShort(idx) & 0xffff; idx += 2; | |
| 56 | - totalCardMoney = buf.getInt(idx) & 0xffffffffl; idx += 4; | |
| 57 | - totalFreeCardCount = buf.getShort(idx) & 0xffff; idx += 2; | |
| 58 | - totalFreeCardMoney = buf.getInt(idx) & 0xffffffffl; idx += 4; | |
| 59 | - passengerStopNo = (short)(buf.get(idx) & 0xff); idx++; | |
| 60 | - } | |
| 61 | - | |
| 62 | - @Override | |
| 63 | - public byte[] write() { | |
| 64 | - // TODO Auto-generated method stub | |
| 65 | - ByteBuffer buf = ByteBuffer.allocate(107); | |
| 66 | - buf.put(info.write()); | |
| 67 | - buf.put(ConvertUtil.int2bcd(stopBetMiles, 2)); | |
| 68 | - buf.put((byte)frontDoorUp); | |
| 69 | - buf.put((byte)frontDoorDown); | |
| 70 | - buf.put((byte)backDoorUp); | |
| 71 | - buf.put((byte)backDoorDown); | |
| 72 | - buf.putShort((short)stay); | |
| 73 | - buf.put((byte)cardCount); | |
| 74 | - buf.putShort((short)cardMoney); | |
| 75 | - buf.put((byte)freeCardCount); | |
| 76 | - buf.putShort((short)freeCardMoney); | |
| 77 | - buf.putShort((short)totalCardCount); | |
| 78 | - buf.putInt((int)totalCardMoney); | |
| 79 | - buf.putShort((short)totalFreeCardCount); | |
| 80 | - buf.putInt((int)totalFreeCardMoney); | |
| 81 | - buf.put((byte)passengerStopNo); | |
| 82 | - | |
| 83 | - return buf.array(); | |
| 84 | - } | |
| 85 | - | |
| 86 | - @Override | |
| 87 | - public String getDeviceId() { | |
| 88 | - // TODO Auto-generated method stub | |
| 89 | - return info.getDeviceId(); | |
| 90 | - } | |
| 91 | - | |
| 92 | - public BasicInfo getInfo() { | |
| 93 | - return info; | |
| 94 | - } | |
| 95 | - | |
| 96 | - public short getStopBetMiles() { | |
| 97 | - return stopBetMiles; | |
| 98 | - } | |
| 99 | - | |
| 100 | - public short getFrontDoorUp() { | |
| 101 | - return frontDoorUp; | |
| 102 | - } | |
| 103 | - | |
| 104 | - public short getFrontDoorDown() { | |
| 105 | - return frontDoorDown; | |
| 106 | - } | |
| 107 | - | |
| 108 | - public short getBackDoorUp() { | |
| 109 | - return backDoorUp; | |
| 110 | - } | |
| 111 | - | |
| 112 | - public short getBackDoorDown() { | |
| 113 | - return backDoorDown; | |
| 114 | - } | |
| 115 | - | |
| 116 | - public int getStay() { | |
| 117 | - return stay; | |
| 118 | - } | |
| 119 | - | |
| 120 | - public short getCardCount() { | |
| 121 | - return cardCount; | |
| 122 | - } | |
| 123 | - | |
| 124 | - public int getCardMoney() { | |
| 125 | - return cardMoney; | |
| 126 | - } | |
| 127 | - | |
| 128 | - public short getFreeCardCount() { | |
| 129 | - return freeCardCount; | |
| 130 | - } | |
| 131 | - | |
| 132 | - public int getFreeCardMoney() { | |
| 133 | - return freeCardMoney; | |
| 134 | - } | |
| 135 | - | |
| 136 | - public int getTotalCardCount() { | |
| 137 | - return totalCardCount; | |
| 138 | - } | |
| 139 | - | |
| 140 | - public long getTotalCardMoney() { | |
| 141 | - return totalCardMoney; | |
| 142 | - } | |
| 143 | - | |
| 144 | - public int getTotalFreeCardCount() { | |
| 145 | - return totalFreeCardCount; | |
| 146 | - } | |
| 147 | - | |
| 148 | - public long getTotalFreeCardMoney() { | |
| 149 | - return totalFreeCardMoney; | |
| 150 | - } | |
| 151 | - | |
| 152 | - public short getPassengerStopNo() { | |
| 153 | - return passengerStopNo; | |
| 154 | - } | |
| 155 | - | |
| 156 | - public String toString() { | |
| 157 | - StringBuilder sb = new StringBuilder(); | |
| 158 | - sb.append("基本数据:").append(info.toString()) | |
| 159 | - .append("站间距离:").append(stopBetMiles) | |
| 160 | - .append("前门上客:").append(frontDoorUp) | |
| 161 | - .append("前门下客:").append(frontDoorDown) | |
| 162 | - .append("后门上客:").append(backDoorUp) | |
| 163 | - .append("后门下客:").append(backDoorDown) | |
| 164 | - .append("本站留车人数:").append(stay) | |
| 165 | - .append("本站刷卡次数:").append(cardCount) | |
| 166 | - .append("本站刷卡金额:").append(cardMoney) | |
| 167 | - .append("免费刷卡次数:").append(freeCardCount) | |
| 168 | - .append("免费刷卡金额:").append(freeCardMoney) | |
| 169 | - .append("总刷卡次数:").append(totalCardCount) | |
| 170 | - .append("总数卡金额:").append(totalCardMoney) | |
| 171 | - .append("总免费刷卡次数:").append(totalFreeCardCount) | |
| 172 | - .append("总免费刷卡金额:").append(totalFreeCardMoney) | |
| 173 | - .append("客流站号:").append(passengerStopNo); | |
| 174 | - | |
| 175 | - return sb.toString(); | |
| 176 | - } | |
| 177 | - | |
| 178 | - @Override | |
| 179 | - public long getTimestamp() { | |
| 180 | - // TODO Auto-generated method stub | |
| 181 | - return info.getTimestamp(); | |
| 182 | - } | |
| 183 | -} |
src/main/java/com/bsth/data/gpsdata/client/pf/codec/MessageDecoder.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pf.codec; | |
| 2 | - | |
| 3 | -import com.bsth.data.gpsdata.client.pf.protocol.PfMessage; | |
| 4 | -import org.apache.mina.core.buffer.IoBuffer; | |
| 5 | -import org.apache.mina.core.session.IoSession; | |
| 6 | -import org.apache.mina.filter.codec.CumulativeProtocolDecoder; | |
| 7 | -import org.apache.mina.filter.codec.ProtocolDecoderOutput; | |
| 8 | - | |
| 9 | - | |
| 10 | -public class MessageDecoder extends CumulativeProtocolDecoder { | |
| 11 | - | |
| 12 | - @Override | |
| 13 | - protected boolean doDecode(IoSession session, IoBuffer in, | |
| 14 | - ProtocolDecoderOutput out) throws Exception { | |
| 15 | - // TODO Auto-generated method stub | |
| 16 | - while (in.remaining() > 3) { | |
| 17 | - in.mark(); | |
| 18 | - byte head1 = in.get(), head2 = in.get(), lenh = in.get(), lenl = in.get(); | |
| 19 | - int len = ((lenh & 0xff) << 8) + (lenl & 0xff); | |
| 20 | - if ((head1 & 0xff) == 0xfa && (head2 & 0xff) == 0xf5) { | |
| 21 | - if (in.remaining() > len) { | |
| 22 | - byte[] bytes = new byte[len + 1]; | |
| 23 | - in.get(bytes); | |
| 24 | - PfMessage msg = new PfMessage(); | |
| 25 | - msg.read(bytes); | |
| 26 | - out.write(msg); | |
| 27 | - } else { | |
| 28 | - in.reset(); | |
| 29 | - return false; | |
| 30 | - } | |
| 31 | - } | |
| 32 | - } | |
| 33 | - return false; | |
| 34 | - } | |
| 35 | - | |
| 36 | - /*private static String toHexString(byte[] bytes) { | |
| 37 | - StringBuilder sb = new StringBuilder(); | |
| 38 | - for (byte b : bytes) { | |
| 39 | - sb.append(Integer.toHexString(b & 0xff) + "|"); | |
| 40 | - } | |
| 41 | - return sb.toString(); | |
| 42 | - }*/ | |
| 43 | -} |
src/main/java/com/bsth/data/gpsdata/client/pf/codec/MessageEncoder.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pf.codec; | |
| 2 | - | |
| 3 | -import org.apache.mina.core.buffer.IoBuffer; | |
| 4 | -import org.apache.mina.core.session.IoSession; | |
| 5 | -import org.apache.mina.filter.codec.ProtocolEncoderAdapter; | |
| 6 | -import org.apache.mina.filter.codec.ProtocolEncoderOutput; | |
| 7 | - | |
| 8 | -public class MessageEncoder extends ProtocolEncoderAdapter { | |
| 9 | - | |
| 10 | - @Override | |
| 11 | - public void encode(IoSession session, Object message, | |
| 12 | - ProtocolEncoderOutput out) throws Exception { | |
| 13 | - // TODO Auto-generated method stub | |
| 14 | - IoBuffer buf = IoBuffer.allocate(1024).setAutoExpand(true); | |
| 15 | - buf.put((byte[])message); | |
| 16 | - buf.flip(); | |
| 17 | - out.write(buf); | |
| 18 | - } | |
| 19 | - | |
| 20 | -} |
src/main/java/com/bsth/data/gpsdata/client/pf/codec/PfMessageCodecFactory.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pf.codec; | |
| 2 | - | |
| 3 | -import org.apache.mina.core.session.IoSession; | |
| 4 | -import org.apache.mina.filter.codec.ProtocolCodecFactory; | |
| 5 | -import org.apache.mina.filter.codec.ProtocolDecoder; | |
| 6 | -import org.apache.mina.filter.codec.ProtocolEncoder; | |
| 7 | - | |
| 8 | -public class PfMessageCodecFactory implements ProtocolCodecFactory { | |
| 9 | - | |
| 10 | - private ProtocolEncoder encoder; | |
| 11 | - private ProtocolDecoder decoder; | |
| 12 | - | |
| 13 | - public PfMessageCodecFactory() { | |
| 14 | - encoder = new MessageEncoder(); | |
| 15 | - decoder = new MessageDecoder(); | |
| 16 | - } | |
| 17 | - | |
| 18 | - @Override | |
| 19 | - public ProtocolEncoder getEncoder(IoSession session) throws Exception { | |
| 20 | - // TODO Auto-generated method stub | |
| 21 | - return encoder; | |
| 22 | - } | |
| 23 | - | |
| 24 | - @Override | |
| 25 | - public ProtocolDecoder getDecoder(IoSession session) throws Exception { | |
| 26 | - // TODO Auto-generated method stub | |
| 27 | - return decoder; | |
| 28 | - } | |
| 29 | - | |
| 30 | -} |
src/main/java/com/bsth/data/gpsdata/client/pf/common/ConvertUtil.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pf.common; | |
| 2 | - | |
| 3 | -import com.bsth.data.gpsdata.client.common.ThreadLocalDateUtil; | |
| 4 | -import org.slf4j.Logger; | |
| 5 | -import org.slf4j.LoggerFactory; | |
| 6 | - | |
| 7 | -import java.text.ParseException; | |
| 8 | -import java.util.Arrays; | |
| 9 | -import java.util.Calendar; | |
| 10 | -import java.util.Date; | |
| 11 | - | |
| 12 | - | |
| 13 | -public class ConvertUtil { | |
| 14 | - | |
| 15 | - private final static Logger log = LoggerFactory.getLogger(ConvertUtil.class); | |
| 16 | - | |
| 17 | - public static int bcd2int(byte[] bytes, int start, int len) { | |
| 18 | - if (len > 4 || len == 0) | |
| 19 | - throw new IllegalArgumentException("bcd2int 字节数不符合要求"); | |
| 20 | - String temp = ""; | |
| 21 | - for (int i = 0;i < len;i++) { | |
| 22 | - int val = bytes[start + i] & 0xff; | |
| 23 | - if (val < 10) temp += 0; | |
| 24 | - temp += Integer.toHexString(val); | |
| 25 | - } | |
| 26 | - return Integer.parseInt(temp); | |
| 27 | - } | |
| 28 | - | |
| 29 | - public static byte[] int2bcd(int val, int len) { | |
| 30 | - if (len > 4 || len == 0) | |
| 31 | - throw new IllegalArgumentException("int2bcd 字节数不符合要求"); | |
| 32 | - byte[] result = new byte[len]; | |
| 33 | - for (int i = len - 1;i > -1;i--) { | |
| 34 | - result[i] = (byte)Integer.parseInt(val%100 + "", 16); | |
| 35 | - val = val/100; | |
| 36 | - } | |
| 37 | - return result; | |
| 38 | - } | |
| 39 | - | |
| 40 | - public static long bcd2long(byte[] bytes, int start, int len) { | |
| 41 | - if (len > 8 || len == 0) | |
| 42 | - throw new IllegalArgumentException("bcd2long 字节数不符合要求"); | |
| 43 | - String temp = ""; | |
| 44 | - for (int i = 0;i < len;i++) { | |
| 45 | - int val = bytes[start + i] & 0xff; | |
| 46 | - if (val < 10) temp += 0; | |
| 47 | - temp += Integer.toHexString(val); | |
| 48 | - } | |
| 49 | - return Long.parseLong(temp); | |
| 50 | - } | |
| 51 | - | |
| 52 | - public static byte[] long2bcd(long val, int len) { | |
| 53 | - if (len > 8 || len == 0) | |
| 54 | - throw new IllegalArgumentException("long2bcd 字节数不符合要求"); | |
| 55 | - byte[] result = new byte[len]; | |
| 56 | - for (int i = len - 1;i > -1;i--) { | |
| 57 | - result[i] = (byte)Integer.parseInt(val%100 + "", 16); | |
| 58 | - val = val/100; | |
| 59 | - } | |
| 60 | - return result; | |
| 61 | - } | |
| 62 | - | |
| 63 | - public static String ascii2string(byte[] bytes, int start, int len) { | |
| 64 | - return new String(Arrays.copyOfRange(bytes, start, start + len)); | |
| 65 | - } | |
| 66 | - | |
| 67 | - public static byte[] string2ascii(String val, int len) { | |
| 68 | - byte[] result = new byte[len]; | |
| 69 | - byte[] bytes = val.getBytes(); | |
| 70 | - if (bytes.length > len && len != 0) | |
| 71 | - throw new IllegalArgumentException("string2ascii 参数不符合要求"); | |
| 72 | - if (len != 0) | |
| 73 | - for (int i = 0, l = bytes.length;i < l;i++) result[i] = bytes[i]; | |
| 74 | - else return bytes; | |
| 75 | - return result; | |
| 76 | - } | |
| 77 | - | |
| 78 | - public static long bcd2timestamp(byte[] bytes, int start) { | |
| 79 | - String temp = "20"; | |
| 80 | - for (int i = 0;i < 6;i++) { | |
| 81 | - int val = bytes[start + i] & 0xff; | |
| 82 | - if (val < 10) temp += 0; | |
| 83 | - temp += Integer.toHexString(val); | |
| 84 | - } | |
| 85 | - Date date = null; | |
| 86 | - try { | |
| 87 | - date = ThreadLocalDateUtil.parse(temp); | |
| 88 | - } catch (ParseException e) { | |
| 89 | - log.error("协议中时间数据异常:" + temp); | |
| 90 | - } | |
| 91 | - if (date != null) return date.getTime(); | |
| 92 | - return -1; | |
| 93 | - } | |
| 94 | - | |
| 95 | - public static byte[] timestamp2bcd(long val) { | |
| 96 | - byte[] result = new byte[6]; | |
| 97 | - Calendar c = Calendar.getInstance(); | |
| 98 | - c.setTime(new Date(val)); | |
| 99 | - result[0] = (byte)(Integer.parseInt(c.get(Calendar.YEAR)%100 + "", 16)); | |
| 100 | - result[1] = (byte)(Integer.parseInt(c.get(Calendar.MONTH) + 1 + "", 16)); | |
| 101 | - result[2] = (byte)Integer.parseInt(c.get(Calendar.DAY_OF_MONTH) + "", 16); | |
| 102 | - result[3] = (byte)Integer.parseInt(c.get(Calendar.HOUR_OF_DAY) + "", 16); | |
| 103 | - result[4] = (byte)Integer.parseInt(c.get(Calendar.MINUTE) + "", 16); | |
| 104 | - result[5] = (byte)Integer.parseInt(c.get(Calendar.SECOND) + "", 16); | |
| 105 | - return result; | |
| 106 | - } | |
| 107 | - | |
| 108 | - public static byte[] int2hex(int val, int len) { | |
| 109 | - if (len < 1) | |
| 110 | - throw new IllegalArgumentException("int2hex len 参数不符合要求"); | |
| 111 | - byte[] result = new byte[len]; | |
| 112 | - for (int i = 0;i < len;i++) { | |
| 113 | - result[len - 1 - i] = (byte)(val%100); | |
| 114 | - val = val/100; | |
| 115 | - } | |
| 116 | - | |
| 117 | - return result; | |
| 118 | - } | |
| 119 | -} |
src/main/java/com/bsth/data/gpsdata/client/pf/handler/PfClientHandler.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pf.handler; | |
| 2 | - | |
| 3 | -import com.bsth.data.gpsdata.client.ClientApp; | |
| 4 | -import com.bsth.data.gpsdata.client.GpsBeforeBuffer; | |
| 5 | -import com.bsth.data.gpsdata.client.common.Protocol2BizUtil; | |
| 6 | -import com.bsth.data.gpsdata.client.msg.IMessageBody; | |
| 7 | -import com.bsth.data.gpsdata.client.pd.protocol.BasicInfo; | |
| 8 | -import com.bsth.data.gpsdata.client.pf.protocol.PfMessage; | |
| 9 | -import org.apache.mina.core.service.IoHandlerAdapter; | |
| 10 | -import org.apache.mina.core.session.IdleStatus; | |
| 11 | -import org.apache.mina.core.session.IoSession; | |
| 12 | -import org.slf4j.Logger; | |
| 13 | -import org.slf4j.LoggerFactory; | |
| 14 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 15 | -import org.springframework.stereotype.Service; | |
| 16 | - | |
| 17 | -import java.io.IOException; | |
| 18 | - | |
| 19 | -@Service | |
| 20 | -public class PfClientHandler extends IoHandlerAdapter{ | |
| 21 | - | |
| 22 | - private final static Logger log = LoggerFactory.getLogger(PfClientHandler.class); | |
| 23 | - | |
| 24 | - //@Autowired | |
| 25 | - //private MessageProcessor processor; | |
| 26 | - | |
| 27 | - @Autowired | |
| 28 | - GpsBeforeBuffer gpsBeforeBuffer; | |
| 29 | - | |
| 30 | - @Override | |
| 31 | - public void sessionCreated(IoSession session) throws Exception { | |
| 32 | - | |
| 33 | - } | |
| 34 | - | |
| 35 | - @Override | |
| 36 | - public void sessionOpened(IoSession session) throws Exception { | |
| 37 | - | |
| 38 | - } | |
| 39 | - | |
| 40 | - @Override | |
| 41 | - public void sessionClosed(IoSession session) throws Exception { | |
| 42 | - String deviceId = (String)session.getAttribute("deviceId"); | |
| 43 | - if (deviceId != null) { | |
| 44 | - //SessionManager.getInstance().unregister(deviceId); | |
| 45 | - log.info("连老网关设备编号:" + deviceId + "断开连接"); | |
| 46 | - log.warn(deviceId + "老网关设备注销"); | |
| 47 | - ClientApp.fconnect(deviceId); | |
| 48 | - } | |
| 49 | - } | |
| 50 | - | |
| 51 | - @Override | |
| 52 | - public void sessionIdle(IoSession session, IdleStatus status) throws Exception { | |
| 53 | - session.closeNow(); | |
| 54 | - } | |
| 55 | - | |
| 56 | - @Override | |
| 57 | - public void exceptionCaught(IoSession session, Throwable cause) throws Exception { | |
| 58 | - if (cause instanceof IOException) session.closeNow(); | |
| 59 | - log.error("PfClientHandler exceptionCaught", cause); | |
| 60 | - } | |
| 61 | - | |
| 62 | - @Override | |
| 63 | - public void messageReceived(IoSession session, Object message) throws Exception { | |
| 64 | - PfMessage msg = (PfMessage)message; | |
| 65 | - IMessageBody body = msg.getMessageBody(); | |
| 66 | - if (body != null) { | |
| 67 | - String deviceId = body.getDeviceId(); | |
| 68 | - if (0x1 == msg.getCommandType()) { | |
| 69 | - log.debug("设备编号:" + body.getDeviceId() + "建立连接"); | |
| 70 | - } | |
| 71 | - | |
| 72 | - BasicInfo info = Protocol2BizUtil.getBasicInfoFromMsg(msg); | |
| 73 | - gpsBeforeBuffer.put(info); | |
| 74 | - } | |
| 75 | - | |
| 76 | - } | |
| 77 | - | |
| 78 | - @Override | |
| 79 | - public void messageSent(IoSession session, Object message) throws Exception { | |
| 80 | - | |
| 81 | - } | |
| 82 | -} |
src/main/java/com/bsth/data/gpsdata/client/pf/protocol/PfFactory.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pf.protocol; | |
| 2 | - | |
| 3 | - | |
| 4 | -import com.bsth.data.gpsdata.client.msg.IMessageBody; | |
| 5 | - | |
| 6 | -public class PfFactory { | |
| 7 | - | |
| 8 | - public static IMessageBody create(int commandType, byte[] data) { | |
| 9 | - String pkgName = PfFactory.class.getPackage().getName(); | |
| 10 | - IMessageBody body = null; | |
| 11 | - try { | |
| 12 | - Class<?> cls = Class.forName(pkgName + ".Pf_" + Integer.toHexString(commandType).toUpperCase() + "_0"); | |
| 13 | - body = (IMessageBody)cls.newInstance(); | |
| 14 | - body.read(data); | |
| 15 | - } catch (ClassNotFoundException e) { | |
| 16 | - // TODO Auto-generated catch block | |
| 17 | - //e.printStackTrace(); | |
| 18 | - } catch (InstantiationException e) { | |
| 19 | - // TODO Auto-generated catch block | |
| 20 | - e.printStackTrace(); | |
| 21 | - } catch (IllegalAccessException e) { | |
| 22 | - // TODO Auto-generated catch block | |
| 23 | - e.printStackTrace(); | |
| 24 | - } | |
| 25 | - return body; | |
| 26 | - } | |
| 27 | -} |
src/main/java/com/bsth/data/gpsdata/client/pf/protocol/PfMessage.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pf.protocol; | |
| 2 | - | |
| 3 | -import com.bsth.data.gpsdata.client.msg.IMessage; | |
| 4 | -import com.bsth.data.gpsdata.client.msg.IMessageBody; | |
| 5 | - | |
| 6 | -import java.util.Arrays; | |
| 7 | - | |
| 8 | -public class PfMessage implements IMessage { | |
| 9 | - | |
| 10 | - private short version; | |
| 11 | - private short serialNo; | |
| 12 | - private short commandType; | |
| 13 | - private IMessageBody messageBody; | |
| 14 | - private byte checkSum; | |
| 15 | - | |
| 16 | - public short getVersion() { | |
| 17 | - return version; | |
| 18 | - } | |
| 19 | - | |
| 20 | - public void setVersion(short version) { | |
| 21 | - this.version = version; | |
| 22 | - } | |
| 23 | - | |
| 24 | - public short getSerialNo() { | |
| 25 | - return serialNo; | |
| 26 | - } | |
| 27 | - | |
| 28 | - public void setSerialNo(short serialNo) { | |
| 29 | - this.serialNo = serialNo; | |
| 30 | - } | |
| 31 | - | |
| 32 | - public short getCommandType() { | |
| 33 | - return commandType; | |
| 34 | - } | |
| 35 | - | |
| 36 | - public void setCommandType(short commandType) { | |
| 37 | - this.commandType = commandType; | |
| 38 | - } | |
| 39 | - | |
| 40 | - public IMessageBody getMessageBody() { | |
| 41 | - return messageBody; | |
| 42 | - } | |
| 43 | - | |
| 44 | - public void setMessageBody(IMessageBody messageBody) { | |
| 45 | - this.messageBody = messageBody; | |
| 46 | - } | |
| 47 | - | |
| 48 | - public byte getCheckSum() { | |
| 49 | - return checkSum; | |
| 50 | - } | |
| 51 | - | |
| 52 | - public void setCheckSum(byte checkSum) { | |
| 53 | - this.checkSum = checkSum; | |
| 54 | - } | |
| 55 | - | |
| 56 | - public void read(byte[] data) { | |
| 57 | - int idx = 0, len = data.length; | |
| 58 | - //version = (short)(data[idx] & 0xff); idx++; | |
| 59 | - //serialNo = (short)(data[idx] & 0xff); idx++; | |
| 60 | - commandType = (short)(data[idx] & 0xff); idx++; | |
| 61 | - byte[] temp = Arrays.copyOfRange(data, idx, len - 1); | |
| 62 | - checkSum = data[len - 1]; | |
| 63 | - if (0xff == (checkSum & 0xff)) { | |
| 64 | - try { | |
| 65 | - messageBody = PfFactory.create(commandType, temp); | |
| 66 | - } catch (Exception e) { | |
| 67 | - | |
| 68 | - } | |
| 69 | - } | |
| 70 | - } | |
| 71 | - | |
| 72 | - public byte[] write() { | |
| 73 | - return null; | |
| 74 | - } | |
| 75 | - | |
| 76 | - public String toString() { | |
| 77 | - StringBuilder sb = new StringBuilder(); | |
| 78 | - //sb.append("报文版本号:").append(version) | |
| 79 | - //.append("报文序列号:").append(serialNo) | |
| 80 | - sb.append("报文命令字:0x").append(Integer.toHexString(commandType)) | |
| 81 | - .append("报文主体:(").append(messageBody).append(")") | |
| 82 | - .append("报文校验和:").append(checkSum); | |
| 83 | - | |
| 84 | - return sb.toString(); | |
| 85 | - } | |
| 86 | -} |
src/main/java/com/bsth/data/gpsdata/client/pf/protocol/Pf_1_0.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.client.pf.protocol; | |
| 2 | - | |
| 3 | -import com.bsth.data.gpsdata.client.msg.IMessageBody; | |
| 4 | -import com.bsth.data.gpsdata.client.pd.common.ConvertUtil; | |
| 5 | - | |
| 6 | -import java.nio.ByteBuffer; | |
| 7 | -import java.util.Date; | |
| 8 | - | |
| 9 | - | |
| 10 | -public class Pf_1_0 implements IMessageBody { | |
| 11 | - | |
| 12 | - /** 1、车载终端识别码-byte[8] */ | |
| 13 | - private String mtd; | |
| 14 | - /** 2、司机工号-byte[8] */ | |
| 15 | - private String driver; | |
| 16 | - /** 3、包车状态-byte[1] */ | |
| 17 | - private int bczt; | |
| 18 | - /** 4、线路状态-byte[1] */ | |
| 19 | - private int xlzt; | |
| 20 | - /** 5、线路代码-byte[6] */ | |
| 21 | - private int xldm; | |
| 22 | - /** 6、营运状态-byte[1] */ | |
| 23 | - private int yyzt; | |
| 24 | - /** 7、进出站状态-byte[1] */ | |
| 25 | - private int jczzt; | |
| 26 | - /** 8、站点编号-byte[8] */ | |
| 27 | - private String zdbh; | |
| 28 | - /** 9、进出停车场状态(0:厂内,1:厂外,2:未知)-byte[1] */ | |
| 29 | - private int jctcczt; | |
| 30 | - /** 10、停车场编号-byte[8] */ | |
| 31 | - private String tccbh; | |
| 32 | - /** 11、路段编码-byte[12] */ | |
| 33 | - private String ldbh; | |
| 34 | - /** 12、上下行状态-byte[1] */ | |
| 35 | - private int sxxzt; | |
| 36 | - /** 13、速度-byte[1] */ | |
| 37 | - private int speed; | |
| 38 | - /** 14、初始异常状态-byte[1] */ | |
| 39 | - private int csyczt; | |
| 40 | - /** 15、结束异常状态-byte[1] */ | |
| 41 | - private int jsyczt; | |
| 42 | - /** 16、车辆位置经度(纠偏后)-byte[4] */ | |
| 43 | - private double lon; | |
| 44 | - /** 17、车辆位置维度(纠偏后)-byte[4] */ | |
| 45 | - private double lat; | |
| 46 | - /** 18、方向-byte[2] */ | |
| 47 | - private int fx; | |
| 48 | - /** 19、发送时间-byte[4] */ | |
| 49 | - private Date fssj; | |
| 50 | - /** 20、离下站距离-byte[2] */ | |
| 51 | - private int lxzjl; | |
| 52 | - /** 21、本站留车人数-byte[2] */ | |
| 53 | - private int bzlcrs; | |
| 54 | - /** 22、车辆位置经度(未纠偏)-byte[4] */ | |
| 55 | - private double lon_old; | |
| 56 | - /** 23、车辆位置经度(未纠偏)-byte[4] */ | |
| 57 | - private double lat_old; | |
| 58 | - /** 24、城建X坐标 */ | |
| 59 | - private double x; | |
| 60 | - /** 25、城建Y坐标 */ | |
| 61 | - private double y; | |
| 62 | - | |
| 63 | - public String getMtd() { | |
| 64 | - return mtd; | |
| 65 | - } | |
| 66 | - | |
| 67 | - public void setMtd(String mtd) { | |
| 68 | - this.mtd = mtd; | |
| 69 | - } | |
| 70 | - | |
| 71 | - public String getDriver() { | |
| 72 | - return driver; | |
| 73 | - } | |
| 74 | - | |
| 75 | - public void setDriver(String driver) { | |
| 76 | - this.driver = driver; | |
| 77 | - } | |
| 78 | - | |
| 79 | - public int getBczt() { | |
| 80 | - return bczt; | |
| 81 | - } | |
| 82 | - | |
| 83 | - public void setBczt(int bczt) { | |
| 84 | - this.bczt = bczt; | |
| 85 | - } | |
| 86 | - | |
| 87 | - public int getXlzt() { | |
| 88 | - return xlzt; | |
| 89 | - } | |
| 90 | - | |
| 91 | - public void setXlzt(int xlzt) { | |
| 92 | - this.xlzt = xlzt; | |
| 93 | - } | |
| 94 | - | |
| 95 | - public int getXldm() { | |
| 96 | - return xldm; | |
| 97 | - } | |
| 98 | - | |
| 99 | - public void setXldm(int xldm) { | |
| 100 | - this.xldm = xldm; | |
| 101 | - } | |
| 102 | - | |
| 103 | - public int getYyzt() { | |
| 104 | - return yyzt; | |
| 105 | - } | |
| 106 | - | |
| 107 | - public void setYyzt(int yyzt) { | |
| 108 | - this.yyzt = yyzt; | |
| 109 | - } | |
| 110 | - | |
| 111 | - public int getJczzt() { | |
| 112 | - return jczzt; | |
| 113 | - } | |
| 114 | - | |
| 115 | - public void setJczzt(int jczzt) { | |
| 116 | - this.jczzt = jczzt; | |
| 117 | - } | |
| 118 | - | |
| 119 | - public String getZdbh() { | |
| 120 | - return zdbh; | |
| 121 | - } | |
| 122 | - | |
| 123 | - public void setZdbh(String zdbh) { | |
| 124 | - this.zdbh = zdbh; | |
| 125 | - } | |
| 126 | - | |
| 127 | - public int getJctcczt() { | |
| 128 | - return jctcczt; | |
| 129 | - } | |
| 130 | - | |
| 131 | - public void setJctcczt(int jctcczt) { | |
| 132 | - this.jctcczt = jctcczt; | |
| 133 | - } | |
| 134 | - | |
| 135 | - public String getTccbh() { | |
| 136 | - return tccbh; | |
| 137 | - } | |
| 138 | - | |
| 139 | - public void setTccbh(String tccbh) { | |
| 140 | - this.tccbh = tccbh; | |
| 141 | - } | |
| 142 | - | |
| 143 | - public String getLdbh() { | |
| 144 | - return ldbh; | |
| 145 | - } | |
| 146 | - | |
| 147 | - public void setLdbh(String ldbh) { | |
| 148 | - this.ldbh = ldbh; | |
| 149 | - } | |
| 150 | - | |
| 151 | - public int getSxxzt() { | |
| 152 | - return sxxzt; | |
| 153 | - } | |
| 154 | - | |
| 155 | - public void setSxxzt(int sxxzt) { | |
| 156 | - this.sxxzt = sxxzt; | |
| 157 | - } | |
| 158 | - | |
| 159 | - public int getSpeed() { | |
| 160 | - return speed; | |
| 161 | - } | |
| 162 | - | |
| 163 | - public void setSpeed(int speed) { | |
| 164 | - this.speed = speed; | |
| 165 | - } | |
| 166 | - | |
| 167 | - public int getCsyczt() { | |
| 168 | - return csyczt; | |
| 169 | - } | |
| 170 | - | |
| 171 | - public void setCsyczt(int csyczt) { | |
| 172 | - this.csyczt = csyczt; | |
| 173 | - } | |
| 174 | - | |
| 175 | - public int getJsyczt() { | |
| 176 | - return jsyczt; | |
| 177 | - } | |
| 178 | - | |
| 179 | - public void setJsyczt(int jsyczt) { | |
| 180 | - this.jsyczt = jsyczt; | |
| 181 | - } | |
| 182 | - | |
| 183 | - public double getLon() { | |
| 184 | - return lon; | |
| 185 | - } | |
| 186 | - | |
| 187 | - public void setLon(double lon) { | |
| 188 | - this.lon = lon; | |
| 189 | - } | |
| 190 | - | |
| 191 | - public double getLat() { | |
| 192 | - return lat; | |
| 193 | - } | |
| 194 | - | |
| 195 | - public void setLat(double lat) { | |
| 196 | - this.lat = lat; | |
| 197 | - } | |
| 198 | - | |
| 199 | - public int getFx() { | |
| 200 | - return fx; | |
| 201 | - } | |
| 202 | - | |
| 203 | - public void setFx(int fx) { | |
| 204 | - this.fx = fx; | |
| 205 | - } | |
| 206 | - | |
| 207 | - public Date getFssj() { | |
| 208 | - return fssj; | |
| 209 | - } | |
| 210 | - | |
| 211 | - public void setFssj(Date fssj) { | |
| 212 | - this.fssj = fssj; | |
| 213 | - } | |
| 214 | - | |
| 215 | - public int getLxzjl() { | |
| 216 | - return lxzjl; | |
| 217 | - } | |
| 218 | - | |
| 219 | - public void setLxzjl(int lxzjl) { | |
| 220 | - this.lxzjl = lxzjl; | |
| 221 | - } | |
| 222 | - | |
| 223 | - public int getBzlcrs() { | |
| 224 | - return bzlcrs; | |
| 225 | - } | |
| 226 | - | |
| 227 | - public void setBzlcrs(int bzlcrs) { | |
| 228 | - this.bzlcrs = bzlcrs; | |
| 229 | - } | |
| 230 | - | |
| 231 | - public double getLon_old() { | |
| 232 | - return lon_old; | |
| 233 | - } | |
| 234 | - | |
| 235 | - public void setLon_old(double lon_old) { | |
| 236 | - this.lon_old = lon_old; | |
| 237 | - } | |
| 238 | - | |
| 239 | - public double getLat_old() { | |
| 240 | - return lat_old; | |
| 241 | - } | |
| 242 | - | |
| 243 | - public void setLat_old(double lat_old) { | |
| 244 | - this.lat_old = lat_old; | |
| 245 | - } | |
| 246 | - | |
| 247 | - public double getX() { | |
| 248 | - return x; | |
| 249 | - } | |
| 250 | - | |
| 251 | - public void setX(double x) { | |
| 252 | - this.x = x; | |
| 253 | - } | |
| 254 | - | |
| 255 | - public double getY() { | |
| 256 | - return y; | |
| 257 | - } | |
| 258 | - | |
| 259 | - public void setY(double y) { | |
| 260 | - this.y = y; | |
| 261 | - } | |
| 262 | - | |
| 263 | - public byte[] write() { | |
| 264 | - return null; | |
| 265 | - } | |
| 266 | - | |
| 267 | - @Override | |
| 268 | - public void read(byte[] bytes) { | |
| 269 | - // TODO Auto-generated method stub | |
| 270 | - int idx = 0; | |
| 271 | - ByteBuffer buf = ByteBuffer.wrap(bytes); | |
| 272 | - mtd = ConvertUtil.ascii2string(bytes, idx, 8); idx += 8; | |
| 273 | - driver = ConvertUtil.ascii2string(bytes, idx, 8); idx += 8; | |
| 274 | - bczt = buf.get(idx); idx++; | |
| 275 | - xlzt = buf.get(idx); idx++; | |
| 276 | - xldm = Integer.parseInt(ConvertUtil.ascii2string(bytes, idx, 6).trim()); idx += 6; | |
| 277 | - yyzt = buf.get(idx); idx++; | |
| 278 | - jczzt = buf.get(idx); idx++; | |
| 279 | - zdbh = ConvertUtil.ascii2string(bytes, idx, 8).trim(); idx += 8; | |
| 280 | - jctcczt = buf.get(idx); idx++; | |
| 281 | - tccbh = ConvertUtil.ascii2string(bytes, idx, 8); idx += 8; | |
| 282 | - ldbh = ConvertUtil.ascii2string(bytes, idx, 12).trim(); idx += 12; | |
| 283 | - sxxzt = buf.get(idx); idx++; | |
| 284 | - speed = buf.get(idx)*10; idx++; | |
| 285 | - csyczt = buf.get(idx); idx++; | |
| 286 | - jsyczt = buf.get(idx); idx++; | |
| 287 | - byte flagx = buf.get(idx); idx++; | |
| 288 | - if (flagx == 0) x = ConvertUtil.bytes2int(bytes, idx, 3)/100.0; | |
| 289 | - else x = -ConvertUtil.bytes2int(bytes, idx, 3)/100.0; | |
| 290 | - idx += 3; | |
| 291 | - byte flagy = buf.get(idx); idx++; | |
| 292 | - if (flagy == 0) y = ConvertUtil.bytes2int(bytes, idx, 3)/100.0; | |
| 293 | - else y = -ConvertUtil.bytes2int(bytes, idx, 3)/100.0; | |
| 294 | - idx += 3; | |
| 295 | - fx = buf.getShort(idx)*(short)10; idx += 2; | |
| 296 | - fssj = new Date(ConvertUtil.bytes2int(bytes, idx, 4) * 1000L); idx += 4; | |
| 297 | - lxzjl = buf.getShort(idx); idx += 2; | |
| 298 | - bzlcrs = buf.getShort(idx); idx += 2; | |
| 299 | - lon = ConvertUtil.bytes2int(bytes, idx, 4); idx += 4; | |
| 300 | - lat = ConvertUtil.bytes2int(bytes, idx, 4); idx += 4; | |
| 301 | - } | |
| 302 | - | |
| 303 | - @Override | |
| 304 | - public String getDeviceId() { | |
| 305 | - // TODO Auto-generated method stub | |
| 306 | - return mtd; | |
| 307 | - } | |
| 308 | - | |
| 309 | - @Override | |
| 310 | - public long getTimestamp() { | |
| 311 | - // TODO Auto-generated method stub | |
| 312 | - return 0; | |
| 313 | - } | |
| 314 | -} |
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
| ... | ... | @@ -45,11 +45,11 @@ public class GpsDataRecovery implements ApplicationContextAware { |
| 45 | 45 | public void recovery() { |
| 46 | 46 | List<GpsEntity> list = loadData(); |
| 47 | 47 | |
| 48 | - //按车辆分组数据 | |
| 48 | + //按线路分组数据 | |
| 49 | 49 | ArrayListMultimap<String, GpsEntity> listMap = ArrayListMultimap.create(); |
| 50 | 50 | for (GpsEntity gps : list) { |
| 51 | - if (gps.getNbbm() != null) | |
| 52 | - listMap.put(gps.getNbbm(), gps); | |
| 51 | + if (gps.getLineId() != null) | |
| 52 | + listMap.put(gps.getLineId(), gps); | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
| ... | ... | @@ -57,9 +57,9 @@ public class GpsDataRecovery implements ApplicationContextAware { |
| 57 | 57 | |
| 58 | 58 | CountDownLatch count = new CountDownLatch(keys.size()); |
| 59 | 59 | GpsComp comp = new GpsComp(); |
| 60 | - for (String nbbm : keys) { | |
| 61 | - Collections.sort(listMap.get(nbbm), comp); | |
| 62 | - threadPool.execute(new RecoveryThread(listMap.get(nbbm), count)); | |
| 60 | + for (String lineId : keys) { | |
| 61 | + Collections.sort(listMap.get(lineId), comp); | |
| 62 | + threadPool.execute(new RecoveryThread(listMap.get(lineId), count)); | |
| 63 | 63 | /*if(nbbm.equals("W7C-001")) |
| 64 | 64 | new RecoveryThread(listMap.get(nbbm), count).run();*/ |
| 65 | 65 | } | ... | ... |
src/main/java/com/bsth/data/schedule/SchModifyLog.java
0 → 100644
| 1 | +package com.bsth.data.schedule; | |
| 2 | + | |
| 3 | +import com.bsth.controller.realcontrol.dto.ChangePersonCar; | |
| 4 | +import com.bsth.entity.mcy_forms.Changetochange; | |
| 5 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 6 | +import com.bsth.entity.sys.SysUser; | |
| 7 | +import com.bsth.repository.form.ChangetochangeRepository; | |
| 8 | +import com.bsth.security.util.SecurityUtils; | |
| 9 | +import org.apache.commons.lang3.StringUtils; | |
| 10 | +import org.joda.time.format.DateTimeFormat; | |
| 11 | +import org.joda.time.format.DateTimeFormatter; | |
| 12 | +import org.slf4j.Logger; | |
| 13 | +import org.slf4j.LoggerFactory; | |
| 14 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 15 | +import org.springframework.stereotype.Service; | |
| 16 | + | |
| 17 | +import java.util.Date; | |
| 18 | + | |
| 19 | +/** | |
| 20 | + * 线调实际排班修改日志记录 | |
| 21 | + * Created by panzhao on 2017/5/7. | |
| 22 | + */ | |
| 23 | +@Service | |
| 24 | +public class SchModifyLog { | |
| 25 | + | |
| 26 | + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | |
| 27 | + | |
| 28 | + Logger log = LoggerFactory.getLogger(this.getClass()); | |
| 29 | + | |
| 30 | + @Autowired | |
| 31 | + ChangetochangeRepository changetochangeRepository; | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 换人换车情况表 | |
| 35 | + */ | |
| 36 | + public void saveChangetochange(ScheduleRealInfo sch, ChangePersonCar cpc){ | |
| 37 | + try { | |
| 38 | + String newNbbm = cpc.getClZbh(); | |
| 39 | + String newJsy = cpc.getJsy(); | |
| 40 | + String oldJsy = sch.getjGh()+"/"+sch.getjName(); | |
| 41 | + | |
| 42 | + if(newNbbm == null && newJsy == null) | |
| 43 | + return; | |
| 44 | + | |
| 45 | + if(newNbbm != null && newJsy != null | |
| 46 | + && newNbbm.equals(sch.getClZbh()) && newJsy.equals(oldJsy)) | |
| 47 | + return; | |
| 48 | + | |
| 49 | + Date d = new Date(); | |
| 50 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 51 | + Changetochange cc = new Changetochange(); | |
| 52 | + cc.setRq(sch.getScheduleDateStr()); | |
| 53 | + cc.setGs(sch.getGsBm()); | |
| 54 | + cc.setFgs(sch.getFgsBm()); | |
| 55 | + cc.setXl(sch.getXlBm()); | |
| 56 | + cc.setLp(sch.getLpName()); | |
| 57 | + cc.setFssj(fmtHHmm.print(d.getTime())); | |
| 58 | + cc.setXgsj(fmtHHmm.print(d.getTime())); | |
| 59 | + if(user != null) | |
| 60 | + cc.setXgr(user.getUserName()); | |
| 61 | + | |
| 62 | + cc.setPcch(sch.getClZbh()); | |
| 63 | + cc.setPcry(oldJsy); | |
| 64 | + cc.setJhch(sch.getClZbh()); | |
| 65 | + cc.setJhgh(sch.getjGh()); | |
| 66 | + | |
| 67 | + if(StringUtils.isNotEmpty(newNbbm)) | |
| 68 | + cc.setSjch(newNbbm); | |
| 69 | + if(StringUtils.isNotEmpty(newJsy)) | |
| 70 | + cc.setSjgh(newJsy); | |
| 71 | + | |
| 72 | + changetochangeRepository.save(cc); | |
| 73 | + }catch (Exception e){ | |
| 74 | + log.error("纪录换人换车情况表", e); | |
| 75 | + } | |
| 76 | + } | |
| 77 | + | |
| 78 | + public void saveChangetochange(ScheduleRealInfo sch, String nbbm, String jsy){ | |
| 79 | + ChangePersonCar cpc = new ChangePersonCar(); | |
| 80 | + cpc.setClZbh(nbbm); | |
| 81 | + cpc.setJsy(jsy); | |
| 82 | + saveChangetochange(sch, cpc); | |
| 83 | + } | |
| 84 | +} | ... | ... |
src/main/java/com/bsth/entity/CarPark.java
| ... | ... | @@ -3,6 +3,9 @@ package com.bsth.entity; |
| 3 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 4 | 4 | |
| 5 | 5 | import javax.persistence.*; |
| 6 | + | |
| 7 | +import org.hibernate.annotations.Formula; | |
| 8 | + | |
| 6 | 9 | import java.util.Date; |
| 7 | 10 | |
| 8 | 11 | |
| ... | ... | @@ -77,6 +80,10 @@ public class CarPark { |
| 77 | 80 | // 分公司 |
| 78 | 81 | private String brancheCompany; |
| 79 | 82 | |
| 83 | + /** 组合公司分公司编码 */ | |
| 84 | + @Formula(" concat(company, '_', branche_company) ") | |
| 85 | + private String cgsbm; | |
| 86 | + | |
| 80 | 87 | // 是否撤销 |
| 81 | 88 | private Integer destroy; |
| 82 | 89 | |
| ... | ... | @@ -99,6 +106,14 @@ public class CarPark { |
| 99 | 106 | // 修改日期 |
| 100 | 107 | @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") |
| 101 | 108 | private Date updateDate; |
| 109 | + | |
| 110 | + public String getCgsbm() { | |
| 111 | + return cgsbm; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void setCgsbm(String cgsbm) { | |
| 115 | + this.cgsbm = cgsbm; | |
| 116 | + } | |
| 102 | 117 | |
| 103 | 118 | public Integer getId() { |
| 104 | 119 | return id; | ... | ... |
src/main/java/com/bsth/entity/schedule/temp/SchedulePlanRuleResult.java
| ... | ... | @@ -27,6 +27,8 @@ public class SchedulePlanRuleResult { |
| 27 | 27 | |
| 28 | 28 | /** 排班规则id */ |
| 29 | 29 | private String ruleId; |
| 30 | + /** 启用日期 */ | |
| 31 | + private Date qyrq; | |
| 30 | 32 | /** 车辆配置id */ |
| 31 | 33 | private String ccId; |
| 32 | 34 | /** 车辆自编号 */ |
| ... | ... | @@ -249,4 +251,12 @@ public class SchedulePlanRuleResult { |
| 249 | 251 | public void setCreateDate(Date createDate) { |
| 250 | 252 | this.createDate = createDate; |
| 251 | 253 | } |
| 254 | + | |
| 255 | + public Date getQyrq() { | |
| 256 | + return qyrq; | |
| 257 | + } | |
| 258 | + | |
| 259 | + public void setQyrq(Date qyrq) { | |
| 260 | + this.qyrq = qyrq; | |
| 261 | + } | |
| 252 | 262 | } | ... | ... |
src/main/java/com/bsth/repository/CarParkRepository.java
| ... | ... | @@ -107,4 +107,7 @@ public interface CarParkRepository extends BaseRepository<CarPark, Integer>{ |
| 107 | 107 | |
| 108 | 108 | @Query(value = "select st_astext(g_park_point), shapes_type, g_center_point, radius,park_code,park_name from bsth_c_car_park where park_code=?1", nativeQuery = true) |
| 109 | 109 | public Object[][] bufferAera(String parkCode); |
| 110 | + | |
| 111 | + @Query(value ="SELECT p.park_name,p.park_code from bsth_c_car_park p where p.park_code = ?1", nativeQuery=true) | |
| 112 | + List<Object[]> selectTccInfoByCode(String parkCode); | |
| 110 | 113 | } | ... | ... |
src/main/java/com/bsth/repository/form/ChangetochangeRepository.java
0 → 100644
| 1 | +package com.bsth.repository.form; | |
| 2 | + | |
| 3 | +import com.bsth.entity.mcy_forms.Changetochange; | |
| 4 | +import com.bsth.repository.BaseRepository; | |
| 5 | +import org.springframework.stereotype.Repository; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Created by panzhao on 2017/5/7. | |
| 9 | + */ | |
| 10 | +@Repository | |
| 11 | +public interface ChangetochangeRepository extends BaseRepository<Changetochange, Integer>{ | |
| 12 | +} | ... | ... |
src/main/java/com/bsth/service/CarParkService.java
src/main/java/com/bsth/service/impl/CarParkServiceImpl.java
| ... | ... | @@ -26,55 +26,30 @@ public class CarParkServiceImpl extends BaseServiceImpl<CarPark, Integer> implem |
| 26 | 26 | |
| 27 | 27 | @Override |
| 28 | 28 | public Map<String, Object> carParkSave(Map<String, Object> map) { |
| 29 | - | |
| 30 | 29 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 31 | - | |
| 32 | 30 | try { |
| 33 | - | |
| 34 | 31 | // 停车场编码 |
| 35 | 32 | String parkCode = map.get("parkCode").equals("") ? null : map.get("parkCode").toString(); |
| 36 | - | |
| 37 | - // 停车场id | |
| 38 | - // Integer id = Integer.parseInt(parkCode); | |
| 39 | - | |
| 40 | 33 | // 停车场名称 |
| 41 | 34 | String parkName = map.get("parkName").equals("") ? "" : map.get("parkName").toString(); |
| 42 | - | |
| 43 | 35 | // 地理位置(百度坐标集合) |
| 44 | 36 | String bParkPoint = map.get("bParkPoint").equals("") ? "" : map.get("bParkPoint").toString(); |
| 45 | - | |
| 46 | - // 地理位置(WGS坐标集合) | |
| 47 | - // String gParkPoint = map.get("gParkPoint").equals("") ? "" :map.get("gParkPoint").toString(); | |
| 48 | - | |
| 49 | 37 | // 多边形WGS坐标点集合 |
| 50 | 38 | String gParkPoint =""; |
| 51 | - | |
| 52 | 39 | if(!bParkPoint.equals("")) { |
| 53 | - | |
| 54 | 40 | String bPloygonGridArray[] = bParkPoint.split(","); |
| 55 | - | |
| 56 | 41 | int bLen_ = bPloygonGridArray.length; |
| 57 | - | |
| 58 | 42 | for(int b = 0 ;b<bLen_;b++) { |
| 59 | - | |
| 60 | 43 | String tempArray[]= bPloygonGridArray[b].split(" "); |
| 61 | - | |
| 62 | 44 | Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]); |
| 63 | - | |
| 64 | 45 | if(b==0) { |
| 65 | - | |
| 66 | 46 | gParkPoint = resultPoint.getLng() + " " + resultPoint.getLat(); |
| 67 | - | |
| 68 | 47 | }else { |
| 69 | - | |
| 70 | 48 | gParkPoint = gParkPoint + ',' + resultPoint.getLng() + " " + resultPoint.getLat(); |
| 71 | - | |
| 72 | 49 | } |
| 73 | - | |
| 74 | 50 | } |
| 75 | 51 | |
| 76 | 52 | } |
| 77 | - | |
| 78 | 53 | if(bParkPoint.equals("")) |
| 79 | 54 | bParkPoint = null; |
| 80 | 55 | else |
| ... | ... | @@ -84,169 +59,92 @@ public class CarParkServiceImpl extends BaseServiceImpl<CarPark, Integer> implem |
| 84 | 59 | gParkPoint = null; |
| 85 | 60 | else |
| 86 | 61 | gParkPoint = "POLYGON((" + gParkPoint +"))"; |
| 87 | - | |
| 88 | - /*bParkPoint = "POLYGON((" + bParkPoint +"))"; | |
| 89 | - | |
| 90 | - gParkPoint = "POLYGON((" + gParkPoint +"))";*/ | |
| 91 | - | |
| 92 | 62 | // 地理位置中心点(百度坐标) |
| 93 | 63 | String bCenterPoint = map.get("bCenterPoint").equals("") ? "" : map.get("bCenterPoint").toString(); |
| 94 | - | |
| 95 | - // 地理位置中心点(WGS坐标) | |
| 96 | - // String gCenterPoint = map.get("gCenterPoint").equals("") ? "" : map.get("gCenterPoint").toString(); | |
| 97 | - | |
| 98 | 64 | String bJwpointsArray[] =null; |
| 99 | - | |
| 100 | 65 | if(bCenterPoint!=null) { |
| 101 | - | |
| 102 | 66 | bJwpointsArray = bCenterPoint.split(" "); |
| 103 | - | |
| 104 | 67 | } |
| 105 | - | |
| 106 | 68 | String gCenterPoint = null; |
| 107 | - | |
| 108 | 69 | if(bJwpointsArray.length>0) { |
| 109 | - | |
| 110 | 70 | Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]); |
| 111 | - | |
| 112 | 71 | gCenterPoint = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); |
| 113 | - | |
| 114 | 72 | } |
| 115 | - | |
| 116 | 73 | // 坐标类型 |
| 117 | 74 | String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); |
| 118 | - | |
| 119 | 75 | // 图形类型 |
| 120 | 76 | String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); |
| 121 | - | |
| 122 | 77 | // 半径 |
| 123 | 78 | Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString()); |
| 124 | - | |
| 125 | 79 | // 面积 |
| 126 | 80 | Double area = map.get("area").equals("") ? 0.0 : Double.parseDouble(map.get("area").toString()); |
| 127 | - | |
| 128 | 81 | // 公司 |
| 129 | 82 | String company = map.get("company").equals("") ? "" : map.get("company").toString(); |
| 130 | - | |
| 131 | 83 | // 分公司 |
| 132 | - /*String brancheCompany = map.get("brancheCompany").equals("") ? "" : map.get("brancheCompany").toString();*/ | |
| 133 | - String brancheCompany=""; | |
| 134 | - | |
| 84 | + String brancheCompany = map.get("brancheCompany").equals("") ? "" : map.get("brancheCompany").toString(); | |
| 135 | 85 | // 是否撤销 |
| 136 | 86 | Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); |
| 137 | - | |
| 138 | 87 | // 版本号 |
| 139 | 88 | Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString()); |
| 140 | - | |
| 141 | 89 | // 描述与说明 |
| 142 | 90 | String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); |
| 143 | - | |
| 144 | 91 | SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); |
| 145 | - | |
| 146 | 92 | Date date = new Date(); |
| 147 | - | |
| 148 | 93 | // 创建日期 |
| 149 | 94 | String createDate = formatter.format(date); |
| 150 | - | |
| 151 | 95 | // 修改日期 |
| 152 | 96 | String updateDate = formatter.format(date); |
| 153 | - | |
| 154 | 97 | // 创建人 |
| 155 | 98 | Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString()); |
| 156 | - | |
| 157 | 99 | // 修改人 |
| 158 | 100 | Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString()); |
| 159 | - | |
| 160 | - | |
| 161 | - | |
| 162 | - | |
| 163 | 101 | carParkRepository.carParkSave(area, company, parkCode, parkName, |
| 164 | - | |
| 165 | 102 | brancheCompany, createBy, createDate, descriptions, destroy, |
| 166 | - | |
| 167 | 103 | updateBy, updateDate, versions, bCenterPoint, bParkPoint, |
| 168 | - | |
| 169 | 104 | dbType, gCenterPoint, gParkPoint, radius, shapesType); |
| 170 | - | |
| 171 | 105 | resultMap.put("status", ResponseCode.SUCCESS); |
| 172 | - | |
| 173 | 106 | } catch (Exception e) { |
| 174 | - | |
| 175 | 107 | resultMap.put("status", ResponseCode.ERROR); |
| 176 | - | |
| 177 | 108 | logger.error("save erro.", e); |
| 178 | - | |
| 179 | 109 | } |
| 180 | - | |
| 181 | 110 | return resultMap; |
| 182 | 111 | } |
| 183 | 112 | |
| 184 | 113 | @Override |
| 185 | 114 | public List<Map<String, Object>> findCarParkInfoFormId(Map<String, Object> map) { |
| 186 | - | |
| 187 | 115 | // 获取线路ID |
| 188 | 116 | Integer id = map.get("id").equals("") ? 0 : Integer.parseInt(map.get("id").toString()); |
| 189 | - | |
| 190 | 117 | List<Object[]> objects = carParkRepository.findCarParkInfoFormId(id); |
| 191 | - | |
| 192 | 118 | List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); |
| 193 | - | |
| 194 | 119 | int len = objects.size(); |
| 195 | - | |
| 196 | 120 | if(objects.size()>0) { |
| 197 | - | |
| 198 | 121 | for(int i = 0 ; i < len; i++) { |
| 199 | - | |
| 200 | 122 | Map<String, Object> tempM = new HashMap<String,Object>(); |
| 201 | - | |
| 202 | 123 | tempM.put("carParkId", objects.get(i)[0]); |
| 203 | - | |
| 204 | 124 | tempM.put("carParkArea", objects.get(i)[1]); |
| 205 | - | |
| 206 | 125 | tempM.put("carParkCompany", objects.get(i)[2]); |
| 207 | - | |
| 208 | 126 | tempM.put("carParkCode", objects.get(i)[3]); |
| 209 | - | |
| 210 | 127 | tempM.put("carParkName", objects.get(i)[4]); |
| 211 | - | |
| 212 | 128 | tempM.put("carParkBrancheCompany", objects.get(i)[5]); |
| 213 | - | |
| 214 | 129 | tempM.put("carParkCreateBy", objects.get(i)[6]); |
| 215 | - | |
| 216 | 130 | tempM.put("carParkCreateDate", objects.get(i)[7]); |
| 217 | - | |
| 218 | 131 | tempM.put("carParkDescriptions", objects.get(i)[8]); |
| 219 | - | |
| 220 | 132 | tempM.put("carParkDestroy", objects.get(i)[9]); |
| 221 | - | |
| 222 | 133 | tempM.put("carParkUpdate", objects.get(i)[10]); |
| 223 | - | |
| 224 | 134 | tempM.put("carParkUpdateDate", objects.get(i)[11]); |
| 225 | - | |
| 226 | 135 | tempM.put("carParkVersions", objects.get(i)[12]); |
| 227 | - | |
| 228 | 136 | tempM.put("carParkBcenterPoint", objects.get(i)[13]); |
| 229 | - | |
| 230 | 137 | tempM.put("carParkBparkPoint", objects.get(i)[14]); |
| 231 | - | |
| 232 | 138 | tempM.put("carParkGcenterPoint", objects.get(i)[15]); |
| 233 | - | |
| 234 | 139 | tempM.put("carParkGparkPoint", objects.get(i)[16]); |
| 235 | - | |
| 236 | 140 | tempM.put("carParkDBtype", objects.get(i)[17]); |
| 237 | - | |
| 238 | 141 | tempM.put("carParkRadius", objects.get(i)[18]); |
| 239 | - | |
| 240 | 142 | tempM.put("carParkShapesType", objects.get(i)[19]); |
| 241 | - | |
| 242 | 143 | resultList.add(tempM); |
| 243 | 144 | } |
| 244 | - | |
| 245 | 145 | } |
| 246 | - | |
| 247 | 146 | return resultList; |
| 248 | 147 | } |
| 249 | - | |
| 250 | 148 | /** |
| 251 | 149 | * 修改停车场信息 |
| 252 | 150 | * |
| ... | ... | @@ -265,90 +163,54 @@ public class CarParkServiceImpl extends BaseServiceImpl<CarPark, Integer> implem |
| 265 | 163 | @Override |
| 266 | 164 | public Map<String, Object> carParkUpdate(Map<String, Object> map) { |
| 267 | 165 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 268 | - | |
| 269 | 166 | try { |
| 270 | - | |
| 271 | 167 | // id |
| 272 | 168 | Integer id = map.get("id").equals("") ? null : Integer.parseInt(map.get("id").toString()); |
| 273 | - | |
| 274 | 169 | if(id!=null) { |
| 275 | - | |
| 276 | 170 | // 面积 |
| 277 | 171 | Double area = map.get("area").equals("") ? null : Double.parseDouble(map.get("area").toString()); |
| 278 | - | |
| 279 | 172 | // 中心点(百度坐标) |
| 280 | 173 | String bCenterPoint = map.get("bCenterPoint").equals("") ? "" : map.get("bCenterPoint").toString(); |
| 281 | - | |
| 282 | 174 | // 图形坐标点集合(百度坐标) |
| 283 | 175 | String bParkPoint = map.get("bParkPoint").equals("") ? "" : map.get("bParkPoint").toString(); |
| 284 | - | |
| 285 | 176 | // 分公司 |
| 286 | - /*String brancheCompany = map.get("brancheCompany").equals("")? "" :map.get("brancheCompany").toString();*/ | |
| 287 | - String brancheCompany = ""; | |
| 288 | - | |
| 177 | + String brancheCompany = map.get("brancheCompany").equals("")? "" :map.get("brancheCompany").toString(); | |
| 178 | + //String brancheCompany = ""; | |
| 289 | 179 | // 公司 |
| 290 | 180 | String company = map.get("company").equals("") ? "" : map.get("company").toString(); |
| 291 | - | |
| 292 | 181 | // 坐标类型 |
| 293 | 182 | String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); |
| 294 | - | |
| 295 | 183 | // 描述与说明 |
| 296 | 184 | String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); |
| 297 | - | |
| 298 | 185 | // 是否撤销 |
| 299 | 186 | Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); |
| 300 | - | |
| 301 | 187 | // 中心点(WGS坐标) |
| 302 | 188 | // String gCenterPoint = map.get("gCenterPoint").equals("") ? "" : map.get("gCenterPoint").toString(); |
| 303 | - | |
| 304 | 189 | String bJwpointsArray[] =null; |
| 305 | - | |
| 306 | 190 | if(bCenterPoint!=null) { |
| 307 | - | |
| 308 | 191 | bJwpointsArray = bCenterPoint.split(" "); |
| 309 | - | |
| 310 | 192 | } |
| 311 | - | |
| 312 | 193 | String gCenterPoint =null; |
| 313 | - | |
| 314 | 194 | if(bJwpointsArray.length>0) { |
| 315 | - | |
| 316 | 195 | Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]); |
| 317 | - | |
| 318 | 196 | gCenterPoint = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); |
| 319 | - | |
| 320 | 197 | } |
| 321 | - | |
| 322 | 198 | // 图形坐标点集合(WGS坐标) |
| 323 | 199 | // String gParkPoint = map.get("gParkPoint").equals("") ? "" : map.get("gParkPoint").toString(); |
| 324 | - | |
| 325 | 200 | // 多边形WGS坐标点集合 |
| 326 | 201 | String gParkPoint =""; |
| 327 | - | |
| 328 | 202 | if(!bParkPoint.equals("")) { |
| 329 | - | |
| 330 | 203 | String bPloygonGridArray[] = bParkPoint.split(","); |
| 331 | - | |
| 332 | 204 | int bLen_ = bPloygonGridArray.length; |
| 333 | - | |
| 334 | 205 | for(int b = 0 ;b<bLen_;b++) { |
| 335 | - | |
| 336 | 206 | String tempArray[]= bPloygonGridArray[b].split(" "); |
| 337 | - | |
| 338 | 207 | Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]); |
| 339 | - | |
| 340 | 208 | if(b==0) { |
| 341 | - | |
| 342 | 209 | gParkPoint = resultPoint.getLng() + " " + resultPoint.getLat(); |
| 343 | - | |
| 344 | 210 | }else { |
| 345 | - | |
| 346 | 211 | gParkPoint = gParkPoint + ',' + resultPoint.getLng() + " " + resultPoint.getLat(); |
| 347 | - | |
| 348 | 212 | } |
| 349 | - | |
| 350 | 213 | } |
| 351 | - | |
| 352 | 214 | } |
| 353 | 215 | if(bParkPoint.equals("")) |
| 354 | 216 | bParkPoint = null; |
| ... | ... | @@ -362,69 +224,51 @@ public class CarParkServiceImpl extends BaseServiceImpl<CarPark, Integer> implem |
| 362 | 224 | /*bParkPoint = "POLYGON((" + bParkPoint +"))"; |
| 363 | 225 | |
| 364 | 226 | gParkPoint = "POLYGON((" + gParkPoint +"))";*/ |
| 365 | - | |
| 366 | 227 | // 编码 |
| 367 | 228 | String parkCode = map.get("parkCode").equals("") ? "" : map.get("parkCode").toString(); |
| 368 | - | |
| 369 | 229 | // 名称 |
| 370 | 230 | String parkName = map.get("parkName").equals("") ? "" : map.get("parkName").toString(); |
| 371 | - | |
| 372 | 231 | // 半径 |
| 373 | 232 | Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString()); |
| 374 | - | |
| 375 | 233 | // 图形类型 |
| 376 | 234 | String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); |
| 377 | - | |
| 378 | 235 | // 版本 |
| 379 | 236 | Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString()); |
| 380 | - | |
| 381 | 237 | // 创建人 |
| 382 | 238 | Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString()); |
| 383 | - | |
| 384 | 239 | // 创建日期 |
| 385 | 240 | String createDate = map.get("createDate").equals("") ? "" : map.get("createDate").toString(); |
| 386 | - | |
| 387 | 241 | Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString()); |
| 388 | - | |
| 389 | 242 | SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); |
| 390 | - | |
| 391 | 243 | Date date = new Date(); |
| 392 | - | |
| 393 | 244 | // 修改日期 |
| 394 | 245 | String updateDate = formatter.format(date); |
| 395 | - | |
| 396 | 246 | carParkRepository.carParkUpdate(area, company, parkCode, parkName, brancheCompany, createBy, createDate, descriptions, destroy, updateBy, updateDate, versions, bCenterPoint, gCenterPoint, bParkPoint, gParkPoint, dbType, radius, shapesType, id); |
| 397 | - | |
| 398 | 247 | } |
| 399 | - | |
| 400 | 248 | resultMap.put("status", ResponseCode.SUCCESS); |
| 401 | - | |
| 402 | 249 | } catch (Exception e) { |
| 403 | - | |
| 404 | 250 | resultMap.put("status", ResponseCode.ERROR); |
| 405 | - | |
| 406 | 251 | logger.error("save erro.", e); |
| 407 | - | |
| 408 | 252 | } |
| 409 | - | |
| 410 | 253 | return resultMap; |
| 411 | 254 | } |
| 412 | - | |
| 413 | 255 | /** 百度坐标转WGS坐标 */ |
| 414 | 256 | public Location FromBDPointToWGSPoint(String bLonx,String bLatx) { |
| 415 | - | |
| 416 | 257 | double lng = Double.parseDouble(bLonx); |
| 417 | - | |
| 418 | 258 | double lat = Double.parseDouble(bLatx); |
| 419 | - | |
| 420 | 259 | Location bdLoc = TransGPS.LocationMake(lng, lat); |
| 421 | - | |
| 422 | 260 | Location location = TransGPS.bd_decrypt(bdLoc); |
| 423 | - | |
| 424 | 261 | Location WGSPoint = TransGPS.transformFromGCJToWGS(location); |
| 425 | - | |
| 426 | 262 | return WGSPoint; |
| 427 | - | |
| 428 | 263 | } |
| 429 | - | |
| 264 | + | |
| 265 | + @Override | |
| 266 | + public boolean selectTccInfoByCode(Map<String, Object> map) { | |
| 267 | + List<Object[]> arrayObj = carParkRepository.selectTccInfoByCode(map.get("parkCode").equals("") ? "" : map.get("parkCode").toString()); | |
| 268 | + boolean tag = true; | |
| 269 | + if(arrayObj.size()>0) { | |
| 270 | + tag= false; | |
| 271 | + } | |
| 272 | + return tag; | |
| 273 | + } | |
| 430 | 274 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/RealChartsServiceImpl.java
| ... | ... | @@ -259,7 +259,7 @@ public class RealChartsServiceImpl implements RealChartsService { |
| 259 | 259 | } |
| 260 | 260 | inStr = " (" + inStr.substring(1) + ")"; |
| 261 | 261 | |
| 262 | - String sql = "SELECT ID,DFSJ,FCSJ_ACTUAL,ZDSJ,ZDSJ_ACTUAL,`STATUS`,XL_BM FROM bsth_c_s_sp_info_real WHERE schedule_date_str=:date AND concat_ws('', real_exec_date, dfsj)<:cdate and xl_bm in "+inStr+" ORDER BY dfsj"; | |
| 262 | + String sql = "SELECT ID,DFSJ,FCSJ_ACTUAL,ZDSJ,ZDSJ_ACTUAL,`STATUS`,XL_BM FROM bsth_c_s_sp_info_real WHERE bc_type!='in' and bc_type!='out' and schedule_date_str=:date AND concat_ws('', real_exec_date, dfsj)<:cdate and xl_bm in "+inStr+" ORDER BY dfsj"; | |
| 263 | 263 | |
| 264 | 264 | MapSqlParameterSource parameters = new MapSqlParameterSource(); |
| 265 | 265 | parameters.addValue("date", date); | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -12,6 +12,7 @@ import com.bsth.data.BasicData; |
| 12 | 12 | import com.bsth.data.LineConfigData; |
| 13 | 13 | import com.bsth.data.schedule.DayOfSchedule; |
| 14 | 14 | import com.bsth.data.schedule.SchAttrCalculator; |
| 15 | +import com.bsth.data.schedule.SchModifyLog; | |
| 15 | 16 | import com.bsth.data.schedule.ScheduleComparator; |
| 16 | 17 | import com.bsth.data.schedule.late_adjust.LateAdjustHandle; |
| 17 | 18 | import com.bsth.entity.Cars; |
| ... | ... | @@ -52,7 +53,6 @@ import com.google.common.base.Splitter; |
| 52 | 53 | import com.google.common.collect.Lists; |
| 53 | 54 | import org.apache.commons.lang3.StringEscapeUtils; |
| 54 | 55 | import org.apache.commons.lang3.StringUtils; |
| 55 | -import org.drools.compiler.lang.dsl.DSLMapParser.statement_return; | |
| 56 | 56 | import org.joda.time.format.DateTimeFormat; |
| 57 | 57 | import org.joda.time.format.DateTimeFormatter; |
| 58 | 58 | import org.slf4j.Logger; |
| ... | ... | @@ -132,6 +132,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 132 | 132 | @Autowired |
| 133 | 133 | CulateMileageService culateService; |
| 134 | 134 | |
| 135 | + @Autowired | |
| 136 | + SchModifyLog schModifyLog; | |
| 137 | + | |
| 135 | 138 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 136 | 139 | |
| 137 | 140 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), |
| ... | ... | @@ -1171,10 +1174,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1171 | 1174 | return rs; |
| 1172 | 1175 | } |
| 1173 | 1176 | |
| 1177 | + String clZbh = map.get("clZbh"); | |
| 1178 | + String jsy = map.get("jsy"); | |
| 1179 | + if(!clZbh.equals(sch.getClZbh()) | |
| 1180 | + || !jsy.equals(sch.getjGh() + "/" + sch.getjName())) | |
| 1181 | + schModifyLog.saveChangetochange(sch, clZbh, jsy);//为换人换车情况表写入数据 | |
| 1174 | 1182 | /** |
| 1175 | 1183 | * 换车 |
| 1176 | 1184 | */ |
| 1177 | - String clZbh = map.get("clZbh"); | |
| 1178 | 1185 | if (StringUtils.isNotEmpty(clZbh)) { |
| 1179 | 1186 | //换车 |
| 1180 | 1187 | if (!carExist(sch.getGsBm(), clZbh)) { |
| ... | ... | @@ -1189,7 +1196,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1189 | 1196 | /** |
| 1190 | 1197 | * 换驾驶员 |
| 1191 | 1198 | */ |
| 1192 | - String jsy = map.get("jsy"); | |
| 1193 | 1199 | if (StringUtils.isNotEmpty(jsy) && jsy.indexOf("/") != -1) { |
| 1194 | 1200 | String jGh = jsy.split("/")[0]; |
| 1195 | 1201 | String jName = getPersonName(sch.getGsBm(), jGh); |
| ... | ... | @@ -2013,11 +2019,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2013 | 2019 | int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0; |
| 2014 | 2020 | int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0; |
| 2015 | 2021 | Map<String, Object> map = null; |
| 2016 | - | |
| 2022 | + | |
| 2017 | 2023 | double xgssgl=0,xgljgl=0,lj=0,cj=0; |
| 2018 | 2024 | for (int i = 0; i < list.size(); i++) { |
| 2019 | 2025 | ScheduleRealInfo scheduleRealInfo = list.get(i); |
| 2020 | - | |
| 2026 | + | |
| 2021 | 2027 | if (scheduleRealInfo != null) { |
| 2022 | 2028 | Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); |
| 2023 | 2029 | //计算实际里程,少驶里程,计划里程=实际里程+少驶里程 |
| ... | ... | @@ -2028,7 +2034,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2028 | 2034 | if (childTaskPlans.isEmpty()) { |
| 2029 | 2035 | tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); |
| 2030 | 2036 | jhlcOrig = scheduleRealInfo.getJhlcOrig() == null ? 0 : scheduleRealInfo.getJhlcOrig(); |
| 2031 | - | |
| 2037 | + | |
| 2032 | 2038 | if(jhlcOrig-tempJhlc>0){ |
| 2033 | 2039 | xgssgl +=jhlcOrig-tempJhlc; |
| 2034 | 2040 | cj += jhlcOrig-tempJhlc; |
| ... | ... | @@ -2040,8 +2046,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2040 | 2046 | if (scheduleRealInfo.isSflj()) { |
| 2041 | 2047 | ljgl += tempJhlc; |
| 2042 | 2048 | ljglZ += tempJhlc; |
| 2043 | - } | |
| 2044 | - | |
| 2049 | + } | |
| 2050 | + | |
| 2045 | 2051 | if (scheduleRealInfo.getStatus() == -1) { |
| 2046 | 2052 | ssgl += tempJhlc; |
| 2047 | 2053 | ssglZ += tempJhlc; |
| ... | ... | @@ -2806,7 +2812,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2806 | 2812 | for(ScheduleRealInfo info:listInfo){ |
| 2807 | 2813 | for(ScheduleRealInfo total:listTotal){ |
| 2808 | 2814 | if(info.getjGh().equals(total.getjGh()) && info.getLpName().equals(total.getLpName()) && info.getClZbh().equals(total.getClZbh())){ |
| 2809 | - | |
| 2815 | + | |
| 2810 | 2816 | } |
| 2811 | 2817 | } |
| 2812 | 2818 | }*/ |
| ... | ... | @@ -2902,7 +2908,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2902 | 2908 | for(ScheduleRealInfo info:listInfo){ |
| 2903 | 2909 | for(ScheduleRealInfo total:listTotal){ |
| 2904 | 2910 | if(info.getjGh().equals(total.getjGh()) && info.getLpName().equals(total.getLpName()) && info.getClZbh().equals(total.getClZbh())){ |
| 2905 | - | |
| 2911 | + | |
| 2906 | 2912 | } |
| 2907 | 2913 | } |
| 2908 | 2914 | }*/ |
| ... | ... | @@ -2979,7 +2985,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2979 | 2985 | fage = false; |
| 2980 | 2986 | } |
| 2981 | 2987 | listS.add(scheduleRealInfo); |
| 2982 | - | |
| 2988 | + | |
| 2983 | 2989 | /* if (scheduleRealInfo != null) { |
| 2984 | 2990 | //计划里程(主任务过滤掉临加班次), |
| 2985 | 2991 | //烂班里程(主任务烂班), |
| ... | ... | @@ -2995,7 +3001,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2995 | 3001 | || scheduleRealInfo.getBcType().equals("out"))) { |
| 2996 | 3002 | jhlc =Arith.add(jhlc,tempJhlc); |
| 2997 | 3003 | } |
| 2998 | - | |
| 3004 | + | |
| 2999 | 3005 | if (scheduleRealInfo.getStatus() == -1) { |
| 3000 | 3006 | remMileage =Arith.add(remMileage,tempJhlc); |
| 3001 | 3007 | } |
| ... | ... | @@ -3081,7 +3087,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3081 | 3087 | ScheduleRealInfo sch; |
| 3082 | 3088 | //BiMap<String, String> map = BasicData.deviceId2NbbmMap.inverse(); |
| 3083 | 3089 | |
| 3084 | - String jGh,jName,sGh,sName; | |
| 3090 | + String jGh = null,jName,sGh,sName; | |
| 3085 | 3091 | for (ChangePersonCar cpc : cpcs) { |
| 3086 | 3092 | |
| 3087 | 3093 | sch = dayOfSchedule.get(cpc.getSchId()); |
| ... | ... | @@ -3102,6 +3108,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3102 | 3108 | rs.put("status", ResponseCode.ERROR); |
| 3103 | 3109 | return rs; |
| 3104 | 3110 | } |
| 3111 | + } | |
| 3112 | + | |
| 3113 | + //为换人换车情况表写入数据 | |
| 3114 | + schModifyLog.saveChangetochange(sch, cpc); | |
| 3115 | + | |
| 3116 | + if (StringUtils.isNotEmpty(cpc.getJsy())) { | |
| 3105 | 3117 | //换驾驶员 |
| 3106 | 3118 | persoChange(sch, jGh); |
| 3107 | 3119 | set.add(sch); | ... | ... |
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleServiceImpl.java
| ... | ... | @@ -112,6 +112,10 @@ public class ScheduleRuleServiceImpl implements ScheduleRuleService { |
| 112 | 112 | public SchedulePlanRuleResult mapRow(ResultSet rs, int i) throws SQLException { |
| 113 | 113 | SchedulePlanRuleResult obj = new SchedulePlanRuleResult(); |
| 114 | 114 | obj.setRuleId(rs.getString("rule_id")); |
| 115 | + obj.setCcZbh(rs.getString("cc_zbh")); | |
| 116 | + obj.setQyrq(rs.getDate("qyrq")); | |
| 117 | + obj.setGids(rs.getString("gids")); | |
| 118 | + obj.setEcids(rs.getString("ecids")); | |
| 115 | 119 | obj.setScheduleDate(rs.getDate("schedule_date")); |
| 116 | 120 | obj.setGidindex(rs.getString("gidindex")); |
| 117 | 121 | obj.setEcindex(rs.getString("ecindex")); | ... | ... |
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_input.java
| 1 | 1 | package com.bsth.service.schedule.rules.shiftloop; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 4 | +import com.bsth.service.schedule.utils.Md5Util; | |
| 4 | 5 | import com.google.common.base.Splitter; |
| 5 | 6 | import org.apache.commons.lang3.StringUtils; |
| 6 | 7 | import org.joda.time.DateTime; |
| ... | ... | @@ -17,6 +18,12 @@ public class ScheduleRule_input { |
| 17 | 18 | |
| 18 | 19 | /** 规则Id */ |
| 19 | 20 | private String ruleId; |
| 21 | + /** | |
| 22 | + * 规则md5值(不使用id判定,使用md5判定) | |
| 23 | + * 使用,启用日期,路牌范围,人员范围 结合生成md5编码 | |
| 24 | + */ | |
| 25 | + private String ruleMd5; | |
| 26 | + | |
| 20 | 27 | /** 规则启用日期 */ |
| 21 | 28 | private DateTime qyrq; |
| 22 | 29 | |
| ... | ... | @@ -78,9 +85,20 @@ public class ScheduleRule_input { |
| 78 | 85 | } |
| 79 | 86 | } |
| 80 | 87 | |
| 88 | + /** 生成规则md5编码 */ | |
| 89 | + ruleMd5 = Md5Util.getMd5( | |
| 90 | + String.valueOf(qyrq.getMillis()) + "_" + | |
| 91 | + scheduleRule1Flat.getLpIds() + "_" + | |
| 92 | + scheduleRule1Flat.getRyConfigIds() | |
| 93 | + ); | |
| 94 | + | |
| 95 | +// System.out.println("rule的md5:" + ruleMd5 + " 车辆:" + scheduleRule1Flat.getCarConfigInfo().getCl().getInsideCode()); | |
| 96 | + | |
| 81 | 97 | this.self = scheduleRule1Flat; |
| 82 | 98 | } |
| 83 | 99 | |
| 100 | + | |
| 101 | + | |
| 84 | 102 | public String getRuleId() { |
| 85 | 103 | return ruleId; |
| 86 | 104 | } |
| ... | ... | @@ -160,4 +178,12 @@ public class ScheduleRule_input { |
| 160 | 178 | public void setSelf(ScheduleRule1Flat self) { |
| 161 | 179 | this.self = self; |
| 162 | 180 | } |
| 181 | + | |
| 182 | + public String getRuleMd5() { | |
| 183 | + return ruleMd5; | |
| 184 | + } | |
| 185 | + | |
| 186 | + public void setRuleMd5(String ruleMd5) { | |
| 187 | + this.ruleMd5 = ruleMd5; | |
| 188 | + } | |
| 163 | 189 | } | ... | ... |
src/main/java/com/bsth/service/schedule/utils/Md5Util.java
0 → 100644
| 1 | +package com.bsth.service.schedule.utils; | |
| 2 | + | |
| 3 | +import java.security.MessageDigest; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Md5工具。 | |
| 7 | + */ | |
| 8 | +public class Md5Util { | |
| 9 | + private static MessageDigest md5 = null; | |
| 10 | + static { | |
| 11 | + try { | |
| 12 | + md5 = MessageDigest.getInstance("MD5"); | |
| 13 | + } catch (Exception exp) { | |
| 14 | + exp.printStackTrace(); | |
| 15 | + } | |
| 16 | + } | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 用于获取一个String的md5值。 | |
| 20 | + * @param str | |
| 21 | + * @return | |
| 22 | + */ | |
| 23 | + public static String getMd5(String str) { | |
| 24 | + byte[] bs = md5.digest(str.getBytes()); | |
| 25 | + StringBuilder s = new StringBuilder(); | |
| 26 | + for (byte x : bs) { | |
| 27 | + if ((x & 0xff) >>4 == 0) { | |
| 28 | + s.append("0").append(Integer.toHexString(x & 0xff)); | |
| 29 | + } else { | |
| 30 | + s.append(Integer.toHexString(x & 0xff)); | |
| 31 | + } | |
| 32 | + } | |
| 33 | + return s.toString(); | |
| 34 | + } | |
| 35 | + | |
| 36 | +} | ... | ... |
src/main/resources/datatools/ktrs/ttinfodetailDataInput.ktr
| ... | ... | @@ -696,7 +696,7 @@ |
| 696 | 696 | <optimizationLevel>9</optimizationLevel> |
| 697 | 697 | <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> |
| 698 | 698 | <jsScript_name>Script 1</jsScript_name> |
| 699 | - <jsScript_script>//Script here

var jhlc; // 计划里程
var bcsj; // 班次时间

// 时间范围正则表达式
var timeRex = /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/;
// 发车时间转换成日期
var fcsj_hour = str2num(sendtime_calcu.substr(0, 2), "#");
var fcsj_min = str2num(sendtime_calcu.substr(3, 2), "#");
var fcsj_date = new Date(2000,1,1,fcsj_hour,fcsj_min,0);

// 判定是否早高峰
var isZgf = false;
if (timeRex.test(early_start_time) && timeRex.test(early_end_time) && early_up_time != null && early_down_time != null) {
 var early_s_hour = str2num(early_start_time.substr(0, 2), "#");
 var early_s_min = str2num(early_start_time.substr(3, 2), "#");
 var early_s_date = new Date(2000,1,1,early_s_hour,early_s_min,0);

 var early_e_hour = str2num(early_end_time.substr(0, 2), "#");
 var early_e_min = str2num(early_end_time.substr(3, 2), "#");
 var early_e_date = new Date(2000,1,1,early_e_hour,early_e_min,0);

 if (fcsj_date >= early_s_date && fcsj_date <= early_e_date) {
 isZgf = true;
 }
}

// 判定是否晚高峰
var isWgf = false;
if (timeRex.test(late_start_time) && timeRex.test(late_end_time) && late_up_time != null && late_down_time != null) {
 var late_s_hour = str2num(late_start_time.substr(0, 2), "#");
 var late_s_min = str2num(late_start_time.substr(3, 2), "#");
 var late_s_date = new Date(2000,1,1,late_s_hour,late_s_min,0);

 var late_e_hour = str2num(late_end_time.substr(0, 2), "#");
 var late_e_min = str2num(late_end_time.substr(3, 2), "#");
 var late_e_date = new Date(2000,1,1,late_e_hour,late_e_min,0);

 if (fcsj_date >= late_s_date && fcsj_date <= late_e_date) {
 isWgf = true;
 }
}

// 判定是否晚高峰

if (sxx == 0) { // 上行
 if (isZgf) {
 jhlc = up_mileage;
 bcsj = early_up_time;
 } else if (isWgf) {
 jhlc = up_mileage;
 bcsj = late_up_time;
 } else {
 jhlc = up_mileage;
 bcsj = up_travel_time;
 }
} else { // sxx == 1 下行
 if (isZgf) {
 jhlc = down_mileage;
 bcsj = early_down_time;
 } else if (isWgf) {
 jhlc = down_mileage;
 bcsj = late_down_time;
 } else {
 jhlc = down_mileage;
 bcsj = down_travel_time;
 }
}

</jsScript_script> | |
| 699 | + <jsScript_script>//Script here

var jhlc; // 计划里程
var bcsj; // 班次时间

// 时间范围正则表达式
var timeRex = /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/;
// 发车时间转换成日期
var fcsj_hour = str2num(sendtime_calcu.substr(0, 2), "#");
var fcsj_min = str2num(sendtime_calcu.substr(3, 2), "#");
var fcsj_date = new Date(2000,1,1,fcsj_hour,fcsj_min,0);

// 判定是否早高峰
var isZgf = false;
if (timeRex.test(early_start_time) && timeRex.test(early_end_time) && early_up_time != null && early_down_time != null) {
 var early_s_hour = str2num(early_start_time.substr(0, 2), "#");
 var early_s_min = str2num(early_start_time.substr(3, 2), "#");
 var early_s_date = new Date(2000,1,1,early_s_hour,early_s_min,0);

 var early_e_hour = str2num(early_end_time.substr(0, 2), "#");
 var early_e_min = str2num(early_end_time.substr(3, 2), "#");
 var early_e_date = new Date(2000,1,1,early_e_hour,early_e_min,0);

 if (fcsj_date >= early_s_date && fcsj_date <= early_e_date) {
 isZgf = true;
 }
}

// 判定是否晚高峰
var isWgf = false;
if (timeRex.test(late_start_time) && timeRex.test(late_end_time) && late_up_time != null && late_down_time != null) {
 var late_s_hour = str2num(late_start_time.substr(0, 2), "#");
 var late_s_min = str2num(late_start_time.substr(3, 2), "#");
 var late_s_date = new Date(2000,1,1,late_s_hour,late_s_min,0);

 var late_e_hour = str2num(late_end_time.substr(0, 2), "#");
 var late_e_min = str2num(late_end_time.substr(3, 2), "#");
 var late_e_date = new Date(2000,1,1,late_e_hour,late_e_min,0);

 if (fcsj_date >= late_s_date && fcsj_date <= late_e_date) {
 isWgf = true;
 }
}

// 判定是否晚高峰

if (sxx == 0) { // 上行
 if (isZgf) {
 jhlc = up_mileage;
 bcsj = early_up_time ? early_up_time : up_travel_time;
 } else if (isWgf) {
 jhlc = up_mileage;
 bcsj = late_up_time ? late_up_time : up_travel_time;
 } else {
 jhlc = up_mileage;
 bcsj = up_travel_time;
 }
} else { // sxx == 1 下行
 if (isZgf) {
 jhlc = down_mileage;
 bcsj = early_down_time ? early_down_time : down_travel_time;
 } else if (isWgf) {
 jhlc = down_mileage;
 bcsj = late_down_time ? late_down_time : down_travel_time;
 } else {
 jhlc = down_mileage;
 bcsj = down_travel_time;
 }
}

</jsScript_script> | |
| 700 | 700 | </jsScript> </jsScripts> <fields> <field> <name>jhlc</name> |
| 701 | 701 | <rename>jhlc</rename> |
| 702 | 702 | <type>String</type> | ... | ... |
src/main/resources/datatools/ktrs/ttinfodetailDataInput2.ktr
| ... | ... | @@ -696,7 +696,7 @@ |
| 696 | 696 | <optimizationLevel>9</optimizationLevel> |
| 697 | 697 | <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> |
| 698 | 698 | <jsScript_name>Script 1</jsScript_name> |
| 699 | - <jsScript_script>//Script here

var jhlc; // 计划里程
var bcsj; // 班次时间

// 时间范围正则表达式
var timeRex = /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/;
// 发车时间转换成日期
var fcsj_hour = str2num(sendtime_calcu.substr(0, 2), "#");
var fcsj_min = str2num(sendtime_calcu.substr(3, 2), "#");
var fcsj_date = new Date(2000,1,1,fcsj_hour,fcsj_min,0);

// 判定是否早高峰
var isZgf = false;
if (timeRex.test(early_start_time) && timeRex.test(early_end_time) && early_up_time != null && early_down_time != null) {
 var early_s_hour = str2num(early_start_time.substr(0, 2), "#");
 var early_s_min = str2num(early_start_time.substr(3, 2), "#");
 var early_s_date = new Date(2000,1,1,early_s_hour,early_s_min,0);

 var early_e_hour = str2num(early_end_time.substr(0, 2), "#");
 var early_e_min = str2num(early_end_time.substr(3, 2), "#");
 var early_e_date = new Date(2000,1,1,early_e_hour,early_e_min,0);

 if (fcsj_date >= early_s_date && fcsj_date <= early_e_date) {
 isZgf = true;
 }
}

// 判定是否晚高峰
var isWgf = false;
if (timeRex.test(late_start_time) && timeRex.test(late_end_time) && late_up_time != null && late_down_time != null) {
 var late_s_hour = str2num(late_start_time.substr(0, 2), "#");
 var late_s_min = str2num(late_start_time.substr(3, 2), "#");
 var late_s_date = new Date(2000,1,1,late_s_hour,late_s_min,0);

 var late_e_hour = str2num(late_end_time.substr(0, 2), "#");
 var late_e_min = str2num(late_end_time.substr(3, 2), "#");
 var late_e_date = new Date(2000,1,1,late_e_hour,late_e_min,0);

 if (fcsj_date >= late_s_date && fcsj_date <= late_e_date) {
 isWgf = true;
 }
}

// 判定是否晚高峰

if (sxx == 0) { // 上行
 if (isZgf) {
 jhlc = up_mileage;
 bcsj = early_up_time;
 } else if (isWgf) {
 jhlc = up_mileage;
 bcsj = late_up_time;
 } else {
 jhlc = up_mileage;
 bcsj = up_travel_time;
 }
} else { // sxx == 1 下行
 if (isZgf) {
 jhlc = down_mileage;
 bcsj = early_down_time;
 } else if (isWgf) {
 jhlc = down_mileage;
 bcsj = late_down_time;
 } else {
 jhlc = down_mileage;
 bcsj = down_travel_time;
 }
}</jsScript_script> | |
| 699 | + <jsScript_script>//Script here

var jhlc; // 计划里程
var bcsj; // 班次时间

// 时间范围正则表达式
var timeRex = /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/;
// 发车时间转换成日期
var fcsj_hour = str2num(sendtime_calcu.substr(0, 2), "#");
var fcsj_min = str2num(sendtime_calcu.substr(3, 2), "#");
var fcsj_date = new Date(2000,1,1,fcsj_hour,fcsj_min,0);

// 判定是否早高峰
var isZgf = false;
if (timeRex.test(early_start_time) && timeRex.test(early_end_time) && early_up_time != null && early_down_time != null) {
 var early_s_hour = str2num(early_start_time.substr(0, 2), "#");
 var early_s_min = str2num(early_start_time.substr(3, 2), "#");
 var early_s_date = new Date(2000,1,1,early_s_hour,early_s_min,0);

 var early_e_hour = str2num(early_end_time.substr(0, 2), "#");
 var early_e_min = str2num(early_end_time.substr(3, 2), "#");
 var early_e_date = new Date(2000,1,1,early_e_hour,early_e_min,0);

 if (fcsj_date >= early_s_date && fcsj_date <= early_e_date) {
 isZgf = true;
 }
}

// 判定是否晚高峰
var isWgf = false;
if (timeRex.test(late_start_time) && timeRex.test(late_end_time) && late_up_time != null && late_down_time != null) {
 var late_s_hour = str2num(late_start_time.substr(0, 2), "#");
 var late_s_min = str2num(late_start_time.substr(3, 2), "#");
 var late_s_date = new Date(2000,1,1,late_s_hour,late_s_min,0);

 var late_e_hour = str2num(late_end_time.substr(0, 2), "#");
 var late_e_min = str2num(late_end_time.substr(3, 2), "#");
 var late_e_date = new Date(2000,1,1,late_e_hour,late_e_min,0);

 if (fcsj_date >= late_s_date && fcsj_date <= late_e_date) {
 isWgf = true;
 }
}

// 判定是否晚高峰

if (sxx == 0) { // 上行
 if (isZgf) {
 jhlc = up_mileage;
 bcsj = early_up_time ? early_up_time : up_travel_time;
 } else if (isWgf) {
 jhlc = up_mileage;
 bcsj = late_up_time ? late_up_time : up_travel_time;
 } else {
 jhlc = up_mileage;
 bcsj = up_travel_time;
 }
} else { // sxx == 1 下行
 if (isZgf) {
 jhlc = down_mileage;
 bcsj = early_down_time ? early_down_time : down_travel_time;
 } else if (isWgf) {
 jhlc = down_mileage;
 bcsj = late_down_time ? late_down_time : down_travel_time;
 } else {
 jhlc = down_mileage;
 bcsj = down_travel_time;
 }
}</jsScript_script> | |
| 700 | 700 | </jsScript> </jsScripts> <fields> <field> <name>jhlc</name> |
| 701 | 701 | <rename>jhlc</rename> |
| 702 | 702 | <type>String</type> | ... | ... |
src/main/resources/logback.xml
| ... | ... | @@ -16,12 +16,12 @@ |
| 16 | 16 | |
| 17 | 17 | <!-- 主日志文件 --> |
| 18 | 18 | <appender name="FILE" |
| 19 | - class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 19 | + class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 20 | 20 | <file>${LOG_BASE}/main/main.log</file> |
| 21 | 21 | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| 22 | 22 | <fileNamePattern>${LOG_BASE}/main/main-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| 23 | 23 | <timeBasedFileNamingAndTriggeringPolicy |
| 24 | - class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 24 | + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 25 | 25 | <maxFileSize>100MB</maxFileSize> |
| 26 | 26 | </timeBasedFileNamingAndTriggeringPolicy> |
| 27 | 27 | </rollingPolicy> |
| ... | ... | @@ -38,12 +38,12 @@ |
| 38 | 38 | |
| 39 | 39 | <!-- 访问日志 --> |
| 40 | 40 | <appender name="ACCESS" |
| 41 | - class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 41 | + class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 42 | 42 | <file>${LOG_BASE}/access/access.log</file> |
| 43 | 43 | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| 44 | 44 | <fileNamePattern>${LOG_BASE}/access/access-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| 45 | 45 | <timeBasedFileNamingAndTriggeringPolicy |
| 46 | - class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 46 | + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 47 | 47 | <maxFileSize>100MB</maxFileSize> |
| 48 | 48 | </timeBasedFileNamingAndTriggeringPolicy> |
| 49 | 49 | </rollingPolicy> |
| ... | ... | @@ -55,18 +55,18 @@ |
| 55 | 55 | </layout> |
| 56 | 56 | </appender> |
| 57 | 57 | <logger name="com.bsth.filter.AccessLogFilter" level="INFO" |
| 58 | - additivity="false"> | |
| 58 | + additivity="false"> | |
| 59 | 59 | <appender-ref ref="ACCESS" /> |
| 60 | 60 | </logger> |
| 61 | 61 | |
| 62 | 62 | <!-- 和网关通讯日志日志 --> |
| 63 | 63 | <appender name="GATEWAY" |
| 64 | - class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 64 | + class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 65 | 65 | <file>${LOG_BASE}/gateway/gateway.log</file> |
| 66 | 66 | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| 67 | 67 | <fileNamePattern>${LOG_BASE}/gateway/gateway-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| 68 | 68 | <timeBasedFileNamingAndTriggeringPolicy |
| 69 | - class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 69 | + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 70 | 70 | <maxFileSize>100MB</maxFileSize> |
| 71 | 71 | </timeBasedFileNamingAndTriggeringPolicy> |
| 72 | 72 | </rollingPolicy> |
| ... | ... | @@ -77,26 +77,26 @@ |
| 77 | 77 | </layout> |
| 78 | 78 | </appender> |
| 79 | 79 | <logger name="com.bsth.service.directive.DirectiveServiceImpl" |
| 80 | - level="INFO" additivity="false"> | |
| 80 | + level="INFO" additivity="false"> | |
| 81 | 81 | <appender-ref ref="GATEWAY" /> |
| 82 | 82 | </logger> |
| 83 | 83 | <logger name="com.bsth.controller.directive.UpstreamEntrance" |
| 84 | - level="INFO" additivity="false"> | |
| 84 | + level="INFO" additivity="false"> | |
| 85 | 85 | <appender-ref ref="GATEWAY" /> |
| 86 | 86 | </logger> |
| 87 | 87 | <logger name="com.bsth.data.directive.GatewayHttpUtils" level="INFO" |
| 88 | - additivity="false"> | |
| 88 | + additivity="false"> | |
| 89 | 89 | <appender-ref ref="GATEWAY" /> |
| 90 | 90 | </logger> |
| 91 | 91 | |
| 92 | 92 | <!-- 运管处接口日志 --> |
| 93 | 93 | <appender name="TRAFFIC" |
| 94 | - class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 94 | + class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 95 | 95 | <file>${LOG_BASE}/traffic/traffic.log</file> |
| 96 | 96 | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| 97 | 97 | <fileNamePattern>${LOG_BASE}/traffic/traffic-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| 98 | 98 | <timeBasedFileNamingAndTriggeringPolicy |
| 99 | - class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 99 | + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 100 | 100 | <maxFileSize>100MB</maxFileSize> |
| 101 | 101 | </timeBasedFileNamingAndTriggeringPolicy> |
| 102 | 102 | </rollingPolicy> |
| ... | ... | @@ -107,18 +107,18 @@ |
| 107 | 107 | </layout> |
| 108 | 108 | </appender> |
| 109 | 109 | <logger name="com.bsth.service.impl.TrafficManageServiceImpl" |
| 110 | - level="INFO" additivity="false"> | |
| 110 | + level="INFO" additivity="false"> | |
| 111 | 111 | <appender-ref ref="TRAFFIC" /> |
| 112 | 112 | </logger> |
| 113 | 113 | |
| 114 | 114 | <!-- schedule 数据工具操作日志 --> |
| 115 | 115 | <appender name="DATATOOLS" |
| 116 | - class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 116 | + class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 117 | 117 | <file>${LOG_BASE}/schedule/datatools/datatools.log</file> |
| 118 | 118 | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| 119 | 119 | <fileNamePattern>${LOG_BASE}/schedule/datatools/datatools-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| 120 | 120 | <timeBasedFileNamingAndTriggeringPolicy |
| 121 | - class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 121 | + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 122 | 122 | <maxFileSize>100MB</maxFileSize> |
| 123 | 123 | </timeBasedFileNamingAndTriggeringPolicy> |
| 124 | 124 | </rollingPolicy> |
| ... | ... | @@ -130,12 +130,12 @@ |
| 130 | 130 | </appender> |
| 131 | 131 | <!-- schedule 时刻表操作日志 --> |
| 132 | 132 | <appender name="TIMETABLE" |
| 133 | - class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 133 | + class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 134 | 134 | <file>${LOG_BASE}/schedule/timetable/timetable.log</file> |
| 135 | 135 | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| 136 | 136 | <fileNamePattern>${LOG_BASE}/schedule/timetable/timetable-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| 137 | 137 | <timeBasedFileNamingAndTriggeringPolicy |
| 138 | - class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 138 | + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 139 | 139 | <maxFileSize>100MB</maxFileSize> |
| 140 | 140 | </timeBasedFileNamingAndTriggeringPolicy> |
| 141 | 141 | </rollingPolicy> |
| ... | ... | @@ -146,11 +146,11 @@ |
| 146 | 146 | </layout> |
| 147 | 147 | </appender> |
| 148 | 148 | <logger name="com.bsth.service.schedule.impl.TTInfoDetailServiceImpl" |
| 149 | - level="INFO" additivity="false"> | |
| 149 | + level="INFO" additivity="false"> | |
| 150 | 150 | <appender-ref ref="TIMETABLE" /> |
| 151 | 151 | </logger> |
| 152 | 152 | <logger name="com.bsth.service.schedule.utils.DataToolsServiceImpl" |
| 153 | - level="INFO" additivity="false"> | |
| 153 | + level="INFO" additivity="false"> | |
| 154 | 154 | <appender-ref ref="TIMETABLE" /> |
| 155 | 155 | <appender-ref ref="DATATOOLS" /> |
| 156 | 156 | </logger> |
| ... | ... | @@ -181,35 +181,36 @@ |
| 181 | 181 | level="INFO" additivity="false"> |
| 182 | 182 | <appender-ref ref="GPS_COUNT" /> |
| 183 | 183 | </logger> |
| 184 | - <!--<logger name="org.hibernate.SQL" level="TRACE">--> | |
| 185 | - <!--<appender-ref ref="STDOUT" />--> | |
| 186 | - <!--</logger>--> | |
| 187 | - | |
| 188 | - <!--JdbcTemplate的日志输出器 --> | |
| 189 | - <logger name="org.springframework.jdbc.core.StatementCreatorUtils" | |
| 190 | - additivity="false" level="TRACE"> | |
| 191 | - <appender-ref ref="STDOUT" /> | |
| 192 | - </logger> | |
| 193 | - <logger name="org.springframework.jdbc.core" additivity="true"> | |
| 194 | - <level value="DEBUG" /> | |
| 195 | - <appender-ref ref="STDOUT" /> | |
| 196 | - </logger> | |
| 197 | - <logger name="java.sql.Connection" additivity="true"> | |
| 198 | - <level value="DEBUG" /> | |
| 199 | - <appender-ref ref="STDOUT" /> | |
| 200 | - </logger> | |
| 201 | - <logger name="java.sql.Statement" additivity="true"> | |
| 202 | - <level value="DEBUG" /> | |
| 203 | - <appender-ref ref="STDOUT" /> | |
| 204 | - </logger> | |
| 205 | - <logger name="java.sql.PreparedStatement" additivity="true"> | |
| 206 | - <level value="DEBUG" /> | |
| 207 | - <appender-ref ref="STDOUT" /> | |
| 208 | - </logger> | |
| 209 | - <logger name="java.sql.ResultSet" additivity="true"> | |
| 210 | - <level value="DEBUG" /> | |
| 211 | - <appender-ref ref="STDOUT" /> | |
| 212 | - </logger> | |
| 184 | + | |
| 185 | + <!--<logger name="org.hibernate.SQL" level="TRACE">--> | |
| 186 | + <!--<appender-ref ref="STDOUT" />--> | |
| 187 | + <!--</logger>--> | |
| 188 | + | |
| 189 | + <!--JdbcTemplate的日志输出器 --> | |
| 190 | + <logger name="org.springframework.jdbc.core.StatementCreatorUtils" | |
| 191 | + additivity="false" level="INFO"> | |
| 192 | + <appender-ref ref="STDOUT" /> | |
| 193 | + </logger> | |
| 194 | + <logger name="org.springframework.jdbc.core" additivity="true"> | |
| 195 | + <level value="INFO" /> | |
| 196 | + <appender-ref ref="STDOUT" /> | |
| 197 | + </logger> | |
| 198 | + <logger name="java.sql.Connection" additivity="true"> | |
| 199 | + <level value="INFO" /> | |
| 200 | + <appender-ref ref="STDOUT" /> | |
| 201 | + </logger> | |
| 202 | + <logger name="java.sql.Statement" additivity="true"> | |
| 203 | + <level value="INFO" /> | |
| 204 | + <appender-ref ref="STDOUT" /> | |
| 205 | + </logger> | |
| 206 | + <logger name="java.sql.PreparedStatement" additivity="true"> | |
| 207 | + <level value="INFO" /> | |
| 208 | + <appender-ref ref="STDOUT" /> | |
| 209 | + </logger> | |
| 210 | + <logger name="java.sql.ResultSet" additivity="true"> | |
| 211 | + <level value="INFO" /> | |
| 212 | + <appender-ref ref="STDOUT" /> | |
| 213 | + </logger> | |
| 213 | 214 | |
| 214 | 215 | <!-- 日志输出级别 --> |
| 215 | 216 | <root level="info"> | ... | ... |
src/main/resources/rules/shiftloop_fb_2.drl
| ... | ... | @@ -5,6 +5,8 @@ import java.util.*; |
| 5 | 5 | |
| 6 | 6 | import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output; |
| 7 | 7 | |
| 8 | +import com.bsth.service.schedule.utils.Md5Util; | |
| 9 | + | |
| 8 | 10 | import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; |
| 9 | 11 | import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; |
| 10 | 12 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| ... | ... | @@ -28,6 +30,7 @@ global ScheduleRuleService scheduleRuleService; |
| 28 | 30 | |
| 29 | 31 | declare Calcu_days_result_pre |
| 30 | 32 | ruleId: String // 规则Id |
| 33 | + ruleMd5: String // 规则md5 | |
| 31 | 34 | |
| 32 | 35 | calcu_index_lp : Integer // 计算之后路牌的起始索引 |
| 33 | 36 | calcu_index_ry : Integer // 计算之后人员的起始索引 |
| ... | ... | @@ -59,7 +62,7 @@ rule "calcu_days_1_" |
| 59 | 62 | $xlId: xlId |
| 60 | 63 | ) |
| 61 | 64 | ScheduleRule_input( |
| 62 | - $ruleId : ruleId, $qyrq : qyrq, | |
| 65 | + $ruleId : ruleId, $qyrq : qyrq, $ruleMd5: ruleMd5, | |
| 63 | 66 | $lpindex : startGbdIndex, $ryindex: startEIndex) |
| 64 | 67 | eval($qyrq.isBefore($fromDate)) |
| 65 | 68 | then |
| ... | ... | @@ -68,6 +71,7 @@ rule "calcu_days_1_" |
| 68 | 71 | // 构造Calcu_days_result_pre,用于路牌 |
| 69 | 72 | Calcu_days_result_pre cdrp = new Calcu_days_result_pre(); |
| 70 | 73 | cdrp.setRuleId($ruleId); |
| 74 | + cdrp.setRuleMd5($ruleMd5); | |
| 71 | 75 | cdrp.setCalcu_index_lp($lpindex); |
| 72 | 76 | cdrp.setCalcu_index_ry($ryindex); |
| 73 | 77 | cdrp.setCalcu_start_date_1($qyrq); |
| ... | ... | @@ -94,7 +98,7 @@ rule "calcu_days_2_" |
| 94 | 98 | $xlId: xlId |
| 95 | 99 | ) |
| 96 | 100 | ScheduleRule_input( |
| 97 | - $ruleId : ruleId, $qyrq : qyrq, | |
| 101 | + $ruleId : ruleId, $qyrq : qyrq, $ruleMd5: ruleMd5, | |
| 98 | 102 | $lpindex : startGbdIndex, $ryindex: startEIndex) |
| 99 | 103 | eval((!$qyrq.isBefore($fromDate)) && (!$qyrq.isAfter($toDate))) |
| 100 | 104 | then |
| ... | ... | @@ -103,6 +107,7 @@ rule "calcu_days_2_" |
| 103 | 107 | // 构造Calcu_days_result_pre,用于路牌 |
| 104 | 108 | Calcu_days_result_pre cdrp = new Calcu_days_result_pre(); |
| 105 | 109 | cdrp.setRuleId($ruleId); |
| 110 | + cdrp.setRuleMd5($ruleMd5); | |
| 106 | 111 | cdrp.setCalcu_index_lp($lpindex); |
| 107 | 112 | cdrp.setCalcu_index_ry($ryindex); |
| 108 | 113 | cdrp.setCalcu_start_date_1($qyrq); |
| ... | ... | @@ -124,6 +129,7 @@ end |
| 124 | 129 | |
| 125 | 130 | declare SchedulePlanRuleResult_wrap |
| 126 | 131 | ruleId: String // 规则Id |
| 132 | + ruleMd5: String // 规则md5编码 | |
| 127 | 133 | scheduleDate: DateTime // 排班日期 |
| 128 | 134 | |
| 129 | 135 | isUsed: Boolean = false // 是否被使用过 |
| ... | ... | @@ -142,7 +148,7 @@ rule "Calcu_SchedulePlanRuleResult_wrap" |
| 142 | 148 | $self: schedulePlan |
| 143 | 149 | ) |
| 144 | 150 | eval($self.getIsHistoryPlanFirst() == true) // 是否使用历史排班标识 |
| 145 | - $sprr: SchedulePlanRuleResult() from scheduleRuleService.findLastByXl($xlId, $fromDate.toDate()) | |
| 151 | + $sprr: SchedulePlanRuleResult($qyrq: qyrq) from scheduleRuleService.findLastByXl($xlId, $fromDate.toDate()) | |
| 146 | 152 | |
| 147 | 153 | then |
| 148 | 154 | // 创建班序历史结果数据 |
| ... | ... | @@ -151,6 +157,16 @@ rule "Calcu_SchedulePlanRuleResult_wrap" |
| 151 | 157 | schedulePlanRuleResult_wrap.setScheduleDate(new DateTime($sprr.getScheduleDate())); |
| 152 | 158 | schedulePlanRuleResult_wrap.setSelf($sprr); |
| 153 | 159 | |
| 160 | + // 规则Md5编码 | |
| 161 | + String md5 = Md5Util.getMd5( | |
| 162 | + String.valueOf($qyrq.getTime()) + "_" + | |
| 163 | + $sprr.getGids() + "_" + $sprr.getEcids() | |
| 164 | + ); | |
| 165 | + | |
| 166 | +// System.out.println("修改后的md5:" + md5 + "车辆:" + $sprr.getCcZbh()); | |
| 167 | + | |
| 168 | + schedulePlanRuleResult_wrap.setRuleMd5(md5); | |
| 169 | + | |
| 154 | 170 | insert(schedulePlanRuleResult_wrap); |
| 155 | 171 | end |
| 156 | 172 | |
| ... | ... | @@ -163,10 +179,12 @@ rule "calcu_days_1_with_result" |
| 163 | 179 | when |
| 164 | 180 | $cdrp: Calcu_days_result_pre( |
| 165 | 181 | calcu_start_date_1.isBefore(calcu_start_date_2), |
| 166 | - $ruleId: ruleId | |
| 182 | + $ruleId: ruleId, | |
| 183 | + $ruleMd5: ruleMd5 | |
| 167 | 184 | ) |
| 168 | 185 | $srrr_wrap: SchedulePlanRuleResult_wrap( |
| 169 | - ruleId == $ruleId, | |
| 186 | +// ruleId == $ruleId, | |
| 187 | + ruleMd5 == $ruleMd5, | |
| 170 | 188 | scheduleDate.isAfter($cdrp.calcu_start_date_1), |
| 171 | 189 | scheduleDate.isBefore($cdrp.calcu_start_date_2), |
| 172 | 190 | isUsed == false, | ... | ... |
src/main/resources/static/pages/base/carpark/add.html
| ... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 | <i class="icon-equalizer font-red-sunglo"></i> |
| 19 | 19 | <span class="caption-subject font-red-sunglo bold uppercase">添加停车场 |
| 20 | 20 | <span class="step-title"> 1 - 4 </span> |
| 21 | + <i class="fa fa-question-circle tipso-animation" style="color: rgba(158, 158, 158, 0.49);"></i> | |
| 21 | 22 | </span> |
| 22 | 23 | </div> |
| 23 | 24 | |
| ... | ... | @@ -38,28 +39,28 @@ |
| 38 | 39 | <a href="#tab1" data-toggle="tab" class="step" aria-expanded="true"> |
| 39 | 40 | <span class="number"> 1 </span> |
| 40 | 41 | <span class="desc"> |
| 41 | - <i class="fa fa-check"></i> 选择添加停车场方式 </span> | |
| 42 | + <i class="fa fa-check"></i> 获取停车场位置方式 </span> | |
| 42 | 43 | </a> |
| 43 | 44 | </li> |
| 44 | 45 | <li> |
| 45 | 46 | <a href="#tab2" data-toggle="tab" class="step"> |
| 46 | 47 | <span class="number"> 2 </span> |
| 47 | 48 | <span class="desc"> |
| 48 | - <i class="fa fa-check"></i> 停车场位置 </span> | |
| 49 | + <i class="fa fa-check"></i> 确定停车场位置 </span> | |
| 49 | 50 | </a> |
| 50 | 51 | </li> |
| 51 | 52 | <li> |
| 52 | 53 | <a href="#tab3" data-toggle="tab" class="step active"> |
| 53 | 54 | <span class="number"> 3 </span> |
| 54 | 55 | <span class="desc"> |
| 55 | - <i class="fa fa-check"></i> 停车场信息 </span> | |
| 56 | + <i class="fa fa-check"></i> 填写停车场信息 </span> | |
| 56 | 57 | </a> |
| 57 | 58 | </li> |
| 58 | 59 | <li> |
| 59 | 60 | <a href="#tab4" data-toggle="tab" class="step"> |
| 60 | 61 | <span class="number"> 4 </span> |
| 61 | 62 | <span class="desc"> |
| 62 | - <i class="fa fa-check"></i> 确认 </span> | |
| 63 | + <i class="fa fa-check"></i> 确认并提交 </span> | |
| 63 | 64 | </a> |
| 64 | 65 | </li> |
| 65 | 66 | </ul> |
| ... | ... | @@ -81,47 +82,33 @@ |
| 81 | 82 | |
| 82 | 83 | <!-- 选择添加站点方式 --> |
| 83 | 84 | <div class="tab-pane active" id="tab1"> |
| 84 | - | |
| 85 | - <h3 class="block"> 选择添加停车场方式 </h3> | |
| 86 | - | |
| 87 | - <!-- 站点名称 --> | |
| 85 | + <h3 class="block"> 获取停车场位置方式 </h3> | |
| 86 | + <!--停车场名称 --> | |
| 88 | 87 | <div class="form-group" id="formRequ"> |
| 89 | - <label class="col-md-3 control-label"><span class="required"> * </span>停车场名称:</label> | |
| 88 | + <label class="col-md-3 control-label"><span class="required"> * </span>停车场名称 :</label> | |
| 90 | 89 | <div class="col-md-9"> |
| 91 | - <input type="text" class="form-control input-medium" id="parkNamebooxtInput" name="parkNamebooxt"> | |
| 90 | + <input type="text" class="form-control input-medium" id="parkNamebooxtInput" name="parkNamebooxt" placeholder="请输入停车场名称"> | |
| 92 | 91 | </div> |
| 93 | 92 | </div> |
| 94 | - | |
| 95 | 93 | <!-- 新增方式 --> |
| 96 | 94 | <div class="form-group"> |
| 97 | - <label class="col-md-3 control-label">新增方式:</label> | |
| 95 | + <label class="col-md-3 control-label"><span class="required"> * </span>选择获取方式:</label> | |
| 98 | 96 | <div class="col-md-9"> |
| 99 | 97 | <div class="icheck-list"> |
| 100 | 98 | <label> |
| 101 | 99 | <input type="radio" class="icheck" name="baseRes" value=0 checked> 系统生成 |
| 102 | 100 | </label> |
| 103 | 101 | <label > |
| 104 | - <input type="radio" class="icheck" name="baseRes" value=1 > 手动添加 | |
| 102 | + <input type="radio" class="icheck" name="baseRes" value=1 > 手动绘制 | |
| 105 | 103 | </label> |
| 106 | 104 | </div> |
| 107 | 105 | </div> |
| 108 | 106 | </div> |
| 109 | - | |
| 110 | - <div class="form-group"> | |
| 111 | - <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50"> | |
| 112 | - <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 新增方式说明: </span></h5> | |
| 113 | - <p><span class="help-block" style="color:#1bbc9b;"> a)系统生成:根据站点名称自动生成以100米为半径范围的圆.</span> </p> | |
| 114 | - <p><span class="help-block" style="color:#1bbc9b;"> b)手动添加:手动在地图上画出站点范围,然后双击鼠标右键保存.</span> </p> | |
| 115 | - </div> | |
| 116 | - </div> | |
| 117 | - | |
| 118 | 107 | </div> |
| 119 | - | |
| 120 | - <!-- 站点位置 --> | |
| 108 | + <!--停车场位置 --> | |
| 121 | 109 | <div class="tab-pane" id="tab2"> |
| 122 | - <h3 class="block"> 站点位置 </h3> | |
| 110 | + <h3 class="block"> 停车场位置 </h3> | |
| 123 | 111 | <div id="addCarParkbmap_basic"></div> |
| 124 | - | |
| 125 | 112 | <div class="leftUtils"> |
| 126 | 113 | <div class="btn-group" style="left: 100px;"> |
| 127 | 114 | <a class="btn btn-sm green-seagreen dropdown-toggle" style="width: 98px;" href="javascript:;" data-toggle="dropdown" aria-expanded="false"> 绘制工具 |
| ... | ... | @@ -139,243 +126,197 @@ |
| 139 | 126 | </div> |
| 140 | 127 | </div> |
| 141 | 128 | </div> |
| 142 | - | |
| 143 | - <!-- 站点信息 --> | |
| 129 | + <!--停车场信息 --> | |
| 144 | 130 | <div class="tab-pane" id="tab3"> |
| 145 | - | |
| 146 | 131 | <h3 class="block"> 停车场信息 </h3> |
| 147 | - | |
| 148 | 132 | <input type="hidden" name="bParkPoint" id="bParkPointInput" /> |
| 149 | - | |
| 150 | 133 | <input type="hidden" name="gParkPoint" id="gParkPointInput" /> |
| 151 | - | |
| 152 | 134 | <input type="hidden" name="dbType" id="dbTypeInput" value="b"/> |
| 153 | - | |
| 154 | - | |
| 155 | 135 | <!-- 停车场名称 --> |
| 156 | 136 | <div class="form-body"> |
| 157 | 137 | <div class="form-group"> |
| 158 | 138 | <label class="control-label col-md-3"> |
| 159 | - <span class="required"> * </span> 停车场名称 : | |
| 139 | + <span class="required"> * </span> 停车场名称 : | |
| 160 | 140 | </label> |
| 161 | 141 | <div class="col-md-6"> |
| 162 | - <input type="text" class="form-control" name="parkName" id="parkNameInput" placeholder="站点名称"> | |
| 142 | + <input type="text" class="form-control" name="parkName" id="parkNameInput" placeholder="请输入站点名称" readonly="readonly"> | |
| 163 | 143 | </div> |
| 164 | 144 | </div> |
| 165 | 145 | </div> |
| 166 | - | |
| 167 | 146 | <!-- 停车场编码 --> |
| 168 | 147 | <div class="form-body"> |
| 169 | 148 | <div class="form-group"> |
| 170 | 149 | <label class="control-label col-md-3"> |
| 171 | - <span class="required"> * </span>停车场编码: | |
| 150 | + <span class="required"> * </span>停车场编码 : | |
| 172 | 151 | </label> |
| 173 | 152 | <div class="col-md-6"> |
| 174 | - <input type="text" class="form-control" name="parkCode" id="parkCodeInput"> | |
| 153 | + <input type="text" class="form-control" name="parkCode" id="parkCodeInput" placeholder="请输入停车场编码"> | |
| 175 | 154 | </div> |
| 176 | 155 | </div> |
| 177 | 156 | </div> |
| 178 | - | |
| 179 | - <!-- 中心位置坐标点 --> | |
| 157 | + <!-- 经纬度坐标点 --> | |
| 180 | 158 | <div class="form-body"> |
| 181 | 159 | <div class="form-group"> |
| 182 | - <label class="col-md-3 control-label">经纬度坐标点:</label> | |
| 160 | + <label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label> | |
| 183 | 161 | <div class="col-md-6"> |
| 184 | - <input type="text" class="form-control" name="bCenterPoint" id="bCenterPointInput"> | |
| 162 | + <input type="text" class="form-control" name="bCenterPoint" id="bCenterPointInput" readonly="readonly" placeholder="请输入经纬度坐标点"> | |
| 185 | 163 | </div> |
| 186 | 164 | </div> |
| 187 | 165 | </div> |
| 188 | 166 | |
| 189 | - <!-- 范围图形类型 --> | |
| 167 | + <!-- 几何图形类型 --> | |
| 190 | 168 | <div class="form-body"> |
| 191 | 169 | <div class="form-group"> |
| 192 | - <label class="col-md-3 control-label">范围图形类型:</label> | |
| 170 | + <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label> | |
| 193 | 171 | <div class="col-md-6"> |
| 194 | - <select name="shapesType" class="form-control" id="shapesTypeSelect"> | |
| 195 | - <option value="">-- 请选择站点类型 --</option> | |
| 196 | - <option value="r">圆形</option> | |
| 197 | - <option value="d">多变形</option> | |
| 198 | - </select> | |
| 172 | + <input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" readonly="readonly" placeholder="请输入几何图形类型"> | |
| 199 | 173 | </div> |
| 200 | 174 | </div> |
| 201 | 175 | </div> |
| 202 | - | |
| 203 | 176 | <!-- 圆形半径 --> |
| 177 | + <div class="form-body" id="radiusGroup"> | |
| 178 | + <div class="form-group"> | |
| 179 | + <label class="col-md-3 control-label"><span class="required"> * </span> 圆形半径 :</label> | |
| 180 | + <div class="col-md-6"> | |
| 181 | + <input type="text" class="form-control" name="radius" id="radiusInput" placeholder="请输入圆形半径"> | |
| 182 | + </div> | |
| 183 | + </div> | |
| 184 | + </div> | |
| 185 | + <!-- 是否撤销 --> | |
| 204 | 186 | <div class="form-body"> |
| 205 | 187 | <div class="form-group"> |
| 206 | - <label class="col-md-3 control-label">圆形半径:</label> | |
| 188 | + <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销 :</label> | |
| 207 | 189 | <div class="col-md-6"> |
| 208 | - <input type="text" class="form-control" name="radius" id="radiusInput" > | |
| 190 | + <select name="destroy" class="form-control" id="destroySelect"> | |
| 191 | + <option value="">-- 请选择撤销类型 --</option> | |
| 192 | + <option value="0">否</option> | |
| 193 | + <option value="1">是</option> | |
| 194 | + </select> | |
| 209 | 195 | </div> |
| 210 | 196 | </div> |
| 211 | 197 | </div> |
| 212 | - | |
| 213 | 198 | <!-- 面积 --> |
| 214 | 199 | <div class="form-body"> |
| 215 | 200 | <div class="form-group"> |
| 216 | - <label class="col-md-3 control-label">面积:</label> | |
| 201 | + <label class="col-md-3 control-label">面积 :</label> | |
| 217 | 202 | <div class="col-md-6"> |
| 218 | - <input type="text" class="form-control" name="area" id="areaInput" > | |
| 219 | - <span class="help-block">单位:平方米</span> | |
| 203 | + <input type="text" class="form-control" name="area" id="areaInput" placeholder="请输入面积"> | |
| 204 | + <span class="help-block">单位:平方米(㎡)</span> | |
| 220 | 205 | </div> |
| 221 | 206 | </div> |
| 222 | 207 | </div> |
| 223 | - | |
| 224 | 208 | <!-- 所属公司 --> |
| 225 | 209 | <div class="form-body"> |
| 226 | 210 | <div class="form-group"> |
| 227 | - <label class="col-md-3 control-label">所属公司:</label> | |
| 211 | + <label class="col-md-3 control-label">所属公司 :</label> | |
| 228 | 212 | <div class="col-md-6"> |
| 229 | - <select name="company" class="form-control" style="width:100%" id="companySelect"> | |
| 230 | - | |
| 231 | - </select> | |
| 213 | + <select name="company" class="form-control" style="width:100%" id="companySelect"></select> | |
| 232 | 214 | </div> |
| 233 | 215 | </div> |
| 234 | 216 | </div> |
| 235 | - | |
| 236 | - | |
| 237 | 217 | <!-- 所属分公司 --> |
| 238 | - <!-- <div class="form-body"> | |
| 218 | + <div class="form-body"> | |
| 239 | 219 | <div class="form-group"> |
| 240 | - <label class="col-md-3 control-label">所属分公司:</label> | |
| 220 | + <label class="col-md-3 control-label">所属分公司 :</label> | |
| 241 | 221 | <div class="col-md-6"> |
| 242 | 222 | <select name="brancheCompany" class="form-control" style="width:100%" id="brancheCompanySelect"> |
| 243 | 223 | </select> |
| 244 | 224 | </div> |
| 245 | 225 | </div> |
| 246 | - </div> --> | |
| 247 | - | |
| 248 | - | |
| 226 | + </div> | |
| 249 | 227 | <!-- 版本号 --> |
| 250 | 228 | <div class="form-body"> |
| 251 | 229 | <div class="form-group"> |
| 252 | - <label class="col-md-3 control-label">版本号:</label> | |
| 230 | + <label class="col-md-3 control-label">版本号 :</label> | |
| 253 | 231 | <div class="col-md-6"> |
| 254 | - <input type="text" class="form-control" name="versions" value='1' Readonly> | |
| 232 | + <input type="text" class="form-control" name="versions" value='1' Readonly placeholder="请输入版本号"> | |
| 255 | 233 | </div> |
| 256 | 234 | </div> |
| 257 | 235 | </div> |
| 258 | - | |
| 259 | - <!-- 范围图形类型 --> | |
| 260 | - <div class="form-body"> | |
| 261 | - <div class="form-group"> | |
| 262 | - <label class="col-md-3 control-label">是否撤销:</label> | |
| 263 | - <div class="col-md-6"> | |
| 264 | - <select name="destroy" class="form-control" id="destroySelect"> | |
| 265 | - <option value="">-- 请选择撤销类型 --</option> | |
| 266 | - <option value="0">否</option> | |
| 267 | - <option value="1">是</option> | |
| 268 | - </select> | |
| 269 | - </div> | |
| 270 | - </div> | |
| 271 | - </div> | |
| 272 | - | |
| 273 | 236 | <!-- 描述/说明 --> |
| 274 | 237 | <div class="form-group"> |
| 275 | - <label class="control-label col-md-3"> 描述/说明: </label> | |
| 238 | + <label class="control-label col-md-3"> 描述/说明 : </label> | |
| 276 | 239 | <div class="col-md-6"> |
| 277 | - <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea> | |
| 240 | + <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="请输入描述/说明"></textarea> | |
| 278 | 241 | </div> |
| 279 | 242 | </div> |
| 280 | 243 | |
| 281 | 244 | </div> |
| 282 | - | |
| 283 | 245 | <!-- 确定提交资料信息 --> |
| 284 | 246 | <div class="tab-pane" id="tab4"> |
| 285 | 247 | <h3 class="block"> 确认您提交的停车场信息 </h3> |
| 286 | - | |
| 287 | 248 | <h4 class="form-section"> 地理位置 </h4> |
| 288 | - | |
| 289 | 249 | <div class="form-group"> |
| 290 | - <label class="control-label col-md-3"> 范围图形类型: </label> | |
| 250 | + <label class="control-label col-md-3"> 几何图形类型: </label> | |
| 291 | 251 | <div class="col-md-4"> |
| 292 | 252 | <p class="form-control-static" data-display="shapesType"> </p> |
| 293 | 253 | </div> |
| 294 | 254 | </div> |
| 295 | - | |
| 296 | - <div class="form-group"> | |
| 297 | - <label class="control-label col-md-3"> 圆形半径: </label> | |
| 255 | + <div class="form-group"> | |
| 256 | + <label class="control-label col-md-3"> 圆形半径 : </label> | |
| 298 | 257 | <div class="col-md-4"> |
| 299 | 258 | <p class="form-control-static" data-display="radius"> </p> |
| 300 | 259 | </div> |
| 301 | 260 | </div> |
| 302 | 261 | |
| 303 | 262 | <div class="form-group"> |
| 304 | - <label class="control-label col-md-3"> 中心位置经纬度坐标点: </label> | |
| 263 | + <label class="control-label col-md-3"> 经纬度坐标点: </label> | |
| 305 | 264 | <div class="col-md-4"> |
| 306 | 265 | <p class="form-control-static" data-display="bCenterPoint"> </p> |
| 307 | 266 | </div> |
| 308 | 267 | </div> |
| 309 | - | |
| 310 | - <!-- <div class="form-group"> | |
| 311 | - <label class="control-label col-md-3"> 中心位置WGS坐标点: </label> | |
| 312 | - <div class="col-md-4"> | |
| 313 | - <p class="form-control-static" data-display="gCenterPoint"> </p> | |
| 314 | - </div> | |
| 315 | - </div> --> | |
| 316 | - | |
| 317 | 268 | <h4 class="form-section"> 停车场信息 </h4> |
| 318 | - | |
| 319 | 269 | <div class="form-group"> |
| 320 | - <label class="control-label col-md-3">停车场名称:</label> | |
| 270 | + <label class="control-label col-md-3">停车场名称 :</label> | |
| 321 | 271 | <div class="col-md-4"> |
| 322 | 272 | <p class="form-control-static" data-display="parkName"> </p> |
| 323 | 273 | </div> |
| 324 | 274 | </div> |
| 325 | - | |
| 326 | 275 | <div class="form-group"> |
| 327 | - <label class="control-label col-md-3">停车场编码:</label> | |
| 276 | + <label class="control-label col-md-3">停车场编码 :</label> | |
| 328 | 277 | <div class="col-md-4"> |
| 329 | 278 | <p class="form-control-static" data-display="parkCode"> </p> |
| 330 | 279 | </div> |
| 331 | 280 | </div> |
| 332 | - | |
| 333 | - <div class="form-group"> | |
| 334 | - <label class="control-label col-md-3">面积:</label> | |
| 281 | + <div class="form-group"> | |
| 282 | + <label class="control-label col-md-3">是否撤销 :</label> | |
| 283 | + <div class="col-md-4"> | |
| 284 | + <p class="form-control-static" data-display="destroy"> </p> | |
| 285 | + </div> | |
| 286 | + </div> | |
| 287 | + <div class="form-group"> | |
| 288 | + <label class="control-label col-md-3">面积 :</label> | |
| 335 | 289 | <div class="col-md-4"> |
| 336 | 290 | <p class="form-control-static" data-display="area"> </p> |
| 337 | 291 | </div> |
| 338 | 292 | </div> |
| 339 | - | |
| 340 | 293 | <div class="form-group"> |
| 341 | - <label class="control-label col-md-3">所属公司:</label> | |
| 294 | + <label class="control-label col-md-3">所属公司 :</label> | |
| 342 | 295 | <div class="col-md-4"> |
| 343 | 296 | <p class="form-control-static" data-display="company"> </p> |
| 344 | 297 | </div> |
| 345 | 298 | </div> |
| 346 | - | |
| 347 | - <!-- <div class="form-group"> | |
| 348 | - <label class="control-label col-md-3">分公司:</label> | |
| 349 | - <div class="col-md-4"> | |
| 350 | - <p class="form-control-static" data-display="brancheCompany"> </p> | |
| 351 | - </div> | |
| 352 | - </div> --> | |
| 353 | - | |
| 354 | 299 | <div class="form-group"> |
| 355 | - <label class="control-label col-md-3">版本号:</label> | |
| 300 | + <label class="control-label col-md-3">分公司 :</label> | |
| 356 | 301 | <div class="col-md-4"> |
| 357 | - <p class="form-control-static" data-display="versions"> </p> | |
| 302 | + <p class="form-control-static" data-display="brancheCompany"> </p> | |
| 358 | 303 | </div> |
| 359 | 304 | </div> |
| 360 | - | |
| 361 | - <div class="form-group"> | |
| 362 | - <label class="control-label col-md-3">是否撤销:</label> | |
| 305 | + <div class="form-group"> | |
| 306 | + <label class="control-label col-md-3">版本号 :</label> | |
| 363 | 307 | <div class="col-md-4"> |
| 364 | - <p class="form-control-static" data-display="destroy"> </p> | |
| 308 | + <p class="form-control-static" data-display="versions"> </p> | |
| 365 | 309 | </div> |
| 366 | 310 | </div> |
| 367 | - | |
| 368 | 311 | <div class="form-group"> |
| 369 | - <label class="control-label col-md-3">描述/说明:</label> | |
| 312 | + <label class="control-label col-md-3">描述/说明 :</label> | |
| 370 | 313 | <div class="col-md-4"> |
| 371 | 314 | <p class="form-control-static" data-display="descriptions"> </p> |
| 372 | 315 | </div> |
| 373 | 316 | </div> |
| 374 | - | |
| 375 | 317 | </div> |
| 376 | 318 | </div> |
| 377 | 319 | </div> |
| 378 | - | |
| 379 | 320 | <div class="form-actions"> |
| 380 | 321 | <div class="row"> |
| 381 | 322 | <div class="col-md-offset-3 col-md-9"> |
| ... | ... | @@ -390,26 +331,18 @@ |
| 390 | 331 | </div> |
| 391 | 332 | </div> |
| 392 | 333 | </div> |
| 393 | - | |
| 394 | 334 | </div> |
| 395 | 335 | </form> |
| 396 | - | |
| 397 | 336 | <!-- END FORM--> |
| 398 | - | |
| 399 | 337 | </div> |
| 400 | 338 | </div> |
| 401 | - | |
| 402 | 339 | <!-- 函数方法JS类库 --> |
| 403 | 340 | <script src="/pages/base/carpark/js/add-input-function.js"></script> |
| 404 | - | |
| 405 | 341 | <!-- 表单向导JS类库 --> |
| 406 | 342 | <script src="/pages/base/carpark/js/add-form-wizard.js"></script> |
| 407 | - | |
| 343 | +<!-- reload事件 --> | |
| 344 | +<script src="/pages/base/carpark/js/add-form-reload.js"></script> | |
| 408 | 345 | <!-- 地图JS类库 --> |
| 409 | 346 | <script src="/pages/base/carpark/js/add-vmap-world.js"></script> |
| 410 | - | |
| 411 | 347 | <!-- 表单元素事件JS类库 --> |
| 412 | -<script src="/pages/base/carpark/js/add-form-events.js"></script> | |
| 413 | - | |
| 414 | -<!-- reload事件 --> | |
| 415 | -<script src="/pages/base/carpark/js/add-form-reload.js"></script> | |
| 416 | 348 | \ No newline at end of file |
| 349 | +<script src="/pages/base/carpark/js/add-form-events.js"></script> | |
| 417 | 350 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/carpark/css/carpark-add.css
src/main/resources/static/pages/base/carpark/css/positions.css
| ... | ... | @@ -21,7 +21,7 @@ html,body{ |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
| 24 | -.leftUtils{ | |
| 24 | +.leftUtils, .drwmageUtils{ | |
| 25 | 25 | position: absolute; |
| 26 | 26 | padding-right: 100px; |
| 27 | 27 | width: 100%; |
| ... | ... | @@ -29,6 +29,7 @@ html,body{ |
| 29 | 29 | z-index: 9999; |
| 30 | 30 | padding-top: 7px; |
| 31 | 31 | top: 20px; |
| 32 | + display: none; | |
| 32 | 33 | } |
| 33 | 34 | |
| 34 | 35 | .BMap_pop div:nth-child(1) , | ... | ... |
src/main/resources/static/pages/base/carpark/edit.html
| 1 | 1 | <!-- 编辑停车场 --> |
| 2 | 2 | <div class="modal fade" id="editPoitsions_carpark_mobal" tabindex="-1" role="basic" aria-hidden="true"> |
| 3 | - | |
| 4 | 3 | <div class="modal-dialog"> |
| 5 | - | |
| 6 | 4 | <div class="modal-content"> |
| 7 | - | |
| 8 | 5 | <div class="modal-header"> |
| 9 | 6 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> |
| 10 | - <h4 class="modal-title">编辑站点</h4> | |
| 7 | + <h4 class="modal-title">编辑停车场</h4> | |
| 11 | 8 | </div> |
| 12 | - | |
| 13 | 9 | <div class="modal-body"> |
| 14 | 10 | |
| 15 | 11 | <form class="form-horizontal" role="form" id="edit_carPark_form" action="/module" method="post"> |
| ... | ... | @@ -17,80 +13,81 @@ |
| 17 | 13 | <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button> |
| 18 | 14 | 您的输入有误,请检查下面的输入项 |
| 19 | 15 | </div> |
| 20 | - | |
| 21 | 16 | <input type="hidden" name="id" id="idInput" /> |
| 22 | - | |
| 23 | 17 | <input type="hidden" name="bParkPoint" id="bParkPointInput" /> |
| 24 | - | |
| 25 | 18 | <input type="hidden" name="gParkPoint" id="gParkPointInput" /> |
| 26 | - | |
| 27 | 19 | <input type="hidden" name="dbType" id="dbTypeInput" value="b"/> |
| 28 | - | |
| 29 | 20 | <!-- 停车场名称 --> |
| 30 | 21 | <div class="form-body"> |
| 31 | 22 | <div class="form-group"> |
| 32 | 23 | <label class="control-label col-md-3"> |
| 33 | - <span class="required"> * </span> 停车场名称 : | |
| 24 | + <span class="required"> * </span> 停车场名称 : | |
| 34 | 25 | </label> |
| 35 | 26 | <div class="col-md-6"> |
| 36 | - <input type="text" class="form-control" name="parkName" id="parkNameInput" placeholder="站点名称"> | |
| 27 | + <input type="text" class="form-control" name="parkName" id="parkNameInput" placeholder="请输入停车场名称"> | |
| 37 | 28 | </div> |
| 38 | 29 | </div> |
| 39 | 30 | </div> |
| 40 | - | |
| 41 | 31 | <!-- 停车场编码 --> |
| 42 | 32 | <div class="form-body"> |
| 43 | 33 | <div class="form-group"> |
| 44 | 34 | <label class="control-label col-md-3"> |
| 45 | - <span class="required"> * </span>停车场编码: | |
| 35 | + <span class="required"> * </span>停车场编码 : | |
| 46 | 36 | </label> |
| 47 | 37 | <div class="col-md-6"> |
| 48 | - <input type="text" class="form-control" name="parkCode" id="parkCodeInput"> | |
| 38 | + <input type="text" class="form-control" name="parkCode" id="parkCodeInput" readonly="readonly" placeholder="请输入停车场编码"> | |
| 49 | 39 | </div> |
| 50 | 40 | </div> |
| 51 | 41 | </div> |
| 52 | - | |
| 53 | - <!-- 中心位置坐标点 --> | |
| 42 | + <!-- 经纬度坐标点 --> | |
| 54 | 43 | <div class="form-body"> |
| 55 | 44 | <div class="form-group"> |
| 56 | - <label class="col-md-3 control-label">经纬度坐标点:</label> | |
| 45 | + <label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label> | |
| 57 | 46 | <div class="col-md-6"> |
| 58 | - <input type="text" class="form-control" name="bCenterPoint" id="bCenterPointInput"> | |
| 47 | + <input type="text" class="form-control" name="bCenterPoint" id="bCenterPointInput" readonly="readonly" placeholder="请输入经纬度坐标点"> | |
| 59 | 48 | </div> |
| 60 | 49 | </div> |
| 61 | 50 | </div> |
| 62 | 51 | |
| 63 | - <!-- 范围图形类型 --> | |
| 52 | + <!-- 几何图形类型 --> | |
| 64 | 53 | <div class="form-body"> |
| 65 | 54 | <div class="form-group"> |
| 66 | - <label class="col-md-3 control-label">范围图形类型:</label> | |
| 55 | + <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label> | |
| 67 | 56 | <div class="col-md-6"> |
| 68 | - <select name="shapesType" class="form-control" id="shapesTypeSelect"> | |
| 69 | - <option value="">-- 请选择站点类型 --</option> | |
| 70 | - <option value="r">圆形</option> | |
| 71 | - <option value="d">多变形</option> | |
| 72 | - </select> | |
| 57 | + <input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" readonly="readonly" placeholder="请输入几何图形类型"> | |
| 73 | 58 | </div> |
| 74 | 59 | </div> |
| 75 | 60 | </div> |
| 76 | 61 | |
| 77 | 62 | <!-- 圆形半径 --> |
| 63 | + <div class="form-body" id="radiusGroup"> | |
| 64 | + <div class="form-group"> | |
| 65 | + <label class="col-md-3 control-label"><span class="required"> * </span>圆形半径 :</label> | |
| 66 | + <div class="col-md-6"> | |
| 67 | + <input type="text" class="form-control" name="radius" id="radiusInput" placeholder="请输入圆形半径"> | |
| 68 | + </div> | |
| 69 | + </div> | |
| 70 | + </div> | |
| 71 | + <!-- 是否撤销 --> | |
| 78 | 72 | <div class="form-body"> |
| 79 | 73 | <div class="form-group"> |
| 80 | - <label class="col-md-3 control-label">圆形半径:</label> | |
| 74 | + <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销 :</label> | |
| 81 | 75 | <div class="col-md-6"> |
| 82 | - <input type="text" class="form-control" name="radius" id="radiusInput" > | |
| 76 | + <select name="destroy" class="form-control" id="destroySelect"> | |
| 77 | + <option value="">-- 请选择撤销类型 --</option> | |
| 78 | + <option value="0">否</option> | |
| 79 | + <option value="1">是</option> | |
| 80 | + </select> | |
| 83 | 81 | </div> |
| 84 | 82 | </div> |
| 85 | 83 | </div> |
| 86 | - | |
| 87 | 84 | <!-- 面积 --> |
| 88 | 85 | <div class="form-body"> |
| 89 | 86 | <div class="form-group"> |
| 90 | - <label class="col-md-3 control-label">面积:</label> | |
| 87 | + <label class="col-md-3 control-label">面积 :</label> | |
| 91 | 88 | <div class="col-md-6"> |
| 92 | 89 | <input type="text" class="form-control" name="area" id="areaInput" > |
| 93 | - <span class="help-block">单位:平方米</span> | |
| 90 | + <span class="help-block">单位:平方米(㎡)</span> | |
| 94 | 91 | </div> |
| 95 | 92 | </div> |
| 96 | 93 | </div> |
| ... | ... | @@ -98,7 +95,7 @@ |
| 98 | 95 | <!-- 所属公司 --> |
| 99 | 96 | <div class="form-body"> |
| 100 | 97 | <div class="form-group"> |
| 101 | - <label class="col-md-3 control-label">所属公司:</label> | |
| 98 | + <label class="col-md-3 control-label">所属公司 :</label> | |
| 102 | 99 | <div class="col-md-6"> |
| 103 | 100 | <select name="company" class="form-control" style="width:100%" id="companySelect"> |
| 104 | 101 | |
| ... | ... | @@ -106,47 +103,33 @@ |
| 106 | 103 | </div> |
| 107 | 104 | </div> |
| 108 | 105 | </div> |
| 109 | - | |
| 106 | + | |
| 110 | 107 | <!-- 所属分公司 --> |
| 111 | - <!-- <div class="form-body"> | |
| 108 | + <div class="form-body"> | |
| 112 | 109 | <div class="form-group"> |
| 113 | - <label class="col-md-3 control-label">所属分公司:</label> | |
| 110 | + <label class="col-md-3 control-label">所属分公司 :</label> | |
| 114 | 111 | <div class="col-md-6"> |
| 115 | 112 | <select name="brancheCompany" class="form-control" style="width:100%" id="brancheCompanySelect"> |
| 116 | 113 | </select> |
| 117 | 114 | </div> |
| 118 | 115 | </div> |
| 119 | - </div> --> | |
| 120 | - | |
| 121 | - <!-- 版本号 --> | |
| 122 | - <div class="form-body"> | |
| 123 | - <div class="form-group"> | |
| 124 | - <label class="col-md-3 control-label">版本号:</label> | |
| 125 | - <div class="col-md-6"> | |
| 126 | - <input type="text" class="form-control" name="versions" value='1' Readonly> | |
| 127 | - </div> | |
| 128 | - </div> | |
| 129 | 116 | </div> |
| 130 | 117 | |
| 131 | - <!-- 范围图形类型 --> | |
| 118 | + <!-- 版本号 --> | |
| 132 | 119 | <div class="form-body"> |
| 133 | 120 | <div class="form-group"> |
| 134 | - <label class="col-md-3 control-label">是否撤销:</label> | |
| 121 | + <label class="col-md-3 control-label">版本号 :</label> | |
| 135 | 122 | <div class="col-md-6"> |
| 136 | - <select name="destroy" class="form-control" id="destroySelect"> | |
| 137 | - <option value="">-- 请选择撤销类型 --</option> | |
| 138 | - <option value="0">否</option> | |
| 139 | - <option value="1">是</option> | |
| 140 | - </select> | |
| 123 | + <input type="text" class="form-control" name="versions" value='1' Readonly placeholder="请输入版本号"> | |
| 141 | 124 | </div> |
| 142 | 125 | </div> |
| 143 | 126 | </div> |
| 144 | 127 | |
| 145 | 128 | <!-- 描述/说明 --> |
| 146 | 129 | <div class="form-group"> |
| 147 | - <label class="control-label col-md-3"> 描述/说明: </label> | |
| 130 | + <label class="control-label col-md-3"> 描述/说明 : </label> | |
| 148 | 131 | <div class="col-md-6"> |
| 149 | - <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea> | |
| 132 | + <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="请输入描述/说明"></textarea> | |
| 150 | 133 | </div> |
| 151 | 134 | </div> |
| 152 | 135 | </form> |
| ... | ... | @@ -161,105 +144,67 @@ |
| 161 | 144 | <script type="text/javascript"> |
| 162 | 145 | |
| 163 | 146 | $('#editPoitsions_carpark_mobal').on('editCarParkMobal_show', function(e, map,fun,carP,ajaxd){ |
| 164 | - | |
| 165 | 147 | /** 获取停车场信息对象 */ |
| 166 | 148 | var CarParkObj = carP.getEitdCarPark(); |
| 167 | - | |
| 168 | 149 | // 获取修改停车场对象ID |
| 169 | 150 | var carParkId = CarParkObj.carParkId; |
| 170 | - | |
| 171 | - /** 根据修改停车场对象属性值 设值表单元素 @paran:<CarParkObj:停车场对象>*/ | |
| 151 | + /** 根据修改停车场对象属性值 设值表单元素 @paran:<CarParkObj:停车场对象>*/ | |
| 172 | 152 | fun.setFormValue(CarParkObj); |
| 173 | - | |
| 174 | 153 | /** 填充公司下拉框 */ |
| 175 | 154 | fun.selectTemp(function() { |
| 176 | - | |
| 177 | 155 | // 获取公司代码 |
| 178 | 156 | var businessCode = CarParkObj.carParkCompany; |
| 179 | - | |
| 180 | 157 | // 获取公司元素并设值 |
| 181 | 158 | $('#companySelect').val(businessCode); |
| 182 | - | |
| 183 | - /** 填充分公司下拉框 @param:<businessCode:公司代码> */ | |
| 184 | - /* fun.getbrancheCompanyValues(businessCode,function() { | |
| 185 | - | |
| 159 | + /** 填充分公司下拉框 @param:<businessCode:公司代码> */ | |
| 160 | + fun.getbrancheCompanyValues(businessCode,function() { | |
| 186 | 161 | // 获取分公司元素并设值 |
| 187 | 162 | $('#brancheCompanySelect').val(CarParkObj.carParkBrancheCompany); |
| 188 | - | |
| 189 | - }); */ | |
| 190 | - | |
| 163 | + }); | |
| 191 | 164 | }); |
| 192 | - | |
| 193 | 165 | // 公司值改变事件 |
| 194 | - // $('#companySelect').on('change',companySelectChangeSetBrancheValue); | |
| 195 | - | |
| 166 | + $('#companySelect').on('change',companySelectChangeSetBrancheValue); | |
| 196 | 167 | function companySelectChangeSetBrancheValue() { |
| 197 | - | |
| 198 | 168 | // 获取公司下拉框选择值 |
| 199 | 169 | var businessCode = $('#companySelect').val(); |
| 200 | - | |
| 201 | 170 | // 分公司下拉框options属性值 |
| 202 | 171 | var options = '<option value="">-- 请选择分公司 --</option>'; |
| 203 | - | |
| 204 | 172 | // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码 |
| 205 | 173 | if(businessCode == null || businessCode ==''){ |
| 206 | - | |
| 207 | 174 | // 填充分公司下拉框options |
| 208 | 175 | $('#brancheCompanySelect').html(options); |
| 209 | - | |
| 210 | 176 | } else { |
| 211 | - | |
| 212 | 177 | // 查询出所属公司下的分公司名称和相应分公司代码 |
| 213 | 178 | $get('/business/all', {upCode_eq: businessCode}, function(array){ |
| 214 | - | |
| 215 | 179 | // 遍历array |
| 216 | 180 | $.each(array, function(i,d){ |
| 217 | - | |
| 218 | 181 | options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>'; |
| 219 | - | |
| 220 | 182 | }); |
| 221 | - | |
| 222 | 183 | // 填充分公司下拉框options |
| 223 | 184 | $('#brancheCompanySelect').html(options); |
| 224 | - | |
| 225 | 185 | }); |
| 226 | 186 | } |
| 227 | 187 | } |
| 228 | - | |
| 229 | 188 | // 显示mobal |
| 230 | 189 | $('#editPoitsions_carpark_mobal').modal({show : true,backdrop: 'static',keyboard: false}); |
| 231 | - | |
| 232 | 190 | // 当调用 hide 实例方法时触发 |
| 233 | 191 | $('#editPoitsions_carpark_mobal').on('hide.bs.modal', function () { |
| 234 | - | |
| 235 | 192 | clearSechear(); |
| 236 | - | |
| 237 | 193 | }); |
| 238 | - | |
| 239 | 194 | function clearSechear(){ |
| 240 | - | |
| 241 | 195 | map.clearMarkAndOverlays(); |
| 242 | - | |
| 243 | 196 | carP.setEitdCarPark({}); |
| 244 | - | |
| 245 | 197 | fun.initCarPark(carParkId); |
| 246 | - | |
| 247 | 198 | } |
| 248 | - | |
| 249 | 199 | // 编辑表单元素 |
| 250 | 200 | var form = $('#edit_carPark_form'); |
| 251 | - | |
| 252 | 201 | // 获取错误提示元素 |
| 253 | 202 | var error = $('.alert-danger', form); |
| 254 | - | |
| 255 | 203 | // 提交数据按钮事件 |
| 256 | 204 | $('#editStationButton').on('click', function() { |
| 257 | - | |
| 258 | 205 | // 表单提交 |
| 259 | 206 | form.submit(); |
| 260 | - | |
| 261 | 207 | }); |
| 262 | - | |
| 263 | 208 | // 表单验证 |
| 264 | 209 | form.validate({ |
| 265 | 210 | |
| ... | ... | @@ -270,80 +215,52 @@ $('#editPoitsions_carpark_mobal').on('editCarParkMobal_show', function(e, map,fu |
| 270 | 215 | focusInvalid : false, |
| 271 | 216 | |
| 272 | 217 | rules : { |
| 273 | - | |
| 274 | - // 停车场名称 | |
| 275 | - 'parkName' : { | |
| 276 | - | |
| 277 | - // 必填项 | |
| 278 | - required : true | |
| 279 | - | |
| 280 | - } | |
| 281 | - | |
| 218 | + 'parkName' : {required : true,},// 停车场名称 必填项 | |
| 219 | + 'parkCode' : {required : true},// 停车场编码 必填项 | |
| 220 | + 'bCenterPoint' : {required : true,},// 经纬度坐标点 必填项 | |
| 221 | + 'shapesType' : {required : true,},// 几何图形类型 必填项 | |
| 222 | + 'radius' : {required : true,digits:true},// 圆形半径 必填项 | |
| 223 | + 'destroy' : {required : true,},// 是否撤销 必填项 | |
| 224 | + 'area' : {number:true,},// 面积 数字 | |
| 225 | + 'descriptions' : {maxlength: 200,},// 描述/说明 最大长度200 | |
| 282 | 226 | }, |
| 283 | - | |
| 284 | 227 | invalidHandler : function(event, validator) { |
| 285 | - | |
| 286 | 228 | error.show(); |
| 287 | - | |
| 288 | 229 | App.scrollTo(error, -200); |
| 289 | - | |
| 290 | 230 | }, |
| 291 | - | |
| 292 | 231 | highlight : function(element) { |
| 293 | - | |
| 294 | 232 | $(element).closest('.form-group').addClass('has-error'); |
| 295 | - | |
| 296 | 233 | }, |
| 297 | - | |
| 298 | 234 | unhighlight : function(element) { |
| 299 | - | |
| 300 | 235 | $(element).closest('.form-group').removeClass('has-error'); |
| 301 | - | |
| 302 | 236 | }, |
| 303 | - | |
| 304 | 237 | success : function(label) { |
| 305 | - | |
| 306 | 238 | label.closest('.form-group').removeClass('has-error'); |
| 307 | - | |
| 308 | 239 | }, |
| 309 | - | |
| 310 | 240 | submitHandler : function(f) { |
| 311 | - | |
| 312 | 241 | var params = form.serializeJSON(); |
| 313 | - | |
| 314 | 242 | params.createBy = CarParkObj.carParkCreateBy; |
| 315 | - | |
| 316 | 243 | // 定义日期格式 |
| 317 | 244 | var fs = 'YYYY-MM-DD HH:mm:ss' |
| 318 | - | |
| 319 | 245 | // 设置日期 |
| 320 | 246 | params.createDate = moment(CarParkObj.carParkCreateDate).format(fs); |
| 321 | - | |
| 322 | 247 | error.hide(); |
| 323 | - | |
| 248 | + if(params.shapesType=='多边形') | |
| 249 | + params.shapesType = 'd'; | |
| 250 | + else if(params.shapesType=='圆形') | |
| 251 | + params.shapesType=='r'; | |
| 324 | 252 | ajaxd.carParkUpdate(params,function(resuntDate) { |
| 325 | - | |
| 326 | 253 | if(resuntDate.status=='SUCCESS') { |
| 327 | - | |
| 328 | 254 | // 弹出添加成功提示消息 |
| 329 | 255 | layer.msg('修改成功...'); |
| 330 | - | |
| 331 | - | |
| 332 | 256 | }else { |
| 333 | - | |
| 334 | 257 | // 弹出添加失败提示消息 |
| 335 | 258 | layer.msg('修改失败...'); |
| 336 | - | |
| 337 | 259 | } |
| 338 | - | |
| 339 | 260 | clearSechear(); |
| 340 | - | |
| 341 | 261 | $('#editPoitsions_carpark_mobal').modal('hide'); |
| 342 | - | |
| 343 | 262 | }) |
| 344 | - | |
| 345 | 263 | } |
| 346 | 264 | }); |
| 347 | - | |
| 348 | 265 | }); |
| 349 | 266 | </script> |
| 350 | 267 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/carpark/edit_select.html
| ... | ... | @@ -3,36 +3,33 @@ |
| 3 | 3 | |
| 4 | 4 | <div class="modal-dialog"> |
| 5 | 5 | |
| 6 | - <div class="modal-content"> | |
| 6 | + <div class="modal-content" style="width:700px"> | |
| 7 | 7 | |
| 8 | 8 | <div class="modal-header"> |
| 9 | 9 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> |
| 10 | - <h4 class="modal-title">选择修改停车场方式</h4> | |
| 10 | + <h4 class="modal-title">选择修改停车场方式 | |
| 11 | + <i class="fa fa-question-circle tipso-animation" style="color: rgba(158, 158, 158, 0.49);"></i> | |
| 12 | + </h4> | |
| 11 | 13 | </div> |
| 12 | 14 | |
| 13 | 15 | <div class="modal-body"> |
| 14 | - | |
| 15 | 16 | <form class="form-horizontal" action="/" method="post" id="edit_select" role="form"> |
| 16 | - | |
| 17 | 17 | <div class="alert alert-danger display-hide" id="editSelectrequired"> |
| 18 | 18 | <button class="close" data-close="alert"></button> |
| 19 | - 站点名称为必填项 | |
| 19 | + 停车场名称为必填项 | |
| 20 | 20 | </div> |
| 21 | - | |
| 22 | 21 | <div class="alert alert-danger display-hide" id="serchrname"> |
| 23 | 22 | <button class="close" data-close="alert"></button> |
| 24 | 23 | 系统无法生成,请选择其他方式新增 |
| 25 | 24 | </div> |
| 26 | - | |
| 27 | 25 | <div class="form-group" id="formRequ"> |
| 28 | 26 | <label class="col-md-3 control-label"><span class="required"> * </span>停车场名称:</label> |
| 29 | 27 | <div class="col-md-9" id="errorInfo"> |
| 30 | 28 | <input type="text" class="form-control input-medium" id="carParkNameboxInput" name="carParkNamebox"> |
| 31 | 29 | </div> |
| 32 | 30 | </div> |
| 33 | - | |
| 34 | 31 | <div class="form-group"> |
| 35 | - <label class="col-md-3 control-label">修改方式:</label> | |
| 32 | + <label class="col-md-3 control-label"><span class="required"> * </span>修改方式 :</label> | |
| 36 | 33 | <div class="col-md-9"> |
| 37 | 34 | <div class="icheck-list"> |
| 38 | 35 | <label> |
| ... | ... | @@ -44,13 +41,6 @@ |
| 44 | 41 | </div> |
| 45 | 42 | </div> |
| 46 | 43 | </div> |
| 47 | - <div class="form-group"> | |
| 48 | - <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50"> | |
| 49 | - <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 修改方式说明: </span></h5> | |
| 50 | - <p><span class="help-block" style="color:#1bbc9b;"> a)系统生成:根据站点名称自动生成以150米为半径范围的圆.</span> </p> | |
| 51 | - <p><span class="help-block" style="color:#1bbc9b;"> b)手动添加:手动在地图上画出站点范围,然后双击鼠标右键保存.</span> </p> | |
| 52 | - </div> | |
| 53 | - </div> | |
| 54 | 44 | </form> |
| 55 | 45 | </div> |
| 56 | 46 | <div class="modal-footer"> |
| ... | ... | @@ -61,118 +51,108 @@ |
| 61 | 51 | </div> |
| 62 | 52 | </div> |
| 63 | 53 | <script type="text/javascript"> |
| 64 | - | |
| 65 | 54 | $('#editPositions_select_mobal').on('editSelectMobal_show', function(e, map,fun,carParkE,ajaxd){ |
| 66 | - | |
| 67 | 55 | // 显示选择修改方式弹出层 |
| 68 | 56 | $('#editPositions_select_mobal').modal({show : true,backdrop: 'static',keyboard: false}); |
| 69 | - | |
| 57 | + /* $('.tipso-animation').tipso({ | |
| 58 | + speed : 100, | |
| 59 | + background : '#0ed0e8', | |
| 60 | + color : '#ffffff', | |
| 61 | + position :'right', | |
| 62 | + width : 390, | |
| 63 | + delay : 400, | |
| 64 | + animationIn : 'bounceIn', | |
| 65 | + animationOut : 'bounceOut', | |
| 66 | + offsetX : -485, | |
| 67 | + offsetY : -25, | |
| 68 | + content :'<span style="display:block; float:left;font-size:x-small;line-height:12px">A)手动规划:手动在地图上画出停车场范围,然后双击鼠标右键保存.</span></br>'+ | |
| 69 | + '<span style="display:block; float:left;font-size:x-small">B)重新编辑:编辑原始位置与站点信息.</span>', | |
| 70 | + | |
| 71 | + }); | |
| 72 | + setTimeout(function(){ | |
| 73 | + $('.tipso-animation').tipso('show'); | |
| 74 | + setTimeout(function(){$('.tipso-animation').tipso('hide');},4000); | |
| 75 | + },500); */ | |
| 76 | + setTimeout(function(){ | |
| 77 | + var offsetY = $('.modal-dialog').offset().top-3 , | |
| 78 | + offsetX = $('.modal-dialog').offset().left-10 ; | |
| 79 | + $('.tipso-animation').tipso({ | |
| 80 | + speed : 100, | |
| 81 | + background : '#0ed0e8', | |
| 82 | + color : '#ffffff', | |
| 83 | + position :'right', | |
| 84 | + width : 390, | |
| 85 | + delay : 400, | |
| 86 | + animationIn : 'bounceIn', | |
| 87 | + animationOut : 'bounceOut', | |
| 88 | + offsetX : -(offsetX), | |
| 89 | + offsetY : -(offsetY), | |
| 90 | + content :'<span style="display:block; float:left;font-size:x-small;line-height:12px">A)手动规划:手动在地图上画出停车场范围,然后双击鼠标右键保存.</span></br>'+ | |
| 91 | + '<span style="display:block; float:left;font-size:x-small">B)重新编辑:编辑原始位置与站点信息.</span>', | |
| 92 | + | |
| 93 | + }); | |
| 94 | + $('.tipso-animation').tipso('show'); | |
| 95 | + setTimeout(function(){$('.tipso-animation').tipso('hide');},4000); | |
| 96 | + },500); | |
| 70 | 97 | var carParkObj = carParkE.getEitdCarPark(); |
| 71 | - | |
| 72 | 98 | // 获取停车场名称元素并赋值 |
| 73 | 99 | $('#carParkNameboxInput').val(carParkObj.carParkName); |
| 74 | - | |
| 75 | 100 | // 定义停车场图形类型 |
| 76 | 101 | var stationShapesTypeV = carParkObj.carParkShapesType; |
| 77 | - | |
| 78 | 102 | // 获取表单元素 |
| 79 | 103 | var form = $('#edit_select'); |
| 80 | - | |
| 81 | 104 | // 获取错误提示元素 |
| 82 | 105 | var editSelectrequired = $('#editSelectrequired', form); |
| 83 | - | |
| 84 | 106 | // 下一步操作事件 |
| 85 | 107 | $('#editselectStationNextButton').on('click', function() { |
| 86 | - | |
| 87 | 108 | // 表单提交 |
| 88 | 109 | form.submit(); |
| 89 | - | |
| 90 | 110 | }); |
| 91 | - | |
| 92 | 111 | //form 表单验证 |
| 93 | 112 | form.validate({ |
| 94 | - | |
| 95 | 113 | errorElement : 'span', |
| 96 | - | |
| 97 | 114 | errorClass : 'help-block help-block-error', |
| 98 | - | |
| 99 | 115 | focusInvalid : false, |
| 100 | - | |
| 101 | 116 | rules : { |
| 102 | - | |
| 103 | - 'carParkNamebox' : { | |
| 104 | - | |
| 105 | - required : true, | |
| 106 | - | |
| 107 | - } | |
| 108 | - | |
| 117 | + 'carParkNamebox' : {required : true,} | |
| 109 | 118 | }, |
| 110 | - | |
| 111 | 119 | invalidHandler : function(event, validator) { |
| 112 | - | |
| 113 | 120 | editSelectrequired.show(); |
| 114 | - | |
| 115 | 121 | App.scrollTo(requiredname, -200); |
| 116 | - | |
| 117 | 122 | }, |
| 118 | 123 | |
| 119 | 124 | highlight : function(element) { |
| 120 | - | |
| 121 | 125 | $(element).closest('.form-group').addClass('has-error'); |
| 122 | - | |
| 123 | 126 | }, |
| 124 | - | |
| 125 | 127 | unhighlight : function(element) { |
| 126 | - | |
| 127 | 128 | $(element).closest('.form-group').removeClass('has-error'); |
| 128 | - | |
| 129 | 129 | }, |
| 130 | - | |
| 131 | 130 | success : function(label) { |
| 132 | - | |
| 133 | 131 | label.closest('.form-group').removeClass('has-error'); |
| 134 | - | |
| 135 | 132 | }, |
| 136 | - | |
| 137 | 133 | submitHandler : function(f) { |
| 138 | - | |
| 139 | 134 | // 隐藏弹出层 |
| 140 | 135 | $('#editPositions_select_mobal').modal('hide'); |
| 141 | - | |
| 142 | 136 | $('#eidt').attr("disabled",true); |
| 143 | - | |
| 144 | 137 | $('#eidt').addClass('btn disabled'); |
| 145 | - | |
| 146 | 138 | // 表单序列 |
| 147 | 139 | var params = form.serializeJSON(); |
| 148 | - | |
| 149 | 140 | // 停车场名称 |
| 150 | 141 | var editStationName = params.carParkNamebox; |
| 151 | - | |
| 152 | 142 | var eidtselect_ = params.editselect; |
| 153 | - | |
| 154 | 143 | // 设置停车场名称 |
| 155 | 144 | carParkE.setEitdCarParkName(editStationName); |
| 156 | - | |
| 157 | 145 | if(eidtselect_==0){ |
| 158 | - | |
| 159 | 146 | map.localSearchFromAdreesToPoint(editStationName); |
| 160 | - | |
| 161 | 147 | map.openDrawingManager(); |
| 162 | - | |
| 163 | 148 | }else if(eidtselect_==1){ |
| 164 | - | |
| 165 | 149 | // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒) |
| 166 | 150 | var mindex = layer.msg('编辑完图形后,请双击图形区域保存',{ offset: '126px', |
| 167 | 151 | shift: 0,time: 10000}); |
| 168 | - | |
| 169 | 152 | // 编辑图形 |
| 170 | 153 | map.editShapes(stationShapesTypeV,mindex); |
| 171 | - | |
| 172 | 154 | } |
| 173 | - | |
| 174 | 155 | } |
| 175 | 156 | }); |
| 176 | - | |
| 177 | 157 | }); |
| 178 | 158 | </script> |
| 179 | 159 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/carpark/js/add-form-events.js
| 1 | 1 | $(function(){ |
| 2 | - | |
| 3 | - // 提交 | |
| 4 | - $('.button-submit').on('click',function() { | |
| 5 | - | |
| 6 | - // 获取表单 | |
| 7 | - var formSubm = $('#submit_carpark_form'); | |
| 8 | - | |
| 9 | - formSubm.submit(); | |
| 10 | - | |
| 11 | - }); | |
| 2 | + // 获取表单 提交 | |
| 3 | + $('.button-submit').on('click',function() {$('#submit_carpark_form').submit();}); | |
| 12 | 4 | |
| 13 | 5 | $('#oppenDrawingManager').on('click',function() { |
| 14 | - | |
| 15 | 6 | addCarParkVmapWorlds.drawingManagerOpen(); |
| 16 | - | |
| 17 | 7 | }); |
| 18 | - | |
| 19 | 8 | $('#closeDrawingManager').on('click',function() { |
| 20 | - | |
| 21 | 9 | addCarParkVmapWorlds.drawingManagerClose(); |
| 22 | - | |
| 23 | 10 | }); |
| 24 | - | |
| 25 | 11 | }); |
| 26 | 12 | \ No newline at end of file | ... | ... |