|
@@ -6,16 +6,17 @@ import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.XML;
|
|
|
import com.gzlh.background.client.BackgroundClientNetty;
|
|
|
import com.gzlh.background.properties.BackgroundPropertiesConfig;
|
|
|
-import com.gzlh.dto.ApplicationConfigDTO;
|
|
|
-import com.gzlh.event.EventBus;
|
|
|
-import com.gzlh.led.client.LedNettyConfig;
|
|
|
-import com.gzlh.led.properties.LedPropertiesConfig;
|
|
|
-import com.gzlh.infrared.client.RedNettyConfig;
|
|
|
-import com.gzlh.infrared.config.RedPropertiesConfig;
|
|
|
-import com.gzlh.socket.TestClientNetty;
|
|
|
-import com.gzlh.weighbridge.client.WeighbridgeNettyConfig;
|
|
|
-import com.gzlh.weighbridge.config.WeighbridgePropertiesConfig;
|
|
|
-import javafx.scene.layout.Background;
|
|
|
+import com.gzlh.device.capture.properties.CapturePropertiesConfig;
|
|
|
+import com.gzlh.config.ModuleEnum;
|
|
|
+import com.gzlh.config.SystemObject;
|
|
|
+import com.gzlh.config.dto.ApplicationConfigDTO;
|
|
|
+import com.gzlh.bus.EventBus;
|
|
|
+import com.gzlh.config.hksdk.HCNetSDK;
|
|
|
+import com.gzlh.config.hksdk.HkUtils;
|
|
|
+import com.gzlh.config.hksdk.bo.HKCacheManager;
|
|
|
+import com.gzlh.device.led.client.LedNettyConfig;
|
|
|
+import com.gzlh.device.infrared.client.RedNettyConfig;
|
|
|
+import com.gzlh.device.weighbridge.client.WeighbridgeNettyConfig;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.boot.CommandLineRunner;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -26,41 +27,56 @@ import java.util.Properties;
|
|
|
|
|
|
@Component
|
|
|
@Slf4j
|
|
|
-public class StartupCommandLineRunner implements CommandLineRunner {
|
|
|
+public class StartupRunner implements CommandLineRunner {
|
|
|
@Resource
|
|
|
private EventBus eventBus;
|
|
|
@Resource
|
|
|
private WeighbridgeNettyConfig weighbridgeNettyConfig;
|
|
|
- @Resource
|
|
|
- private WeighbridgePropertiesConfig propertiesConfig;
|
|
|
+
|
|
|
@Resource
|
|
|
private LedNettyConfig ledNettyConfig;
|
|
|
@Resource
|
|
|
- private LedPropertiesConfig ledConfig;
|
|
|
- @Resource
|
|
|
private RedNettyConfig redNettyConfig;
|
|
|
- @Resource
|
|
|
- private RedPropertiesConfig redConfig;
|
|
|
+
|
|
|
@Resource
|
|
|
private BackgroundPropertiesConfig backgroundPropertiesConfig;
|
|
|
@Resource
|
|
|
private BackgroundClientNetty backgroundClientNetty;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private HkUtils hkUtils;
|
|
|
+ @Resource
|
|
|
+ private HCNetSDK hcNetSDK;
|
|
|
+
|
|
|
@Override
|
|
|
public void run(String... args) throws Exception {
|
|
|
initConfig();
|
|
|
- if (propertiesConfig.isEnable()) {
|
|
|
+ if (SystemObject.weighbridgePropertiesConfig.isEnable()) {
|
|
|
ThreadUtil.execute(() -> weighbridgeNettyConfig.connect());
|
|
|
}
|
|
|
- if (ledConfig.isEnable()) {
|
|
|
+ if (SystemObject.ledPropertiesConfig.isEnable()) {
|
|
|
ThreadUtil.execute(() -> ledNettyConfig.connect());
|
|
|
}
|
|
|
- if (redConfig.isEnable()) {
|
|
|
+ if (SystemObject.redPropertiesConfig.isEnable()) {
|
|
|
ThreadUtil.execute(() -> redNettyConfig.connect());
|
|
|
}
|
|
|
if (backgroundPropertiesConfig.isEnable()) {
|
|
|
- ThreadUtil.execute(() -> backgroundClientNetty.connect());
|
|
|
+
|
|
|
}
|
|
|
+ if (SystemObject.capturePropertiesConfig.isEnable()){
|
|
|
+ CapturePropertiesConfig capturePropertiesConfig=SystemObject.capturePropertiesConfig;
|
|
|
+ short port= (short) capturePropertiesConfig.getPort();
|
|
|
+ String ip=capturePropertiesConfig.getHost();
|
|
|
+ int userId = hkUtils.Login_V40(ip, port, capturePropertiesConfig.getUsername(), capturePropertiesConfig.getPwd(), hcNetSDK);
|
|
|
+ if (userId!=-1){
|
|
|
+ log.info("登录海康抓拍设备:{},{}",ip,userId);
|
|
|
+ hkUtils.SetAlarm(hcNetSDK,userId);
|
|
|
+ HKCacheManager.add(ModuleEnum.CAPTURE_MODULE,userId);
|
|
|
+ }else {
|
|
|
+ log.info("登录海康抓拍设备失败:{},{}",hcNetSDK.NET_DVR_GetLastError(),userId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void initConfig() {
|