Browse Source

/*灵州站红外兼容数据类型改造*/

master
htjcAdmin 5 months ago
parent
commit
ba0e00952d
11 changed files with 251 additions and 515 deletions
  1. +2
    -2
      inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsControlController.java
  2. +4
    -4
      inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsDeviceController.java
  3. +32
    -11
      inspect-ivs/src/main/java/com/inspect/ivs/service/IvsCommonService.java
  4. +45
    -24
      inspect-ivs/src/main/java/com/inspect/ivs/service/IvsResourceRetryableDelegate.java
  5. +2
    -4
      inspect-ivs/src/main/java/com/inspect/ivs/util/UriUtils.java
  6. +31
    -114
      inspect-ivs/src/main/java/com/inspect/ivs/vo/IvsChanSnapVo.java
  7. +30
    -81
      inspect-ivs/src/main/java/com/inspect/ivs/vo/IvsDevChanSnapVo.java
  8. +31
    -181
      inspect-ivs/src/main/java/com/inspect/ivs/vo/IvsPresetVo.java
  9. +45
    -59
      inspect-ivs/src/main/java/com/inspect/ivs/vo/IvsVo.java
  10. +4
    -4
      inspect-job/src/main/java/com/inspect/job/task/IvsOperateRetryableDelegate.java
  11. +25
    -31
      inspect-job/src/main/java/com/inspect/job/task/JobMainTask.java

+ 2
- 2
inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsControlController.java View File

