扫码详情
This commit is contained in:
parent
303e903d69
commit
b0dd4e46f6
@ -2,10 +2,7 @@ package com.cdzy.operations.controller;
|
|||||||
|
|
||||||
import com.cdzy.common.model.request.PageParam;
|
import com.cdzy.common.model.request.PageParam;
|
||||||
import com.cdzy.common.model.response.JsonResult;
|
import com.cdzy.common.model.response.JsonResult;
|
||||||
import com.cdzy.operations.model.dto.EbikeBikeInfoDto;
|
import com.cdzy.operations.model.dto.*;
|
||||||
import com.cdzy.operations.model.dto.EbikeDto;
|
|
||||||
import com.cdzy.operations.model.dto.EbikeUserBikeInfo;
|
|
||||||
import com.cdzy.operations.model.dto.EbikeUserLockDto;
|
|
||||||
import com.cdzy.operations.model.entity.EbikeBikeInfo;
|
import com.cdzy.operations.model.entity.EbikeBikeInfo;
|
||||||
import com.cdzy.operations.model.vo.*;
|
import com.cdzy.operations.model.vo.*;
|
||||||
import com.cdzy.operations.service.EbikeBikeInfoService;
|
import com.cdzy.operations.service.EbikeBikeInfoService;
|
||||||
@ -198,4 +195,16 @@ public class EbikeBikeInfoController {
|
|||||||
}
|
}
|
||||||
return JsonResult.success();
|
return JsonResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆扫码详情
|
||||||
|
*
|
||||||
|
* @param bikeCode 车辆编号
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/scanInfo")
|
||||||
|
public JsonResult<EbikeScanInfoDto> info(@RequestParam("bikeCode") String bikeCode) {
|
||||||
|
EbikeScanInfoDto info = ebikeBikeInfoService.scanInfo(bikeCode);
|
||||||
|
return JsonResult.success(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,7 +97,6 @@ public class EbikeBikeInfoDto implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@Column(onInsertValue = "now()")
|
|
||||||
private LocalDateTime createdAt;
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,7 +107,6 @@ public class EbikeBikeInfoDto implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 修改时间
|
* 修改时间
|
||||||
*/
|
*/
|
||||||
@Column(onUpdateValue = "now()")
|
|
||||||
private LocalDateTime updatedAt;
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -0,0 +1,162 @@
|
|||||||
|
package com.cdzy.operations.model.dto;
|
||||||
|
|
||||||
|
import com.cdzy.operations.handler.PointDeserializer;
|
||||||
|
import com.cdzy.operations.handler.PointSerializer;
|
||||||
|
import com.cdzy.operations.handler.PointTypeHandler;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.locationtech.jts.geom.Point;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆扫一扫详情。
|
||||||
|
*
|
||||||
|
* @author attiya
|
||||||
|
* @since 2025-10-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EbikeScanInfoDto implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆详情ID
|
||||||
|
*/
|
||||||
|
private Long bikeInfoId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营商ID
|
||||||
|
*/
|
||||||
|
private Long operatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营区ID
|
||||||
|
*/
|
||||||
|
private Long regionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营区名称
|
||||||
|
*/
|
||||||
|
private String regionName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆编号(与车辆二维码编号相同
|
||||||
|
*/
|
||||||
|
private String bikeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池ID
|
||||||
|
*/
|
||||||
|
private Long batteryId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中控ID
|
||||||
|
*/
|
||||||
|
private Long ecuId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头盔ID
|
||||||
|
*/
|
||||||
|
private Long helmetId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定位
|
||||||
|
*/
|
||||||
|
@Column(typeHandler = PointTypeHandler.class)
|
||||||
|
@JsonSerialize(using = PointSerializer.class)
|
||||||
|
@JsonDeserialize(using = PointDeserializer.class)
|
||||||
|
private Point location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remarks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆状态
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆使用状态
|
||||||
|
*/
|
||||||
|
private Integer usageStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private Long createdBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
private Long updatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否包含头盔
|
||||||
|
*/
|
||||||
|
private Boolean hasHelme;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否包含巡检
|
||||||
|
*/
|
||||||
|
private Boolean hasInspection = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否自己已接单巡检工单
|
||||||
|
*/
|
||||||
|
private Boolean inspectionAcceptSelf = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否包含换电
|
||||||
|
*/
|
||||||
|
private Boolean hasBatterySwap = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否自己已接单换电工单
|
||||||
|
*/
|
||||||
|
private Boolean batterySwapAcceptSelf = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否包含调度
|
||||||
|
*/
|
||||||
|
private Boolean hasDispatch = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否自己已接单调度工单
|
||||||
|
*/
|
||||||
|
private Boolean dispatchAcceptSelf = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否包含维修
|
||||||
|
*/
|
||||||
|
private Boolean hasRepair = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否自己已接单维修工单
|
||||||
|
*/
|
||||||
|
private Boolean repairAcceptSelf = false;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,10 +1,7 @@
|
|||||||
package com.cdzy.operations.service;
|
package com.cdzy.operations.service;
|
||||||
|
|
||||||
import com.cdzy.common.model.request.PageParam;
|
import com.cdzy.common.model.request.PageParam;
|
||||||
import com.cdzy.operations.model.dto.EbikeBikeInfoDto;
|
import com.cdzy.operations.model.dto.*;
|
||||||
import com.cdzy.operations.model.dto.EbikeDto;
|
|
||||||
import com.cdzy.operations.model.dto.EbikeUserBikeInfo;
|
|
||||||
import com.cdzy.operations.model.dto.EbikeUserLockDto;
|
|
||||||
import com.cdzy.operations.model.entity.EbikeBikeInfo;
|
import com.cdzy.operations.model.entity.EbikeBikeInfo;
|
||||||
import com.cdzy.operations.model.vo.*;
|
import com.cdzy.operations.model.vo.*;
|
||||||
import com.ebike.feign.model.vo.EbikeLockVo;
|
import com.ebike.feign.model.vo.EbikeLockVo;
|
||||||
@ -100,4 +97,11 @@ public interface EbikeBikeInfoService extends IService<EbikeBikeInfo> {
|
|||||||
* @param ecuSn 中控编号
|
* @param ecuSn 中控编号
|
||||||
*/
|
*/
|
||||||
EbikeEcuMsgDto getEcuMsg(String ecuSn);
|
EbikeEcuMsgDto getEcuMsg(String ecuSn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆扫码详情
|
||||||
|
* @param bikeCode 车辆编号
|
||||||
|
* @return 车辆详情
|
||||||
|
*/
|
||||||
|
EbikeScanInfoDto scanInfo(String bikeCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,10 +23,7 @@ import com.cdzy.operations.mapper.EbikeDefaultBillingConfigurationMapper;
|
|||||||
import com.cdzy.operations.mapper.EbikeRegionMapper;
|
import com.cdzy.operations.mapper.EbikeRegionMapper;
|
||||||
import com.cdzy.operations.mapper.EbikeSiteMapper;
|
import com.cdzy.operations.mapper.EbikeSiteMapper;
|
||||||
import com.cdzy.operations.mapper.EbikeSpecialBillingConfigurationMapper;
|
import com.cdzy.operations.mapper.EbikeSpecialBillingConfigurationMapper;
|
||||||
import com.cdzy.operations.model.dto.EbikeBikeInfoDto;
|
import com.cdzy.operations.model.dto.*;
|
||||||
import com.cdzy.operations.model.dto.EbikeDto;
|
|
||||||
import com.cdzy.operations.model.dto.EbikeUserBikeInfo;
|
|
||||||
import com.cdzy.operations.model.dto.EbikeUserLockDto;
|
|
||||||
import com.cdzy.operations.model.entity.EbikeBatteryInfo;
|
import com.cdzy.operations.model.entity.EbikeBatteryInfo;
|
||||||
import com.cdzy.operations.model.entity.EbikeBikeInfo;
|
import com.cdzy.operations.model.entity.EbikeBikeInfo;
|
||||||
import com.cdzy.operations.model.entity.EbikeBikeOrder;
|
import com.cdzy.operations.model.entity.EbikeBikeOrder;
|
||||||
@ -546,7 +543,7 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
|||||||
queryWrapper.clear();
|
queryWrapper.clear();
|
||||||
queryWrapper.where(EBIKE_BIKE_INFO.ECU_ID.eq(ebikeEcuInfo.getEcuId()));
|
queryWrapper.where(EBIKE_BIKE_INFO.ECU_ID.eq(ebikeEcuInfo.getEcuId()));
|
||||||
long count = this.mapper.selectCountByQuery(queryWrapper);
|
long count = this.mapper.selectCountByQuery(queryWrapper);
|
||||||
if (count > 0){
|
if (count > 0) {
|
||||||
throw new EbikeException("中控已绑定其他车辆,不能进行换绑");
|
throw new EbikeException("中控已绑定其他车辆,不能进行换绑");
|
||||||
}
|
}
|
||||||
queryWrapper.clear();
|
queryWrapper.clear();
|
||||||
@ -573,10 +570,54 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
|||||||
ResGPSDto ecu = (ResGPSDto) redisUtil.getEcu(ecuSn);
|
ResGPSDto ecu = (ResGPSDto) redisUtil.getEcu(ecuSn);
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
EbikeEcuMsgDto ebikeEcuMsgDto = objectMapper.convertValue(ecu, EbikeEcuMsgDto.class);
|
EbikeEcuMsgDto ebikeEcuMsgDto = objectMapper.convertValue(ecu, EbikeEcuMsgDto.class);
|
||||||
ebikeEcuMsgDto.setRealVoltage(ecu.getVoltage()/1000.0);
|
ebikeEcuMsgDto.setRealVoltage(ecu.getVoltage() / 1000.0);
|
||||||
return ebikeEcuMsgDto;
|
return ebikeEcuMsgDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EbikeScanInfoDto scanInfo(String bikeCode) {
|
||||||
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
|
.select(EBIKE_BIKE_INFO.ALL_COLUMNS, EBIKE_REGION.REGION_NAME)
|
||||||
|
.leftJoin(EBIKE_REGION).on(EBIKE_REGION.REGION_ID.eq(EBIKE_BIKE_INFO.REGION_ID))
|
||||||
|
.where(EBIKE_BIKE_INFO.BIKE_CODE.eq(bikeCode));
|
||||||
|
EbikeScanInfoDto ebikeScanInfoDto = this.mapper.selectOneByQueryAs(queryWrapper, EbikeScanInfoDto.class);
|
||||||
|
queryWrapper.clear();
|
||||||
|
queryWrapper.where(EBIKE_BIKE_ORDER.BIKE_CODE.eq(bikeCode));
|
||||||
|
List<EbikeBikeOrder> list = orderMapper.selectListByQuery(queryWrapper);
|
||||||
|
long staffId = StpUtil.getLoginIdAsLong();
|
||||||
|
if (!list.isEmpty()) {
|
||||||
|
for (EbikeBikeOrder order : list) {
|
||||||
|
switch (order.getOrderType()) {
|
||||||
|
case BikeOrderType.INSPECTION -> {
|
||||||
|
ebikeScanInfoDto.setHasInspection(Boolean.TRUE);
|
||||||
|
if (order.getReceiverId() != null && staffId == order.getReceiverId()) {
|
||||||
|
ebikeScanInfoDto.setInspectionAcceptSelf(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case BikeOrderType.BATTERY_SWAP -> {
|
||||||
|
ebikeScanInfoDto.setHasBatterySwap(Boolean.TRUE);
|
||||||
|
if (order.getReceiverId() != null && staffId == order.getReceiverId()) {
|
||||||
|
ebikeScanInfoDto.setBatterySwapAcceptSelf(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case BikeOrderType.DISPATCH -> {
|
||||||
|
ebikeScanInfoDto.setHasDispatch(Boolean.TRUE);
|
||||||
|
if (order.getReceiverId() != null && staffId == order.getReceiverId()) {
|
||||||
|
ebikeScanInfoDto.setDispatchAcceptSelf(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case BikeOrderType.REPAIR -> {
|
||||||
|
ebikeScanInfoDto.setHasRepair(Boolean.TRUE);
|
||||||
|
if (order.getReceiverId() != null && staffId == order.getReceiverId()) {
|
||||||
|
ebikeScanInfoDto.setRepairAcceptSelf(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ebikeScanInfoDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static EbikeSpecialDay getEbikeSpecialDay(List<EbikeSpecialDay> ebikeSpecialDays) {
|
static EbikeSpecialDay getEbikeSpecialDay(List<EbikeSpecialDay> ebikeSpecialDays) {
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
package com.cdzy.operations;
|
package com.cdzy.operations;
|
||||||
|
|
||||||
|
import com.cdzy.common.model.dto.ResGPSDto;
|
||||||
import com.cdzy.operations.mapper.EbikeBikeOrderMapper;
|
import com.cdzy.operations.mapper.EbikeBikeOrderMapper;
|
||||||
import com.cdzy.operations.model.dto.EbikeBikeOrderDayCountDto;
|
import com.cdzy.operations.model.dto.EbikeBikeOrderDayCountDto;
|
||||||
import com.cdzy.operations.model.dto.EbikeBikeOrderMonthCountDto;
|
import com.cdzy.operations.model.dto.EbikeBikeOrderMonthCountDto;
|
||||||
import com.cdzy.operations.model.dto.EbikeBikeOrderWeekCountDto;
|
import com.cdzy.operations.model.dto.EbikeBikeOrderWeekCountDto;
|
||||||
|
import com.cdzy.operations.utils.RedisUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
@ -16,6 +18,9 @@ class EbikeOperationsApplicationTests {
|
|||||||
@Resource
|
@Resource
|
||||||
private EbikeBikeOrderMapper orderMapper;
|
private EbikeBikeOrderMapper orderMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void monthCount() {
|
void monthCount() {
|
||||||
List<EbikeBikeOrderMonthCountDto> monthCountDtos = orderMapper.monthCount(320131029184712704L);
|
List<EbikeBikeOrderMonthCountDto> monthCountDtos = orderMapper.monthCount(320131029184712704L);
|
||||||
@ -40,6 +45,10 @@ class EbikeOperationsApplicationTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test() {
|
||||||
|
ResGPSDto ecu = (ResGPSDto) redisUtil.getEcu("2370171956");
|
||||||
|
System.out.println(ecu.getVoltage()/1000.0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user