From 7f5fbf4ef6832a6ef27387d8ce973522feec2094 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期四, 28 十二月 2023 16:53:09 +0800
Subject: [PATCH] 车辆管理数量
---
ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java | 6 +++++-
ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java | 2 +-
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java | 32 ++++++++++++++++++++++++++------
3 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
index b7e2ef0..9d0d430 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
@@ -285,7 +285,11 @@
String usersId = SecurityUtils.getUserId();
ArdSyUser ardSyUser = iArdSyUserService.userById(usersId);
String syURL = sysConfigService.getSYURL();
- return ardSyCarService.allListByUser(ardSyUser,syURL,usersId);
+ //鏍规嵁userId鏌ヨ閮ㄩ棬Id
+ SysUser sysUser = sysUserService.selectUserById(usersId);
+ //鏍规嵁褰撳墠deptId鎴栬�呭綋鍓嶅強鎵�灞炰笅绾х殑鎵�鏈塪eptId
+ List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId());
+ return ardSyCarService.allListByUser(ardSyUser,syURL,usersId,deptList);
}
@PreAuthorize("@ss.hasPermi('sy:syCar:carList')")
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java b/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
index c89042b..1de5883 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
@@ -111,7 +111,7 @@
* @param usersId
* @return
*/
- Map<String,Object> allListByUser(ArdSyUser ardSyUser, String syURL,String usersId);
+ Map<String,Object> allListByUser(ArdSyUser ardSyUser, String syURL,String usersId, List<Long> deptList);
List<Map<String,String>> getCarList(ArdSyUser ardSyUser, String syURL,String usersId,String teamId);
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
index 0a67bcb..774ea33 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
@@ -483,7 +483,7 @@
* @return
*/
@Override
- public Map<String, Object> allListByUser(ArdSyUser ardSyUser, String syURL, String usersId) {
+ public Map<String, Object> allListByUser(ArdSyUser ardSyUser, String syURL, String usersId, List<Long> deptList) {
Map<String, Object> result0 = new HashMap();
//鍒ゆ柇鍏宠仈琛ㄦ槸鍚︽湁鏁版嵁
if (ardSyUser != null) {
@@ -504,10 +504,29 @@
map.put("list", new ArrayList());
return map;
}
+ QueryWrapper<ArdSyCar> queryWrapper = new QueryWrapper<>();
+ queryWrapper.in("dept_id", deptList);
+ List<ArdSyCar> carListTable = ardSyCarMapper.selectList(queryWrapper);
int online = 0;
for (Map<String, Object> map : (List<Map<String, Object>>) result0.get("list")) {
Map<String, Object> resultMap = sYClient.getTeamCarList(syURL, (String) map.get("teamId"), result.get("sessionId"));
List<Map<String, Object>> carList = (List<Map<String, Object>>) resultMap.get("carList");
+ if(carList.size()>0){
+ for (int i = 0; i < carList.size(); i++) {
+ String carId = (String) carList.get(i).get("carId");
+ Boolean isCar = false;
+ for (int j = 0; j < carListTable.size(); j++) {
+ ArdSyCar ardSyCar = carListTable.get(j);
+ if (carId.equals(ardSyCar.getCarId())) {
+ isCar = true;
+ break;
+ }
+ }
+ if(!isCar){
+ carList.remove(carList.get(i));
+ }
+ }
+ }
for (Map<String, Object> m : carList) {
if (((String) m.get("stateCn")).contains("鍦ㄧ嚎")) {
online = online + 1;
@@ -515,11 +534,12 @@
continue;
}
}
- for (Map<String, Object> m : (List<Map<String, Object>>) result0.get("list")) {
- if (((String) m.get("teamId")).equals(((String) map.get("teamId")))) {
- map.put("count", Integer.parseInt((String) m.get("carNum")));
- }
- }
+// for (Map<String, Object> m : (List<Map<String, Object>>) result0.get("list")) {
+// if (((String) m.get("teamId")).equals(((String) map.get("teamId")))) {
+// map.put("count", Integer.parseInt((String) m.get("carNum")));
+// }
+// }
+ map.put("count", carList.size());
map.put("online", online);
online = 0;
}
--
Gitblit v1.9.3