记得上下班打卡 | git大法好,push需谨慎

Commit 3c5b3793 authored by 胡佳晨's avatar 胡佳晨

sweet redis相关 提交

parent 976b55ae
......@@ -5,6 +5,12 @@ package com.liquidnet.service.sweet.constant;
*/
public class SweetConstant {
public final static String REDIS_KEY_SWEET_MANUAL_PUSH_LIST="sweet:manual:pushList";
public final static String REDIS_KEY_SWEET_MANUAL_TIME_LIST="sweet:manual:timeList:manual:";
public final static String REDIS_KEY_SWEET_MANUAL_NOTIFY_LIST="sweet:manual:notify:manual:";
public final static String REDIS_KEY_SWEET_MANUAL_RICH_TEXT="sweet:manual:richText:manual:";
public final static String REDIS_KEY_SWEET_MANUAL_SORT="sweet:manual:sort:manual:";
public enum ManualPosition {
POSITION_1("艺人"),
POSITION_2("签售时间"),
......
......@@ -77,6 +77,7 @@ public class SweetManualArtistsController {
@ApiOperation("宣传手册艺人修改")
@ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "manualRelationId", value = "手册艺人id", required = true),
@ApiImplicitParam(type = "query", dataType = "String", name = "manualId", value = "手册id", required = true),
@ApiImplicitParam(type = "query", dataType = "String", name = "artistId", value = "艺人id", required = true),
@ApiImplicitParam(type = "query", dataType = "String", name = "stageId", value = "场地id", required = true),
@ApiImplicitParam(type = "query", dataType = "String", name = "performanceStart", value = "演出开始时间", required = false),
......@@ -85,21 +86,24 @@ public class SweetManualArtistsController {
@ApiImplicitParam(type = "query", dataType = "String", name = "signatureEnd", value = "签售结束时间", required = false),
})
public ResponseDto<Boolean> change(@RequestParam(defaultValue = "1") String manualRelationId,
@RequestParam(defaultValue = "1") String manualId,
@RequestParam(defaultValue = "10") String artistId,
@RequestParam(defaultValue = "") String stageId,
@RequestParam(defaultValue = "", required = false) String performanceStart,
@RequestParam(defaultValue = "", required = false) String performanceEnd,
@RequestParam(defaultValue = "", required = false) String signatureStart,
@RequestParam(defaultValue = "", required = false) String signatureEnd) {
return sweetManualArtistsService.change(manualRelationId, artistId, stageId, performanceStart, performanceEnd, signatureStart, signatureEnd);
return sweetManualArtistsService.change(manualRelationId, manualId, artistId, stageId, performanceStart, performanceEnd, signatureStart, signatureEnd);
}
@DeleteMapping("delete")
@ApiOperation("宣传手册艺人删除")
@ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "manualRelationId", value = "手册艺人id", required = true)
@ApiImplicitParam(type = "query", dataType = "String", name = "manualRelationId", value = "手册艺人id", required = true),
@ApiImplicitParam(type = "query", dataType = "String", name = "manualId", value = "手册id", required = true)
})
public ResponseDto<Boolean> delete(@RequestParam(defaultValue = "1") String manualRelationId) {
return sweetManualArtistsService.delete(manualRelationId);
public ResponseDto<Boolean> delete(@RequestParam(defaultValue = "1") String manualRelationId,
@RequestParam(defaultValue = "1") String manualId) {
return sweetManualArtistsService.delete(manualRelationId, manualId);
}
}
......@@ -41,7 +41,7 @@ public class SweetManualNotifyController {
})
public ResponseDto<PageInfo<SweetManualNotify>> getList(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(defaultValue = "标题",required = false) String name,
@RequestParam(defaultValue = "标题", required = false) String name,
@RequestParam(defaultValue = "手册id") String manualId) {
return sweetManualNotifyService.getList(page, size, name, manualId);
}
......@@ -72,13 +72,15 @@ public class SweetManualNotifyController {
@ApiOperation("修改通知")
@ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "manualId", value = "手册id", required = true),
@ApiImplicitParam(type = "query", dataType = "String", name = "manualNotifyId", value = "通知id", required = true),
@ApiImplicitParam(type = "query", dataType = "String", name = "title", value = "标题", required = true),
@ApiImplicitParam(type = "query", dataType = "String", name = "content", value = "内容", required = true),
})
public ResponseDto<Boolean> change(@RequestParam(defaultValue = "") String manualId,
@RequestParam(defaultValue = "") String manualNotifyId,
@RequestParam(defaultValue = "标题") String title,
@RequestParam(defaultValue = "内容") String content) {
return sweetManualNotifyService.change(manualId, title, content);
return sweetManualNotifyService.change(manualId, manualNotifyId, title, content);
}
@DeleteMapping("delete")
......
......@@ -9,7 +9,9 @@ import java.util.ArrayList;
public class SweetManualArtistListDto implements Serializable {
private String manualRelationId;
private String artistId;
private String name;
private String stageId;
private String title;
private String performanceStart;
private String performanceEnd;
......
......@@ -24,8 +24,8 @@ public interface ISweetManualArtistsService extends IService<SweetManualArtists>
ResponseDto<SweetManualArtistListDto> details(String manualRelationId);
ResponseDto<Boolean> change(String manualRelationId,String artistId, String stageId,String performanceStart,String performanceEnd,String signatureStart,String signatureEnd);
ResponseDto<Boolean> change(String manualRelationId,String manualId,String artistId, String stageId,String performanceStart,String performanceEnd,String signatureStart,String signatureEnd);
ResponseDto<Boolean> delete(String manualRelationId);
ResponseDto<Boolean> delete(String manualRelationId,String manualId);
}
......@@ -24,7 +24,7 @@ public interface ISweetManualNotifyService extends IService<SweetManualNotify> {
ResponseDto<SweetManualNotify> details(String manualId);
ResponseDto<Boolean> change(String manualId, String title, String content);
ResponseDto<Boolean> change(String manualId,String manualNotifyId, String title, String content);
ResponseDto<Boolean> delete(String manualId);
}
......@@ -5,12 +5,18 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.dto.SweetManualArtistList2Dto;
import com.liquidnet.service.sweet.dto.SweetManualArtistListDto;
import com.liquidnet.service.sweet.dto.SweetManualArtistStageListDto;
import com.liquidnet.service.sweet.entity.SweetArtists;
import com.liquidnet.service.sweet.entity.SweetManualArtists;
import com.liquidnet.service.sweet.entity.SweetStage;
import com.liquidnet.service.sweet.mapper.SweetArtistsMapper;
import com.liquidnet.service.sweet.mapper.SweetManualArtistsMapper;
import com.liquidnet.service.sweet.mapper.SweetStageMapper;
import com.liquidnet.service.sweet.service.ISweetArtistsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.service.sweet.utils.RedisDataUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -30,6 +36,10 @@ public class SweetArtistsServiceImpl extends ServiceImpl<SweetArtistsMapper, Swe
@Autowired
private SweetArtistsMapper sweetArtistsMapper;
@Autowired
private SweetManualArtistsMapper sweetManualArtistsMapper;
@Autowired
private RedisDataUtils redisDataUtils;
@Override
public ResponseDto<PageInfo<SweetArtists>> getList(int page, int size, String name) {
......@@ -80,6 +90,11 @@ public class SweetArtistsServiceImpl extends ServiceImpl<SweetArtistsMapper, Swe
sweetArtists.setDescribes(describe);
sweetArtists.setUpdatdAt(LocalDateTime.now());
sweetArtistsMapper.update(sweetArtists, Wrappers.lambdaUpdate(SweetArtists.class).eq(SweetArtists::getArtistsId, artistsId));
List<SweetManualArtists> data = sweetManualArtistsMapper.selectList(Wrappers.lambdaQuery(SweetManualArtists.class).eq(SweetManualArtists::getArtistsId, artistsId));
for (SweetManualArtists item : data) {
redisDataUtils.deleteTimeListRedisData(item.getManualId());
}
return ResponseDto.success();
} catch (Exception e) {
return ResponseDto.failure();
......
......@@ -13,6 +13,7 @@ import com.liquidnet.service.sweet.entity.SweetManualNotify;
import com.liquidnet.service.sweet.mapper.SweetManualArtistsMapper;
import com.liquidnet.service.sweet.service.ISweetManualArtistsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.service.sweet.utils.RedisDataUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -33,6 +34,8 @@ public class SweetManualArtistsServiceImpl extends ServiceImpl<SweetManualArtist
@Autowired
private SweetManualArtistsMapper sweetManualArtistsMapper;
@Autowired
private RedisDataUtils redisDataUtils;
@Override
public ResponseDto<PageInfo<SweetManualArtistListDto>> getList(Integer page, Integer size, String manualId) {
......@@ -64,6 +67,8 @@ public class SweetManualArtistsServiceImpl extends ServiceImpl<SweetManualArtist
sweetManualNotify.setSignatureEnd(signatureEnd != null ? DateUtil.Formatter.yyyyMMddHHmmss.parse(signatureEnd) : null);
sweetManualNotify.setCreatedAt(LocalDateTime.now());
sweetManualArtistsMapper.insert(sweetManualNotify);
redisDataUtils.deleteTimeListRedisData(manualId);
return ResponseDto.success();
} catch (Exception e) {
return ResponseDto.failure();
......@@ -84,10 +89,9 @@ public class SweetManualArtistsServiceImpl extends ServiceImpl<SweetManualArtist
}
@Override
public ResponseDto<Boolean> change(String manualRelationId, String artistId, String stageId, String performanceStart, String performanceEnd, String signatureStart, String signatureEnd) {
public ResponseDto<Boolean> change(String manualRelationId, String manualId, String artistId, String stageId, String performanceStart, String performanceEnd, String signatureStart, String signatureEnd) {
try {
SweetManualArtists sweetManualNotify = new SweetManualArtists();
sweetManualNotify.setManualRelationId(IDGenerator.nextSnowId());
sweetManualNotify.setStageId(stageId);
sweetManualNotify.setArtistsId(artistId);
sweetManualNotify.setPerformanceEnd(DateUtil.Formatter.yyyyMMddHHmmss.parse(performanceEnd));
......@@ -96,6 +100,8 @@ public class SweetManualArtistsServiceImpl extends ServiceImpl<SweetManualArtist
sweetManualNotify.setSignatureEnd(DateUtil.Formatter.yyyyMMddHHmmss.parse(signatureEnd));
sweetManualNotify.setUpdatedAt(LocalDateTime.now());
sweetManualArtistsMapper.update(sweetManualNotify, Wrappers.lambdaUpdate(SweetManualArtists.class).eq(SweetManualArtists::getManualRelationId, manualRelationId));
redisDataUtils.deleteTimeListRedisData(manualId);
return ResponseDto.success();
} catch (Exception e) {
return ResponseDto.failure();
......@@ -103,13 +109,16 @@ public class SweetManualArtistsServiceImpl extends ServiceImpl<SweetManualArtist
}
@Override
public ResponseDto<Boolean> delete(String manualRelationId) {
public ResponseDto<Boolean> delete(String manualRelationId, String manualId) {
try {
SweetManualArtists sweetManualNotify = new SweetManualArtists();
sweetManualNotify.setManualRelationId(IDGenerator.nextSnowId());
sweetManualNotify.setStatus(0);
sweetManualNotify.setUpdatedAt(LocalDateTime.now());
sweetManualArtistsMapper.update(sweetManualNotify, Wrappers.lambdaUpdate(SweetManualArtists.class).eq(SweetManualArtists::getManualRelationId, manualRelationId));
redisDataUtils.deleteTimeListRedisData(manualId);
return ResponseDto.success();
} catch (Exception e) {
return ResponseDto.failure();
......
......@@ -10,6 +10,7 @@ import com.liquidnet.service.sweet.entity.SweetManualNotify;
import com.liquidnet.service.sweet.mapper.SweetManualNotifyMapper;
import com.liquidnet.service.sweet.service.ISweetManualNotifyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.service.sweet.utils.RedisDataUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -29,13 +30,15 @@ public class SweetManualNotifyServiceImpl extends ServiceImpl<SweetManualNotifyM
@Autowired
private SweetManualNotifyMapper sweetManualNotifyMapper;
@Autowired
private RedisDataUtils redisDataUtils;
@Override
public ResponseDto<PageInfo<SweetManualNotify>> getList(Integer page, Integer size, String title,String manualId) {
public ResponseDto<PageInfo<SweetManualNotify>> getList(Integer page, Integer size, String title, String manualId) {
PageInfo<SweetManualNotify> pageInfo = null;
try {
PageHelper.startPage(page, size);
List<SweetManualNotify> data = sweetManualNotifyMapper.selectList(Wrappers.lambdaQuery(SweetManualNotify.class).like(SweetManualNotify::getTitle, title).eq(SweetManualNotify::getManualId,manualId).eq(SweetManualNotify::getStatus, 1));
List<SweetManualNotify> data = sweetManualNotifyMapper.selectList(Wrappers.lambdaQuery(SweetManualNotify.class).like(SweetManualNotify::getTitle, title).eq(SweetManualNotify::getManualId, manualId).eq(SweetManualNotify::getStatus, 1));
pageInfo = new PageInfo(data);
return ResponseDto.success(pageInfo);
} catch (Exception e) {
......@@ -44,7 +47,7 @@ public class SweetManualNotifyServiceImpl extends ServiceImpl<SweetManualNotifyM
}
@Override
public ResponseDto<Boolean> add(String manualId,String title, String content) {
public ResponseDto<Boolean> add(String manualId, String title, String content) {
try {
SweetManualNotify sweetManualNotify = new SweetManualNotify();
sweetManualNotify.setManualNotifyId(IDGenerator.nextSnowId());
......@@ -53,6 +56,11 @@ public class SweetManualNotifyServiceImpl extends ServiceImpl<SweetManualNotifyM
sweetManualNotify.setContent(content);
sweetManualNotify.setCreatedAt(LocalDateTime.now());
sweetManualNotifyMapper.insert(sweetManualNotify);
List<SweetManualNotify> oldData = redisDataUtils.getNotifyRedisData(manualId);
oldData.add(sweetManualNotify);
redisDataUtils.setNotifyRedisData(manualId, oldData);
return ResponseDto.success();
} catch (Exception e) {
return ResponseDto.failure();
......@@ -69,13 +77,24 @@ public class SweetManualNotifyServiceImpl extends ServiceImpl<SweetManualNotifyM
}
@Override
public ResponseDto<Boolean> change(String manualId, String title, String content) {
public ResponseDto<Boolean> change(String manualId,String manualNotifyId, String title, String content) {
try {
SweetManualNotify sweetManualNotify = new SweetManualNotify();
sweetManualNotify.setTitle(title);
sweetManualNotify.setContent(content);
sweetManualNotify.setUpdatedAt(LocalDateTime.now());
sweetManualNotifyMapper.update(sweetManualNotify, Wrappers.lambdaUpdate(SweetManualNotify.class).eq(SweetManualNotify::getManualId, manualId));
sweetManualNotifyMapper.update(sweetManualNotify, Wrappers.lambdaUpdate(SweetManualNotify.class).eq(SweetManualNotify::getManualNotifyId, manualNotifyId));
List<SweetManualNotify> oldData = redisDataUtils.getNotifyRedisData(manualId);
for (SweetManualNotify item:oldData){
if(item.getManualNotifyId().equalsIgnoreCase(manualNotifyId)){
item.setTitle(title);
item.setContent(content);
item.setUpdatedAt(LocalDateTime.now());
}
}
redisDataUtils.setNotifyRedisData(manualId, oldData);
return ResponseDto.success();
} catch (Exception e) {
return ResponseDto.failure();
......
......@@ -15,6 +15,7 @@ import com.liquidnet.service.sweet.mapper.SweetManualMapper;
import com.liquidnet.service.sweet.mapper.SweetStageMapper;
import com.liquidnet.service.sweet.service.ISweetManualService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.service.sweet.utils.RedisDataUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -35,6 +36,8 @@ public class SweetManualServiceImpl extends ServiceImpl<SweetManualMapper, Sweet
@Autowired
private SweetManualMapper sweetManualMapper;
@Autowired
private RedisDataUtils redisDataUtils;
@Override
public ResponseDto<PageInfo<SweetManualDto>> getManualList(int page, int size, String name) {
......@@ -84,6 +87,7 @@ public class SweetManualServiceImpl extends ServiceImpl<SweetManualMapper, Sweet
} catch (Exception e) {
return ResponseDto.failure();
}
redisDataUtils.deletePushListRedisData();
return ResponseDto.success();
}
......@@ -97,6 +101,7 @@ public class SweetManualServiceImpl extends ServiceImpl<SweetManualMapper, Sweet
} catch (Exception e) {
return ResponseDto.failure();
}
redisDataUtils.deletePushListRedisData();
return ResponseDto.success();
}
}
......@@ -7,6 +7,7 @@ import com.liquidnet.service.sweet.entity.SweetManualSort;
import com.liquidnet.service.sweet.mapper.SweetManualSortMapper;
import com.liquidnet.service.sweet.service.ISweetManualSortService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.service.sweet.utils.RedisDataUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -25,6 +26,8 @@ public class SweetManualSortServiceImpl extends ServiceImpl<SweetManualSortMappe
@Autowired
private SweetManualSortMapper sweetManualSortMapper;
@Autowired
private RedisDataUtils redisDataUtils;
@Override
public ResponseDto<SweetManualSort> get(String manualId) {
......@@ -52,6 +55,7 @@ public class SweetManualSortServiceImpl extends ServiceImpl<SweetManualSortMappe
sweetManualSort.setCreatedAt(LocalDateTime.now());
sweetManualSortMapper.insert(sweetManualSort);
}
redisDataUtils.deleteSortRedisData(manualId);
} catch (Exception e) {
return ResponseDto.failure();
}
......
......@@ -8,6 +8,7 @@ import com.liquidnet.service.sweet.entity.SweetRichtext;
import com.liquidnet.service.sweet.mapper.SweetRichtextMapper;
import com.liquidnet.service.sweet.service.ISweetRichtextService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.service.sweet.utils.RedisDataUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -26,6 +27,8 @@ public class SweetRichtextServiceImpl extends ServiceImpl<SweetRichtextMapper, S
@Autowired
private SweetRichtextMapper sweetRichtextMapper;
@Autowired
private RedisDataUtils redisDataUtils;
@Override
public ResponseDto<SweetRichtext> get(String manualId, Integer type) {
......@@ -74,6 +77,8 @@ public class SweetRichtextServiceImpl extends ServiceImpl<SweetRichtextMapper, S
sweetRichtext.setType(type);
sweetRichtext.setCreatedAt(LocalDateTime.now());
sweetRichtextMapper.update(sweetRichtext, Wrappers.lambdaUpdate(SweetRichtext.class).eq(SweetRichtext::getManualId, manualId).eq(SweetRichtext::getType, type));
redisDataUtils.setRichTextRedisData(manualId,type.toString(),sweetRichtext);
} catch (Exception e) {
return ResponseDto.failure();
}
......
......@@ -6,10 +6,13 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.entity.SweetManualArtists;
import com.liquidnet.service.sweet.entity.SweetStage;
import com.liquidnet.service.sweet.mapper.SweetManualArtistsMapper;
import com.liquidnet.service.sweet.mapper.SweetStageMapper;
import com.liquidnet.service.sweet.service.ISweetStageService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.service.sweet.utils.RedisDataUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -30,13 +33,17 @@ public class SweetStageServiceImpl extends ServiceImpl<SweetStageMapper, SweetSt
@Autowired
private SweetStageMapper sweetStageMapper;
@Autowired
private SweetManualArtistsMapper sweetManualArtistsMapper;
@Autowired
private RedisDataUtils redisDataUtils;
@Override
public ResponseDto<PageInfo<SweetStage>> getList(int page, int size,String title) {
public ResponseDto<PageInfo<SweetStage>> getList(int page, int size, String title) {
PageInfo<SweetStage> pageInfo = null;
try {
PageHelper.startPage(page, size);
List<SweetStage> data = sweetStageMapper.selectList(Wrappers.lambdaQuery(SweetStage.class).like(SweetStage::getTitle,title));
List<SweetStage> data = sweetStageMapper.selectList(Wrappers.lambdaQuery(SweetStage.class).like(SweetStage::getTitle, title));
pageInfo = new PageInfo(data);
return ResponseDto.success(pageInfo);
} catch (Exception e) {
......@@ -74,6 +81,12 @@ public class SweetStageServiceImpl extends ServiceImpl<SweetStageMapper, SweetSt
sweetStage.setTitle(name);
sweetStage.setUpdatedAt(LocalDateTime.now());
sweetStageMapper.update(sweetStage, Wrappers.lambdaUpdate(SweetStage.class).eq(SweetStage::getStageId, stageId));
List<SweetManualArtists> data = sweetManualArtistsMapper.selectList(Wrappers.lambdaQuery(SweetManualArtists.class).eq(SweetManualArtists::getStageId, stageId));
for (SweetManualArtists item : data) {
redisDataUtils.deleteTimeListRedisData(item.getManualId());
}
return ResponseDto.success();
} catch (Exception e) {
return ResponseDto.failure();
......
......@@ -39,7 +39,7 @@ public class RedisDataUtils {
public List<SweetManualAppletDto> setPushList() {
String redisKey = "";
String redisKey = SweetConstant.REDIS_KEY_SWEET_MANUAL_PUSH_LIST;
List<SweetManualAppletDto> data = sweetManualMapper.getManualAppletDto();
for (SweetManualAppletDto item : data) {
item.setFieldName((String) redisUtil.hget("kylin:fields:id" + ":" + item.getFieldId(), "name"));
......@@ -50,8 +50,9 @@ public class RedisDataUtils {
return data;
}
//获取电子手册列表 (城市)
public List<SweetManualAppletDto> getPushList() {
String redisKey = "";
String redisKey = SweetConstant.REDIS_KEY_SWEET_MANUAL_PUSH_LIST;
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return setPushList();
......@@ -60,6 +61,7 @@ public class RedisDataUtils {
}
}
//获取电子手册演出详情
public SweetManualAppletDto getAppletPerformance(String manualId) {
List<SweetManualAppletDto> data = getPushList();
SweetManualAppletDto returnData = new SweetManualAppletDto();
......@@ -72,8 +74,8 @@ public class RedisDataUtils {
return returnData;
}
public SweetManualArtistList2Dto setTimeList(String manualId, String dateTime) {
String redisKey = "".concat(manualId).concat(dateTime);
public SweetManualArtistList2Dto setTimeList(String manualId,String content) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_MANUAL_TIME_LIST.concat(manualId);
HashMap<String, Object> map = new HashMap<>();
map.put("manualId", manualId);
List<SweetManualArtistListDto> data = sweetManualArtistsMapper.getManualList(map);
......@@ -99,35 +101,42 @@ public class RedisDataUtils {
return returnData;
}
public SweetManualArtistList2Dto getTimeList(String manualId, String dateTime) {
String redisKey = "".concat(manualId).concat(dateTime);
//获取时间表
public SweetManualArtistList2Dto getTimeList(String manualId) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_MANUAL_TIME_LIST.concat(manualId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return setTimeList(manualId, dateTime);
return setTimeList(manualId,null);
} else {
return (SweetManualArtistList2Dto) obj;
}
}
public SweetRichtext setRichTextRedisData(String manualId, String type) {
String redisKey = "".concat(manualId).concat(type);
SweetRichtext sweetRichtext = sweetRichtextMapper.selectOne(Wrappers.lambdaQuery(SweetRichtext.class).eq(SweetRichtext::getManualId, manualId).eq(SweetRichtext::getType, type));
public SweetRichtext setRichTextRedisData(String manualId, String type,SweetRichtext content) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_MANUAL_RICH_TEXT.concat(manualId).concat(":type:"+type);
SweetRichtext sweetRichtext;
if(content!=null){
sweetRichtext = content;
}else{
sweetRichtext = sweetRichtextMapper.selectOne(Wrappers.lambdaQuery(SweetRichtext.class).eq(SweetRichtext::getManualId, manualId).eq(SweetRichtext::getType, type));
}
redisUtil.set(redisKey, sweetRichtext);
return sweetRichtext;
}
//获取富文本详情
public SweetRichtext getRichTextRedisData(String manualId, String type) {
String redisKey = "".concat(manualId).concat(type);
String redisKey = SweetConstant.REDIS_KEY_SWEET_MANUAL_RICH_TEXT.concat(manualId).concat(":type:"+type);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return setRichTextRedisData(manualId, type);
return setRichTextRedisData(manualId, type,null);
} else {
return (SweetRichtext) obj;
}
}
public List<String> setTagRedisData(String manualId) {
String redisKey = "".concat(manualId);
String redisKey = SweetConstant.REDIS_KEY_SWEET_MANUAL_SORT.concat(manualId);
SweetManualSort data = sweetManualSortMapper.selectOne(Wrappers.lambdaQuery(SweetManualSort.class).eq(SweetManualSort::getManualId, manualId));
String[] arrays = data.getShowPosition().split(",");
List<String> returnData = new ArrayList<>();
......@@ -138,8 +147,9 @@ public class RedisDataUtils {
return returnData;
}
//获取显示的标签
public List<String> getTagRedisData(String manualId) {
String redisKey = "".concat(manualId);
String redisKey = SweetConstant.REDIS_KEY_SWEET_MANUAL_SORT.concat(manualId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return setTagRedisData(manualId);
......@@ -148,21 +158,38 @@ public class RedisDataUtils {
}
}
public List<SweetManualNotify> setNotifyRedisData(String manualId) {
String redisKey = "".concat(manualId);
List<SweetManualNotify> data = sweetManualNotifyMapper.selectList(Wrappers.lambdaQuery(SweetManualNotify.class).eq(SweetManualNotify::getManualId, manualId).eq(SweetManualNotify::getStatus, 1));
public List<SweetManualNotify> setNotifyRedisData(String manualId, List<SweetManualNotify> content) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_MANUAL_NOTIFY_LIST.concat(manualId);
List<SweetManualNotify> data;
if (content != null) {
data = content;
} else {
data = sweetManualNotifyMapper.selectList(Wrappers.lambdaQuery(SweetManualNotify.class).eq(SweetManualNotify::getManualId, manualId).eq(SweetManualNotify::getStatus, 1));
}
redisUtil.set(redisKey, data);
return data;
}
//获取通知
public List<SweetManualNotify> getNotifyRedisData(String manualId) {
String redisKey = "".concat(manualId);
String redisKey = SweetConstant.REDIS_KEY_SWEET_MANUAL_NOTIFY_LIST.concat(manualId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return setNotifyRedisData(manualId);
return setNotifyRedisData(manualId, null);
} else {
return (List<SweetManualNotify>) obj;
}
}
public void deletePushListRedisData() {
redisUtil.del(SweetConstant.REDIS_KEY_SWEET_MANUAL_PUSH_LIST);//列表
}
public void deleteTimeListRedisData(String manualId) {
redisUtil.del(SweetConstant.REDIS_KEY_SWEET_MANUAL_TIME_LIST.concat(manualId));//列表
}
public void deleteSortRedisData(String manualId) {
redisUtil.del(SweetConstant.REDIS_KEY_SWEET_MANUAL_SORT.concat(manualId));//列表
}
}
......@@ -4,7 +4,9 @@
<resultMap id="getManualListResult" type="com.liquidnet.service.sweet.dto.SweetManualArtistListDto">
<result column="manual_relation_id" property="manualRelationId"/>
<result column="artists_id" property="artistId"/>
<result column="name" property="name"/>
<result column="stage_id" property="stageId"/>
<result column="title" property="title"/>
<result column="performance_start" property="performanceStart"/>
<result column="performance_end" property="performanceEnd"/>
......@@ -18,7 +20,9 @@
<select id="getManualList" parameterType="java.util.Map" resultMap="getManualListResult">
select manual_relation_id,
sa.`artists_id`,
sa.`name`,
ss.stage_id,
ss.title,
performance_start,
performance_end,
......
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