车辆静止时更新车辆位置
This commit is contained in:
parent
c54075d734
commit
4e892d6f6d
@ -40,7 +40,7 @@ public interface OperationsFeignClient {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@GetMapping("/ebikeBikeInfo/api/openLock")
|
@GetMapping("/ebikeBikeInfo/api/openLock")
|
||||||
JsonResult<?> openLock(@RequestParam("bikeCode")String bikeCode);
|
JsonResult<?> openLock(@RequestParam("bikeCode") String bikeCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户关锁
|
* 用户关锁
|
||||||
@ -56,7 +56,7 @@ public interface OperationsFeignClient {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@GetMapping("/ebikeBikeInfo/api/bikeInfo")
|
@GetMapping("/ebikeBikeInfo/api/bikeInfo")
|
||||||
JsonResult<FeignEbikeUserBikeInfo> bikeInfo(@RequestParam("bikeCode")String bikeCode);
|
JsonResult<FeignEbikeUserBikeInfo> bikeInfo(@RequestParam("bikeCode") String bikeCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据EcuSn生成换电工单
|
* 根据EcuSn生成换电工单
|
||||||
@ -64,7 +64,7 @@ public interface OperationsFeignClient {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@GetMapping("/ebikeBikeOrder/batterySwapOrder")
|
@GetMapping("/ebikeBikeOrder/batterySwapOrder")
|
||||||
JsonResult<FeignEbikeUserBikeInfo> batterySwapOrder(@RequestParam("ecuSn")String ecuSn);
|
JsonResult<FeignEbikeUserBikeInfo> batterySwapOrder(@RequestParam("ecuSn") String ecuSn);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,4 +84,15 @@ public interface OperationsFeignClient {
|
|||||||
@PostMapping("ebikeTracking/save")
|
@PostMapping("ebikeTracking/save")
|
||||||
JsonResult<?> saveEbikeTracking(@RequestBody EbikeTracking ebikeTracking);
|
JsonResult<?> saveEbikeTracking(@RequestBody EbikeTracking ebikeTracking);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存车辆最新位置
|
||||||
|
* @param ecuSn 中控编号
|
||||||
|
* @param longitude 经度
|
||||||
|
* @param latitude 纬度
|
||||||
|
* @return 保存结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/changeLocation")
|
||||||
|
JsonResult<?> changeLocation(@RequestParam("ecuSn") String ecuSn, @RequestParam("longitude") Double longitude, @RequestParam("latitude") Double latitude);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,22 +7,30 @@ import com.cdzy.operations.model.dto.EbikeBikeInfoDto;
|
|||||||
import com.cdzy.operations.model.dto.EbikeDto;
|
import com.cdzy.operations.model.dto.EbikeDto;
|
||||||
import com.cdzy.operations.model.dto.EbikeUserBikeInfo;
|
import com.cdzy.operations.model.dto.EbikeUserBikeInfo;
|
||||||
import com.cdzy.operations.model.dto.EbikeUserLockDto;
|
import com.cdzy.operations.model.dto.EbikeUserLockDto;
|
||||||
|
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;
|
||||||
import com.ebike.feign.model.vo.EbikeLockVo;
|
import com.ebike.feign.model.vo.EbikeLockVo;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.postgresql.geometric.PGpoint;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.cdzy.operations.model.entity.table.EbikeBikeInfoTableDef.EBIKE_BIKE_INFO;
|
||||||
|
import static com.cdzy.operations.model.entity.table.EbikeEcuInfoTableDef.EBIKE_ECU_INFO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆基本信息 控制层。
|
* 车辆基本信息 控制层。
|
||||||
*
|
*
|
||||||
* @author attiya
|
* @author attiya
|
||||||
* @since 2025-10-17
|
* @since 2025-10-17
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Validated
|
@Validated
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/ebikeBikeInfo")
|
@RequestMapping("/ebikeBikeInfo")
|
||||||
@ -160,4 +168,26 @@ public class EbikeBikeInfoController {
|
|||||||
ResGPSDto ecuMsg = ebikeBikeInfoService.getEcuMsg(ecuSn);
|
ResGPSDto ecuMsg = ebikeBikeInfoService.getEcuMsg(ecuSn);
|
||||||
return JsonResult.success(ecuMsg);
|
return JsonResult.success(ecuMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存车辆最新位置
|
||||||
|
*
|
||||||
|
* @param ecuSn 中控编号
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/changeLocation")
|
||||||
|
public JsonResult<?> changeLocation(@RequestParam("ecuSn") String ecuSn, @RequestParam("longitude") Double longitude,@RequestParam("latitude") Double latitude) {
|
||||||
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
|
.leftJoin(EBIKE_ECU_INFO).on(EBIKE_ECU_INFO.ECU_ID.eq(EBIKE_BIKE_INFO.ECU_ID))
|
||||||
|
.where(EBIKE_ECU_INFO.ECU_SN.eq(ecuSn));
|
||||||
|
EbikeBikeInfo bikeInfo = ebikeBikeInfoService.getOne(queryWrapper);
|
||||||
|
if (bikeInfo == null) {
|
||||||
|
log.warn("中控未绑定车辆或不存在,SN={}", ecuSn);
|
||||||
|
return JsonResult.failed();
|
||||||
|
}else {
|
||||||
|
bikeInfo.setLocation(new PGpoint(longitude,latitude));
|
||||||
|
ebikeBikeInfoService.updateById(bikeInfo);
|
||||||
|
}
|
||||||
|
return JsonResult.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,8 +89,8 @@ public class ReoprtHandler {
|
|||||||
EbikeTracking ebikeTracking = new EbikeTracking(deviceId, doubles[1], doubles[0]);
|
EbikeTracking ebikeTracking = new EbikeTracking(deviceId, doubles[1], doubles[0]);
|
||||||
operateFeignClient.saveEbikeTracking(ebikeTracking);
|
operateFeignClient.saveEbikeTracking(ebikeTracking);
|
||||||
//车辆静止,直接落库
|
//车辆静止,直接落库
|
||||||
if (isMoving == '0'){
|
if (isMoving == '0') {
|
||||||
|
operateFeignClient.changeLocation(deviceId,doubles[0], doubles[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user