From 1ee76c252f2dbba62e0ec34cccf9eaac51de9083 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 23 七月 2025 16:25:23 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DriverServiceImpl.java |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DriverServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DriverServiceImpl.java
index 38f09d7..f05233c 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DriverServiceImpl.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DriverServiceImpl.java
@@ -2,11 +2,14 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.core.web.page.PageInfo;
 import com.ruoyi.dataInterchange.api.feignClient.UPExgMsgReportDriverInfoClient;
 import com.ruoyi.dataInterchange.api.vo.UPExgMsgReportDriverInfoVo;
 import com.ruoyi.system.api.model.Driver;
 import com.ruoyi.system.api.model.Enterprise;
 import com.ruoyi.system.mapper.DriverMapper;
+import com.ruoyi.system.query.DriverListReq;
+import com.ruoyi.system.query.DriverListResp;
 import com.ruoyi.system.service.IDriverService;
 import com.ruoyi.system.service.IEnterpriseService;
 import org.springframework.stereotype.Service;
@@ -16,6 +19,7 @@
 import java.time.ZoneOffset;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 /**
  * @author zhibing.pu
@@ -45,9 +49,17 @@
 			createTime = driver.getUpdateTime().toEpochSecond(ZoneOffset.ofHours(8));
 		}
 		List<UPExgMsgReportDriverInfoVo> list = upExgMsgReportDriverInfoClient.getUPExgMsgReportDriverInfoListIsAfterCreateTime(createTime).getData();
+		if (null == list || list.isEmpty()) {
+			return;
+		}
 		List<Enterprise> list1 = enterpriseService.list();
+		List<Driver> list2 = driverService.list();
 		List<Driver> driverList = new ArrayList<>();
 		for (UPExgMsgReportDriverInfoVo vo : list) {
+			Optional<Driver> first = list2.stream().filter(s -> s.getDrivingLicenseNumber().equals(vo.getDriverId())).findFirst();
+			if(first.isPresent()){
+				continue;
+			}
 			driver = new Driver();
 			driver.setName(vo.getDriverName());
 			driver.setDrivingLicenseNumber(vo.getDriverId());
@@ -59,8 +71,24 @@
 			driver.setStatus(1);
 			driver.setFlag(1);
 			driver.setUpdateTime(LocalDateTime.now());
+			driver.setVehicleNumber(vo.getVehicleNo());
 			driverList.add(driver);
 		}
-		this.saveBatch(driverList);
+		if (driverList.size() > 0) {
+			this.saveBatch(driverList);
+		}
+	}
+	
+	
+	/**
+	 * 获取司机列表
+	 *
+	 * @param driverListReq
+	 * @return
+	 */
+	@Override
+	public PageInfo<DriverListResp> getDriverList(DriverListReq driverListReq) {
+		PageInfo<DriverListResp> pageInfo = new PageInfo<>(driverListReq.getPageCurr(), driverListReq.getPageSize());
+		return this.baseMapper.getDriverList(pageInfo, driverListReq);
 	}
 }

--
Gitblit v1.7.1