Browse Source

/*红外1800修改。*/

master
htjcAdmin 8 months ago
parent
commit
c59f99bca8
10 changed files with 92 additions and 30 deletions
  1. +2
    -0
      inspect-base/inspect-base-core/src/main/java/com/inspect/base/core/constant/AlgConstants.java
  2. +2
    -2
      inspect-base/inspect-base-core/src/main/java/com/inspect/base/core/utils/HttpClientUtils.java
  3. +1
    -0
      inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsDeviceController.java
  4. +15
    -0
      inspect-ivs/src/main/java/com/inspect/ivs/domain/Temp.java
  5. +4
    -0
      inspect-job/src/main/java/com/inspect/job/client/TaskExecClient.java
  6. +54
    -19
      inspect-job/src/main/java/com/inspect/job/task/JobMainTask.java
  7. +5
    -0
      inspect-main/inspect-main-task-exec/src/main/java/com/inspect/exec/controller/PatrolTaskExecController.java
  8. +5
    -6
      inspect-main/inspect-main-task-exec/src/main/java/com/inspect/exec/controller/PatrolTaskExecuteSchedulerController.java
  9. +1
    -1
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/IPatrolResultService.java
  10. +3
    -2
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/impl/PatrolResultServiceImpl.java

+ 2
- 0
inspect-base/inspect-base-core/src/main/java/com/inspect/base/core/constant/AlgConstants.java View File

@ -7,4 +7,6 @@ public class AlgConstants {
public static final String INFRA_CAMERA = "infra_camera";
public static final String INFRA_CAMERA_REVERSE = "infra_camera_reverse";
public static final String XB = "xb";
public static final String ALG_SUBTYPE_CODE = "alg_subtype_code";
}

+ 2
- 2
inspect-base/inspect-base-core/src/main/java/com/inspect/base/core/utils/HttpClientUtils.java View File

@ -60,8 +60,8 @@ public class HttpClientUtils {
if (bufferedReader != null) {
bufferedReader.close();
}
} catch (IOException var16) {
var16.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}


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

