无关风月
2025-04-17 d3c9f6c94cfd14f6c45fe6e92dd357386c7c3cd9
ruoyi-service/ruoyi-worker/src/main/java/com/ruoyi/worker/controller/OrderController.java
@@ -355,7 +355,6 @@
            // 读取订单ID的JSON文件内容
            try {
                String jsonContent = new String(Files.readAllBytes(Paths.get(jsonFilePath)));
                System.out.println("JSON 文件内容:" + jsonContent);
                List<ServeCoordinate> coordinate = JSONObject.parseObject(jsonContent, List.class);
                // 订单轨迹信息
                ServeCoordinate data = new ServeCoordinate();
@@ -390,7 +389,7 @@
        String nowStr = now.format(formatter);
        redisService.setCacheObject("MARK:"+workerId+":"+nowStr,longitude + "," + latitude);
        redisService.setCacheObject("MARK:"+workerId+":"+nowStr,longitude + "," + latitude, 10L, TimeUnit.MINUTES);
        String cacheObject = redisService.getCacheObject("MARK:" + workerId + ":" + formattedTime);
        if (cacheObject!=null){
@@ -430,7 +429,7 @@
            System.err.println("-----当前距离"+distance);
            //如果超出一定范围,存入Mark文件
            if (distance<50){
                redisService.setCacheObject("TIME:"+workerId,LocalDateTime.now());
                redisService.setCacheObject("TIME:"+workerId,LocalDateTime.now(), 10L, TimeUnit.MINUTES);
                marker(longitude,latitude);
            }
            }
@@ -506,7 +505,6 @@
            // 读取订单ID的JSON文件内容
            try {
                String jsonContent = new String(Files.readAllBytes(Paths.get(jsonFilePath)));
                System.out.println("JSON 文件内容:" + jsonContent);
                List<ServeCoordinate> coordinate = JSONObject.parseObject(jsonContent, List.class);
                // 订单轨迹信息
                ServeCoordinate data = new ServeCoordinate();
@@ -537,7 +535,7 @@
//
//    }
    @ApiOperation(value = "上传经纬度", tags = {"师傅端-首页"})
    @ApiOperation(value = "上传经纬度", tags = {"师傅端-首页[2.0]"})
    @GetMapping(value = "/putLocation")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "workId", name = "workId", dataType = "int", required = true),
@@ -547,10 +545,14 @@
    public R<Object> orderNavigation(@RequestParam Integer workId, @RequestParam String longitude,
                                     @RequestParam String latitude) {
        Result<String> address = GaoDeMapUtil.getCityCode(longitude, latitude);
        System.err.println(address.getDatas());
        String cityCode = address.getDatas();
        System.err.println("城市code"+cityCode);
        String provinceCode = cityCode.substring(0, 2) + "0000";
        System.err.println("省份code"+provinceCode);
        Set<Integer> strings = new HashSet<>();
        strings.add(workId);
        redisService.setCacheSet("workerLocation:"+address.getDatas()+":", strings);
        redisService.setCacheSet("workerLocation:"+cityCode+":", strings);
        redisService.setCacheSet("workerLocation:"+provinceCode+":", strings);
        redisService.setCacheObject("work:"+workId+":", longitude+","+latitude);
        return R.ok();