|
|
|
@ -12,6 +12,7 @@ import com.hnac.hzinfo.inspect.ai.service.IZhiPuBigModelService;
|
|
|
|
|
import com.hnac.hzinfo.inspect.ai.vo.ZhiPuImageAnalysisDTO; |
|
|
|
|
import com.hnac.hzinfo.inspect.utils.HiKUtil; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
@ -21,6 +22,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -29,6 +32,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
*/ |
|
|
|
|
@Service |
|
|
|
|
@AllArgsConstructor |
|
|
|
|
@Slf4j |
|
|
|
|
public class ZhiPuBigModelServiceImpl implements IZhiPuBigModelService { |
|
|
|
|
|
|
|
|
|
private final IStationVideoTypeClient stationVideoTypeClient; |
|
|
|
@ -59,7 +63,6 @@ public class ZhiPuBigModelServiceImpl implements IZhiPuBigModelService {
|
|
|
|
|
if (StringUtil.isBlank(url)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BigModelAnalysisRequestDTO zhiPuRequest = new BigModelAnalysisRequestDTO(); |
|
|
|
|
zhiPuRequest.setUrl(url); |
|
|
|
|
zhiPuRequest.setCheckTypeSonList(analysisTypeList); |
|
|
|
@ -85,23 +88,35 @@ public class ZhiPuBigModelServiceImpl implements IZhiPuBigModelService {
|
|
|
|
|
@Override |
|
|
|
|
public List<String> getZhiPuAnalysisType(String[] originalCode) { |
|
|
|
|
List<String> result = new ArrayList<>(); |
|
|
|
|
R<List<Dict>> zhiPuResponse = dictClient.getList(ZHI_PU_TYPE_KEY); |
|
|
|
|
if (!zhiPuResponse.isSuccess()) { |
|
|
|
|
Map<String, String> typeMap = mappingTypes(); |
|
|
|
|
for (String code : originalCode) { |
|
|
|
|
String zhiPuType = typeMap.get(code); |
|
|
|
|
if (StringUtil.isNotBlank(zhiPuType)) { |
|
|
|
|
result.add(zhiPuType); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
List<Dict> zhiPuList = zhiPuResponse.getData(); |
|
|
|
|
for (String code : originalCode) { |
|
|
|
|
R<String> valueResponse = dictClient.getValue(CAMERA_TYPE_KEY, code); |
|
|
|
|
if (!valueResponse.isSuccess()|| StringUtil.isBlank(valueResponse.getData())) { |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
public Map<String, String> mappingTypes() { |
|
|
|
|
Map<String, String> typeMap = new ConcurrentHashMap<>(); |
|
|
|
|
R<List<Dict>> zhiPuResponse = dictClient.getList(ZHI_PU_TYPE_KEY); |
|
|
|
|
if (!zhiPuResponse.isSuccess() || CollectionUtil.isEmpty(zhiPuResponse.getData())) { |
|
|
|
|
return typeMap; |
|
|
|
|
} |
|
|
|
|
String value = valueResponse.getData(); |
|
|
|
|
for (Dict dict : zhiPuList) { |
|
|
|
|
if (value.indexOf(dict.getDictValue()) >= 0 || dict.getDictValue().indexOf(value) >= 0) { |
|
|
|
|
result.add(dict.getDictKey()); |
|
|
|
|
R<List<Dict>> cameraResponse = dictClient.getList(CAMERA_TYPE_KEY); |
|
|
|
|
if (!cameraResponse.isSuccess() || CollectionUtil.isEmpty(cameraResponse.getData())) { |
|
|
|
|
return typeMap; |
|
|
|
|
} |
|
|
|
|
List<Dict> zhiPuList = zhiPuResponse.getData(); |
|
|
|
|
List<Dict> cameraList = cameraResponse.getData(); |
|
|
|
|
for (Dict camera : cameraList) { |
|
|
|
|
for (Dict zhiPu : zhiPuList) { |
|
|
|
|
if (camera.getDictValue().indexOf(zhiPu.getDictValue()) >= 0 || zhiPu.getDictValue().indexOf(camera.getDictValue()) >= 0) { |
|
|
|
|
typeMap.put(camera.getDictKey(), zhiPu.getDictKey()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
return typeMap; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|