Commit 1d039083 authored by licc's avatar licc

修改上传文件接口

parent 0d23ea2f
......@@ -74,9 +74,9 @@
</dependency>
</dependencies>
<!-- MAVEN构建 -->
<build>
<finalName>${project.artifactId}-${moduleVersion.wisenergy-mapper}</finalName>
</build>
</project>
\ No newline at end of file
......@@ -45,7 +45,7 @@ public class WxPayUtil {
private static String apiV3Key = WxCommon.SECRET_KEY;
// 你的商户私钥
private static String privateKey = "-----BEGIN PRIVATE KEY-----\n" +WxCommon.PRIVATE_KEY
private static String privateKey = "-----BEGIN PRIVATE KEY-----\n" +WxCommon.SECRET_KEY
+ "-----END PRIVATE KEY-----\n";
private static CloseableHttpClient httpClient;
......
......@@ -16,7 +16,9 @@ public class WxCommon {
public static final String WX_PAY_URL = "https://api.mch.weixin.qq.com/v3/pay/transactions/native";
public static final String WX_PAY_QUERY = " https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/";
public static final String WX_PAY_QUERY = "https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/";
public static final String SECRET_KEY = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDhGq+iGQueP8EU" +
"3qj0T0Otnha0XboVcgmeDkgbe08H54WiF9d3R4aLAo+wAkAj/R7nRw2yWeaaMEgb" +
"ZvUz03IioVKwLhaMVEtwE5sNFCMGDDh9jGjm66j+BYgVk02P5hUAcYLcJYeo9iHA" +
......
......@@ -16,10 +16,10 @@ import java.io.IOException;
import java.util.UUID;
/**
*@ Description:
*@ Author : 86187
*@ Date : 2021/2/3 17:05
* @author 86187
* @ Description:
* @ Author : 86187
* @ Date : 2021/2/3 17:05
*/
@Api(tags = "图片上传")
@RestController
......@@ -42,12 +42,12 @@ public class FileUploadController {
/**
* 允许上传的格式
*/
private static final String[] IMAGE_TYPE = new String[]{".bmp", ".jpg", ".jpeg", ".gif", ".png"};
private static final String[] IMAGE_TYPE = new String[]{".bmp", ".jpg", ".jpeg", ".gif", ".png", ".xlsx", ".xls"};
@ApiOperation(value = "文件上传", notes = "文件上传")
@PostMapping(value = "/upload", headers = "content-type=multipart/form-data")
public R file(
@ApiParam(required = true, value = "用户头像")
@ApiParam(required = true, value = "上传文件")
@RequestParam("file") MultipartFile file,
HttpServletRequest request) {
......@@ -55,7 +55,7 @@ public class FileUploadController {
if (file.isEmpty()) {
// 上传文件为空
return R.error("上传图片不能为空");
return R.error("上传文件不能为空");
}
for (String type : IMAGE_TYPE) {
if (StringUtils.endsWithIgnoreCase(file.getOriginalFilename(), type)) {
......@@ -64,7 +64,7 @@ public class FileUploadController {
}
}
if (isLegal) {
return R.error("图片类型不符合");
return R.error("上传文件类型不符合");
}
File folder = new File(uploadImagesLocation);
if (!folder.exists()) {
......@@ -79,6 +79,6 @@ public class FileUploadController {
} catch (IOException e) {
e.printStackTrace();
}
return R.error("图片上传失败!");
return R.error("上传文件失败!");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment