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