@ -63,7 +63,7 @@ public class IvsControlController {
if (command.equals("set")) {
JSONObject paramJsonPreAdd = new JSONObject();
paramJsonPreAdd.put("cameraCode", ivsPresetVo.getCameraCode());
paramJsonPreAdd.put("presetName", ivsPresetVo.getPresetName());
paramJsonPreAdd.put("presetName", ivsPresetVo.getName());
IvsPresetView ivsPresetView = ivsCommonService.postJson(ivsResourceRetryableDelegate.getLabel(), paramJsonPreAdd, IvsConst.URI_PRESET_SET, IvsPresetView.class);
log.debug("[IVS] PRESET SET RES: {}", ivsPresetView);
return Response.ok(ivsPresetView);
@ -72,7 +72,7 @@ public class IvsControlController {
paramJsonPreUpdate.put("cameraCode", ivsPresetVo.getCameraCode());
JSONObject ptzPresetInfo = new JSONObject();
ptzPresetInfo.put("presetIndex", Integer.parseInt(ivsPresetVo.getPreset()));
ptzPresetInfo.put("presetName", ivsPresetVo.getPresetName());
ptzPresetInfo.put("presetName", ivsPresetVo.getName());
paramJsonPreUpdate.put("ptzPresetInfo", ptzPresetInfo);
IvsResult ivsResult = ivsCommonService.putJson(ivsResourceRetryableDelegate.getLabel(), paramJsonPreUpdate, IvsConst.URI_PRESET_SET, IvsResult.class);
log.debug("[IVS] PRESET UPDATE RES :{}", ivsResult);


+ 4
- 4
inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsDeviceController.java View File

@ -335,8 +335,8 @@ public class IvsDeviceController {
}
} else {
try {
final String presetName = ivsDevChanSnapVo.getPresetName();
final String patrolPointId = ivsDevChanSnapVo.getPatrolPointId();
final String presetName = ivsDevChanSnapVo.getName();
final String patrolPointId = ivsDevChanSnapVo.getId();
final String uuid = ivsResourceRetryableDelegate.getLabel();
log.info(com.inspect.base.core.constant.Color.MAGENTA + "[IVS] CHANNEL_SNAPSHOT: {}" + com.inspect.base.core.constant.Color.END, ivsDevChanSnapVo.getCameraCode());
IvsSnapshotView ivsSnapshotView;
@ -360,8 +360,8 @@ public class IvsDeviceController {
try {
IvsChanSnapVo ivsChanSnapVo = new IvsChanSnapVo();
ivsChanSnapVo.setUUID(uuid);
ivsChanSnapVo.setPresetName(presetName);
ivsChanSnapVo.setPatrolPointId(patrolPointId);
ivsChanSnapVo.setName(presetName);
ivsChanSnapVo.setId(patrolPointId);
ivsChanSnapVo.setCameraCode(ivsDevChanSnapVo.getCameraCode());
ivsChanSnapVo.setDomainCode(ivsDevChanSnapVo.getDomainCode());
ivsChanSnapVo.setTaskID(ivsSnapshotView.getTaskID());


+ 32
- 11
inspect-ivs/src/main/java/com/inspect/ivs/service/IvsCommonService.java View File

@ -28,6 +28,8 @@ import org.springframework.web.reactive.function.client.WebClient.RequestBodySpe
import javax.annotation.Resource;
import javax.net.ssl.HttpsURLConnection;
import static com.inspect.ivs.constant.IvsConst.HTTP_JSESSIONID_SESSION_NAME;
@Component
public class IvsCommonService {
private static final Logger log = LoggerFactory.getLogger(IvsCommonService.class);
@ -59,14 +61,23 @@ public class IvsCommonService {
public RequestBodySpec http(HttpMethod httpMethod, String uri) {
log.info(Color.MAGENTA + "[IVS] ivs address: {} " + Color.END, getAddress().concat(uri));
assert webClient != null;
return webClient.method(httpMethod).uri(getAddress().concat(uri));
}
public RequestBodySpec http(HttpMethod httpMethod, String ipAddr, String uri) {
assert StringUtils.isNotBlank(ipAddr);
assert StringUtils.isNotBlank(uri);
log.info(Color.MAGENTA + "http ivs address: {} " + Color.END, ipAddr.concat(uri));
assert webClient != null;
return webClient.method(httpMethod).uri(ipAddr.concat(uri));
}
public <T> T get(final String label, String uri, Class<T> clazz) {
String cookie = this.getCookie();
String res = HttpUtil.createGet(getAddress().concat(uri))
//.cookie(new HttpCookie[]{new HttpCookie(IvsConst.HTTP_JSESSIONID_SESSION_NAME, cookie)})
.cookie(IvsConst.HTTP_JSESSIONID_SESSION_NAME.concat("=").concat(cookie))
.cookie(HTTP_JSESSIONID_SESSION_NAME.concat("=").concat(cookie))
.execute()
.body();
log.info("[IVS] GET URI: {}, RES: {}", uri, res);
@ -77,7 +88,7 @@ public class IvsCommonService {
String cookie = this.getCookie();
final String url = StringUtils.isEmpty(address) ? getAddress().concat(uri) : address.concat(uri);
String res = HttpUtil.createGet(url)
.cookie(IvsConst.HTTP_JSESSIONID_SESSION_NAME.concat("=").concat(cookie))
.cookie(HTTP_JSESSIONID_SESSION_NAME.concat("=").concat(cookie))
.execute()
.body();
log.info("[IVS] GET ADDRESS: {} URI: {}, RES: {}", address, uri, res);
@ -87,13 +98,13 @@ public class IvsCommonService {
public <T> T getJson(String label, String uri, Class<T> clazz) {
String cookie = this.getCookie();
String res = HttpUtil.createGet(getAddress().concat(uri))
.cookie(new HttpCookie[]{new HttpCookie(IvsConst.HTTP_JSESSIONID_SESSION_NAME, cookie)})
.cookie(new HttpCookie[]{new HttpCookie(HTTP_JSESSIONID_SESSION_NAME, cookie)})
.execute()
.body();
JSONObject t = http(HttpMethod.GET, uri)
.contentType(MediaType.APPLICATION_JSON)
.cookie("JSESSIONID", cookie).retrieve().bodyToMono(JSONObject.class).block();
.cookie(HTTP_JSESSIONID_SESSION_NAME, cookie).retrieve().bodyToMono(JSONObject.class).block();
log.info("[CALL IVS] getJson POST, Response:{}", t.toJSONString());
return this.checkResultCodeAndConvertResult(label, uri, t, clazz);
}
@ -101,7 +112,7 @@ public class IvsCommonService {
public JSONObject getResultJson(String label, String uri) {
String cookie = this.getCookie();
JSONObject result = this.http(HttpMethod.GET, uri)
.cookie(IvsConst.HTTP_JSESSIONID_SESSION_NAME, cookie)
.cookie(HTTP_JSESSIONID_SESSION_NAME, cookie)
.retrieve()
.bodyToMono(JSONObject.class)
.block();
@ -124,7 +135,7 @@ public class IvsCommonService {
JSONObject jsonObject
= http(HttpMethod.DELETE, uri)
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.cookie(IvsConst.HTTP_JSESSIONID_SESSION_NAME, cookie)
.cookie(HTTP_JSESSIONID_SESSION_NAME, cookie)
.retrieve()
.bodyToMono(JSONObject.class)
.block();
@ -153,7 +164,7 @@ public class IvsCommonService {
String cookie = this.getCookie();
JSONObject t = http(HttpMethod.PUT, uri)
.contentType(MediaType.APPLICATION_JSON)
.cookie(IvsConst.HTTP_JSESSIONID_SESSION_NAME, cookie)
.cookie(HTTP_JSESSIONID_SESSION_NAME, cookie)
.bodyValue(requestParam)
.retrieve()
.bodyToMono(JSONObject.class)
@ -178,15 +189,25 @@ public class IvsCommonService {
// }
public <T> T postJson(String label, Object requestParam, String uri, Class<T> clazz) {
String cookie = this.getCookie();
JSONObject t = this.http(HttpMethod.POST, uri)
.contentType(MediaType.APPLICATION_JSON)
.cookie("JSESSIONID", cookie)
.cookie(HTTP_JSESSIONID_SESSION_NAME, this.getCookie())
.bodyValue(requestParam).retrieve()
.bodyToMono(JSONObject.class)
.block();
log.info("IVS postJson, Parameter:{}, Response:{}", JSONObject.toJSONString(requestParam), t.toJSONString());
return this.checkResultCodeAndConvertResult(label, uri, t, clazz);
}
public <T> T postJson(String label, String ipAddr, String uri, Object requestParam, Class<T> clazz) {
final String destAddr = StringUtils.isEmpty(ipAddr) ? getAddress() : ipAddr;
JSONObject t = this.http(HttpMethod.POST, destAddr, uri)
.contentType(MediaType.APPLICATION_JSON)
.cookie(HTTP_JSESSIONID_SESSION_NAME, this.getCookie())
.bodyValue(requestParam).retrieve()
.bodyToMono(JSONObject.class)
.block();
log.info("[CALL IVS] POST, Parameter:{}", JSONObject.toJSONString(requestParam));
log.info("[CALL IVS] POST, Response:{}", t.toJSONString());
log.info("IVS postJsonEx, Parameter:{}, Response:{}", JSONObject.toJSONString(requestParam), t.toJSONString());
return this.checkResultCodeAndConvertResult(label, uri, t, clazz);
}


+ 45
- 24
inspect-ivs/src/main/java/com/inspect/ivs/service/IvsResourceRetryableDelegate.java View File

@ -11,6 +11,7 @@ import com.inspect.ivs.view.IvsSnapshotView;
import com.inspect.ivs.vo.IvsChanSnapVo;
import com.inspect.ivs.vo.IvsDevChanSnapVo;
import com.inspect.ivs.vo.IvsPresetVo;
import com.inspect.ivs.vo.IvsVo;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
@ -54,6 +55,7 @@ public class IvsResourceRetryableDelegate {
@Resource
private IvsCommonService ivsCommonService;
// 转到预置位
@Retryable(
value = IOException.class,
maxAttempts = RETRYABLE_MAX,
@ -62,12 +64,9 @@ public class IvsResourceRetryableDelegate {
int retryCount = RetrySynchronizationManager.getContext() != null
? RetrySynchronizationManager.getContext().getRetryCount() + 1
: 1;
log.info("URI_PTZ_CONTROL GOTO: retryCount: {}, UUID: {}, CODE: {}, ID: {}, NAME: {}",
log.info("URI_PTZ_CONTROL GOTO: retryCount: {}, BODY: {}",
retryCount,
ivsPresetVo.getUUID(),
ivsPresetVo.getCameraCode(),
ivsPresetVo.getPatrolPointId(),
ivsPresetVo.getPresetName());
ivsPresetVo);
JSONObject paramJson = new JSONObject();
paramJson.put("cameraCode", ivsPresetVo.getCameraCode());
log.debug("URI_PTZ_CONTROL GOTO: IVS VERSION: {}", version);
@ -79,7 +78,9 @@ public class IvsResourceRetryableDelegate {
paramJson.put("controlPara1", ivsPresetVo.getPreset());
paramJson.put("controlPara2", "");
try {
ivsCommonService.postJson(ivsPresetVo.getUUID(), paramJson, IvsConst.URI_PTZ_CONTROL, IvsResult.class);
final String apiAddr = getApiAddress(ivsPresetVo);
log.info("URI_PTZ_CONTROL GOTO apiAddr: {}", apiAddr);
ivsCommonService.postJson(ivsPresetVo.getUUID(), apiAddr, IvsConst.URI_PTZ_CONTROL, paramJson, IvsResult.class);
} catch (Exception e) {
log.info("URI_PTZ_CONTROL GOTO FAIL retryCount: {}, UUID: {}", retryCount, ivsPresetVo.getUUID());
throw new IOException("URI_PTZ_CONTROL GOTO: FAIL UUID: " + ivsPresetVo.getUUID() + ", retryCount: " + retryCount);
@ -94,6 +95,7 @@ public class IvsResourceRetryableDelegate {
return Response.fail();
}
// 下发拍照命令
@Retryable(
value = IOException.class,
maxAttempts = RETRYABLE_MAX,
@ -102,21 +104,26 @@ public class IvsResourceRetryableDelegate {
int retryCount = RetrySynchronizationManager.getContext() != null
? RetrySynchronizationManager.getContext().getRetryCount() + 1
: 1;
log.info("URI_PLATFORM_SNAPSHOT retryCount: {}, UUID: {}, ID: {}, NAME: {}",
log.info("URI_PLATFORM_SNAPSHOT retryCount: {}, BODY: {}",
retryCount,
ivsDevChanSnapVo.getUUID(),
ivsDevChanSnapVo.getPatrolPointId(),
ivsDevChanSnapVo.getPresetName());
ivsDevChanSnapVo);
IvsSnapshotView ivsSnapshotView;
try {
Set<String> ignoredKeys = new HashSet<>();
ignoredKeys.add("uUID");
ignoredKeys.add("presetName");
ignoredKeys.add("patrolPointId");
ignoredKeys.add("name");
ignoredKeys.add("id");
ignoredKeys.add("host");
ignoredKeys.add("port");
ignoredKeys.add("address");
ignoredKeys.add("username");
ignoredKeys.add("password");
final String apiAddr = getApiAddress(ivsDevChanSnapVo);
log.info("URI_PLATFORM_SNAPSHOT apiAddr: {}", apiAddr);
final String uri = UriUtils.parseIgnored(IvsConst.URI_PLATFORM_SNAPSHOT, ivsDevChanSnapVo, ignoredKeys);
//ivsSnapshotView = ivsCommonService.get(ivsDevChanSnapVo.getUUID(), UriUtils.parse(IvsConst.URI_PLATFORM_SNAPSHOT, ivsDevChanSnapVo), IvsSnapshotView.class);
log.info("URI_PLATFORM_SNAPSHOT retryCount: {}, UUID: {}, URI: {}", retryCount, ivsDevChanSnapVo.getUUID(), uri);
ivsSnapshotView = ivsCommonService.get(ivsDevChanSnapVo.getUUID(), uri, IvsSnapshotView.class);
ivsSnapshotView = ivsCommonService.get(ivsDevChanSnapVo.getUUID(), apiAddr, uri, IvsSnapshotView.class);
log.info("URI_PLATFORM_SNAPSHOT SUCCESS retryCount: {}, UUID: {}", retryCount, ivsDevChanSnapVo.getUUID());
} catch (Exception e) {
log.info("URI_PLATFORM_SNAPSHOT FAIL retryCount: {}, UUID: {}", retryCount, ivsDevChanSnapVo.getUUID());
@ -133,6 +140,7 @@ public class IvsResourceRetryableDelegate {
return null;
}
// 获取照片信息(下载路径)
@Retryable(
value = IOException.class,
maxAttempts = RETRYABLE_MIN,
@ -141,25 +149,27 @@ public class IvsResourceRetryableDelegate {
int retryCount = RetrySynchronizationManager.getContext() != null
? RetrySynchronizationManager.getContext().getRetryCount() + 1
: 1;
log.info("URI_SNAPSHOT_LIST retryCount: {}, UUID: {}, ID: {}, NAME: {}",
log.info("URI_SNAPSHOT_LIST retryCount: {}, BODY: {}",
retryCount,
ivsChanSnapVo.getUUID(),
ivsChanSnapVo.getPatrolPointId(),
ivsChanSnapVo.getPresetName());
ivsChanSnapVo);
final String uuid = ivsChanSnapVo.getUUID();
IvsPlatformSnapshotView snapShotView;
try {
ivsChanSnapVo.setUUID(null);
ivsChanSnapVo.setPresetName(null);
ivsChanSnapVo.setPatrolPointId(null);
ivsChanSnapVo.setName(null);
ivsChanSnapVo.setId(null);
final String apiAddr = getApiAddress(ivsChanSnapVo);
log.info("URI_SNAPSHOT_LIST apiAddr: {}", apiAddr);
snapShotView = ivsCommonService.postJson(
ivsChanSnapVo.getUUID(),
ivsChanSnapVo,
apiAddr,
IvsConst.URI_SNAPSHOT_LIST,
ivsChanSnapVo,
IvsPlatformSnapshotView.class);
log.info("URI_SNAPSHOT_LIST SUCCESS retryCount: {}, UUID: {}", retryCount, ivsChanSnapVo.getUUID());
log.info("URI_SNAPSHOT_LIST SUCCESS retryCount: {}, UUID: {}", retryCount, uuid);
} catch (Exception e) {
log.info("URI_SNAPSHOT_LIST FAIL retryCount: {}, UUID: {}", retryCount, ivsChanSnapVo.getUUID());
throw new IOException("URI_SNAPSHOT_LIST FAIL UUID: " + ivsChanSnapVo.getUUID());
log.info("URI_SNAPSHOT_LIST FAIL retryCount: {}, UUID: {}", retryCount, uuid);
throw new IOException("URI_SNAPSHOT_LIST FAIL UUID: " + uuid);
}
return snapShotView;
@ -172,6 +182,7 @@ public class IvsResourceRetryableDelegate {
return null;
}
// 下载照片
@Retryable(
value = IOException.class,
maxAttempts = RETRYABLE_MIN,
@ -250,8 +261,18 @@ public class IvsResourceRetryableDelegate {
return StreamUtils.copyToByteArray(imgFile.getInputStream());
}
public String getLabel() {
return UUID.randomUUID().toString().trim().replaceAll(StringUtils.DASH, StringUtils.EMPTY);
}
private String getApiAddress(IvsVo ivsVo) {
String realAddr = null;
if(StringUtils.isNotEmpty(ivsVo.getHost()) && StringUtils.isNotEmpty(ivsVo.getPort())) { // nvr ip
realAddr = ivsVo.getHost().concat(StringUtils.COLON).concat(ivsVo.getPort());
} else if (StringUtils.isNotEmpty(ivsVo.getAddress())) { // camera ip
realAddr = ivsVo.getAddress();
}
return realAddr;
}
}

+ 2
- 4
inspect-ivs/src/main/java/com/inspect/ivs/util/UriUtils.java View File

@ -29,8 +29,6 @@ public class UriUtils {
public static String parseIgnored(String uri, Object params, Set<String> ignoredKeys) {
JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(params));
StringBuilder sb = new StringBuilder("?");
String key;
for (String s : json.keySet()) {
key = s;
@ -71,8 +69,8 @@ public class UriUtils {
public static void main(String[] args) {
IvsDevChanSnapVo ivsDevChanSnapVo = new IvsDevChanSnapVo();
ivsDevChanSnapVo.setPatrolPointId("123456");
ivsDevChanSnapVo.setPresetName("ssssss");
ivsDevChanSnapVo.setId("123456");
ivsDevChanSnapVo.setName("ssssss");
ivsDevChanSnapVo.setUUID("d9a1cad491f94756877cc2d3088c0138");
ivsDevChanSnapVo.setCameraCode("01969538356559120106");
ivsDevChanSnapVo.setDomainCode("425b88eb55ab4bcfae2c4efe1bd6df88");


+ 31
- 114
inspect-ivs/src/main/java/com/inspect/ivs/vo/IvsChanSnapVo.java View File

@ -1,138 +1,55 @@
package com.inspect.ivs.vo;
import java.io.Serializable;
import java.util.Objects;
public class IvsChanSnapVo implements Serializable {
private String cameraCode;
private String domainCode;
public class IvsChanSnapVo extends IvsVo {
private String taskID;
private String UUID;
private String presetName;
private String patrolPointId;
public String getCameraCode() {
return this.cameraCode;
}
public IvsChanSnapVo() {}
public String getDomainCode() {
return this.domainCode;
public IvsChanSnapVo(String cameraCode, String domainCode, String taskID) {
this.setCameraCode(cameraCode);
this.setDomainCode(domainCode);
this.taskID = taskID;
}
public String getTaskID() {
return this.taskID;
}
public void setCameraCode(String cameraCode) {
this.cameraCode = cameraCode;
}
public void setDomainCode(String domainCode) {
this.domainCode = domainCode;
}
public void setTaskID(String taskID) {
this.taskID = taskID;
}
public String getUUID() {
return UUID;
}
public void setUUID(String UUID) {
this.UUID = UUID;
}
public String getPresetName() {
return presetName;
}
public void setPresetName(String presetName) {
this.presetName = presetName;
}
public String getPatrolPointId() {
return patrolPointId;
}
public void setPatrolPointId(String patrolPointId) {
this.patrolPointId = patrolPointId;
}
public boolean equals(Object o) {
if(o == this) {
return true;
} else if(!(o instanceof IvsChanSnapVo)) {
return false;
} else {
IvsChanSnapVo other = (IvsChanSnapVo)o;
if(!other.canEqual(this)) {
return false;
} else {
label47: {
Object this$cameraCode = this.getCameraCode();
Object other$cameraCode = other.getCameraCode();
if(this$cameraCode == null) {
if(other$cameraCode == null) {
break label47;
}
} else if(this$cameraCode.equals(other$cameraCode)) {
break label47;
}
return false;
}
Object this$domainCode = this.getDomainCode();
Object other$domainCode = other.getDomainCode();
if(this$domainCode == null) {
if(other$domainCode != null) {
return false;
}
} else if(!this$domainCode.equals(other$domainCode)) {
return false;
}
Object this$taskID = this.getTaskID();
Object other$taskID = other.getTaskID();
if(this$taskID == null) {
if(other$taskID != null) {
return false;
}
} else if(!this$taskID.equals(other$taskID)) {
return false;
}
return true;
}
}
}
protected boolean canEqual(Object other) {
return other instanceof IvsChanSnapVo;
@Override
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
if (!super.equals(object)) return false;
IvsChanSnapVo that = (IvsChanSnapVo) object;
return Objects.equals(taskID, that.taskID);
}
@Override
public int hashCode() {
int PRIME = 1;
int result = 1;
Object $cameraCode = this.getCameraCode();
result = result * 59 + ($cameraCode == null?43:$cameraCode.hashCode());
Object $domainCode = this.getDomainCode();
result = result * 59 + ($domainCode == null?43:$domainCode.hashCode());
Object $taskID = this.getTaskID();
result = result * 59 + ($taskID == null?43:$taskID.hashCode());
return result;
return Objects.hash(super.hashCode(), taskID);
}
@Override
public String toString() {
return "IvsChannelSnapVo(cameraCode=" + this.getCameraCode() + ", domainCode=" + this.getDomainCode() + ", taskID=" + this.getTaskID() + ")";
}
public IvsChanSnapVo() {
}
public IvsChanSnapVo(String cameraCode, String domainCode, String taskID) {
this.cameraCode = cameraCode;
this.domainCode = domainCode;
this.taskID = taskID;
return "IvsChanSnapVo{" +
"taskID='" + taskID + '\'' +
", code='" + getCode() + '\'' +
", cameraCode='" + getCameraCode() + '\'' +
", domainCode='" + getDomainCode() + '\'' +
", presetName='" + getName() + '\'' +
", patrolPointId='" + getId() + '\'' +
", host='" + getHost() + '\'' +
", port='" + getPort() + '\'' +
", username='" + getUsername() + '\'' +
", password='" + getPassword() + '\'' +
", address='" + getAddress() + '\'' +
", UUID='" + getUUID() + '\'' +
'}';
}
}

+ 30
- 81
inspect-ivs/src/main/java/com/inspect/ivs/vo/IvsDevChanSnapVo.java View File

@ -1,14 +1,13 @@
package com.inspect.ivs.vo;
import java.util.Objects;
public class IvsDevChanSnapVo extends IvsVo {
private String serial;
private String channel;
private boolean realtime;
private boolean check_outputs;
private boolean timeout;
private String UUID;
private String presetName;
private String patrolPointId;
public String getSerial() {
return this.serial;
@ -50,89 +49,39 @@ public class IvsDevChanSnapVo extends IvsVo {
this.timeout = timeout;
}
public String getUUID() {
return UUID;
}
public void setUUID(String UUID) {
this.UUID = UUID;
}
public String getPresetName() {
return presetName;
}
public void setPresetName(String presetName) {
this.presetName = presetName;
}
public String getPatrolPointId() {
return patrolPointId;
}
public void setPatrolPointId(String patrolPointId) {
this.patrolPointId = patrolPointId;
}
public boolean equals(Object o) {
if(o == this) {
return true;
} else if(!(o instanceof IvsDevChanSnapVo)) {
return false;
} else {
IvsDevChanSnapVo other = (IvsDevChanSnapVo)o;
if(!other.canEqual(this)) {
return false;
} else if(this.isRealtime() != other.isRealtime()) {
return false;
} else if(this.isCheck_outputs() != other.isCheck_outputs()) {
return false;
} else if(this.isTimeout() != other.isTimeout()) {
return false;
} else {
Object this$serial = this.getSerial();
Object other$serial = other.getSerial();
if(this$serial == null) {
if(other$serial != null) {
return false;
}
} else if(!this$serial.equals(other$serial)) {
return false;
}
Object this$channel = this.getChannel();
Object other$channel = other.getChannel();
if(this$channel == null) {
if(other$channel != null) {
return false;
}
} else if(!this$channel.equals(other$channel)) {
return false;
}
return true;
}
}
}
protected boolean canEqual(Object other) {
return other instanceof IvsDevChanSnapVo;
@Override
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
if (!super.equals(object)) return false;
IvsDevChanSnapVo that = (IvsDevChanSnapVo) object;
return realtime == that.realtime && check_outputs == that.check_outputs && timeout == that.timeout && Objects.equals(serial, that.serial) && Objects.equals(channel, that.channel);
}
@Override
public int hashCode() {
int PRIME = 1;
int result = 1;
result = result * 59 + (this.isRealtime()?79:97);
result = result * 59 + (this.isCheck_outputs()?79:97);
result = result * 59 + (this.isTimeout()?79:97);
Object $serial = this.getSerial();
result = result * 59 + ($serial == null?43:$serial.hashCode());
Object $channel = this.getChannel();
result = result * 59 + ($channel == null?43:$channel.hashCode());
return result;
return Objects.hash(super.hashCode(), serial, channel, realtime, check_outputs, timeout);
}
@Override
public String toString() {
return "IvsDevChanSnapVo(serial=" + this.getSerial() + ", channel=" + this.getChannel() + ", realtime=" + this.isRealtime() + ", check_outputs=" + this.isCheck_outputs() + ", timeout=" + this.isTimeout() + ")";
return "IvsDevChanSnapVo{" +
"serial='" + serial + '\'' +
", channel='" + channel + '\'' +
", realtime=" + realtime +
", check_outputs=" + check_outputs +
", timeout=" + timeout +
", code='" + getCode() + '\'' +
", cameraCode='" + getCameraCode() + '\'' +
", domainCode='" + getDomainCode() + '\'' +
", presetName='" + getName() + '\'' +
", patrolPointId='" + getId() + '\'' +
", host='" + getHost() + '\'' +
", port='" + getPort() + '\'' +
", username='" + getUsername() + '\'' +
", password='" + getPassword() + '\'' +
", address='" + getAddress() + '\'' +
", UUID='" + getUUID() + '\'' +
'}';
}
}

+ 31
- 181
inspect-ivs/src/main/java/com/inspect/ivs/vo/IvsPresetVo.java View File

@ -1,28 +1,17 @@
package com.inspect.ivs.vo;
import java.io.Serializable;
import java.util.Objects;
public class IvsPresetVo implements Serializable {
public class IvsPresetVo extends IvsVo {
private String serial;
private String channel;
private String code;
private String command;
private String preset;
private String name;
private String cameraCode;
private String patrolPointId;
private String presetName;
private int focusSwitch = 0;
private String UUID;
public void setCode(String code) {
this.cameraCode = this.code = code;
}
public void setName(String name) {
this.presetName = this.name = name;
}
public String getSerial() {
return this.serial;
@ -48,14 +37,6 @@ public class IvsPresetVo implements Serializable {
return this.name;
}
public String getCameraCode() {
return this.cameraCode;
}
public String getPresetName() {
return this.presetName;
}
public int getFocusSwitch() {
return this.focusSwitch;
}
@ -76,175 +57,44 @@ public class IvsPresetVo implements Serializable {
this.preset = preset;
}
public void setCameraCode(String cameraCode) {
this.cameraCode = cameraCode;
}
public void setPresetName(String presetName) {
this.presetName = presetName;
}
public void setFocusSwitch(int focusSwitch) {
this.focusSwitch = focusSwitch;
}
public String getPatrolPointId() {
return patrolPointId;
}
public void setPatrolPointId(String patrolPointId) {
this.patrolPointId = patrolPointId;
}
public String getUUID() {
return UUID;
}
public void setUUID(String UUID) {
this.UUID = UUID;
}
public boolean equals(Object o) {
if(o == this) {
return true;
} else if(!(o instanceof IvsPresetVo)) {
return false;
} else {
IvsPresetVo other = (IvsPresetVo)o;
if(!other.canEqual(this)) {
return false;
} else if(this.getFocusSwitch() != other.getFocusSwitch()) {
return false;
} else {
label109: {
Object this$serial = this.getSerial();
Object other$serial = other.getSerial();
if(this$serial == null) {
if(other$serial == null) {
break label109;
}
} else if(this$serial.equals(other$serial)) {
break label109;
}
return false;
}
label102: {
Object this$channel = this.getChannel();
Object other$channel = other.getChannel();
if(this$channel == null) {
if(other$channel == null) {
break label102;
}
} else if(this$channel.equals(other$channel)) {
break label102;
}
return false;
}
Object this$code = this.getCode();
Object other$code = other.getCode();
if(this$code == null) {
if(other$code != null) {
return false;
}
} else if(!this$code.equals(other$code)) {
return false;
}
label88: {
Object this$command = this.getCommand();
Object other$command = other.getCommand();
if(this$command == null) {
if(other$command == null) {
break label88;
}
} else if(this$command.equals(other$command)) {
break label88;
}
return false;
}
Object this$preset = this.getPreset();
Object other$preset = other.getPreset();
if(this$preset == null) {
if(other$preset != null) {
return false;
}
} else if(!this$preset.equals(other$preset)) {
return false;
}
label74: {
Object this$name = this.getName();
Object other$name = other.getName();
if(this$name == null) {
if(other$name == null) {
break label74;
}
} else if(this$name.equals(other$name)) {
break label74;
}
return false;
}
Object this$cameraCode = this.getCameraCode();
Object other$cameraCode = other.getCameraCode();
if(this$cameraCode == null) {
if(other$cameraCode != null) {
return false;
}
} else if(!this$cameraCode.equals(other$cameraCode)) {
return false;
}
Object this$presetName = this.getPresetName();
Object other$presetName = other.getPresetName();
if(this$presetName == null) {
if(other$presetName != null) {
return false;
}
} else if(!this$presetName.equals(other$presetName)) {
return false;
}
return true;
}
}
}
protected boolean canEqual(Object other) {
return other instanceof IvsPresetVo;
@Override
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
if (!super.equals(object)) return false;
IvsPresetVo that = (IvsPresetVo) object;
return focusSwitch == that.focusSwitch && Objects.equals(serial, that.serial) && Objects.equals(channel, that.channel) && Objects.equals(code, that.code) && Objects.equals(command, that.command) && Objects.equals(preset, that.preset) && Objects.equals(name, that.name);
}
@Override
public int hashCode() {
int PRIME = 1;
int result = 1;
result = result * 59 + this.getFocusSwitch();
Object $serial = this.getSerial();
result = result * 59 + ($serial == null?43:$serial.hashCode());
Object $channel = this.getChannel();
result = result * 59 + ($channel == null?43:$channel.hashCode());
Object $code = this.getCode();
result = result * 59 + ($code == null?43:$code.hashCode());
Object $command = this.getCommand();
result = result * 59 + ($command == null?43:$command.hashCode());
Object $preset = this.getPreset();
result = result * 59 + ($preset == null?43:$preset.hashCode());
Object $name = this.getName();
result = result * 59 + ($name == null?43:$name.hashCode());
Object $cameraCode = this.getCameraCode();
result = result * 59 + ($cameraCode == null?43:$cameraCode.hashCode());
Object $presetName = this.getPresetName();
result = result * 59 + ($presetName == null?43:$presetName.hashCode());
return result;
return Objects.hash(super.hashCode(), serial, channel, code, command, preset, name, focusSwitch);
}
@Override
public String toString() {
return "SipbPresetVo(serial=" + this.getSerial() + ", channel=" + this.getChannel() + ", code=" + this.getCode() + ", command=" + this.getCommand() + ", preset=" + this.getPreset() + ", name=" + this.getName() + ", cameraCode=" + this.getCameraCode() + ", presetName=" + this.getPresetName() + ", focusSwitch=" + this.getFocusSwitch() + ")";
return "IvsPresetVo{" +
"serial='" + serial + '\'' +
", channel='" + channel + '\'' +
", code='" + code + '\'' +
", command='" + command + '\'' +
", preset='" + preset + '\'' +
", name='" + name + '\'' +
", focusSwitch=" + focusSwitch +
"code='" + getCode() + '\'' +
"cameraCode='" + getCameraCode() + '\'' +
"domainCode='" + getCameraCode() + '\'' +
"host='" + getHost() + '\'' +
"port='" + getPort() + '\'' +
"address='" + getAddress() + '\'' +
"username='" + getUsername() + '\'' +
"password='" + getPassword() + '\'' +
"name='" + getName() + '\'' +
"id='" + getId() + '\'' +
'}';
}
}

+ 45
- 59
inspect-ivs/src/main/java/com/inspect/ivs/vo/IvsVo.java View File

@ -3,17 +3,21 @@ package com.inspect.ivs.vo;
import com.inspect.base.core.utils.StringUtils;
import java.io.Serializable;
import java.util.Objects;
public class IvsVo implements Serializable {
private static final long serialVersionUID = -6922254609485688648L;
private String code;
private String cameraCode;
private String domainCode;
private String name;
private String id;
private String host;
private String port;
private String username;
private String password;
private String address;
private String UUID;
public void setCode(String code) {
if(!StringUtils.isEmpty(code)) {
@ -89,72 +93,54 @@ public class IvsVo implements Serializable {
this.address = address;
}
public boolean equals(Object o) {
if(o == this) {
return true;
} else if(!(o instanceof IvsVo)) {
return false;
} else {
IvsVo other = (IvsVo)o;
if(!other.canEqual(this)) {
return false;
} else {
label47: {
Object this$code = this.getCode();
Object other$code = other.getCode();
if(this$code == null) {
if(other$code == null) {
break label47;
}
} else if(this$code.equals(other$code)) {
break label47;
}
return false;
}
Object this$cameraCode = this.getCameraCode();
Object other$cameraCode = other.getCameraCode();
if(this$cameraCode == null) {
if(other$cameraCode != null) {
return false;
}
} else if(!this$cameraCode.equals(other$cameraCode)) {
return false;
}
Object this$domainCode = this.getDomainCode();
Object other$domainCode = other.getDomainCode();
if(this$domainCode == null) {
if(other$domainCode != null) {
return false;
}
} else if(!this$domainCode.equals(other$domainCode)) {
return false;
}
return true;
}
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUUID() {
return UUID;
}
public void setUUID(String UUID) {
this.UUID = UUID;
}
protected boolean canEqual(Object other) {
return other instanceof IvsVo;
@Override
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
IvsVo ivsVo = (IvsVo) object;
return Objects.equals(code, ivsVo.code) && Objects.equals(cameraCode, ivsVo.cameraCode) && Objects.equals(domainCode, ivsVo.domainCode) && Objects.equals(host, ivsVo.host) && Objects.equals(port, ivsVo.port) && Objects.equals(username, ivsVo.username) && Objects.equals(password, ivsVo.password) && Objects.equals(address, ivsVo.address);
}
@Override
public int hashCode() {
int PRIME = 1;
int result = 1;
Object $code = this.getCode();
result = result * 59 + ($code == null?43:$code.hashCode());
Object $cameraCode = this.getCameraCode();
result = result * 59 + ($cameraCode == null?43:$cameraCode.hashCode());
Object $domainCode = this.getDomainCode();
result = result * 59 + ($domainCode == null?43:$domainCode.hashCode());
return result;
return Objects.hash(code, cameraCode, domainCode, host, port, username, password, address);
}
@Override
public String toString() {
return "IvsVo(code=" + this.getCode() + ", cameraCode=" + this.getCameraCode() + ", domainCode=" + this.getDomainCode() + ")";
return "IvsVo{" +
"code='" + code + '\'' +
", cameraCode='" + cameraCode + '\'' +
", domainCode='" + domainCode + '\'' +
", host='" + host + '\'' +
", port='" + port + '\'' +
", username='" + username + '\'' +
", password='" + password + '\'' +
", address='" + address + '\'' +
'}';
}
}

+ 4
- 4
inspect-job/src/main/java/com/inspect/job/task/IvsOperateRetryableDelegate.java View File

@ -31,8 +31,8 @@ public class IvsOperateRetryableDelegate {
final String param = "serial=" + presetPos.getVideoNvrCode()
+ "&command=goto&preset=" + presetPos.getPresetPosCode()
+ "&code=" + presetPos.getChannelCode()
+ "&presetName=" + URLEncoder.encode(presetPos.getPresetPosName(), ("UTF-8"))
+ "&patrolPointId=" + presetPos.getPatrolPointId();
+ "&name=" + URLEncoder.encode(presetPos.getPresetPosName(), ("UTF-8"))
+ "&id=" + presetPos.getPatrolPointId();
log.info("API_CONTROL_PRESET uuid: {}, param: {}, request: {}",
uuid,
presetPos.getPatrolPointId() + "-" + presetPos.getPresetPosName(),
@ -57,8 +57,8 @@ public class IvsOperateRetryableDelegate {
final String param = "serial=" + presetPos.getVideoNvrCode()
+ "&command=goto&preset=" + presetPos.getPresetPosCode()
+ "&code=" + presetPos.getChannelCode()
+ "&presetName=" + presetPos.getPresetPosName()
+ "&patrolPointId=" + presetPos.getPatrolPointId();
+ "&name=" + presetPos.getPresetPosName()
+ "&id=" + presetPos.getPatrolPointId();
log.info("API_CONTROL_PRESET retryCount: {}, param: {}, request: {}",
retryCount,
presetPos.getPatrolPointId() + "-" + presetPos.getPresetPosName(),


+ 25
- 31
inspect-job/src/main/java/com/inspect/job/task/JobMainTask.java View File

@ -500,15 +500,15 @@ public class JobMainTask {
if (PresetAction.PHOTO.getCode().equals(presetAction.getActionType())) {
final String chanType = presetPos.getChannelType();
fileTypes.append("ir".equals(chanType) ? "1" : "vl".equals(chanType) ? "2" : "").append(",");
boolean bOk = false;
//boolean bOk = false;
try {
log.info("PHOTO PresetType uuid: {}, chanType: {}, videoNvrCode: {}, channelCode: {}, patrolPointId: {}", uuid, chanType, presetPos.getVideoNvrCode(), presetPos.getChannelCode(), presetPos.getPatrolPointId());
if ("vl".equals(chanType)) {
String paramUrl = liveIVS_URL + "/api/v1/device/channelsnap?serial="
+ presetPos.getVideoNvrCode()
+ "&realtime=true&code=" + presetPos.getChannelCode()
+ "&presetName=" + URLEncoder.encode(presetPos.getPresetPosName(), ("UTF-8"))
+ "&patrolPointId=" + presetPos.getPatrolPointId();
+ "&name=" + URLEncoder.encode(presetPos.getPresetPosName(), ("UTF-8"))
+ "&id=" + presetPos.getPatrolPointId();
String paramFileName = taskPatrolId.split(StringUtils.UNDERLINE)[1] + StringUtils.UNDERLINE
+ taskPatrolId.split(StringUtils.UNDERLINE)[2] + StringUtils.UNDERLINE
+ presetPos.getPatrolPointId() + StringUtils.UNDERLINE
@ -518,7 +518,7 @@ public class JobMainTask {
FtpResult ftpResult = getFileAndSave(paramUrl, paramFileName, paramFileDir);
if (ftpResult != null && StringUtils.isNotEmpty(ftpResult.getFilepath())) {
log.info("filePath: {}", ftpResult.getFilepath());
bOk = ftpResult.isOk();
//bOk = ftpResult.isOk();
filePaths.append("/" + ftpResult.getFilepath());
}
} else if ("ir".equals(chanType)) {
@ -559,7 +559,7 @@ public class JobMainTask {
FtpResult ftpResult = getFileAndSave(paramUrl, paramFileName, paramFileDir);
if (ftpResult != null && StringUtils.isNotEmpty(ftpResult.getFilepath())) {
log.info("红外处理新流程: filePath: {}", ftpResult.getFilepath());
bOk = ftpResult.isOk();
//bOk = ftpResult.isOk();
filePaths.append("/" + ftpResult.getFilepath());
}
} else { // 古老的红外处理流程保留勿删除
@ -584,7 +584,7 @@ public class JobMainTask {
log.error("error", e);
}
recordPersist(bOk, taskExecRecord, infoListSize, patrolTaskInfo, presetPos, fileTypes, filePaths);
recordPersist(taskExecRecord, infoListSize, patrolTaskInfo, presetPos, fileTypes, filePaths);
} else if (PresetAction.VIDEO.getCode().equals(presetAction.getActionType())) {
log.info("VIDEO PresetType videoNvrCode: {}, channelCode: {}", presetPos.getVideoNvrCode(), presetPos.getChannelCode());
fileTypes.append(4).append(",");
@ -638,8 +638,7 @@ public class JobMainTask {
return rectangles.toString();
}
synchronized private void addPointRecord(boolean bOk,
PatrolTaskExecRecord taskExecRecord,
synchronized private void addPointRecord(PatrolTaskExecRecord taskExecRecord,
PatrolTaskInfo taskInfo,
PatrolPresetPosSlim presetPos,
StringBuffer fileTypes,
@ -665,15 +664,10 @@ public class JobMainTask {
.oldTaskPatrolledId(taskExecRecord.getOldTaskPatrolId())
.patrolPointId(presetPos.getPatrolPointId())
.time(new Date())
.isOk(bOk ? 1 : 0)
.isOk(1)
.build();
taskExecClient.addPatrolTaskPointExecRecord(pointExecRecord);
if (!bOk) {
log.info(Color.RED + "pointExecRecord crud add taskPatrolId: {}, deviceId: {}" + Color.END, taskPatrolId, deviceId);
}
//if (bOk)
log.info(Color.RED + "pointExecRecord crud add taskPatrolId: {}, deviceId: {}" + Color.END, taskPatrolId, deviceId);
//if(!testMode)
{
String patrolId = taskExecRecord.getTaskPatrolId();
@ -750,7 +744,7 @@ public class JobMainTask {
}
}
synchronized private int addCursorNumber(String taskPatrolId, boolean bOk, int infoListSize) {
synchronized private int addCursorNumber(String taskPatrolId, int infoListSize) {
PatrolTaskExecRecord taskExecRecord = taskExecClient.selectPatrolTaskExecRecordByTaskPatrolId(taskPatrolId);
int total = taskExecRecord.getTotalNumber();
@ -866,17 +860,17 @@ public class JobMainTask {
taskExecClient.updatePatrolTaskExecRecord(execRecord);
}
synchronized private PatrolTaskExecRecord recordPersist(boolean bOk,
PatrolTaskExecRecord taskExecRecord,
int infoListSize,
PatrolTaskInfo taskInfo,
PatrolPresetPosSlim presetPos,
StringBuffer fileTypes,
StringBuffer filePaths) {
synchronized private PatrolTaskExecRecord recordPersist(
PatrolTaskExecRecord taskExecRecord,
int infoListSize,
PatrolTaskInfo taskInfo,
PatrolPresetPosSlim presetPos,
StringBuffer fileTypes,
StringBuffer filePaths) {
log.info(Color.CYAN + "recordPersistTrace bOk: {}" + Color.END, bOk);
//log.info(Color.CYAN + "recordPersistTrace bOk: {}" + Color.END, bOk);
try {
addPointRecord(bOk, taskExecRecord, taskInfo, presetPos, fileTypes, filePaths);
addPointRecord(taskExecRecord, taskInfo, presetPos, fileTypes, filePaths);
} catch (Exception e) {
log.error("error", e);
}
@ -885,7 +879,7 @@ public class JobMainTask {
log.info(Color.CYAN + "addCursorNumberStart" + Color.END);
int cursorNumber = 0;
try {
cursorNumber = addCursorNumber(taskExecRecord.getTaskPatrolId(), bOk, infoListSize);
cursorNumber = addCursorNumber(taskExecRecord.getTaskPatrolId(), infoListSize);
} catch (Exception e) {
log.error("error", e);
}
@ -1269,10 +1263,10 @@ public class JobMainTask {
log.info("CompletableFuture Break Join: taskPatrolId: {}", patrolTaskExecRecord.getOldTaskPatrolId());
}
private void handlePrePointBatch(final int threadCnt, final PatrolTaskExecRecord patrolTaskExecRecord, final List<PatrolTaskInfo> batch) {
asyncTaskPatrolPointCnt.getAndAdd(batch.size());
private void handlePrePointBatch(final int threadCnt, final PatrolTaskExecRecord patrolTaskExecRecord, final List<PatrolTaskInfo> taskInfoBatch) {
asyncTaskPatrolPointCnt.getAndAdd(taskInfoBatch.size());
log.info("handlePrePointBatch threadCnt: {}, asyncTaskPatrolPointCnt: {}, batch size: {}, devNo: {}, taskId: {}",
threadCnt, asyncTaskPatrolPointCnt.get(), batch.size(), patrolTaskExecRecord.getDevNo(), patrolTaskExecRecord.getTaskId());
threadCnt, asyncTaskPatrolPointCnt.get(), taskInfoBatch.size(), patrolTaskExecRecord.getDevNo(), patrolTaskExecRecord.getTaskId());
final String taskPatrolId = patrolTaskExecRecord.getOldTaskPatrolId();
StatusMonitor monitor = TaskStatusManager.get(patrolTaskExecRecord.getOldTaskPatrolId());
@ -1288,7 +1282,7 @@ public class JobMainTask {
return taskState;
});
}
for (final PatrolTaskInfo taskInfo : batch) {
for (final PatrolTaskInfo taskInfo : taskInfoBatch) {
log.info("handlePrePointBatch taskPatrolId: {}, patrolPointId: {}, lineId: {}", patrolTaskExecRecord.getTaskPatrolId(), taskInfo.getDeviceId(), taskInfo.getLineId());
int status = monitor.getStatus();
if (status == Integer.parseInt(TaskStatus.HALTED.getCode())) {
@ -1306,7 +1300,7 @@ public class JobMainTask {
} else if (status == -1 || status == 0) {
log.info("task status error state taskPatrolId: {}", taskPatrolId);
}
prePointExec(patrolTaskExecRecord, taskInfo, batch.size());
prePointExec(patrolTaskExecRecord, taskInfo, taskInfoBatch.size());
}
}


Loading…
Cancel
Save