Commit 2f7e3672291e4d38650845a318290bc5845623a8
1 parent
8e1333ea
指令和操作日志
Showing
16 changed files
with
432 additions
and
38 deletions
src/main/java/com/bsth/WebAppConfiguration.java
| @@ -63,11 +63,11 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS | @@ -63,11 +63,11 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS | ||
| 63 | * | 63 | * |
| 64 | * @Title: addInterceptors | 64 | * @Title: addInterceptors |
| 65 | * @Description: TODO(HTTP结构化访问日志记录 ) | 65 | * @Description: TODO(HTTP结构化访问日志记录 ) |
| 66 | - | 66 | + */ |
| 67 | @Override | 67 | @Override |
| 68 | public void addInterceptors(InterceptorRegistry registry) { | 68 | public void addInterceptors(InterceptorRegistry registry) { |
| 69 | registry.addInterceptor(httpOpLogInterceptor); | 69 | registry.addInterceptor(httpOpLogInterceptor); |
| 70 | - }*/ | 70 | + } |
| 71 | 71 | ||
| 72 | @Override | 72 | @Override |
| 73 | public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { | 73 | public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { |
src/main/java/com/bsth/controller/directive/DirectiveController.java
| @@ -3,13 +3,17 @@ package com.bsth.controller.directive; | @@ -3,13 +3,17 @@ package com.bsth.controller.directive; | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | import java.util.Map; | 4 | import java.util.Map; |
| 5 | 5 | ||
| 6 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | import org.springframework.web.bind.annotation.RequestMapping; | 8 | import org.springframework.web.bind.annotation.RequestMapping; |
| 8 | import org.springframework.web.bind.annotation.RequestMethod; | 9 | import org.springframework.web.bind.annotation.RequestMethod; |
| 9 | import org.springframework.web.bind.annotation.RequestParam; | 10 | import org.springframework.web.bind.annotation.RequestParam; |
| 10 | import org.springframework.web.bind.annotation.RestController; | 11 | import org.springframework.web.bind.annotation.RestController; |
| 11 | 12 | ||
| 13 | +import com.alibaba.fastjson.JSON; | ||
| 14 | +import com.alibaba.fastjson.JSONObject; | ||
| 12 | import com.bsth.entity.directive.D80; | 15 | import com.bsth.entity.directive.D80; |
| 16 | +import com.bsth.entity.directive.DC0_A3; | ||
| 13 | import com.bsth.entity.sys.SysUser; | 17 | import com.bsth.entity.sys.SysUser; |
| 14 | import com.bsth.security.util.SecurityUtils; | 18 | import com.bsth.security.util.SecurityUtils; |
| 15 | import com.bsth.service.directive.DirectiveService; | 19 | import com.bsth.service.directive.DirectiveService; |
| @@ -130,4 +134,28 @@ public class DirectiveController { | @@ -130,4 +134,28 @@ public class DirectiveController { | ||
| 130 | 134 | ||
| 131 | return directiveService.findDirective(nbbm, dType, page, size); | 135 | return directiveService.findDirective(nbbm, dType, page, size); |
| 132 | } | 136 | } |
| 137 | + | ||
| 138 | + @RequestMapping(value = "/c0a4", method = RequestMethod.POST) | ||
| 139 | + public int c0a4(@RequestParam String nbbm){ | ||
| 140 | + return directiveService.sendC0A4(nbbm); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | +// @RequestMapping(value = "/c0a3", method = RequestMethod.POST) | ||
| 144 | +// public int c0a3(@RequestParam DC0_A4 c0a4){ | ||
| 145 | +// return directiveService.sendC0A3(c0a4); | ||
| 146 | +// } | ||
| 147 | + | ||
| 148 | + @RequestMapping(value = "/c0a3", method = RequestMethod.POST) | ||
| 149 | + public int c0a3(String json){ | ||
| 150 | + json = StringEscapeUtils.unescapeHtml4(json); | ||
| 151 | + DC0_A3 c0a3 = JSON.toJavaObject(JSONObject.parseObject(json), DC0_A3.class); | ||
| 152 | + return directiveService.sendC0A3(c0a3); | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + @RequestMapping(value = "/c0a5", method = RequestMethod.POST) | ||
| 156 | + public int c0a5(String json){ | ||
| 157 | + json = StringEscapeUtils.unescapeHtml4(json); | ||
| 158 | + //DC0_A3 c0a3 = JSON.toJavaObject(JSONObject.parseObject(json), DC0_A3.class); | ||
| 159 | + return directiveService.sendC0A5(json); | ||
| 160 | + } | ||
| 133 | } | 161 | } |
src/main/java/com/bsth/controller/directive/UpstreamEntrance.java
| @@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject; | @@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject; | ||
| 13 | import com.bsth.data.directive.DayOfDirectives; | 13 | import com.bsth.data.directive.DayOfDirectives; |
| 14 | import com.bsth.data.pilot80.PilotReport; | 14 | import com.bsth.data.pilot80.PilotReport; |
| 15 | import com.bsth.entity.directive.D80; | 15 | import com.bsth.entity.directive.D80; |
| 16 | +import com.bsth.entity.directive.DC0_A4; | ||
| 16 | import com.bsth.entity.directive.DirectiveReponse; | 17 | import com.bsth.entity.directive.DirectiveReponse; |
| 17 | 18 | ||
| 18 | /** | 19 | /** |
| @@ -53,10 +54,25 @@ public class UpstreamEntrance { | @@ -53,10 +54,25 @@ public class UpstreamEntrance { | ||
| 53 | // 80协议上报 | 54 | // 80协议上报 |
| 54 | else if (jsonParam.getInteger("operCode") == 0X80) { | 55 | else if (jsonParam.getInteger("operCode") == 0X80) { |
| 55 | try { | 56 | try { |
| 56 | - D80 d80 = JSON.toJavaObject(jsonParam, D80.class); | ||
| 57 | - // 驾驶员上报 | ||
| 58 | - if (d80.getData().getOperCode2() == 0x26) | 57 | + JSONObject data = jsonParam.getJSONObject("data"); |
| 58 | + switch (data.getShort("operCode2")) { | ||
| 59 | + case 0x26: | ||
| 60 | + // 驾驶员上报 | ||
| 61 | + D80 d80 = JSON.toJavaObject(jsonParam, D80.class); | ||
| 59 | pilotReport.report(d80); | 62 | pilotReport.report(d80); |
| 63 | + break; | ||
| 64 | + | ||
| 65 | + case 0xA4: | ||
| 66 | + data.put("port", data.getString("port").trim()); | ||
| 67 | + data.put("posPort", data.getString("posPort").trim()); | ||
| 68 | + data.put("posIpAddress", data.getString("posIpAddress").trim()); | ||
| 69 | + data.put("ipAddress", data.getString("ipAddress").trim()); | ||
| 70 | + | ||
| 71 | + DC0_A4 c0a4 = JSON.toJavaObject(jsonParam, DC0_A4.class); | ||
| 72 | + System.out.println(c0a4); | ||
| 73 | + break; | ||
| 74 | + } | ||
| 75 | + | ||
| 60 | } catch (Exception e) { | 76 | } catch (Exception e) { |
| 61 | logger.error("", e); | 77 | logger.error("", e); |
| 62 | } | 78 | } |
src/main/java/com/bsth/data/LineConfigData.java
| @@ -15,6 +15,7 @@ import org.springframework.stereotype.Component; | @@ -15,6 +15,7 @@ import org.springframework.stereotype.Component; | ||
| 15 | import com.bsth.entity.Line; | 15 | import com.bsth.entity.Line; |
| 16 | import com.bsth.entity.realcontrol.D80ReplyTemp; | 16 | import com.bsth.entity.realcontrol.D80ReplyTemp; |
| 17 | import com.bsth.entity.realcontrol.LineConfig; | 17 | import com.bsth.entity.realcontrol.LineConfig; |
| 18 | +import com.bsth.oplog.normal.OpLogger; | ||
| 18 | import com.bsth.service.LineService; | 19 | import com.bsth.service.LineService; |
| 19 | import com.bsth.service.realcontrol.LineConfigService; | 20 | import com.bsth.service.realcontrol.LineConfigService; |
| 20 | 21 | ||
| @@ -39,6 +40,9 @@ public class LineConfigData implements CommandLineRunner { | @@ -39,6 +40,9 @@ public class LineConfigData implements CommandLineRunner { | ||
| 39 | 40 | ||
| 40 | @Autowired | 41 | @Autowired |
| 41 | LineService lineService; | 42 | LineService lineService; |
| 43 | + | ||
| 44 | + @Autowired | ||
| 45 | + OpLogger opLog; | ||
| 42 | 46 | ||
| 43 | @Override | 47 | @Override |
| 44 | public void run(String... arg0) throws Exception { | 48 | public void run(String... arg0) throws Exception { |
| @@ -47,6 +51,8 @@ public class LineConfigData implements CommandLineRunner { | @@ -47,6 +51,8 @@ public class LineConfigData implements CommandLineRunner { | ||
| 47 | Iterator<LineConfig> itr = lineConfigService.findAll().iterator(); | 51 | Iterator<LineConfig> itr = lineConfigService.findAll().iterator(); |
| 48 | while (itr.hasNext()) | 52 | while (itr.hasNext()) |
| 49 | setBuffer(itr.next()); | 53 | setBuffer(itr.next()); |
| 54 | + | ||
| 55 | + opLog.info("Line_config_data"); | ||
| 50 | } | 56 | } |
| 51 | 57 | ||
| 52 | public LineConfig get(String lineCode){ | 58 | public LineConfig get(String lineCode){ |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| @@ -72,7 +72,7 @@ public class GpsRealData implements CommandLineRunner{ | @@ -72,7 +72,7 @@ public class GpsRealData implements CommandLineRunner{ | ||
| 72 | 72 | ||
| 73 | @Override | 73 | @Override |
| 74 | public void run(String... arg0) throws Exception { | 74 | public void run(String... arg0) throws Exception { |
| 75 | - Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 7, TimeUnit.SECONDS); | 75 | + Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 18, TimeUnit.SECONDS); |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | public GpsEntity add(GpsEntity gps) { | 78 | public GpsEntity add(GpsEntity gps) { |
| @@ -200,7 +200,10 @@ public class GpsRealData implements CommandLineRunner{ | @@ -200,7 +200,10 @@ public class GpsRealData implements CommandLineRunner{ | ||
| 200 | } | 200 | } |
| 201 | } else | 201 | } else |
| 202 | logger.error("result is null"); | 202 | logger.error("result is null"); |
| 203 | - } finally { | 203 | + } catch(Exception e){ |
| 204 | + logger.error("", e); | ||
| 205 | + } | ||
| 206 | + finally { | ||
| 204 | if (null != httpClient) | 207 | if (null != httpClient) |
| 205 | httpClient.close(); | 208 | httpClient.close(); |
| 206 | if(null != response) | 209 | if(null != response) |
src/main/java/com/bsth/entity/directive/DC0_A3.java
0 → 100644
| 1 | +package com.bsth.entity.directive; | ||
| 2 | + | ||
| 3 | +import javax.persistence.Embeddable; | ||
| 4 | +import javax.persistence.Entity; | ||
| 5 | +import javax.persistence.GeneratedValue; | ||
| 6 | +import javax.persistence.Id; | ||
| 7 | +import javax.persistence.Table; | ||
| 8 | +import javax.persistence.Transient; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * | ||
| 12 | + * @ClassName: DC0_A4 | ||
| 13 | + * @Description: TODO(设备参数) | ||
| 14 | + * @author PanZhao | ||
| 15 | + * @date 2016年10月18日 下午5:22:36 | ||
| 16 | + * | ||
| 17 | + */ | ||
| 18 | +@Entity | ||
| 19 | +@Table(name = "bsth_v_C0_A3") | ||
| 20 | +public class DC0_A3 extends Directive{ | ||
| 21 | + | ||
| 22 | + @Id | ||
| 23 | + @GeneratedValue | ||
| 24 | + private Integer id; | ||
| 25 | + | ||
| 26 | + private DC0_A3Data data; | ||
| 27 | + | ||
| 28 | + @Embeddable | ||
| 29 | + public static class DC0_A3Data { | ||
| 30 | + /** | ||
| 31 | + * 二级协议 | ||
| 32 | + */ | ||
| 33 | + private Short operCode2 = 0xA3; | ||
| 34 | + /** 设备编号 */ | ||
| 35 | + @Transient | ||
| 36 | + private String deviceId; | ||
| 37 | + /** 网关IP地址 */ | ||
| 38 | + private String ipAddress; | ||
| 39 | + /** 网关端口 */ | ||
| 40 | + private int port; | ||
| 41 | + /** 定时定距上报模式 */ | ||
| 42 | + private short reportMode; | ||
| 43 | + /** 定时上报时间间隔 */ | ||
| 44 | + private int interval; | ||
| 45 | + /** 定距上报距离间隔 */ | ||
| 46 | + private String distance; | ||
| 47 | + /** 非线路状态超速阀门 */ | ||
| 48 | + private short speedingThreshold; | ||
| 49 | + /** 预警阀门 */ | ||
| 50 | + private short alarmThreshold; | ||
| 51 | + /** pos机IP地址 */ | ||
| 52 | + private String posIpAddress; | ||
| 53 | + /** pos机端口 */ | ||
| 54 | + private String posPort; | ||
| 55 | + /** 延迟机关时间 */ | ||
| 56 | + private int delay; | ||
| 57 | + /** 中门视频切换到码表界面速度阀门 默认45 */ | ||
| 58 | + private short speedThreshold1; | ||
| 59 | + /** 码表界面切换到中门视频速度阀门 默认35 */ | ||
| 60 | + private short speedThreshold2; | ||
| 61 | + /** 对比度 */ | ||
| 62 | + private short contrast; | ||
| 63 | + /** 亮度 */ | ||
| 64 | + private short brightness; | ||
| 65 | + /** 饱和度 */ | ||
| 66 | + private short saturation; | ||
| 67 | + public Short getOperCode2() { | ||
| 68 | + return operCode2; | ||
| 69 | + } | ||
| 70 | + public void setOperCode2(Short operCode2) { | ||
| 71 | + this.operCode2 = operCode2; | ||
| 72 | + } | ||
| 73 | + public String getDeviceId() { | ||
| 74 | + return deviceId; | ||
| 75 | + } | ||
| 76 | + public void setDeviceId(String deviceId) { | ||
| 77 | + this.deviceId = deviceId; | ||
| 78 | + } | ||
| 79 | + public String getIpAddress() { | ||
| 80 | + return ipAddress; | ||
| 81 | + } | ||
| 82 | + public void setIpAddress(String ipAddress) { | ||
| 83 | + this.ipAddress = ipAddress; | ||
| 84 | + } | ||
| 85 | + public int getPort() { | ||
| 86 | + return port; | ||
| 87 | + } | ||
| 88 | + public void setPort(int port) { | ||
| 89 | + this.port = port; | ||
| 90 | + } | ||
| 91 | + public short getReportMode() { | ||
| 92 | + return reportMode; | ||
| 93 | + } | ||
| 94 | + public void setReportMode(short reportMode) { | ||
| 95 | + this.reportMode = reportMode; | ||
| 96 | + } | ||
| 97 | + public int getInterval() { | ||
| 98 | + return interval; | ||
| 99 | + } | ||
| 100 | + public void setInterval(int interval) { | ||
| 101 | + this.interval = interval; | ||
| 102 | + } | ||
| 103 | + public String getDistance() { | ||
| 104 | + return distance; | ||
| 105 | + } | ||
| 106 | + public void setDistance(String distance) { | ||
| 107 | + this.distance = distance; | ||
| 108 | + } | ||
| 109 | + public short getSpeedingThreshold() { | ||
| 110 | + return speedingThreshold; | ||
| 111 | + } | ||
| 112 | + public void setSpeedingThreshold(short speedingThreshold) { | ||
| 113 | + this.speedingThreshold = speedingThreshold; | ||
| 114 | + } | ||
| 115 | + public short getAlarmThreshold() { | ||
| 116 | + return alarmThreshold; | ||
| 117 | + } | ||
| 118 | + public void setAlarmThreshold(short alarmThreshold) { | ||
| 119 | + this.alarmThreshold = alarmThreshold; | ||
| 120 | + } | ||
| 121 | + public String getPosIpAddress() { | ||
| 122 | + return posIpAddress; | ||
| 123 | + } | ||
| 124 | + public void setPosIpAddress(String posIpAddress) { | ||
| 125 | + this.posIpAddress = posIpAddress; | ||
| 126 | + } | ||
| 127 | + public String getPosPort() { | ||
| 128 | + return posPort; | ||
| 129 | + } | ||
| 130 | + public void setPosPort(String posPort) { | ||
| 131 | + this.posPort = posPort; | ||
| 132 | + } | ||
| 133 | + public int getDelay() { | ||
| 134 | + return delay; | ||
| 135 | + } | ||
| 136 | + public void setDelay(int delay) { | ||
| 137 | + this.delay = delay; | ||
| 138 | + } | ||
| 139 | + public short getSpeedThreshold1() { | ||
| 140 | + return speedThreshold1; | ||
| 141 | + } | ||
| 142 | + public void setSpeedThreshold1(short speedThreshold1) { | ||
| 143 | + this.speedThreshold1 = speedThreshold1; | ||
| 144 | + } | ||
| 145 | + public short getSpeedThreshold2() { | ||
| 146 | + return speedThreshold2; | ||
| 147 | + } | ||
| 148 | + public void setSpeedThreshold2(short speedThreshold2) { | ||
| 149 | + this.speedThreshold2 = speedThreshold2; | ||
| 150 | + } | ||
| 151 | + public short getContrast() { | ||
| 152 | + return contrast; | ||
| 153 | + } | ||
| 154 | + public void setContrast(short contrast) { | ||
| 155 | + this.contrast = contrast; | ||
| 156 | + } | ||
| 157 | + public short getBrightness() { | ||
| 158 | + return brightness; | ||
| 159 | + } | ||
| 160 | + public void setBrightness(short brightness) { | ||
| 161 | + this.brightness = brightness; | ||
| 162 | + } | ||
| 163 | + public short getSaturation() { | ||
| 164 | + return saturation; | ||
| 165 | + } | ||
| 166 | + public void setSaturation(short saturation) { | ||
| 167 | + this.saturation = saturation; | ||
| 168 | + } | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public Integer getId() { | ||
| 172 | + return id; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + public void setId(Integer id) { | ||
| 176 | + this.id = id; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + public DC0_A3Data getData() { | ||
| 180 | + return data; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + public void setData(DC0_A3Data data) { | ||
| 184 | + this.data = data; | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | +} |
src/main/java/com/bsth/entity/directive/DC0_A4.java
| 1 | package com.bsth.entity.directive; | 1 | package com.bsth.entity.directive; |
| 2 | 2 | ||
| 3 | import javax.persistence.Embeddable; | 3 | import javax.persistence.Embeddable; |
| 4 | +import javax.persistence.Entity; | ||
| 4 | import javax.persistence.GeneratedValue; | 5 | import javax.persistence.GeneratedValue; |
| 5 | import javax.persistence.Id; | 6 | import javax.persistence.Id; |
| 7 | +import javax.persistence.Table; | ||
| 8 | +import javax.persistence.Transient; | ||
| 6 | 9 | ||
| 7 | /** | 10 | /** |
| 8 | * | 11 | * |
| 9 | - * @ClassName: DC0_A4 | ||
| 10 | - * @Description: TODO(参数查询) | 12 | + * @ClassName: DC0_A4 |
| 13 | + * @Description: TODO(设备参数) | ||
| 11 | * @author PanZhao | 14 | * @author PanZhao |
| 12 | * @date 2016年10月18日 下午5:22:36 | 15 | * @date 2016年10月18日 下午5:22:36 |
| 13 | * | 16 | * |
| 14 | */ | 17 | */ |
| 18 | +@Entity | ||
| 19 | +@Table(name = "bsth_v_C0_A4") | ||
| 15 | public class DC0_A4 extends Directive{ | 20 | public class DC0_A4 extends Directive{ |
| 16 | 21 | ||
| 17 | @Id | 22 | @Id |
| 18 | @GeneratedValue | 23 | @GeneratedValue |
| 19 | private Integer id; | 24 | private Integer id; |
| 20 | 25 | ||
| 26 | + private DC0A4Data data; | ||
| 21 | 27 | ||
| 22 | @Embeddable | 28 | @Embeddable |
| 23 | public static class DC0A4Data { | 29 | public static class DC0A4Data { |
| @@ -26,6 +32,7 @@ public class DC0_A4 extends Directive{ | @@ -26,6 +32,7 @@ public class DC0_A4 extends Directive{ | ||
| 26 | */ | 32 | */ |
| 27 | private Short operCode2; | 33 | private Short operCode2; |
| 28 | /** 设备编号 */ | 34 | /** 设备编号 */ |
| 35 | + @Transient | ||
| 29 | private String deviceId; | 36 | private String deviceId; |
| 30 | /** 网关IP地址 */ | 37 | /** 网关IP地址 */ |
| 31 | private String ipAddress; | 38 | private String ipAddress; |
| @@ -43,5 +50,137 @@ public class DC0_A4 extends Directive{ | @@ -43,5 +50,137 @@ public class DC0_A4 extends Directive{ | ||
| 43 | private short alarmThreshold; | 50 | private short alarmThreshold; |
| 44 | /** pos机IP地址 */ | 51 | /** pos机IP地址 */ |
| 45 | private String posIpAddress; | 52 | private String posIpAddress; |
| 53 | + /** pos机端口 */ | ||
| 54 | + private String posPort; | ||
| 55 | + /** 延迟机关时间 */ | ||
| 56 | + private int delay; | ||
| 57 | + /** 中门视频切换到码表界面速度阀门 默认45 */ | ||
| 58 | + private short speedThreshold1; | ||
| 59 | + /** 码表界面切换到中门视频速度阀门 默认35 */ | ||
| 60 | + private short speedThreshold2; | ||
| 61 | + /** 对比度 */ | ||
| 62 | + private short contrast; | ||
| 63 | + /** 亮度 */ | ||
| 64 | + private short brightness; | ||
| 65 | + /** 饱和度 */ | ||
| 66 | + private short saturation; | ||
| 67 | + public Short getOperCode2() { | ||
| 68 | + return operCode2; | ||
| 69 | + } | ||
| 70 | + public void setOperCode2(Short operCode2) { | ||
| 71 | + this.operCode2 = operCode2; | ||
| 72 | + } | ||
| 73 | + public String getDeviceId() { | ||
| 74 | + return deviceId; | ||
| 75 | + } | ||
| 76 | + public void setDeviceId(String deviceId) { | ||
| 77 | + this.deviceId = deviceId; | ||
| 78 | + } | ||
| 79 | + public String getIpAddress() { | ||
| 80 | + return ipAddress; | ||
| 81 | + } | ||
| 82 | + public void setIpAddress(String ipAddress) { | ||
| 83 | + this.ipAddress = ipAddress; | ||
| 84 | + } | ||
| 85 | + public int getPort() { | ||
| 86 | + return port; | ||
| 87 | + } | ||
| 88 | + public void setPort(int port) { | ||
| 89 | + this.port = port; | ||
| 90 | + } | ||
| 91 | + public short getReportMode() { | ||
| 92 | + return reportMode; | ||
| 93 | + } | ||
| 94 | + public void setReportMode(short reportMode) { | ||
| 95 | + this.reportMode = reportMode; | ||
| 96 | + } | ||
| 97 | + public int getInterval() { | ||
| 98 | + return interval; | ||
| 99 | + } | ||
| 100 | + public void setInterval(int interval) { | ||
| 101 | + this.interval = interval; | ||
| 102 | + } | ||
| 103 | + public String getDistance() { | ||
| 104 | + return distance; | ||
| 105 | + } | ||
| 106 | + public void setDistance(String distance) { | ||
| 107 | + this.distance = distance; | ||
| 108 | + } | ||
| 109 | + public short getSpeedingThreshold() { | ||
| 110 | + return speedingThreshold; | ||
| 111 | + } | ||
| 112 | + public void setSpeedingThreshold(short speedingThreshold) { | ||
| 113 | + this.speedingThreshold = speedingThreshold; | ||
| 114 | + } | ||
| 115 | + public short getAlarmThreshold() { | ||
| 116 | + return alarmThreshold; | ||
| 117 | + } | ||
| 118 | + public void setAlarmThreshold(short alarmThreshold) { | ||
| 119 | + this.alarmThreshold = alarmThreshold; | ||
| 120 | + } | ||
| 121 | + public String getPosIpAddress() { | ||
| 122 | + return posIpAddress; | ||
| 123 | + } | ||
| 124 | + public void setPosIpAddress(String posIpAddress) { | ||
| 125 | + this.posIpAddress = posIpAddress; | ||
| 126 | + } | ||
| 127 | + public String getPosPort() { | ||
| 128 | + return posPort; | ||
| 129 | + } | ||
| 130 | + public void setPosPort(String posPort) { | ||
| 131 | + this.posPort = posPort; | ||
| 132 | + } | ||
| 133 | + public int getDelay() { | ||
| 134 | + return delay; | ||
| 135 | + } | ||
| 136 | + public void setDelay(int delay) { | ||
| 137 | + this.delay = delay; | ||
| 138 | + } | ||
| 139 | + public short getSpeedThreshold1() { | ||
| 140 | + return speedThreshold1; | ||
| 141 | + } | ||
| 142 | + public void setSpeedThreshold1(short speedThreshold1) { | ||
| 143 | + this.speedThreshold1 = speedThreshold1; | ||
| 144 | + } | ||
| 145 | + public short getSpeedThreshold2() { | ||
| 146 | + return speedThreshold2; | ||
| 147 | + } | ||
| 148 | + public void setSpeedThreshold2(short speedThreshold2) { | ||
| 149 | + this.speedThreshold2 = speedThreshold2; | ||
| 150 | + } | ||
| 151 | + public short getContrast() { | ||
| 152 | + return contrast; | ||
| 153 | + } | ||
| 154 | + public void setContrast(short contrast) { | ||
| 155 | + this.contrast = contrast; | ||
| 156 | + } | ||
| 157 | + public short getBrightness() { | ||
| 158 | + return brightness; | ||
| 159 | + } | ||
| 160 | + public void setBrightness(short brightness) { | ||
| 161 | + this.brightness = brightness; | ||
| 162 | + } | ||
| 163 | + public short getSaturation() { | ||
| 164 | + return saturation; | ||
| 165 | + } | ||
| 166 | + public void setSaturation(short saturation) { | ||
| 167 | + this.saturation = saturation; | ||
| 168 | + } | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public Integer getId() { | ||
| 172 | + return id; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + public void setId(Integer id) { | ||
| 176 | + this.id = id; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + public DC0A4Data getData() { | ||
| 180 | + return data; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + public void setData(DC0A4Data data) { | ||
| 184 | + this.data = data; | ||
| 46 | } | 185 | } |
| 47 | } | 186 | } |
src/main/java/com/bsth/oplog/Type.java deleted
100644 → 0
src/main/java/com/bsth/oplog/db/DBHelper.java
| @@ -11,11 +11,11 @@ import com.bsth.Application; | @@ -11,11 +11,11 @@ import com.bsth.Application; | ||
| 11 | import com.bsth.oplog.Log; | 11 | import com.bsth.oplog.Log; |
| 12 | import com.bsth.oplog.db.mysql.DBPersistence; | 12 | import com.bsth.oplog.db.mysql.DBPersistence; |
| 13 | 13 | ||
| 14 | -//@Component | 14 | +@Component |
| 15 | public class DBHelper implements CommandLineRunner{ | 15 | public class DBHelper implements CommandLineRunner{ |
| 16 | 16 | ||
| 17 | private final static int maxBufSize = 1000; | 17 | private final static int maxBufSize = 1000; |
| 18 | - private final static int fixedMinute = 1; | 18 | + private final static int fixedMinute = 10; |
| 19 | 19 | ||
| 20 | private static LinkedList<Log> buffer = new LinkedList<>(); | 20 | private static LinkedList<Log> buffer = new LinkedList<>(); |
| 21 | 21 |
src/main/java/com/bsth/oplog/http/HttpOpLogInterceptor.java
| @@ -25,7 +25,7 @@ public class HttpOpLogInterceptor implements HandlerInterceptor { | @@ -25,7 +25,7 @@ public class HttpOpLogInterceptor implements HandlerInterceptor { | ||
| 25 | private final PathMatcher pathMatcher = new AntPathMatcher(); | 25 | private final PathMatcher pathMatcher = new AntPathMatcher(); |
| 26 | 26 | ||
| 27 | // GET 白名单 | 27 | // GET 白名单 |
| 28 | - private String[] httpGetWhiteList = { "/user/login/**", "/user/currentUser", "/dictionary/**", "/module/findByCurrentUser" }; | 28 | + private String[] httpGetWhiteList = { "/user/login/**", "/user/currentUser", "/dictionary/**", "/module/findByCurrentUser", "/gps/**", "/error/**" }; |
| 29 | 29 | ||
| 30 | // POST 白名单 | 30 | // POST 白名单 |
| 31 | private String[] httpPostWhiteList = { | 31 | private String[] httpPostWhiteList = { |
src/main/java/com/bsth/oplog/http/HttpRecorder.java
| @@ -16,7 +16,6 @@ import com.alibaba.fastjson.JSON; | @@ -16,7 +16,6 @@ import com.alibaba.fastjson.JSON; | ||
| 16 | import com.bsth.entity.sys.SysUser; | 16 | import com.bsth.entity.sys.SysUser; |
| 17 | import com.bsth.oplog.Level; | 17 | import com.bsth.oplog.Level; |
| 18 | import com.bsth.oplog.Log; | 18 | import com.bsth.oplog.Log; |
| 19 | -import com.bsth.oplog.Type; | ||
| 20 | import com.bsth.oplog.db.DBHelper; | 19 | import com.bsth.oplog.db.DBHelper; |
| 21 | import com.bsth.security.util.SecurityUtils; | 20 | import com.bsth.security.util.SecurityUtils; |
| 22 | import com.bsth.util.IpUtils; | 21 | import com.bsth.util.IpUtils; |
| @@ -42,22 +41,7 @@ public class HttpRecorder { | @@ -42,22 +41,7 @@ public class HttpRecorder { | ||
| 42 | public void record(HttpServletRequest request, HandlerMethod method){ | 41 | public void record(HttpServletRequest request, HandlerMethod method){ |
| 43 | Log log = new Log(); | 42 | Log log = new Log(); |
| 44 | 43 | ||
| 45 | - Type type = null; | ||
| 46 | - switch (request.getMethod()) { | ||
| 47 | - case "GET": | ||
| 48 | - type = Type.HTTP_GET; | ||
| 49 | - break; | ||
| 50 | - case "POST": | ||
| 51 | - type = Type.HTTP_POST; | ||
| 52 | - break; | ||
| 53 | - case "DELETE": | ||
| 54 | - type = Type.HTTP_DELETE; | ||
| 55 | - break; | ||
| 56 | - case "PUT": | ||
| 57 | - type = Type.HTTP_PUT; | ||
| 58 | - break; | ||
| 59 | - } | ||
| 60 | - log.setType(type.toString()); | 44 | + log.setType(request.getMethod().toUpperCase()); |
| 61 | log.setLevel(Level.INFO.toString()); | 45 | log.setLevel(Level.INFO.toString()); |
| 62 | try { | 46 | try { |
| 63 | log.setServerIp(InetAddress.getLocalHost().getHostAddress()); | 47 | log.setServerIp(InetAddress.getLocalHost().getHostAddress()); |
src/main/java/com/bsth/oplog/normal/OpLogger.java
| @@ -10,7 +10,6 @@ import org.springframework.stereotype.Component; | @@ -10,7 +10,6 @@ import org.springframework.stereotype.Component; | ||
| 10 | 10 | ||
| 11 | import com.bsth.entity.sys.SysUser; | 11 | import com.bsth.entity.sys.SysUser; |
| 12 | import com.bsth.oplog.Log; | 12 | import com.bsth.oplog.Log; |
| 13 | -import com.bsth.oplog.Type; | ||
| 14 | import com.bsth.oplog.db.DBHelper; | 13 | import com.bsth.oplog.db.DBHelper; |
| 15 | import com.bsth.security.util.SecurityUtils; | 14 | import com.bsth.security.util.SecurityUtils; |
| 16 | import com.bsth.util.IpUtils; | 15 | import com.bsth.util.IpUtils; |
| @@ -55,7 +54,7 @@ public class OpLogger { | @@ -55,7 +54,7 @@ public class OpLogger { | ||
| 55 | Log log = new Log(); | 54 | Log log = new Log(); |
| 56 | log.setTimestamp(System.currentTimeMillis()); | 55 | log.setTimestamp(System.currentTimeMillis()); |
| 57 | log.setPath(path); | 56 | log.setPath(path); |
| 58 | - log.setType(Type.NORMAL.toString()); | 57 | + log.setType("NORMAL"); |
| 59 | 58 | ||
| 60 | //get caller | 59 | //get caller |
| 61 | StackTraceElement[] stack = (new Throwable()).getStackTrace(); | 60 | StackTraceElement[] stack = (new Throwable()).getStackTrace(); |
src/main/java/com/bsth/service/directive/DirectiveService.java
| @@ -7,6 +7,7 @@ import java.util.Map; | @@ -7,6 +7,7 @@ import java.util.Map; | ||
| 7 | import com.bsth.entity.directive.D60; | 7 | import com.bsth.entity.directive.D60; |
| 8 | import com.bsth.entity.directive.D64; | 8 | import com.bsth.entity.directive.D64; |
| 9 | import com.bsth.entity.directive.D80; | 9 | import com.bsth.entity.directive.D80; |
| 10 | +import com.bsth.entity.directive.DC0_A3; | ||
| 10 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 11 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 11 | import com.bsth.service.BaseService; | 12 | import com.bsth.service.BaseService; |
| 12 | 13 | ||
| @@ -82,4 +83,10 @@ public interface DirectiveService extends BaseService<D60, Integer>{ | @@ -82,4 +83,10 @@ public interface DirectiveService extends BaseService<D60, Integer>{ | ||
| 82 | Map<String, Object> findAll80(Map<String, Object> map, int page, int size); | 83 | Map<String, Object> findAll80(Map<String, Object> map, int page, int size); |
| 83 | 84 | ||
| 84 | D64 save64(D64 d64); | 85 | D64 save64(D64 d64); |
| 86 | + | ||
| 87 | + int sendC0A4(String nbbm); | ||
| 88 | + | ||
| 89 | + int sendC0A3(DC0_A3 c0a4); | ||
| 90 | + | ||
| 91 | + int sendC0A5(String json); | ||
| 85 | } | 92 | } |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| @@ -30,6 +30,7 @@ import com.bsth.data.schedule.DayOfSchedule; | @@ -30,6 +30,7 @@ import com.bsth.data.schedule.DayOfSchedule; | ||
| 30 | import com.bsth.entity.directive.D60; | 30 | import com.bsth.entity.directive.D60; |
| 31 | import com.bsth.entity.directive.D64; | 31 | import com.bsth.entity.directive.D64; |
| 32 | import com.bsth.entity.directive.D80; | 32 | import com.bsth.entity.directive.D80; |
| 33 | +import com.bsth.entity.directive.DC0_A3; | ||
| 33 | import com.bsth.entity.directive.Directive; | 34 | import com.bsth.entity.directive.Directive; |
| 34 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 35 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 35 | import com.bsth.entity.sys.SysUser; | 36 | import com.bsth.entity.sys.SysUser; |
| @@ -470,4 +471,32 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -470,4 +471,32 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 470 | public D64 save64(D64 d64) { | 471 | public D64 save64(D64 d64) { |
| 471 | return d64Repository.save(d64); | 472 | return d64Repository.save(d64); |
| 472 | } | 473 | } |
| 474 | + | ||
| 475 | + @Override | ||
| 476 | + public int sendC0A4(String nbbm) { | ||
| 477 | + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | ||
| 478 | + | ||
| 479 | + Map<String, Object> c0a4 = new HashMap<>(); | ||
| 480 | + c0a4.put("deviceId", deviceId); | ||
| 481 | + c0a4.put("timestamp", System.currentTimeMillis()); | ||
| 482 | + c0a4.put("operCode", (short)0xC0); | ||
| 483 | + | ||
| 484 | + Map<String, Object> data = new HashMap<>(); | ||
| 485 | + data.put("deviceId", deviceId); | ||
| 486 | + data.put("operCode2", (short)0xA4); | ||
| 487 | + c0a4.put("data", data); | ||
| 488 | + | ||
| 489 | + return GatewayHttpUtils.postJson(JSON.toJSONString(c0a4)); | ||
| 490 | + } | ||
| 491 | + | ||
| 492 | + @Override | ||
| 493 | + public int sendC0A3(DC0_A3 c0a3) { | ||
| 494 | + GatewayHttpUtils.postJson(JSON.toJSONString(c0a3)); | ||
| 495 | + return 0; | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | + @Override | ||
| 499 | + public int sendC0A5(String json) { | ||
| 500 | + return GatewayHttpUtils.postJson(json); | ||
| 501 | + } | ||
| 473 | } | 502 | } |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -13,6 +13,8 @@ import java.util.List; | @@ -13,6 +13,8 @@ import java.util.List; | ||
| 13 | import java.util.Map; | 13 | import java.util.Map; |
| 14 | import java.util.Set; | 14 | import java.util.Set; |
| 15 | 15 | ||
| 16 | +import javax.transaction.Transactional; | ||
| 17 | + | ||
| 16 | import org.apache.commons.lang3.StringUtils; | 18 | import org.apache.commons.lang3.StringUtils; |
| 17 | import org.slf4j.Logger; | 19 | import org.slf4j.Logger; |
| 18 | import org.slf4j.LoggerFactory; | 20 | import org.slf4j.LoggerFactory; |
src/main/java/com/bsth/util/db/DBUtils_MS.java
| @@ -22,7 +22,7 @@ import com.mchange.v2.c3p0.DataSources; | @@ -22,7 +22,7 @@ import com.mchange.v2.c3p0.DataSources; | ||
| 22 | * @author PanZhao | 22 | * @author PanZhao |
| 23 | * | 23 | * |
| 24 | */ | 24 | */ |
| 25 | -@Component | 25 | +//@Component |
| 26 | public class DBUtils_MS { | 26 | public class DBUtils_MS { |
| 27 | 27 | ||
| 28 | private static String url = null; | 28 | private static String url = null; |