This commit is contained in:
彭勇平 2025-03-31 14:37:13 +08:00
parent a0e8cc603a
commit bccc0204de
7 changed files with 27 additions and 11 deletions

View file

@ -62,6 +62,7 @@ import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import weixin.popular.api.SnsAPI; import weixin.popular.api.SnsAPI;
@ -84,6 +85,9 @@ import java.util.*;
@Service("userService") @Service("userService")
@Slf4j @Slf4j
public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements UserService { public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements UserService {
@Value("${file.upload.url}")
public static String fileUrl = "";
@Autowired @Autowired
private UserVipService userVipService; private UserVipService userVipService;
@Autowired @Autowired
@ -1054,7 +1058,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
// 配置通知栏图标 // 配置通知栏图标
notification.setLogo("icon.png"); //配置通知栏图标需要在客户端开发时嵌入默认为push.png notification.setLogo("icon.png"); //配置通知栏图标需要在客户端开发时嵌入默认为push.png
// 配置通知栏网络图标 // 配置通知栏网络图标
notification.setLogoUrl(commonInfoService.findOne(19).getValue() + "/logo.png"); notification.setLogoUrl(fileUrl + "/file/logo.png");
notification.setTitle(title); notification.setTitle(title);
notification.setBody(content); notification.setBody(content);
notification.setClickType("url"); notification.setClickType("url");

View file

@ -33,6 +33,8 @@ public class AliFileUploadController {
@Value("${file.upload.path}") @Value("${file.upload.path}")
public String filePath = ""; public String filePath = "";
@Value("${file.upload.url}")
public String fileUrl = "";
private final CommonInfoService commonRepository; private final CommonInfoService commonRepository;
@ -62,12 +64,12 @@ public class AliFileUploadController {
// 关闭OSSClient // 关闭OSSClient
ossClient.shutdown(); ossClient.shutdown();
// String src = commonRepository.findOne(72).getValue()+"/"+completePath; // String src = commonRepository.findOne(72).getValue()+"/"+completePath;
String src = commonRepository.findOne(19).getValue()+"/img/"+completePath; String src = fileUrl + "/img/"+completePath;
return Result.success().put("data",src); return Result.success().put("data",src);
}else{ }else{
try try
{ {
String http = commonRepository.findOne(19).getValue(); String http = fileUrl;
String[] split = http.split("://"); String[] split = http.split("://");
// 上传文件路径 // 上传文件路径
// String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath"; // String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath";
@ -105,11 +107,11 @@ public class AliFileUploadController {
ossClient.putObject(commonRepository.findOne(71).getValue(), completePath, inputStream); ossClient.putObject(commonRepository.findOne(71).getValue(), completePath, inputStream);
// 关闭OSSClient // 关闭OSSClient
ossClient.shutdown(); ossClient.shutdown();
return commonRepository.findOne(19).getValue()+"/img/"+completePath; return fileUrl+"/img/"+completePath;
}else{ }else{
try try
{ {
String http = commonRepository.findOne(19).getValue(); String http = fileUrl;
String[] split = http.split("://"); String[] split = http.split("://");
// 上传文件路径 // 上传文件路径
// String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath"; // String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath";
@ -148,11 +150,11 @@ public class AliFileUploadController {
ossClient.putObject(commonRepository.findOne(71).getValue(), completePath, inputStream); ossClient.putObject(commonRepository.findOne(71).getValue(), completePath, inputStream);
// 关闭OSSClient // 关闭OSSClient
ossClient.shutdown(); ossClient.shutdown();
url = commonRepository.findOne(19).getValue()+"/img/"+completePath; url = fileUrl+"/img/"+completePath;
}else{ }else{
try try
{ {
String http = commonRepository.findOne(19).getValue(); String http = fileUrl;
String[] split = http.split("://"); String[] split = http.split("://");
// 上传文件路径 // 上传文件路径
// String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath"; // String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath";

View file

@ -5,6 +5,7 @@ import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.File;
@ -32,6 +33,9 @@ public class FileUploadUtils
private static CommonInfoService commonRepository; private static CommonInfoService commonRepository;
@Value("${file.upload.url}")
public static String fileUrl = "";
@Autowired @Autowired
public void setCommonRepository(CommonInfoService commonRepository) { public void setCommonRepository(CommonInfoService commonRepository) {
FileUploadUtils.commonRepository = commonRepository; FileUploadUtils.commonRepository = commonRepository;
@ -39,7 +43,7 @@ public class FileUploadUtils
public static String getDefaultBaseDir() public static String getDefaultBaseDir()
{ {
return commonRepository.findOne(19).getValue(); return fileUrl;
} }
/** /**

View file

@ -61,6 +61,7 @@ import jodd.util.StringUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -85,6 +86,8 @@ public class WxServiceImpl implements WxService {
private static final String TRADE_TYPE_JSAPI = "JSAPI"; private static final String TRADE_TYPE_JSAPI = "JSAPI";
private static final String Wap = "MWEB"; private static final String Wap = "MWEB";
@Value("${file.upload.url}")
public static String fileUrl = "";
@Autowired @Autowired
private CommonInfoService commonInfoService; private CommonInfoService commonInfoService;
@ -1076,8 +1079,8 @@ public class WxServiceImpl implements WxService {
@Override @Override
public boolean refund(String ordersNo) { public boolean refund(String ordersNo) {
WXConfigUtil config = null; WXConfigUtil config = null;
String h5Url = commonInfoService.findOne(19).getValue().split("://")[1]; // String h5Url = commonInfoService.findOne(19).getValue().split("://")[1];
String filePath = "/www/wwwroot/" + h5Url + "/service/apiclient_cert.p12"; String filePath = fileUrl + "/service/apiclient_cert.p12";
try { try {
config = new WXConfigUtil(filePath); config = new WXConfigUtil(filePath);
} catch (Exception e) { } catch (Exception e) {

View file

@ -35,3 +35,4 @@ spring:
file: file:
upload: upload:
path: /mnt/file/ path: /mnt/file/
url: 127.0.0.1:8080/file/

View file

@ -35,3 +35,4 @@ spring:
file: file:
upload: upload:
path: /mnt/file/ path: /mnt/file/
url: 127.0.0.1:8080/file/

View file

@ -35,3 +35,4 @@ spring:
file: file:
upload: upload:
path: /mnt/file/ path: /mnt/file/
url: 127.0.0.1:8080/file/