DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
@@ -459,6 +459,9 @@ } } @ResponseBody @PostMapping("/api/order/reassignCancel") @ApiOperation(value = "提交改派申请--取消", tags = {"司机端-服务中"}, notes = "") DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IReassignService.java
@@ -17,6 +17,10 @@ * @throws Exception */ ResultUtil saveData(Reassign reassign, Integer uid, Integer type) throws Exception; ResultUtil saveDataCancel(Reassign reassign, Integer uid, Integer type) throws Exception; DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/CarServiceImpl.java
@@ -66,10 +66,10 @@ // driver.getCompanyId() != null && driver.getCompanyId() != 0 ? driver.getCompanyId() : 1)); for (Map<String, Object> stringObjectMap : list) { // 1使用中 2空闲中 if(stringObjectMap.get("useDriverId")!=null && stringObjectMap.get("useDriverId").toString().equals(uid.toString())){ map.put("useState", 1); if(stringObjectMap.get("useDriverId")!=null){ stringObjectMap.put("useState", 1); }else { map.put("useState", 2); stringObjectMap.put("useState", 2); } } map.put("list", list); DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java
@@ -291,6 +291,9 @@ case 1: OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(reassign.getOrderId()); if(orderPrivateCar.getState() == 10){ return ResultUtil.error("订单已取消"); } orderPrivateCar.setState(orderPrivateCar.getOldState()); orderPrivateCar.setReassignNotice(0); orderPrivateCarService.updateById(orderPrivateCar); @@ -310,6 +313,9 @@ break; case 2: OrderTaxi orderTaxi = orderTaxiService.selectById(reassign.getOrderId()); if(orderTaxi.getState() == 10){ return ResultUtil.error("订单已取消"); } orderTaxi.setState(orderTaxi.getOldState()); orderTaxi.setReassignNotice(0); orderTaxiService.updateById(orderTaxi); @@ -797,10 +803,13 @@ Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 Integer state = orderTaxi1.getState(); if (state != 1 || state!= 11) { orderIds.remove(orderTaxi.getId()); 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()); @@ -843,49 +852,47 @@ int finalI = i; PushOrder pushOrder = querys.stream().filter(s -> s.getType() == (finalI <= 3 ? finalI : 3)).findFirst().orElse(null); System.out.println("pushOrder:" + pushOrder); int i2 = pushOrder.getPushTime() / 10; if (i2 == 0) { i2 = 1; if (orderPrivateCar.getState() > 1 && orderPrivateCar.getState() != 11) { break; } for (int i1 = 0; i1 < i2; i1++) { 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() != 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; } //获取空闲司机 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()); } } Thread.sleep(10000);//设置等待时间 Integer state = orderPrivateCar.getState(); if (state > 1 && state != 11) { orderIds.remove(orderPrivateCar.getId()); return; } if (i == 18 && (state == 1 || state==11)) { pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1); orderPrivateCar.setState(10); orderPrivateCarService.updateById(orderPrivateCar); orderIds.remove(orderPrivateCar.getId()); 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()); return; } if (i == 18 && (state == 1 || state==11)) { System.err.println("结束改派退单-------------修改订单为取消状态"); pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1); pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, 10); orderPrivateCar.setState(10); orderPrivateCarService.updateById(orderPrivateCar); orderIds.remove(orderPrivateCar.getId()); } } } catch (Exception e) { e.printStackTrace(); UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/dao/mapping/OrderPrivateCarMapper.xml
@@ -392,7 +392,7 @@ a.abnormalIntro, a.abnormalImg, a.companyId, IF(a.abnormalIntro is not null, 1, 0) as appealButton IF(a.abnormalIntro is null and a.recoveryOrder = 1, 0, 1) as appealButton from t_order_private_car a left join t_driver b on (a.driverId = b.id) left join t_car c on (a.carId = c.id) UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
@@ -2877,6 +2877,8 @@ break; } if (i == querys.size() + 15) { orderPrivateCar1.setState(10); orderPrivateCarMapper.updateById(orderPrivateCar1); pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1); orderIds.remove(orderPrivateCar.getId()); } UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ServerCarModelServiceImpl.java
@@ -129,6 +129,8 @@ * @throws Exception */ public List<ServerCarModelWarpper> getPrice(Integer companyId, double distance, long duration, long wait, Integer type, Map<String, String> geocode) throws Exception { System.err.println("预估里程:" + distance); System.err.println("预估时间:" + duration); String provinceCode = geocode.get("provinceCode"); String cityCode = geocode.get("cityCode"); String districtCode = geocode.get("districtCode"); UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GDMapElectricFenceUtil.java
@@ -364,7 +364,7 @@ */ public Map<String, String> getDriving(String origins, String destination, String waypoints){ String url = "https://restapi.amap.com/v3/direction/driving?key=" + key + "&origin=" + origins + "&destination=" + destination + "&waypoints=" + waypoints + "&extensions=base&strategy=0"; "&waypoints=" + waypoints + "&extensions=base&strategy=2"; String forObject = restTemplate.getForObject(url, String.class); JSONObject jsonObject = JSON.parseObject(forObject); String status = jsonObject.getString("status"); UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/OrderUtil.java
@@ -192,7 +192,7 @@ tradePayOff1Data.setAccessMode("APP"); tradePayOff1Data.getGoodsInfo().forEach(goodsInfoRequest -> { goodsInfoRequest.setId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "9811000039358999" : "981100006005901"); goodsInfoRequest.setSubAppId("wxcc3c9058e2b294db"); goodsInfoRequest.setSubAppId(qianYunTongConfig.getAppId()); goodsInfoRequest.setAreaInfo("520100"); goodsInfoRequest.setPayType("0"); @@ -398,7 +398,7 @@ tradeOrderCreateData.setAccessMode("APP"); tradeOrderCreateData.getGoodsInfo().forEach(goodsInfoRequest -> { goodsInfoRequest.setId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "9811000039358999" : "981100006005901"); goodsInfoRequest.setSubAppId("wxcc3c9058e2b294db"); goodsInfoRequest.setSubAppId(qianYunTongConfig.getAppId()); goodsInfoRequest.setAreaInfo("520100"); goodsInfoRequest.setPayType("0"); goodsInfoRequest.setBusinessType("10408"); UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/dao/mapping/OrderTaxiMapper.xml
@@ -265,7 +265,7 @@ a.abnormalIntro, a.abnormalImg, a.companyId, IF(a.abnormalIntro is not null, 1, 0) as appealButton IF(a.abnormalIntro is null and a.recoveryOrder = 1, 0, 1)) as appealButton from t_order_taxi a left join t_driver b on (a.driverId = b.id) left join t_car c on (a.carId = c.id) UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
@@ -2343,6 +2343,8 @@ break; } if (i == querys.size() + 15 && state == 1) { orderTaxi1.setState(10); orderPrivateCarService.updateById(orderTaxi1); pushUtil.pushEndPush(1, orderTaxi.getUserId(), orderTaxi.getId(), 2); orderIds.remove(orderTaxi.getId()); } UserQYTTravel/guns-admin/src/test/java/com/stylefeng/guns/GunsApplicationTest.java
@@ -1,69 +1,69 @@ package com.stylefeng.guns; import com.alibaba.fastjson.JSON; import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; import com.stylefeng.guns.modular.system.model.Company; import com.stylefeng.guns.modular.system.model.Driver; import com.stylefeng.guns.modular.system.model.UserInfo; import com.stylefeng.guns.modular.system.service.ICompanyService; import com.stylefeng.guns.modular.system.service.IDriverService; import com.stylefeng.guns.modular.system.service.IUserInfoService; import com.stylefeng.guns.modular.system.util.EmailUtil; import com.stylefeng.guns.modular.system.util.qianyuntong.OrderUtil; import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; import lombok.extern.slf4j.Slf4j; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import javax.mail.MessagingException; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.util.List; /** * SpringBoot方式启动类 * * @author stylefeng * @Date 2017/5/21 12:06 */ @Slf4j @RunWith(SpringRunner.class) @SpringBootTest public class GunsApplicationTest { @Autowired private IOrderPrivateCarService orderPrivateCarService; @Autowired private IUserInfoService userInfoService; @Autowired private IDriverService driverService; @Autowired private ICompanyService companyService; @Autowired private IPaymentRecordService paymentRecordService; @Autowired private EmailUtil emailUtil; @Test public void test(){ try { emailUtil.sendEmailWithAttachment("393733352@qq.com", "贵人家园出行-行程单", "请查收您的行程单", null, "贵人家园出行-行程单"); } catch (MessagingException e) { throw new RuntimeException(e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } } //package com.stylefeng.guns; // //import com.alibaba.fastjson.JSON; //import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; //import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; //import com.stylefeng.guns.modular.system.model.Company; //import com.stylefeng.guns.modular.system.model.Driver; //import com.stylefeng.guns.modular.system.model.UserInfo; //import com.stylefeng.guns.modular.system.service.ICompanyService; //import com.stylefeng.guns.modular.system.service.IDriverService; //import com.stylefeng.guns.modular.system.service.IUserInfoService; //import com.stylefeng.guns.modular.system.util.EmailUtil; //import com.stylefeng.guns.modular.system.util.qianyuntong.OrderUtil; //import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; //import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; //import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; //import lombok.extern.slf4j.Slf4j; //import org.junit.Test; //import org.junit.runner.RunWith; //import org.springframework.beans.BeanUtils; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.boot.test.context.SpringBootTest; //import org.springframework.test.context.junit4.SpringRunner; // //import javax.mail.MessagingException; //import java.io.UnsupportedEncodingException; //import java.math.BigDecimal; //import java.util.List; // ///** // * SpringBoot方式启动类 // * // * @author stylefeng // * @Date 2017/5/21 12:06 // */ //@Slf4j //@RunWith(SpringRunner.class) //@SpringBootTest //public class GunsApplicationTest { // // @Autowired // private IOrderPrivateCarService orderPrivateCarService; // // @Autowired // private IUserInfoService userInfoService; // // @Autowired // private IDriverService driverService; // @Autowired // private ICompanyService companyService; // @Autowired // private IPaymentRecordService paymentRecordService; // @Autowired // private EmailUtil emailUtil; // // // // // @Test // public void test(){ // try { // emailUtil.sendEmailWithAttachment("393733352@qq.com", "贵人家园出行-行程单", "请查收您的行程单", null, "贵人家园出行-行程单"); // } catch (MessagingException e) { // throw new RuntimeException(e); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } //}