From cb7e84fe6e40f3ce3ed1fe3fb3b4c0da8c847793 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 27 八月 2025 23:51:22 +0800 Subject: [PATCH] 修改bug --- DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java | 120 ++++--- DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java | 332 +++++++++++++---------- DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/dao/mapping/OrderPrivateCarMapper.xml | 4 DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java | 11 DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java | 25 - DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/model/OrderPrivateCar.java | 114 ++++++++ DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushUtil.java | 3 DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/OrderUtil.java | 6 DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java | 54 ++- DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java | 107 ++++--- DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserInfo.java | 5 DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/dao/mapping/OrderTaxiMapper.xml | 4 12 files changed, 472 insertions(+), 313 deletions(-) diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java index 2578fde..de7aa4d 100644 --- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java +++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java @@ -530,9 +530,11 @@ return ResultUtil.tokenErr(); } Driver driver = driverService.selectById(uid); - String areaCode = driver.getAreaCode(); + String areaCode = driver.getPlaceOfEmployment(); TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>() .eq("districtCode", areaCode) + .eq("state", 1) + .eq("remove", 0) .eq("status", 2) .last("LIMIT 1")); if(tDriverPromotionActivity!=null){ @@ -565,8 +567,8 @@ accessToken = getAccessToken(); } int index=0; - - if(ToolUtil.isEmpty(img)) { + String urlLink = driver.getShareLink(); + if(ToolUtil.isEmpty(img) || ToolUtil.isEmpty(urlLink)) { RestTemplate rest = new RestTemplate(); // String url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=" + accessToken; String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken; @@ -574,7 +576,7 @@ param.put("page", "pages/home/home"); param.put("width", 430); //二维码尺寸 param.put("scene", "driverId=" + uid); //二维码尺寸 - param.put("env_version", "trial"); //二维码尺寸 + param.put("env_version", "release"); //二维码尺寸 HttpRequest post = HttpUtil.createPost(url); post.body(JSON.toJSONString(param)); @@ -584,7 +586,6 @@ redisTemplate.opsForValue().set("DRIVER_WX_IMG" + uid, img,30, TimeUnit.DAYS); } - String urlLink = driver.getShareLink(); if(ToolUtil.isEmpty(urlLink)) { index=1; String url1 = "https://api.weixin.qq.com/wxa/generate_urllink?access_token=" + accessToken; diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/dao/mapping/OrderPrivateCarMapper.xml b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/dao/mapping/OrderPrivateCarMapper.xml index 0a99479..a19f8f4 100644 --- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/dao/mapping/OrderPrivateCarMapper.xml +++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/dao/mapping/OrderPrivateCarMapper.xml @@ -260,7 +260,7 @@ payManner as payManner, UNIX_TIMESTAMP(travelTime) as travelTime, remark as remark - from t_order_private_car where driverId = #{driverId} + from t_order_private_car where driverId = #{driverId} and recoveryOrder = 0 <if test="state == 1"> and state != 1 </if> @@ -318,7 +318,7 @@ a.startLat as startLat, a.endLon as endLon, a.endLat as endLat, - a.orderMoney as orderMoney, + if(a.abnormal = 2 and a.abnormalStatus = 2, a.responsibilityMoney, a.orderMoney) as orderMoney, a.payManner as payManner, a.thankYouFee, a.trackId as trackId, diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/model/OrderPrivateCar.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/model/OrderPrivateCar.java index c99a141..309cfec 100644 --- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/model/OrderPrivateCar.java +++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/model/OrderPrivateCar.java @@ -445,6 +445,38 @@ private String promotionPhone; private String travelId; + /** + * 是否异常订单 1否 2是 + */ + @TableField("abnormal") + private Integer abnormal; + + private Long promotionActivityId; + /** + * 中台是否已创建订单(0=否,1=是) + */ + private Integer isCreated; + /** + * 是否是追缴单(0=否,1=是) + */ + private Integer recoveryOrder; + /** + * 是否生成追缴单(0=否,1=是) + */ + private Integer isGenerateRecoveryOrder; + /** + * 原始订单id + */ + private Integer oldOrderId; + + + private Integer abnormalStatus; + + private Integer responsibilityType; + + private BigDecimal responsibilityMoney; + + private String abnormalRemark; public String getPromotionUser() { @@ -1206,7 +1238,87 @@ public void setTravelId(String travelId) { this.travelId = travelId; } - + + public Integer getAbnormal() { + return abnormal; + } + + public void setAbnormal(Integer abnormal) { + this.abnormal = abnormal; + } + + public Long getPromotionActivityId() { + return promotionActivityId; + } + + public void setPromotionActivityId(Long promotionActivityId) { + this.promotionActivityId = promotionActivityId; + } + + public Integer getIsCreated() { + return isCreated; + } + + public void setIsCreated(Integer isCreated) { + this.isCreated = isCreated; + } + + public Integer getRecoveryOrder() { + return recoveryOrder; + } + + public void setRecoveryOrder(Integer recoveryOrder) { + this.recoveryOrder = recoveryOrder; + } + + public Integer getIsGenerateRecoveryOrder() { + return isGenerateRecoveryOrder; + } + + public void setIsGenerateRecoveryOrder(Integer isGenerateRecoveryOrder) { + this.isGenerateRecoveryOrder = isGenerateRecoveryOrder; + } + + public Integer getOldOrderId() { + return oldOrderId; + } + + public void setOldOrderId(Integer oldOrderId) { + this.oldOrderId = oldOrderId; + } + + public Integer getAbnormalStatus() { + return abnormalStatus; + } + + public void setAbnormalStatus(Integer abnormalStatus) { + this.abnormalStatus = abnormalStatus; + } + + public Integer getResponsibilityType() { + return responsibilityType; + } + + public void setResponsibilityType(Integer responsibilityType) { + this.responsibilityType = responsibilityType; + } + + public BigDecimal getResponsibilityMoney() { + return responsibilityMoney; + } + + public void setResponsibilityMoney(BigDecimal responsibilityMoney) { + this.responsibilityMoney = responsibilityMoney; + } + + public String getAbnormalRemark() { + return abnormalRemark; + } + + public void setAbnormalRemark(String abnormalRemark) { + this.abnormalRemark = abnormalRemark; + } + @Override public String toString() { return "OrderPrivateCar{" + diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java index 14e5aee..97df78d 100644 --- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java +++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java @@ -232,7 +232,6 @@ driver.getCompanyId() != null && driver.getCompanyId() != 0 ? driver.getCompanyId() : 1)); orderPrivateCar.setState(2); orderPrivateCar.setSnatchOrderTime(new Date()); - //调用高德创建轨迹 // String s = gdFalconUtil.selectTerminal(driver.getPhone()); // String track = gdFalconUtil.createTrack(s); @@ -248,7 +247,7 @@ // 是否推广订单 - Integer promotion = isPromotion(orderPrivateCar.getUserId()); + Integer promotion = isPromotion(orderPrivateCar.getUserId(), driver.getPlaceOfEmployment()); if(null != promotion){ orderPrivateCar.setPromotion(2); Driver driver1 = driverService.selectById(promotion); @@ -277,18 +276,20 @@ orderPrivateCar.setTravelId(travelItinerary); }else{ //改派抢单 - Company company1 = companyService.selectById(driver.getCompanyId()); - //中台修改订单状态 - ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); - request1.setOrderId(orderPrivateCar.getTravelId()); - request1.setStatus(orderPrivateCar.getState()); - request1.setDriverId(driver.getEmpId().toString()); - if(2 == orderPrivateCar.getPromotion()){ - Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); - request1.setPromoterId(driver1.getEmpId().toString()); + if(ToolUtil.isNotEmpty(orderPrivateCar.getTravelId())){ + Company company1 = companyService.selectById(driver.getCompanyId()); + //中台修改订单状态 + ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); + request1.setOrderId(orderPrivateCar.getTravelId()); + request1.setStatus(orderPrivateCar.getState()); + request1.setDriverId(driver.getEmpId().toString()); + if(2 == orderPrivateCar.getPromotion()){ + Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); + request1.setPromoterId(driver1.getEmpId().toString()); + } + request1.setSupplierShopId(company1.getEnterCode()); + OrderUtil.modifyTravelItinerary(request1); } - request1.setSupplierShopId(company1.getEnterCode()); - OrderUtil.modifyTravelItinerary(request1); } this.updateById(orderPrivateCar); @@ -375,11 +376,11 @@ } - private Integer isPromotion(Integer userId){ + private Integer isPromotion(Integer userId, String code){ UserInfo userInfo = userInfoMapper.selectById(userId); if(userInfo.getBindDriverId()!=null && userInfo.getBindExpireDate().getTime()>System.currentTimeMillis()){ - String registAreaCode = userInfo.getRegistAreaCode(); - TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("state",1).eq("districtCode", registAreaCode).last(" and now() between startTime and endTime AND FIND_IN_SET(" + 1 + ", bizType) limit 1")); + TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("state",1) + .eq("districtCode", code).last(" and now() between startTime and endTime AND FIND_IN_SET(" + 1 + ", bizType) limit 1")); if(tDriverPromotionActivity!=null){ return userInfo.getBindDriverId(); } @@ -570,19 +571,21 @@ } this.updateById(orderPrivateCar); - Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); - Company company = companyService.selectById(driver.getCompanyId()); - //中台修改订单状态 - ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); - request.setOrderId(orderPrivateCar.getTravelId()); - request.setStatus(orderPrivateCar.getState()); - request.setDriverId(driver.getEmpId().toString()); - if(2 == orderPrivateCar.getPromotion()){ - Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); - request.setPromoterId(driver1.getEmpId().toString()); + if(ToolUtil.isNotEmpty(orderPrivateCar.getTravelId())){ + Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); + Company company = companyService.selectById(driver.getCompanyId()); + //中台修改订单状态 + ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); + request.setOrderId(orderPrivateCar.getTravelId()); + request.setStatus(orderPrivateCar.getState()); + request.setDriverId(driver.getEmpId().toString()); + if(2 == orderPrivateCar.getPromotion()){ + Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); + request.setPromoterId(driver1.getEmpId().toString()); + } + request.setSupplierShopId(company.getEnterCode()); + OrderUtil.modifyTravelItinerary(request); } - request.setSupplierShopId(company.getEnterCode()); - OrderUtil.modifyTravelItinerary(request); // TODO: 2020/6/5 推送状态 OrderPrivateCar finalOrderPrivateCar = orderPrivateCar; @@ -652,18 +655,20 @@ this.updateById(orderPrivateCar); Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); - Company company = companyService.selectById(driver.getCompanyId()); - //中台修改订单状态 - ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); - request.setOrderId(orderPrivateCar.getTravelId()); - request.setStatus(7); - request.setDriverId(driver.getEmpId().toString()); - if(2 == orderPrivateCar.getPromotion()){ - Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); - request.setPromoterId(driver1.getEmpId().toString()); + if(ToolUtil.isNotEmpty(orderPrivateCar.getTravelId())){ + Company company = companyService.selectById(driver.getCompanyId()); + //中台修改订单状态 + ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); + request.setOrderId(orderPrivateCar.getTravelId()); + request.setStatus(7); + request.setDriverId(driver.getEmpId().toString()); + if(2 == orderPrivateCar.getPromotion()){ + Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); + request.setPromoterId(driver1.getEmpId().toString()); + } + request.setSupplierShopId(company.getEnterCode()); + OrderUtil.modifyTravelItinerary(request); } - request.setSupplierShopId(company.getEnterCode()); - OrderUtil.modifyTravelItinerary(request); pushUtil.removeTask(orderId, 1);//删除定时任务,结束推送数据 @@ -832,6 +837,9 @@ JSONObject jsonObject = jsonArray.getJSONObject(i); Integer id = jsonObject.getInteger("id"); Double amount = jsonObject.getDouble("amount"); + if(amount == 0){ + continue; + } OrderAdditionalFee orderAdditionalFee = new OrderAdditionalFee(); orderAdditionalFee.setOrderType(1); orderAdditionalFee.setOrderId(orderId); @@ -846,18 +854,20 @@ this.updateById(orderPrivateCar); Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); - Company company1 = companyService.selectById(driver.getCompanyId()); - //中台修改订单状态 - ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); - request1.setOrderId(orderPrivateCar.getTravelId()); - request1.setStatus(orderPrivateCar.getState()); - request1.setDriverId(driver.getEmpId().toString()); - if(2 == orderPrivateCar.getPromotion()){ - Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); - request1.setPromoterId(driver1.getEmpId().toString()); + if(ToolUtil.isNotEmpty(orderPrivateCar.getTravelId())){ + Company company1 = companyService.selectById(driver.getCompanyId()); + //中台修改订单状态 + ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); + request1.setOrderId(orderPrivateCar.getTravelId()); + request1.setStatus(orderPrivateCar.getState()); + request1.setDriverId(driver.getEmpId().toString()); + if(2 == orderPrivateCar.getPromotion()){ + Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); + request1.setPromoterId(driver1.getEmpId().toString()); + } + request1.setSupplierShopId(company1.getEnterCode()); + OrderUtil.modifyTravelItinerary(request1); } - request1.setSupplierShopId(company1.getEnterCode()); - OrderUtil.modifyTravelItinerary(request1); pushUtil.removeTask(orderId, 1);//删除定时任务,结束推送数据 systemNoticeService.addSystemNotice(1, "司机已结束本次行程,谢谢使用", orderPrivateCar.getUserId(), 1); @@ -933,7 +943,15 @@ } Map<String, Object> map = new HashMap<>(); - map.put("orderMoney", orderPrivateCar.getOrderMoney()==null?0:orderPrivateCar.getOrderMoney());//订单金额 + if(orderPrivateCar.getState() == 5){ + map.put("orderMoney", orderPrivateCar.getOrderMoney()==null?0:orderPrivateCar.getOrderMoney());//订单金额 + }else{ + if(orderPrivateCar.getAbnormal() == 2 && orderPrivateCar.getResponsibilityType() > 2 && orderPrivateCar.getAbnormalStatus() == 2){ + map.put("orderMoney", orderPrivateCar.getResponsibilityMoney()); + }else{ + map.put("orderMoney", orderPrivateCar.getOrderMoney()==null?0:orderPrivateCar.getOrderMoney());//订单金额 + } + } map.put("startMileage", orderPrivateCar.getStartMileage());//起步价 map.put("startMoney", orderPrivateCar.getStartMoney());//起步价 map.put("mileageKilometers", orderPrivateCar.getMileageKilometers());//里程费 diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserInfo.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserInfo.java index 8554b90..6d2d64a 100644 --- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserInfo.java +++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserInfo.java @@ -132,19 +132,14 @@ */ @TableField("state") private Integer state; - - - /** * 绑定的司机id */ @TableField("bindDriverId") private Integer bindDriverId; - /** * 绑定司机有效期 */ - private Date bindExpireDate; /** * 中台用户ID diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java index 9e470c0..15f0717 100644 --- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java +++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java @@ -412,26 +412,6 @@ if(registeredWarpper.getCompanyId()==null){ return ResultUtil.error("请选择服务商"); } - - String code = registeredWarpper.getPlaceOfEmployment(); - Company query = companyCityService.query(code); - if(null == query){ - return ResultUtil.error("选择从业地暂未开通业务"); - } - if(null != query){ - switch (query.getType()){ - case 1://平台 - driver.setCompanyId(query.getId()); - break; - case 2://分公司 - driver.setCompanyId(query.getId()); - break; - case 3://加盟商 - driver.setCompanyId(query.getSuperiorId()); - driver.setFranchiseeId(query.getId()); - break; - } - } driver.setHeadImgUrl(registeredWarpper.getHeadImgUrl()); driver.setIdCardImgUrl1(registeredWarpper.getIdCardImgUrl1()); driver.setIdCardImgUrl2(registeredWarpper.getIdCardImgUrl2()); @@ -658,7 +638,10 @@ return ResultUtil.error("车辆正在使用中"); } } - + //专车业务需要校验 +// if(0 == driver.getIsSynchronous() && type.contains("1")){ +// return ResultUtil.error("请先开通钱包"); +// } //判断车辆是否正在使用中 Car car = carService.selectById(driver.getCarId()); if(car.getUseDriverId() != null && !car.getUseDriverId().equals(uid)){ diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java index 7517822..6142adf 100644 --- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java +++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java @@ -387,7 +387,7 @@ break; case 2://出租 OrderTaxi orderTaxi = orderTaxiService.selectById(orderId); - if(null != orderTaxi && orderTaxi.getType() == 2){ + if((null != orderTaxi && orderTaxi.getType() == 2) || (null != orderTaxi && orderTaxi.getState() == 11)){ map = orderTaxiService.queryPushOrder(orderId); }else{ OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); @@ -1232,19 +1232,21 @@ orderPrivateCar.setState(8); orderPrivateCarService.updateById(orderPrivateCar); - Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); - Company company1 = companyService.selectById(driver.getCompanyId()); - //中台修改订单状态 - ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); - request1.setOrderId(orderPrivateCar.getTravelId()); - request1.setStatus(orderPrivateCar.getState()); - request1.setDriverId(driver.getEmpId().toString()); - if(2 == orderPrivateCar.getPromotion()){ - Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); - request1.setPromoterId(driver1.getEmpId().toString()); + if(ToolUtil.isNotEmpty(orderPrivateCar.getTravelId())){ + Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); + Company company1 = companyService.selectById(driver.getCompanyId()); + //中台修改订单状态 + ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); + request1.setOrderId(orderPrivateCar.getTravelId()); + request1.setStatus(orderPrivateCar.getState()); + request1.setDriverId(driver.getEmpId().toString()); + if(2 == orderPrivateCar.getPromotion()){ + Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); + request1.setPromoterId(driver1.getEmpId().toString()); + } + request1.setSupplierShopId(company1.getEnterCode()); + OrderUtil.modifyTravelItinerary(request1); } - request1.setSupplierShopId(company1.getEnterCode()); - OrderUtil.modifyTravelItinerary(request1); userId = orderPrivateCar.getUserId(); driverId = orderPrivateCar.getDriverId(); @@ -1276,19 +1278,21 @@ orderTaxi.setState(8); orderTaxiService.updateById(orderTaxi); - Driver driver1 = driverService.selectById(orderTaxi.getDriverId()); - Company company = companyService.selectById(driver1.getCompanyId()); - //中台修改订单状态 - ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); - request.setOrderId(orderTaxi.getTravelId()); - request.setStatus(orderTaxi.getState()); - request.setDriverId(driver1.getEmpId().toString()); - if(2 == orderTaxi.getPromotion()){ - Driver driver2 = driverService.selectById(orderTaxi.getPromotionDriverId()); - request.setPromoterId(driver2.getEmpId().toString()); + if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){ + Driver driver1 = driverService.selectById(orderTaxi.getDriverId()); + Company company = companyService.selectById(driver1.getCompanyId()); + //中台修改订单状态 + ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); + request.setOrderId(orderTaxi.getTravelId()); + request.setStatus(orderTaxi.getState()); + request.setDriverId(driver1.getEmpId().toString()); + if(2 == orderTaxi.getPromotion()){ + Driver driver2 = driverService.selectById(orderTaxi.getPromotionDriverId()); + request.setPromoterId(driver2.getEmpId().toString()); + } + request.setSupplierShopId(company.getEnterCode()); + OrderUtil.modifyTravelItinerary(request); } - request.setSupplierShopId(company.getEnterCode()); - OrderUtil.modifyTravelItinerary(request); userId = orderTaxi.getUserId(); driverId = orderTaxi.getDriverId(); diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java index 6eef1c7..41a37b6 100644 --- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java +++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java @@ -193,20 +193,23 @@ orderPrivateCar.setOldState(orderPrivateCar.getState()); orderPrivateCar.setState(11); orderPrivateCar.setReassignNotice(2); + orderPrivateCar.setIsReassign(2); orderPrivateCarService.updateById(orderPrivateCar); - Company company = companyService.selectById(driver.getCompanyId()); - //中台修改订单状态 - ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); - request.setOrderId(orderPrivateCar.getTravelId()); - request.setStatus(orderPrivateCar.getState()); - request.setDriverId(driver.getEmpId().toString()); - if (2 == orderPrivateCar.getPromotion()) { - Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); - request.setPromoterId(driver1.getEmpId().toString()); + if(ToolUtil.isNotEmpty(orderPrivateCar.getTravelId())){ + Company company = companyService.selectById(driver.getCompanyId()); + //中台修改订单状态 + ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); + request.setOrderId(orderPrivateCar.getTravelId()); + request.setStatus(orderPrivateCar.getState()); + request.setDriverId(driver.getEmpId().toString()); + if (2 == orderPrivateCar.getPromotion()) { + Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); + request.setPromoterId(driver1.getEmpId().toString()); + } + request.setSupplierShopId(company.getEnterCode()); + OrderUtil.modifyTravelItinerary(request); } - request.setSupplierShopId(company.getEnterCode()); - OrderUtil.modifyTravelItinerary(request); //添加已收入明细 @@ -219,20 +222,23 @@ orderTaxi.setOldState(orderTaxi.getState()); orderTaxi.setState(11); orderTaxi.setReassignNotice(2); + orderTaxi.setIsReassign(2); orderTaxiService.updateById(orderTaxi); - Company company1 = companyService.selectById(driver.getCompanyId()); - //中台修改订单状态 - ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); - request1.setOrderId(orderTaxi.getTravelId()); - request1.setStatus(orderTaxi.getState()); - request1.setDriverId(driver.getEmpId().toString()); - if (2 == orderTaxi.getPromotion()) { - Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); - request1.setPromoterId(driver1.getEmpId().toString()); + if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){ + Company company1 = companyService.selectById(driver.getCompanyId()); + //中台修改订单状态 + ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); + request1.setOrderId(orderTaxi.getTravelId()); + request1.setStatus(orderTaxi.getState()); + request1.setDriverId(driver.getEmpId().toString()); + if (2 == orderTaxi.getPromotion()) { + Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); + request1.setPromoterId(driver1.getEmpId().toString()); + } + request1.setSupplierShopId(company1.getEnterCode()); + OrderUtil.modifyTravelItinerary(request1); } - request1.setSupplierShopId(company1.getEnterCode()); - OrderUtil.modifyTravelItinerary(request1); //添加已收入明细 // incomeService.saveData(1, orderTaxi.getCompanyId(), 4, orderTaxi.getId(), 2, reassign.getMoney()); @@ -245,6 +251,7 @@ orderLogistics.setOldState(orderLogistics.getState()); orderLogistics.setState(11); orderLogistics.setReassignNotice(2); + orderLogistics.setIsReassign(2); orderLogisticsService.updateById(orderLogistics); //添加已收入明细 @@ -255,6 +262,7 @@ orderLogistics1.setOldState(orderLogistics1.getState()); orderLogistics1.setState(11); orderLogistics1.setReassignNotice(2); + orderLogistics1.setIsReassign(2); orderLogisticsService.updateById(orderLogistics1); //添加已收入明细 @@ -298,18 +306,20 @@ orderPrivateCar.setReassignNotice(0); orderPrivateCarService.updateById(orderPrivateCar); - Company company = companyService.selectById(driver.getCompanyId()); - //中台修改订单状态 - ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); - request.setOrderId(orderPrivateCar.getTravelId()); - request.setStatus(orderPrivateCar.getState()); - request.setDriverId(driver.getEmpId().toString()); - if (2 == orderPrivateCar.getPromotion()) { - Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); - request.setPromoterId(driver1.getEmpId().toString()); + if(ToolUtil.isNotEmpty(orderPrivateCar.getTravelId())){ + Company company = companyService.selectById(driver.getCompanyId()); + //中台修改订单状态 + ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); + request.setOrderId(orderPrivateCar.getTravelId()); + request.setStatus(orderPrivateCar.getState()); + request.setDriverId(driver.getEmpId().toString()); + if (2 == orderPrivateCar.getPromotion()) { + Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); + request.setPromoterId(driver1.getEmpId().toString()); + } + request.setSupplierShopId(company.getEnterCode()); + OrderUtil.modifyTravelItinerary(request); } - request.setSupplierShopId(company.getEnterCode()); - OrderUtil.modifyTravelItinerary(request); break; case 2: OrderTaxi orderTaxi = orderTaxiService.selectById(reassign.getOrderId()); @@ -319,18 +329,20 @@ orderTaxi.setState(orderTaxi.getOldState()); orderTaxi.setReassignNotice(0); orderTaxiService.updateById(orderTaxi); - Company company1 = companyService.selectById(driver.getCompanyId()); - //中台修改订单状态 - ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); - request1.setOrderId(orderTaxi.getTravelId()); - request1.setStatus(orderTaxi.getState()); - request1.setDriverId(driver.getEmpId().toString()); - if (2 == orderTaxi.getPromotion()) { - Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); - request1.setPromoterId(driver1.getEmpId().toString()); + if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){ + Company company1 = companyService.selectById(driver.getCompanyId()); + //中台修改订单状态 + ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); + request1.setOrderId(orderTaxi.getTravelId()); + request1.setStatus(orderTaxi.getState()); + request1.setDriverId(driver.getEmpId().toString()); + if (2 == orderTaxi.getPromotion()) { + Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); + request1.setPromoterId(driver1.getEmpId().toString()); + } + request1.setSupplierShopId(company1.getEnterCode()); + OrderUtil.modifyTravelItinerary(request1); } - request1.setSupplierShopId(company1.getEnterCode()); - OrderUtil.modifyTravelItinerary(request1); break; } reassignMapper.delete(new EntityWrapper<Reassign>().eq("orderId",reassign.getOrderId()).eq("orderType",reassign.getOrderType())); @@ -541,6 +553,7 @@ orderCrossCity.setOldState(orderCrossCity.getState()); orderCrossCity.setState(11); orderCrossCity.setReassignNotice(2); + orderCrossCity.setIsReassign(2); orderCrossCityService.updateById(orderCrossCity); //添加已收入明细 @@ -548,13 +561,13 @@ } systemNoticeService.addSystemNotice(2, "您已使用余额成功支付改派申请费用!", uid, 1); //开始推送调度单 - Map<String, String> map = new HashMap<>(); - map.put("orderId", reassign.getOrderId().toString()); - map.put("orderType", reassign.getOrderType().toString()); - List<Dispatch> dispatches = dispatchMapper.queryDispatchs(driver.getFranchiseeId() == null ? driver.getCompanyId() : driver.getFranchiseeId(), 1); - for (Dispatch dispatch : dispatches) { - jgPushUtil.push(2, "有新的改派订单需要处理,请及时处理!", "订单改派", map, "DISPATCH" + dispatch.getId()); - } +// Map<String, String> map = new HashMap<>(); +// map.put("orderId", reassign.getOrderId().toString()); +// map.put("orderType", reassign.getOrderType().toString()); +// List<Dispatch> dispatches = dispatchMapper.queryDispatchs(driver.getFranchiseeId() == null ? driver.getCompanyId() : driver.getFranchiseeId(), 1); +// for (Dispatch dispatch : dispatches) { +// jgPushUtil.push(2, "有新的改派订单需要处理,请及时处理!", "订单改派", map, "DISPATCH" + dispatch.getId()); +// } } if (reassign.getPayType() == 4) { @@ -619,14 +632,14 @@ reassign.setPayOrder(order_id); reassign.setPayTime(new Date()); this.updateById(reassign); - //开始推送调度单 - Map<String, String> map = new HashMap<>(); - map.put("orderId", reassign.getOrderId().toString()); - map.put("orderType", reassign.getOrderType().toString()); - List<Dispatch> dispatches = dispatchMapper.queryDispatchs(driver.getFranchiseeId() == null ? driver.getCompanyId() : driver.getFranchiseeId(), 1); - for (Dispatch dispatch : dispatches) { - jgPushUtil.push(2, "有新的改派订单需要处理,请及时处理!", "订单改派", map, "DISPATCH" + dispatch.getId()); - } +// //开始推送调度单 +// Map<String, String> map = new HashMap<>(); +// map.put("orderId", reassign.getOrderId().toString()); +// map.put("orderType", reassign.getOrderType().toString()); +// List<Dispatch> dispatches = dispatchMapper.queryDispatchs(driver.getFranchiseeId() == null ? driver.getCompanyId() : driver.getFranchiseeId(), 1); +// for (Dispatch dispatch : dispatches) { +// jgPushUtil.push(2, "有新的改派订单需要处理,请及时处理!", "订单改派", map, "DISPATCH" + dispatch.getId()); +// } } query.setState(2); query.setCode(order_id); @@ -638,6 +651,7 @@ orderCrossCity1.setOldState(orderCrossCity1.getState()); orderCrossCity1.setState(11); orderCrossCity1.setReassignNotice(2); + orderCrossCity1.setIsReassign(2); orderCrossCityService.updateById(orderCrossCity1); System.out.println("==============跨城修改改派通知状态完毕===================" + orderCrossCity1); @@ -683,6 +697,7 @@ orderPrivateCar.setOldState(orderPrivateCar.getState()); orderPrivateCar.setState(11); orderPrivateCar.setReassignNotice(2); + orderPrivateCar.setIsReassign(2); orderPrivateCarService.updateById(orderPrivateCar); //添加已收入明细 @@ -694,6 +709,7 @@ orderTaxi.setOldState(orderTaxi.getState()); orderTaxi.setState(11); orderTaxi.setReassignNotice(2); + orderTaxi.setIsReassign(2); orderTaxiService.updateById(orderTaxi); //添加已收入明细 @@ -705,6 +721,7 @@ orderLogistics.setOldState(orderLogistics.getState()); orderLogistics.setState(11); orderLogistics.setReassignNotice(2); + orderLogistics.setIsReassign(2); orderLogisticsService.updateById(orderLogistics); //添加已收入明细 @@ -716,6 +733,7 @@ orderLogistics1.setOldState(orderLogistics1.getState()); orderLogistics1.setState(11); orderLogistics1.setReassignNotice(2); + orderLogistics1.setIsReassign(2); orderLogisticsService.updateById(orderLogistics1); //添加已收入明细 @@ -724,14 +742,14 @@ break; } systemNoticeService.addSystemNotice(2, "您已使用" + (type == 1 ? "微信" : (type == 2 ? "支付宝" : "云闪付")) + "成功支付改派申请费用!", reassign.getOriginalDriverId(), 1); - //开始推送调度单 - Map<String, String> map = new HashMap<>(); - map.put("orderId", reassign.getOrderId().toString()); - map.put("orderType", reassign.getOrderType().toString()); - List<Dispatch> dispatches = dispatchMapper.queryDispatchs(driver.getFranchiseeId() == null ? driver.getCompanyId() : driver.getFranchiseeId(), 1); - for (Dispatch dispatch : dispatches) { - jgPushUtil.push(2, "有新的改派订单需要处理,请及时处理!", "订单改派", map, "DISPATCH" + dispatch.getId()); - } +// //开始推送调度单 +// Map<String, String> map = new HashMap<>(); +// map.put("orderId", reassign.getOrderId().toString()); +// map.put("orderType", reassign.getOrderType().toString()); +// List<Dispatch> dispatches = dispatchMapper.queryDispatchs(driver.getFranchiseeId() == null ? driver.getCompanyId() : driver.getFranchiseeId(), 1); +// for (Dispatch dispatch : dispatches) { +// jgPushUtil.push(2, "有新的改派订单需要处理,请及时处理!", "订单改派", map, "DISPATCH" + dispatch.getId()); +// } System.out.println("==============其他订单完毕==================="); } else { System.err.println("预支付数据异常(orderId = " + id + ")"); @@ -771,50 +789,58 @@ } OpenCity openCity = openCityService.openCity1(orderTaxi.getStartLon().toString(), orderTaxi.getStartLat().toString()); List<PushOrder> querys = pushOrderService.querys(null, 2, openCity.getId());//获取需要推送的次数 - int size=18; - for (int i = 1; i <= size; i++) { - int finalI = i; - PushOrder pushOrder = querys.stream().filter(s -> s.getType() == (finalI <= 3 ? finalI : 3)).findFirst().orElse(null); - System.out.println("pushOrder:" + pushOrder); - //获取空闲司机 - List<Driver> list = driverService.queryIdleDriver(2, orderTaxi.getStartLon(), orderTaxi.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 - list = list.stream().filter(e -> e.getId() != uid).collect(Collectors.toList()); - OrderTaxi orderTaxi1 = orderTaxiService.selectById(orderTaxi.getId()); - if (list.size() > 0) { - double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 - int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取) - lastIndex = lastIndex == 0 ? list.size() : lastIndex; - list = list.subList(0, lastIndex);//获取空闲司机中占比数据 - for (Driver driver : list) {//开始进行推送 - //查询是否在限制推单范围内 - boolean bo = false; - for (Integer integer : integers) { - if (integer.compareTo(driver.getId()) == 0) { - bo = true; - break; + int num = 0; + for (int j = 0; j < 6; j++) { + Boolean push = false; + for (int i = 1; i <= querys.size(); i++) { + int finalI = i; + PushOrder pushOrder = querys.stream().filter(s -> s.getType() == (finalI <= 3 ? finalI : 3)).findFirst().orElse(null); + System.out.println("pushOrder:" + pushOrder); + //获取空闲司机 + List<Driver> list = driverService.queryIdleDriver(2, orderTaxi.getStartLon(), orderTaxi.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 + list = list.stream().filter(e -> e.getId() != uid).collect(Collectors.toList()); + OrderTaxi orderTaxi1 = orderTaxiService.selectById(orderTaxi.getId()); + if (list.size() > 0) { + double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 + int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取) + lastIndex = lastIndex == 0 ? list.size() : lastIndex; + list = list.subList(0, lastIndex);//获取空闲司机中占比数据 + for (Driver driver : list) {//开始进行推送 + //查询是否在限制推单范围内 + boolean bo = false; + for (Integer integer : integers) { + if (integer.compareTo(driver.getId()) == 0) { + bo = true; + break; + } } + if (bo) { + continue; + } + pushUtil.pushOrderState(2, driver.getId(), orderTaxi.getId(), 2, orderTaxi.getState(), pushOrder.getPushTime()); } - if (bo) { - continue; - } - pushUtil.pushOrderState(2, driver.getId(), orderTaxi.getId(), 2, orderTaxi.getState(), pushOrder.getPushTime()); + } + Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 + Integer state = orderTaxi1.getState(); + if (state != 1 || state!= 11) { + orderIds.remove(orderTaxi.getId()); + push = true; + break; + } + if (num == 18 && (state == 1 || state==11)) { + System.err.println("结束改派退单-------------修改订单为取消状态"); + pushUtil.pushEndPush(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, 11); + pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, 10); + orderTaxi1.setState(10); + orderTaxiService.updateById(orderTaxi1); + orderIds.remove(orderTaxi.getId()); } } - Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 - Integer state = orderTaxi1.getState(); - if (state != 1 || state!= 11) { - orderIds.remove(orderTaxi.getId()); + if(push){ break; } - if (i == 18 && (state == 1 || state==11)) { - System.err.println("结束改派退单-------------修改订单为取消状态"); - pushUtil.pushEndPush(1, orderTaxi.getUserId(), orderTaxi.getId(), 2); - pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, 10); - orderTaxi1.setState(10); - orderTaxiService.updateById(orderTaxi1); - orderIds.remove(orderTaxi.getId()); - } } + } catch (Exception e) { e.printStackTrace(); } @@ -843,57 +869,67 @@ } OpenCity openCity = openCityService.openCity1(orderPrivateCar.getStartLon().toString(), orderPrivateCar.getStartLat().toString()); List<PushOrder> querys = pushOrderService.querys(null, 1, openCity.getId());//获取需要推送的次数 - int size=18; - for (int i = 1; i <= size; i++) { - OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(id); - if (null == orderPrivateCar || (orderPrivateCar.getState() > 1 && orderPrivateCar.getState() != 11)) { - break; - } - int finalI = i; - PushOrder pushOrder = querys.stream().filter(s -> s.getType() == (finalI <= 3 ? finalI : 3)).findFirst().orElse(null); - System.out.println("pushOrder:" + pushOrder); + int num = 0; + for (int j = 0; j < 6; j++) { + Boolean push = false; + for (int i = 1; i <= querys.size(); i++) { + num++; + OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(id); + if (null == orderPrivateCar || (orderPrivateCar.getState() > 1 && orderPrivateCar.getState() != 11)) { + push = true; + break; + } + int finalI = i; + PushOrder pushOrder = querys.stream().filter(s -> s.getType() == (finalI <= 3 ? finalI : 3)).findFirst().orElse(null); + System.out.println("pushOrder:" + pushOrder); - if (orderPrivateCar.getState() > 1 && orderPrivateCar.getState() != 11) { - break; - } - //获取空闲司机 - List<Driver> list = driverService.queryIdleDriver(orderType, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 - list = list.stream().filter(e -> !e.getId().equals(uid)).collect(Collectors.toList()); - if (list.size() > 0) { - double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 - int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取) - lastIndex = lastIndex == 0 ? list.size() : lastIndex; - list = list.subList(0, lastIndex);//获取空闲司机中占比数据 - for (Driver driver : list) {//开始进行推送 - boolean bo = false; - for (Integer integer : integers) { - if (integer.compareTo(driver.getId()) == 0) { - bo = true; - break; + if (orderPrivateCar.getState() > 1 && orderPrivateCar.getState() != 11) { + push = true; + break; + } + //获取空闲司机 + List<Driver> list = driverService.queryIdleDriver(orderType, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 + list = list.stream().filter(e -> !e.getId().equals(uid)).collect(Collectors.toList()); + if (list.size() > 0) { + double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 + int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取) + lastIndex = lastIndex == 0 ? list.size() : lastIndex; + list = list.subList(0, lastIndex);//获取空闲司机中占比数据 + for (Driver driver : list) {//开始进行推送 + boolean bo = false; + for (Integer integer : integers) { + if (integer.compareTo(driver.getId()) == 0) { + bo = true; + break; + } } + if (bo) { + continue; + } + pushUtil.pushOrderState(2, driver.getId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), pushOrder.getPushTime()); } - if (bo) { - continue; - } - pushUtil.pushOrderState(2, driver.getId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), pushOrder.getPushTime()); + } + Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 + Integer state = orderPrivateCar.getState(); + if (state > 1 && state != 11) { + orderIds.remove(orderPrivateCar.getId()); + push = true; + return; + } + if (num == 18 && (state == 1 || state==11)) { + System.err.println("结束改派退单-------------修改订单为取消状态"); + pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, 11); + pushUtil.pushReassignEndCancel(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, 10); + orderPrivateCar.setState(10); + orderPrivateCarService.updateById(orderPrivateCar); + orderIds.remove(orderPrivateCar.getId()); } } - Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 - Integer state = orderPrivateCar.getState(); - if (state > 1 && state != 11) { - orderIds.remove(orderPrivateCar.getId()); - return; + if(push){ + break; } - if (i == 18 && (state == 1 || state==11)) { - System.err.println("结束改派退单-------------修改订单为取消状态"); - pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1); - pushUtil.pushReassignEndCancel(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, 10); - orderPrivateCar.setState(10); - orderPrivateCarService.updateById(orderPrivateCar); - orderIds.remove(orderPrivateCar.getId()); - } - } + } catch (Exception e) { e.printStackTrace(); } diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushUtil.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushUtil.java index 8393e30..19e7c69 100644 --- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushUtil.java +++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushUtil.java @@ -109,7 +109,7 @@ * @param orderId * @param orderType */ - public void pushEndPush(Integer type, Integer uid, Integer orderId, Integer orderType) { + public void pushEndPush(Integer type, Integer uid, Integer orderId, Integer orderType, Integer state) { JSONObject jsonObject = new JSONObject(); jsonObject.put("code", 200); jsonObject.put("msg", "SUCCESS"); @@ -117,6 +117,7 @@ Map<String, Object> map = new HashMap<>(); map.put("orderId", orderId); map.put("orderType", orderType); + map.put("state", state); jsonObject.put("data", map); //调用推送 diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/OrderUtil.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/OrderUtil.java index b16392a..7d4447d 100644 --- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/OrderUtil.java +++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/OrderUtil.java @@ -528,9 +528,9 @@ tradePayOffData.setPaymentInfos(paymentInfoRequests); List<GoodsInfo> goodsInfo = new ArrayList<>(); GoodsInfo goodsInfo1 = new GoodsInfo(); - goodsInfo1.setMerchantCode("B00000905"); - goodsInfo1.setCustId("CB0000004686"); - goodsInfo1.setCustName("证联消费平台交易客户"); + goodsInfo1.setMerchantCode("prod".equals(qianYunTongConfig.getActiveProfile()) ? "B00001404" : "B00000905"); + goodsInfo1.setCustId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "CB0000004853" : "CB0000004686"); + goodsInfo1.setCustName("prod".equals(qianYunTongConfig.getActiveProfile()) ? "黔南云码通数字产业运营有限公司" : "证联消费平台交易客户"); goodsInfo1.setBusinessType("10408"); goodsInfo1.setAgreementNo("prod".equals(qianYunTongConfig.getActiveProfile()) ? "00000402485377063581755054680461" : "00000000468618354161754464398681"); goodsInfo1.setProfitSharing("1"); diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/dao/mapping/OrderTaxiMapper.xml b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/dao/mapping/OrderTaxiMapper.xml index b321971..e4421af 100644 --- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/dao/mapping/OrderTaxiMapper.xml +++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/dao/mapping/OrderTaxiMapper.xml @@ -148,7 +148,7 @@ payManner as payManner, UNIX_TIMESTAMP(travelTime) as travelTime, remark as remark - from t_order_taxi where driverId = #{driverId} + from t_order_taxi where driverId = #{driverId} and recoveryOrder = 0 <if test="state == 1"> and state != 1 </if> @@ -275,7 +275,7 @@ a.startLat as startLat, a.endLon as endLon, a.endLat as endLat, - a.orderMoney as orderMoney, + if(a.abnormal = 2 and a.abnormalStatus = 2, a.responsibilityMoney, a.orderMoney) as orderMoney, a.payManner as payManner, a.thankYouFee, a.trackId as trackId, diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java index 9d06f60..bc3a9eb 100644 --- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java +++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java @@ -222,7 +222,7 @@ // } // 是否推广订单 - Integer promotion = isPromotion(orderTaxi.getUserId()); + Integer promotion = isPromotion(orderTaxi.getUserId(), driver.getPlaceOfEmployment()); if(promotion!=null){ orderTaxi.setPromotion(2); Driver driver1 = driverService.selectById(promotion); @@ -251,18 +251,20 @@ orderTaxi.setTravelId(travelItinerary); }else{ //改派抢单 - Company company1 = companyService.selectById(driver.getCompanyId()); - //中台修改订单状态 - ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); - request1.setOrderId(orderTaxi.getTravelId()); - request1.setStatus(orderTaxi.getState()); - request1.setDriverId(driver.getEmpId().toString()); - if(2 == orderTaxi.getPromotion()){ - Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); - request1.setPromoterId(driver1.getEmpId().toString()); + if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){ + Company company1 = companyService.selectById(driver.getCompanyId()); + //中台修改订单状态 + ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); + request1.setOrderId(orderTaxi.getTravelId()); + request1.setStatus(orderTaxi.getState()); + request1.setDriverId(driver.getEmpId().toString()); + if(2 == orderTaxi.getPromotion()){ + Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); + request1.setPromoterId(driver1.getEmpId().toString()); + } + request1.setSupplierShopId(company1.getEnterCode()); + OrderUtil.modifyTravelItinerary(request1); } - request1.setSupplierShopId(company1.getEnterCode()); - OrderUtil.modifyTravelItinerary(request1); } this.updateById(orderTaxi); @@ -336,11 +338,11 @@ return ResultUtil.success(orderTaxi.getId()); } - private Integer isPromotion(Integer userId){ + private Integer isPromotion(Integer userId, String code){ UserInfo userInfo = userInfoMapper.selectById(userId); if(userInfo.getBindDriverId()!=null && userInfo.getBindExpireDate().getTime()<=System.currentTimeMillis()){ - String registAreaCode = userInfo.getRegistAreaCode(); - TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("state",1).eq("districtCode", registAreaCode).le("startTime", new Date()).ge("endTime", new Date()).last("AND FIND_IN_SET(" + 2 + ", bizType) limit 1")); + TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("state",1) + .eq("districtCode", code).le("startTime", new Date()).ge("endTime", new Date()).last("AND FIND_IN_SET(" + 2 + ", bizType) limit 1")); if(tDriverPromotionActivity!=null){ return userInfo.getBindDriverId(); } @@ -379,6 +381,7 @@ orderTaxi.setOrderType(orderPrivateCar.getOrderType()); orderTaxi.setOrderSource(orderPrivateCar.getOrderSource()); orderTaxi.setIsDelete(1); + orderTaxi.setIsReassign(1); return orderTaxi; } @@ -531,19 +534,21 @@ } this.updateById(orderTaxi); - Driver driver = driverService.selectById(orderTaxi.getDriverId()); - Company company = companyService.selectById(driver.getCompanyId()); - //中台修改订单状态 - ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); - request.setOrderId(orderTaxi.getTravelId()); - request.setStatus(orderTaxi.getState()); - request.setDriverId(driver.getEmpId().toString()); - if(2 == orderTaxi.getPromotion()){ - Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); - request.setPromoterId(driver1.getEmpId().toString()); + if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){ + Driver driver = driverService.selectById(orderTaxi.getDriverId()); + Company company = companyService.selectById(driver.getCompanyId()); + //中台修改订单状态 + ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); + request.setOrderId(orderTaxi.getTravelId()); + request.setStatus(orderTaxi.getState()); + request.setDriverId(driver.getEmpId().toString()); + if(2 == orderTaxi.getPromotion()){ + Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); + request.setPromoterId(driver1.getEmpId().toString()); + } + request.setSupplierShopId(company.getEnterCode()); + OrderUtil.modifyTravelItinerary(request); } - request.setSupplierShopId(company.getEnterCode()); - OrderUtil.modifyTravelItinerary(request); // TODO: 2020/6/5 推送状态 new Thread(new Runnable() { @@ -589,18 +594,20 @@ this.updateById(orderTaxi); Driver driver = driverService.selectById(orderTaxi.getDriverId()); - Company company = companyService.selectById(driver.getCompanyId()); - //中台修改订单状态 - ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); - request.setOrderId(orderTaxi.getTravelId()); - request.setStatus(orderTaxi.getState()); - request.setDriverId(driver.getEmpId().toString()); - if(2 == orderTaxi.getPromotion()){ - Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); - request.setPromoterId(driver1.getEmpId().toString()); + if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){ + Company company = companyService.selectById(driver.getCompanyId()); + //中台修改订单状态 + ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); + request.setOrderId(orderTaxi.getTravelId()); + request.setStatus(orderTaxi.getState()); + request.setDriverId(driver.getEmpId().toString()); + if(2 == orderTaxi.getPromotion()){ + Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); + request.setPromoterId(driver1.getEmpId().toString()); + } + request.setSupplierShopId(company.getEnterCode()); + OrderUtil.modifyTravelItinerary(request); } - request.setSupplierShopId(company.getEnterCode()); - OrderUtil.modifyTravelItinerary(request); //回滚司机状态为空闲 driver.setState(2); @@ -642,18 +649,20 @@ this.updateById(orderTaxi); Driver driver = driverService.selectById(orderTaxi.getDriverId()); - Company company1 = companyService.selectById(driver.getCompanyId()); - //中台修改订单状态 - ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); - request1.setOrderId(orderTaxi.getTravelId()); - request1.setStatus(orderTaxi.getState()); - request1.setDriverId(driver.getEmpId().toString()); - if(2 == orderTaxi.getPromotion()){ - Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); - request1.setPromoterId(driver1.getEmpId().toString()); + if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){ + Company company1 = companyService.selectById(driver.getCompanyId()); + //中台修改订单状态 + ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); + request1.setOrderId(orderTaxi.getTravelId()); + request1.setStatus(orderTaxi.getState()); + request1.setDriverId(driver.getEmpId().toString()); + if(2 == orderTaxi.getPromotion()){ + Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); + request1.setPromoterId(driver1.getEmpId().toString()); + } + request1.setSupplierShopId(company1.getEnterCode()); + OrderUtil.modifyTravelItinerary(request1); } - request1.setSupplierShopId(company1.getEnterCode()); - OrderUtil.modifyTravelItinerary(request1); //回滚司机状态为空闲 driver.setState(2); -- Gitblit v1.7.1