Showing
1 changed file
with
4 additions
and
8 deletions
@@ -141,18 +141,14 @@ public class InviteSettlementServiceImpl implements IInviteSettlementService { | @@ -141,18 +141,14 @@ public class InviteSettlementServiceImpl implements IInviteSettlementService { | ||
141 | 141 | ||
142 | @VisibleForTesting | 142 | @VisibleForTesting |
143 | Pair<Integer, Integer> getTimeRangeOfMonth(String month) { | 143 | Pair<Integer, Integer> getTimeRangeOfMonth(String month) { |
144 | - LocalDateTime requestMonth = null; | 144 | + LocalDateTime start = null; |
145 | + ZoneOffset zoneOffset = InviteSettlementUtils.zoneOffset(); | ||
145 | try { | 146 | try { |
146 | - requestMonth = LocalDateTime.parse(month, DateTimeFormatter.ofPattern("yyyyMM")); | 147 | + start = LocalDateTime.parse(month + "01 00:00:00", DateTimeFormatter.ofPattern("yyyyMMdd HH:mm:ss")); |
147 | } catch (Exception e) { | 148 | } catch (Exception e) { |
148 | throwServiceException("日期格式不正确"); | 149 | throwServiceException("日期格式不正确"); |
149 | } | 150 | } |
150 | - ZoneOffset zoneOffset = ZoneOffset.of("+8"); | ||
151 | - int startTime = (int) LocalDateTime.of(requestMonth.getYear(), requestMonth.getMonthValue(), 1, 0, 0, 0) | ||
152 | - .toEpochSecond(zoneOffset); | ||
153 | - int endTime = (int) LocalDateTime.of(requestMonth.getYear(), requestMonth.getMonthValue() + 1, 1, 0, 0, 0) | ||
154 | - .toEpochSecond(zoneOffset) - 1; | ||
155 | - return Pair.of(startTime, endTime); | 151 | + return Pair.of((int) start.toEpochSecond(zoneOffset), (int) start.plusMonths(1).toEpochSecond(zoneOffset) - 1); |
156 | } | 152 | } |
157 | 153 | ||
158 | @Override | 154 | @Override |
-
Please register or login to post a comment