@@ -30,7 +30,7 @@ public class GitStatServiceImpl implements GitStatService {
30
30
private final Pattern pat = Pattern .compile ("(\\ d+)\\ s(\\ d+)\\ s" );
31
31
32
32
@ Override
33
- public List <StatData > stat (Integer method , String startDate ,
33
+ public List <StatData > stat (int method , String startDate ,
34
34
String endDate , String author , String gitRoot ) throws Exception {
35
35
36
36
Stack <String > result = multiCmdExec (method , startDate , endDate , author , gitRoot );
@@ -124,12 +124,17 @@ private StatParam calcDays(int method, String startDate, String endDate) throws
124
124
days = 7 ;
125
125
}
126
126
case Constants .GitConstants .STAT_METHOD_MONTH -> {
127
- Date today = new Date ();
128
127
lastTime = cur .getTime ();
129
128
cur .add (Calendar .MONTH , -1 );
130
129
startTime = cur .getTime ();
131
130
days = (lastTime .getTime () - startTime .getTime ()) / Constants .StaticParam .DAY_MILLIONSECOND ;
132
131
}
132
+ case Constants .GitConstants .STAT_METHOD_YEAR -> {
133
+ lastTime = cur .getTime ();
134
+ cur .add (Calendar .YEAR , -1 );
135
+ startTime = cur .getTime ();
136
+ days = (lastTime .getTime () - startTime .getTime ()) / Constants .StaticParam .DAY_MILLIONSECOND ;
137
+ }
133
138
default -> {
134
139
}
135
140
}
@@ -167,6 +172,7 @@ private Stack<String> multiCmdExec(int method,
167
172
case Constants .GitConstants .STAT_METHOD_DAY -> since = "1.day.ago" ;
168
173
case Constants .GitConstants .STAT_METHOD_WEEK -> since = "1.week.ago" ;
169
174
case Constants .GitConstants .STAT_METHOD_MONTH -> since = "1.month.ago" ;
175
+ case Constants .GitConstants .STAT_METHOD_YEAR -> since = "1.year.ago" ;
170
176
default -> {
171
177
}
172
178
}
0 commit comments