| | |
| | | private Integer priceType; |
| | | @ApiModelProperty(value = "预估价") |
| | | @TableField("estimatedPrice") |
| | | private BigDecimal estimatedPrice; |
| | | private Double estimatedPrice; |
| | | |
| | | @ApiModelProperty(value = "上一次定位推送时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | |
| | | this.priceType = priceType; |
| | | } |
| | | |
| | | public BigDecimal getEstimatedPrice() { |
| | | public Double getEstimatedPrice() { |
| | | return estimatedPrice; |
| | | } |
| | | |
| | | public void setEstimatedPrice(BigDecimal estimatedPrice) { |
| | | public void setEstimatedPrice(Double estimatedPrice) { |
| | | this.estimatedPrice = estimatedPrice; |
| | | } |
| | | |
| | |
| | | orderPrivateCar.setState(7); |
| | | } |
| | | |
| | | if(new BigDecimal(orderPrivateCar.getPaymentAdvanceMoney()).compareTo(BigDecimal.ZERO)>0 && new BigDecimal(orderPrivateCar.getPaymentAdvanceMoney()).compareTo(new BigDecimal(orderPrivateCar.getOrderMoney()))>-1) { |
| | | if(orderPrivateCar.getPayMethod() == 0 && new BigDecimal(orderPrivateCar.getPaymentAdvanceMoney()).compareTo(BigDecimal.ZERO)>0 && new BigDecimal(orderPrivateCar.getPaymentAdvanceMoney()).compareTo(new BigDecimal(orderPrivateCar.getOrderMoney()))>-1) { |
| | | orderPrivateCar.setState(8); |
| | | // 退款情况 |
| | | if (new BigDecimal(orderPrivateCar.getPaymentAdvanceMoney()).compareTo(new BigDecimal(orderPrivateCar.getOrderMoney())) > 0) { |
| | |
| | | // orderPrivateCar.setBindId(""); |
| | | // } |
| | | // 判断预估金额和订单金额差异是否大于3元 |
| | | if(BigDecimal.valueOf(orderPrivateCar.getOrderMoney()).subtract(orderPrivateCar.getEstimatedPrice()).abs().doubleValue() > 3){ |
| | | if(BigDecimal.valueOf(orderPrivateCar.getOrderMoney()).subtract(new BigDecimal(orderPrivateCar.getEstimatedPrice())).abs().doubleValue() > 3){ |
| | | orderPrivateCar.setIsException(1); |
| | | } |
| | | if(orderPrivateCar.getIsException() == 1){ |
| | |
| | | map.put("discountMoney", orderPrivateCar.getDiscountMoney());//折扣抵扣金额 |
| | | map.put("discount", orderPrivateCar.getDiscount());//折扣 |
| | | if(Objects.isNull(orderPrivateCar.getEstimatedPrice())){ |
| | | orderPrivateCar.setEstimatedPrice(BigDecimal.ZERO); |
| | | orderPrivateCar.setEstimatedPrice(0D); |
| | | } |
| | | if(BigDecimal.valueOf(orderPrivateCar.getOrderMoney()).subtract(orderPrivateCar.getEstimatedPrice()).abs().doubleValue() > 3){ |
| | | if(BigDecimal.valueOf(orderPrivateCar.getOrderMoney()).subtract(new BigDecimal(orderPrivateCar.getEstimatedPrice())).abs().doubleValue() > 3){ |
| | | orderPrivateCar.setIsException(1); |
| | | } |
| | | map.put("estimatedPrice", orderPrivateCar.getEstimatedPrice()); |
| | |
| | | private Integer priceType; |
| | | @ApiModelProperty(value = "预估价") |
| | | @TableField("estimatedPrice") |
| | | private BigDecimal estimatedPrice; |
| | | private Double estimatedPrice; |
| | | |
| | | @ApiModelProperty(value = "上一次定位推送时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | |
| | | this.priceType = priceType; |
| | | } |
| | | |
| | | public BigDecimal getEstimatedPrice() { |
| | | public Double getEstimatedPrice() { |
| | | return estimatedPrice; |
| | | } |
| | | |
| | | public void setEstimatedPrice(BigDecimal estimatedPrice) { |
| | | public void setEstimatedPrice(Double estimatedPrice) { |
| | | this.estimatedPrice = estimatedPrice; |
| | | } |
| | | public Integer getIsplatPay() { |
| | |
| | | orderPrivateCar.setTravelTime(travelTime); |
| | | orderPrivateCar.setOrderType(reservation); |
| | | orderPrivateCar.setOrderSource(orderSource); |
| | | orderPrivateCar.setEstimatedPrice(estimatedPrice); |
| | | if(orderSource == 2){//扫码下单 |
| | | Driver driver = driverService.selectById(driverId); |
| | | if(null == driver){ |
| | |
| | | orderPrivateCar.setState(7); |
| | | if(orderSource == 2){ |
| | | orderPrivateCar.setOrderMoney(data.get(0).getAmount()); |
| | | orderPrivateCar.setEstimatedPrice(data.get(0).getAmount()); |
| | | }else { |
| | | orderPrivateCar.setOrderMoney(data.get(carIndex).getAmount()); |
| | | orderPrivateCar.setEstimatedPrice(data.get(carIndex).getAmount()); |
| | | } |
| | | orderPrivateCar.setPayMethod(0); |
| | | this.insert(orderPrivateCar); |
| | |
| | | baseWarpper.setAmount(orderPrivateCar.getOrderMoney()); |
| | | return ResultUtil.success(baseWarpper); |
| | | }else { |
| | | if(orderSource == 2){ |
| | | orderPrivateCar.setEstimatedPrice(data.get(0).getAmount()); |
| | | }else { |
| | | orderPrivateCar.setEstimatedPrice(data.get(carIndex).getAmount()); |
| | | } |
| | | orderPrivateCar.setIsReassign(1); |
| | | orderPrivateCar.setIsDelete(1); |
| | | orderPrivateCar.setPayMethod(1); |
| | |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0); |
| | | //获取空闲司机 |
| | | // List<Driver> list = driverService.queryIdleDriver(1, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(1, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | List<Driver> list1 = driverService.queryIdleDriver_(1, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), 2.0D, null);//所有附近空闲司机 |
| | | list.addAll(list1); |
| | | list = list.stream().distinct().collect(Collectors.toList()); |
| | | if(list.size() > 0){ |
| | | // 查询预约单 |
| | | List<Integer> driverIds = list.stream().map(Driver::getId).collect(Collectors.toList()); |
| | |
| | | List<OrderPosition> list = JSONArray.parseArray(sb.toString(), OrderPosition.class); |
| | | orderServerWarpper.setOrderPositionList(JSONObject.toJSONString(list)); |
| | | } |
| | | // 查询司机服务中的订单 |
| | | OrderPrivateCar one = this.selectOne(new EntityWrapper<OrderPrivateCar>() |
| | | .eq("driverId", orderPrivateCar.getDriverId()) |
| | | .eq("state", 5) |
| | | .orderBy("insertTime", false) |
| | | .last("LIMIT 1")); |
| | | if(Objects.nonNull(one)){ |
| | | orderServerWarpper.setLastLon(one.getEndLon()+""); |
| | | orderServerWarpper.setLastLat(one.getEndLat()+""); |
| | | } |
| | | return orderServerWarpper; |
| | | } |
| | | |
| | |
| | | */ |
| | | List<Driver> queryIdleDriver_(@Param("type") Integer type, @Param("serverCarModelId") Integer serverCarModelId, |
| | | @Param("companyId") Integer companyId); |
| | | /** |
| | | * 获取当前已上班type业务类型、设置了可以接此类型的单据、服务车型匹配且空闲的司机 |
| | | * @param type |
| | | * @param serverCarModelId |
| | | * @param companyId |
| | | * @return |
| | | */ |
| | | List<Driver> queryIdleDriverService_(@Param("type") Integer type, @Param("serverCarModelId") Integer serverCarModelId, |
| | | @Param("companyId") Integer companyId); |
| | | |
| | | |
| | | /** |
| | |
| | | ) |
| | | </select> |
| | | |
| | | <select id="queryIdleDriverService_" resultType="Driver"> |
| | | select |
| | | id as id, |
| | | account as account, |
| | | jobNumber as jobNumber, |
| | | phone as phone, |
| | | password as password, |
| | | name as name, |
| | | sex as sex, |
| | | idCard as idCard, |
| | | companyId as companyId, |
| | | franchiseeId as franchiseeId, |
| | | headImgUrl as headImgUrl, |
| | | faceImgUrl as faceImgUrl, |
| | | idCardImgUrl1 as idCardImgUrl1, |
| | | idCardImgUrl2 as idCardImgUrl2, |
| | | placeOfEmployment as placeOfEmployment, |
| | | birthday as birthday, |
| | | bankCardNumber as bankCardNumber, |
| | | driverNationality as driverNationality, |
| | | driverNation as driverNation, |
| | | driverMaritalStatus as driverMaritalStatus, |
| | | driverLanguageLevel as driverLanguageLevel, |
| | | driverEducation as driverEducation, |
| | | driverCensus as driverCensus, |
| | | driverAddress as driverAddress, |
| | | driverContactAddress as driverContactAddress, |
| | | driverAge as driverAge, |
| | | driveCard as driveCard, |
| | | driveCardImgUrl as driveCardImgUrl, |
| | | driverType as driverType, |
| | | getDriverLicenseDate as getDriverLicenseDate, |
| | | driverLicenseOn as driverLicenseOn, |
| | | driverLicenseOff as driverLicenseOff, |
| | | taxiDriver as taxiDriver, |
| | | taxiAptitudeCard as taxiAptitudeCard, |
| | | networkCarlssueImg as networkCarlssueImg, |
| | | networkCarlssueOrganization as networkCarlssueOrganization, |
| | | networkCarlssueDate as networkCarlssueDate, |
| | | getNetworkCarProofDate as getNetworkCarProofDate, |
| | | networkCarProofOn as networkCarProofOn, |
| | | networkCarProofOff as networkCarProofOff, |
| | | registerDate as registerDate, |
| | | fullTimeDriver as fullTimeDriver, |
| | | inDriverBlacklist as inDriverBlacklist, |
| | | commercialType as commercialType, |
| | | contractCompany as contractCompany, |
| | | contractOn as contractOn, |
| | | contractOff as contractOff, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactPhone as emergencyContactPhone, |
| | | emergencyContactAddress as emergencyContactAddress, |
| | | remark as remark, |
| | | isPlatCar as isPlatCar, |
| | | carId as carId, |
| | | authState as authState, |
| | | state as state, |
| | | addType as addType, |
| | | balance as balance, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | from t_driver |
| | | where flag != 3 and state = 3 and authState = 2 |
| | | <if test="null != companyId"> |
| | | <choose> |
| | | <when test="companyId != 1"> |
| | | and companyId = #{companyId} or franchiseeId = #{companyId} |
| | | </when> |
| | | <otherwise> |
| | | and companyId is null or companyId = 0 or companyId = 1 or franchiseeId is null or franchiseeId = 0 |
| | | </otherwise> |
| | | </choose> |
| | | |
| | | </if> |
| | | and id in |
| | | ( |
| | | select driverId from t_driver_work where startTime < now() and state = 1 and `type` like CONCAT('%', #{type}, '%') |
| | | ) |
| | | and id in (select driverId from t_driver_orders where `type` = #{type}) |
| | | and carId in (select carId from t_car_service where `type` = #{type} |
| | | <if test="null != serverCarModelId"> |
| | | and serverCarModelId = #{serverCarModelId} |
| | | </if> |
| | | ) |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryOrderDriver" resultType="map"> |
| | |
| | | List<BaseWarpper> queryBusiness(Integer uid) throws Exception; |
| | | |
| | | List<Driver> queryDriverLimitTen(Integer type, Double lon, Double lat); |
| | | |
| | | List<Driver> queryIdleDriver_(Integer type, Integer serverCarModelId, Double lon, Double lat, Double distance, Integer companyId); |
| | | } |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | list.add(driver); |
| | | } |
| | | }else{ |
| | | System.err.println(driver.getName() + "-----------------没有上传经纬度----------------"); |
| | | // System.err.println(driver.getName() + "-----------------没有上传经纬度----------------"); |
| | | } |
| | | } |
| | | return list; |
| | |
| | | List<Driver> drivers = driverMapper.queryIdleDriver_(type, serverCarModelId, companyId); |
| | | List<Driver> list = new ArrayList<>(); |
| | | for(Driver driver : drivers){ |
| | | if(driver.getId() == 2448){ |
| | | System.err.println("司机名称---"+driver.getName()); |
| | | } |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(driver.getId())); |
| | | if(null != value){ |
| | | /*Map<String, String> distance1 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, value, 0);//计算距离 |
| | | double d = Double.valueOf(distance1.get("distance")).doubleValue();*/ |
| | | // double d = GDMapGeocodingUtil.getDistance(lat,lon,Double.parseDouble(value.split(",")[1]),Double.parseDouble(value.split(",")[0])); |
| | | double d = gdMapElectricFenceUtil.getDrivingRoute(lat,lon,Double.parseDouble(value.split(",")[1]),Double.parseDouble(value.split(",")[0])); |
| | | if(d < (distance * 1000)){ |
| | | list.add(driver); |
| | | } |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | /** |
| | | * 获取给定车型且空闲的司机 |
| | | * @param type |
| | | * @param serverCarModelId |
| | | * @param lon |
| | | * @param lat |
| | | * @param distance |
| | | * @param companyId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Driver> queryIdleDriver_(Integer type, Integer serverCarModelId, Double lon, Double lat, Double distance, Integer companyId) { |
| | | List<Driver> drivers = driverMapper.queryIdleDriverService_(type, serverCarModelId, companyId); |
| | | List<Driver> list = new ArrayList<>(); |
| | | for(Driver driver : drivers){ |
| | | String value = redisUtil.getValue("DRIVER" + driver.getId()); |
| | | if(null != value){ |
| | | /*Map<String, String> distance1 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, value, 0);//计算距离 |
| | | double d = Double.valueOf(distance1.get("distance")).doubleValue();*/ |
| | |
| | | if(CollectionUtils.isEmpty(drivers)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | for (Driver driver : drivers) { |
| | | Iterator<Driver> iterator = drivers.iterator(); |
| | | while (iterator.hasNext()){ |
| | | Driver driver = iterator.next(); |
| | | String value = redisUtil.getValue("DRIVER" + driver.getId()); |
| | | if(null != value){ |
| | | double d = GDMapGeocodingUtil.getDistance(lat,lon,Double.parseDouble(value.split(",")[1]),Double.parseDouble(value.split(",")[0])); |
| | | driver.setLon(Double.parseDouble(value.split(",")[0])); |
| | | driver.setLat(Double.parseDouble(value.split(",")[1])); |
| | | driver.setDistance(d); |
| | | }else { |
| | | System.err.println(driver.getName() + "------没有上传经纬度------"); |
| | | iterator.remove(); |
| | | } |
| | | } |
| | | if(drivers.size() > 10){ |
| | |
| | | private Integer reassignNotice; |
| | | private String orderPositionList; |
| | | |
| | | @ApiModelProperty("司机上一单位置经度") |
| | | private String lastLon; |
| | | @ApiModelProperty("司机上一单位置纬度") |
| | | private String lastLat; |
| | | |
| | | public String getLastLon() { |
| | | return lastLon; |
| | | } |
| | | |
| | | public void setLastLon(String lastLon) { |
| | | this.lastLon = lastLon; |
| | | } |
| | | |
| | | public String getLastLat() { |
| | | return lastLat; |
| | | } |
| | | |
| | | public void setLastLat(String lastLat) { |
| | | this.lastLat = lastLat; |
| | | } |
| | | |
| | | public String getOrderPositionList() { |
| | | return orderPositionList; |
| | | } |