Browse Source

/*表计类型走自己的大模型,增加ANALYSIS_BIG_URL_METER分支*/

master
htjcAdmin 4 months ago
parent
commit
1b3fc09bf9
3 changed files with 27 additions and 6 deletions
  1. +1
    -0
      inspect-base/inspect-base-core/src/main/java/com/inspect/base/core/constant/AlgConstants.java
  2. +1
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/constant/AnalyseConstants.java
  3. +25
    -6
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/AnalyseRequestServiceImpl.java

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

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


+ 1
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/constant/AnalyseConstants.java View File

@ -37,6 +37,7 @@ public class AnalyseConstants {
public static final String ANALYSE_FILTER_URL = "ANALYSE_FILTER_URL";
public static final String ANALYSIS_BIG_URL = "ANALYSIS_BIG_URL";
public static final String ANALYSIS_BIG_URL_INFRARED = "ANALYSIS_BIG_URL_INFRARED";
public static final String ANALYSIS_BIG_URL_METER = "ANALYSIS_BIG_URL_METER";
public static final String MAX_NUM = "MAX_NUM";
public static final String ALGORITHM_REQUEST_QUEUE = "algorithm:request:queue";


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

@ -91,12 +91,15 @@ public class AnalyseRequestServiceImpl implements IAnalyseRequestService {
// }
// });
if(checkInfraredType(typeList)) {
if (checkInfraredType(typeList)) {
requestUrl = patrolTaskService.selectConfigByKey(AnalyseConstants.ANALYSIS_BIG_URL_INFRARED);
log.info("BIG_MODEL_INFRARED requestId: {}, requestUrl: {}", requestId, requestUrl);
log.info("ANALYSIS_BIG_URL_INFRARED requestId: {}, requestUrl: {}", requestId, requestUrl);
} else if (checkMeterType(typeList)) {
requestUrl = patrolTaskService.selectConfigByKey(AnalyseConstants.ANALYSIS_BIG_URL_METER);
log.info("ANALYSIS_BIG_URL_METER requestId: {}, requestUrl: {}", requestId, requestUrl);
} else {
requestUrl = patrolTaskService.selectConfigByKey(AnalyseConstants.ANALYSIS_BIG_URL);
log.info("BIG_MODEL_OTHER requestId: {}, requestUrl: {}", requestId, requestUrl);
log.info("DEFAULT ANALYSIS_BIG_URL requestId: {}, requestUrl: {}", requestId, requestUrl);
}
final String analyzeBigModelRequestIdRedisKey = AnalyseConstants.ANALYSE_AI_REQUEST.concat(requestId);
@ -107,7 +110,7 @@ public class AnalyseRequestServiceImpl implements IAnalyseRequestService {
redisService.setCacheObject(analyzeBigModelRequestIdRedisKey, analyseReq.clone(), requestTimeout, TimeUnit.DAYS);
}
if(StringUtil.isEmpty(requestUrl)) {
if (StringUtil.isEmpty(requestUrl)) {
requestUrl = "http://localhost:8080";
}
@ -115,13 +118,13 @@ public class AnalyseRequestServiceImpl implements IAnalyseRequestService {
analyseReq.setRequestUrl(requestUrl.concat(AnalyseConstants.ANALYSE_URI));
analyseReq.setRedissonTime(DateUtils.parseDateToStr(DateUtils.yyyyMMddHHmmss, new Date()));
if(testMode) {
if (testMode) {
delayQueueService.submitRequest(AnalyseConstants.ANALYSE_REQ_DELAY_QUEUE, analyseReq, (3L), TimeUnit.MINUTES);
} else {
delayQueueService.submitRequest(AnalyseConstants.ANALYSE_REQ_DELAY_QUEUE, analyseReq, requestTimeout, TimeUnit.DAYS);
}
if(!retryDelegate.callRemoteAnalyseService(analyseReq)) {
if (!retryDelegate.callRemoteAnalyseService(analyseReq)) {
log.info("FINALLY FAIL CALL REMOTE ANALYSE SERVICE, requestId: {}, taskPatrolId: {}",
analyseReq.getRequestId(),
analyseReq.getTaskPatrolId());
@ -141,6 +144,10 @@ public class AnalyseRequestServiceImpl implements IAnalyseRequestService {
AlgConstants.INFRA_CAMERA_REVERSE
));
private static final Set<String> METER_TYPES = new HashSet<>(Arrays.asList(
AlgConstants.METER
));
public static boolean checkInfraredType(String[] typeList) {
if (typeList == null) {
return false;
@ -153,6 +160,18 @@ public class AnalyseRequestServiceImpl implements IAnalyseRequestService {
return false;
}
public static boolean checkMeterType(String[] typeList) {
if (typeList == null) {
return false;
}
for (String type : typeList) {
if (METER_TYPES.contains(type)) {
return true;
}
}
return false;
}
public static void main(String[] args) {
try {
ObjectMapper mapper = new ObjectMapper();


Loading…
Cancel
Save