批量调度订单车辆判断

This commit is contained in:
attiya 2025-08-23 11:57:26 +08:00
parent 9754a57679
commit 5c1bcfec16
2 changed files with 19 additions and 4 deletions

View File

@ -1208,6 +1208,7 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
StaffFeign staffFeign = getStaffFeignInfo();
String userId = staffFeign.getStaffId().toString();
checkBikeCodes(eqWorkOrderDispatchDto);
// 生成工单编号
SnowFlakeIDKeyGenerator snowFlakeIDKeyGenerator = new SnowFlakeIDKeyGenerator();
long orderCode = snowFlakeIDKeyGenerator.nextId();
@ -1258,6 +1259,23 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
}
}
private void checkBikeCodes(ReqWorkOrderDispatchDto eqWorkOrderDispatchDto) {
List<String> bikeCodes = eqWorkOrderDispatchDto.getBikeCodes();
QueryWrapper queryWrapper = QueryWrapper.create()
.select(EBIKE_DISPATCH_RECORDS.BIKE_CODE)
.leftJoin(EBIKE_BIKE_ORDER).on(EBIKE_BIKE_ORDER.ORDER_ID.eq(EBIKE_DISPATCH_RECORDS.ORDER_ID))
.where(EBIKE_BIKE_ORDER.HANDLE_STATE.ne(0))
.where(EBIKE_DISPATCH_RECORDS.BIKE_CODE.in(bikeCodes));
List<String> list = ebikeDispatchRecordsMapper.selectListByQueryAs(queryWrapper, String.class);
if (!list.isEmpty()) {
bikeCodes.removeAll(list);
if (bikeCodes.isEmpty()) {
throw new RuntimeException("当前所有车辆已创建调度订单");
}
eqWorkOrderDispatchDto.setBikeCodes(bikeCodes);
}
}
/**
* 根据订单ID 获取车辆调度信息
*

View File

@ -1,15 +1,12 @@
package com.cdzy.user.config;
import com.cdzy.user.component.MyTenantFactory;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.core.FlexGlobalConfig;
import com.mybatisflex.core.audit.AuditManager;
import com.mybatisflex.core.dialect.DbType;
import com.mybatisflex.core.dialect.DialectFactory;
import com.mybatisflex.core.tenant.TenantFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**