Selaa lähdekoodia

车辆派出天数统计

lamphua 7 kuukautta sitten
vanhempi
commit
3c9c9f740e

+ 33
- 7
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcCarController.java Näytä tiedosto

@@ -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
     }

+ 1
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcDeviceController.java Näytä tiedosto

@@ -232,7 +232,7 @@ public class CmcDeviceController extends BaseController
232 232
             StringBuilder deviceNames = new StringBuilder();
233 233
             deviceNames.append(cmcDevice.getName()).append("【").append(cmcDevice.getBrand() != null ? cmcDevice.getBrand() : "")
234 234
                     .append(cmcDevice.getSeries() != null ? "-" + cmcDevice.getSeries() + "】" : "")
235
-                    .append(cmcDevice.getCode() != null ? "(设备编号:" + cmcDevice.getCode() + ")" : "").append(",");
235
+                    .append(cmcDevice.getCode() != null ? "(设备编号:" + cmcDevice.getCode() + ")" : "");
236 236
             if (count > 0) {
237 237
                 JSONObject approvalObject = new JSONObject();
238 238
                 approvalObject.put("name", deviceNames);

+ 1
- 1
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcSettleMapper.xml Näytä tiedosto

@@ -134,7 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
134 134
             <if test="jyTime != null "> and s.jy_time = #{jyTime}</if>
135 135
             <if test="jyComment != null  and jyComment != ''"> and s.jy_comment = #{jyComment}</if>
136 136
             <if test="managerUserId != null "> and s.manager_user_id = #{managerUserId}</if>
137
-            <if test="managerTime != null "> and s.manager_time = #{managerTime}</if>
137
+            <if test="managerTime != null "> and YEAR(s.manager_time) = YEAR(#{managerTime})</if>
138 138
             <if test="managerComment != null  and managerComment != ''"> and s.manager_comment = #{managerComment}</if>
139 139
             <if test="gmUserId != null "> and s.gm_user_id = #{gmUserId}</if>
140 140
             <if test="gmTime != null and @com.ruoyi.common.utils.DateUtils@parseDateToStr('yyyy', gmTime) == '2000' "> and s.gm_time is not null</if>

Loading…
Peruuta
Tallenna