Commit 85d4eb5e by 水库浪子

修改群发相关BUG

1 parent 407f5b4f
...@@ -9,6 +9,7 @@ import com.linkwechat.common.core.domain.FileVo; ...@@ -9,6 +9,7 @@ import com.linkwechat.common.core.domain.FileVo;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.file.FileUploadUtils; import com.linkwechat.common.utils.file.FileUploadUtils;
import com.linkwechat.common.utils.file.FileUtils; import com.linkwechat.common.utils.file.FileUtils;
import com.linkwechat.common.utils.file.MimeTypeUtils;
import com.linkwechat.framework.web.domain.server.SysFile; import com.linkwechat.framework.web.domain.server.SysFile;
import com.linkwechat.framework.web.service.FileService; import com.linkwechat.framework.web.service.FileService;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -120,8 +121,9 @@ public class CommonController { ...@@ -120,8 +121,9 @@ public class CommonController {
* 通用上传请求 * 通用上传请求
*/ */
@PostMapping("/common/uploadFile2Cos") @PostMapping("/common/uploadFile2Cos")
public AjaxResult uploadFile2Cos(MultipartFile file) throws Exception { public AjaxResult uploadFile2Cos(MultipartFile file){
try { try {
SysFile sysFile SysFile sysFile
= fileService.upload(file); = fileService.upload(file);
return AjaxResult.success( return AjaxResult.success(
...@@ -131,7 +133,7 @@ public class CommonController { ...@@ -131,7 +133,7 @@ public class CommonController {
.build() .build()
); );
} catch (Exception e) { } catch (Exception e) {
return AjaxResult.error(e.getMessage()); return AjaxResult.error("不支持当前文件上传或文件过大建议传20MB以内的文件");
} }
} }
......
...@@ -6,6 +6,7 @@ import com.linkwechat.common.config.RuoYiConfig; ...@@ -6,6 +6,7 @@ import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.utils.OsUtils; import com.linkwechat.common.utils.OsUtils;
import com.linkwechat.common.utils.file.FileUploadUtils; import com.linkwechat.common.utils.file.FileUploadUtils;
import com.linkwechat.common.utils.file.FileUtils; import com.linkwechat.common.utils.file.FileUtils;
import com.linkwechat.common.utils.file.MimeTypeUtils;
import com.linkwechat.framework.web.domain.server.SysFile; import com.linkwechat.framework.web.domain.server.SysFile;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -42,25 +43,35 @@ public class FileService { ...@@ -42,25 +43,35 @@ public class FileService {
* @return * @return
* @throws IOException * @throws IOException
*/ */
public SysFile upload(MultipartFile file) throws IOException { public SysFile upload(MultipartFile file) throws Exception {
String fileName="";
String imgUrlPrefix=""; try {
if(ruoYiConfig.getFile().isStartCosUpload()){//开启云上传 FileUploadUtils.assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
//开启云上传开关则云上传,不然上传本地 String fileName="";
fileName = FileUploadUtils.upload2Cos(file, ruoYiConfig.getFile().getCos()); String imgUrlPrefix="";
imgUrlPrefix = ruoYiConfig.getFile().getCos().getCosImgUrlPrefix(); if(ruoYiConfig.getFile().isStartCosUpload()){//开启云上传
}else {//本地上传 //开启云上传开关则云上传,不然上传本地
File osFile=OsUtils.isWindows()?new File(WINDOWSFILEPATH):new File(LINUXFILEPATH); fileName = FileUploadUtils.upload2Cos(file, ruoYiConfig.getFile().getCos());
if(!osFile.exists()){ imgUrlPrefix = ruoYiConfig.getFile().getCos().getCosImgUrlPrefix();
osFile.mkdirs(); }else {//本地上传
} File osFile=OsUtils.isWindows()?new File(WINDOWSFILEPATH):new File(LINUXFILEPATH);
fileName = FileUploadUtils.upload(osFile.getPath(), file); if(!osFile.exists()){
imgUrlPrefix = ruoYiConfig.getFile().getImgUrlPrefix(); osFile.mkdirs();
} }
return SysFile.builder() fileName = FileUploadUtils.upload(osFile.getPath(), file);
.fileName(fileName) imgUrlPrefix = ruoYiConfig.getFile().getImgUrlPrefix();
.imgUrlPrefix(imgUrlPrefix) }
.build(); return SysFile.builder()
.fileName(fileName)
.imgUrlPrefix(imgUrlPrefix)
.build();
}catch (Exception e){
throw e;
}
} }
......
...@@ -288,6 +288,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -288,6 +288,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null and userId !=''"> <if test="userId != null and userId !=''">
AND wfcr.user_id=#{userId} AND wfcr.user_id=#{userId}
</if> </if>
ORDER BY wfcr.create_time ASC limit 1
</select> </select>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
wcm.chat_type, wcm.chat_type,
wcm.setting_time, wcm.setting_time,
wcm.expect_send, wcm.expect_send,
wcm.actual_send, (SELECT count(*) FROM `we_customer_messgaeResult` wcmr where wcmr.message_id=wcm.message_id and `status`=1) as actual_send,
wcm.timed_task, wcm.timed_task,
wcm.msgid, wcm.msgid,
wcm.check_status wcm.check_status
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!