Pu Zhibing
2025-08-08 6dbd3b95671e6ac00a442b9866331397af1b10ba
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/shunfeng/controller/rideCommentController.java
@@ -10,22 +10,27 @@
import com.stylefeng.guns.modular.shunfeng.task.base.QuartzManager;
import com.stylefeng.guns.modular.shunfeng.task.base.TimeJobType;
import com.stylefeng.guns.modular.shunfeng.task.jobs.CourseExamineRide;
import com.stylefeng.guns.modular.shunfeng.util.DateUtil;
import com.stylefeng.guns.modular.shunfeng.util.OrderUtil;
import com.stylefeng.guns.modular.shunfeng.util.OrdersUtil;
import com.stylefeng.guns.modular.shunfeng.util.SensitiveWordUtil;
import com.stylefeng.guns.modular.system.dao.SensitiveWordsMapper;
import com.stylefeng.guns.modular.system.model.SensitiveWords;
import com.stylefeng.guns.modular.system.model.TCarBrand;
import com.stylefeng.guns.modular.system.model.UserInfo;
import com.stylefeng.guns.modular.system.service.ISystemNoticeService;
import com.stylefeng.guns.modular.system.service.ITCarBrandService;
import com.stylefeng.guns.modular.system.service.IUserInfoService;
import com.stylefeng.guns.modular.system.util.DateUtil;
import com.stylefeng.guns.modular.system.util.GDMapElectricFenceUtil;
import com.stylefeng.guns.modular.system.util.PushUtil;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.*;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
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.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -48,9 +53,6 @@
        /*顺风车设置*/
        @Autowired
        private IParamRideService paramRideService;
        /*系统设置*/
        @Autowired
        private IParamService paramService;
        /*定时任务*/
        @Autowired
        private ITimeTaskService timeTaskService;
@@ -59,7 +61,7 @@
        private IDriverRideService driverRideService;
        /*顺风车品牌*/
        @Autowired
        private IBrandService brandService;
        private ITCarBrandService carBrandService;
        /*评价*/
        @Autowired
        private IEvaluateService evaluateService;
@@ -98,11 +100,18 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/authentication")
    @PostMapping("/authentication")
    @ApiOperation(value = "发布顺风车行程实名认证", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id", dataType = "int"),
            @ApiImplicitParam(name = "name", value = "姓名", dataType = "string"),
            @ApiImplicitParam(name = "identity", value = "身份证", dataType = "string"),
            @ApiImplicitParam(name = "type", value = "1用户,2司机", dataType = "int"),
    })
    public Object authentication(Integer userId,String name,String  identity,Integer type) {
        try {
            if (userId == null || userId == 0) {
                return ApiJson.returnNG("userId不能为空");
                return ResultUtil.paranErr("userId不能为空");
            }
            /*发布顺风车行程实名认证*/
            UserApply apply=new UserApply();
@@ -120,6 +129,7 @@
                /*修改用户实名认证通过*/
                UserInfo userInfo=new UserInfo();
                userInfo.setId(userId);
                userInfo.setIsAuth(2);
                String sex = identity.substring(16, 17); //取指定位置的值(16位之后,17位结束;)
                int b = Integer.parseInt(sex);//强制类型转换
                if (b % 2 == 0) {
@@ -136,11 +146,11 @@
            applyService.insert(apply);
            Map<String,Object> reMap=new HashMap<>();
            reMap.put("auditState", aBoolean);
            return ApiJson.returnOK(reMap);
            return ResultUtil.success(reMap);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("异常");
        return ResultUtil.error("异常");
    }
    /**
@@ -150,11 +160,12 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/faceAuthentication")
    @PostMapping("/faceAuthentication")
    @ApiOperation(value = "人脸识别", httpMethod = "POST")
    public Object authentication(Integer userId,String headImg) {
//        try {
//            if (userId == null || userId == 0) {
//                return ApiJson.returnNG("userId不能为空");
//                return ResultUtil.paranErr("userId不能为空");
//            }
//            /*查询实名认证信息*/
//            UserApply apply=applyService.selectOne(new EntityWrapper<UserApply>().eq("userId",userId)
@@ -192,7 +203,7 @@
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
        return ApiJson.returnNG("异常");
        return ResultUtil.paranErr("异常");
    }
    /**
@@ -200,15 +211,16 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/getBrandList")
    @GetMapping("/getBrandList")
    @ApiOperation(value = "获取车辆品牌列表", httpMethod = "GET")
    public Object getBrandList(){
        try {
            List<Brand> brands=brandService.selectList(null);
            return ApiJson.returnOK(brands);
            List<TCarBrand> tCarBrands = carBrandService.selectList(null);
            return ApiJson.returnOK(tCarBrands);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("异常");
        return ResultUtil.error("异常");
    }
    /**
@@ -218,14 +230,19 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/homeOrderCount")
    @GetMapping("/homeOrderCount")
    @ApiOperation(value = "顺风车首页(待处理订单数)", httpMethod = "GET")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id", dataType = "int"),
            @ApiImplicitParam(name = "type", value = "1用户,2司机", dataType = "int"),
    })
    public Object homeOrderCount(Integer userId,Integer type){
        try {
            if(ToolUtil.isEmpty(userId)){
                return ApiJson.returnNG("userId不能为空");
                return ResultUtil.paranErr("userId不能为空");
            }
            if(ToolUtil.isEmpty(type)){
                return ApiJson.returnNG("type不能为空");
                return ResultUtil.paranErr("type不能为空");
            }
            Integer count=0;
@@ -244,7 +261,7 @@
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("获取异常");
        return ResultUtil.error("获取异常");
    }
    /**
@@ -254,14 +271,19 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/homeOrderList")
    @GetMapping("/homeOrderList")
    @ApiOperation(value = "顺风车首页(待处理订单列表)", httpMethod = "GET")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id", dataType = "int"),
            @ApiImplicitParam(name = "type", value = "1用户待处理订单:进行中的订单 2司机待处理订单:进行中的订单 3我的顺风车行程", dataType = "int"),
    })
    public Object homeOrderList(Integer userId,Integer type,Integer current,Integer size){
        try {
            if(ToolUtil.isEmpty(userId)){
                return ApiJson.returnNG("userId不能为空");
                return ResultUtil.paranErr("userId不能为空");
            }
            if(ToolUtil.isEmpty(type)){
                return ApiJson.returnNG("type不能为空");
                return ResultUtil.paranErr("type不能为空");
            }
            List<OrderRideVo> rideVoList=new ArrayList<>();
            OrderRideVo orderRideVo=new OrderRideVo();
@@ -284,7 +306,7 @@
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("获取异常");
        return ResultUtil.error("获取异常");
    }
    /**
@@ -293,7 +315,15 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/orderPrice")
    @PostMapping("/orderPrice")
    @ApiOperation(value = "根据输入的开始结束经纬度和人数获取订单价格", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "num", value = "人数", dataType = "int"),
            @ApiImplicitParam(name = "startLat", value = "起点纬度", dataType = "double"),
            @ApiImplicitParam(name = "startLon", value = "起点经度", dataType = "double"),
            @ApiImplicitParam(name = "endLat", value = "终点纬度", dataType = "double"),
            @ApiImplicitParam(name = "endLon", value = "终点经度", dataType = "double"),
    })
    public Object orderPrice(Integer num,Double startLat,Double startLon,Double endLat,Double endLon){
        try {
            String locationS=startLon+","+startLat;
@@ -337,7 +367,7 @@
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("获取异常");
        return ResultUtil.error("获取异常");
    }
    /**
@@ -352,27 +382,42 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/userAddOrder")
    @PostMapping("/userAddOrder")
    @ApiOperation(value = "用户下单", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id", dataType = "int"),
            @ApiImplicitParam(name = "startTime", value = "出行时间", dataType = "string"),
            @ApiImplicitParam(name = "num", value = "出行人数", dataType = "int"),
            @ApiImplicitParam(name = "startName", value = "起点名称", dataType = "string"),
            @ApiImplicitParam(name = "startLat", value = "起点纬度", dataType = "double"),
            @ApiImplicitParam(name = "startLon", value = "起点经度", dataType = "double"),
            @ApiImplicitParam(name = "endName", value = "终点名称", dataType = "string"),
            @ApiImplicitParam(name = "endLat", value = "终点纬度", dataType = "double"),
            @ApiImplicitParam(name = "endLon", value = "终点经度", dataType = "double"),
            @ApiImplicitParam(name = "money", value = "金额", dataType = "double"),
            @ApiImplicitParam(name = "isDai  1=是 2=否", value = "是否代喊  1=是 2=否", dataType = "int"),
            @ApiImplicitParam(name = "lxPhone", value = "联系电话", dataType = "string"),
    })
    public Object addOrder(Integer userId,String startTime,Integer num,String startName,Double startLat,Double startLon,Double endLat,Double endLon,
                           String endName,Double money,Integer isDai,String lxPhone){
        try {
            if(ToolUtil.isEmpty(userId)){
                return ApiJson.returnNG("userId不能为空");
                return ResultUtil.paranErr("userId不能为空");
            }
            if(ToolUtil.isEmpty(startTime)){
                return ApiJson.returnNG("startTime不能为空");
                return ResultUtil.paranErr("startTime不能为空");
            }
            if(ToolUtil.isEmpty(num)){
                return ApiJson.returnNG("num不能为空");
                return ResultUtil.paranErr("num不能为空");
            }
            if(ToolUtil.isEmpty(startName)){
                return ApiJson.returnNG("startName不能为空");
                return ResultUtil.paranErr("startName不能为空");
            }
            if(ToolUtil.isEmpty(endName)){
                return ApiJson.returnNG("endName不能为空");
                return ResultUtil.paranErr("endName不能为空");
            }
            if(ToolUtil.isEmpty(money)){
                return ApiJson.returnNG("money不能为空");
                return ResultUtil.paranErr("money不能为空");
            }
            /*用户只能发布一个进行中的行程*/
            /*EntityWrapper<OrderRide> entityWrapper=new EntityWrapper();
@@ -380,7 +425,7 @@
            entityWrapper.in("state","1,2,3,4");
            Integer count=orderRideService.selectCount(entityWrapper);
            if(count>0){
                return ApiJson.returnNG("还有进行中的订单");
                return ResultUtil.paranErr("还有进行中的订单");
            }*/
            /*用户可以发布多个订单*/
            ParamRide paramRide=paramRideService.selectOne(new EntityWrapper<ParamRide>().eq("type",2));
@@ -393,7 +438,7 @@
                }
            }
            OrderRide orderRide=new OrderRide();
            orderRide.setOrderNum(OrderUtil.getOrderNoForPrefix("ride"));
            orderRide.setOrderNum(OrdersUtil.getOrderNoForPrefix("ride"));
            orderRide.setPlatformMoney(platformMoney);
            orderRide.setAddTime(new Date());
            orderRide.setUserId(userId);
