mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
Merge branch 'dev-new' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev-new
This commit is contained in:
@@ -219,4 +219,29 @@ public class CommonController {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传蓝牙升级程序到阿里云oss
|
||||
* http://localhost:8080/common/uploadBlueToothFile2OSS
|
||||
* @param file
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@CrossOrigin
|
||||
@PostMapping("/uploadBlueToothFile2OSS")
|
||||
public AjaxResult uploadBlueToothFile2OSS(MultipartFile file) throws Exception {
|
||||
try {
|
||||
String url = AliyunOssUploadUtils.uploadBlueToothFile(file);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", url);
|
||||
ajax.put("fileName", FileUtils.getName(url));
|
||||
ajax.put("newFileName", FileUtils.getName(url));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
log.info("固件上传成功 url:{}", url);
|
||||
return ajax;
|
||||
}catch (Exception e){
|
||||
log.error("上传到阿里云oss error, ", e);
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,12 +98,12 @@ public class PileFirmwareInfoController extends BaseController {
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/uploadBlueToothFile")
|
||||
public AjaxResult uploadBlueToothFile(@RequestParam("avatarfile") MultipartFile file) {
|
||||
if (!file.isEmpty()) {
|
||||
String result = AliyunOssUploadUtils.uploadBlueToothFile(file);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error("上传文件错误!!");
|
||||
}
|
||||
// @PostMapping("/uploadBlueToothFile")
|
||||
// public AjaxResult uploadBlueToothFile(@RequestParam("blueToothFile") MultipartFile file) {
|
||||
// if (!file.isEmpty()) {
|
||||
// String result = AliyunOssUploadUtils.uploadBlueToothFile(file);
|
||||
// return AjaxResult.success();
|
||||
// }
|
||||
// return AjaxResult.error("上传文件错误!!");
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ aliyunoss:
|
||||
# 蓝牙小程序文件保存路径
|
||||
bluetoothFileHost: bluetooth
|
||||
# 访问域名
|
||||
# url: https://ydc-oss-dev.oss-cn-shanghai.aliyuncs.com
|
||||
interviewUrl: https://ydc-oss-prod.oss-cn-shanghai.aliyuncs.com
|
||||
url: http://img.sit.jsowellcloud.com
|
||||
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ aliyunoss:
|
||||
# 蓝牙小程序文件保存路径
|
||||
bluetoothFileHost: bluetooth
|
||||
# 访问域名
|
||||
# url: https://ydc-oss-prod.oss-cn-shanghai.aliyuncs.com
|
||||
interviewUrl: https://ydc-oss-prod.oss-cn-shanghai.aliyuncs.com
|
||||
url: https://img.jsowellcloud.com
|
||||
|
||||
########################微信支付参数#######################################
|
||||
|
||||
@@ -143,7 +143,7 @@ aliyunoss:
|
||||
# 蓝牙小程序文件保存路径
|
||||
bluetoothFileHost: bluetooth
|
||||
# 访问域名
|
||||
# url: https://ydc-oss-prod.oss-cn-shanghai.aliyuncs.com
|
||||
interviewUrl: https://ydc-oss-prod.oss-cn-shanghai.aliyuncs.com
|
||||
url: https://img.jsowellcloud.com
|
||||
|
||||
########################微信支付参数#######################################
|
||||
|
||||
@@ -143,7 +143,7 @@ aliyunoss:
|
||||
# 蓝牙小程序文件保存路径
|
||||
bluetoothFileHost: bluetooth
|
||||
# 访问域名
|
||||
# url: https://ydc-oss-dev.oss-cn-shanghai.aliyuncs.com
|
||||
interviewUrl: https://ydc-oss-prod.oss-cn-shanghai.aliyuncs.com
|
||||
url: http://img.sit.jsowellcloud.com
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,11 @@ public class AliyunOssConfig {
|
||||
*/
|
||||
private String bluetoothFileHost;
|
||||
|
||||
/**
|
||||
* 访问域名(上传蓝牙固件时用)
|
||||
*/
|
||||
private String interviewUrl;
|
||||
|
||||
/**
|
||||
* 访问域名
|
||||
*/
|
||||
@@ -90,6 +95,14 @@ public class AliyunOssConfig {
|
||||
this.bluetoothFileHost = bluetoothFileHost;
|
||||
}
|
||||
|
||||
public String getInterviewUrl() {
|
||||
return interviewUrl;
|
||||
}
|
||||
|
||||
public void setInterviewUrl(String interviewUrl) {
|
||||
this.interviewUrl = interviewUrl;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
@@ -107,6 +120,7 @@ public class AliyunOssConfig {
|
||||
.append("bucketName", bucketName)
|
||||
.append("filehost", filehost)
|
||||
.append("bluetoothFileHost", bluetoothFileHost)
|
||||
.append("interviewUrl", interviewUrl)
|
||||
.append("url", url)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.common.util.file;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.aliyun.oss.OSS;
|
||||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.model.ObjectMetadata;
|
||||
@@ -59,7 +60,7 @@ public class AliyunOssUploadUtils {
|
||||
filePathName = aliyunOssConfig.getFilehost() + "/" + dir_name + randomNumber + filePathName;
|
||||
try {
|
||||
PutObjectResult putObjectResult = ossClient.putObject(aliyunOssConfig.getBucketName(), filePathName, file.getInputStream());
|
||||
log.info("上传OSS成功, url:{}", putObjectResult.getResponse().getUri());
|
||||
// log.info("上传OSS成功, url:{}", putObjectResult.getResponse().getUri());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
@@ -86,7 +87,7 @@ public class AliyunOssUploadUtils {
|
||||
filePathName = aliyunOssConfig.getBluetoothFileHost() + "/files/" + filePathName;
|
||||
try {
|
||||
PutObjectResult putObjectResult = ossClient.putObject(aliyunOssConfig.getBucketName(), filePathName, file.getInputStream());
|
||||
log.info("上传OSS成功, url:{}", putObjectResult.getResponse().getUri());
|
||||
// log.info("上传蓝牙升级文件到OSS成功, putObjectResult:{}", JSONObject.toJSONString(putObjectResult));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
@@ -94,7 +95,7 @@ public class AliyunOssUploadUtils {
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
return aliyunOssConfig.getUrl() + "/" + filePathName;
|
||||
return aliyunOssConfig.getInterviewUrl() + "/" + filePathName;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import com.jsowell.pile.domain.PileFirmwareInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.file.AliyunOssUploadUtils;
|
||||
import com.jsowell.pile.domain.PileFirmwareInfo;
|
||||
import com.jsowell.pile.mapper.PileFirmwareInfoMapper;
|
||||
import com.jsowell.pile.service.PileFirmwareInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -85,6 +85,11 @@
|
||||
<el-table-column label="固件名称" align="center" prop="name" />
|
||||
<el-table-column label="固件描述" align="center" prop="description" />
|
||||
<el-table-column label="路径" align="center" prop="filePath" />
|
||||
<el-table-column label="固件类型" align="center" prop="useRange">
|
||||
<template slot-scope="scope">
|
||||
<p>{{ scope.row.useRange == 2 ? "蓝牙" : "4G" }}</p>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<!--<el-button
|
||||
|
||||
Reference in New Issue
Block a user