工单车辆详情
This commit is contained in:
parent
508b29c617
commit
90e4303b46
@ -46,8 +46,8 @@ public class JsonResult<E> implements Serializable {
|
||||
}
|
||||
|
||||
|
||||
public static JsonResult<Object> success (Object data) {
|
||||
return new JsonResult<>(Code.SUCCESS, Message.SUCCESS,data);
|
||||
public static <T> JsonResult<T> success(T data) {
|
||||
return new JsonResult<>(Code.SUCCESS, Message.SUCCESS, data);
|
||||
}
|
||||
public static JsonResult<Object> success (String msg) {
|
||||
return new JsonResult<>(Code.SUCCESS, msg,null);
|
||||
|
||||
@ -206,7 +206,7 @@ public class EbikeBikeOrderController {
|
||||
@PostMapping("batteryChange")
|
||||
public JsonResult<?> batteryChange(@Validated @RequestBody EbikeBatteryChangeVo changeVo) {
|
||||
ebikeBikeOrderService.batteryChange(changeVo);
|
||||
return JsonResult.success(Message.SUCCESS);
|
||||
return JsonResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -215,7 +215,7 @@ public class EbikeBikeOrderController {
|
||||
* @return 操作结果
|
||||
*/
|
||||
@GetMapping("bikeInfo")
|
||||
public JsonResult<?> bikeInfo(@RequestParam("bikeCode") String bikeCode) {
|
||||
public JsonResult<EbikeOrderBikeInfoDto> bikeInfo(@RequestParam("bikeCode") String bikeCode) {
|
||||
EbikeOrderBikeInfoDto info = ebikeBikeOrderService.bikeInfo(bikeCode);
|
||||
return JsonResult.success(info);
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ import org.postgresql.geometric.PGpoint;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@ -61,49 +62,49 @@ public class EbikeOrderBikeInfoDto implements Serializable {
|
||||
private Integer soc;
|
||||
|
||||
/**
|
||||
* 外接电源电压,单位:毫伏
|
||||
* 外接电源电压,单位:伏
|
||||
*/
|
||||
private Integer voltage;
|
||||
private BigDecimal voltage;
|
||||
|
||||
/**
|
||||
* GPS信号强度【0-31】
|
||||
*/
|
||||
private Integer gsm;
|
||||
private String gsm;
|
||||
|
||||
/**
|
||||
* 0: 头盔不在位 1: 头盔在位
|
||||
* 头盔在位: 0: 头盔不在位 1: 头盔在位
|
||||
*/
|
||||
private Character helmetExit;
|
||||
private String helmetExit;
|
||||
|
||||
/**
|
||||
* 0: 头盔锁未上锁 1: 头盔锁已上锁
|
||||
* 头盔锁状态: 0: 头盔锁未上锁 1: 头盔锁已上锁
|
||||
*/
|
||||
private Character isHelmetLocked;
|
||||
private String isHelmetLocked;
|
||||
|
||||
/**
|
||||
* 0:后轮静止 1:后轮转动(轮动状态
|
||||
* 轮动状态: 0:后轮静止 1:后轮转动(轮动状态
|
||||
*/
|
||||
private Character isWheelSpin;
|
||||
private String isWheelSpin;
|
||||
|
||||
/**
|
||||
* 0: 车辆静止 1: 车辆移动(运动状态
|
||||
* 运动状态: 0: 车辆静止 1: 车辆移动(运动状态
|
||||
*/
|
||||
private Character isMoving;
|
||||
private String isMoving;
|
||||
|
||||
/**
|
||||
* 0:电门关闭 1:电门打开
|
||||
* 电门状态: 0:电门关闭 1:电门打开
|
||||
*/
|
||||
private Character accOn;
|
||||
private String accOn;
|
||||
|
||||
/**
|
||||
* 0:后轮未锁 1:后轮已锁
|
||||
* 轮锁状态: 0:后轮未锁 1:后轮已锁
|
||||
*/
|
||||
private Character wheelLocked;
|
||||
private String wheelLocked;
|
||||
|
||||
/**
|
||||
* 0:电池仓未锁 1:电池仓已锁
|
||||
* 电池仓状态: 0:电池仓未锁 1:电池仓已锁
|
||||
*/
|
||||
private Character seatLocked;
|
||||
private String seatLocked;
|
||||
|
||||
/**
|
||||
* 速度
|
||||
|
||||
@ -17,8 +17,6 @@ import com.cdzy.operations.service.EbikeBikeOrderService;
|
||||
import com.cdzy.operations.utils.GeoCodingUtil;
|
||||
import com.cdzy.operations.utils.MinioUtil;
|
||||
import com.cdzy.operations.utils.RedisUtil;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.mybatisflex.core.keygen.impl.SnowFlakeIDKeyGenerator;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.core.update.UpdateChain;
|
||||
@ -29,6 +27,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -388,22 +388,26 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
||||
}
|
||||
ResGPSDto resGPSDto = (ResGPSDto)redisUtil.getEcu(bikeInfo.getEcuSn());
|
||||
bikeInfo.setSoc(resGPSDto.getSoc());
|
||||
bikeInfo.setVoltage(resGPSDto.getVoltage());
|
||||
bikeInfo.setGsm(resGPSDto.getGsm());
|
||||
bikeInfo.setHelmetExit(resGPSDto.getHelmetExit());
|
||||
bikeInfo.setIsHelmetLocked(resGPSDto.getIsHelmetLocked());
|
||||
bikeInfo.setIsWheelSpin(resGPSDto.getIsWheelSpin());
|
||||
bikeInfo.setIsMoving(resGPSDto.getIsMoving());
|
||||
bikeInfo.setAccOn(resGPSDto.getAccOn());
|
||||
bikeInfo.setWheelLocked(resGPSDto.getWheelLocked());
|
||||
bikeInfo.setSeatLocked(resGPSDto.getSeatLocked());
|
||||
BigDecimal result = new BigDecimal(resGPSDto.getVoltage())
|
||||
.divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP);
|
||||
bikeInfo.setVoltage(result);
|
||||
if (resGPSDto.getGsm()>20 && resGPSDto.getGsm()<31){
|
||||
bikeInfo.setGsm("信号强");
|
||||
}else if (resGPSDto.getGsm()<20 && resGPSDto.getGsm()>10){
|
||||
bikeInfo.setGsm("信号一般");
|
||||
}else if (resGPSDto.getGsm()<=10){
|
||||
bikeInfo.setGsm("信号弱");
|
||||
}
|
||||
bikeInfo.setHelmetExit(resGPSDto.getHelmetExit()==1?"头盔在位":"头盔不在位");
|
||||
bikeInfo.setIsHelmetLocked(resGPSDto.getIsHelmetLocked()==1?"头盔已上锁":"头盔未上锁");
|
||||
bikeInfo.setIsWheelSpin(resGPSDto.getIsWheelSpin()==1?"转动":"静止");
|
||||
bikeInfo.setIsMoving(resGPSDto.getIsMoving()==1?"运动":"静止");
|
||||
bikeInfo.setAccOn(resGPSDto.getAccOn()==1?"开":"关");
|
||||
bikeInfo.setWheelLocked(resGPSDto.getWheelLocked()==1?"上锁":"未上锁");
|
||||
bikeInfo.setSeatLocked(resGPSDto.getSeatLocked()==1?"关闭":"打开");
|
||||
bikeInfo.setSpeed(resGPSDto.getSpeed());
|
||||
bikeInfo.setLatestTime(resGPSDto.getLatestTime());
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
ObjectNode objectNode = mapper.createObjectNode();
|
||||
objectNode.put("lng",resGPSDto.getLongitude());
|
||||
objectNode.put("lat",resGPSDto.getLatitude());
|
||||
String locationToAddress = geoCodingUtil.getLocationToAddress(objectNode);
|
||||
String locationToAddress = geoCodingUtil.getLocationToAddress(resGPSDto.getLongitude(),resGPSDto.getLatitude());
|
||||
bikeInfo.setChineseLocation(locationToAddress);
|
||||
return bikeInfo;
|
||||
}
|
||||
|
||||
@ -100,6 +100,21 @@ public class GeoCodingUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 输入经纬度,返回地址。
|
||||
*
|
||||
* @param lng 经度
|
||||
* @param lat 纬度
|
||||
* @return 地址
|
||||
*/
|
||||
public String getLocationToAddress(Double lng, Double lat) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
ObjectNode objectNode = mapper.createObjectNode();
|
||||
objectNode.put("lng",lng);
|
||||
objectNode.put("lat",lat);
|
||||
return getLocationToAddress(objectNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 输入经纬度,返回地址明细(含区域ID、县区名)。
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user