Commit 51bc347f by xmh

匹配bug修复,代码优化

1 parent 6e44e6cb
...@@ -325,7 +325,7 @@ public class ReidService { ...@@ -325,7 +325,7 @@ public class ReidService {
Date max = DateUtil.addMinutes(pic.getCreateTime(), timeInterval); Date max = DateUtil.addMinutes(pic.getCreateTime(), timeInterval);
Date min = DateUtil.addMinutes(pic.getCreateTime(), -timeInterval); Date min = DateUtil.addMinutes(pic.getCreateTime(), -timeInterval);
countTimeLTE = countTimeLTE == null ? max : max.compareTo(countTimeLTE) > 0 ? max : countTimeLTE; countTimeLTE = countTimeLTE == null ? max : max.compareTo(countTimeLTE) > 0 ? max : countTimeLTE;
countTimeGTE = countTimeGTE == null ? min : min.compareTo(countTimeGTE) < 0 ? min : countTimeLTE; countTimeGTE = countTimeGTE == null ? min : min.compareTo(countTimeGTE) < 0 ? min : countTimeGTE;
} }
BodyFeature feature = storageUtils.getBodyFeature(picId); BodyFeature feature = storageUtils.getBodyFeature(picId);
......
...@@ -5,6 +5,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -5,6 +5,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
import com.viontech.label.core.base.DateConverter; import com.viontech.label.core.base.DateConverter;
import com.viontech.label.tool.keliu.service.FileService;
import com.viontech.label.tool.keliu.service.LocalFileServiceImpl;
import com.viontech.label.tool.keliu.service.OnlineFileServiceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -48,6 +52,19 @@ public class WebConfig implements WebMvcConfigurer { ...@@ -48,6 +52,19 @@ public class WebConfig implements WebMvcConfigurer {
return restTemplateBuilder.build(); return restTemplateBuilder.build();
} }
@Bean("fileService")
@ConditionalOnProperty("vion.keliu-image-path")
public FileService localFileService() {
return new LocalFileServiceImpl();
}
@Bean("fileService")
@ConditionalOnProperty("vion.keliu-image-url")
public FileService onlineFileService() {
return new OnlineFileServiceImpl();
}
@Configuration @Configuration
public static class CorsConfig { public static class CorsConfig {
@Bean @Bean
......
package com.viontech.label.tool.keliu.service; package com.viontech.label.tool.keliu.service;
import com.viontech.label.tool.keliu.config.VionConfig; import com.viontech.label.tool.keliu.config.VionConfig;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File; import java.io.File;
...@@ -14,12 +13,15 @@ import java.io.File; ...@@ -14,12 +13,15 @@ import java.io.File;
* @author 谢明辉 * @author 谢明辉
* @date 2021/7/9 * @date 2021/7/9
*/ */
@Service("fileService") @Slf4j
@ConditionalOnProperty("vion.keliu-image-path")
public class LocalFileServiceImpl implements FileService { public class LocalFileServiceImpl implements FileService {
@Resource @Resource
private VionConfig vionConfig; private VionConfig vionConfig;
public LocalFileServiceImpl() {
log.info("======================= LocalFileServiceImpl =======================");
}
@Override @Override
public byte[] getFile(String filePath) { public byte[] getFile(String filePath) {
try { try {
......
package com.viontech.label.tool.keliu.service; package com.viontech.label.tool.keliu.service;
import com.viontech.label.tool.keliu.config.VionConfig; import com.viontech.label.tool.keliu.config.VionConfig;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -13,8 +12,7 @@ import javax.annotation.Resource; ...@@ -13,8 +12,7 @@ import javax.annotation.Resource;
* @author 谢明辉 * @author 谢明辉
* @date 2021/7/9 * @date 2021/7/9
*/ */
@Service("fileService") @Slf4j
@ConditionalOnProperty("vion.keliu-image-url")
public class OnlineFileServiceImpl implements FileService { public class OnlineFileServiceImpl implements FileService {
@Resource @Resource
...@@ -22,6 +20,10 @@ public class OnlineFileServiceImpl implements FileService { ...@@ -22,6 +20,10 @@ public class OnlineFileServiceImpl implements FileService {
@Resource @Resource
private RestTemplate restTemplate; private RestTemplate restTemplate;
public OnlineFileServiceImpl() {
log.info("======================= OnlineFileServiceImpl =======================");
}
@Override @Override
public byte[] getFile(String filePath) { public byte[] getFile(String filePath) {
return restTemplate.getForObject(vionConfig.getKeliuImageUrl() + filePath, byte[].class); return restTemplate.getForObject(vionConfig.getKeliuImageUrl() + filePath, byte[].class);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!