Browse Source

车辆派出天数统计

lamphua 9 months ago
parent
commit
3c9c9f740e

+ 33
- 7
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcCarController.java View File

92
         JSONArray usageArray = new JSONArray();
92
         JSONArray usageArray = new JSONArray();
93
         JSONObject usageObject = new JSONObject();
93
         JSONObject usageObject = new JSONObject();
94
         JSONArray approvalArray = new JSONArray();
94
         JSONArray approvalArray = new JSONArray();
95
+        JSONArray dayArray = new JSONArray();
95
         CmcCar cmcCar = new CmcCar();
96
         CmcCar cmcCar = new CmcCar();
96
         cmcCar.setStatus("0");
97
         cmcCar.setStatus("0");
97
         statusObject.put("已派出", cmcCarService.selectCmcCarList(cmcCar).size());
98
         statusObject.put("已派出", cmcCarService.selectCmcCarList(cmcCar).size());
122
         }
123
         }
123
         getCarUsageStatistic(cmcCarApproval, usageObject);
124
         getCarUsageStatistic(cmcCarApproval, usageObject);
124
         getCarApprovalStatistic(cmcCarApproval, approvalArray);
125
         getCarApprovalStatistic(cmcCarApproval, approvalArray);
126
+        getCarDayStatistic(cmcCarApproval, dayArray);
125
         yearArray.add(yearObject);
127
         yearArray.add(yearObject);
126
         statusArray.add(statusObject);
128
         statusArray.add(statusObject);
127
         usageArray.add(usageObject);
129
         usageArray.add(usageObject);
129
         jsonObject.put("status", statusArray);
131
         jsonObject.put("status", statusArray);
130
         jsonObject.put("usage", usageArray);
132
         jsonObject.put("usage", usageArray);
131
         jsonObject.put("approval", approvalArray);
133
         jsonObject.put("approval", approvalArray);
134
+        jsonObject.put("day", dayArray);
132
         jsonObject.getJSONArray("approval").sort((a,b)->((JSONObject)b).getIntValue("count") - ((JSONObject)a).getIntValue("count"));
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
         return success(jsonObject);
137
         return success(jsonObject);
134
     }
138
     }
135
 
139
 
195
     //各车辆派出次数
199
     //各车辆派出次数
196
     public void getCarApprovalStatistic(CmcCarApproval cmcCarApproval, JSONArray approvalArray) {
200
     public void getCarApprovalStatistic(CmcCarApproval cmcCarApproval, JSONArray approvalArray) {
197
         for (CmcCar cmcCar : cmcCarService.selectCmcCarList(new CmcCar())) {
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 View File

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

+ 1
- 1
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcSettleMapper.xml View File

134
             <if test="jyTime != null "> and s.jy_time = #{jyTime}</if>
134
             <if test="jyTime != null "> and s.jy_time = #{jyTime}</if>
135
             <if test="jyComment != null  and jyComment != ''"> and s.jy_comment = #{jyComment}</if>
135
             <if test="jyComment != null  and jyComment != ''"> and s.jy_comment = #{jyComment}</if>
136
             <if test="managerUserId != null "> and s.manager_user_id = #{managerUserId}</if>
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
             <if test="managerComment != null  and managerComment != ''"> and s.manager_comment = #{managerComment}</if>
138
             <if test="managerComment != null  and managerComment != ''"> and s.manager_comment = #{managerComment}</if>
139
             <if test="gmUserId != null "> and s.gm_user_id = #{gmUserId}</if>
139
             <if test="gmUserId != null "> and s.gm_user_id = #{gmUserId}</if>
140
             <if test="gmTime != null and @com.ruoyi.common.utils.DateUtils@parseDateToStr('yyyy', gmTime) == '2000' "> and s.gm_time is not null</if>
140
             <if test="gmTime != null and @com.ruoyi.common.utils.DateUtils@parseDateToStr('yyyy', gmTime) == '2000' "> and s.gm_time is not null</if>

Loading…
Cancel
Save