| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.GpsCoordinateUtils; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.crossCity.server.impl.OrderCrossCityServiceImpl; |
| | |
| | | return ResultUtil.error("有未完成的订单"); |
| | | } |
| | | |
| | | list = orderTaxiMapper.queryByState_(uid, 2, 1, 1, 2, 3, 4, 5, 6, 11); |
| | | list = orderTaxiMapper.queryByState_(uid, 2, 1, 1, 2, 3, 4, 5, 6, 7, 11, 12); |
| | | if(list.size() > 0 && orderTaxi.getOrderType() == 2){ |
| | | return ResultUtil.error("有未完成的订单"); |
| | | } |
| | |
| | | @Override |
| | | public List<Map<String, Object>> queryCoupon(Integer orderId, Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | OrderTaxi orderTaxi = this.selectById(orderId); |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon(uid, orderTaxi.getCompanyId(), 1, 2, orderTaxi.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(uid, orderTaxi.getCompanyId(), 1, 0, orderTaxi.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon(uid, null, 1, 2, orderTaxi.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(uid, null, 1, 0, orderTaxi.getOrderMoney(), pageNum, size); |
| | | list.addAll(list1); |
| | | return list; |
| | | } |
| | |
| | | UserCouponRecord userCouponRecord = null; |
| | | if(null != couponId){ |
| | | userCouponRecord = userCouponRecordService.selectById(couponId); |
| | | if(userCouponRecord.getCompanyId() != orderTaxi.getCompanyId()){ |
| | | return ResultUtil.error("优惠券不能用于此订单", ""); |
| | | } |
| | | // if(userCouponRecord.getCompanyId() != orderTaxi.getCompanyId()){ |
| | | // return ResultUtil.error("优惠券不能用于此订单", ""); |
| | | // } |
| | | if(userCouponRecord.getState() == 2){ |
| | | return ResultUtil.error("优惠券已使用", ""); |
| | | } |
| | |
| | | value = map.get("lon") + "," + map.get("lat"); |
| | | } |
| | | } |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(value, orderTaxi.getStartLon() + "," + orderTaxi.getStartLat(), 1); |
| | | // todo 注意 因更换地图为百度 两者lon和lat位置互换了 |
| | | String[] split = value.split(","); |
| | | value = split[1] + "," + split[0]; |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(value, orderTaxi.getStartLat() + "," + orderTaxi.getStartLon(), 1); |
| | | String d = "0"; |
| | | String t = "0"; |
| | | if(null == distance){ |
| | |
| | | orderServerWarpper.setOrderId(orderTaxi.getId()); |
| | | orderServerWarpper.setOrderType(2); |
| | | orderServerWarpper.setState(orderTaxi.getState()); |
| | | orderServerWarpper.setLon(null != value ? value.split(",")[0] : "0.0"); |
| | | orderServerWarpper.setLat(null != value ? value.split(",")[1] : "0.0"); |
| | | orderServerWarpper.setLon(null != value ? value.split(",")[1] : "0.0"); |
| | | orderServerWarpper.setLat(null != value ? value.split(",")[0] : "0.0"); |
| | | value = value == null ? "0.0,0.0" : value; |
| | | double[] doubles = GpsCoordinateUtils.calBD09toGCJ02(Double.parseDouble(value.split(",")[1]), Double.parseDouble(value.split(",")[0])); |
| | | orderServerWarpper.setNextLongitude(String.valueOf(doubles[0])); |
| | | orderServerWarpper.setNextLatitude(String.valueOf(doubles[1])); |
| | | // 起点地址转换 |
| | | doubles = GpsCoordinateUtils.calBD09toGCJ02(orderTaxi.getStartLat(), orderTaxi.getStartLon()); |
| | | orderServerWarpper.setStartLat(String.valueOf(doubles[0])); |
| | | orderServerWarpper.setStartLon(String.valueOf(doubles[1])); |
| | | // 终点地址转换 |
| | | doubles = GpsCoordinateUtils.calBD09toGCJ02(orderTaxi.getEndLat(), orderTaxi.getEndLon()); |
| | | orderServerWarpper.setEndLat(String.valueOf(doubles[0])); |
| | | orderServerWarpper.setEndLon(String.valueOf(doubles[1])); |
| | | orderServerWarpper.setReassignNotice(orderTaxi.getReassignNotice()); |
| | | if(orderTaxi.getState() == 2 || orderTaxi.getState() == 3){//前往预约地 |
| | | orderServerWarpper.setReservationMileage(d); |
| | |
| | | orderServerWarpper.setLaveTime("0"); |
| | | } |
| | | if(orderTaxi.getState() == 5 || orderTaxi.getState() == 6){//服务中 |
| | | distance = gdMapElectricFenceUtil.getDistance(value, orderTaxi.getEndLon() + "," + orderTaxi.getEndLat(), 1); |
| | | distance = gdMapElectricFenceUtil.getDistance(value, orderTaxi.getEndLat() + "," + orderTaxi.getEndLon(), 1); |
| | | if(null == distance){ |
| | | System.err.println("查询距离出错了"); |
| | | }else{ |
| | |
| | | orderTaxi.setPayMoney(query.getAmount()); |
| | | this.updateById(orderTaxi); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(orderTaxi.getUserId()); |
| | | SysIntegral query1 = sysIntegralMapper.query(orderTaxi.getCompanyId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分 |
| | | userInfoService.updateById(userInfo); |
| | | // UserInfo userInfo = userInfoService.selectById(orderTaxi.getUserId()); |
| | | // SysIntegral query1 = sysIntegralMapper.query(orderTaxi.getCompanyId()); |
| | | // userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分 |
| | | // userInfoService.updateById(userInfo); |
| | | |
| | | //处理优惠券和红包 |
| | | if(null != orderTaxi.getCouponId()){ |