Merge branch 'main' of http://47.109.71.130:3000/attiya/ebike-share into main
This commit is contained in:
commit
1e247457b9
@ -81,4 +81,13 @@ public interface MaintenanceFeignClient {
|
||||
*/
|
||||
@PostMapping("ebikeBikeInfo/deleteBatteryInfo")
|
||||
JsonResult<List<RspBikeInfo>> deleteBatteryInfo(@RequestBody List<String> batteryCodes);
|
||||
|
||||
/**
|
||||
* 根据ecuSn生成换电工单
|
||||
*
|
||||
* @param ecuSn 中控编号编号
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("ebikeOrder/changeBattery")
|
||||
JsonResult<?> changeBattery(@RequestParam(name = "ecuSn") String ecuSn);
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ public class EbikeBikeOrder implements Serializable {
|
||||
private Long orderCode;
|
||||
|
||||
/**
|
||||
* 工单类型 1 维修工单 2 换电工单
|
||||
* 工单类型 1 维修工单 2 换电工单 3 调度工单
|
||||
*/
|
||||
private String orderType;
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -55,8 +56,7 @@ import static com.cdzy.ebikemaintenance.model.pojo.table.EbikeBikeInfoTableDef.E
|
||||
import static com.cdzy.ebikemaintenance.model.pojo.table.EbikeBikeOrderTableDef.EBIKE_BIKE_ORDER;
|
||||
import static com.cdzy.ebikemaintenance.model.pojo.table.EbikeCarStatusInfoTableDef.EBIKE_CAR_STATUS_INFO;
|
||||
import static com.cdzy.ebikemaintenance.model.pojo.table.EbikeEcuInfoTableDef.EBIKE_ECU_INFO;
|
||||
import static com.mybatisflex.core.query.QueryMethods.max;
|
||||
import static com.mybatisflex.core.query.QueryMethods.select;
|
||||
import static com.mybatisflex.core.query.QueryMethods.*;
|
||||
|
||||
/**
|
||||
* 车辆基本信息 服务层实现。
|
||||
@ -113,6 +113,8 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
||||
private MinioUtil minioUtil;
|
||||
@Resource
|
||||
private GeoCodingUtil geoCodingUtil;
|
||||
@Resource
|
||||
private EbikeVehicleListingRecordsMapper ebikeVehicleListingRecordsMapper;
|
||||
|
||||
@Override
|
||||
public EbikeBikeInfo getByBikeCode(String bikeCode) {
|
||||
@ -366,6 +368,7 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
||||
try {
|
||||
ebikeBikeInfoMapper.vehicleLeaveWarehouse(reqBulkDeliveryDto.getBikeCode(),
|
||||
reqBulkDeliveryDto.getStatus(), reqBulkDeliveryDto.getReginId());
|
||||
batchRecordBikeListingInfo(reqBulkDeliveryDto);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("vehicleLeaveWarehouse===>{}", e.getMessage() + Arrays.toString(e.getStackTrace()));
|
||||
@ -1085,4 +1088,44 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
||||
}
|
||||
return resEbikeBikeWorkOrderDto;
|
||||
}
|
||||
/**
|
||||
* 批量记录车辆上架信息
|
||||
*
|
||||
* @param reqBulkDeliveryDto 请求参数
|
||||
*/
|
||||
public void batchRecordBikeListingInfo(ReqBulkDeliveryDto reqBulkDeliveryDto) {
|
||||
// 获取车辆上架的车牌列表
|
||||
List<String> bikeCode = reqBulkDeliveryDto.getBikeCode();
|
||||
String tokenValue = StpUtil.getTokenValue();
|
||||
JsonResult<StaffFeign> result = staffFeignClient.getInfoByToken(tokenValue);
|
||||
if (result.getCode() != Code.SUCCESS) {
|
||||
throw new RuntimeException("获取用户信息失败");
|
||||
}
|
||||
StaffFeign staffFeign = result.getData();
|
||||
// 获取当前操作用户和时间
|
||||
String operatorName = staffFeign.getStaffId().toString();
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
String batch = currentTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); // 格式化当前时间为“年月日时分秒”形式
|
||||
|
||||
// 创建用于批量插入的记录列表
|
||||
List<EbikeVehicleListingRecords> recordsList = new ArrayList<>(bikeCode.size());
|
||||
// 遍历车辆编号列表,生成每个记录对象
|
||||
for (String bikeId : bikeCode) {
|
||||
EbikeVehicleListingRecords record = new EbikeVehicleListingRecords();
|
||||
record.setBatch(batch);
|
||||
record.setBikeCode(bikeId);
|
||||
String reginId = reqBulkDeliveryDto.getReginId();
|
||||
// 根据reginId是否为空设置内容
|
||||
record.setContent(reginId.isEmpty() ? "车辆批量下架" : "车辆批量上架");
|
||||
record.setOperationType(reginId.isEmpty() ? 0 : 1);
|
||||
record.setOperateUser(operatorName);
|
||||
record.setOperateTime(currentTime);
|
||||
record.setReginId(reqBulkDeliveryDto.getReginId());
|
||||
recordsList.add(record);
|
||||
}
|
||||
// 如果有记录,则批量插入
|
||||
if (!recordsList.isEmpty()) {
|
||||
ebikeVehicleListingRecordsMapper.insertBatch(recordsList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,10 +39,11 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
||||
EbikeBikeInfo ebikeBikeInfo = infoMapper.selectOneByQuery(queryWrapper);
|
||||
queryWrapper.clear();
|
||||
queryWrapper.where(EBIKE_BIKE_ORDER.BIKE_ID.eq(ebikeBikeInfo.getBikeId()))
|
||||
.where(EBIKE_BIKE_ORDER.ORDER_TYPE.eq("2"))
|
||||
.where(EBIKE_BIKE_ORDER.HANDLE_STATE.eq("0"));
|
||||
EbikeBikeOrder order = this.mapper.selectOneByQuery(queryWrapper);
|
||||
if (order != null) {
|
||||
throw new RuntimeException("该车辆已存在换电工单,无需重复生成");
|
||||
throw new RuntimeException("该车辆存在未完成的换电工单,无需重复生成");
|
||||
}
|
||||
//生成工单
|
||||
EbikeBikeOrder bikeOrder = new EbikeBikeOrder();
|
||||
@ -57,6 +58,7 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
||||
public void doneChangeBattery(String bikeId, String receiverId) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_BIKE_ORDER.BIKE_ID.eq(bikeId))
|
||||
.where(EBIKE_BIKE_ORDER.ORDER_TYPE.eq("2"))
|
||||
.where(EBIKE_BIKE_ORDER.HANDLE_STATE.eq("0"));
|
||||
EbikeBikeOrder bikeOrder = this.mapper.selectOneByQuery(queryWrapper);
|
||||
if (bikeOrder == null){
|
||||
|
||||
@ -6,6 +6,7 @@ import com.cdzy.common.model.ResGPSDto;
|
||||
import com.cdzy.ebikereport.enums.BitSwitch;
|
||||
import com.cdzy.ebikereport.utils.BinaryUtil;
|
||||
import com.cdzy.ebikereport.utils.RedisUtil;
|
||||
import com.ebike.feign.clients.MaintenanceFeignClient;
|
||||
import com.ebike.feign.clients.OperateFeignClient;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.data.geo.Point;
|
||||
@ -25,6 +26,9 @@ public class ReoprtHandler {
|
||||
@Resource
|
||||
private OperateFeignClient operateFeignClient;
|
||||
|
||||
@Resource
|
||||
private MaintenanceFeignClient maintenanceFeignClient;
|
||||
|
||||
/**
|
||||
* 报文处理
|
||||
*/
|
||||
@ -48,8 +52,8 @@ public class ReoprtHandler {
|
||||
char isWheelSpin = binary.charAt(BitSwitch.IS_WHEEL_SPIN);
|
||||
char isMoving = binary.charAt(BitSwitch.IS_MOVING);
|
||||
ResGPSDto resGpsDto = param.toJavaObject(ResGPSDto.class);
|
||||
if (resGpsDto.getSoc() < 20){
|
||||
//TODO:生成换电工单
|
||||
if (resGpsDto.getSoc() > 0 && resGpsDto.getSoc() < 20){
|
||||
maintenanceFeignClient.changeBattery(deviceId);
|
||||
}
|
||||
resGpsDto.setEcuSn(deviceId);
|
||||
resGpsDto.setHelmetExit(helmet);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user