@@ -411,15 +456,9 @@
            orderRide.setState(1);//未支付状态
            orderRideService.insert(orderRide);
            //todo 定时人数  自动取消订单
            Param param = paramService.selectOne(new EntityWrapper<Param>().eq("type", 21));//顺风车支付倒计时设置(分钟)
            Integer time =10;
            Map<String,Object> reMap=new HashMap<>();
            if(param != null){
                time=Integer.parseInt(param.getContext());
                reMap.put("djs",time);
            }else{
                reMap.put("djs",time);
            }
            reMap.put("djs",time);
            reMap.put("orderId",orderRide.getId());
            reMap.put("addTime",orderRide.getAddTime());
            // 添加定时任务信息
@@ -435,11 +474,11 @@
            maps.put("orderId",orderRide.getId());
            maps.put("timeTaskId",timeTask.getId());
            QuartzManager.addJob(CourseExamineRide.class,(CourseExamineRide.DSCE+orderRide.getId()).toUpperCase(), TimeJobType.UNLOCK, DateUtil.getDate_strYMdHms(System.currentTimeMillis() + 1000*60*time) , maps);
            return ApiJson.returnOK(orderRide.getId());
            return ResultUtil.success(orderRide.getId());
        } catch (Exception e) {
            e.printStackTrace();
        }
            return ApiJson.returnNG("异常");
            return ResultUtil.error("异常");
        }
    /**
@@ -452,23 +491,35 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/driverAddTravel")
    @PostMapping("/driverAddTravel")
    @ApiOperation(value = "司机创建行程", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "driverId", value = "司机id", dataType = "int"),
            @ApiImplicitParam(name = "startTime", value = "出行时间", dataType = "string"),
            @ApiImplicitParam(name = "num", value = "出行人数", dataType = "int"),
            @ApiImplicitParam(name = "startName", value = "起点名称", dataType = "string"),
            @ApiImplicitParam(name = "startLat", value = "起点纬度", dataType = "double"),
            @ApiImplicitParam(name = "startLon", value = "起点经度", dataType = "double"),
            @ApiImplicitParam(name = "endName", value = "终点名称", dataType = "string"),
            @ApiImplicitParam(name = "endLat", value = "终点纬度", dataType = "double"),
            @ApiImplicitParam(name = "endLon", value = "终点经度", dataType = "double"),
    })
    public Object driverAddTravel(Integer driverId,String startTime,Integer num,String startName,String endName,Double startLat,Double startLon,Double endLat,Double endLon){
        try {
            if(ToolUtil.isEmpty(driverId)){
                return ApiJson.returnNG("driverId不能为空");
                return ResultUtil.paranErr("driverId不能为空");
            }
            if(ToolUtil.isEmpty(startTime)){
                return ApiJson.returnNG("startTime不能为空");
                return ResultUtil.paranErr("startTime不能为空");
            }
            if(ToolUtil.isEmpty(num)){
                return ApiJson.returnNG("num不能为空");
                return ResultUtil.paranErr("num不能为空");
            }
            if(ToolUtil.isEmpty(startName)){
                return ApiJson.returnNG("startName不能为空");
                return ResultUtil.paranErr("startName不能为空");
            }
            if(ToolUtil.isEmpty(endName)){
                return ApiJson.returnNG("endName不能为空");
                return ResultUtil.paranErr("endName不能为空");
            }
            /*用户的资料过期了不可以发布行程*/
            DriverRide driverRide=driverRideService.selectById(driverId);
@@ -479,12 +530,12 @@
                            || DateUtil.getDate(driverRide.getDutyInsuranceTime(), "yyyy-MM-dd").getTime()-new Date().getTime()<0
                            || DateUtil.getDate(driverRide.getAnnualInspectionTime(), "yyyy-MM-dd").getTime()-new Date().getTime()<0
                            ){
                        return ApiJson.returnNG("您的证件已过期,请重新上传资料");
                        return ResultUtil.error("您的证件已过期,请重新上传资料");
                    }
                }
                /*1一个司机可以创建多个行程*/
                OrderTravel orderTravel=new OrderTravel();
                orderTravel.setOrderNum(OrderUtil.getOrderNoForPrefix("travel"));
                orderTravel.setOrderNum(OrdersUtil.getOrderNoForPrefix("travel"));
                orderTravel.setAddTime(new Date());
                orderTravel.setDriverId(driverId);
                orderTravel.setStartTime(DateUtil.getDate(startTime,"yyyy-MM-dd HH:mm"));
@@ -504,7 +555,7 @@
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("异常");
        return ResultUtil.error("异常");
    }
