|
@@ -45,16 +45,21 @@ public class UserSignServiceImpl extends AbstractService<UserSign> implements Us
|
|
|
private CifAccountDubboServiceClient accountDubboServiceClient;
|
|
|
|
|
|
@Override
|
|
|
- public List<UserSignDetailVO> todayDetail(Long uid) {
|
|
|
- ConfigDTO configByCode = configDubboServiceClient.getConfigByCode(USER_SIGN_INFO);
|
|
|
- List<UserSignDetailVO> list = JSONObject.parseArray(configByCode.getValueInfo(), UserSignDetailVO.class);
|
|
|
+ public UserSignDetailVO todayDetail(Long uid) {
|
|
|
+ UserSignDetailVO detailVO = new UserSignDetailVO();
|
|
|
+ boolean hasSignedToday = hasSignedToday(uid);
|
|
|
+ detailVO.setToday(hasSignedToday);
|
|
|
int continuousDays = getContinuousDays(uid);
|
|
|
+ detailVO.setContinueSign(continuousDays);
|
|
|
+
|
|
|
+ ConfigDTO configByCode = configDubboServiceClient.getConfigByCode(USER_SIGN_INFO);
|
|
|
+ List<UserSignDetailVO.SignVO> list = JSONObject.parseArray(configByCode.getValueInfo(), UserSignDetailVO.SignVO.class);
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
- if (i == continuousDays - 1) {
|
|
|
+ if (i <= continuousDays - 1) {
|
|
|
list.get(i).setStatus(1);
|
|
|
}
|
|
|
}
|
|
|
- return list;
|
|
|
+ return detailVO;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -129,6 +134,7 @@ public class UserSignServiceImpl extends AbstractService<UserSign> implements Us
|
|
|
Example.Criteria criteria = condition.createCriteria();
|
|
|
criteria.andEqualTo("uid", userId);
|
|
|
condition.orderBy("id").desc();
|
|
|
+ condition.setCountProperty("id");
|
|
|
List<UserSign> list = userSignMapper.selectByCondition(condition);
|
|
|
|
|
|
if (list.isEmpty()) {
|
|
@@ -143,9 +149,9 @@ public class UserSignServiceImpl extends AbstractService<UserSign> implements Us
|
|
|
private void giveReward(Long uid) {
|
|
|
int reward = 0;
|
|
|
ConfigDTO configByCode = configDubboServiceClient.getConfigByCode(USER_SIGN_INFO);
|
|
|
- List<UserSignDetailVO> userSignList = JSONObject.parseArray(configByCode.getValueInfo(), UserSignDetailVO.class);
|
|
|
- UserSignDetailVO maxDaysReward = userSignList.stream()
|
|
|
- .max(Comparator.comparing(UserSignDetailVO::getDays))
|
|
|
+ List<UserSignDetailVO.SignVO> userSignList = JSONObject.parseArray(configByCode.getValueInfo(), UserSignDetailVO.SignVO.class);
|
|
|
+ UserSignDetailVO.SignVO maxDaysReward = userSignList.stream()
|
|
|
+ .max(Comparator.comparing(UserSignDetailVO.SignVO::getDays))
|
|
|
.orElse(null);
|
|
|
if (maxDaysReward != null) {
|
|
|
reward = maxDaysReward.getValue();
|