@ -129,6 +129,7 @@ public class IvsDeviceController {
*/
@PostMapping("/temper")
public String temper(@RequestBody Temp temp) {
log.info( "[infrared_1800] 获取红外温度 temper param: {}", temp);
String cameraCode = temp.getCameraCode().split("#")[0]; //cameraCode摄像机编码
int presetId = temp.getPresetId(); //预设位ID
int ruleId = 12; //规则ID 暂时写死取12就行


+ 15
- 0
inspect-ivs/src/main/java/com/inspect/ivs/domain/Temp.java View File

@ -4,6 +4,8 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Objects;
@AllArgsConstructor
@NoArgsConstructor
@Data
@ -15,4 +17,17 @@ public class Temp {
private int ruleId;
private int meterType;
private String nvrcode;
@Override
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
Temp temp = (Temp) object;
return presetId == temp.presetId && ruleId == temp.ruleId && meterType == temp.meterType && Objects.equals(cameraCode, temp.cameraCode) && Objects.equals(nvrcode, temp.nvrcode);
}
@Override
public int hashCode() {
return Objects.hash(cameraCode, presetId, ruleId, meterType, nvrcode);
}
}

+ 4
- 0
inspect-job/src/main/java/com/inspect/job/client/TaskExecClient.java View File

@ -103,4 +103,8 @@ public interface TaskExecClient {
@PostMapping({"/getPatrolTaskStatusByTaskPatrolledId"})
PatrolTaskStatus getPatrolTaskStatusByTaskPatrolledId(String patrolId);
@PostMapping({"/exec/getAlgTypeListByPatrolPointId"})
Map<String, String> getAlgTypeListByPatrolPointId(final String patrolPointId);
}

+ 54
- 19
inspect-job/src/main/java/com/inspect/job/task/JobMainTask.java View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.inspect.access.base.model.InfraredModel;
import com.inspect.base.core.constant.AlgConstants;
import com.inspect.base.core.constant.RedisConst;
import com.inspect.base.core.domain.FtpResult;
import com.inspect.base.core.domain.Response;
@ -29,13 +30,8 @@ import com.inspect.base.core.domain.maintain.MaintainRegion;
import com.inspect.job.util.HttpClientUtil;
import com.inspect.system.base.domain.SysDictData;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
@ -471,20 +467,59 @@ public class JobMainTask {
filePaths.append("/" + ftpResult.getFilepath());
}
} else if ("ir".equals(chanType)) {
InfraredModel infraredModel = new InfraredModel();
infraredModel.setChannelSerial(presetPos.getChannelCode());
infraredModel.setPresetId(Integer.parseInt(presetPos.getPresetPosCode()));
EqpBook eqpbook = new EqpBook();
eqpbook.setPatrolDeviceCode(presetPos.getPatrolDeviceCode());
List<EqpBook> eqpBookListList = taskExecClient.selectBasedataEqpBookList(eqpbook);
if (!eqpBookListList.isEmpty()) {
Response ir_gen = remoteInvokeService.invoke("IR_GEN", presetPos.getPatrolDeviceCode().split("#")[0], new HashMap<>());
log.info("ir_gen: {}", JSONObject.toJSONString(ir_gen));
Object data = ir_gen.getData();
String path = JSONObject.parseObject(JSONObject.toJSONString(data)).getString("filePath");
path = path.split("33333")[1];
filePaths.append(path).append(",");
log.info("INFRA:{}", taskExecRecord.getTaskName() + " path : " + path);
log.info("[JOB] 红外处理流程, chanType: {}, patrolPointId: {}", chanType, presetPos.getPatrolPointId());
Map<String, String> algSubtypeIdMap = taskExecClient.getAlgTypeListByPatrolPointId(String.valueOf(presetPos.getPatrolPointId()));
log.info("prePointExec algorithmTypeMap: {}", algSubtypeIdMap);
final String algSubtypeCode = algSubtypeIdMap == null ? StringUtils.EMPTY :
algSubtypeIdMap.getOrDefault(AlgConstants.ALG_SUBTYPE_CODE, StringUtils.EMPTY);
if(algSubtypeCode.contains(AlgConstants.INFRA_1800)
|| algSubtypeCode.contains(AlgConstants.INFRA_YU3)
|| algSubtypeCode.contains(AlgConstants.INFRA_CAMERA)
|| algSubtypeCode.contains(AlgConstants.INFRA_CAMERA_REVERSE)) {
log.info("[infra_1800] 红外处理新流程: prePointExec algSubtypeCode: {}", algSubtypeCode);
String paramFileName;
if(algSubtypeCode.contains(AlgConstants.INFRA_1800)) {
final String temperUrl = liveIVS_URL + "/api/v1/device/temper";
JSONObject temperParam = new JSONObject();
temperParam.put("presetId", 0);
temperParam.put("cameraCode", presetPos.getChannelCode());
final String temperUrlRes = HttpClientUtils.sendPostAgain(temperUrl, temperParam.toString());
log.info("[infra_1800] prePointExec temperUrlRes: {}", temperUrlRes);
paramFileName = taskPatrolId.split(StringUtils.UNDERLINE)[1] + StringUtils.UNDERLINE
+ taskPatrolId.split(StringUtils.UNDERLINE)[2] + StringUtils.UNDERLINE
+ presetPos.getPatrolPointId() + StringUtils.UNDERLINE
+ taskExecRecord.getDevNo() + "_" + temperUrlRes + ".jpg";
} else {
paramFileName = taskPatrolId.split(StringUtils.UNDERLINE)[1] + StringUtils.UNDERLINE
+ taskPatrolId.split(StringUtils.UNDERLINE)[2] + StringUtils.UNDERLINE
+ presetPos.getPatrolPointId() + StringUtils.UNDERLINE
+ taskExecRecord.getDevNo() + ".jpg";
}
String paramUrl = liveIVS_URL + "/api/v1/device/channelsnap?serial=" + presetPos.getVideoNvrCode() + "&realtime=true&code=" + presetPos.getChannelCode();
String paramFileDir = basePath + "CCD";
log.info("红外处理新流程: paramUrl: {}, paramFileName: {}, paramFileDir: {}", paramUrl, paramFileName, paramFileDir);
FtpResult ftpResult = saveFile(paramUrl, paramFileName, paramFileDir);
if (ftpResult != null && StringUtils.isNotEmpty(ftpResult.getFilepath())) {
log.info("红外处理新流程: filePath: {}", ftpResult.getFilepath());
bOk = ftpResult.isOk();
filePaths.append("/" + ftpResult.getFilepath());
}
} else { // 古老的红外处理流程保留勿删除
InfraredModel infraredModel = new InfraredModel();
infraredModel.setChannelSerial(presetPos.getChannelCode());
infraredModel.setPresetId(Integer.parseInt(presetPos.getPresetPosCode()));
EqpBook eqpbook = new EqpBook();
eqpbook.setPatrolDeviceCode(presetPos.getPatrolDeviceCode());
List<EqpBook> eqpBookListList = taskExecClient.selectBasedataEqpBookList(eqpbook);
if (!eqpBookListList.isEmpty()) {
Response ir_gen = remoteInvokeService.invoke("IR_GEN", presetPos.getPatrolDeviceCode().split("#")[0], new HashMap<>());
log.info("ir_gen: {}", JSONObject.toJSONString(ir_gen));
Object data = ir_gen.getData();
String path = JSONObject.parseObject(JSONObject.toJSONString(data)).getString("filePath");
path = path.split("33333")[1];
filePaths.append(path).append(",");
log.info("INFRA:{}", taskExecRecord.getTaskName() + " path : " + path);
}
}
}
} catch (Exception e) {


+ 5
- 0
inspect-main/inspect-main-task-exec/src/main/java/com/inspect/exec/controller/PatrolTaskExecController.java View File

@ -730,6 +730,11 @@ public class PatrolTaskExecController extends BaseController {
}
}
@PostMapping({"/getAlgTypeListByPatrolPointId"})
public Map<String, String> getAlgTypeListByPatrolPointId(@RequestBody final String patrolPointId) {
return patrolResultService.selectAlgorithmType(patrolPointId);
}
public static void main(String[] args) {
String dateString = DateUtils.format(DateUtils.yyyyMMddHHmmss2, new Date());
System.out.println(dateString);


+ 5
- 6
inspect-main/inspect-main-task-exec/src/main/java/com/inspect/exec/controller/PatrolTaskExecuteSchedulerController.java View File

@ -349,10 +349,9 @@ public class PatrolTaskExecuteSchedulerController extends BaseController {
String basePath = (patrolTaskExecRecord.getStationCode() == null ? this.stationCode : patrolTaskExecRecord.getStationCode()) + "/" + year + "/" + monthStr + "/" + dayStr + "/" + patrolTaskExecRecord.getTaskCode() + "/";
PatrolPresetPos presetPos = patrolPresetPosList.get(0);
try {
String param = "serial=" + presetPos.getVideoNvrCode() + "&command=goto&preset=" + presetPos.getPresetPosCode() + "&code=" + presetPos.getChannelCode();
this.log.info("[EXEC] PRESET TURN TO MEDIA CLOUD MIRROR CONTROL INTERFACE: {}", this.liveSIPB_URL + this.preset + param);
log.info("[EXEC] PRESET TURN TO MEDIA CLOUD MIRROR CONTROL INTERFACE: {}", this.liveSIPB_URL + this.preset + param);
HttpClientUtils.get(this.liveSIPB_URL + this.preset, param);
} catch (Exception e) {
e.printStackTrace();
@ -365,7 +364,7 @@ public class PatrolTaskExecuteSchedulerController extends BaseController {
}
patrolPresetAction.setPresetPosId(presetPos.getPresetPosId());
List<PatrolPresetAction> patrolPresetActionList = this.taskExecClient.selectPatrolPresetActionList(patrolPresetAction);
List<PatrolPresetAction> patrolPresetActionList = taskExecClient.selectPatrolPresetActionList(patrolPresetAction);
StringBuffer fileTypes = new StringBuffer();
StringBuffer filePaths = new StringBuffer();
Iterator<PatrolPresetAction> iterator = patrolPresetActionList.iterator();
@ -400,11 +399,11 @@ public class PatrolTaskExecuteSchedulerController extends BaseController {
try {
Thread.sleep(1000L * photoGap);
if ("vl".equals(presetPos.getChannelType())) {
Date d = new Date();
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String filePath = this.saveFile(this.liveSIPB_URL + "/api/v1/device/channelsnap?serial=" + presetPos.getVideoNvrCode() + "&realtime=true&code=" + presetPos.getChannelCode(), presetPos.getPatrolPointId() + "_" + patrolTaskExecRecord.getDevNo() + "_" + sdf.format(d) + ".jpg", basePath + "CCD");
String filePath = this.saveFile(this.liveSIPB_URL + "/api/v1/device/channelsnap?serial=" + presetPos.getVideoNvrCode() + "&realtime=true&code=" + presetPos.getChannelCode(), presetPos.getPatrolPointId() + "_" + patrolTaskExecRecord.getDevNo() + "_" + sdf.format(date) + ".jpg", basePath + "CCD");
if ("".equals(filePath)) {
filePath = this.saveFile(this.liveSIPB_URL + "/api/v1/device/channelsnap?serial=" + presetPos.getVideoNvrCode() + "&realtime=true&code=" + presetPos.getChannelCode(), presetPos.getPatrolPointId() + "_" + patrolTaskExecRecord.getDevNo() + "_" + sdf.format(d) + ".jpg", basePath + "CCD");
filePath = this.saveFile(this.liveSIPB_URL + "/api/v1/device/channelsnap?serial=" + presetPos.getVideoNvrCode() + "&realtime=true&code=" + presetPos.getChannelCode(), presetPos.getPatrolPointId() + "_" + patrolTaskExecRecord.getDevNo() + "_" + sdf.format(date) + ".jpg", basePath + "CCD");
}
filePaths.append(filePath).append(",");


+ 1
- 1
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/IPatrolResultService.java View File

@ -35,7 +35,7 @@ public interface IPatrolResultService {
List<AlgInfo> selectAlgInfo(PatrolResult patrolResult);
Map<String, String> selectAlgorithmType(String type);
Map<String, String> selectAlgorithmType(String patrolPointId);
Map<String, String> selectAlgorithmInfo(String info);


+ 3
- 2
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/impl/PatrolResultServiceImpl.java View File

@ -122,8 +122,9 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
return patrolResultMapper.selectAlgInfo(patrolResult);
}
public Map<String, String> selectAlgorithmType(String lineId) {
return patrolResultMapper.selectAlgorithmType(lineId);
public Map<String, String> selectAlgorithmType(String patrolPointId) {
log.info("selectAlgorithmType patrolPointId: {}", patrolPointId);
return patrolResultMapper.selectAlgorithmType(patrolPointId);
}
public Map<String, String> selectAlgorithmInfo(String code) {


Loading…
Cancel
Save