Browse Source

Merge remote-tracking branch 'origin/dev-zs' into dev-zs

dev-zs
fyj 2 years ago
parent
commit
c935d4f989
  1. 23
      device_cars/src/main/java/com/xr/device_car/config/utils/Files.java
  2. 10
      device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/FocalLengthConfigController.java
  3. 2
      device_iec61850clent/src/main/resources/application.yml

23
device_cars/src/main/java/com/xr/device_car/config/utils/Files.java

@ -283,6 +283,29 @@ public class Files {
return os.toByteArray(); return os.toByteArray();
} }
public static BufferedImage bytesTobufferedImage(byte[] bytes){
BufferedImage image = null;
try {
// 利用ByteArrayInputStream将字节数据转换成InputStream
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
// 使用ImageIO读取InputStream中的数据转换为BufferedImage
image = ImageIO.read(bais);
// 关闭ByteArrayInputStream
bais.close();
// 此时,image就是转换后的BufferedImage对象,可以进行显示或其他处理
// 例如显示图像:
// ImageIcon icon=new ImageIcon(image);
// JOptionPane.showMessageDialog(null, icon);
} catch (IOException e) {
e.printStackTrace();
}
return image;
}
public static String uploadImage(BufferedImage bufferedImage,String imgPath,String rqImg) throws Exception{ public static String uploadImage(BufferedImage bufferedImage,String imgPath,String rqImg) throws Exception{
File file =new File(imgPath+rqImg); File file =new File(imgPath+rqImg);
if(!file.getParentFile().exists()){ if(!file.getParentFile().exists()){

10
device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/FocalLengthConfigController.java

@ -78,15 +78,11 @@ public class FocalLengthConfigController {
QueryWrapper<FocalLengthConfig> query1=new QueryWrapper<>(); QueryWrapper<FocalLengthConfig> query1=new QueryWrapper<>();
query1.in("config_id",meters); query1.in("config_id",meters);
List<FocalLengthConfig> lists=focalLengthConfigService.list(query1); List<FocalLengthConfig> lists=focalLengthConfigService.list(query1);
File file1=new File("D:\\images\\images\\img_ori.jpg");
if (!file1.getParentFile().exists()) {
file1.getParentFile().mkdirs();
}
if(focalLengthConfig.getRotate() == null){ if(focalLengthConfig.getRotate() == null){
focalLengthConfig.setRotate(0); focalLengthConfig.setRotate(0);
} }
BufferedImage bufferedImage=Files.bytesTobufferedImage(config.getFocalPicture());
BufferedImage bufferedImage=ImageIO.read(file1);
int width=bufferedImage.getWidth(); int width=bufferedImage.getWidth();
int height=bufferedImage.getHeight(); int height=bufferedImage.getHeight();
File file = new File("D:\\images\\path\\config"); File file = new File("D:\\images\\path\\config");
@ -183,7 +179,7 @@ public class FocalLengthConfigController {
stringBuffer.append("\t\t\t\t").append("\"expected_len\":"+focalLengthConfig.getExpectedLen()+",\n"); stringBuffer.append("\t\t\t\t").append("\"expected_len\":"+focalLengthConfig.getExpectedLen()+",\n");
stringBuffer.append("\t\t\t\t\"padding\":\"0\",\n"); stringBuffer.append("\t\t\t\t\"padding\":\"0\",\n");
stringBuffer.append("\t\t\t\t\"append_from\":\"head\",\n"); stringBuffer.append("\t\t\t\t\"append_from\":\"head\",\n");
stringBuffer.append("\t\t\t\t\"shorten_from\":\"tail\",\n"); stringBuffer.append("\t\t\t\t\"shorten_from\":\"tail\"\n");
stringBuffer.append("\t\t\t},\n"); stringBuffer.append("\t\t\t},\n");
stringBuffer.append("\t\t\t\"scales\": [0.0,0.0,1.0,5.0]\n\t\t},"); stringBuffer.append("\t\t\t\"scales\": [0.0,0.0,1.0,5.0]\n\t\t},");
} else if(config1.getConfigType().equals("5")){ } else if(config1.getConfigType().equals("5")){

2
device_iec61850clent/src/main/resources/application.yml

@ -1,6 +1,6 @@
spring: spring:
profiles: profiles:
active: prod #开发环境 active: dev #开发环境
# active: test #测试环境5 # active: test #测试环境5
#active: prod #生产环境 #active: prod #生产环境
# active: prod #生产环境 # active: prod #生产环境

Loading…
Cancel
Save