liujie
2023-08-31 a0afbd1e36f74cb521c4d51b08a54f6a1fe538f2
src/main/java/com/stylefeng/guns/modular/system/controller/OrderController.java
@@ -4,6 +4,8 @@
import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.utils.HttpRequest;
import com.stylefeng.guns.modular.system.utils.RedisUtil;
import com.stylefeng.guns.modular.system.utils.tips.ErrorTip;
import com.stylefeng.guns.modular.system.utils.tips.SuccessTip;
import io.swagger.annotations.Api;
@@ -18,10 +20,7 @@
import java.math.BigDecimal;
import java.net.FileNameMap;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.*;
@Controller
@Api(tags = "订单")
@@ -66,6 +65,9 @@
    @Resource
    private ITGoodsService goodsService;
    @Autowired
    private RedisUtil redisUtil;
    /**
     * company 订单
@@ -296,6 +298,45 @@
        return new SuccessTip(page);
    }
    @ApiOperation(value = "上传司机位置",notes="上传司机位置")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType     = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "driverId", value = "driverId", required = true, dataType = "Integer"),
            @ApiImplicitParam(name = "lon", value = "lon", required = true, dataType = "String"),
            @ApiImplicitParam(name = "lat", value = "lat", required = true, dataType = "String"),
            @ApiImplicitParam(name = "type", value = "type", required = true, dataType = "int"),
    })
    @GetMapping(value = "/updateLonLat")
    @ResponseBody
    public Object updateLonLat(Integer driverId, String lon, String lat,int type){
        //  通过司机id获取订单
        List<TOrder> orders = orderService.selectList(new EntityWrapper<TOrder>().eq("nowDriverId", driverId));
        if(orders.size()>0){
            TOrder tOrder = orders.get(0);
            if(type==1){
                orderService.saveLonLat(tOrder.getId(),lon,lat);
            }
            redisUtil.setStrValue(tOrder.getId().toString(),lon+lat);
        }
        return new SuccessTip();
    }
    @ApiOperation(value = "获取订单司机位置",notes="获取订单司机位置")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType     = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "orderId", value = "orderId", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "lon", value = "lon", required = true, dataType = "String"),
            @ApiImplicitParam(name = "lat", value = "lat", required = true, dataType = "String"),
    })
    @GetMapping(value = "/getLonLat")
    @ResponseBody
    public Object getLonLat(Long orderId){
        //  通过司机id获取订单
        List<Map<String,Object>> orders = orderService.getLonLat(orderId);
        return new SuccessTip(orders);
    }
    @ApiOperation(value = "卡车公司--安排司机",notes="卡车公司--安排司机")