|
@@ -97,7 +97,7 @@ public class MemberSignInRecordServiceImpl implements MemberSignInRecordService
|
|
|
public AppMemberSignInConfigMoonRespVO getOwnSignInMoon(Long loginUserId, String month) {
|
|
|
|
|
|
// 获取当前月份, 天数 , 星期数
|
|
|
- List<Days> days = generateDaysForCurrentMonth();
|
|
|
+ List<Days> days = generateDaysForCurrentMonth(month);
|
|
|
LocalDate today = LocalDate.now();
|
|
|
LocalDate firstDayOfMonth = today.withDayOfMonth(1);
|
|
|
LocalDate lastDayOfMonth = today.withDayOfMonth(today.lengthOfMonth());
|
|
@@ -117,11 +117,16 @@ public class MemberSignInRecordServiceImpl implements MemberSignInRecordService
|
|
|
for (MemberSignInRecordDO memberSignInRecordDO : lastRecordInMoon) {
|
|
|
updateDayByNumber(days,memberSignInRecordDO.getDay());
|
|
|
}
|
|
|
+ int continueDays = 0;
|
|
|
|
|
|
MemberSignInRecordDO lastRecord = signInRecordMapper.selectLastRecordByUserId(loginUserId);
|
|
|
+ if (lastRecord!=null){
|
|
|
+ continueDays = lastRecord.getDay();
|
|
|
+ }
|
|
|
+
|
|
|
return AppMemberSignInConfigMoonRespVO.builder()
|
|
|
.days(days)
|
|
|
- .continueDays(lastRecord.getDay())
|
|
|
+ .continueDays(continueDays)
|
|
|
.rules(Rules.builder().build())
|
|
|
.continueDays(0).build();
|
|
|
}
|
|
@@ -138,12 +143,16 @@ public class MemberSignInRecordServiceImpl implements MemberSignInRecordService
|
|
|
}
|
|
|
|
|
|
|
|
|
- public static List<Days> generateDaysForCurrentMonth() {
|
|
|
+ public static List<Days> generateDaysForCurrentMonth(String month) {
|
|
|
List<Days> daysList = new ArrayList<>();
|
|
|
+ YearMonth yearMonth = YearMonth.parse(month, DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
|
+ LocalDate firstDayOfMonth = yearMonth.atDay(1);
|
|
|
+ LocalDate lastDayOfMonth = yearMonth.atEndOfMonth();
|
|
|
LocalDate today = LocalDate.now();
|
|
|
- LocalDate firstDayOfMonth = today.withDayOfMonth(1);
|
|
|
- LocalDate lastDayOfMonth = today.withDayOfMonth(today.lengthOfMonth());
|
|
|
-
|
|
|
+ if (StringUtils.isBlank(month)){
|
|
|
+ firstDayOfMonth = today.withDayOfMonth(1);
|
|
|
+ lastDayOfMonth = today.withDayOfMonth(today.lengthOfMonth());
|
|
|
+ }
|
|
|
for (LocalDate date = firstDayOfMonth; date.isBefore(lastDayOfMonth.plusDays(1)); date = date.plusDays(1)) {
|
|
|
Days day = new Days();
|
|
|
day.setDate(Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|