车辆静止时更新车辆位置
This commit is contained in:
parent
c54075d734
commit
4e892d6f6d
@ -84,4 +84,15 @@ public interface OperationsFeignClient {
|
||||
@PostMapping("ebikeTracking/save")
|
||||
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.EbikeUserBikeInfo;
|
||||
import com.cdzy.operations.model.dto.EbikeUserLockDto;
|
||||
import com.cdzy.operations.model.entity.EbikeBikeInfo;
|
||||
import com.cdzy.operations.model.vo.*;
|
||||
import com.cdzy.operations.service.EbikeBikeInfoService;
|
||||
import com.ebike.feign.model.vo.EbikeLockVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.postgresql.geometric.PGpoint;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
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
|
||||
* @since 2025-10-17
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("/ebikeBikeInfo")
|
||||
@ -160,4 +168,26 @@ public class EbikeBikeInfoController {
|
||||
ResGPSDto ecuMsg = ebikeBikeInfoService.getEcuMsg(ecuSn);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public class ReoprtHandler {
|
||||
operateFeignClient.saveEbikeTracking(ebikeTracking);
|
||||
//车辆静止,直接落库
|
||||
if (isMoving == '0') {
|
||||
|
||||
operateFeignClient.changeLocation(deviceId,doubles[0], doubles[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user