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

Commit 34541450 authored by jiangxiulong's avatar jiangxiulong

增加投票的城市名称

parent 2ffb208a
......@@ -48,14 +48,15 @@ public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, S
@Override
public ResponseDto getList(String phone, String unionId) {
List<SweetCItyVoteStatVo> sweetCityVoteStatList = redisDataUtils.getSweetCityVoteStatList();
String userVote = redisDataUtils.getUserVote(phone, unionId);
SweetCityVoteParam userVote = redisDataUtils.getUserVote(phone, unionId);
String cityCode = userVote.getCityCode();
for (SweetCItyVoteStatVo info : sweetCityVoteStatList) {
if (userVote.isEmpty()) {
if (null == userVote) {
info.setIsVote(1);
} else if (!userVote.equals(info.getCityCode())) {
info.setIsVote(3);
} else {
} else if (cityCode.equals(info.getCityCode())) {
info.setIsVote(2);
} else {
info.setIsVote(3);
}
}
HashMap<String, Object> stringObjectHashMap = CollectionUtil.mapStringObject();
......@@ -68,8 +69,8 @@ public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, S
@Override
public ResponseDto createVote(SweetCityVoteParam param) {
String userVote = redisDataUtils.getUserVote(param.getPhone(), param.getUnionId());
if (!userVote.isEmpty()) {
SweetCityVoteParam userVote = redisDataUtils.getUserVote(param.getPhone(), param.getUnionId());
if (null != userVote) {
return ResponseDto.failure("已经投过票啦~");
}
SweetCityVote aNew = SweetCityVote.getNew();
......@@ -106,7 +107,7 @@ public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, S
redisDataUtils.incrSweetCityVote(aNew.getCityCode());
redisDataUtils.setUserVote(param.getPhone(), param.getUnionId(), param.getCityCode());
redisDataUtils.setUserVote(param.getPhone(), param.getUnionId(), param);
return ResponseDto.success();
}
......
......@@ -13,6 +13,7 @@ import com.liquidnet.service.sweet.dto.SweetManualArtistListDto;
import com.liquidnet.service.sweet.dto.SweetManualArtistStageListDto;
import com.liquidnet.service.sweet.entity.*;
import com.liquidnet.service.sweet.mapper.*;
import com.liquidnet.service.sweet.param.SweetCityVoteParam;
import com.liquidnet.service.sweet.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -517,17 +518,17 @@ public class RedisDataUtils {
return (Integer) obj;
}
}
public void setUserVote(String phone, String openId, String cityCode) {
public void setUserVote(String phone, String openId, SweetCityVoteParam param) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_CITY_VOTE_USER.concat(phone).concat("-").concat(openId);
redisUtil.set(redisKey, cityCode);
redisUtil.set(redisKey, param);
}
public String getUserVote(String phone, String openId) {
public SweetCityVoteParam getUserVote(String phone, String openId) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_CITY_VOTE_USER.concat(phone).concat("-").concat(openId);
Object obj = redisUtil.get(redisKey);
if (null == obj) {
return "";
return null;
} else {
return (String) obj;
return (SweetCityVoteParam) obj;
}
}
public void setSweetCityVoteStatUpdateTime() {
......
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