@@ -527,51 +578,70 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/driverAudit")
    @PostMapping("/driverAudit")
    @ApiOperation(value = "用户申请顺风车司机/修改司机资料", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id", dataType = "int"),
            @ApiImplicitParam(name = "brandId", value = "品牌id", dataType = "int"),
            @ApiImplicitParam(name = "driverId", value = "司机id", dataType = "int"),
            @ApiImplicitParam(name = "carType", value = "车辆品牌", dataType = "string"),
            @ApiImplicitParam(name = "carNum", value = "车牌", dataType = "string"),
            @ApiImplicitParam(name = "inviteCodeRide", value = "别人的邀请码", dataType = "string"),
            @ApiImplicitParam(name = "license", value = "驾驶证号", dataType = "string"),
            @ApiImplicitParam(name = "licenseImg", value = "驾驶证图片", dataType = "string"),
            @ApiImplicitParam(name = "comInsuranceTime", value = "交强险到期时间", dataType = "string"),
            @ApiImplicitParam(name = "comInsuranceImg", value = "交强险照片", dataType = "string"),
            @ApiImplicitParam(name = "businessInsuranceTime", value = "商业险到期时间", dataType = "string"),
            @ApiImplicitParam(name = "businessInsuranceImg", value = "商业险图片", dataType = "string"),
            @ApiImplicitParam(name = "dutyInsuranceTime", value = "驾乘人员责任险到期时间", dataType = "string"),
            @ApiImplicitParam(name = "dutyInsuranceImg", value = "驾乘人员责任险照片", dataType = "string"),
            @ApiImplicitParam(name = "annualInspectionTime", value = "年检到期时间", dataType = "string"),
            @ApiImplicitParam(name = "annualInspectionImg", value = "年检图片", dataType = "string"),
    })
    public Object driverAudit(Integer userId,Integer brandId,Integer driverId,String carType,String carNum,String inviteCodeRide,String license,String licenseImg,String comInsuranceTime,String comInsuranceImg,
                              String businessInsuranceTime,String businessInsuranceImg,String dutyInsuranceTime,String dutyInsuranceImg,String annualInspectionTime,String annualInspectionImg){
        try {
            if(ToolUtil.isEmpty(userId)){
                return ApiJson.returnNG("userId不能为空");
                return ResultUtil.paranErr("userId不能为空");
            }
            if(ToolUtil.isEmpty(carType)){
                return ApiJson.returnNG("carType不能为空");
                return ResultUtil.paranErr("carType不能为空");
            }
            if(ToolUtil.isEmpty(brandId)){
                return ApiJson.returnNG("brandId不能为空");
                return ResultUtil.paranErr("brandId不能为空");
            }
            if(ToolUtil.isEmpty(carNum)){
                return ApiJson.returnNG("carNum不能为空");
                return ResultUtil.paranErr("carNum不能为空");
            }
            if(ToolUtil.isEmpty(license)){
                return ApiJson.returnNG("license不能为空");
                return ResultUtil.paranErr("license不能为空");
            }
            if(ToolUtil.isEmpty(licenseImg)){
                return ApiJson.returnNG("licenseImg不能为空");
                return ResultUtil.paranErr("licenseImg不能为空");
            }
            if(ToolUtil.isEmpty(comInsuranceTime)){
                return ApiJson.returnNG("comInsuranceTime不能为空");
                return ResultUtil.paranErr("comInsuranceTime不能为空");
            }
            if(ToolUtil.isEmpty(comInsuranceImg)){
                return ApiJson.returnNG("comInsuranceImg不能为空");
                return ResultUtil.paranErr("comInsuranceImg不能为空");
            }
            if(ToolUtil.isEmpty(businessInsuranceTime)){
                return ApiJson.returnNG("businessInsuranceTime不能为空");
                return ResultUtil.paranErr("businessInsuranceTime不能为空");
            }
            if(ToolUtil.isEmpty(businessInsuranceImg)){
                return ApiJson.returnNG("businessInsuranceImg不能为空");
                return ResultUtil.paranErr("businessInsuranceImg不能为空");
            }
            if(ToolUtil.isEmpty(dutyInsuranceTime)){
                return ApiJson.returnNG("dutyInsuranceTime不能为空");
                return ResultUtil.paranErr("dutyInsuranceTime不能为空");
            }
            if(ToolUtil.isEmpty(dutyInsuranceImg)){
                return ApiJson.returnNG("dutyInsuranceImg不能为空");
                return ResultUtil.paranErr("dutyInsuranceImg不能为空");
            }
            if(ToolUtil.isEmpty(annualInspectionTime)){
                return ApiJson.returnNG("annualInspectionTime不能为空");
                return ResultUtil.paranErr("annualInspectionTime不能为空");
            }
            if(ToolUtil.isEmpty(annualInspectionImg)){
                return ApiJson.returnNG("annualInspectionImg不能为空");
                return ResultUtil.paranErr("annualInspectionImg不能为空");
            }
            DriverRide driverRide=new DriverRide();
            driverRide.setBrandId(brandId);
@@ -635,7 +705,7 @@
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("异常");
        return ResultUtil.error("异常");
    }
    /**
@@ -644,23 +714,24 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/driverInfo")
    @GetMapping("/driverInfo")
    @ApiOperation(value = "获取司机资料", httpMethod = "GET")
    public Object driverInfo(Integer driverId){
        try {
            if(ToolUtil.isEmpty(driverId)){
                return ApiJson.returnNG("driverId不能为空");
                return ResultUtil.paranErr("driverId不能为空");
            }
            DriverRide driverRide=driverRideService.selectById(driverId);
            /*获取司机品牌id*/
            Brand b=brandService.selectById(driverRide.getBrandId());
            if(b!=null){
                driverRide.setCarType(b.getName());
            TCarBrand tCarBrand = carBrandService.selectById(driverRide.getBrandId());
            if(tCarBrand!=null){
                driverRide.setCarType(tCarBrand.getName());
            }
            return ApiJson.returnOK(driverRide);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("异常");
        return ResultUtil.error("异常");
    }
    /**
@@ -670,14 +741,19 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/cancelServiceMoney")
    @GetMapping("/cancelServiceMoney")
    @ApiOperation(value = "司机用户获取取消的服务费(同时计算退款金额)", httpMethod = "GET")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "int"),
            @ApiImplicitParam(name = "type", value = "1用户,2司机", dataType = "int")
    })
    public Object cancelServiceMoney(Integer orderId,Integer type){
        try {
            if(ToolUtil.isEmpty(orderId)){
                return ApiJson.returnNG("orderId不能为空");
                return ResultUtil.paranErr("orderId不能为空");
            }
            if(ToolUtil.isEmpty(type)){
                return ApiJson.returnNG("type不能为空");
                return ResultUtil.paranErr("type不能为空");
            }
            Double serviceMoney=0d;
            if(type==1){//用户
@@ -719,11 +795,11 @@
                }
                orderTravelService.updateById(orderTravel);//更新取消服务费
            }
            return ApiJson.returnOK(serviceMoney);
            return ResultUtil.success(serviceMoney);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("异常");
        return ResultUtil.error("异常");
    }
    /**
@@ -733,18 +809,19 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/userCancel")
    @PostMapping("/userCancel")
    @ApiOperation(value = "用户订单取消 待出行之前才可以取消", httpMethod = "POST")
    public Object userCancel(Integer orderId){
        try {
            if(ToolUtil.isEmpty(orderId)){
                return ApiJson.returnNG("orderId不能为空");
                return ResultUtil.paranErr("orderId不能为空");
            }
            /*查看这个订单是否在进行中*/
            OrderRide orderRide=orderRideService.selectById(orderId);
            if(orderRide!=null){
                /*查询该订单是否已经取消*/
                if(orderRide.getState()==6){
                    return ApiJson.returnNG("该订单已取消");
                    return ResultUtil.error("该订单已取消");
                }
                //用户取消给司机推送
                if(orderRide.getDriverId()!=null) {
@@ -762,11 +839,11 @@
                    orderTravelService.updateById(orderTravel);
                }
            }
            return ApiJson.returnOK("");
            return ResultUtil.success("");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("异常");
        return ResultUtil.error("异常");
    }
    //用户取消退款
    public void userCancelTuik(OrderRide orderRide){
@@ -775,7 +852,7 @@
        }
        if(orderRide.getTuiMoney()>0){
            Financial financial= financialService.selectOne(new EntityWrapper<Financial>().eq("orderNum",orderRide.getOrderNum()));
            String finNum=OrderUtil.getOrderNoForPrefix("fin");
            String finNum=OrdersUtil.getOrderNoForPrefix("fin");
            //todo 退款金额大于0需要退款
            if(orderRide.getPayType()==1){//余额
                UserInfo userInfo=userInfoService.selectById(orderRide.getUserId());
@@ -818,16 +895,17 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/driverCancel")
    @PostMapping("/driverCancel")
    @ApiOperation(value = "司机行程取消", httpMethod = "POST")
    public Object driverCancel(Integer orderId){
        try {
            if(ToolUtil.isEmpty(orderId)){
                return ApiJson.returnNG("orderId不能为空");
                return ResultUtil.paranErr("orderId不能为空");
            }
            OrderTravel orderTravel=orderTravelService.selectById(orderId);
            if(orderTravel!=null){
                if(orderTravel.getState()==6){
                    return ApiJson.returnNG("该订单已取消");
                    return ResultUtil.error("该订单已取消");
                }
                DriverRide driverRide=driverRideService.selectById(orderTravel.getDriverId());
                if(orderTravel.getServiceMoney()!=null && orderTravel.getServiceMoney()>0){
@@ -848,7 +926,7 @@
                    f.setMoney(orderTravel.getServiceMoney());
                    f.setPwType(9);//9=顺风车取消服务费
                    f.setOrderNum(orderTravel.getOrderNum());
                    String finNum=OrderUtil.getOrderNoForPrefix("fin");
                    String finNum=OrdersUtil.getOrderNoForPrefix("fin");
                    f.setLsType(finNum);
                    f.setUserId(driverRide.getUserId());
                    f.setOrderType(4);
@@ -878,11 +956,11 @@
                }
            }
            return ApiJson.returnOK("");
            return ResultUtil.success("");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("异常");
        return ResultUtil.error("异常");
    }
    /**
@@ -892,15 +970,21 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/driverOperation")
    @PostMapping("/driverOperation")
    @ApiOperation(value = "司机确认同行,接到乘客,送达乘客", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userOrderId", value = "用户订单id", dataType = "int"),
            @ApiImplicitParam(name = "type", value = "1确认同行 2接到乘客,3送达乘客", dataType = "int"),
            @ApiImplicitParam(name = "driverOrderId", value = "司机订单id", dataType = "int")
    })
    @Transactional
    public Object driverOperation(Integer userOrderId,Integer type,Integer driverOrderId){
        try {
            if(ToolUtil.isEmpty(driverOrderId)){
                return ApiJson.returnNG("driverOrderId不能为空");
                return ResultUtil.paranErr("driverOrderId不能为空");
            }
            if(ToolUtil.isEmpty(type)){
                return ApiJson.returnNG("type不能为空");
                return ResultUtil.paranErr("type不能为空");
            }
            OrderTravel orderTravel=orderTravelService.selectById(driverOrderId);//司机行程
            /*用户的资料过期了不可以发布行程*/
@@ -911,17 +995,17 @@
                        || DateUtil.getDate(driverRide.getDutyInsuranceTime(), "yyyy-MM-dd").getTime()-new Date().getTime()<0
                        || DateUtil.getDate(driverRide.getAnnualInspectionTime(), "yyyy-MM-dd").getTime()-new Date().getTime()<0
                        ){
                    return ApiJson.returnNG("您的证件已过期,请重新上传资料");
                    return ResultUtil.error("您的证件已过期,请重新上传资料");
                }
            }
            OrderRide orderRide=orderRideService.selectById(userOrderId);
            if(orderRide!=null && orderRide.getState()==6){
                return  ApiJson.returnNG("用户已取消该行程");
                return  ResultUtil.error("用户已取消该行程");
            }
            if(orderTravel!=null){
                if(type==1){//1确认同行 一个行程只能匹配一个订单
                    if(orderTravel.getState()==3){
                        return ApiJson.returnNG("该行程已经绑定了用户订单");
                        return ResultUtil.error("该行程已经绑定了用户订单");
                    }
                    orderTravel.setState(3);
                    //绑定司机行程、设置用户订单状态
@@ -947,7 +1031,7 @@
                    f.setPayType("1");//余额
                    f.setMoney(orderRide.getMoney()-orderRide.getPlatformMoney());//司机提成
                    f.setPwType(11);//顺风车司机提成
                    f.setLsType(OrderUtil.getOrderNoForPrefix("finan"));
                    f.setLsType(OrdersUtil.getOrderNoForPrefix("finan"));
                    f.setUserId(userInfo.getId());
                    f.setOrderType(4);
                    f.setLx(1);
@@ -956,11 +1040,7 @@
                    if(ToolUtil.isNotEmpty(driverRide.getByInviteCode())){
                        /*计算推广用户的提成*/
                        UserInfo userInfo1=userInfoService.selectOne(new EntityWrapper<UserInfo>().eq("inviteCodeRide",driverRide.getByInviteCode()));
                        Param param=paramService.selectOne(new EntityWrapper<Param>().eq("type",22));
                        Double discount=100d;
                        if(param!=null){
                            discount=Double.valueOf(param.getContext());
                        }
                        Double money=orderRide.getMoney()*discount/100;//提成金额
                        userInfoService.updateById(userInfo1);
                        
@@ -969,7 +1049,7 @@
                        f.setPayType("1");//余额
                        f.setMoney(money);//邀请金额
                        f.setPwType(10);//分享收益
                        f.setLsType(OrderUtil.getOrderNoForPrefix("finan"));
                        f.setLsType(OrdersUtil.getOrderNoForPrefix("finan"));
                        f.setUserId(userInfo1.getId());
                        f.setOrderType(4);
                        f.setLx(1);
@@ -990,11 +1070,11 @@
                }
            }
            pushUtil.pushOrderState(1, orderRide.getUserId(), orderRide.getId(), 8, orderRide.getState(), null);
            return ApiJson.returnOK("");
            return ResultUtil.success("");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("异常");
        return ResultUtil.error("异常");
    }
    /**
     * 用户评价
@@ -1006,20 +1086,28 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/evaluate")
    @PostMapping("/evaluate")
    @ApiOperation(value = "用户评价", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "int"),
            @ApiImplicitParam(name = "driverId", value = "司机id", dataType = "int"),
            @ApiImplicitParam(name = "userId", value = "用户id", dataType = "int"),
            @ApiImplicitParam(name = "score", value = "评分", dataType = "int"),
            @ApiImplicitParam(name = "content", value = "评价内容", dataType = "string")
    })
    public Object evaluate(Integer orderId,Integer driverId,Integer userId,Integer score,String  content){
        try {
            if(userId == null || userId == 0){
                return ApiJson.returnNG("userId不能为空");
                return ResultUtil.paranErr("userId不能为空");
            }
            if(driverId == null || driverId == 0){
                return ApiJson.returnNG("driverId不能为空");
                return ResultUtil.paranErr("driverId不能为空");
            }
            if(orderId == null || orderId == 0){
                return ApiJson.returnNG("orderId不能为空");
                return ResultUtil.paranErr("orderId不能为空");
            }
            if(score == null || score == 0){
                return ApiJson.returnNG("score不能为空");
                return ResultUtil.paranErr("score不能为空");
            }
            Evaluate evaluate=new Evaluate();
            evaluate.setAddTime(new Date());
@@ -1037,7 +1125,7 @@
                SensitiveWordUtil.init(sensitiveWordSet);
                boolean result = SensitiveWordUtil.contains(content);
                if(result){
                    return ApiJson.returnNG("评价内容包含敏感词");
                    return ResultUtil.error("评价内容包含敏感词");
                }
            }
            evaluate.setContent(content);
@@ -1064,11 +1152,11 @@
            orderRideService.updateById(orderTaxi);
            evaluateService.insert(evaluate);
            /*需要反订单数据*/
            return ApiJson.returnOK(orderId);
            return ResultUtil.success(orderId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("");
        return ResultUtil.error("");
    }
    /**
@@ -1081,17 +1169,26 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/complaints")
    @PostMapping("/complaints")
    @ApiOperation(value = "投诉", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "driverId", value = "司机id", dataType = "int"),
            @ApiImplicitParam(name = "userId", value = "用户id", dataType = "int"),
            @ApiImplicitParam(name = "content", value = "投诉内容", dataType = "string"),
            @ApiImplicitParam(name = "reMark", value = "备注", dataType = "string"),
            @ApiImplicitParam(name = "type", value = "1=顺风车用户,2=顺风车司机", dataType = "int"),
            @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "int")
    })
    public Object complaints(Integer driverId,Integer userId,String  content,String reMark,Integer type,Integer orderId) {
        try {
            if (userId == null || userId == 0) {
                return ApiJson.returnNG("userId不能为空");
                return ResultUtil.paranErr("userId不能为空");
            }
            if (driverId == null || driverId == 0) {
                return ApiJson.returnNG("driverId不能为空");
                return ResultUtil.paranErr("driverId不能为空");
            }
            if (orderId == null || orderId == 0) {
                return ApiJson.returnNG("orderId不能为空");
                return ResultUtil.paranErr("orderId不能为空");
            }
            Complaints complaints=new Complaints();
            complaints.setAddTime(new Date());
@@ -1106,7 +1203,7 @@
            SensitiveWordUtil.init(sensitiveWordSet);
            boolean result = SensitiveWordUtil.contains(content);
            if(result){
                return ApiJson.returnNG("投诉内容包含敏感词");
                return ResultUtil.error("投诉内容包含敏感词");
            }
            complaints.setContent(content);
            complaints.setReMark(reMark);
@@ -1134,11 +1231,11 @@
                orderTravel.setIsComplaint(2);
                orderTravelService.updateById(orderTravel);
            }
            return ApiJson.returnOK("投诉成功");
            return ResultUtil.success("投诉成功");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("");
        return ResultUtil.error("");
    }
    /**
     *  用户邀请司机接单(需要发送消息)
@@ -1147,14 +1244,19 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/userInvite")
    @PostMapping("/userInvite")
    @ApiOperation(value = "用户邀请司机接单(需要发送消息)", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id", dataType = "int"),
            @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "int")
    })
    public Object myOrders(Integer orderId,Integer userId){
        try {
            if(ToolUtil.isEmpty(orderId)){
                return ApiJson.returnNG("orderId不能为空");
                return ResultUtil.paranErr("orderId不能为空");
            }
            if(ToolUtil.isEmpty(userId)){
                return ApiJson.returnNG("userId不能为空");
                return ResultUtil.paranErr("userId不能为空");
            }
            OrderTravel orderTravel=orderTravelService.selectById(orderId);
            UserInfo userInfo_=userInfoService.selectOne(new EntityWrapper<UserInfo>().eq("driverId",orderTravel.getDriverId()));//司机用户
@@ -1169,11 +1271,11 @@
                    throw new RuntimeException(e);
                }
            }
            return ApiJson.returnOK("邀请成功");
            return ResultUtil.success("邀请成功");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("异常");
        return ResultUtil.error("异常");
    }
    /**
     * 用户订单匹配列表页面,用户订单去匹配司机的行程
@@ -1184,20 +1286,27 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/userMatchingOrderList")
    @PostMapping("/userMatchingOrderList")
    @ApiOperation(value = "用户订单匹配列表页面,用户订单去匹配司机的行程", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "int"),
            @ApiImplicitParam(name = "type", value = "1默认排序(根据线路、时间,人数综合匹配排序721),2时间最早,3距离最近", dataType = "int"),
            @ApiImplicitParam(name = "lon", value = "经度", dataType = "double"),
            @ApiImplicitParam(name = "lat", value = "纬度", dataType = "double"),
    })
    public Object userMatchingOrderList(Integer orderId,Integer current,Integer size,Integer type,Double lon,Double lat){
        try {
            if(ToolUtil.isEmpty(orderId)){
                return ApiJson.returnNG("orderId不能为空");
                return ResultUtil.paranErr("orderId不能为空");
            }
            if(ToolUtil.isEmpty(type)){
                return ApiJson.returnNG("type不能为空");
                return ResultUtil.paranErr("type不能为空");
            }
            if(ToolUtil.isEmpty(lon)){
                return ApiJson.returnNG("lon不能为空");
                return ResultUtil.paranErr("lon不能为空");
            }
            if(ToolUtil.isEmpty(lat)){
                return ApiJson.returnNG("lat不能为空");
                return ResultUtil.paranErr("lat不能为空");
            }
            OrderRide orderRide=orderRideService.selectById(orderId);
            current=current==null?1:current;
@@ -1212,11 +1321,11 @@
            orderRideVo.setNum(orderRide.getNum());
            orderRideVo.setType(type+1);//搜索条件:1默认排序(根据线路、时间,人数综合匹配排序721),2时间最早,3距离最近
            List<OrderRideVo> orderRides=orderTravelService.getOrderTravel(orderRideVo);
            return ApiJson.returnOK(orderRides);
            return ResultUtil.success(orderRides);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("异常");
        return ResultUtil.error("异常");
    }
    /**
@@ -1230,21 +1339,28 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/driverMatchingOrderList")
    @PostMapping("/driverMatchingOrderList")
    @ApiOperation(value = "司机订单匹配列表页面(司机的订单去匹配乘客订单)", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "int"),
            @ApiImplicitParam(name = "type", value = "1默认排序(根据线路、时间,人数综合匹配排序721),2时间最早,3距离最近,4价格最低", dataType = "int"),
            @ApiImplicitParam(name = "lon", value = "经度", dataType = "double"),
            @ApiImplicitParam(name = "lat", value = "纬度", dataType = "double"),
    })
    public Object driverMatchingOrderList(Integer orderId,Integer current,Integer size,Integer type,Double lon,Double lat){
        try {
            try {
                if(ToolUtil.isEmpty(orderId)){
                    return ApiJson.returnNG("orderId不能为空");
                    return ResultUtil.paranErr("orderId不能为空");
                }
                if(ToolUtil.isEmpty(type)){
                    return ApiJson.returnNG("type不能为空");
                    return ResultUtil.paranErr("type不能为空");
                }
                if(ToolUtil.isEmpty(lon)){
                    return ApiJson.returnNG("lon不能为空");
                    return ResultUtil.paranErr("lon不能为空");
                }
                if(ToolUtil.isEmpty(lat)){
                    return ApiJson.returnNG("lat不能为空");
                    return ResultUtil.paranErr("lat不能为空");
                }
                OrderTravel orderTravel=orderTravelService.selectById(orderId);
                current=current==null?1:current;
@@ -1259,14 +1375,14 @@
                orderRideVo.setLat(lat);
                orderRideVo.setType(type+1);//搜索条件:1默认排序(根据线路、时间,人数综合匹配排序721),2时间最早,3距离最近,4价格最低
                List<OrderRideVo> orderRides=orderRideService.getOrderRide(orderRideVo);
                return ApiJson.returnOK(orderRides);
                return ResultUtil.success(orderRides);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("异常");
        return ResultUtil.error("异常");
    }
    /**
@@ -1276,14 +1392,21 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/orderInfo")
    @GetMapping("/orderInfo")
    @ApiOperation(value = "订单详情", httpMethod = "GET")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "int"),
            @ApiImplicitParam(name = "type", value = "1=用户订单,2=司机订单", dataType = "int"),
            @ApiImplicitParam(name = "lon", value = "经度", dataType = "double"),
            @ApiImplicitParam(name = "lat", value = "纬度", dataType = "double"),
    })
    public Object orderInfo(Integer orderId,Integer type,Double lon,Double lat) {
        try {
            if(ToolUtil.isEmpty(orderId)){
                return ApiJson.returnNG("orderId不能为空");
                return ResultUtil.paranErr("orderId不能为空");
            }
            if(ToolUtil.isEmpty(type)){
                return ApiJson.returnNG("type不能为空");
                return ResultUtil.paranErr("type不能为空");
            }
            //取司机的经纬度
            OrderRideInfoVo orderRideInfoVo=new OrderRideInfoVo();
@@ -1297,19 +1420,13 @@
                orderRideInfoVo=orderTravelService.getOrderInfo(orderRideInfoVo);
            }
            /*获取顺风车订单支付倒计时*/
            Param param = paramService.selectOne(new EntityWrapper<Param>().eq("type", 21));//顺风车支付倒计时设置(分钟)
            Integer time =10;
            if(param != null){
                time=Integer.parseInt(param.getContext());
                orderRideInfoVo.setDjs(time);
            }else{
                orderRideInfoVo.setDjs(time);
            }
            return ApiJson.returnOK(orderRideInfoVo);
            orderRideInfoVo.setDjs(time);
            return ResultUtil.success(orderRideInfoVo);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return ApiJson.returnNG("异常");
            return ResultUtil.error("异常");
        }
    /**
@@ -1319,14 +1436,15 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/checkInviteCode")
    @PostMapping("/checkInviteCode")
    @ApiOperation(value = "验证输入的邀请码是否正确", httpMethod = "POST")
    public Object orderInfo(String inviteCode,Integer type) {
        try {
            if(ToolUtil.isEmpty(inviteCode)){
                return ApiJson.returnNG("inviteCode不能为空");
                return ResultUtil.paranErr("inviteCode不能为空");
            }
            if(ToolUtil.isEmpty(type)){
                return ApiJson.returnNG("type不能为空");
                return ResultUtil.paranErr("type不能为空");
            }
            Integer count=0;
            if(type==1){
@@ -1334,11 +1452,11 @@
            }else {
                count=userInfoService.selectCount(new EntityWrapper<UserInfo>().eq("inviteCodeRide",inviteCode));
            }
            return ApiJson.returnOK(count);
            return ResultUtil.success(count);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("异常");
        return ResultUtil.error("异常");
    }
    /**
@@ -1348,11 +1466,12 @@
     * @return
     */
    @ResponseBody
    @RequestMapping("/checkInsuranceTime")
    @PostMapping("/checkInsuranceTime")
    @ApiOperation(value = "验证司机证件是否过期", httpMethod = "POST")
    public Object orderInfo(Integer driverId) {
        try {
            if(ToolUtil.isEmpty(driverId)){
                return ApiJson.returnNG("driverId不能为空");
                return ResultUtil.paranErr("driverId不能为空");
            }
            DriverRide driverRide=driverRideService.selectById(driverId);
            Integer count=0;
@@ -1365,11 +1484,11 @@
                    count=1;
                }
            }
            return ApiJson.returnOK(count);
            return ResultUtil.success(count);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ApiJson.returnNG("异常");
        return ResultUtil.error("异常");
    }
}