xuhy
2025-02-21 d7e2a44ef2525d121a8fea9daa4b5b7fad42eb61
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
package com.ruoyi.worker.controller;
 
 
import cn.afterturn.easypoi.cache.manager.IFileLoader;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.constant.Constants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.core.exception.GlobalException;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.GaoDeMapUtil;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.order.api.entity.ChangeDispatch;
import com.ruoyi.order.api.entity.Order;
import com.ruoyi.order.api.entity.OrderDetailVO;
import com.ruoyi.order.api.entity.OrderSubmitRequest;
import com.ruoyi.order.api.feignClient.ExchangeDispatchClient;
import com.ruoyi.order.api.feignClient.OrderClient;
import com.ruoyi.system.api.model.LoginUserInfo;
import com.ruoyi.worker.entity.MasterWorker;
import com.ruoyi.worker.entity.RecoveryServe;
import com.ruoyi.worker.service.MasterWorkerService;
import com.ruoyi.worker.service.RecoveryServeService;
import com.ruoyi.worker.vo.ServeCoordinate;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import javax.annotation.Resource;
 
import lombok.Synchronized;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
/**
 * <p>
 * 订单管理 前端控制器
 * </p>
 *
 * @author hjl
 * @since 2024-06-05
 */
@RestController
@RequestMapping("/master/order")
@Api(value = "师傅端", tags = "师傅端")
public class OrderController {
 
    @Resource
    private TokenService tokenService;
    @Resource
    private MasterWorkerService masterWorkerService;
    @Resource
    private OrderClient orderClient;
    @Resource
    private ExchangeDispatchClient dispatchClient;
    @Resource
    private RecoveryServeService recoveryServeService;
 
    @Resource
    private RedisService redisService;
 
