update 会议controller拆分
This commit is contained in:
+21
-1
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.*;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
@@ -11,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -130,7 +132,7 @@ public class CommonController {
|
||||
* @param response
|
||||
*/
|
||||
@GetMapping(value = "/download/{id}")
|
||||
public void view(@PathVariable String id,HttpServletRequest request, HttpServletResponse response) {
|
||||
public void view(@PathVariable String id,HttpServletRequest request, HttpServletResponse response,String type) {
|
||||
// 查询数据表数据是否存在
|
||||
LambdaQueryWrapper<OSSFile> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OSSFile::getId,id);
|
||||
@@ -174,6 +176,24 @@ public class CommonController {
|
||||
outputStream.write(buf, 0, len);
|
||||
}
|
||||
response.flushBuffer();
|
||||
//统计下载和上传次数
|
||||
if ("download".equals(type)) {
|
||||
Integer downloadNumber = ossFile.getDownloadNumber();
|
||||
if (downloadNumber == null) {
|
||||
ossFile.setDownloadNumber(0);
|
||||
} else {
|
||||
ossFile.setDownloadNumber(downloadNumber + 1);
|
||||
}
|
||||
ossFileService.updateAndPush(ossFile);
|
||||
} else if ("view".equals(type)) {
|
||||
Integer viewNumber = ossFile.getViewNumber();
|
||||
if (viewNumber == null) {
|
||||
ossFile.setViewNumber(0);
|
||||
} else {
|
||||
ossFile.setViewNumber(viewNumber + 1);
|
||||
}
|
||||
ossFileService.updateAndPush(ossFile);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("预览文件失败" + e.getMessage());
|
||||
response.setStatus(404);
|
||||
|
||||
Reference in New Issue
Block a user