Browse Source

/*Redisson机制不起作用问题修改;红外画框设置值存储到数据库*/

master
htjcAdmin 3 months ago
parent
commit
d7b8ad1004
6 changed files with 46 additions and 29 deletions
  1. +3
    -3
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/service/impl/AnalyseResponseServiceImpl.java
  2. +5
    -3
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/AnalyseRequestDelayQueueListener.java
  3. +3
    -3
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/AnalyseRequestServiceImpl.java
  4. +29
    -16
      inspect-main/inspect-main-video/src/main/java/com/inspect/patrol/controller/PatrolPresetPosController.java
  5. +3
    -0
      inspect-main/inspect-main-video/src/main/java/com/inspect/patrol/service/BasedataPatrolPointService.java
  6. +3
    -4
      inspect-metadata/src/main/java/com/inspect/metadata/patrolpointmnt/controller/BasedataPatrolPointController.java

+ 3
- 3
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/service/impl/AnalyseResponseServiceImpl.java View File

@ -76,7 +76,7 @@ public class AnalyseResponseServiceImpl implements IAnalyseResponseService {
private ResultAnalysisUtils resultAnalysisUtils;
@Resource
private DelayQueueService<AnalyseRequest> delayQueueService;
private DelayQueueService<String> delayQueueService;
@Override
public void picAnalyseRetNotify(AnalyseResult analyseResult) {
@ -127,8 +127,8 @@ public class AnalyseResponseServiceImpl implements IAnalyseResponseService {
analyseRequest.getTaskPatrolId(),
requestId,
analyseRequest);
if (delayQueueService.containRequest(AnalyseConstants.ALGORITHM_REQUEST_DELAY_QUEUE, analyseRequest)) {
boolean isRemoved = delayQueueService.removeRequest(AnalyseConstants.ALGORITHM_REQUEST_DELAY_QUEUE, analyseRequest);
if (delayQueueService.containRequest(AnalyseConstants.ALGORITHM_REQUEST_DELAY_QUEUE, analyseRequest.getRequestId())) {
boolean isRemoved = delayQueueService.removeRequest(AnalyseConstants.ALGORITHM_REQUEST_DELAY_QUEUE, analyseRequest.getRequestId());
log.info("ALGORITHM_FILTER_RESULT Redisson Removed requestId: {}, Result: {}, analyseRequest: {}", requestId, isRemoved ? "success" : "fail", analyseRequest);
} else {
log.info("ALGORITHM_FILTER_RESULT Redisson has Compensated requestId: {}, analyseRequest: {}", requestId, analyseRequest);


+ 5
- 3
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/AnalyseRequestDelayQueueListener.java View File

@ -35,13 +35,15 @@ public class AnalyseRequestDelayQueueListener implements InitializingBean, Dispo
public void afterPropertiesSet() {
// 启动监听线程
listenerThread = new Thread(() -> {
RBlockingQueue<AnalyseRequest> blockingQueue = redissonClient.getBlockingQueue(AnalyseConstants.ALGORITHM_REQUEST_DELAY_QUEUE);
RBlockingQueue<String> blockingQueue = redissonClient.getBlockingQueue(AnalyseConstants.ALGORITHM_REQUEST_DELAY_QUEUE);
log.info("Listening AnalyseRequest Delay Queue Task Launching");
while (running && !Thread.currentThread().isInterrupted()) {
try {
AnalyseRequest request = blockingQueue.take(); // 阻塞等待任务到期
handleRequest(request);
// AnalyseRequest request = blockingQueue.take(); // 阻塞等待任务到期
// handleRequest(request);
final String requestId = blockingQueue.take(); // 阻塞等待任务到期
log.info("ANALYSE_REQUEST_DELAY_QUEUE_EXPIRE requestId: {}", requestId);
} catch (RedissonShutdownException e) {
log.warn("Redisson 已关闭,终止监听线程");
break;


+ 3
- 3
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/AnalyseRequestServiceImpl.java View File

@ -44,7 +44,7 @@ public class AnalyseRequestServiceImpl implements IAnalyseRequestService {
private AnalyseRequestRetryableDelegate retryDelegate;
@Resource
private DelayQueueService<AnalyseRequest> delayQueueService;
private DelayQueueService<String> delayQueueService;
@Resource
private IAnalyseLogService analysisLogService;
@ -130,9 +130,9 @@ public class AnalyseRequestServiceImpl implements IAnalyseRequestService {
analyseReq.setRedissonTime(DateUtils.parseDateToStr(DateUtils.yyyyMMddHHmmss, new Date()));
if (testMode) {
delayQueueService.submitRequest(AnalyseConstants.ALGORITHM_REQUEST_DELAY_QUEUE, analyseReq, (3L), TimeUnit.MINUTES);
delayQueueService.submitRequest(AnalyseConstants.ALGORITHM_REQUEST_DELAY_QUEUE, analyseReq.getRequestId(), (3L), TimeUnit.MINUTES);
} else {
delayQueueService.submitRequest(AnalyseConstants.ALGORITHM_REQUEST_DELAY_QUEUE, analyseReq, requestTimeout, TimeUnit.DAYS);
delayQueueService.submitRequest(AnalyseConstants.ALGORITHM_REQUEST_DELAY_QUEUE, analyseReq.getRequestId(), requestTimeout, TimeUnit.DAYS);
}
if (retryDelegate.callRemoteAnalyseService(analyseReq)) {


+ 29
- 16
inspect-main/inspect-main-video/src/main/java/com/inspect/patrol/controller/PatrolPresetPosController.java View File

@ -390,11 +390,13 @@ public class PatrolPresetPosController extends BaseController {
String password = jsonObject.getString(("password"));
List<SysDictData> presetPoints = new ArrayList<>();
String params = "code=" + channelCode;
if(StringUtils.isNotEmpty(host)) params.concat(("&host=")).concat(URLEncoder.encode(host, ("UTF-8")));
if(StringUtils.isNotEmpty(port)) params.concat(("&port=")).concat(URLEncoder.encode(port, ("UTF-8")));
if(StringUtils.isNotEmpty(username)) params.concat(("&username=")).concat(URLEncoder.encode(username, ("UTF-8")));
if(StringUtils.isNotEmpty(password)) params.concat(("&password=")).concat(URLEncoder.encode(password, ("UTF-8")));
if(StringUtils.isNotEmpty(address)) params.concat(("&address=")).concat(URLEncoder.encode(address, ("UTF-8")));
if (StringUtils.isNotEmpty(host)) params.concat(("&host=")).concat(URLEncoder.encode(host, ("UTF-8")));
if (StringUtils.isNotEmpty(port)) params.concat(("&port=")).concat(URLEncoder.encode(port, ("UTF-8")));
if (StringUtils.isNotEmpty(username))
params.concat(("&username=")).concat(URLEncoder.encode(username, ("UTF-8")));
if (StringUtils.isNotEmpty(password))
params.concat(("&password=")).concat(URLEncoder.encode(password, ("UTF-8")));
if (StringUtils.isNotEmpty(address)) params.concat(("&address=")).concat(URLEncoder.encode(address, ("UTF-8")));
String result = HttpClientUtils.get((this.deviceUrl + AccessApiConstant.PTZ_LIST), params);
JSONObject ivsPresetInfo = JSONObject.parseObject(result);
String resultCode = ivsPresetInfo.getString("resultCode");
@ -513,7 +515,7 @@ public class PatrolPresetPosController extends BaseController {
this.basedataPatrolPointService.UpPatrolPointModel((new JSONObject()).fluentPut("patrolPointId", patrolPresetPos.getPatrolPointId()));
// insert into basedata_patrolpoint_preset
JSONArray objects = this.selectBasePreset(patrolPresetPos);
if (objects == null || objects.size() == 0) {
if (objects == null || objects.isEmpty()) {
basePresetId = this.insertBasePreset(patrolPresetPos);
}
SnapModel snapModel = new SnapModel();
@ -521,7 +523,18 @@ public class PatrolPresetPosController extends BaseController {
snapModel.setPatrolDeviceCode(patrolPresetPos.getPatrolDeviceCode());
snap = this.deviceIntoService.snap(snapModel);
patrolPresetPos.setChannelImg(snap);
logger.info("[PRESET] patrolPresetPos: {}", patrolPresetPos);
logger.info("PRESET_ADD patrolPointId: {}, patrolPresetPos: {}", patrolPresetPos.getPatrolPointId(), patrolPresetPos);
// update basedata_patrolpoint
try {
JSONObject editJsonObject = (new JSONObject())
.fluentPut("patrolpointId", patrolPresetPos.getPatrolPointId())
.fluentPut("meterType", patrolPresetPos.getPresetParamList().get(0).getCoordinate());
logger.info("PRESET_ADD editJsonObject: {}", editJsonObject);
basedataPatrolPointService.edit(editJsonObject);
} catch (Exception e) {
e.printStackTrace();
}
PatrolPresetPos patrolPresetPos1 = new PatrolPresetPos();
patrolPresetPos1.setPatrolPointId(patrolPresetPos.getPatrolPointId());
List<PatrolPresetPos> presetPosList = patrolPresetPosService.selectPatrolPresetPosList(patrolPresetPos1);
@ -547,19 +560,19 @@ public class PatrolPresetPosController extends BaseController {
temperParam.put("cameraCode", patrolPresetPos.getChannelCode());
List<Map<String, Object>> polygonList = new ArrayList<>();
String[] split = patrolPresetParam.getCoordinate().split(StringUtils.COMMA);
if(split.length == 10){
if (split.length == 10) {
Map<String, Object> point = new HashMap<>();
point.put("x", (int)((Double.parseDouble(split[0])/Double.parseDouble(split[8])) * 8190));
point.put("y", (int)((Double.parseDouble(split[1])/Double.parseDouble(split[9])) * 8190));
point.put("x", (int) ((Double.parseDouble(split[0]) / Double.parseDouble(split[8])) * 8190));
point.put("y", (int) ((Double.parseDouble(split[1]) / Double.parseDouble(split[9])) * 8190));
Map<String, Object> point1 = new HashMap<>();
point1.put("x", (int)((Double.parseDouble(split[2])/Double.parseDouble(split[8])) * 8190));
point1.put("y", (int)((Double.parseDouble(split[3])/Double.parseDouble(split[9])) * 8190));
point1.put("x", (int) ((Double.parseDouble(split[2]) / Double.parseDouble(split[8])) * 8190));
point1.put("y", (int) ((Double.parseDouble(split[3]) / Double.parseDouble(split[9])) * 8190));
Map<String, Object> point2 = new HashMap<>();
point2.put("x", (int)((Double.parseDouble(split[4])/Double.parseDouble(split[8])) * 8190));
point2.put("y", (int)((Double.parseDouble(split[5])/Double.parseDouble(split[9])) * 8190));
point2.put("x", (int) ((Double.parseDouble(split[4]) / Double.parseDouble(split[8])) * 8190));
point2.put("y", (int) ((Double.parseDouble(split[5]) / Double.parseDouble(split[9])) * 8190));
Map<String, Object> point3 = new HashMap<>();
point3.put("x", (int)((Double.parseDouble(split[6])/Double.parseDouble(split[8])) * 8190));
point3.put("y", (int)((Double.parseDouble(split[7])/Double.parseDouble(split[9])) * 8190));
point3.put("x", (int) ((Double.parseDouble(split[6]) / Double.parseDouble(split[8])) * 8190));
point3.put("y", (int) ((Double.parseDouble(split[7]) / Double.parseDouble(split[9])) * 8190));
polygonList.add(point);
polygonList.add(point1);
polygonList.add(point2);


+ 3
- 0
inspect-main/inspect-main-video/src/main/java/com/inspect/patrol/service/BasedataPatrolPointService.java View File

@ -14,6 +14,9 @@ public interface BasedataPatrolPointService {
@PostMapping({"/patrolpointmnt/patrolpoint"})
AjaxResult add(@RequestBody JSONObject jsonObject);
@PostMapping({"/patrolpointmnt/patrolpoint/edit"})
AjaxResult edit(@RequestBody JSONObject jsonObject);
@PostMapping({"/patrolpointmnt/patrolpoint/remove/{patrolpointIds}"})
AjaxResult remove(@PathVariable("patrolpointIds") Long[] pointIds);


+ 3
- 4
inspect-metadata/src/main/java/com/inspect/metadata/patrolpointmnt/controller/BasedataPatrolPointController.java View File

@ -33,6 +33,7 @@ import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
@ -42,6 +43,7 @@ import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@Slf4j
@RestController
@RequestMapping({"/patrolpointmnt/patrolpoint"})
public class BasedataPatrolPointController extends BaseController {
@ -186,6 +188,7 @@ public class BasedataPatrolPointController extends BaseController {
)
@PostMapping({"/edit"})
public AjaxResult edit(@RequestBody BasedataPatrolPoint basedataPatrolpoint) {
log.info("BASEDATA_PATROL_POINT_CONTROLLER EDIT param: {}", basedataPatrolpoint);
return this.toAjax(this.basedataPatrolPointService.updateBasedataPatrolPoint(basedataPatrolpoint));
}
@ -273,8 +276,4 @@ public class BasedataPatrolPointController extends BaseController {
return AjaxResult.success(this.basedataPatrolPointService.pointLatestResult(pointLatestResultVo));
}
}

Loading…
Cancel
Save