    /**
     * linux服务器保存订单轨迹文件夹
     */
     private static final String BASE_PATH = "/usr/local/coordinate/";
//    private static final String BASE_PATH = "F:/DeskTop/coordinate/";
     private static final String BASE_MARKER_PATH = "/usr/local/marker/";
//    private static final String BASE_PATH = "D:/Desktop/coordinate/";
//    private static final String BASE_MARKER_PATH = "F:/DeskTop/marker/";
    /**
     * 师傅端-获取订单列表
     *
     * @param state 订单状态(0:全部、1:待上门、2:已完结)
     */
    @ApiOperation(value = "订单列表", tags = {"师傅端-订单列表"})
    @GetMapping(value = "/orderList")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单状态(0:全部、1:待上门、2:已完结)", name = "state", dataType = "Integer", required = true)
    })
    public R<Page<Order>> orderList(@RequestParam Integer state,
                                    @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        LoginUserInfo loginWorker = tokenService.getLoginUserByWorker();
        if (null == loginWorker) {
            return R.loginExpire("登录失效!");
        }
        Page<Order> dataList = orderClient.orderListWorker(loginWorker.getUserid(), state, pageNum, pageSize).getData();
        List<Order> orderList = dataList.getRecords();
        List<Integer> ids = orderList.stream().map(Order::getServeId).collect(Collectors.toList());
        if (!ids.isEmpty()) {
            List<RecoveryServe> serveList = recoveryServeService.lambdaQuery()
                    .in(RecoveryServe::getId, ids).list();
            Map<Integer, String> map = serveList.stream().collect(Collectors.toMap(RecoveryServe::getId,
                    mw -> Optional.ofNullable(mw.getCover()).orElse("")));
            for (Order order : orderList) {
                order.setCover(map.get(order.getServeId()));
                if (order.getAddress()!=null) {
                    order.setReservationAddress(order.getReservationAddress() + order.getAddress());
                }
            }
        }
        return R.ok(dataList);
    }
 
    /**
     * 师傅端-申请订单改派
     *
     * @param orderId 订单id
     */
    @ApiOperation(value = "申请订单改派", tags = {"师傅端-订单列表"})
    @GetMapping(value = "/applyChange")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "String", required = true),
            @ApiImplicitParam(value = "改派原因", name = "reason", dataType = "String", required = true)
    })
    @Transactional(rollbackFor = Exception.class)
    public R<String> applyChange(@RequestParam String orderId, @RequestParam String reason) {
        LoginUserInfo loginWorker = tokenService.getLoginUserByWorker();
        if (null == loginWorker) {
            return R.loginExpire("登录失效!");
        }
        ChangeDispatch data = dispatchClient.changeDispatchOne(orderId).getData();
        if (null != data) {
            if (Constants.ZERO.equals(data.getState())) {
                return R.fail("当前订单已提交改派申请,请等待改派!");
            } else if (Constants.ONE.equals(data.getState())) {
                return R.fail("当前等单已改派!");
            }
        }
        MasterWorker masterWorker = masterWorkerService.getById(loginWorker.getUserid());
        // 订单改派信息
        ChangeDispatch changeDispatch = new ChangeDispatch();
        changeDispatch.setWorkerId(masterWorker.getId());
        changeDispatch.setWorkerName(masterWorker.getRealName());
        changeDispatch.setApplyReason(reason);
        changeDispatch.setApplyTime(DateUtils.getNowDate());
        changeDispatch.setState(Constants.ZERO);
        Boolean result = orderClient.changeOrderState(orderId, Constants.SIX).getData();
        Order order = orderClient.detail(orderId).getData();
        if (null == order) {
            throw new GlobalException("订单信息异常!");
        }
        changeDispatch.setOrderId(orderId);
        changeDispatch.setOrderNumber(order.getOrderNumber());
        changeDispatch.setUserId(order.getUserId());
        changeDispatch.setUserName(order.getReservationName());
        // 添加改派信息
        Boolean save = dispatchClient.changeDispatchSave(changeDispatch).getData();
        return result && save ? R.ok() : R.fail();
    }
 
    /**
     * 师傅端-已到达预约地点
     *
     * @param orderId 订单id
     */
    @ApiOperation(value = "订单路线导航", tags = {"师傅端-首页"})
    @GetMapping(value = "/checkDistance")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "String", required = true),
            @ApiImplicitParam(value = "师傅所在经度", name = "longitude", dataType = "String", required = true),
            @ApiImplicitParam(value = "师傅所在纬度", name = "latitude", dataType = "String", required = true)
    })
    public R<Object> checkDistance(@RequestParam String orderId, @RequestParam String longitude,
                                   @RequestParam String latitude) {
        LoginUserInfo loginWorker = tokenService.getLoginUserByWorker();
        if (null == loginWorker) {
            return R.loginExpire("登录失效!");
        }
        // 校验经纬度
        Order order = orderClient.detail(orderId).getData();
        // 用户下单位置经纬度
        String orderPosition = order.getLongitude() + "," + order.getLatitude();
        // 师傅经纬度
        String workerPosition = longitude + "," + latitude;
        // 师傅当前位置离用户下单位置具体距离
        Long distance = GaoDeMapUtil.getDistance(orderPosition, workerPosition).getDatas();
        // 上传时判断是否在下单位置附件,距离大于某个值则 不允许上传
        if (distance > Constants.THREE_THOUSAND) {
//            throw new GlobalException("您当前手机定位超出当前订单预约地址范围 3km,无法提供回收服务!");
            return R.ok(Boolean.FALSE, "您当前手机定位超出当前订单预约地址范围 3km,无法提供回收服务!");
        }
        return R.ok(true);
    }
 
    /**
     * 师傅端-已到达预约地点
     *
     * @param orderId 订单id
     */
    @ApiOperation(value = "订单路线导航", tags = {"师傅端-首页"})
    @GetMapping(value = "/orderNavigation")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "String", required = true),
            @ApiImplicitParam(value = "师傅所在经度", name = "longitude", dataType = "String", required = true),
            @ApiImplicitParam(value = "师傅所在纬度", name = "latitude", dataType = "String", required = true)
    })
    public R<Object> orderNavigation(@RequestParam String orderId, @RequestParam String longitude,
                                     @RequestParam String latitude) {
        LoginUserInfo loginWorker = tokenService.getLoginUserByWorker();
        if (null == loginWorker) {
            return R.loginExpire("登录失效!");
        }
        return R.ok(orderClient.orderNavigation(orderId, loginWorker.getUserid(), longitude, latitude).getData());
    }
 
    /**
     * 师傅端-已到达预约地点
     *
     * @param orderId 订单id
     */
    @ApiOperation(value = "已到达预约地点", tags = {"师傅端-订单列表"})
    @GetMapping(value = "/reachPosition")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "orderId", name = "orderId", dataType = "Integer", required = true)
    })
    public R<Boolean> reachPosition(@RequestParam String orderId) {
        LoginUserInfo loginWorker = tokenService.getLoginUserByWorker();
        if (null == loginWorker) {
            return R.loginExpire("登录失效!");
        }
        return orderClient.reachPosition(orderId, loginWorker.getUserid());
    }
 
    /**
     * 师傅端-订单详情
     *
     * @param orderId 订单id
     */
    @ApiOperation(value = "订单详情", tags = {"师傅端-订单列表"})
    @GetMapping(value = "/orderDetail")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "String", required = true)
    })
    public R<OrderDetailVO> orderDetail(@RequestParam String orderId) {
        LoginUserInfo loginWorker = tokenService.getLoginUserByWorker();
        if (null == loginWorker) {
            return R.loginExpire("登录失效!");
        }
        R<OrderDetailVO> orderDetail = orderClient.orderDetail(orderId);
        if (null == orderDetail) {
            return R.fail();
        }
        OrderDetailVO data = orderDetail.getData();
        Integer serveId = data.getOrderInfo().getServeId();
        RecoveryServe recoveryServe = recoveryServeService.lambdaQuery()
                .eq(RecoveryServe::getId, serveId).one();
        if (null != recoveryServe) {
            data.getOrderInfo().setCover(recoveryServe.getCover());
        }
        return R.ok(data);
    }
 
    /**
     * 师傅端-订单详情
     *
     * @param orderSubmitRequest 提交订单信息
     */
    @ApiOperation(value = "订单完工-提交订单", tags = {"师傅端-订单列表"})
    @PostMapping(value = "/orderSubmit")
    public R<Boolean> orderSubmit(@RequestBody OrderSubmitRequest orderSubmitRequest) {
        LoginUserInfo loginWorker = tokenService.getLoginUserByWorker();
        if (null == loginWorker) {
            return R.loginExpire("登录失效!");
        }
        return orderClient.orderSubmit(orderSubmitRequest);
    }
    private static final double EARTH_RADIUS_METERS = 6371000.0;
    /**
     * 师傅端-定时调度记录师傅所走路线经纬度
     *
     * @param longitude 经度
     * @param latitude  纬度
     */
    @ApiOperation(value = "订单进行-记录全天路线经纬度", tags = {"师傅端-订单列表"})
    @GetMapping(value = "/coordinate")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "经度", name = "longitude", dataType = "Integer", required = true),
            @ApiImplicitParam(value = "纬度", name = "latitude", dataType = "Integer", required = true)
    })
    @Synchronized
    public R<Boolean> coordinate(@RequestParam Double longitude, @RequestParam Double latitude) {
 
        System.err.println("调用记录经纬度"+ LocalDateTime.now());
 
        LoginUserInfo loginWorker = tokenService.getLoginUserByWorker();
        if (null == loginWorker) {
            return R.loginExpire("登录失效!");
        }
        Object cacheObject2 = redisService.getCacheObject("LOCK" + loginWorker.getUserid());
        if (cacheObject2!=null){
            return R.ok();
        }else {
            redisService.setCacheObject("LOCK" + loginWorker.getUserid(),"1", 10L, TimeUnit.SECONDS);
        }
 
        // 获取当天时间
        String today = DateUtils.dateTimeNow("yyyy-MM-dd");
        Integer workerId = loginWorker.getUserid();
        ServeCoordinate serveCoordinate = new ServeCoordinate();
        serveCoordinate.setWorkerId(workerId);
        serveCoordinate.setDate(today);
        serveCoordinate.setCoordinate(longitude + "," + latitude);
        serveCoordinate.setLongitude(longitude);
        serveCoordinate.setLatitude(latitude);
        List<ServeCoordinate> list = new ArrayList<>();
        list.add(serveCoordinate);
        String jsonString = JSONObject.toJSONString(list);
        // 检查师傅ID的文件夹是否存在,不存在则创建
        String masterFolderPath = BASE_PATH + workerId;
        File masterFolder = new File(masterFolderPath);
        if (!masterFolder.exists()) {
            // 创建师傅ID的文件夹
            masterFolder.mkdirs();
        }
 
        // 检查订单ID的JSON文件是否存在,不存在则创建
        String jsonFilePath = masterFolderPath + "/" + today + ".json";
        File jsonFile = new File(jsonFilePath);
        if (!jsonFile.exists()) {
            try {
                // 创建订单ID的JSON文件
                jsonFile.createNewFile();
                // 首次记录轨迹
                FileWriter writer = new FileWriter(jsonFile);
                writer.write(jsonString);
                writer.close();
            } catch (IOException e) {
                return R.fail(e.getMessage());
            }
        } else {
            // 读取订单ID的JSON文件内容
            try {
                String jsonContent = new String(Files.readAllBytes(Paths.get(jsonFilePath)));
                List<ServeCoordinate> coordinate = JSONObject.parseObject(jsonContent, List.class);
                // 订单轨迹信息
                ServeCoordinate data = new ServeCoordinate();
                data.setWorkerId(workerId);
                data.setDate(today);
                data.setCoordinate(longitude + "," + latitude);
                data.setLongitude(longitude);
                data.setLatitude(latitude);
                coordinate.add(data);
                String itemStr = JSONObject.toJSONString(coordinate);
                FileWriter writer = new FileWriter(jsonFile);
                writer.write(itemStr);
                writer.close();
            } catch (IOException e) {
                return R.fail(e.getMessage());
            }
        }
 
 
        //拿到三十分钟之前的时间,并已 yyyy-MM-dd HH:mm格式存储
        // 当前时间
        LocalDateTime now = LocalDateTime.now();
 
        // 减去三十分钟
        LocalDateTime thirtyMinutesAgo = now.minusMinutes(5);
 
        // 定义日期时间格式
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
 
        // 格式化时间
        String formattedTime = thirtyMinutesAgo.format(formatter);
        String nowStr = now.format(formatter);
 
 
        redisService.setCacheObject("MARK:"+workerId+":"+nowStr,longitude + "," + latitude, 10L, TimeUnit.MINUTES);
 
        String cacheObject = redisService.getCacheObject("MARK:" + workerId + ":" + formattedTime);
        if (cacheObject!=null){
 
            String cacheObject1 = redisService.getCacheObject("TIME:" + workerId);
            if (cacheObject1==null){
                cacheObject1 = "2000-09-06 20:24:10.740";
            }
        // 定义日期时间格式
        DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
 
        // 解析字符串为 LocalDateTime
        LocalDateTime localDateTime = LocalDateTime.parse(cacheObject1, formatter1);
            if (isWithinTwoMinutes(localDateTime, now)){
            //计算两点之间的距离
            String[] split = cacheObject.split(",");
            String longitude1 = split[0];
            String latitude1 = split[1];
            double longitude1Double = Double.parseDouble(longitude1);
            double latitude1Double = Double.parseDouble(latitude1);
            double lat1Rad = Math.toRadians(latitude);
            double lon1Rad = Math.toRadians(longitude);
            double lat2Rad = Math.toRadians(latitude1Double);
            double lon2Rad = Math.toRadians(longitude1Double);
 
            // 计算经纬度差值
            double dlon = lon2Rad - lon1Rad;
            double dlat = lat2Rad - lat1Rad;
 
            // Haversine 公式
            double a = Math.pow(Math.sin(dlat / 2), 2) +
                    Math.cos(lat1Rad) * Math.cos(lat2Rad) *
                            Math.pow(Math.sin(dlon / 2), 2);
            double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
            // 计算距离
            double distance = EARTH_RADIUS_METERS * c;
            System.err.println("-----当前距离"+distance);
            //如果超出一定范围,存入Mark文件
            if (distance<50){
                redisService.setCacheObject("TIME:"+workerId,LocalDateTime.now(), 10L, TimeUnit.MINUTES);
                marker(longitude,latitude);
            }
            }
        }
 
 
        redisService.deleteObject("LOCK" + loginWorker.getUserid());
        return R.ok();
    }
 
    public static boolean isWithinTwoMinutes(LocalDateTime dateTime1, LocalDateTime dateTime2) {
        // 计算两个时间之间的差值
        Duration duration = Duration.between(dateTime1, dateTime2);
 
        // 检查差值是否小于等于2分钟
        long minutes = Math.abs(duration.toMinutes());
        return minutes >= 5;
    }
    /**
     * 师傅端-定时调度记录师傅当天的轨迹标点
     *
     * @param longitude 经度
     * @param latitude  纬度
     */
    @ApiOperation(value = "订单进行-记录当天的轨迹标点", tags = {"师傅端-订单列表"})
    @GetMapping(value = "/marker")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "经度", name = "longitude", dataType = "Integer", required = true),
            @ApiImplicitParam(value = "纬度", name = "latitude", dataType = "Integer", required = true)
    })
    public R<Boolean> marker(@RequestParam Double longitude, @RequestParam Double latitude) {
        System.err.println("调用标点"+ LocalDateTime.now());
        LoginUserInfo loginWorker = tokenService.getLoginUserByWorker();
        if (null == loginWorker) {
            return R.loginExpire("登录失效!");
        }
        // 获取当天时间
        String today = DateUtils.dateTimeNow("yyyy-MM-dd");
//        Integer workerId = 1;
         Integer workerId = loginWorker.getUserid();
        ServeCoordinate serveCoordinate = new ServeCoordinate();
        serveCoordinate.setWorkerId(workerId);
        serveCoordinate.setDate(today);
        serveCoordinate.setCoordinate(longitude + "," + latitude);
        serveCoordinate.setLongitude(longitude);
        serveCoordinate.setLatitude(latitude);
        List<ServeCoordinate> list = new ArrayList<>();
        list.add(serveCoordinate);
        String jsonString = JSONObject.toJSONString(list);
        // 检查师傅ID的文件夹是否存在,不存在则创建
        String masterFolderPath = BASE_MARKER_PATH + workerId;
        File masterFolder = new File(masterFolderPath);
        if (!masterFolder.exists()) {
            // 创建师傅ID的文件夹
            masterFolder.mkdirs();
        }
 
        // 检查今天的JSON文件是否存在,不存在则创建
        String jsonFilePath = masterFolderPath + "/" + today + ".json";
        File jsonFile = new File(jsonFilePath);
        if (!jsonFile.exists()) {
            try {
                // 创建今天的JSON文件
                jsonFile.createNewFile();
                // 首次记录标点
                FileWriter writer = new FileWriter(jsonFile);
                writer.write(jsonString);
                writer.close();
            } catch (IOException e) {
                return R.fail(e.getMessage());
            }
        } else {
            // 读取订单ID的JSON文件内容
            try {
                String jsonContent = new String(Files.readAllBytes(Paths.get(jsonFilePath)));
                List<ServeCoordinate> coordinate = JSONObject.parseObject(jsonContent, List.class);
                // 订单轨迹信息
                ServeCoordinate data = new ServeCoordinate();
                data.setWorkerId(workerId);
                data.setDate(today);
                data.setCoordinate(longitude + "," + latitude);
                data.setLongitude(longitude);
                data.setLatitude(latitude);
                coordinate.add(data);
                String itemStr = JSONObject.toJSONString(coordinate);
                FileWriter writer = new FileWriter(jsonFile);
                writer.write(itemStr);
                writer.close();
            } catch (IOException e) {
                return R.fail(e.getMessage());
            }
        }
        return R.ok();
    }
//    @ApiOperation(value = "算经纬度", tags = {"师傅端-订单列表"})
//    @GetMapping(value = "/distance")
//    @ApiImplicitParams({
//            @ApiImplicitParam(value = "经度", name = "longitude", dataType = "Integer", required = true),
//            @ApiImplicitParam(value = "纬度", name = "latitude", dataType = "Integer", required = true)
//    })
//    public R<Boolean> distance(@RequestParam Double longitude1, @RequestParam Double latitude1,@RequestParam Double longitude2, @RequestParam Double latitude2) {
//
//
//    }
 
    @ApiOperation(value = "上传经纬度", tags = {"师傅端-首页"})
    @GetMapping(value = "/putLocation")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "workId", name = "workId", dataType = "int", required = true),
            @ApiImplicitParam(value = "师傅所在经度", name = "longitude", dataType = "String", required = true),
            @ApiImplicitParam(value = "师傅所在纬度", name = "latitude", dataType = "String", required = true)
    })
    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());
        Set<Integer> strings = new HashSet<>();
        strings.add(workId);
        redisService.setCacheSet("workerLocation:"+address.getDatas()+":", strings);
        redisService.setCacheObject("work:"+workId+":", longitude+","+latitude);
        return R.ok();
 
    }
 
}