...
|
...
|
@@ -6,6 +6,8 @@ import java.util.Map; |
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import com.yoho.activity.common.redis.CacheKeyEnum;
|
|
|
import com.yoho.activity.common.redis.RedisValueCache;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
...
|
...
|
@@ -35,7 +37,9 @@ public class UserdayPrizeLogServiceImpl implements IUserdayPrizeLogService { |
|
|
private IUserdayPrizeLogDAO userdayPrizeLogDAO;
|
|
|
@Resource(name = "userdayDrawPrizeService")
|
|
|
Map<Integer, IUserdayDrawPrizeService> userdayDrawPrizeServiceMap;
|
|
|
|
|
|
@Resource
|
|
|
RedisValueCache redisValueCache;
|
|
|
|
|
|
@Value("${userday.open.day}")
|
|
|
String userdayOpenDay;
|
|
|
|
...
|
...
|
@@ -108,9 +112,9 @@ public class UserdayPrizeLogServiceImpl implements IUserdayPrizeLogService { |
|
|
return userdayDrawPrizeService.existsPrizeLog(userdayPrizeLogList);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<UserdayPrizeLogResponseBO> queryPrizeLog(int uid, int prize_type) throws Exception {
|
|
|
log.info("enter queryPrizeLog. param uid={}, prize_type={}", uid, prize_type);
|
|
|
@Override
|
|
|
public List<UserdayPrizeLogResponseBO> queryPrizeLog(int uid, int prize_type) throws Exception {
|
|
|
log.info("enter queryPrizeLog. param uid={}, prize_type={}", uid, prize_type);
|
|
|
|
|
|
// (1)校验uid, prize_type
|
|
|
if (1 > uid || 1 > prize_type) {
|
...
|
...
|
@@ -120,19 +124,27 @@ public class UserdayPrizeLogServiceImpl implements IUserdayPrizeLogService { |
|
|
// (2)查询当天中奖日志
|
|
|
List<UserdayPrizeLog> userdayPrizeLogList = userdayPrizeLogDAO.selectByUidAndPrizeType(uid, prize_type);
|
|
|
if (CollectionUtils.isEmpty(userdayPrizeLogList)) {
|
|
|
return null;
|
|
|
return null;
|
|
|
}
|
|
|
List<UserdayPrizeLogResponseBO> list = new ArrayList<>(userdayPrizeLogList.size());
|
|
|
UserdayPrizeLogResponseBO bo = null;
|
|
|
for (UserdayPrizeLog dal : userdayPrizeLogList) {
|
|
|
bo = new UserdayPrizeLogResponseBO();
|
|
|
BeanUtils.copyProperties(dal, bo);
|
|
|
bo.setWinningTime(DateUtils.long2DateStr(((long)bo.getCreateTime()) * 1000, "HH:mm"));
|
|
|
list.add(bo);
|
|
|
bo = new UserdayPrizeLogResponseBO();
|
|
|
BeanUtils.copyProperties(dal, bo);
|
|
|
bo.setWinningTime(DateUtils.long2DateStr(((long) bo.getCreateTime()) * 1000, "HH:mm"));
|
|
|
list.add(bo);
|
|
|
}
|
|
|
|
|
|
// (3)返回
|
|
|
return list;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int queryPrizeLogNum(int prize_type) {
|
|
|
log.info("enter queryPrizeLogNum. param prize_type={}", prize_type);
|
|
|
int realNum = userdayPrizeLogDAO.selectNumByPrizeType(prize_type);
|
|
|
Integer virtualNum = redisValueCache.get(CacheKeyEnum.USERDAY_DRAWPRIZENUM, "", Integer.class);
|
|
|
return realNum + (null == virtualNum ? 0 : virtualNum);
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|