|
@@ -92,6 +92,7 @@ public class CmcCarController extends BaseController
|
92
|
92
|
JSONArray usageArray = new JSONArray();
|
93
|
93
|
JSONObject usageObject = new JSONObject();
|
94
|
94
|
JSONArray approvalArray = new JSONArray();
|
|
95
|
+ JSONArray dayArray = new JSONArray();
|
95
|
96
|
CmcCar cmcCar = new CmcCar();
|
96
|
97
|
cmcCar.setStatus("0");
|
97
|
98
|
statusObject.put("已派出", cmcCarService.selectCmcCarList(cmcCar).size());
|
|
@@ -122,6 +123,7 @@ public class CmcCarController extends BaseController
|
122
|
123
|
}
|
123
|
124
|
getCarUsageStatistic(cmcCarApproval, usageObject);
|
124
|
125
|
getCarApprovalStatistic(cmcCarApproval, approvalArray);
|
|
126
|
+ getCarDayStatistic(cmcCarApproval, dayArray);
|
125
|
127
|
yearArray.add(yearObject);
|
126
|
128
|
statusArray.add(statusObject);
|
127
|
129
|
usageArray.add(usageObject);
|
|
@@ -129,7 +131,9 @@ public class CmcCarController extends BaseController
|
129
|
131
|
jsonObject.put("status", statusArray);
|
130
|
132
|
jsonObject.put("usage", usageArray);
|
131
|
133
|
jsonObject.put("approval", approvalArray);
|
|
134
|
+ jsonObject.put("day", dayArray);
|
132
|
135
|
jsonObject.getJSONArray("approval").sort((a,b)->((JSONObject)b).getIntValue("count") - ((JSONObject)a).getIntValue("count"));
|
|
136
|
+ jsonObject.getJSONArray("day").sort((a,b)->((JSONObject)b).getIntValue("count") - ((JSONObject)a).getIntValue("count"));
|
133
|
137
|
return success(jsonObject);
|
134
|
138
|
}
|
135
|
139
|
|
|
@@ -195,13 +199,35 @@ public class CmcCarController extends BaseController
|
195
|
199
|
//各车辆派出次数
|
196
|
200
|
public void getCarApprovalStatistic(CmcCarApproval cmcCarApproval, JSONArray approvalArray) {
|
197
|
201
|
for (CmcCar cmcCar : cmcCarService.selectCmcCarList(new CmcCar())) {
|
198
|
|
- cmcCarApproval.setCars(cmcCar.getCarId().toString());
|
199
|
|
- int count = cmcCarApprovalService.selectCmcCarApprovalList(cmcCarApproval).size();
|
200
|
|
- if (count > 0) {
|
201
|
|
- JSONObject approvalObject = new JSONObject();
|
202
|
|
- approvalObject.put("name", cmcCar.getLicensePlate());
|
203
|
|
- approvalObject.put("count", count);
|
204
|
|
- approvalArray.add(approvalObject);
|
|
202
|
+ if (cmcCar.getCarId() < 16) {
|
|
203
|
+ cmcCarApproval.setCars(cmcCar.getCarId().toString());
|
|
204
|
+ int count = cmcCarApprovalService.selectCmcCarApprovalList(cmcCarApproval).size();
|
|
205
|
+ if (count > 0) {
|
|
206
|
+ JSONObject approvalObject = new JSONObject();
|
|
207
|
+ approvalObject.put("name", cmcCar.getLicensePlate());
|
|
208
|
+ approvalObject.put("count", count);
|
|
209
|
+ approvalArray.add(approvalObject);
|
|
210
|
+ }
|
|
211
|
+ }
|
|
212
|
+ }
|
|
213
|
+ }
|
|
214
|
+
|
|
215
|
+ //各车辆派出天数
|
|
216
|
+ public void getCarDayStatistic(CmcCarApproval cmcCarApproval, JSONArray dayArray) {
|
|
217
|
+ for (CmcCar cmcCar : cmcCarService.selectCmcCarList(new CmcCar())) {
|
|
218
|
+ if (cmcCar.getCarId() < 16) {
|
|
219
|
+ cmcCarApproval.setCars(cmcCar.getCarId().toString());
|
|
220
|
+ long days = 0;
|
|
221
|
+ for (CmcCarApproval carApproval : cmcCarApprovalService.selectCmcCarApprovalList(cmcCarApproval)) {
|
|
222
|
+ if (carApproval.getDays() < 1) {
|
|
223
|
+ carApproval.setDays(1L);
|
|
224
|
+ }
|
|
225
|
+ days = days + carApproval.getDays();
|
|
226
|
+ }
|
|
227
|
+ JSONObject dayObject = new JSONObject();
|
|
228
|
+ dayObject.put("name", cmcCar.getLicensePlate());
|
|
229
|
+ dayObject.put("count", days);
|
|
230
|
+ dayArray.add(dayObject);
|
205
|
231
|
}
|
206
|
232
|
}
|
207
|
233
|
}
|