|
@@ -19,12 +19,15 @@ import com.gzlh.device.led.factory.LedFactory;
|
|
|
import com.gzlh.device.led.utils.LedOptions;
|
|
|
import com.gzlh.device.plc.event.PLCEvent;
|
|
|
import com.gzlh.device.plc.handler.PLCHadnler;
|
|
|
-import com.gzlh.device.weighbridge.config.WeighbridgePropertiesConfig;
|
|
|
import com.gzlh.device.weighbridge.factory.WeighbridgeFactory;
|
|
|
import com.gzlh.entity.CommandBO;
|
|
|
+import com.gzlh.entity.ReqBO;
|
|
|
import com.gzlh.utils.DeviceCache;
|
|
|
+import com.gzlh.utils.WordHandlerUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Slf4j
|
|
@@ -45,7 +48,6 @@ public class EventThread implements Runnable{
|
|
|
LedFactory ledFactory= SystemObject.ledFactory;
|
|
|
WeighbridgeFactory weighbridgeFactory=SystemObject.weighbridgeFactory;
|
|
|
ElectronFactory electronFactory= SystemObject.electronFactory;
|
|
|
- WeighbridgePropertiesConfig weighbridgePropertiesConfig=SystemObject.weighbridgePropertiesConfig;
|
|
|
PLCHadnler plcHadnler= SpringUtil.getBean(PLCHadnler.class);
|
|
|
CaptureFactory captureFactory=SystemObject.captureFactory;
|
|
|
CaputreSetting caputreSetting=SysConfig.caputreSetting;
|
|
@@ -69,7 +71,7 @@ public class EventThread implements Runnable{
|
|
|
ledFactory.handler(serialSetting.getLed().getBrand()).handlerAction(command);
|
|
|
} else if (StrUtil.equals(module, ModuleEnum.WEIGHBRIDGE_MODULE.getModuleEn())) {
|
|
|
//动作属于地磅
|
|
|
- weighbridgeFactory.handler(weighbridgePropertiesConfig.getBrand()).handlerAction(command);
|
|
|
+ weighbridgeFactory.handler(serialSetting.getWeighbridge().getBrand()).handlerAction(command);
|
|
|
}else if (StrUtil.equals(module, ModuleEnum.CAPTURE_MODULE.getModuleEn())) {
|
|
|
//动作属于抓拍单元--车牌识别
|
|
|
captureFactory.handler(caputreSetting.getBrand()).handlerAction(command);
|
|
@@ -125,14 +127,16 @@ public class EventThread implements Runnable{
|
|
|
String api="/open/submit";
|
|
|
HttpResponse response = request(address+api, JSONUtil.toJsonStr(EventDataManager.getCacheData()));
|
|
|
EventBus eventBus= SpringUtil.getBean(EventBus.class);
|
|
|
- log.info("提交通道数据-返回结果 code:{},body:{}",response.getStatus(),response.body());
|
|
|
- if (response.getStatus() == 200 || response.getStatus() == 500){
|
|
|
- JSONObject jsonObject = new JSONObject(response.body());
|
|
|
- String data = jsonObject.get("data").toString();
|
|
|
- log.info("提交通道数据-返回结果:{}",data);
|
|
|
+ log.info("提交通道数据-返回结果:{}",response.body());
|
|
|
+ if (response.getStatus() == 200){
|
|
|
+ String body = response.body();
|
|
|
+ JSONObject jsonObject = new JSONObject(body);
|
|
|
+// 返回数据解密
|
|
|
+ String data = WordHandlerUtils.AESDecrypt(jsonObject.get("data").toString());
|
|
|
+// String data = jsonObject.get("data").toString();
|
|
|
CommandBO commandBO = JSONUtil.toBean(data, CommandBO.class);
|
|
|
LedOptions options = new LedOptions().setLine("04").setShowType("00");
|
|
|
- if (response.getStatus()==200){
|
|
|
+ if ("200".equals(jsonObject.get("code"))){
|
|
|
options.setColor("02");
|
|
|
if (ModuleEnum.LED_MODULE.getModuleEn().equalsIgnoreCase(commandBO.getCommand().getModule())){
|
|
|
SystemObject.ledFactory.handler(SysConfig.serialSetting.getLed().getBrand())
|
|
@@ -165,8 +169,8 @@ public class EventThread implements Runnable{
|
|
|
// url = "http://192.168.1.8:9191/open/submit";
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
// System.out.println(startTime);
|
|
|
-
|
|
|
- String body = json;
|
|
|
+// 数据加密
|
|
|
+ String body = WordHandlerUtils.AESEncrypt(json);
|
|
|
try {
|
|
|
// System.out.printf("请求地址:%s, 请求体:%s ", url,body);
|
|
|
|
|
@@ -174,7 +178,7 @@ public class EventThread implements Runnable{
|
|
|
.header("Content-Type", "application/json;character=utf-8;")
|
|
|
.body(body)
|
|
|
.execute();
|
|
|
- String bodyResult = res.body();
|
|
|
+// String bodyResult = res.body();
|
|
|
// System.out.printf("ReqStatus:%s,返回结果:{%s} ",res.getStatus(), bodyResult);
|
|
|
|
|
|
} catch (Exception e) {
|