|
@@ -42,8 +42,8 @@ import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
import com.sckw.transport.api.dubbo.TransportRemoteService;
|
|
import com.sckw.transport.api.dubbo.TransportRemoteService;
|
|
|
import com.sckw.transport.api.model.param.CapacityTruckParam;
|
|
import com.sckw.transport.api.model.param.CapacityTruckParam;
|
|
|
-import com.sckw.transport.api.model.vo.CapacityTruckVO;
|
|
|
|
|
import com.sckw.transport.api.model.vo.RWaybillOrderVo;
|
|
import com.sckw.transport.api.model.vo.RWaybillOrderVo;
|
|
|
|
|
+import com.sckw.transport.api.model.vo.WaybillOrderTaskVO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -275,7 +275,7 @@ public class KwfDriverService {
|
|
|
Map<String, SysDictResDto> dicts = this.dict(dictKey);
|
|
Map<String, SysDictResDto> dicts = this.dict(dictKey);
|
|
|
|
|
|
|
|
/**数据组装**/
|
|
/**数据组装**/
|
|
|
- for (KwfDriverVo driver:drivers) {
|
|
|
|
|
|
|
+ for (KwfDriverVo driver : drivers) {
|
|
|
UserCacheResDto user = users == null ? null : users.get(Long.parseLong(driver.getCreateBy()));
|
|
UserCacheResDto user = users == null ? null : users.get(Long.parseLong(driver.getCreateBy()));
|
|
|
EntCacheResDto ent = ents == null ? null : ents.get(Long.parseLong(driver.getEntId()));
|
|
EntCacheResDto ent = ents == null ? null : ents.get(Long.parseLong(driver.getEntId()));
|
|
|
SysDictResDto licenseType = dicts == null
|
|
SysDictResDto licenseType = dicts == null
|
|
@@ -288,6 +288,9 @@ public class KwfDriverService {
|
|
|
KwfTruck truckInfo = getTruckInfo(driver.getId(), driver.getEntId());
|
|
KwfTruck truckInfo = getTruckInfo(driver.getId(), driver.getEntId());
|
|
|
driver.setTruckNo(truckInfo.getTruckNo());
|
|
driver.setTruckNo(truckInfo.getTruckNo());
|
|
|
|
|
|
|
|
|
|
+ //获取司机完成量(查询司机的当天完成量、7天完成量、30天完成量)
|
|
|
|
|
+ getDriverTaskAmounts(driver.getEntId(), driver.getId(), driver);
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
return drivers;
|
|
return drivers;
|
|
|
}
|
|
}
|
|
@@ -331,6 +334,7 @@ public class KwfDriverService {
|
|
|
//查询司机关联车辆信息
|
|
//查询司机关联车辆信息
|
|
|
KwfTruckReport truckReport = truckReportRepository.getOne(Wrappers.<KwfTruckReport>lambdaQuery()
|
|
KwfTruckReport truckReport = truckReportRepository.getOne(Wrappers.<KwfTruckReport>lambdaQuery()
|
|
|
.eq(BaseModel::getDelFlag, 0)
|
|
.eq(BaseModel::getDelFlag, 0)
|
|
|
|
|
+ .eq(BaseModel::getStatus, 0)
|
|
|
.eq(KwfTruckReport::getDriverId, driverId)
|
|
.eq(KwfTruckReport::getDriverId, driverId)
|
|
|
.eq(KwfTruckReport::getEntId, entId));
|
|
.eq(KwfTruckReport::getEntId, entId));
|
|
|
if (truckReport == null) {
|
|
if (truckReport == null) {
|
|
@@ -347,12 +351,34 @@ public class KwfDriverService {
|
|
|
return truck;
|
|
return truck;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
- * @param params 查询参数
|
|
|
|
|
- * @desc 查询
|
|
|
|
|
- * @author zk
|
|
|
|
|
- * @date 2023/7/6
|
|
|
|
|
- **/
|
|
|
|
|
|
|
+ * 查询司机的当天完成量、7天完成量、30天完成量
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param truck
|
|
|
|
|
+ * @param ents
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ private void getDriverTaskAmounts(String entId, String driverId, KwfDriverVo driver) {
|
|
|
|
|
+ if (StringUtils.isEmpty(entId) || StringUtils.isEmpty(driverId)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ //查询司机的当天完成量、7天完成量、30天完成量
|
|
|
|
|
+ WaybillOrderTaskVO taskVO = transportRemoteService.queryWaybillOrderTaskByDriverId(Long.valueOf(entId), Long.valueOf(driverId));
|
|
|
|
|
+ if (taskVO == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ driver.setTodayTaskAmount(taskVO.getTodayTaskAmount());
|
|
|
|
|
+ driver.setWeeklyTaskAmount(taskVO.getWeeklyTaskAmount());
|
|
|
|
|
+ driver.setMonthlyTaskAmount(taskVO.getMonthlyTaskAmount());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param params 查询参数
|
|
|
|
|
+ * @desc 查询
|
|
|
|
|
+ * @author zk
|
|
|
|
|
+ * @date 2023/7/6
|
|
|
|
|
+ **/
|
|
|
public List<Map<String, Object>> findList(Map<String, Object> params) {
|
|
public List<Map<String, Object>> findList(Map<String, Object> params) {
|
|
|
return driverDao.findList(params);
|
|
return driverDao.findList(params);
|
|
|
}
|
|
}
|
|
@@ -1216,23 +1242,20 @@ public class KwfDriverService {
|
|
|
CapacityTruckParam param = new CapacityTruckParam();
|
|
CapacityTruckParam param = new CapacityTruckParam();
|
|
|
param.setTruckNo(request.getTruckNo());
|
|
param.setTruckNo(request.getTruckNo());
|
|
|
param.setEntId(request.getEntId());
|
|
param.setEntId(request.getEntId());
|
|
|
- //校验物流订单车辆是否存在
|
|
|
|
|
- List<CapacityTruckVO> capacityTruckVOS = transportRemoteService.queryCapacityTruck(param);
|
|
|
|
|
- if (CollectionUtils.isEmpty(capacityTruckVOS)) {
|
|
|
|
|
- throw new BusinessPlatfromException(ErrorCodeEnum.WAYBILL_ORDER_NOT_TRUCK, "您所在的企业暂无该车辆,请与企业管理人员联系");
|
|
|
|
|
|
|
+ //查询企业下的车辆信息
|
|
|
|
|
+ List<KwfTruck> kwfTrucks = truckRepository.queryTruckByEntId(request.getEntId());
|
|
|
|
|
+ if (CollectionUtils.isEmpty(kwfTrucks)) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.TRUCK_NOT_FOUND, "您所在的企业暂无该车辆,请与企业管理人员联系");
|
|
|
|
|
+ }
|
|
|
|
|
+ //校验输入的车牌和轴数
|
|
|
|
|
+ KwfTruck matchedTruck = kwfTrucks.stream()
|
|
|
|
|
+ .filter(truck ->
|
|
|
|
|
+ Objects.equals(request.getTruckNo(), truck.getTruckNo()) &&
|
|
|
|
|
+ Objects.equals(String.valueOf(request.getTruckAxleId()), truck.getCarAxis()))
|
|
|
|
|
+ .findFirst().orElse(null);
|
|
|
|
|
+ if (matchedTruck == null) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.TRUCK_NOT_FOUND, "您所在的企业暂无该车辆,请与企业管理人员联系");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- Long truckId = capacityTruckVOS.stream().map(CapacityTruckVO::getTruckId).distinct().findFirst()
|
|
|
|
|
- .orElseThrow(() ->new BusinessPlatfromException(ErrorCodeEnum.TRUCK_NOT_FOUND, "车牌[" + request.getTruckNo() + "]未关联有效车辆ID"));
|
|
|
|
|
- KwfTruck truck = truckRepository.queryByTruckId(truckId);
|
|
|
|
|
- if (truck == null) {
|
|
|
|
|
- throw new BusinessPlatfromException(ErrorCodeEnum.TRUCK_NOT_FOUND, "车辆ID[" + truckId + "]不存在");
|
|
|
|
|
- }
|
|
|
|
|
- //校验车辆车轴信息
|
|
|
|
|
- if (StringUtils.isBlank(truck.getCarAxis()) || request.getTruckAxleId() != Long.parseLong(truck.getCarAxis())) {
|
|
|
|
|
- throw new BusinessPlatfromException(ErrorCodeEnum.WAYBILL_ORDER_NOT_TRUCK, "您所在的企业暂无该车辆,请与企业管理人员联系");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
//校验车辆是否已存在
|
|
//校验车辆是否已存在
|
|
|
List<KwfDriverAssociatedTruck> associatedTrackList = driverAssociatedTruckRepository.queryByEntIdAndDriverId(request.getEntId(), request.getDriverId());
|
|
List<KwfDriverAssociatedTruck> associatedTrackList = driverAssociatedTruckRepository.queryByEntIdAndDriverId(request.getEntId(), request.getDriverId());
|
|
|
boolean isDuplicate = associatedTrackList.stream()
|
|
boolean isDuplicate = associatedTrackList.stream()
|
|
@@ -1339,4 +1362,27 @@ public class KwfDriverService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param params 参数
|
|
|
|
|
+ * @desc 解绑车辆
|
|
|
|
|
+ * @author zk
|
|
|
|
|
+ * @date 2023/7/6
|
|
|
|
|
+ **/
|
|
|
|
|
+ public HttpResult unbindTruck(KwfBindTruckDto params) {
|
|
|
|
|
+ //查询是否存在已有车辆司机关系数据
|
|
|
|
|
+ KwfTruckReport truckReport = truckReportRepository.getOne(Wrappers.<KwfTruckReport>lambdaQuery()
|
|
|
|
|
+ .eq(KwfTruckReport::getEntId, LoginUserHolder.getEntId())
|
|
|
|
|
+ .eq(KwfTruckReport::getDriverId, params.getId())
|
|
|
|
|
+ .eq(KwfTruckReport::getDelFlag, Global.NO)
|
|
|
|
|
+ .eq(KwfTruckReport::getStatus, Global.NO));
|
|
|
|
|
+ if(truckReport == null) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.WAYBILL_ORDER_STATUS_ERROR, "此司机无车辆绑定信息!");
|
|
|
|
|
+ }
|
|
|
|
|
+ truckReport.setStatus(Global.YES);
|
|
|
|
|
+ boolean saveResult = truckReportRepository.updateById(truckReport);
|
|
|
|
|
+ return saveResult ? HttpResult.ok("车辆绑定成功!") : HttpResult.error("车辆绑定失败!");
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|