Commit a99826a7 authored by YangZhaoJun1's avatar YangZhaoJun1

缓存超时时间,上传图片权限验证

parent 9c3d1a2b
...@@ -105,7 +105,7 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -105,7 +105,7 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiOperation(value="上传图片", notes="上传任务书所需图片") @ApiOperation(value="上传图片", notes="上传任务书所需图片")
@ApiImplicitParam(name = "image", value = "图片文件", required = true, dataType = "MultipartFile") @ApiImplicitParam(name = "image", value = "图片文件", required = true, dataType = "MultipartFile")
@PreAuthorize("hasRole('ROLE_1002')") @PreAuthorize("hasAnyRole('ROLE_1002','ROLE_1001')")
@PostMapping(value = "/uploadMdFileWithoutAuth") @PostMapping(value = "/uploadMdFileWithoutAuth")
public Map<String, Object> uploadMdFile(MultipartFile image) { public Map<String, Object> uploadMdFile(MultipartFile image) {
String path = global.getMD_FILE_LOCATION(); String path = global.getMD_FILE_LOCATION();
......
...@@ -10,6 +10,7 @@ import org.rcisoft.business.tpaperchapter.dao.TPaperChapterRepository; ...@@ -10,6 +10,7 @@ import org.rcisoft.business.tpaperchapter.dao.TPaperChapterRepository;
import org.rcisoft.business.tquestion.dto.QuestionListAndNumDto; import org.rcisoft.business.tquestion.dto.QuestionListAndNumDto;
import org.rcisoft.business.tquestion.dao.TQuestionOptionsRepository; import org.rcisoft.business.tquestion.dao.TQuestionOptionsRepository;
import org.rcisoft.business.tquestion.entity.TQuestionOptions; import org.rcisoft.business.tquestion.entity.TQuestionOptions;
import org.rcisoft.common.component.Global;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.service.RcRedisService; import org.rcisoft.core.service.RcRedisService;
...@@ -70,6 +71,9 @@ public class TQuestionServiceImpl implements TQuestionService { ...@@ -70,6 +71,9 @@ public class TQuestionServiceImpl implements TQuestionService {
@Autowired @Autowired
private RcRedisService rcRedisServiceImpl; private RcRedisService rcRedisServiceImpl;
@Autowired
private Global global;
/** /**
* 保存 tQuestion * 保存 tQuestion
* @param tQuestion * @param tQuestion
...@@ -294,7 +298,9 @@ public class TQuestionServiceImpl implements TQuestionService { ...@@ -294,7 +298,9 @@ public class TQuestionServiceImpl implements TQuestionService {
questionListAndNum.setNumOfMultiSelect(tQuestionRepository.queryNumByType("2",chapterId)); questionListAndNum.setNumOfMultiSelect(tQuestionRepository.queryNumByType("2",chapterId));
questionListAndNum.setNumOfJudgment(tQuestionRepository.queryNumByType("3",chapterId)); questionListAndNum.setNumOfJudgment(tQuestionRepository.queryNumByType("3",chapterId));
//将数据放入缓存中 //将数据放入缓存中
rcRedisServiceImpl.setBytes(userId + "_" + chapterId,SerializationUtils.serializer(questionListAndNum)); rcRedisServiceImpl.setBytes(userId + "_" + chapterId,
SerializationUtils.serializer(questionListAndNum),
global.getREDIS_TIMEOUT());
return questionListAndNum; return questionListAndNum;
} }
......
...@@ -249,4 +249,8 @@ public class Global { ...@@ -249,4 +249,8 @@ public class Global {
/*openOffice安装路径*/ /*openOffice安装路径*/
@Value("${global.other.open_office_home}") @Value("${global.other.open_office_home}")
private String OPEN_OFFICE_HOME; private String OPEN_OFFICE_HOME;
/*redis缓存超时时间*/
@Value("${spring.redis.timeout}")
private Integer REDIS_TIMEOUT;
} }
...@@ -63,6 +63,7 @@ spring: ...@@ -63,6 +63,7 @@ spring:
max-wait: -1 max-wait: -1
database: 0 database: 0
password: '' password: ''
timeout: 3600
freemarker: freemarker:
charset: UTF-8 charset: UTF-8
suffix: .ftl suffix: .ftl
......
...@@ -63,6 +63,7 @@ spring: ...@@ -63,6 +63,7 @@ spring:
max-wait: -1 max-wait: -1
database: 0 database: 0
password: '' password: ''
timeout: 3600
freemarker: freemarker:
charset: UTF-8 charset: UTF-8
suffix: .ftl suffix: .ftl
......
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