1.add exception project for clean cache

main
Gary 5 months ago
parent 555b3afdef
commit fcd87ca353

@ -50,13 +50,21 @@ public class CMSJournalController {
@ApiOperation(value = "新增期刊", notes = "新增期刊")
@RequestMapping(value = "/add", method = RequestMethod.POST)
public Result add(@ApiParam(value = "期刊信息", required = true) @Valid @RequestBody JournalAddModel addModel){
cacheChannel.evict("default", "journal_filter");
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_PAGE);
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_COUNT);
cleanCache();
return journalService.add(addModel);
}
@ApiOperation(value = "查询期刊详情", notes = "查询期刊详情")
private void cleanCache() {
try {
cacheChannel.evict("default", "journal_filter");
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_PAGE);
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_COUNT);
}catch(Exception e) {
e.printStackTrace();
}
}
@ApiOperation(value = "查询期刊详情", notes = "查询期刊详情")
@RequestMapping(value="/{id}",method= RequestMethod.GET)
public Result<JournalRespDto> findOne(@ApiParam(value = "期刊ID", required = true) @PathVariable String id){
return journalService.findOne(id);
@ -79,13 +87,17 @@ public class CMSJournalController {
}
private void cleanCache(String id) {
cacheChannel.evict("default", "journal_filter");
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_PAGE);
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_COUNT);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_ID, id);
String journalNo=journalService.findJournalNoById(id);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_SONG_LIST, journalNo);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_NO,journalNo);
try {
cacheChannel.evict("default", "journal_filter");
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_PAGE);
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_COUNT);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_ID, id);
String journalNo=journalService.findJournalNoById(id);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_SONG_LIST, journalNo);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_NO,journalNo);
}catch(Exception e) {
e.printStackTrace();
}
}
@ApiOperation(value = "更新期刊启停状态", notes = "更新期刊启停状态")

Loading…
Cancel
Save