Commit 0ea88c8a by 水库浪子

修改群发图片资源相关BUG

1 parent 4d655403
Showing 19 changed files with 141 additions and 120 deletions
......@@ -21,6 +21,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 通用请求处理
......@@ -124,7 +125,7 @@ public class CommonController {
= fileService.upload(file);
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", sysFile.getFileName());
ajax.put("url", sysFile.getImgUrlPrefix()+sysFile.getFileName());
ajax.put("url", sysFile.getFileName());
return ajax;
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
......@@ -133,11 +134,11 @@ public class CommonController {
/**
* 本地图片下载
* 获取图片
*/
@GetMapping("/findFile")
public void findFile(HttpServletResponse response,String fileName){
fileService.findFile(fileName,response);
@GetMapping("/common/findImage")
public void findImage(HttpServletResponse response,String fileName){
fileService.findImage(fileName,response);
}
......
......@@ -15,7 +15,10 @@ import com.linkwechat.wecom.service.IWeCustomerMessagePushService;
import com.linkwechat.wecom.service.IWeCustomerMessgaeResultService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
......@@ -33,6 +36,7 @@ public class WeCustomerMessagePushController extends BaseController {
@Autowired
@Lazy
private IWeCustomerMessagePushService weCustomerMessagePushService;
@Autowired
......@@ -50,7 +54,11 @@ public class WeCustomerMessagePushController extends BaseController {
@PostMapping(value = "add")
public AjaxResult add(@RequestBody CustomerMessagePushDto customerMessagePushDto) {
try {
SecurityContext context = SecurityContextHolder.getContext();
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
SecurityContextHolder.setContext(context);
weCustomerMessagePushService.addWeCustomerMessagePush(customerMessagePushDto);
} catch (JsonProcessingException | ParseException e) {
e.printStackTrace();
return AjaxResult.error("群发失败");
......
......@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.stream.Collectors;
......@@ -99,7 +100,9 @@ public class WeMaterialController extends BaseController {
@DeleteMapping("/{ids}")
@ApiOperation("删除素材信息")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(materialService.deleteWeMaterialByIds(ids));
materialService.deleteWeMaterialByIds(ids);
return AjaxResult.success();
}
......@@ -136,7 +139,7 @@ public class WeMaterialController extends BaseController {
//@PreAuthorize("@ss.hasPermi('wechat:material:temporaryMaterialMediaId')")
@Log(title = "获取素材media_id", businessType = BusinessType.OTHER)
@GetMapping("/temporaryMaterialMediaId")
@ApiOperation("获取素材media_id")
@ApiOperation("H5端发送获取素材media_id")
public AjaxResult temporaryMaterialMediaId(String url,String type,String name){
WeMediaDto weMediaDto = materialService.uploadTemporaryMaterial(url,
type
......@@ -145,13 +148,32 @@ public class WeMaterialController extends BaseController {
}
//@PreAuthorize("@ss.hasPermi('wechat:material:temporaryMaterialMediaId')")
@Log(title = "获取素材media_id", businessType = BusinessType.OTHER)
@PostMapping("/temporaryMaterialMediaIdForWeb")
@ApiOperation("web端发送获取素材media_id")
public AjaxResult temporaryMaterialMediaIdForWeb(@RequestBody TemporaryMaterialDto temporaryMaterialDto){
WeMediaDto weMediaDto = materialService.uploadTemporaryMaterial(temporaryMaterialDto.getUrl(),
MediaType.of( temporaryMaterialDto.getType()).get().getMediaType()
,temporaryMaterialDto.getName());
return AjaxResult.success(weMediaDto);
}
@Log(title = "上传素材图片", businessType = BusinessType.OTHER)
@PostMapping("/uploadimg")
@ApiOperation("上传素材图片")
public AjaxResult<WeMediaDto> uploadImg(MultipartFile file){
public AjaxResult<WeMediaDto> uploadImg(MultipartFile file, HttpServletRequest request){
System.out.println(request.getServerName());
WeMediaDto weMediaDto=new WeMediaDto();
// WeMediaDto weMediaDto = materialService.uploadImg(file);
// weMediaDto.setFileName(file.getResource().getFilename());
// weMediaDto.setFileName(file.getResource().getFilename()); weMaterialFileVO.getMaterialUrl()+
WeMaterialFileVO weMaterialFileVO = materialService.uploadWeMaterialFile(file, MediaType.IMAGE.getType());
weMediaDto.setFileName(weMaterialFileVO.getMaterialName());
weMediaDto.setUrl(weMaterialFileVO.getMaterialUrl()+weMaterialFileVO.getMaterialName());
......
......@@ -229,7 +229,7 @@ public class WeTaskFissionController extends BaseController {
public AjaxResult<JSONObject> upload(@RequestParam(value = "file") MultipartFile file) throws IOException {
String url = FileUploadUtils.upload2Cos(file, cosConfig);
JSONObject json = new JSONObject();
json.put("rewardImageUrl", cosConfig.getImgUrlPrefix()+url);
json.put("rewardImageUrl", cosConfig.getCosImgUrlPrefix()+url);
return AjaxResult.success(json);
}
......
......@@ -12,13 +12,20 @@ ruoyi:
# 是否开启文件云上传(使用的是腾讯云,如果开启了,则需要配置腾讯云存储相关信息;如果关闭了则文件存储再本地,需要配置本地路径)
file:
startCosUpload: true
#图片在系统中的访问前缀,图片无论是上传云端还是服务器本地,都通过本地读取资源,然后返回前端
imgUrlPrefix:
#腾讯云对象存储
cos:
#id
secretId:
#密钥
secretKey:
#地区
region:
#区块空间
bucketName:
#访问前缀
cosImgUrlPrefix:
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /app/project/pic)
#profile: /data/jenkins_home/app/project/
# 获取ip地址开关
......@@ -59,6 +66,7 @@ ruoyi:
- /wecom/community/h5/**
- /weixin/auth/**
- /wecom/material/temporaryMaterialMediaId
- /common/findImage
# 开发环境配置
server:
......@@ -86,9 +94,9 @@ path:
#H5地址路径
H5:
url:
fissionUrl:
fissionGroupUrl:
url: http://h5.linkwechat.cn/index.html
fissionUrl: http://h5.linkwechat.cn/index.html
fissionGroupUrl: http://h5.linkwechat.cn/fission.html
# Spring配置
spring:
# 资源信息
......@@ -101,7 +109,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://127.0.0.1:10179/lw-test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://127.0.0.1:10179/link-wechat?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: root
# 从库数据源
......@@ -210,14 +218,6 @@ mybatis-plus:
logic-delete-value: 1
logic-not-delete-value: 0
## MyBatis配置
#mybatis:
# # 搜索指定包别名
# typeAliasesPackage: com.linkwechat.**.domain
# # 配置mapper的扫描,找到所有的mapper.xml映射文件
# mapperLocations: classpath*:mapper/**/*Mapper.xml
# # 加载全局的配置文件
# configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件
pagehelper:
......@@ -246,8 +246,8 @@ xss:
elasticsearch:
schema: http
address:
userName:
password:
userName: "elastic"
password: "0p-0p-0p-"
connectTimeout: 10000
socketTimeout: 10000
connectionRequestTimeout: 10000
......@@ -331,5 +331,5 @@ wecome:
authorizeRedirectUrl:
weixin:
appid:
secret:
\ No newline at end of file
appid: wxa57479bcd3f15461
secret: f23f4becdcac9819f292a3754fd8f84e
\ No newline at end of file
......@@ -20,6 +20,6 @@ public class CosConfig {
private String bucketName;
private String imgUrlPrefix;
private String cosImgUrlPrefix;
}
......@@ -196,11 +196,10 @@ public class FileUploadUtils {
COSClient cosClient = new COSClient(cred, clientConfig);
// 指定要上传到 COS 上对象键
String key = "exampleobject";
ObjectMetadata objectMetadata = new ObjectMetadata();
PutObjectRequest putObjectRequest = new PutObjectRequest(cosConfig.getBucketName(), fileName,file.getInputStream(),objectMetadata);
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
log.info("{}","https://link-wechat-1251309172.cos.ap-nanjing.myqcloud.com/"+fileName);
log.info("{}",cosConfig.getCosImgUrlPrefix()+fileName);
log.info("腾讯cos上传信息:{}",new ObjectMapper().writeValueAsString(putObjectResult));
cosClient.shutdown();
......
......@@ -286,7 +286,7 @@ public class FinanceUtils {
getMediaData(sdkfileid, "", "", filePath, fileName);
CosConfig cosConfig = SpringUtils.getBean(CosConfig.class);
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
StringBuilder cosUrl = new StringBuilder(cosConfig.getImgUrlPrefix());
StringBuilder cosUrl = new StringBuilder(cosConfig.getCosImgUrlPrefix());
String cosFilePath = FileUploadUtils.upload2Cos(new FileInputStream(new File(filePath, fileName)), suffix, cosConfig);
cosUrl.append(cosFilePath);
data.put("attachment", cosUrl.toString());
......
......@@ -108,7 +108,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(ruoYiConfig.getAnonUrl()).anonymous()
// .antMatchers("/login", "/captchaImage", "/findWxQrLoginInfo", "/wxQrLogin").anonymous()
.antMatchers(
HttpMethod.GET,
"/*.html",
......@@ -116,34 +115,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/**/*.css",
"/**/*.js"
).permitAll()
// .antMatchers("/profile/**").anonymous()
// .antMatchers("/common/download**").anonymous()
// .antMatchers("/common/download/resource**").anonymous()
// .antMatchers("/common/download/url**").anonymous()
// .antMatchers("/swagger-ui.html").anonymous()
// .antMatchers("/swagger-resources/**").anonymous()
// .antMatchers("/webjars/**").anonymous()
// .antMatchers("/*/api-docs").anonymous()
// .antMatchers("/druid/**").anonymous()
// .antMatchers("/wecom/callback/**").anonymous()
//
// .antMatchers("/wecom/chat/item/list").anonymous()
// .antMatchers("/wecom/chat/collection/list").anonymous()
// .antMatchers("/wecom/chat/collection/cancleCollection").anonymous()
// .antMatchers("/wecom/chat/collection/addCollection").anonymous()
// .antMatchers("/wecom/chat/side/h5List").anonymous()
// .antMatchers("/wecom/ticket/**").anonymous()
//
// .antMatchers("/wecom/user/getUserInfo").anonymous()
// // .antMatchers("/common/uploadFile2Cos").anonymous()
//// .antMatchers("/wecom/material/temporaryMaterialMediaId").anonymous()
// .antMatchers("/wecom/portrait/**").anonymous()
// .antMatchers("/wecom/fission/poster", "/wecom/fission/*/progress/*", "/wecom/reward/getRewardByFissionId/**").anonymous()
// // 获取实际群活码和社群运营H5页面不需要登录
// .antMatchers("/wecom/groupCode/getActualCode/**").anonymous()
// .antMatchers("/wecom/community/h5/**").anonymous()
// //微信授权接口
// .antMatchers("/weixin/auth/**").anonymous()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
......
......@@ -34,8 +34,6 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
throws ServletException, IOException
{
LoginUser loginUser = tokenService.getLoginUser(request);
Enumeration<String> parameterNames = request.getParameterNames();
if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication()))
{
......
package com.linkwechat.framework.web.service;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.utils.OsUtils;
import com.linkwechat.common.utils.file.FileUploadUtils;
import com.linkwechat.common.utils.file.FileUtils;
import com.linkwechat.framework.web.domain.server.SysFile;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* 文件服务
*/
@Component
@Slf4j
public class FileService {
......@@ -59,39 +61,26 @@ public class FileService {
}
public void findFile(String fileName, HttpServletResponse rp){
String fileDownUrl="";
// if(ruoYiConfig.getFile().isStartCosUpload()) {//开启云上传
// fileDownUrl= ruoYiConfig.getFile().getImgUrlPrefix();
// }else{
fileDownUrl=OsUtils.isWindows()?WINDOWSFILEPATH+fileName:LINUXFILEPATH+fileName;
// }
File file=new File(fileDownUrl);
if (file.exists()) {
FileInputStream fis = null;
OutputStream os = null;
try {
fis = new FileInputStream(file);
os = rp.getOutputStream();
int count = 0;
byte[] buffer = new byte[1024 * 8];
while ((count = fis.read(buffer)) != -1) {
os.write(buffer, 0, count);
os.flush();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
fis.close();
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* 获取图片(本地,或者网络图片)
* @param fileName
* @param rp
*/
public void findImage(String fileName, HttpServletResponse rp){
try {
String fileDownUrl="";
rp.setContentType("image/png");
if(ruoYiConfig.getFile().isStartCosUpload()) {//开启云上传
fileDownUrl= ruoYiConfig.getFile().getCos().getCosImgUrlPrefix();
FileUtils.downloadFile(fileDownUrl+fileName,rp.getOutputStream());
}else{
fileDownUrl=OsUtils.isWindows()?WINDOWSFILEPATH+"/"+fileName:LINUXFILEPATH+"/"+fileName;
FileUtils.writeBytes(fileDownUrl,rp.getOutputStream());
}
}catch (Exception e){
log.error("图片获取异常:"+e.getMessage());
}
}
......
package com.linkwechat.framework.web.service;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import com.linkwechat.common.config.RuoYiConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
......@@ -41,6 +44,9 @@ public class TokenService
@Value("${token.expireTime}")
private int expireTime;
@Autowired
private RuoYiConfig ruoYiConfig;
protected static final long MILLIS_SECOND = 1000;
protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND;
......@@ -208,11 +214,19 @@ public class TokenService
*/
private String getToken(HttpServletRequest request)
{
String token = request.getHeader(header);
if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX))
{
token = token.replace(Constants.TOKEN_PREFIX, "");
String token = "";
//移除匿名接口中请求头的token
if(!Arrays.asList(ruoYiConfig.getAnonUrl()).contains(request.getRequestURI())){
// request.removeAttribute(header);
// request.
token = request.getHeader(header);
if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX))
{
token = token.replace(Constants.TOKEN_PREFIX, "");
}
}
return token;
}
......
......@@ -103,18 +103,18 @@ public class RyTask {
}
public void WeCustomers() {
//查询系统所有客户
List<WeCustomer> cacheList = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
if (CollectionUtils.isEmpty(cacheList)) {
List<WeCustomer> customers = weCustomerService.selectWeCustomerList(null);
redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
} else {
List<WeCustomer> customers = weCustomerService.selectWeCustomerList(null);
List<WeCustomer> weCustomers = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
if (CollectionUtils.isNotEmpty(weCustomers) && weCustomers.size() < customers.size()) {
redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
}
}
// //查询系统所有客户
// List<WeCustomer> cacheList = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
// if (CollectionUtils.isEmpty(cacheList)) {
// List<WeCustomer> customers = weCustomerService.selectWeCustomerList(null);
// redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
// } else {
// List<WeCustomer> customers = weCustomerService.selectWeCustomerList(null);
// List<WeCustomer> weCustomers = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
// if (CollectionUtils.isNotEmpty(weCustomers) && weCustomers.size() < customers.size()) {
// redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
// }
// }
}
private void setRedisCacheSeqValue(AtomicLong index) {
......
......@@ -166,7 +166,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
// 新客拉群创建的员工活码欢迎语图片(群活码图片)
String codeUrl = weGroupCodeService.selectGroupCodeUrlByEmplCodeState(state);
if (StringUtils.isNotNull(codeUrl)) {
buildWelcomeMsgImg(weWelcomeMsgBuilder, codeUrl, codeUrl.replaceAll(cosConfig.getImgUrlPrefix(), ""));
buildWelcomeMsgImg(weWelcomeMsgBuilder, codeUrl, codeUrl.replaceAll(cosConfig.getCosImgUrlPrefix(), ""));
}
// 普通员工活码欢迎语图片
else if (StringUtils.isNotEmpty(messageMap.getCategoryId())) {
......
......@@ -48,7 +48,7 @@ public interface IWeMaterialService {
* @param ids id列表
* @return {@link int}
*/
int deleteWeMaterialByIds(Long[] ids);
void deleteWeMaterialByIds(Long[] ids);
/**
* 更新素材信息
......
......@@ -21,6 +21,7 @@ import com.linkwechat.wecom.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -72,6 +73,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
@Override
@Transactional(rollbackFor = Exception.class)
@Async
public void addWeCustomerMessagePush(CustomerMessagePushDto customerMessagePushDto) throws JsonProcessingException, ParseException {
// if ((null != customerMessagePushDto.getSettingTime() && !"".equals(customerMessagePushDto.getSettingTime()))
......
......@@ -78,8 +78,9 @@ public class WeMaterialServiceImpl implements IWeMaterialService {
}
//构造返回结果
// return WeMaterialFileVO.builder().materialUrl(url).materialName(file.getOriginalFilename()).build();
return WeMaterialFileVO.builder().materialUrl(ruoYiConfig.getFile().getCos().getCosImgUrlPrefix()).materialName(FileUploadUtils.upload2Cos(file, ruoYiConfig.getFile().getCos())).build();
return WeMaterialFileVO.builder().materialUrl(ruoYiConfig.getFile().getImgUrlPrefix()).materialName(FileUploadUtils.upload2Cos(file, ruoYiConfig.getFile().getCos())).build();
// return WeMaterialFileVO.builder().materialUrl(ruoYiConfig.getFile().getCos().getCosImgUrlPrefix()+"/common/findImage?fileName=/").materialName(FileUploadUtils.upload2Cos(file, ruoYiConfig.getFile().getCos())).build();
} catch (Exception e) {
throw new WeComException(e.getMessage());
}
......@@ -99,8 +100,8 @@ public class WeMaterialServiceImpl implements IWeMaterialService {
}
@Override
public int deleteWeMaterialByIds(Long[] ids) {
return weMaterialMapper.deleteWeMaterialByIds(ids);
public void deleteWeMaterialByIds(Long[] ids) {
weMaterialMapper.deleteWeMaterialByIds(ids);
}
@Override
......
......@@ -125,6 +125,8 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
return poster.getBackgroundImgPath();
}
Set<String> existFontId = new HashSet<>();
Map<String, Font> fontMap = poster.getPosterSubassemblyList().stream().filter(wePosterSubassembly -> wePosterSubassembly.getType().equals(1))
.peek(wePosterSubassembly -> {
if (wePosterSubassembly.getFontId() == null) {
......@@ -149,17 +151,29 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
fileCallableMap = new HashMap<>();
}
fileCallableMap.put(poster.getBackgroundImgPath(), NetFileUtils.getNetFile(poster.getBackgroundImgPath()));
Map<String, BufferedImage> bufferedImageMap = fileCallableMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, stringFileCallableEntry -> {
try {
return ImageUtils.copyBufferedImage(ImageIO.read(new ByteArrayInputStream(Objects.requireNonNull(NetFileUtils.getByteArrayOutputStream(stringFileCallableEntry.getValue(), false)).toByteArray())), BufferedImage.TYPE_INT_ARGB);
return ImageUtils.copyBufferedImage(ImageIO.read(new ByteArrayInputStream(Objects.requireNonNull(NetFileUtils.getByteArrayOutputStream(stringFileCallableEntry.getValue(), false)).toByteArray())),
BufferedImage.TYPE_INT_ARGB);
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException("图片读取错误");
}
}));
BufferedImage backgroundImg = bufferedImageMap.get(poster.getBackgroundImgPath());
poster.setWidth(backgroundImg.getWidth());
poster.setHeight(backgroundImg.getHeight());
poster.getPosterSubassemblyList().forEach(wePosterSubassembly -> {
if (wePosterSubassembly.getType().equals(1)) {
Font font = fontMap.get(wePosterSubassembly.getFontId() + "_" + wePosterSubassembly.getFontSize() + "_" + wePosterSubassembly.getFontStyle());
......@@ -196,13 +210,15 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
}
});
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
ImageIO.write(backgroundImg, "png", byteArrayOutputStream);
NetFileUtils.StreamMultipartFile streamMultipartFile = new NetFileUtils.StreamMultipartFile(System.currentTimeMillis() + ".jpg", byteArrayOutputStream.toByteArray());
byteArrayOutputStream.close();
String path = FileUploadUtils.upload2Cos(streamMultipartFile, ruoYiConfig.getFile().getCos());
poster.setSampleImgPath(ruoYiConfig.getFile().getImgUrlPrefix() + path);
poster.setSampleImgPath(ruoYiConfig.getFile().getCos().getCosImgUrlPrefix() + path);
return poster.getSampleImgPath();
} catch (IOException e) {
e.printStackTrace();
......
......@@ -453,7 +453,7 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
throw new WeComException("生成二维码异常");
}
}
return cosConfig.getImgUrlPrefix() + qrCode;
return cosConfig.getCosImgUrlPrefix() + qrCode;
} else {
throw new WeComException("生成二维码异常,用户信息不存在");
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!