Merge remote-tracking branch 'origin/2.0' into 2.0
# Conflicts:
# ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/PlatformController.java
# ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/TSubsidyController.java
# ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/SysRedPacketRecordController.java
# ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TSysReformistController.java
# ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TSysRedSetMapper.xml
# ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TSysCancleOrder.java
# ManagementIGOTravel/guns-admin/src/main/resources/application-dev.yml
# ManagementIGOTravel/guns-admin/src/main/resources/application.yml
# ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/subsidy/grant.html
# ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/subsidy/use.html
# ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/sysRedPacketRecord/sysRedPacketRecord.html
# ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tSysReformist/tRedSetEdit.html
# ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tSysReformist/tSysReformist.html
# ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/platform/water.js
# ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/subsidy/use.js
# ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/tSysReformist/tRedSet.js
| | |
| | | <artifactId>font-asian</artifactId> |
| | | <version>7.1.13</version> |
| | | </dependency> |
| | | <!--任务调度框架--> |
| | | <dependency> |
| | | <groupId>org.quartz-scheduler</groupId> |
| | | <artifactId>quartz</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.mchange</groupId> |
| | | <artifactId>c3p0</artifactId> |
| | | <version>0.9.5.5</version> |
| | | </dependency> |
| | | |
| | | <!--Google ODRD--> |
| | | <dependency> |
| | | <groupId>com.google.maps</groupId> |
| | | <artifactId>fleetengine-auth</artifactId> |
| | | <version>1.11.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.util.GDFalconUtil; |
| | | import com.stylefeng.guns.modular.system.util.quartz.QuartzUtil; |
| | | import com.stylefeng.guns.modular.system.util.quartz.SchedulerUtil; |
| | | import org.apache.http.client.HttpClient; |
| | | import org.apache.http.config.SocketConfig; |
| | | import org.apache.http.impl.client.HttpClientBuilder; |
| | | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
| | | import org.quartz.SchedulerException; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.InputStreamReader; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.TimeZone; |
| | | |
| | |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(GunsApplication.class, args); |
| | | |
| | | try { |
| | | //启动定时任务调度器 |
| | | QuartzUtil.start(GunsApplication.class.getClassLoader().getResourceAsStream("quartz.properties")); |
| | | } catch (SchedulerException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | logger.info("GunsApplication is success!"); |
| | | } |
| | | |
| | |
| | | import com.stylefeng.guns.modular.system.util.ALiSendSms; |
| | | import com.stylefeng.guns.modular.system.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.util.EmailUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | | import com.stylefeng.guns.modular.system.warpper.BalanceUsageRecord; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | @Resource |
| | | private DriverActivityHistoryMapper driverActivityHistoryMapper; |
| | | |
| | | @Resource |
| | | private IBalanceUsageRecordService balanceUsageRecordService; |
| | | |
| | | @Autowired |
| | | private FleetEngineUtil fleetEngineUtil; |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryTotalRevenue") |
| | | @ApiOperation(value = "获取收入明细", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取收入明细【2.0】", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> list = driverService.queryTotalRevenue(language, uid, pageNum, size); |
| | | |
| | | List<BaseWarpper> data = new ArrayList<>(); |
| | | for(Map<String, Object> map : list){ |
| | | String type = map.get("type").toString(); |
| | |
| | | if("2".equals(type)){ |
| | | switch (Integer.valueOf(String.valueOf(null != map.get("orderType") ? map.get("orderType") : 0))){ |
| | | case 1: |
| | | baseWarpper.setName(language == 1 ? "打车" : language == 2 ? "Ride" : "Course"); |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(map.get("incomeId").toString()); |
| | | baseWarpper.setName(language == 1 ? (orderPrivateCar.getCancelMidway() == 0 ? "" : "【途中取消】") + "打车" : language == 2 ? (orderPrivateCar.getCancelMidway() == 0 ? "" : "【Cancelled during the trip】") + "Ride" : (orderPrivateCar.getCancelMidway() == 0 ? "" : "【Annulé en cours de voyage】") + "Course"); |
| | | break; |
| | | case 2: |
| | | baseWarpper.setName(language == 1 ? "出租车" : language == 2 ? "taxi" : "taxi"); |
| | |
| | | baseWarpper.setName(language == 1 ? "城际出行" : language == 2 ? "Intercity travel" : "Mobilité entre villes"); |
| | | break; |
| | | case 4: |
| | | baseWarpper.setName(language == 1 ? "包裹" : language == 2 ? "Delivery" : "Livraison"); |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(map.get("incomeId").toString()); |
| | | baseWarpper.setName(language == 1 ? (orderLogistics.getCancelMidway() == 0 ? "" : "【途中取消】") + "包裹" : language == 2 ? (orderLogistics.getCancelMidway() == 0 ? "" : "【Cancelled during the trip】") + "Delivery" : (orderLogistics.getCancelMidway() == 0 ? "" : "【Annulé en cours de voyage】") + "Livraison"); |
| | | break; |
| | | case 5: |
| | | baseWarpper.setName(language == 1 ? "跨城小件物流" : language == 2 ? "Cross-city small parts logistics" : "Logistique des petites pièces à travers la ville"); |
| | |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(map.get("incomeId").toString()); |
| | | List<Income> incomes3 = incomeService.queryData(1, null, 2, orderLogistics.getId(), 4); |
| | | map1.put("travelMoney", orderLogistics != null ? orderLogistics.getTravelMoney() : 0);//行程费 |
| | | map1.put("parkMoney", 0);//停车费 |
| | | map1.put("tipMoney", orderLogistics != null ? orderLogistics.getTipMoney() : 0);//小费 |
| | | map1.put("roadTollMoney", 0);//过路费 |
| | | map1.put("parkMoney", orderLogistics != null ? orderLogistics.getParkMoney() : 0);//停车费 |
| | | map1.put("tipMoney", 0);//小费 |
| | | map1.put("roadTollMoney", orderLogistics != null ? orderLogistics.getRoadTollMoney() : 0);//过路费 |
| | | map1.put("rakeMoney", incomes3.size() > 0 ? incomes3.get(0).getMoney() : 0);//抽成 |
| | | break; |
| | | case 5: |
| | | OrderLogistics orderLogistics1 = orderLogisticsService.selectById(map.get("incomeId").toString()); |
| | | List<Income> incomes4 = incomeService.queryData(1, null, 2, orderLogistics1.getId(), 5); |
| | | map1.put("travelMoney", orderLogistics1 != null ? orderLogistics1.getTravelMoney() : 0);//行程费 |
| | | map1.put("travelMoney", orderLogistics1 != null ? orderLogistics1.getOrderMoney() : 0);//行程费 |
| | | map1.put("parkMoney", 0);//停车费 |
| | | map1.put("tipMoney", orderLogistics1 != null ? orderLogistics1.getTipMoney() : 0);//小费 |
| | | map1.put("tipMoney", 0);//小费 |
| | | map1.put("roadTollMoney", 0);//过路费 |
| | | map1.put("rakeMoney", incomes4.size() > 0 ? incomes4.get(0).getMoney() : 0);//抽成 |
| | | break; |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryBalanceUsageRecord") |
| | | @ApiOperation(value = "获取余额使用记录【2.0】", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "体现类型(1=活动收入,2=业务收入)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BalanceUsageRecord> queryBalanceUsageRecord(Integer language, Integer pageNum, Integer size, Integer type, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | BalanceUsageRecord balanceUsageRecord = new BalanceUsageRecord(); |
| | | balanceUsageRecord.setTotal(balanceUsageRecordService.queryBalanceUsageRecordSum(uid, type)); |
| | | balanceUsageRecord.setList(balanceUsageRecordService.queryBalanceUsageRecord(language, uid, type, pageNum, size)); |
| | | return ResultUtil.success(balanceUsageRecord); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/getFleetEngineAuth") |
| | | @ApiOperation(value = "获取google地图授权token", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<Map<String, Object>> getFleetEngineAuth(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Map<String, Object> s = fleetEngineUtil.fleetEngineAuth(2, uid); |
| | | return ResultUtil.success(s); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryMyAllOrder") |
| | | @ApiOperation(value = "获取我的订单列表", tags = {"司机端-首页"}, notes = "") |
| | | @ApiOperation(value = "获取我的订单列表【2.0】", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "数据类型(1=全部,2=待支付,3=已取消,4=已完成)", name = "state", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryOrderInfo") |
| | | @ApiOperation(value = "获取服务中页面订单详情", tags = {"司机端-服务中"}, notes = "",response = OrderInfoWarpper.class) |
| | | @ApiOperation(value = "获取服务中页面订单详情【2.0】", tags = {"司机端-服务中"}, notes = "",response = OrderInfoWarpper.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,4=小件物流-同城)", name = "orderType", required = true, dataType = "int"), |
| | |
| | | @ApiOperation(value = "司机确认费用", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付方式(1=OK平台收款,2=其他方式收款)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=同城小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | // @ApiImplicitParam(value = "支付方式(1=OK平台收款,2=其他方式收款)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "行程费用(出租车必传)", name = "travelFee", required = false, dataType = "double"), |
| | | @ApiImplicitParam(value = "停车费", name = "parkingFee", required = false, dataType = "double"), |
| | | @ApiImplicitParam(value = "过路费", name = "crossingFee", required = false, dataType = "double"), |
| | |
| | | @ApiOperation(value = "手动确认订单完成", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,4=同城小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil completeOrder(Integer orderId, Integer orderType, Integer language){ |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryMoneyInfo") |
| | | @ApiOperation(value = "获取订单费用明细", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiOperation(value = "获取订单费用明细【2.0】", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,4=同城小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<MoneyInfoWarpper> queryMoneyInfo(Integer orderId, Integer orderType){ |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/fillInPickUpCode") |
| | |
| | | } |
| | | return callbackResponse; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/updateEndAddress") |
| | | @ApiOperation(value = "处理乘客修改目的地【2.0】", tags = {"用户端-专车", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "状态(2=同意,3=拒绝)", name = "status", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "语言", name = "language", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil updateEndAddress(Integer orderId, Integer orderType, Integer status){ |
| | | switch (orderType){ |
| | | case 1: |
| | | orderPrivateCarService.updateEndAddress(orderId, status); |
| | | break; |
| | | case 4: |
| | | orderLogisticsService.updateEndAddress(orderId, status); |
| | | break; |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/settlementRecord/queryHistoricalSettlement") |
| | | @ApiOperation(value = "获取结算历史记录", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取结算历史记录【2.0】", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.service.IWithdrawalService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.WithdrawalListWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.WithdrawalWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/withdrawal/queryWithdrawal") |
| | | @ApiOperation(value = "获取历史提现数据", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取历史提现数据【2.0】", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "提现类型(1=活动收入提现,2=业务收入提现)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "体现类型(1=活动收入提现,2=业务收入提现)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "状态(1=处理中,2=已提现,3=提现失败)", name = "state", required = false, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<WithdrawalWarpper>> queryWithdrawal(Integer language, Integer pageNum, Integer size, Integer type, HttpServletRequest request){ |
| | | public ResultUtil<WithdrawalWarpper> queryWithdrawal(Integer language, Integer pageNum, Integer size, Integer type, Integer state, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> list = withdrawalService.queryWithdrawal(language, uid, type, pageNum, size); |
| | | return ResultUtil.success(WithdrawalWarpper.getWithdrawalWarpper(list)); |
| | | List<Map<String, Object>> list = withdrawalService.queryWithdrawal(language, uid, type, state, pageNum, size); |
| | | List<WithdrawalListWarpper> withdrawalWarpper = WithdrawalListWarpper.getWithdrawalWarpper(list); |
| | | WithdrawalWarpper withdrawalWarpper1 = new WithdrawalWarpper(); |
| | | withdrawalWarpper1.setTotal(withdrawalService.queryWithdrawalSum(uid, type)); |
| | | withdrawalWarpper1.setList(withdrawalWarpper); |
| | | return ResultUtil.success(withdrawalWarpper1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | orderCrossCity.setState(3); |
| | | orderCrossCity.setSetOutTime(new Date()); |
| | | systemNoticeService.addSystemNotice(1, "司机已出发,请耐心等待", orderCrossCity.getUserId()); |
| | | pushUtil.pushDriverPosition(orderCrossCity.getId(), 3);//主动推送司机定位 |
| | | break; |
| | | case 4://到达预约点,等待客户上车 |
| | | orderCrossCity.setState(4); |
| | |
| | | orderCrossCity.setBoardingTime(new Date()); |
| | | orderCrossCity.setState(5); |
| | | orderCrossCity.setStartServiceTime(new Date()); |
| | | |
| | | pushUtil.pushDriverPosition(orderCrossCity.getId(), 3);//主动推送司机定位 |
| | | break; |
| | | case 6://结束服务 |
| | | orderCrossCity.setGetoffLon(lon); |
| | |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderCrossCity.getUserId(), orderCrossCity.getId(), 3, orderCrossCity.getState()); |
| | | pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState()); |
| | | pushUtil.pushDriverPosition(orderCrossCity.getId(), 3); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderCrossCity.getUserId(), orderCrossCity.getId(), 3, orderCrossCity.getState()); |
| | | pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState()); |
| | | pushUtil.pushDriverPosition(orderCrossCity.getId(), 3); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | */ |
| | | List<OrderLogistics> query(@Param("state") List<Integer> state, @Param("driverId") Integer driverId); |
| | | |
| | | |
| | | /** |
| | | * 获取费用明细 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | Map<String, Object> queryMoneyInfo(@Param("orderId") Integer orderId); |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.smallLogistics.dao.OrderLogisticsMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics"> |
| | | <id column="id" property="id"/> |
| | | <result column="type" property="type"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="driverId" property="driverId"/> |
| | | <result column="carId" property="carId"/> |
| | | <result column="orderNum" property="orderNum"/> |
| | | <result column="cargoType" property="cargoType"/> |
| | | <result column="urgent" property="urgent"/> |
| | | <result column="cargoNumber" property="cargoNumber"/> |
| | | <result column="remark" property="remark"/> |
| | | <result column="placementLon" property="placementLon"/> |
| | | <result column="placementLat" property="placementLat"/> |
| | | <result column="placementAddress" property="placementAddress"/> |
| | | <result column="startLon" property="startLon"/> |
| | | <result column="startLat" property="startLat"/> |
| | | <result column="startAddress" property="startAddress"/> |
| | | <result column="endLon" property="endLon"/> |
| | | <result column="endLat" property="endLat"/> |
| | | <result column="endAddress" property="endAddress"/> |
| | | <result column="recipient" property="recipient"/> |
| | | <result column="recipientPhone" property="recipientPhone"/> |
| | | <result column="boardingLon" property="boardingLon"/> |
| | | <result column="boardingLat" property="boardingLat"/> |
| | | <result column="boardingAddress" property="boardingAddress"/> |
| | | <result column="boardingTime" property="boardingTime"/> |
| | | <result column="getoffLon" property="getoffLon"/> |
| | | <result column="getoffLat" property="getoffLat"/> |
| | | <result column="getoffAddress" property="getoffAddress"/> |
| | | <result column="getoffTime" property="getoffTime"/> |
| | | <result column="mileage" property="mileage"/> |
| | | <result column="payManner" property="payManner"/> |
| | | <result column="payType" property="payType"/> |
| | | <result column="orderMoney" property="orderMoney"/> |
| | | <result column="travelMoney" property="travelMoney"/> |
| | | <result column="tipMoney" property="tipMoney"/> |
| | | <result column="redPacketMoney" property="redPacketMoney"/> |
| | | <result column="couponMoney" property="couponMoney"/> |
| | | <result column="redPacketId" property="redPacketId"/> |
| | | <result column="couponId" property="couponId"/> |
| | | <result column="discount" property="discount"/> |
| | | <result column="discountMoney" property="discountMoney"/> |
| | | <result column="activityId" property="activityId"/> |
| | | <result column="companyId" property="companyId"/> |
| | | <result column="payMoney" property="payMoney"/> |
| | | <result column="state" property="state"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | <result column="travelTime" property="travelTime"/> |
| | | <result column="snatchOrderTime" property="snatchOrderTime"/> |
| | | <result column="setOutTime" property="setOutTime"/> |
| | | <result column="arriveTime" property="arriveTime"/> |
| | | <result column="startServiceTime" property="startServiceTime"/> |
| | | <result column="endServiceTime" property="endServiceTime"/> |
| | | <result column="orderSource" property="orderSource"/> |
| | | <result column="invoiceId" property="invoiceId"/> |
| | | <result column="trackId" property="trackId"/> |
| | | <result column="isDelete" property="isDelete"/> |
| | | <result column="oldState" property="oldState"/> |
| | | <result column="telX" property="telX"/> |
| | | <result column="bindId" property="bindId"/> |
| | | <result column="pickUpCode" property="pickUpCode"/> |
| | | <result column="isReassign" property="isReassign"/> |
| | | <result column="reassignNotice" property="reassignNotice"/> |
| | | <result column="driverPay" property="driverPay"/> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | |
| | | a.urgent as urgent, |
| | | a.tipMoney as tipMoney, |
| | | a.remark as remark, |
| | | a.isReassign as isReassign |
| | | a.isReassign as isReassign, |
| | | a.tripId |
| | | from t_order_logistics a |
| | | left join t_user b on (a.userId = b.id) |
| | | where a.id = #{orderId} |
| | |
| | | a.payMoney as payMoney, |
| | | a.trackId as trackId, |
| | | b.nickName as userName, |
| | | b.phone as userPhone, |
| | | a.recipient as nickName, |
| | | a.recipientPhone as phone, |
| | | a.urgent as urgent, |
| | |
| | | c.money as cancelPayMoney, |
| | | if(c.userType = 1, '用户', '平台') as cancelUser, |
| | | (select isSpecialCar from t_sys_reformist where companyId = a.companyId) as reassign, |
| | | a.driverPay |
| | | a.driverPay, |
| | | a.isFrozen, |
| | | a.priceDifference, |
| | | a.tripId, |
| | | DATE_FORMAT(a.snatchOrderTime, '%Y-%m-%d %H:%i:%s') as snatchOrderTime |
| | | from t_order_logistics a |
| | | left join t_user b on (a.userId = b.id) |
| | | left join t_order_cancel c on (a.id = c.orderId and c.orderType = a.type and c.state = 2) |
| | |
| | | state as state, |
| | | CONCAT(recipient, '-', recipientPhone) as `user`, |
| | | CONCAT(if(#{language} = 1, if(cargoType = 1, '普通货物 x ', '贵重货物 x '), if(#{language} = 2, if(cargoType = 1, 'General cargo x ', 'Valuable cargo x '), if(cargoType = 1, 'Pour marchandises générales x ', 'Marchandises de valeur x '))), cargoNumber) as cargoNumber, |
| | | driverId as driverId |
| | | driverId as driverId, |
| | | isFrozen |
| | | from t_order_logistics where 1 = 1 |
| | | <if test="null != driverId"> |
| | | and driverId = #{driverId} |
| | |
| | | payManner as payManner, |
| | | UNIX_TIMESTAMP(travelTime) as travelTime, |
| | | remark as remark, |
| | | driverPay |
| | | driverPay, |
| | | cancelMidway |
| | | from t_order_logistics where driverId = #{uid} |
| | | <if test="state == 1"> |
| | | and state not in (1, 7) |
| | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 小件物流订单 |
| | | */ |
| | | @Data |
| | | @TableName("t_order_logistics") |
| | | public class OrderLogistics { |
| | | /** |
| | |
| | | */ |
| | | @TableField("carId") |
| | | private Integer carId; |
| | | /** |
| | | * 服务车型id |
| | | */ |
| | | @TableField("serverCarModelId") |
| | | private Integer serverCarModelId; |
| | | /** |
| | | * 订单号 |
| | | */ |
| | |
| | | @TableField("orderMoney") |
| | | private Double orderMoney; |
| | | /** |
| | | * 行程费 |
| | | * 起步价 |
| | | */ |
| | | @TableField("travelMoney") |
| | | private Double travelMoney; |
| | | @TableField("startMoney") |
| | | private Double startMoney; |
| | | /** |
| | | * 小费 |
| | | * 里程公里 |
| | | */ |
| | | @TableField("tipMoney") |
| | | private Double tipMoney; |
| | | @TableField("mileageKilometers") |
| | | private Double mileageKilometers; |
| | | /** |
| | | * 里程费 |
| | | */ |
| | | @TableField("mileageMoney") |
| | | private Double mileageMoney; |
| | | /** |
| | | * 时长分钟 |
| | | */ |
| | | @TableField("duration") |
| | | private Double duration; |
| | | /** |
| | | * 时长费 |
| | | */ |
| | | @TableField("durationMoney") |
| | | private Double durationMoney; |
| | | /** |
| | | * 等待分钟 |
| | | */ |
| | | @TableField("wait") |
| | | private Double wait; |
| | | /** |
| | | * 等待费 |
| | | */ |
| | | @TableField("waitMoney") |
| | | private Double waitMoney; |
| | | /** |
| | | * 远途公里 |
| | | */ |
| | | @TableField("longDistance") |
| | | private Double longDistance; |
| | | /** |
| | | * 远途费 |
| | | */ |
| | | @TableField("longDistanceMoney") |
| | | private Double longDistanceMoney; |
| | | /** |
| | | * 停车费 |
| | | */ |
| | | @TableField("parkMoney") |
| | | private Double parkMoney; |
| | | /** |
| | | * 过路费 |
| | | */ |
| | | @TableField("roadTollMoney") |
| | | private Double roadTollMoney; |
| | | /** |
| | | * 红包抵扣金额 |
| | | */ |
| | |
| | | * 红包id |
| | | */ |
| | | @TableField("redPacketId") |
| | | private Integer redPacketId; |
| | | private String redPacketId; |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | |
| | | @TableField("payMoney") |
| | | private Double payMoney; |
| | | /** |
| | | * 状态(1=待接单,2=待出发,3=待到达预约地点,4=待取货,5=送货中,6=已送达,7=待支付,8=需补差价,9=已取货,10=已取消,11=改派中,12=已支付差价) |
| | | * 状态(1=待接单,2=待出发,3=待到达预约地点,4=待取货,5=送货中,6=已送达,7=待支付,8=需补差价,9=已取货,10=已取消,11=改派中,12=已支付差价,13=取消待支付) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | /** |
| | | * 该派前的订单状态 |
| | | * @return |
| | | */ |
| | | @TableField("oldState") |
| | | private Integer oldState; |
| | | /** |
| | | * 移动小号 |
| | | * @return |
| | | */ |
| | |
| | | */ |
| | | @TableField("driverPay") |
| | | private Integer driverPay; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Integer getDriverId() { |
| | | return driverId; |
| | | } |
| | | |
| | | public void setDriverId(Integer driverId) { |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public Integer getCarId() { |
| | | return carId; |
| | | } |
| | | |
| | | public void setCarId(Integer carId) { |
| | | this.carId = carId; |
| | | } |
| | | |
| | | public String getOrderNum() { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(String orderNum) { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | public Integer getCargoType() { |
| | | return cargoType; |
| | | } |
| | | |
| | | public void setCargoType(Integer cargoType) { |
| | | this.cargoType = cargoType; |
| | | } |
| | | |
| | | public Integer getUrgent() { |
| | | return urgent; |
| | | } |
| | | |
| | | public void setUrgent(Integer urgent) { |
| | | this.urgent = urgent; |
| | | } |
| | | |
| | | public Integer getCargoNumber() { |
| | | return cargoNumber; |
| | | } |
| | | |
| | | public void setCargoNumber(Integer cargoNumber) { |
| | | this.cargoNumber = cargoNumber; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Double getPlacementLon() { |
| | | return placementLon; |
| | | } |
| | | |
| | | public void setPlacementLon(Double placementLon) { |
| | | this.placementLon = placementLon; |
| | | } |
| | | |
| | | public Double getPlacementLat() { |
| | | return placementLat; |
| | | } |
| | | |
| | | public void setPlacementLat(Double placementLat) { |
| | | this.placementLat = placementLat; |
| | | } |
| | | |
| | | public String getPlacementAddress() { |
| | | return placementAddress; |
| | | } |
| | | |
| | | public void setPlacementAddress(String placementAddress) { |
| | | this.placementAddress = placementAddress; |
| | | } |
| | | |
| | | public Double getStartLon() { |
| | | return startLon; |
| | | } |
| | | |
| | | public void setStartLon(Double startLon) { |
| | | this.startLon = startLon; |
| | | } |
| | | |
| | | public Double getStartLat() { |
| | | return startLat; |
| | | } |
| | | |
| | | public void setStartLat(Double startLat) { |
| | | this.startLat = startLat; |
| | | } |
| | | |
| | | public String getStartAddress() { |
| | | return startAddress; |
| | | } |
| | | |
| | | public void setStartAddress(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | public Double getEndLon() { |
| | | return endLon; |
| | | } |
| | | |
| | | public void setEndLon(Double endLon) { |
| | | this.endLon = endLon; |
| | | } |
| | | |
| | | public Double getEndLat() { |
| | | return endLat; |
| | | } |
| | | |
| | | public void setEndLat(Double endLat) { |
| | | this.endLat = endLat; |
| | | } |
| | | |
| | | public String getEndAddress() { |
| | | return endAddress; |
| | | } |
| | | |
| | | public void setEndAddress(String endAddress) { |
| | | this.endAddress = endAddress; |
| | | } |
| | | |
| | | public String getRecipient() { |
| | | return recipient; |
| | | } |
| | | |
| | | public void setRecipient(String recipient) { |
| | | this.recipient = recipient; |
| | | } |
| | | |
| | | public String getRecipientPhone() { |
| | | return recipientPhone; |
| | | } |
| | | |
| | | public void setRecipientPhone(String recipientPhone) { |
| | | this.recipientPhone = recipientPhone; |
| | | } |
| | | |
| | | public Double getBoardingLon() { |
| | | return boardingLon; |
| | | } |
| | | |
| | | public void setBoardingLon(Double boardingLon) { |
| | | this.boardingLon = boardingLon; |
| | | } |
| | | |
| | | public Double getBoardingLat() { |
| | | return boardingLat; |
| | | } |
| | | |
| | | public void setBoardingLat(Double boardingLat) { |
| | | this.boardingLat = boardingLat; |
| | | } |
| | | |
| | | public String getBoardingAddress() { |
| | | return boardingAddress; |
| | | } |
| | | |
| | | public void setBoardingAddress(String boardingAddress) { |
| | | this.boardingAddress = boardingAddress; |
| | | } |
| | | |
| | | public Date getBoardingTime() { |
| | | return boardingTime; |
| | | } |
| | | |
| | | public void setBoardingTime(Date boardingTime) { |
| | | this.boardingTime = boardingTime; |
| | | } |
| | | |
| | | public Double getGetoffLon() { |
| | | return getoffLon; |
| | | } |
| | | |
| | | public void setGetoffLon(Double getoffLon) { |
| | | this.getoffLon = getoffLon; |
| | | } |
| | | |
| | | public Double getGetoffLat() { |
| | | return getoffLat; |
| | | } |
| | | |
| | | public void setGetoffLat(Double getoffLat) { |
| | | this.getoffLat = getoffLat; |
| | | } |
| | | |
| | | public String getGetoffAddress() { |
| | | return getoffAddress; |
| | | } |
| | | |
| | | public void setGetoffAddress(String getoffAddress) { |
| | | this.getoffAddress = getoffAddress; |
| | | } |
| | | |
| | | public Date getGetoffTime() { |
| | | return getoffTime; |
| | | } |
| | | |
| | | public void setGetoffTime(Date getoffTime) { |
| | | this.getoffTime = getoffTime; |
| | | } |
| | | |
| | | public Double getMileage() { |
| | | return mileage; |
| | | } |
| | | |
| | | public void setMileage(Double mileage) { |
| | | this.mileage = mileage; |
| | | } |
| | | |
| | | public Integer getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public void setPayType(Integer payType) { |
| | | this.payType = payType; |
| | | } |
| | | |
| | | public Double getOrderMoney() { |
| | | return orderMoney; |
| | | } |
| | | |
| | | public void setOrderMoney(Double orderMoney) { |
| | | this.orderMoney = orderMoney; |
| | | } |
| | | |
| | | public Double getTravelMoney() { |
| | | return travelMoney; |
| | | } |
| | | |
| | | public void setTravelMoney(Double travelMoney) { |
| | | this.travelMoney = travelMoney; |
| | | } |
| | | |
| | | public Double getTipMoney() { |
| | | return tipMoney; |
| | | } |
| | | |
| | | public void setTipMoney(Double tipMoney) { |
| | | this.tipMoney = tipMoney; |
| | | } |
| | | |
| | | public Double getRedPacketMoney() { |
| | | return redPacketMoney; |
| | | } |
| | | |
| | | public void setRedPacketMoney(Double redPacketMoney) { |
| | | this.redPacketMoney = redPacketMoney; |
| | | } |
| | | |
| | | public Double getCouponMoney() { |
| | | return couponMoney; |
| | | } |
| | | |
| | | public void setCouponMoney(Double couponMoney) { |
| | | this.couponMoney = couponMoney; |
| | | } |
| | | |
| | | public Integer getRedPacketId() { |
| | | return redPacketId; |
| | | } |
| | | |
| | | public void setRedPacketId(Integer redPacketId) { |
| | | this.redPacketId = redPacketId; |
| | | } |
| | | |
| | | public Integer getCouponId() { |
| | | return couponId; |
| | | } |
| | | |
| | | public void setCouponId(Integer couponId) { |
| | | this.couponId = couponId; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Double getPayMoney() { |
| | | return payMoney; |
| | | } |
| | | |
| | | public void setPayMoney(Double payMoney) { |
| | | this.payMoney = payMoney; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Date getTravelTime() { |
| | | return travelTime; |
| | | } |
| | | |
| | | public void setTravelTime(Date travelTime) { |
| | | this.travelTime = travelTime; |
| | | } |
| | | |
| | | public Date getSnatchOrderTime() { |
| | | return snatchOrderTime; |
| | | } |
| | | |
| | | public void setSnatchOrderTime(Date snatchOrderTime) { |
| | | this.snatchOrderTime = snatchOrderTime; |
| | | } |
| | | |
| | | public Date getSetOutTime() { |
| | | return setOutTime; |
| | | } |
| | | |
| | | public void setSetOutTime(Date setOutTime) { |
| | | this.setOutTime = setOutTime; |
| | | } |
| | | |
| | | public Date getArriveTime() { |
| | | return arriveTime; |
| | | } |
| | | |
| | | public void setArriveTime(Date arriveTime) { |
| | | this.arriveTime = arriveTime; |
| | | } |
| | | |
| | | public Date getStartServiceTime() { |
| | | return startServiceTime; |
| | | } |
| | | |
| | | public void setStartServiceTime(Date startServiceTime) { |
| | | this.startServiceTime = startServiceTime; |
| | | } |
| | | |
| | | public Date getEndServiceTime() { |
| | | return endServiceTime; |
| | | } |
| | | |
| | | public void setEndServiceTime(Date endServiceTime) { |
| | | this.endServiceTime = endServiceTime; |
| | | } |
| | | |
| | | public Integer getOrderSource() { |
| | | return orderSource; |
| | | } |
| | | |
| | | public void setOrderSource(Integer orderSource) { |
| | | this.orderSource = orderSource; |
| | | } |
| | | |
| | | |
| | | public Integer getInvoiceId() { |
| | | return invoiceId; |
| | | } |
| | | |
| | | public void setInvoiceId(Integer invoiceId) { |
| | | this.invoiceId = invoiceId; |
| | | } |
| | | |
| | | public Integer getPayManner() { |
| | | return payManner; |
| | | } |
| | | |
| | | public void setPayManner(Integer payManner) { |
| | | this.payManner = payManner; |
| | | } |
| | | |
| | | public String getTrackId() { |
| | | return trackId; |
| | | } |
| | | |
| | | public void setTrackId(String trackId) { |
| | | this.trackId = trackId; |
| | | } |
| | | |
| | | public Double getDiscount() { |
| | | return discount; |
| | | } |
| | | |
| | | public void setDiscount(Double discount) { |
| | | this.discount = discount; |
| | | } |
| | | |
| | | public Double getDiscountMoney() { |
| | | return discountMoney; |
| | | } |
| | | |
| | | public void setDiscountMoney(Double discountMoney) { |
| | | this.discountMoney = discountMoney; |
| | | } |
| | | |
| | | public Integer getActivityId() { |
| | | return activityId; |
| | | } |
| | | |
| | | public void setActivityId(Integer activityId) { |
| | | this.activityId = activityId; |
| | | } |
| | | |
| | | public Integer getIsDelete() { |
| | | return isDelete; |
| | | } |
| | | |
| | | public void setIsDelete(Integer isDelete) { |
| | | this.isDelete = isDelete; |
| | | } |
| | | |
| | | public Integer getOldState() { |
| | | return oldState; |
| | | } |
| | | |
| | | public void setOldState(Integer oldState) { |
| | | this.oldState = oldState; |
| | | } |
| | | |
| | | public String getTelX() { |
| | | return telX; |
| | | } |
| | | |
| | | public void setTelX(String telX) { |
| | | this.telX = telX; |
| | | } |
| | | |
| | | public String getBindId() { |
| | | return bindId; |
| | | } |
| | | |
| | | public void setBindId(String bindId) { |
| | | this.bindId = bindId; |
| | | } |
| | | |
| | | public String getPickUpCode() { |
| | | return pickUpCode; |
| | | } |
| | | |
| | | public void setPickUpCode(String pickUpCode) { |
| | | this.pickUpCode = pickUpCode; |
| | | } |
| | | |
| | | public Integer getIsReassign() { |
| | | return isReassign; |
| | | } |
| | | |
| | | public void setIsReassign(Integer isReassign) { |
| | | this.isReassign = isReassign; |
| | | } |
| | | |
| | | public Integer getReassignNotice() { |
| | | return reassignNotice; |
| | | } |
| | | |
| | | public void setReassignNotice(Integer reassignNotice) { |
| | | this.reassignNotice = reassignNotice; |
| | | } |
| | | |
| | | public Integer getDriverPay() { |
| | | return driverPay; |
| | | } |
| | | |
| | | public void setDriverPay(Integer driverPay) { |
| | | this.driverPay = driverPay; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderLogistics{" + |
| | | "id=" + id + |
| | | ", type=" + type + |
| | | ", userId=" + userId + |
| | | ", driverId=" + driverId + |
| | | ", carId=" + carId + |
| | | ", orderNum='" + orderNum + '\'' + |
| | | ", cargoType=" + cargoType + |
| | | ", cargoNumber=" + cargoNumber + |
| | | ", remark=" + remark + |
| | | ", placementLon=" + placementLon + |
| | | ", placementLat=" + placementLat + |
| | | ", placementAddress='" + placementAddress + '\'' + |
| | | ", startLon=" + startLon + |
| | | ", startLat=" + startLat + |
| | | ", startAddress='" + startAddress + '\'' + |
| | | ", endLon=" + endLon + |
| | | ", endLat=" + endLat + |
| | | ", endAddress='" + endAddress + '\'' + |
| | | ", recipient='" + recipient + '\'' + |
| | | ", recipientPhone='" + recipientPhone + '\'' + |
| | | ", boardingLon=" + boardingLon + |
| | | ", boardingLat=" + boardingLat + |
| | | ", boardingAddress='" + boardingAddress + '\'' + |
| | | ", boardingTime=" + boardingTime + |
| | | ", getoffLon=" + getoffLon + |
| | | ", getoffLat=" + getoffLat + |
| | | ", getoffAddress='" + getoffAddress + '\'' + |
| | | ", getoffTime=" + getoffTime + |
| | | ", mileage=" + mileage + |
| | | ", payManner=" + payManner + |
| | | ", payType=" + payType + |
| | | ", orderMoney=" + orderMoney + |
| | | ", travelMoney=" + travelMoney + |
| | | ", tipMoney=" + tipMoney + |
| | | ", redPacketMoney=" + redPacketMoney + |
| | | ", couponMoney=" + couponMoney + |
| | | ", redPacketId=" + redPacketId + |
| | | ", couponId=" + couponId + |
| | | ", discount=" + discount + |
| | | ", discountMoney=" + discountMoney + |
| | | ", activityId=" + activityId + |
| | | ", companyId=" + companyId + |
| | | ", payMoney=" + payMoney + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | ", travelTime=" + travelTime + |
| | | ", snatchOrderTime=" + snatchOrderTime + |
| | | ", setOutTime=" + setOutTime + |
| | | ", arriveTime=" + arriveTime + |
| | | ", startServiceTime=" + startServiceTime + |
| | | ", endServiceTime=" + endServiceTime + |
| | | ", orderSource=" + orderSource + |
| | | ", invoiceId=" + invoiceId + |
| | | ", trackId='" + trackId + '\'' + |
| | | ", isDelete=" + isDelete + |
| | | ", telX='" + telX + '\'' + |
| | | ", bindId='" + bindId + '\'' + |
| | | '}'; |
| | | } |
| | | /** |
| | | * 改派之前的订单状态 |
| | | * @return |
| | | */ |
| | | @TableField("oldState") |
| | | private Integer oldState; |
| | | /** |
| | | * 修改目的地经度 |
| | | */ |
| | | @TableField("destinationLon") |
| | | private String destinationLon; |
| | | /** |
| | | * 修改目的地纬度 |
| | | */ |
| | | @TableField("destinationLat") |
| | | private String destinationLat; |
| | | /** |
| | | * 修改目的地地址 |
| | | */ |
| | | @TableField("destination") |
| | | private String destination; |
| | | private Integer isplatPay; |
| | | private BigDecimal freeMoney; |
| | | /** |
| | | * 补差价金额 |
| | | */ |
| | | @TableField("priceDifference") |
| | | private Double priceDifference; |
| | | /** |
| | | * 起步里程 |
| | | */ |
| | | @TableField("startMileage") |
| | | private Double startMileage; |
| | | /** |
| | | * 中途取消(0=否,1=是) |
| | | */ |
| | | @TableField("cancelMidway") |
| | | private Integer cancelMidway; |
| | | /** |
| | | * google行程id |
| | | */ |
| | | @TableField("tripId") |
| | | private String tripId; |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | void payOrderLogisticsCallback(Integer id, String order_id, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 处理乘客修改终点 |
| | | * @param orderId |
| | | * @param status |
| | | */ |
| | | void updateEndAddress(Integer orderId, Integer status); |
| | | |
| | | |
| | | /** |
| | | * 获取费用明细 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Map<String, Object> queryMoneyInfo(Integer orderId) throws Exception; |
| | | |
| | | /** |
| | | * 确认费用操作 |
| | | * @param orderId |
| | | * @param type |
| | | * @param parkingFee |
| | | * @param crossingFee |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil confirmFees(Integer language, Integer orderId, Integer type, Double parkingFee, Double crossingFee) throws Exception; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogisticsSpread; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsSpreadService; |
| | | import com.stylefeng.guns.modular.system.dao.CarMapper; |
| | | import com.stylefeng.guns.modular.system.dao.RegionMapper; |
| | | import com.stylefeng.guns.modular.system.dao.UserInfoMapper; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; |
| | | import com.stylefeng.guns.modular.system.util.quartz.QuartzUtil; |
| | | import com.stylefeng.guns.modular.system.util.quartz.jobs.OrderTimeOutJob; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import org.apache.shiro.util.StringUtils; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.jsoup.select.Elements; |
| | | import org.quartz.JobDataMap; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Autowired |
| | | private IOrderEvaluateService orderEvaluateService; |
| | | |
| | | @Autowired |
| | | private IReminderRulesService reminderRulesService; |
| | | |
| | | @Resource |
| | | private SystemPriceMapper systemPriceMapper; |
| | | |
| | | @Autowired |
| | | private FleetEngineUtil fleetEngineUtil; |
| | | |
| | | @Resource |
| | | private CarModelMapper carModelMapper; |
| | | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | if(orderLogistics.getState() != 1){ |
| | | return ResultUtil.error(language == 1 ? "手速有点慢哦,订单已被抢啦" : language == 2 ? "Too slow, order was snatched!" : "Trop lent, l’ordre a été arraché!"); |
| | | } |
| | | |
| | | Driver driver = driverService.selectById(uid); |
| | | orderLogistics.setDriverId(uid); |
| | | orderLogistics.setCarId(driver.getCarId()); |
| | |
| | | driver.getCompanyId() != null && driver.getCompanyId() != 0 ? driver.getCompanyId() : 1)); |
| | | orderLogistics.setState(2); |
| | | orderLogistics.setSnatchOrderTime(new Date()); |
| | | |
| | | //调用高德创建轨迹 |
| | | // String s = gdFalconUtil.selectTerminal(driver.getPhone()); |
| | | // String track = gdFalconUtil.createTrack(s); |
| | | // orderLogistics.setTrackId(track); |
| | | |
| | | //调用移动的小号接口 |
| | | // Map<String, String> geocode = gdMapGeocodingUtil.geocode(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString()); |
| | | // Region region = regionMapper.query(geocode.get("districtCode")); |
| | | // Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderLogistics.getRecipientPhone(), driver.getPhone(), Integer.valueOf(region.getCitycode().substring(1))); |
| | | // if(String.valueOf(map.get("code")).equals("200")){ |
| | | // orderLogistics.setTelX(map.get("telX")); |
| | | // orderLogistics.setBindId(map.get("bindId")); |
| | | // } |
| | | |
| | | if(!StringUtils.hasLength(orderLogistics.getTripId())){ |
| | | orderLogistics.setTripId(UUIDUtil.getRandomCode()); |
| | | } |
| | | this.updateById(orderLogistics); |
| | | |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(driver.getCompanyId()); |
| | | Double speMoney = orderLogistics.getType() == 4 ? company.getSameLogisticsMoney() : company.getCrossLogisticsMoney(); |
| | | BigDecimal d = null;//企业收入 |
| | | BigDecimal c = null;//司机收入 |
| | | if(company.getIsSpeFixedOrProportional() == 2){//固定 |
| | | d = new BigDecimal(speMoney); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d);//只有出行金额参与抽成,其余归属司机 |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | Double price = orderLogistics.getTravelMoney(); |
| | | d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | // incomeService.saveData(1, orderLogistics.getCompanyId(), 2, orderLogistics.getId(), orderLogistics.getType(), d.doubleValue()); |
| | | // incomeService.saveData(2, orderLogistics.getDriverId(), 2, orderLogistics.getId(), orderLogistics.getType(), c.doubleValue()); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | //修改司机为服务中 |
| | | driver.setState(3); |
| | | driverService.updateById(driver); |
| | | |
| | | //添加定时任务(普通任务) |
| | | ReminderRules reminderRules = reminderRulesService.selectOne(new EntityWrapper<ReminderRules>().eq("companyId", driver.getCompanyId())); |
| | | if(null != reminderRules){ |
| | | JSONObject jsonObject = JSON.parseObject(reminderRules.getContent()); |
| | | long packageTimeoutReminderInterval = jsonObject.getInteger("packageTimeoutReminderInterval") * 60000L; |
| | | long m = (System.currentTimeMillis() - orderLogistics.getSnatchOrderTime().getTime()) / 60000; |
| | | JobDataMap jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("driverId", uid); |
| | | jobDataMap.put("orderId", orderLogistics.getId()); |
| | | jobDataMap.put("orderType", 4); |
| | | jobDataMap.put("describe", language == 1 ? "您的包裹订单已超时" + m + "分钟,请抓紧!" : language == 2 ? "Your delivery order is overdue for " + m + " minute(s), please go faster." : "Votre commande de livraison est en retard depuis " + m + " minute(s), veuillez aller plus vite."); |
| | | QuartzUtil.addSimpleQuartzTask( |
| | | new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderLogistics.getId() + "_4", "ORDER_TIME_OUT", jobDataMap) |
| | | , new Date(packageTimeoutReminderInterval), packageTimeoutReminderInterval, -1); |
| | | } |
| | | |
| | | Car car = carService.selectById(orderLogistics.getCarId()); |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carService.updateById(car); |
| | | } |
| | | String trip = fleetEngineUtil.getTrip(orderLogistics.getTripId()); |
| | | if(ToolUtil.isEmpty(trip)){ |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | fleetEngineUtil.createTrip(car.getVehicleId(), 1, orderLogistics.getTripId(), |
| | | orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(), orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | }else{ |
| | | //开始修改行程数据 |
| | | fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); |
| | | } |
| | | |
| | | //推送相关代码------------------start---------------- |
| | | new Thread(new Runnable() { |
| | |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState()); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState()); |
| | | } |
| | | }).start(); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushDriverPosition(orderId, orderLogistics.getType()); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | List<OrderLogisticsSpread> orderLogisticsId = spreadService.selectList(new EntityWrapper<OrderLogisticsSpread>().eq("orderLogisticsId", orderLogistics.getId()).eq("payType",4)); |
| | | |
| | | |
| | | String tripStatus = "UNKNOWN_TRIP_STATUS"; |
| | | switch (state){ |
| | | case 3://出发前往预约点 |
| | | orderLogistics.setState(3); |
| | | orderLogistics.setSetOutTime(new Date()); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "司机已出发,请耐心等待" : language == 2 ? "The driver is on the way, please wait." : "Le chauffeur est en route. Veuillez patienter.", orderLogistics.getUserId()); |
| | | pushUtil.pushDriverPosition(orderId, 4); |
| | | tripStatus = "ENROUTE_TO_PICKUP"; |
| | | break; |
| | | case 4://到达预约点,等待客户上车 |
| | | orderLogistics.setState(4); |
| | | orderLogistics.setArriveTime(new Date()); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "司机已到达您设置的预约地点。" : language == 2 ? "The driver has arrived at the reserved location." : "Le chauffeur est arrivé à l'endroit prévu.", orderLogistics.getUserId()); |
| | | tripStatus = "ARRIVED_AT_PICKUP"; |
| | | break; |
| | | case 5://开始服务 |
| | | orderLogistics.setBoardingLon(lon); |
| | |
| | | orderLogistics.setBoardingTime(new Date()); |
| | | orderLogistics.setState(5); |
| | | orderLogistics.setStartServiceTime(new Date()); |
| | | |
| | | pushUtil.pushDriverPosition(orderLogistics.getId(), orderLogistics.getType());//主动推送司机定位 |
| | | tripStatus = "ENROUTE_TO_DROPOFF"; |
| | | break; |
| | | case 6://结束服务(专车可以返回继续服务)不修改状态 |
| | | case 6://结束服务 |
| | | orderLogistics.setGetoffLon(lon); |
| | | orderLogistics.setGetoffLat(lat); |
| | | orderLogistics.setGetoffAddress(address); |
| | | orderLogistics.setGetoffTime(new Date()); |
| | | orderLogistics.setEndServiceTime(new Date()); |
| | | orderLogistics.setState(6); |
| | | |
| | | if(orderLogistics.getPayType() != 4){ |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderLogistics.getCompanyId()); |
| | | Double speMoney = company.getSameLogisticsMoney(); |
| | | BigDecimal d = null;//企业收入 |
| | | BigDecimal c = null;//司机收入 |
| | | if(company.getIsSameLogisticsFixedOrProportional() == 2){//固定 |
| | | d = new BigDecimal(speMoney); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d);//只有出行金额参与抽成,其余归属司机 |
| | | } |
| | | if(company.getIsSameLogisticsFixedOrProportional() == 1){//比例 |
| | | Double price = orderLogistics.getOrderMoney(); |
| | | d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | |
| | | incomeService.saveData(1, orderLogistics.getCompanyId(), 2, orderLogistics.getId(), 4, d.doubleValue()); |
| | | incomeService.saveData(2, orderLogistics.getDriverId(), 2, orderLogistics.getId(), 4, c.doubleValue()); |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | if (orderLogistics.getPayType()==4||!orderLogisticsId.isEmpty()){ |
| | | double sum = 0; |
| | | if (orderLogistics.getPayType()==4){ |
| | | sum= orderLogistics.getOrderMoney(); |
| | | } |
| | | |
| | | if (!orderLogisticsId.isEmpty()){ |
| | | for (OrderLogisticsSpread orderLogisticsSpread : orderLogisticsId) { |
| | | sum = sum +orderLogisticsSpread.getPrice(); |
| | | } |
| | | } |
| | | |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | if(null != orderLogistics.getCouponMoney() && 0 < orderLogistics.getCouponMoney()){ |
| | | Double money = orderLogistics.getCouponMoney(); |
| | | incomeService.saveData(2, orderLogistics.getDriverId(), 5, orderLogistics.getId(), orderLogistics.getType(), money); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | if(null != orderLogistics.getDiscountMoney() && 0 < orderLogistics.getDiscountMoney()){ |
| | | Double money = orderLogistics.getDiscountMoney(); |
| | | incomeService.saveData(2, orderLogistics.getDriverId(), 6, orderLogistics.getId(), orderLogistics.getType(), money); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | if(null != orderLogistics.getRedPacketMoney() && 0 < orderLogistics.getRedPacketMoney()){ |
| | | Double money = orderLogistics.getRedPacketMoney(); |
| | | incomeService.saveData(2, orderLogistics.getDriverId(), 7, orderLogistics.getId(), orderLogistics.getType(), money); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | |
| | | |
| | | Company company = companyService.selectById(orderLogistics.getCompanyId()); |
| | | Double speMoney = company.getSameLogisticsMoney(); |
| | | BigDecimal d = null;//企业收入 |
| | | BigDecimal c = null;//司机收入 |
| | | if(company.getIsSameLogisticsFixedOrProportional() == 2){//固定 |
| | | d = new BigDecimal(speMoney); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d);//只有出行金额参与抽成,其余归属司机 |
| | | } |
| | | if(company.getIsSameLogisticsFixedOrProportional() == 1){//比例 |
| | | Double price = orderLogistics.getOrderMoney(); |
| | | d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | //记录司机待结算金额 |
| | | if(d.compareTo(new BigDecimal(0)) > 0){ |
| | | SettlementDetail settlementDetail = new SettlementDetail(); |
| | | settlementDetail.setOrderId(orderId); |
| | | settlementDetail.setOrderType(4); |
| | | settlementDetail.setDriverId(orderLogistics.getDriverId()); |
| | | settlementDetail.setOrderMoney(sum); |
| | | settlementDetail.setPrice(d.doubleValue()); |
| | | settlementDetail.setCreateTime(new Date()); |
| | | settlementDetailService.insert(settlementDetail); |
| | | |
| | | SettlementAllocation settlementAllocation = settlementAllocationService.selectOne(null); |
| | | if(null != settlementAllocation){ |
| | | JSONObject jsonObject = JSON.parseObject(settlementAllocation.getContent()); |
| | | Double maxPrice = jsonObject.getDouble("maxPrice"); |
| | | Integer type = jsonObject.getInteger("type"); |
| | | if(type == 1){ |
| | | List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", orderLogistics.getDriverId()).isNull("settlementRecordId").last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(createTime, '%Y-%m-%d')")); |
| | | BigDecimal total = new BigDecimal(0); |
| | | for (SettlementDetail detail : settlementDetailList) { |
| | | total = total.add(new BigDecimal(detail.getPrice())); |
| | | } |
| | | if(maxPrice.compareTo(total.doubleValue()) <= 0){ |
| | | SettlementRecord settlementRecord = settlementRecordService.selectOne(new EntityWrapper<SettlementRecord>().eq("driverId", orderLogistics.getDriverId()) |
| | | .eq("type", type).eq("paymentStatus", 1).last(" and day = DATE_FORMAT(now(), '%Y-%m-%d')")); |
| | | if(null == settlementRecord){ |
| | | settlementRecord = new SettlementRecord(); |
| | | settlementRecord.setDay(new Date()); |
| | | settlementRecord.setDriverId(orderLogistics.getDriverId()); |
| | | settlementRecord.setType(type); |
| | | settlementRecord.setPaymentStatus(1); |
| | | settlementRecord.setPayMoney(total.doubleValue()); |
| | | settlementRecord.setInsertTime(new Date()); |
| | | settlementRecordService.insert(settlementRecord); |
| | | }else{ |
| | | settlementRecord.setPayMoney(total.doubleValue()); |
| | | settlementRecordService.updateById(settlementRecord); |
| | | } |
| | | for (SettlementDetail detail : settlementDetailList) { |
| | | detail.setSettlementRecordId(settlementRecord.getId()); |
| | | settlementDetailService.updateById(detail); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | tripStatus = "COMPLETE"; |
| | | break; |
| | | } |
| | | this.updateById(orderLogistics); |
| | | |
| | | if(6 == state && ToolUtil.isNotEmpty(pickUpCode)){ |
| | | fillInPickUpCode(orderId, pickUpCode, language); |
| | | } |
| | | |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | Car car = carMapper.selectById(driver.getCarId()); |
| | | //修改行程数据 |
| | | fleetEngineUtil.updateTrip(tripStatus, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); |
| | | |
| | | // TODO: 2020/6/5 推送状态 |
| | | new Thread(new Runnable() { |
| | |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState()); |
| | | } |
| | | }).start(); |
| | | |
| | | |
| | | if(state == 6){ |
| | | UserInfo userInfo = userInfoMapper.selectById(orderLogistics.getUserId()); |
| | | language = userInfo.getLanguage(); |
| | | String payTypeChinese = ""; |
| | | String payTypeEnglish = ""; |
| | | String payTypeFrench = ""; |
| | | if(orderLogistics.getPayType() == 1){ |
| | | payTypeChinese = "手机支付"; |
| | | payTypeEnglish = "Mobile money"; |
| | | payTypeFrench = "Argent mobile"; |
| | | } |
| | | if(orderLogistics.getPayType() == 2){ |
| | | payTypeChinese = "银行卡支付"; |
| | | payTypeEnglish = "Bank card"; |
| | | payTypeFrench = "Carte bancaire"; |
| | | } |
| | | if(orderLogistics.getPayType() == 3){ |
| | | payTypeChinese = "余额支付"; |
| | | payTypeEnglish = "I-GO Wallet"; |
| | | payTypeFrench = "Portefeuille I-GO"; |
| | | } |
| | | if(orderLogistics.getPayType() == 3){ |
| | | payTypeChinese = "现金"; |
| | | payTypeEnglish = "Cash"; |
| | | payTypeFrench = "En espèces"; |
| | | } |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/receiptLogistics.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | Car car = carMapper.selectById(orderLogistics.getCarId()); |
| | | Double aDouble = 0D; |
| | | if(null != orderLogistics.getDriverId()){ |
| | | aDouble = orderEvaluateService.queryDriverScore(orderLogistics.getDriverId()); |
| | | } |
| | | if(1 == language){ |
| | | document.getElementById("english").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("I-GO电子收据"); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",您在I-GO此订单消费GHS " + orderLogistics.getPayMoney()); |
| | | Element xcf_chinese = document.getElementById("xcf_chinese"); |
| | | xcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){ |
| | | Element yhq_chinese = document.getElementById("yhq_chinese"); |
| | | yhq_chinese.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element yhq_chinese_div = document.getElementById("yhq_chinese_div"); |
| | | yhq_chinese_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){ |
| | | Element zk_chinese = document.getElementById("zk_chinese"); |
| | | zk_chinese.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element zk_chinese_div = document.getElementById("zk_chinese_div"); |
| | | zk_chinese_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){ |
| | | Element hb_chinese = document.getElementById("hb_chinese"); |
| | | hb_chinese.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element hb_chinese_div = document.getElementById("hb_chinese_div"); |
| | | hb_chinese_div.remove(); |
| | | } |
| | | Element xj_chinese = document.getElementById("xj_chinese"); |
| | | xj_chinese.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pay_type_chinese = document.getElementById("pay_type_chinese"); |
| | | pay_type_chinese.text(payTypeChinese); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pdf_chinese = document.getElementById("pdf_chinese"); |
| | | pdf_chinese.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_chinese = document.getElementById("lost_item_chinese"); |
| | | lost_item_chinese.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_chinese = document.getElementById("track_chinese"); |
| | | // track_chinese.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_chinese = document.getElementsByClass("driver_chinese"); |
| | | for (int i = 0; i < driver_chinese.size(); i++) { |
| | | Element element = driver_chinese.get(i); |
| | | element.text(" " + driver.getFirstName() + "." + driver.getLastName()); |
| | | } |
| | | Element cp_chinese = document.getElementById("cp_chinese"); |
| | | cp_chinese.text("车牌:" + car.getCarLicensePlate()); |
| | | Element pf_chinese = document.getElementById("pf_chinese"); |
| | | pf_chinese.text("司机评分:" + aDouble); |
| | | Element start_address_chinese = document.getElementById("start_address_chinese"); |
| | | start_address_chinese.text(orderLogistics.getStartAddress()); |
| | | Element end_address_chinese = document.getElementById("end_address_chinese"); |
| | | end_address_chinese.text(orderLogistics.getEndAddress()); |
| | | Phone phone = phoneService.selectOne(new EntityWrapper<Phone>().eq("type", 2).eq("companyId", driver.getCompanyId())); |
| | | Element server_tel_chinese = document.getElementById("server_tel_chinese"); |
| | | server_tel_chinese.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("Receipt"); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip "); |
| | | Element xcf_english = document.getElementById("xcf_english"); |
| | | xcf_english.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){ |
| | | Element yhq_english = document.getElementById("yhq_english"); |
| | | yhq_english.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element yhq_english_div = document.getElementById("yhq_english_div"); |
| | | yhq_english_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){ |
| | | Element zk_english = document.getElementById("zk_english"); |
| | | zk_english.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element zk_english_div = document.getElementById("zk_english_div"); |
| | | zk_english_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){ |
| | | Element hb_english = document.getElementById("hb_english"); |
| | | hb_english.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element hb_english_div = document.getElementById("hb_english_div"); |
| | | hb_english_div.remove(); |
| | | } |
| | | Element xj_english = document.getElementById("xj_english"); |
| | | xj_english.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pay_type_english = document.getElementById("pay_type_english"); |
| | | pay_type_english.text(payTypeEnglish); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pdf_english = document.getElementById("pdf_english"); |
| | | pdf_english.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_english = document.getElementById("lost_item_english"); |
| | | lost_item_english.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_english = document.getElementById("track_english"); |
| | | // track_english.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_english = document.getElementsByClass("driver_english"); |
| | | for (int i = 0; i < driver_english.size(); i++) { |
| | | Element element = driver_english.get(i); |
| | | element.text(" " + driver.getFirstName() + "." + driver.getLastName()); |
| | | } |
| | | Element cp_english = document.getElementById("cp_english"); |
| | | cp_english.text("Number Plate:" + car.getCarLicensePlate()); |
| | | Element pf_english = document.getElementById("pf_english"); |
| | | pf_english.text("Driver Rating:" + aDouble); |
| | | Element start_address_english = document.getElementById("start_address_english"); |
| | | start_address_english.text(orderLogistics.getStartAddress()); |
| | | Element end_address_english = document.getElementById("end_address_english"); |
| | | end_address_english.text(orderLogistics.getEndAddress()); |
| | | Phone phone = phoneService.selectOne(new EntityWrapper<Phone>().eq("type", 2).eq("companyId", driver.getCompanyId())); |
| | | Element server_tel_english = document.getElementById("server_tel_english"); |
| | | server_tel_english.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("english").remove(); |
| | | document.getElementsByTag("title").get(0).text("Reçu"); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le "); |
| | | Element xcf_french = document.getElementById("xcf_french"); |
| | | xcf_french.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){ |
| | | Element yhq_french = document.getElementById("yhq_french"); |
| | | yhq_french.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element yhq_french_div = document.getElementById("yhq_french_div"); |
| | | yhq_french_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){ |
| | | Element zk_french = document.getElementById("zk_french"); |
| | | zk_french.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element zk_french_div = document.getElementById("zk_french_div"); |
| | | zk_french_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){ |
| | | Element hb_french = document.getElementById("hb_french"); |
| | | hb_french.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element hb_french_div = document.getElementById("hb_french_div"); |
| | | hb_french_div.remove(); |
| | | } |
| | | Element xj_french = document.getElementById("xj_french"); |
| | | xj_french.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pay_type_french = document.getElementById("pay_type_french"); |
| | | pay_type_french.text(payTypeFrench); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pdf_french = document.getElementById("pdf_french"); |
| | | pdf_french.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_french = document.getElementById("lost_item_french"); |
| | | lost_item_french.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_french = document.getElementById("track_french"); |
| | | // track_french.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_french = document.getElementsByClass("driver_french"); |
| | | for (int i = 0; i < driver_french.size(); i++) { |
| | | Element element = driver_french.get(i); |
| | | element.text(" " + driver.getFirstName() + "." + driver.getLastName()); |
| | | } |
| | | Element cp_french = document.getElementById("cp_french"); |
| | | cp_french.text("Plaque: GS " + car.getCarLicensePlate()); |
| | | Element pf_french = document.getElementById("pf_french"); |
| | | pf_french.text("Note du chauffeur: " + aDouble); |
| | | Element start_address_french = document.getElementById("start_address_french"); |
| | | start_address_french.text(orderLogistics.getStartAddress()); |
| | | Element end_address_french = document.getElementById("end_address_french"); |
| | | end_address_french.text(orderLogistics.getEndAddress()); |
| | | Phone phone = phoneService.selectOne(new EntityWrapper<Phone>().eq("type", 2).eq("companyId", driver.getCompanyId())); |
| | | Element server_tel_french = document.getElementById("server_tel_french"); |
| | | server_tel_french.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "I-GO电子收据" : language == 2 ? "Receipt" : "Reçu", document.html()); |
| | | |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/parcel_receipt_" + orderId + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | File file1 = new File("/usr/local/nginx/html/files/pdf/"); |
| | | if(!file1.exists()){ |
| | | file1.mkdirs(); |
| | | } |
| | | file1 = new File("/usr/local/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf"); |
| | | if(!file1.exists()){ |
| | | file1.createNewFile(); |
| | | } |
| | | try{ |
| | | FileOutputStream fileOutputStream = new FileOutputStream(file1); |
| | | HtmlToPdfUtils.convertToPdf("/usr/local/nginx/html/files/html/parcel_receipt_" + orderId + ".html", "I-GO", fileOutputStream); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | System.out.println("html转pdf异常"); |
| | | } |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/parcel_receipt_" + orderId + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(userInfo.getId()); |
| | | tEmail.setType(1); |
| | | tEmail.setName(language == 1 ? "I-GO电子收据" : language == 2 ? "Receipt" : "Reçu"); |
| | | tEmail.setOrderId(orderId); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | String week = EmailUtil.getWeek(language, i); |
| | | tEmail.setWeek(week); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil makeUpTheDifference(Integer orderId, Double difference, Integer language) throws Exception { |
| | | OrderLogisticsSpread query = orderLogisticsSpreadService.query(orderId); |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | if(orderLogistics.getState() != 4 && orderLogistics.getState() != 8){ |
| | | if(orderLogistics.getState() != 4){ |
| | | return ResultUtil.error(language == 1 ? "不允许设置差价" : language == 2 ? "To set price difference is not allowed." : "Il n’est pas permis de définir une différence de prix."); |
| | | } |
| | | if(query != null){ |
| | | query.setPrice(difference); |
| | | orderLogisticsSpreadService.updateById(query); |
| | | return ResultUtil.success(); |
| | | } |
| | | OrderLogisticsSpread orderLogisticsSpread = new OrderLogisticsSpread(); |
| | | orderLogisticsSpread.setOrderLogisticsId(orderId); |
| | | orderLogisticsSpread.setPrice(difference); |
| | | orderLogisticsSpreadService.insert(orderLogisticsSpread); |
| | | orderLogistics.setState(8); |
| | | this.updateById(orderLogistics); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushPayDifference(1, orderLogistics.getUserId(), orderId, orderLogistics.getType(), difference); |
| | | } |
| | | }).start(); |
| | | //推送给乘客,需要乘客确认后再加 |
| | | pushUtil.pushPayDifference(1, orderLogistics.getUserId(), orderId, orderLogistics.getType(), difference, 1); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState()); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState()); |
| | | } |
| | | }).start(); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushDriverPosition(orderId, orderLogistics.getType()); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | System.err.println("预支付数据异常(orderId = " + id + ")"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理乘客修改终点 |
| | | * @param orderId |
| | | * @param status |
| | | */ |
| | | @Override |
| | | public void updateEndAddress(Integer orderId, Integer status) { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | if(2 == status){ |
| | | orderLogistics.setEndLon(Double.valueOf(orderLogistics.getDestinationLon())); |
| | | orderLogistics.setEndLat(Double.valueOf(orderLogistics.getDestinationLat())); |
| | | orderLogistics.setEndAddress(orderLogistics.getDestination()); |
| | | } |
| | | orderLogistics.setDestinationLon(""); |
| | | orderLogistics.setDestination(""); |
| | | orderLogistics.setDestinationLat(""); |
| | | this.updateById(orderLogistics); |
| | | pushUtil.pushModifyAddress(1, orderLogistics.getUserId(), orderId, 4, status); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取费用明细 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Map<String, Object> queryMoneyInfo(Integer orderId) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | if(orderLogistics.getState() == 5){//服务中的时候获取实时费用数据 |
| | | this.setMoney(orderLogistics, 0D, 0D); |
| | | } |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("orderMoney", orderLogistics.getOrderMoney());//订单金额 |
| | | map.put("startMileage", orderLogistics.getStartMileage());//起步价 |
| | | map.put("startMoney", orderLogistics.getStartMoney());//起步价 |
| | | map.put("mileageKilometers", orderLogistics.getMileageKilometers());//里程费 |
| | | map.put("mileageMoney", orderLogistics.getMileageMoney());//里程费 |
| | | map.put("duration", orderLogistics.getDuration());//时长费 |
| | | map.put("durationMoney", orderLogistics.getDurationMoney());//时长费 |
| | | map.put("wait", orderLogistics.getWait());//等待费 |
| | | map.put("waitMoney", orderLogistics.getWaitMoney());//等待费 |
| | | map.put("longDistance", orderLogistics.getLongDistance());//远途费 |
| | | map.put("longDistanceMoney", orderLogistics.getLongDistanceMoney());//远途费 |
| | | map.put("parkMoney", orderLogistics.getParkMoney());//停车费 |
| | | map.put("roadTollMoney", orderLogistics.getRoadTollMoney());//过路费 |
| | | map.put("redPacketMoney", orderLogistics.getRedPacketMoney());//红包抵扣金额 |
| | | map.put("couponMoney", orderLogistics.getCouponMoney());//优惠券抵扣金额 |
| | | map.put("discountMoney", orderLogistics.getDiscountMoney());//折扣抵扣金额 |
| | | map.put("discount", orderLogistics.getDiscount());//折扣 |
| | | map.put("priceDifference", orderLogistics.getPriceDifference());//补差价 |
| | | return map; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 计算价格 |
| | | * @param orderLogistics |
| | | * @param parkingFee |
| | | * @param crossingFee |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public OrderLogistics setMoney(OrderLogistics orderLogistics, Double parkingFee, Double crossingFee) throws Exception { |
| | | Map<String, Object> query1 = systemPriceMapper.query(orderLogistics.getCompanyId(), 4, orderLogistics.getServerCarModelId()); |
| | | //开始根据不同的方式计算金额 |
| | | double amount = 0; |
| | | JSONObject jsonObject = JSON.parseObject(query1.get("content").toString()); |
| | | Double num1 = jsonObject.getDouble("num1");//起步价(元) |
| | | Double num2 = jsonObject.getDouble("num2");//起步公里(公里) |
| | | Double num3 = jsonObject.getDouble("num3");//起步时间(分钟) |
| | | Double num4 = jsonObject.getDouble("num4");//里程费(元) |
| | | Double num5 = jsonObject.getDouble("num5");//时长费(分钟) |
| | | Double num6 = jsonObject.getDouble("num6");//等待费(分钟) |
| | | Double num7 = jsonObject.getDouble("num7");//等待费(元) |
| | | Double num8 = jsonObject.getDouble("num8");//远途费(公里) |
| | | Double num9 = jsonObject.getDouble("num9");//远途费(公里) |
| | | Double num10 = jsonObject.getDouble("num10");//远途费(元) |
| | | Double num11 = jsonObject.getDouble("num11");//远途费(公里) |
| | | Double num12 = jsonObject.getDouble("num12");//远途费(公里) |
| | | Double num13 = jsonObject.getDouble("num13");//远途费(元) |
| | | Double num14 = jsonObject.getDouble("num14");//远途费(公里) |
| | | Double num15 = jsonObject.getDouble("num15");//远途费(元) |
| | | // String num16 = jsonObject.getString("num16");//夜间费(开始时间) |
| | | // Double num17 = jsonObject.getDouble("num17");//夜间费(元) |
| | | // Double num18 = jsonObject.getDouble("num18");//夜间费(元) |
| | | // Double num19 = jsonObject.getDouble("num19");//夜间费(元) |
| | | // Double num20 = jsonObject.getDouble("num20");//夜间费(元) |
| | | // Double num21 = jsonObject.getDouble("num21");//夜间费(元) |
| | | // Double num22 = jsonObject.getDouble("num22");//夜间费(元) |
| | | String num23 = jsonObject.getString("num23");//高峰费(开始时间) |
| | | String num24 = jsonObject.getString("num24");//高峰费(开始时间) |
| | | Double num25 = jsonObject.getDouble("num25");//高峰费(元) |
| | | Double num26 = jsonObject.getDouble("num26");//高峰费(元) |
| | | Double num27 = jsonObject.getDouble("num27");//高峰费(元) |
| | | Double num28 = jsonObject.getDouble("num28");//高峰费(元) |
| | | Double num29 = jsonObject.getDouble("num29");//高峰费(元) |
| | | Double num30 = jsonObject.getDouble("num30");//高峰费(元) |
| | | |
| | | Date date = new Date(); |
| | | double d = (null == orderLogistics.getMileage() ? 0D : orderLogistics.getMileage()) / 1000;//实际公里 |
| | | double t = ((orderLogistics.getEndServiceTime().getTime() - orderLogistics.getStartServiceTime().getTime()) / 60000) + 1;//实际时间(不满一分钟按一分钟算) |
| | | double w = ((orderLogistics.getStartServiceTime().getTime() - orderLogistics.getArriveTime().getTime()) / 60000) + 1;//等待分钟(不满一分钟按一分钟算) |
| | | double d1 = (d - num2) < 0 ? 0 : d - num2;//超出起步里程的公里 |
| | | double t1 = (t - num3) < 0 ? 0 : new BigDecimal(t - num3).setScale(0, BigDecimal.ROUND_UP).doubleValue();//超过起步分钟数的时间 |
| | | double w1 = (w - num6) < 0 ? 0 : new BigDecimal(w - num6).setScale(0, BigDecimal.ROUND_UP).doubleValue();//超出等待时间的时间 |
| | | double yt1 = 0;//远途1段 |
| | | double yt2 = 0;//远途2段 |
| | | double yt3 = 0;//远途3段 |
| | | |
| | | |
| | | //夜间服务处理逻辑 |
| | | // if(ToolUtil.isNotEmpty(num16)){ |
| | | // Calendar s = Calendar.getInstance(); |
| | | // s.setTime(date); |
| | | // s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num16.split(" - ")[0].split(":")[0])); |
| | | // s.set(Calendar.MINUTE, Integer.valueOf(num16.split(" - ")[0].split(":")[1])); |
| | | // |
| | | // Calendar e = Calendar.getInstance(); |
| | | // e.setTime(date); |
| | | // e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num16.split(" - ")[1].split(":")[0])); |
| | | // e.set(Calendar.MINUTE, Integer.valueOf(num16.split(" - ")[1].split(":")[1])); |
| | | // |
| | | // if(date.getTime() > s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ |
| | | // if(d > num8.doubleValue() && d <= num9.doubleValue()){ |
| | | // yt1 = num20 * (d - num8); |
| | | // } |
| | | // if(d > num9.doubleValue()){ |
| | | // yt1 = num20 * (num9 - num8); |
| | | // } |
| | | // if(d > num11.doubleValue() && d <= num12.doubleValue()){ |
| | | // yt2 = num21 * (d - num11); |
| | | // } |
| | | // if(d > num12.doubleValue()){ |
| | | // yt2 = num21 * (num12 - num11); |
| | | // } |
| | | // if(d > num14.doubleValue()){ |
| | | // yt3 = num22 * (d - num14); |
| | | // } |
| | | // amount = num17 + (d1 * num18) + (t1 * num19) + (w1 * num7) + yt1 + yt2 + yt3; |
| | | // orderLogistics.setStartMileage(num2); |
| | | // orderLogistics.setStartMoney(num17);//起步价 |
| | | // orderLogistics.setStartDuration((int)(num3.doubleValue())); |
| | | // orderLogistics.setMileageKilometers(new BigDecimal(d1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // orderLogistics.setMileageMoney(new BigDecimal(d1 * num18).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//里程费 |
| | | // orderLogistics.setDuration(new BigDecimal(t1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // orderLogistics.setDurationMoney(new BigDecimal(t1 * num19).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//时长费 |
| | | // orderLogistics.setWait(new BigDecimal(w1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // orderLogistics.setWaitMoney(new BigDecimal(w1 * num7).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//等待费 |
| | | // orderLogistics.setLongDistance(new BigDecimal((d > num8) ? d - num8 : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // orderLogistics.setLongDistanceMoney(new BigDecimal(yt1 + yt2 + yt3).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//远途费 |
| | | // orderLogistics.setParkMoney(parkingFee);//停车费 |
| | | // orderLogistics.setRoadTollMoney(crossingFee);//过路费 |
| | | // orderLogistics.setRedPacketMoney(0D);//红包抵扣 |
| | | // orderLogistics.setCouponMoney(0D);//优惠券抵扣 |
| | | // orderLogistics.setDiscount(0D);//优惠抵扣 |
| | | // orderLogistics.setPayMoney(0D);//支付金额 |
| | | // orderLogistics.setOrderMoney(new BigDecimal(amount + parkingFee + crossingFee).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // orderLogistics.setMoneyType(2); |
| | | // orderLogistics.setMoneyTime(num16); |
| | | // return orderLogistics; |
| | | // } |
| | | // } |
| | | |
| | | |
| | | //高峰时段处理逻辑 |
| | | Calendar s1 = Calendar.getInstance(); |
| | | s1.setTime(date); |
| | | s1.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num23.split(" - ")[0].split(":")[0])); |
| | | s1.set(Calendar.MINUTE, Integer.valueOf(num23.split(" - ")[0].split(":")[1])); |
| | | |
| | | Calendar e1 = Calendar.getInstance(); |
| | | e1.setTime(date); |
| | | e1.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num23.split(" - ")[1].split(":")[0])); |
| | | e1.set(Calendar.MINUTE, Integer.valueOf(num23.split(" - ")[1].split(":")[1])); |
| | | |
| | | Calendar s2 = Calendar.getInstance(); |
| | | s2.setTime(date); |
| | | s2.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num24.split(" - ")[0].split(":")[0])); |
| | | s2.set(Calendar.MINUTE, Integer.valueOf(num24.split(" - ")[0].split(":")[1])); |
| | | |
| | | Calendar e2 = Calendar.getInstance(); |
| | | e2.setTime(date); |
| | | e2.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num24.split(" - ")[1].split(":")[0])); |
| | | e2.set(Calendar.MINUTE, Integer.valueOf(num24.split(" - ")[1].split(":")[1])); |
| | | |
| | | if((date.getTime() > s1.getTimeInMillis() && date.getTime() < e1.getTimeInMillis()) || (date.getTime() > s2.getTimeInMillis() && date.getTime() < e2.getTimeInMillis())){ |
| | | if(d > num8.doubleValue() && d <= num9.doubleValue()){ |
| | | yt1 = num28 * (d - num8); |
| | | } |
| | | if(d > num9.doubleValue()){ |
| | | yt1 = num28 * (num9 - num8); |
| | | } |
| | | if(d > num11.doubleValue() && d <= num12.doubleValue()){ |
| | | yt2 = num29 * (d - num11); |
| | | } |
| | | if(d > num12.doubleValue()){ |
| | | yt2 = num29 * (num12 - num11); |
| | | } |
| | | if(d > num14.doubleValue()){ |
| | | yt3 = num30 * (d - num14); |
| | | } |
| | | amount = num25 + (d1 * num26) + (t1 * num27) + (w1 * num7) + yt1 + yt2 + yt3; |
| | | orderLogistics.setStartMileage(num2); |
| | | orderLogistics.setStartMoney(num25);//起步价 |
| | | orderLogistics.setMileageKilometers(new BigDecimal(d1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | orderLogistics.setMileageMoney(new BigDecimal(d1 * num26).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//里程费 |
| | | orderLogistics.setDuration(new BigDecimal(t1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | orderLogistics.setDurationMoney(new BigDecimal(t1 * num27).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//时长费 |
| | | orderLogistics.setWait(new BigDecimal(w1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | orderLogistics.setWaitMoney(new BigDecimal(w1 * num7).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//等待费 |
| | | orderLogistics.setLongDistance(new BigDecimal((d > num8) ? d - num8 : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | orderLogistics.setLongDistanceMoney(new BigDecimal(yt1 + yt2 + yt3).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//远途费 |
| | | orderLogistics.setParkMoney(parkingFee);//停车费 |
| | | orderLogistics.setRoadTollMoney(crossingFee);//过路费 |
| | | orderLogistics.setRedPacketMoney(0D);//红包抵扣 |
| | | orderLogistics.setCouponMoney(0D);//优惠券抵扣 |
| | | orderLogistics.setDiscount(0D);//优惠抵扣 |
| | | orderLogistics.setPayMoney(0D);//支付金额 |
| | | orderLogistics.setOrderMoney(new BigDecimal(amount + parkingFee + crossingFee).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | |
| | | return orderLogistics; |
| | | } |
| | | |
| | | //其他时间段的计算 |
| | | if(d > num8.doubleValue() && d <= num9.doubleValue()){ |
| | | yt1 = num10 * (d - num8); |
| | | } |
| | | if(d > num9.doubleValue()){ |
| | | yt1 = num10 * (num9 - num8); |
| | | } |
| | | if(d > num11.doubleValue() && d <= num12.doubleValue()){ |
| | | yt2 = num13 * (d - num11); |
| | | } |
| | | if(d > num12.doubleValue()){ |
| | | yt2 = num13 * (num12 - num11); |
| | | } |
| | | if(d > num14.doubleValue()){ |
| | | yt3 = num15 * (d - num14); |
| | | } |
| | | amount = num1 + (d1 * num4) + (t1 * num5) + (w1 * num7) + yt1 + yt2 + yt3; |
| | | orderLogistics.setStartMileage(num2); |
| | | orderLogistics.setStartMoney(num1);//起步价 |
| | | orderLogistics.setMileageKilometers(new BigDecimal(d1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | orderLogistics.setMileageMoney(new BigDecimal(d1 * num4).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//里程费 |
| | | orderLogistics.setDuration(new BigDecimal(t1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | orderLogistics.setDurationMoney(new BigDecimal(t1 * num5).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//时长费 |
| | | orderLogistics.setWait(new BigDecimal(w1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | orderLogistics.setWaitMoney(new BigDecimal(w1 * num7).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//等待费 |
| | | orderLogistics.setLongDistance(new BigDecimal((d > num8) ? d - num8 : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | orderLogistics.setLongDistanceMoney(new BigDecimal(yt1 + yt2 + yt3).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//远途费 |
| | | orderLogistics.setParkMoney(parkingFee);//停车费 |
| | | orderLogistics.setRoadTollMoney(crossingFee);//过路费 |
| | | orderLogistics.setRedPacketMoney(0D);//红包抵扣 |
| | | orderLogistics.setCouponMoney(0D);//优惠券抵扣 |
| | | orderLogistics.setDiscount(0D);//优惠抵扣 |
| | | orderLogistics.setPayMoney(0D);//支付金额 |
| | | orderLogistics.setOrderMoney(new BigDecimal(amount + parkingFee + crossingFee).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | return orderLogistics; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 确认费用操作 |
| | | * @param orderId |
| | | * @param type |
| | | * @param parkingFee |
| | | * @param crossingFee |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil confirmFees(Integer language, Integer orderId, Integer type, Double parkingFee, Double crossingFee) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | if(orderLogistics.getArriveTime()==null){ |
| | | orderLogistics.setArriveTime(orderLogistics.getStartServiceTime()); |
| | | } |
| | | orderLogistics = this.setMoney(orderLogistics, 0D, 0D);//计算费用 |
| | | orderLogistics.setPayManner(type); |
| | | orderLogistics.setParkMoney(null == parkingFee ? 0D : parkingFee); |
| | | orderLogistics.setRoadTollMoney(null == crossingFee ? 0D : crossingFee); |
| | | orderLogistics.setOrderMoney(orderLogistics.getOrderMoney() + orderLogistics.getParkMoney() + orderLogistics.getRoadTollMoney() + orderLogistics.getPriceDifference()); |
| | | //判断是否首单免费-免费直接完成 |
| | | Integer orderNumber = this.selectCount(new EntityWrapper<OrderLogistics>().eq("userId",orderLogistics.getUserId()).last("and (state=8 or state=9)")); |
| | | |
| | | if(orderNumber<=0){//判断是否是首单 |
| | | //判断是否免单 |
| | | UserInfo userInfo = userInfoMapper.selectById(orderLogistics.getUserId()); |
| | | if(userInfo.getFreeMoney().doubleValue()>0d){ |
| | | if(orderLogistics.getOrderMoney()<=userInfo.getFreeMoney().doubleValue()){ |
| | | orderLogistics.setState(8); |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderLogistics.getCompanyId()); |
| | | Double speMoney = company.getSpeMoney(); |
| | | BigDecimal d = null;//企业收入 |
| | | BigDecimal c = null;//司机收入 |
| | | if(company.getIsSpeFixedOrProportional() == 2){//固定 |
| | | d = new BigDecimal(speMoney); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d);//只有出行金额参与抽成,其余归属司机 |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | Double price = orderLogistics.getStartMoney() + orderLogistics.getMileageMoney() + orderLogistics.getWaitMoney() + orderLogistics.getDurationMoney() + orderLogistics.getLongDistanceMoney(); |
| | | d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | incomeService.saveData(1, orderLogistics.getCompanyId(), 2, orderLogistics.getId(), 4, d.doubleValue()); |
| | | incomeService.saveData(2, orderLogistics.getDriverId(), 2, orderLogistics.getId(), 4, c.doubleValue()); |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | }else{ |
| | | orderLogistics.setState(7); |
| | | orderLogistics.setOrderMoney(orderLogistics.getOrderMoney()-userInfo.getFreeMoney().doubleValue()); |
| | | orderLogistics.setFreeMoney(userInfo.getFreeMoney()); |
| | | |
| | | } |
| | | |
| | | }else{ |
| | | orderLogistics.setState(7); |
| | | } |
| | | |
| | | }else{ |
| | | orderLogistics.setState(7); |
| | | } |
| | | |
| | | Map<String, String> map = chinaMobileUtil.midAxbUnBindSend(orderLogistics.getBindId(),orderLogistics.getTelX()); |
| | | if(String.valueOf(map.get("code")).equals("200")){ |
| | | orderLogistics.setTelX(""); |
| | | orderLogistics.setBindId(""); |
| | | } |
| | | this.updateById(orderLogistics); |
| | | |
| | | |
| | | pushUtil.removeTask(orderId, 4);//删除定时任务,结束推送数据 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "司机已结束本次行程,谢谢使用" : language == 2 ? |
| | | "The driver has finished the trip,thank you for using I-GO" : "Le chauffeur a terminé le trajet, merci d'utiliser I-GO", orderLogistics.getUserId()); |
| | | |
| | | //回滚司机状态为空闲 |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | driver.setState(2); |
| | | driverService.updateById(driver); |
| | | |
| | | OrderLogistics finalOrderTaxi = orderLogistics; |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, finalOrderTaxi.getUserId(), finalOrderTaxi.getId(), 4, finalOrderTaxi.getState()); |
| | | pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 4, finalOrderTaxi.getState()); |
| | | } |
| | | }).start(); |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
| | |
| | | endAddress as endAddress, |
| | | state as state, |
| | | orderType as reservation, |
| | | driverId as driverId |
| | | driverId as driverId, |
| | | isFrozen |
| | | from t_order_private_car where 1 = 1 |
| | | <if test="null != driverId"> |
| | | and driverId = #{driverId} |
| | |
| | | endAddress as endAddress, |
| | | state as state, |
| | | orderType as reservation, |
| | | driverId as driverId |
| | | driverId as driverId, |
| | | isFrozen |
| | | from t_order_private_car where 1 = 1 |
| | | <if test="null != driverId"> |
| | | and driverId = #{driverId} |
| | |
| | | endAddress as endAddress, |
| | | state as state, |
| | | orderType as reservation, |
| | | driverId as driverId |
| | | driverId as driverId, |
| | | isFrozen |
| | | from t_order_private_car where 1 = 1 |
| | | <if test="null != driverId"> |
| | | and driverId = #{driverId} |
| | |
| | | payManner as payManner, |
| | | UNIX_TIMESTAMP(travelTime) as travelTime, |
| | | remark as remark, |
| | | driverPay |
| | | from t_order_private_car where driverId = #{driverId} |
| | | driverPay, |
| | | cancelMidway, |
| | | as settleAccounts |
| | | from t_order_private_car |
| | | where driverId = #{driverId} |
| | | <if test="state == 1"> |
| | | and state != 1 |
| | | </if> |
| | |
| | | orderSource as orderSource, |
| | | orderType as orderType, |
| | | isReassign as isReassign, |
| | | companyId as companyId |
| | | companyId as companyId, |
| | | tripId |
| | | from t_order_private_car where id = #{orderId} |
| | | </select> |
| | | |
| | |
| | | a.payMoney as payMoney, |
| | | a.trackId as trackId, |
| | | b.nickName as nickName, |
| | | b.phone as userPhone, |
| | | a.passengersPhone as phone, |
| | | a.orderType as reservation, |
| | | a.telX as telX, |
| | |
| | | c.money as cancelPayMoney, |
| | | if(c.userType = 1, '用户', '平台') as cancelUser, |
| | | (select isSpecialCar from t_sys_reformist where companyId = a.companyId) as reassign, |
| | | a.driverPay |
| | | a.driverPay, |
| | | a.isFrozen, |
| | | a.tripId, |
| | | DATE_FORMAT(a.snatchOrderTime, '%Y-%m-%d %H:%i:%s') as snatchOrderTime |
| | | from t_order_private_car a |
| | | left join t_user b on (a.userId = b.id) |
| | | left join t_order_cancel c on (a.id = c.orderId and c.orderType = 1 and c.state = 2) |
| | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | |
| | | /** |
| | | * 专车车订单 |
| | | */ |
| | | @Data |
| | | @TableName("t_order_private_car") |
| | | public class OrderPrivateCar { |
| | | /** |
| | |
| | | */ |
| | | @TableField("driverPay") |
| | | private Integer driverPay; |
| | | |
| | | |
| | | public Integer getIsFrozen() { |
| | | return isFrozen; |
| | | } |
| | | |
| | | public void setIsFrozen(Integer isFrozen) { |
| | | this.isFrozen = isFrozen; |
| | | } |
| | | |
| | | public Integer getSmsNumber() { |
| | | return smsNumber; |
| | | } |
| | | |
| | | public void setSmsNumber(Integer smsNumber) { |
| | | this.smsNumber = smsNumber; |
| | | } |
| | | |
| | | public Date getSmsTime() { |
| | | return smsTime; |
| | | } |
| | | |
| | | public void setSmsTime(Date smsTime) { |
| | | this.smsTime = smsTime; |
| | | } |
| | | |
| | | public Integer getMoneyType() { |
| | | return moneyType; |
| | | } |
| | | |
| | | public void setMoneyType(Integer moneyType) { |
| | | this.moneyType = moneyType; |
| | | } |
| | | |
| | | public String getMoneyTime() { |
| | | return moneyTime; |
| | | } |
| | | |
| | | public void setMoneyTime(String moneyTime) { |
| | | this.moneyTime = moneyTime; |
| | | } |
| | | |
| | | public BigDecimal getFreeMoney() { |
| | | return freeMoney; |
| | | } |
| | | |
| | | |
| | | public void setFreeMoney(BigDecimal freeMoney) { |
| | | this.freeMoney = freeMoney; |
| | | } |
| | | |
| | | public Integer getIsFree() { |
| | | return isFree; |
| | | } |
| | | |
| | | public void setIsFree(Integer isFree) { |
| | | this.isFree = isFree; |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getCrossCityOrderId() { |
| | | return crossCityOrderId; |
| | | } |
| | | |
| | | public void setCrossCityOrderId(Integer crossCityOrderId) { |
| | | this.crossCityOrderId = crossCityOrderId; |
| | | } |
| | | |
| | | public Integer getPlace() { |
| | | return place; |
| | | } |
| | | |
| | | public void setPlace(Integer place) { |
| | | this.place = place; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Integer getServerCarModelId() { |
| | | return serverCarModelId; |
| | | } |
| | | |
| | | public void setServerCarModelId(Integer serverCarModelId) { |
| | | this.serverCarModelId = serverCarModelId; |
| | | } |
| | | |
| | | public Integer getDriverId() { |
| | | return driverId; |
| | | } |
| | | |
| | | public void setDriverId(Integer driverId) { |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public Integer getCarId() { |
| | | return carId; |
| | | } |
| | | |
| | | public void setCarId(Integer carId) { |
| | | this.carId = carId; |
| | | } |
| | | |
| | | public String getOrderNum() { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(String orderNum) { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | public Double getPlacementLon() { |
| | | return placementLon; |
| | | } |
| | | |
| | | public void setPlacementLon(Double placementLon) { |
| | | this.placementLon = placementLon; |
| | | } |
| | | |
| | | public Double getPlacementLat() { |
| | | return placementLat; |
| | | } |
| | | |
| | | public void setPlacementLat(Double placementLat) { |
| | | this.placementLat = placementLat; |
| | | } |
| | | |
| | | public String getPlacementAddress() { |
| | | return placementAddress; |
| | | } |
| | | |
| | | public void setPlacementAddress(String placementAddress) { |
| | | this.placementAddress = placementAddress; |
| | | } |
| | | |
| | | public Double getStartLon() { |
| | | return startLon; |
| | | } |
| | | |
| | | public void setStartLon(Double startLon) { |
| | | this.startLon = startLon; |
| | | } |
| | | |
| | | public Double getStartLat() { |
| | | return startLat; |
| | | } |
| | | |
| | | public void setStartLat(Double startLat) { |
| | | this.startLat = startLat; |
| | | } |
| | | |
| | | public String getStartAddress() { |
| | | return startAddress; |
| | | } |
| | | |
| | | public void setStartAddress(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | public Double getEndLon() { |
| | | return endLon; |
| | | } |
| | | |
| | | public void setEndLon(Double endLon) { |
| | | this.endLon = endLon; |
| | | } |
| | | |
| | | public Double getEndLat() { |
| | | return endLat; |
| | | } |
| | | |
| | | public void setEndLat(Double endLat) { |
| | | this.endLat = endLat; |
| | | } |
| | | |
| | | public String getEndAddress() { |
| | | return endAddress; |
| | | } |
| | | |
| | | public void setEndAddress(String endAddress) { |
| | | this.endAddress = endAddress; |
| | | } |
| | | |
| | | public Double getBoardingLon() { |
| | | return boardingLon; |
| | | } |
| | | |
| | | public void setBoardingLon(Double boardingLon) { |
| | | this.boardingLon = boardingLon; |
| | | } |
| | | |
| | | public Double getBoardingLat() { |
| | | return boardingLat; |
| | | } |
| | | |
| | | public void setBoardingLat(Double boardingLat) { |
| | | this.boardingLat = boardingLat; |
| | | } |
| | | |
| | | public String getBoardingAddress() { |
| | | return boardingAddress; |
| | | } |
| | | |
| | | public void setBoardingAddress(String boardingAddress) { |
| | | this.boardingAddress = boardingAddress; |
| | | } |
| | | |
| | | public Date getBoardingTime() { |
| | | return boardingTime; |
| | | } |
| | | |
| | | public void setBoardingTime(Date boardingTime) { |
| | | this.boardingTime = boardingTime; |
| | | } |
| | | |
| | | public Double getGetoffLon() { |
| | | return getoffLon; |
| | | } |
| | | |
| | | public void setGetoffLon(Double getoffLon) { |
| | | this.getoffLon = getoffLon; |
| | | } |
| | | |
| | | public Double getGetoffLat() { |
| | | return getoffLat; |
| | | } |
| | | |
| | | public void setGetoffLat(Double getoffLat) { |
| | | this.getoffLat = getoffLat; |
| | | } |
| | | |
| | | public String getGetoffAddress() { |
| | | return getoffAddress; |
| | | } |
| | | |
| | | public void setGetoffAddress(String getoffAddress) { |
| | | this.getoffAddress = getoffAddress; |
| | | } |
| | | |
| | | public Date getGetoffTime() { |
| | | return getoffTime; |
| | | } |
| | | |
| | | public void setGetoffTime(Date getoffTime) { |
| | | this.getoffTime = getoffTime; |
| | | } |
| | | |
| | | public Double getMileage() { |
| | | return mileage; |
| | | } |
| | | |
| | | public void setMileage(Double mileage) { |
| | | this.mileage = mileage; |
| | | } |
| | | |
| | | public Integer getPayManner() { |
| | | return payManner; |
| | | } |
| | | |
| | | public void setPayManner(Integer payManner) { |
| | | this.payManner = payManner; |
| | | } |
| | | |
| | | public Integer getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public void setPayType(Integer payType) { |
| | | this.payType = payType; |
| | | } |
| | | |
| | | public Double getOrderMoney() { |
| | | return orderMoney; |
| | | } |
| | | |
| | | public void setOrderMoney(Double orderMoney) { |
| | | this.orderMoney = orderMoney; |
| | | } |
| | | |
| | | public Double getStartMoney() { |
| | | return startMoney; |
| | | } |
| | | |
| | | public void setStartMoney(Double startMoney) { |
| | | this.startMoney = startMoney; |
| | | } |
| | | |
| | | public Double getMileageMoney() { |
| | | return mileageMoney; |
| | | } |
| | | |
| | | public void setMileageMoney(Double mileageMoney) { |
| | | this.mileageMoney = mileageMoney; |
| | | } |
| | | |
| | | public Double getDurationMoney() { |
| | | return durationMoney; |
| | | } |
| | | |
| | | public void setDurationMoney(Double durationMoney) { |
| | | this.durationMoney = durationMoney; |
| | | } |
| | | |
| | | public Double getLongDistanceMoney() { |
| | | return longDistanceMoney; |
| | | } |
| | | |
| | | public void setLongDistanceMoney(Double longDistanceMoney) { |
| | | this.longDistanceMoney = longDistanceMoney; |
| | | } |
| | | |
| | | public Double getParkMoney() { |
| | | return parkMoney; |
| | | } |
| | | |
| | | public void setParkMoney(Double parkMoney) { |
| | | this.parkMoney = parkMoney; |
| | | } |
| | | |
| | | public Double getRoadTollMoney() { |
| | | return roadTollMoney; |
| | | } |
| | | |
| | | public void setRoadTollMoney(Double roadTollMoney) { |
| | | this.roadTollMoney = roadTollMoney; |
| | | } |
| | | |
| | | public Double getRedPacketMoney() { |
| | | return redPacketMoney; |
| | | } |
| | | |
| | | public void setRedPacketMoney(Double redPacketMoney) { |
| | | this.redPacketMoney = redPacketMoney; |
| | | } |
| | | |
| | | public Double getCouponMoney() { |
| | | return couponMoney; |
| | | } |
| | | |
| | | public void setCouponMoney(Double couponMoney) { |
| | | this.couponMoney = couponMoney; |
| | | } |
| | | |
| | | public Integer getRedPacketId() { |
| | | return redPacketId; |
| | | } |
| | | |
| | | public void setRedPacketId(Integer redPacketId) { |
| | | this.redPacketId = redPacketId; |
| | | } |
| | | |
| | | public Integer getCouponId() { |
| | | return couponId; |
| | | } |
| | | |
| | | public void setCouponId(Integer couponId) { |
| | | this.couponId = couponId; |
| | | } |
| | | |
| | | public Double getDiscount() { |
| | | return discount; |
| | | } |
| | | |
| | | public void setDiscount(Double discount) { |
| | | this.discount = discount; |
| | | } |
| | | |
| | | public Double getDiscountMoney() { |
| | | return discountMoney; |
| | | } |
| | | |
| | | public void setDiscountMoney(Double discountMoney) { |
| | | this.discountMoney = discountMoney; |
| | | } |
| | | |
| | | public Integer getActivityId() { |
| | | return activityId; |
| | | } |
| | | |
| | | public void setActivityId(Integer activityId) { |
| | | this.activityId = activityId; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Double getPayMoney() { |
| | | return payMoney; |
| | | } |
| | | |
| | | public void setPayMoney(Double payMoney) { |
| | | this.payMoney = payMoney; |
| | | } |
| | | |
| | | public Integer getSubstitute() { |
| | | return substitute; |
| | | } |
| | | |
| | | public void setSubstitute(Integer substitute) { |
| | | this.substitute = substitute; |
| | | } |
| | | |
| | | public String getPassengers() { |
| | | return passengers; |
| | | } |
| | | |
| | | public void setPassengers(String passengers) { |
| | | this.passengers = passengers; |
| | | } |
| | | |
| | | public String getPassengersPhone() { |
| | | return passengersPhone; |
| | | } |
| | | |
| | | public void setPassengersPhone(String passengersPhone) { |
| | | this.passengersPhone = passengersPhone; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Date getTravelTime() { |
| | | return travelTime; |
| | | } |
| | | |
| | | public void setTravelTime(Date travelTime) { |
| | | this.travelTime = travelTime; |
| | | } |
| | | |
| | | public Date getSnatchOrderTime() { |
| | | return snatchOrderTime; |
| | | } |
| | | |
| | | public void setSnatchOrderTime(Date snatchOrderTime) { |
| | | this.snatchOrderTime = snatchOrderTime; |
| | | } |
| | | |
| | | public Date getSetOutTime() { |
| | | return setOutTime; |
| | | } |
| | | |
| | | public void setSetOutTime(Date setOutTime) { |
| | | this.setOutTime = setOutTime; |
| | | } |
| | | |
| | | public Date getArriveTime() { |
| | | return arriveTime; |
| | | } |
| | | |
| | | public void setArriveTime(Date arriveTime) { |
| | | this.arriveTime = arriveTime; |
| | | } |
| | | |
| | | public Date getStartServiceTime() { |
| | | return startServiceTime; |
| | | } |
| | | |
| | | public void setStartServiceTime(Date startServiceTime) { |
| | | this.startServiceTime = startServiceTime; |
| | | } |
| | | |
| | | public Date getEndServiceTime() { |
| | | return endServiceTime; |
| | | } |
| | | |
| | | public void setEndServiceTime(Date endServiceTime) { |
| | | this.endServiceTime = endServiceTime; |
| | | } |
| | | |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | |
| | | public Integer getOrderSource() { |
| | | return orderSource; |
| | | } |
| | | |
| | | public void setOrderSource(Integer orderSource) { |
| | | this.orderSource = orderSource; |
| | | } |
| | | |
| | | public Integer getInvoiceId() { |
| | | return invoiceId; |
| | | } |
| | | |
| | | public void setInvoiceId(Integer invoiceId) { |
| | | this.invoiceId = invoiceId; |
| | | } |
| | | |
| | | public Integer getIsReassign() { |
| | | return isReassign; |
| | | } |
| | | |
| | | public void setIsReassign(Integer isReassign) { |
| | | this.isReassign = isReassign; |
| | | } |
| | | |
| | | public Integer getReassignNotice() { |
| | | return reassignNotice; |
| | | } |
| | | |
| | | public void setReassignNotice(Integer reassignNotice) { |
| | | this.reassignNotice = reassignNotice; |
| | | } |
| | | |
| | | public String getTrackId() { |
| | | return trackId; |
| | | } |
| | | |
| | | public void setTrackId(String trackId) { |
| | | this.trackId = trackId; |
| | | } |
| | | |
| | | public Integer getIsDelete() { |
| | | return isDelete; |
| | | } |
| | | |
| | | public void setIsDelete(Integer isDelete) { |
| | | this.isDelete = isDelete; |
| | | } |
| | | |
| | | public Integer getOldState() { |
| | | return oldState; |
| | | } |
| | | |
| | | public void setOldState(Integer oldState) { |
| | | this.oldState = oldState; |
| | | } |
| | | |
| | | public String getTelX() { |
| | | return telX; |
| | | } |
| | | |
| | | public void setTelX(String telX) { |
| | | this.telX = telX; |
| | | } |
| | | |
| | | public String getBindId() { |
| | | return bindId; |
| | | } |
| | | |
| | | public void setBindId(String bindId) { |
| | | this.bindId = bindId; |
| | | } |
| | | |
| | | public Double getWaitMoney() { |
| | | return waitMoney; |
| | | } |
| | | |
| | | public void setWaitMoney(Double waitMoney) { |
| | | this.waitMoney = waitMoney; |
| | | } |
| | | |
| | | public Double getMileageKilometers() { |
| | | return mileageKilometers; |
| | | } |
| | | |
| | | public void setMileageKilometers(Double mileageKilometers) { |
| | | this.mileageKilometers = mileageKilometers; |
| | | } |
| | | |
| | | public Double getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(Double duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public Double getWait() { |
| | | return wait; |
| | | } |
| | | |
| | | public void setWait(Double wait) { |
| | | this.wait = wait; |
| | | } |
| | | |
| | | public Double getLongDistance() { |
| | | return longDistance; |
| | | } |
| | | |
| | | public void setLongDistance(Double longDistance) { |
| | | this.longDistance = longDistance; |
| | | } |
| | | |
| | | public Double getStartMileage() { |
| | | return startMileage; |
| | | } |
| | | |
| | | public void setStartMileage(Double startMileage) { |
| | | this.startMileage = startMileage; |
| | | } |
| | | |
| | | public Integer getDriverPay() { |
| | | return driverPay; |
| | | } |
| | | |
| | | public void setDriverPay(Integer driverPay) { |
| | | this.driverPay = driverPay; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderPrivateCar{" + |
| | | "id=" + id + |
| | | ", type=" + type + |
| | | ", crossCityOrderId=" + crossCityOrderId + |
| | | ", place=" + place + |
| | | ", userId=" + userId + |
| | | ", serverCarModelId=" + serverCarModelId + |
| | | ", driverId=" + driverId + |
| | | ", carId=" + carId + |
| | | ", orderNum='" + orderNum + '\'' + |
| | | ", placementLon=" + placementLon + |
| | | ", placementLat=" + placementLat + |
| | | ", placementAddress='" + placementAddress + '\'' + |
| | | ", startLon=" + startLon + |
| | | ", startLat=" + startLat + |
| | | ", startAddress='" + startAddress + '\'' + |
| | | ", endLon=" + endLon + |
| | | ", endLat=" + endLat + |
| | | ", endAddress='" + endAddress + '\'' + |
| | | ", boardingLon=" + boardingLon + |
| | | ", boardingLat=" + boardingLat + |
| | | ", boardingAddress='" + boardingAddress + '\'' + |
| | | ", boardingTime=" + boardingTime + |
| | | ", getoffLon=" + getoffLon + |
| | | ", getoffLat=" + getoffLat + |
| | | ", getoffAddress='" + getoffAddress + '\'' + |
| | | ", getoffTime=" + getoffTime + |
| | | ", mileage=" + mileage + |
| | | ", payManner=" + payManner + |
| | | ", payType=" + payType + |
| | | ", orderMoney=" + orderMoney + |
| | | ", startMileage=" + startMileage + |
| | | ", startMoney=" + startMoney + |
| | | ", mileageKilometers=" + mileageKilometers + |
| | | ", mileageMoney=" + mileageMoney + |
| | | ", duration=" + duration + |
| | | ", durationMoney=" + durationMoney + |
| | | ", wait=" + wait + |
| | | ", waitMoney=" + waitMoney + |
| | | ", longDistance=" + longDistance + |
| | | ", longDistanceMoney=" + longDistanceMoney + |
| | | ", parkMoney=" + parkMoney + |
| | | ", roadTollMoney=" + roadTollMoney + |
| | | ", redPacketMoney=" + redPacketMoney + |
| | | ", couponMoney=" + couponMoney + |
| | | ", redPacketId=" + redPacketId + |
| | | ", couponId=" + couponId + |
| | | ", discount=" + discount + |
| | | ", discountMoney=" + discountMoney + |
| | | ", activityId=" + activityId + |
| | | ", companyId=" + companyId + |
| | | ", payMoney=" + payMoney + |
| | | ", substitute=" + substitute + |
| | | ", passengers='" + passengers + '\'' + |
| | | ", passengersPhone='" + passengersPhone + '\'' + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | ", travelTime=" + travelTime + |
| | | ", snatchOrderTime=" + snatchOrderTime + |
| | | ", setOutTime=" + setOutTime + |
| | | ", arriveTime=" + arriveTime + |
| | | ", startServiceTime=" + startServiceTime + |
| | | ", endServiceTime=" + endServiceTime + |
| | | ", orderType=" + orderType + |
| | | ", orderSource=" + orderSource + |
| | | ", invoiceId=" + invoiceId + |
| | | ", isReassign=" + isReassign + |
| | | ", reassignNotice=" + reassignNotice + |
| | | ", trackId='" + trackId + '\'' + |
| | | ", isDelete=" + isDelete + |
| | | ", oldState=" + oldState + |
| | | ", telX='" + telX + '\'' + |
| | | ", bindId='" + bindId + '\'' + |
| | | '}'; |
| | | } |
| | | /** |
| | | * 修改目的地经度 |
| | | */ |
| | | @TableField("destinationLon") |
| | | private String destinationLon; |
| | | /** |
| | | * 修改目的地纬度 |
| | | */ |
| | | @TableField("destinationLat") |
| | | private String destinationLat; |
| | | /** |
| | | * 修改目的地地址 |
| | | */ |
| | | @TableField("destination") |
| | | private String destination; |
| | | /** |
| | | * 中途取消(0=否,1=是) |
| | | */ |
| | | @TableField("cancelMidway") |
| | | private Integer cancelMidway; |
| | | /** |
| | | * google行程id |
| | | */ |
| | | @TableField("tripId") |
| | | private String tripId; |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | void payOrderPrivateCarCallback(Integer id, String order_id, Integer language) throws Exception; |
| | | |
| | | /** |
| | | * 处理乘客修改终点 |
| | | * @param orderId |
| | | * @param status |
| | | */ |
| | | void updateEndAddress(Integer orderId, Integer status); |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.specialTrain.dao.OrderPrivateCarMapper; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.dao.CarModelMapper; |
| | | import com.stylefeng.guns.modular.system.dao.RegionMapper; |
| | | import com.stylefeng.guns.modular.system.dao.SystemPriceMapper; |
| | | import com.stylefeng.guns.modular.system.dao.UserInfoMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.quartz.QuartzUtil; |
| | | import com.stylefeng.guns.modular.system.util.quartz.jobs.OrderTimeOutJob; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.apache.shiro.util.StringUtils; |
| | | import org.quartz.JobDataMap; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | |
| | |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | @Autowired |
| | | private IReminderRulesService reminderRulesService; |
| | | |
| | | @Autowired |
| | | private FleetEngineUtil fleetEngineUtil; |
| | | |
| | | @Resource |
| | | private CarModelMapper carModelMapper; |
| | | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if(orderPrivateCar.getState() == 9){ |
| | | if(orderPrivateCar.getState() == 10){ |
| | | return ResultUtil.error(language == 1 ? "订单已取消" : language == 2 ? "Order cancelled" : "Commande annulée"); |
| | | } |
| | | if(orderPrivateCar.getState() != 1){ |
| | |
| | | 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); |
| | | // orderPrivateCar.setTrackId(track); |
| | | |
| | | //调用移动的小号接口 |
| | | /*Map<String, String> geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getStartLon().toString(), orderPrivateCar.getStartLat().toString()); |
| | | Region region = regionMapper.query(geocode.get("districtCode"));*/ |
| | | // Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderPrivateCar.getPassengersPhone(), driver.getPhone(), null); |
| | | // if(String.valueOf(map.get("code")).equals("200")){ |
| | | // orderPrivateCar.setTelX(map.get("telX")); |
| | | // orderPrivateCar.setBindId(map.get("bindId")); |
| | | // } |
| | | // System.out.println(map); |
| | | if(!StringUtils.hasLength(orderPrivateCar.getTripId())){ |
| | | orderPrivateCar.setTripId(UUIDUtil.getRandomCode()); |
| | | } |
| | | this.updateById(orderPrivateCar); |
| | | |
| | | //如果是预约单,则不修改司机为服务中 |
| | |
| | | driver.setState(3); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | |
| | | //添加定时任务(普通任务) |
| | | ReminderRules reminderRules = reminderRulesService.selectOne(new EntityWrapper<ReminderRules>().eq("companyId", driver.getCompanyId())); |
| | | if(null != reminderRules){ |
| | | JSONObject jsonObject = JSON.parseObject(reminderRules.getContent()); |
| | | //预约单 |
| | | if(orderPrivateCar.getOrderType() == 1){ |
| | | long specialCarTimeoutReminderInterval = jsonObject.getInteger("specialCarTimeoutReminderInterval") * 60000L; |
| | | long m = (System.currentTimeMillis() - orderPrivateCar.getSnatchOrderTime().getTime()) / 60000; |
| | | JobDataMap jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("driverId", uid); |
| | | jobDataMap.put("orderId", orderPrivateCar.getId()); |
| | | jobDataMap.put("orderType", 1); |
| | | jobDataMap.put("describe", language == 1 ? "您的打车订单已超时" + m + "分钟,请抓紧!" : language == 2 ? "Your ride order is overdue for " + m + " minute(s), please go faster." : "Votre commande de course est en retard depuis " + m + " minute(s), veuillez aller plus vite."); |
| | | QuartzUtil.addSimpleQuartzTask( |
| | | new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderPrivateCar.getId() + "_1", "ORDER_TIME_OUT", jobDataMap) |
| | | , new Date(specialCarTimeoutReminderInterval), specialCarTimeoutReminderInterval, -1); |
| | | }else{ |
| | | UserInfo userInfo = userInfoMapper.selectById(orderPrivateCar.getUserId()); |
| | | JSONObject reservationOrder = jsonObject.getJSONObject("reservationOrder"); |
| | | long appointmentReminder = reservationOrder.getInteger("appointmentReminder") * 60000L; |
| | | long appointmentTimeoutReminderInterval = reservationOrder.getInteger("appointmentTimeoutReminderInterval") * 60000L; |
| | | SimpleDateFormat sdf = new SimpleDateFormat(""); |
| | | JobDataMap jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("driverId", uid); |
| | | jobDataMap.put("orderId", orderPrivateCar.getId()); |
| | | jobDataMap.put("orderType", 1); |
| | | jobDataMap.put("describe", "您将于" + sdf.format(orderPrivateCar.getTravelTime()) + "去接" + userInfo.getFirstName() + " " + userInfo.getLastName() + ",请准时!"); |
| | | QuartzUtil.addSimpleQuartzTask( |
| | | new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderPrivateCar.getId() + "_1", "ORDER_TIME_OUT", jobDataMap) |
| | | , new Date(appointmentReminder), appointmentReminder, 0); |
| | | |
| | | |
| | | jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("driverId", uid); |
| | | jobDataMap.put("orderId", orderPrivateCar.getId()); |
| | | jobDataMap.put("orderType", 1); |
| | | jobDataMap.put("describe", "您将于" + sdf.format(orderPrivateCar.getTravelTime()) + "去接" + userInfo.getFirstName() + " " + userInfo.getLastName() + ",请准时!"); |
| | | QuartzUtil.addSimpleQuartzTask( |
| | | new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderPrivateCar.getId() + "_1", "ORDER_TIME_OUT", jobDataMap) |
| | | , new Date(appointmentReminder + appointmentTimeoutReminderInterval), appointmentTimeoutReminderInterval, -1); |
| | | } |
| | | } |
| | | |
| | | Car car = carService.selectById(orderPrivateCar.getCarId()); |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carService.updateById(car); |
| | | } |
| | | String trip = fleetEngineUtil.getTrip(orderPrivateCar.getTripId()); |
| | | if(ToolUtil.isEmpty(trip)){ |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | fleetEngineUtil.createTrip(car.getVehicleId(), 1, orderPrivateCar.getTripId(), |
| | | orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(), orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString()); |
| | | } |
| | | //开始修改行程数据 |
| | | fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderPrivateCar.getTripId(), null, null, null, null); |
| | | |
| | | //推送相关代码------------------start---------------- |
| | | new Thread(new Runnable() { |
| | |
| | | } |
| | | }).start(); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushDriverPosition(orderId, 1); |
| | | } |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(2, language == 1 ? "您已成功抢得打车订单,请及时联系客户!" : |
| | | language == 2 ? "You have grabbed the ride order, please contact the client timely." |
| | |
| | | if(state==4 && orderPrivateCar.getState()!=3){ |
| | | return ResultUtil.error(language == 1 ? "当前订单不能到达预约地点" : language == 2 ? "The current order cannot arrive at the reservation" : "La commande en cours ne peut pas atteindre le rendez-vous"); |
| | | } |
| | | String tripStatus = "UNKNOWN_TRIP_STATUS"; |
| | | switch (state){ |
| | | case 3://出发前往预约点 |
| | | orderPrivateCar.setState(3); |
| | | orderPrivateCar.setSetOutTime(new Date()); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "司机已出发,请耐心等待" : language == 2 ? "The driver is on the way, please wait." : "Le chauffeur est en route. Veuillez patienter.", orderPrivateCar.getUserId()); |
| | | pushUtil.pushDriverPosition(orderPrivateCar.getId(), 1);//主动推送司机定位 |
| | | tripStatus = "ENROUTE_TO_PICKUP"; |
| | | break; |
| | | case 4://到达预约点,等待客户上车 |
| | | orderPrivateCar.setState(4); |
| | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "司机已到达您设置的预约地点,请及时上车" : language == 2 ? |
| | | "The driver has arrived at the reserved location, please get in timely." : |
| | | "Le chauffeur est arrivé à l'endroit prévu, veuillez monter dans la voiture à temps.", orderPrivateCar.getUserId()); |
| | | tripStatus = "ARRIVED_AT_PICKUP"; |
| | | break; |
| | | case 5://开始服务 |
| | | orderPrivateCar.setBoardingLon(lon); |
| | |
| | | orderPrivateCar.setBoardingTime(new Date()); |
| | | orderPrivateCar.setState(5); |
| | | orderPrivateCar.setStartServiceTime(new Date()); |
| | | |
| | | pushUtil.pushDriverPosition(orderPrivateCar.getId(), 1);//主动推送司机定位 |
| | | |
| | | OrderPosition orderPosition = new OrderPosition(); |
| | | orderPosition.setOrderId(orderId); |
| | |
| | | out.write(JSON.toJSONString(orderPositions)); |
| | | out.flush(); |
| | | out.close(); |
| | | tripStatus = "ENROUTE_TO_DROPOFF"; |
| | | break; |
| | | case 6://结束服务(专车可以返回继续服务)不修改状态 |
| | | orderPrivateCar.setState(6); |
| | | orderPrivateCar.setGetoffLon(lon); |
| | | orderPrivateCar.setGetoffLat(lat); |
| | | orderPrivateCar.setGetoffAddress(address); |
| | | orderPrivateCar.setGetoffTime(new Date()); |
| | | orderPrivateCar.setEndServiceTime(new Date()); |
| | | tripStatus = "COMPLETE"; |
| | | break; |
| | | } |
| | | this.updateById(orderPrivateCar); |
| | | |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | //修改行程数据 |
| | | fleetEngineUtil.updateTrip(tripStatus, null, 1, orderPrivateCar.getTripId(), null, null, null, null); |
| | | |
| | | // TODO: 2020/6/5 推送状态 |
| | | OrderPrivateCar finalOrderPrivateCar = orderPrivateCar; |
| | |
| | | System.err.println("预支付数据异常(orderId = " + id + ")"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理乘客修改终点 |
| | | * @param orderId |
| | | * @param status |
| | | */ |
| | | @Override |
| | | public void updateEndAddress(Integer orderId, Integer status) { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | if(2 == status){ |
| | | orderPrivateCar.setEndLon(Double.valueOf(orderPrivateCar.getDestinationLon())); |
| | | orderPrivateCar.setEndLat(Double.valueOf(orderPrivateCar.getDestinationLat())); |
| | | orderPrivateCar.setEndAddress(orderPrivateCar.getDestination()); |
| | | } |
| | | orderPrivateCar.setDestinationLon(""); |
| | | orderPrivateCar.setDestination(""); |
| | | orderPrivateCar.setDestinationLat(""); |
| | | this.updateById(orderPrivateCar); |
| | | pushUtil.pushModifyAddress(1, orderPrivateCar.getUserId(), orderId, 1, status); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.BalanceUsageRecord1; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/13 10:24 |
| | | */ |
| | | public interface BalanceUsageRecordMapper extends BaseMapper<BalanceUsageRecord1> { |
| | | |
| | | |
| | | /** |
| | | * 获取使用记录列表 |
| | | * @param driverId |
| | | * @param type |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryBalanceUsageRecord(@Param("driverId") Integer driverId, @Param("type") Integer type, |
| | | @Param("pageNum") Integer pageNum, @Param("size") Integer size); |
| | | |
| | | |
| | | /** |
| | | * 获取使用记录总额 |
| | | * @param driverId |
| | | * @param type |
| | | * @return |
| | | */ |
| | | Double queryBalanceUsageRecordSum(@Param("driverId") Integer driverId, @Param("type") Integer type); |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.CancleOrder; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/28 10:15 |
| | | */ |
| | | public interface CancleOrderMapper extends BaseMapper<CancleOrder> { |
| | | } |
| | |
| | | * @param driverId |
| | | * @return |
| | | */ |
| | | DriverOnline query(@Param("driverId") Integer driverId, @Param("day") String day, @Param("assessment") Integer assessment); |
| | | DriverOnline query(@Param("driverId") Integer driverId, @Param("day") String day, @Param("type") Integer type, @Param("assessment") Integer assessment); |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | |
| | | List<DriverOnline> queryList(@Param("day") String day, @Param("duration") Long duration); |
| | | List<DriverOnline> queryList(@Param("day") String day, @Param("type") Integer type, @Param("duration") Long duration); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.ReminderRules; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/18 16:10 |
| | | */ |
| | | public interface ReminderRulesMapper extends BaseMapper<ReminderRules> { |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | * @param driverId |
| | | * @return |
| | | */ |
| | | List<QueryHistoricalSettlement> queryHistoricalSettlement(@Param("driverId") Integer driverId, @Param("pageNum") Integer pageNum, |
| | | List<Map<String, Object>> queryHistoricalSettlement(@Param("driverId") Integer driverId, @Param("pageNum") Integer pageNum, |
| | | @Param("size") Integer size); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryWithdrawal(@Param("uid") Integer uid, @Param("userType") Integer userType, |
| | | @Param("type") Integer type, @Param("pageNum") Integer pageNum, |
| | | @Param("type") Integer type, @Param("state") Integer state, @Param("pageNum") Integer pageNum, |
| | | @Param("size") Integer size); |
| | | |
| | | |
| | | /** |
| | | * 获取提现总额 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | Double queryWithdrawalSum(@Param("uid") Integer uid, @Param("userType") Integer userType, |
| | | @Param("type") Integer type); |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.system.dao.BalanceUsageRecordMapper"> |
| | | |
| | | |
| | | |
| | | <select id="queryBalanceUsageRecord" resultType="map"> |
| | | select |
| | | DATE_FORMAT(createTime, '%Y-%m-%d') as createTime, |
| | | money, |
| | | purpose |
| | | from t_balance_usage_record type = #{type} and driverId = #{driverId} order by createTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryBalanceUsageRecordSum" resultType="double"> |
| | | select ifnull(sum(money), 0) from t_balance_usage_record where type = #{type} and driverId = #{driverId} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.system.dao.CancleOrderMapper"> |
| | | |
| | | </mapper> |
| | |
| | | (select `name` from t_company where 1 = 1 and if(a.companyId is null or a.companyId = 0, id = 1, if(a.franchiseeId is null or a.franchiseeId = 0, id = a.companyId, id = a.franchiseeId))) as company, |
| | | b.carLicensePlate as licensePlate, |
| | | b.carColor as carColor, |
| | | b.vehicleId, |
| | | CONCAT(d.`name`, c.`name`) as brand, |
| | | ( |
| | | (select count(id) from t_order_private_car where driverId = a.id and state in (7, 8, 9)) + |
| | |
| | | `date` as `date`, |
| | | duration as duration, |
| | | assessment as assessment |
| | | from t_driver_online where driverId = #{driverId} and DATE_FORMAT(`date`, '%Y-%m-%d') = #{day} and assessment = #{assessment} |
| | | from t_driver_online where driverId = #{driverId} and DATE_FORMAT(`date`, '%Y-%m-%d') = #{day} and type = #{type} and assessment = #{assessment} |
| | | </select> |
| | | |
| | | |
| | |
| | | `date` as `date`, |
| | | duration as duration, |
| | | assessment as assessment |
| | | from t_driver_online where DATE_FORMAT(`date`, '%Y-%m-%d') = #{day} and duration >= #{duration} |
| | | from t_driver_online where DATE_FORMAT(`date`, '%Y-%m-%d') = #{day} and type = #{type} and duration >= #{duration} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.system.dao.ReminderRulesMapper"> |
| | | |
| | | </mapper> |
| | |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryHistoricalSettlement" resultType="com.stylefeng.guns.modular.system.warpper.QueryHistoricalSettlement"> |
| | | <select id="queryHistoricalSettlement" resultType="map"> |
| | | select |
| | | DATE_FORMAT(`day`, '%Y-%m-%d') as createTime, |
| | | payMoney as price, |
| | | `type` |
| | | `type`, |
| | | payType, |
| | | balanceType |
| | | from t_settlement_record where driverId = #{driverId} and paymentStatus = 2 order by insertTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | </mapper> |
| | |
| | | withdrawalType as withdrawalType, |
| | | serialNo as serialNo |
| | | from t_pub_withdrawal |
| | | where flag != 3 and userType = #{userType} and userId = #{uid} and type = #{type} order by insertTime desc limit #{pageNum}, #{size} |
| | | where flag != 3 and userType = #{userType} and userId = #{uid} and type = #{type} |
| | | <if test="null != state"> |
| | | and state = #{state} |
| | | </if> |
| | | order by insertTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryWithdrawalSum" resultType="double"> |
| | | select |
| | | ifnull(sum(money), 0) as money |
| | | from t_pub_withdrawal |
| | | where flag != 3 and userType = #{userType} and userId = #{uid} and type = #{type} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/13 10:21 |
| | | */ |
| | | @Data |
| | | @TableName("t_balance_usage_record") |
| | | public class BalanceUsageRecord1 { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 余额类型(1=奖励,2=收入) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 使用金额 |
| | | */ |
| | | @TableField("money") |
| | | private Double money; |
| | | /** |
| | | * 用途 |
| | | */ |
| | | @TableField("purpose") |
| | | private Integer purpose; |
| | | /** |
| | | * 使用时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 取消订单设置 |
| | | */ |
| | | @Data |
| | | @TableName("t_sys_cancle_order") |
| | | public class CancleOrder { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 企业id |
| | | */ |
| | | @TableField("companyId") |
| | | private Integer companyId; |
| | | /** |
| | | * 取消规则 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 车辆 |
| | | */ |
| | | @Data |
| | | @TableName("t_car") |
| | | public class Car { |
| | | /** |
| | |
| | | |
| | | private Integer authState; |
| | | |
| | | public Integer getAuthState() { |
| | | return authState; |
| | | } |
| | | |
| | | public void setAuthState(Integer authState) { |
| | | this.authState = authState; |
| | | } |
| | | |
| | | /** |
| | | * 添加来源(1=司机注册 2=平台添加 3=分公司添加 4=加盟商添加) |
| | | */ |
| | |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | |
| | | public Integer getDriverId() { |
| | | return driverId; |
| | | } |
| | | |
| | | public void setDriverId(Integer driverId) { |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getIsPlatCar() { |
| | | return isPlatCar; |
| | | } |
| | | |
| | | public void setIsPlatCar(Integer isPlatCar) { |
| | | this.isPlatCar = isPlatCar; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Integer getFranchiseeId() { |
| | | return franchiseeId; |
| | | } |
| | | |
| | | public void setFranchiseeId(Integer franchiseeId) { |
| | | this.franchiseeId = franchiseeId; |
| | | } |
| | | |
| | | public String getCarColor() { |
| | | return carColor; |
| | | } |
| | | |
| | | public void setCarColor(String carColor) { |
| | | this.carColor = carColor; |
| | | } |
| | | |
| | | public Integer getCarModelId() { |
| | | return carModelId; |
| | | } |
| | | |
| | | public void setCarModelId(Integer carModelId) { |
| | | this.carModelId = carModelId; |
| | | } |
| | | |
| | | public Integer getCarBrandId() { |
| | | return carBrandId; |
| | | } |
| | | |
| | | public void setCarBrandId(Integer carBrandId) { |
| | | this.carBrandId = carBrandId; |
| | | } |
| | | |
| | | public String getCarLicensePlate() { |
| | | return carLicensePlate; |
| | | } |
| | | |
| | | public void setCarLicensePlate(String carLicensePlate) { |
| | | this.carLicensePlate = carLicensePlate; |
| | | } |
| | | |
| | | public String getCarPhoto() { |
| | | return carPhoto; |
| | | } |
| | | |
| | | public void setCarPhoto(String carPhoto) { |
| | | this.carPhoto = carPhoto; |
| | | } |
| | | |
| | | public String getDrivingLicenseNumber() { |
| | | return drivingLicenseNumber; |
| | | } |
| | | |
| | | public void setDrivingLicenseNumber(String drivingLicenseNumber) { |
| | | this.drivingLicenseNumber = drivingLicenseNumber; |
| | | } |
| | | |
| | | public String getDrivingLicensePhoto() { |
| | | return drivingLicensePhoto; |
| | | } |
| | | |
| | | public void setDrivingLicensePhoto(String drivingLicensePhoto) { |
| | | this.drivingLicensePhoto = drivingLicensePhoto; |
| | | } |
| | | |
| | | public Date getAnnualInspectionTime() { |
| | | return annualInspectionTime; |
| | | } |
| | | |
| | | public void setAnnualInspectionTime(Date annualInspectionTime) { |
| | | this.annualInspectionTime = annualInspectionTime; |
| | | } |
| | | |
| | | public String getInsurancePhoto() { |
| | | return insurancePhoto; |
| | | } |
| | | |
| | | public void setInsurancePhoto(String insurancePhoto) { |
| | | this.insurancePhoto = insurancePhoto; |
| | | } |
| | | |
| | | public Date getCommercialInsuranceTime() { |
| | | return commercialInsuranceTime; |
| | | } |
| | | |
| | | public String getPeopleAndCarsPhone() { |
| | | return peopleAndCarsPhone; |
| | | } |
| | | |
| | | public void setPeopleAndCarsPhone(String peopleAndCarsPhone) { |
| | | this.peopleAndCarsPhone = peopleAndCarsPhone; |
| | | } |
| | | |
| | | public void setCommercialInsuranceTime(Date commercialInsuranceTime) { |
| | | this.commercialInsuranceTime = commercialInsuranceTime; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Integer getAddType() { |
| | | return addType; |
| | | } |
| | | |
| | | public void setAddType(Integer addType) { |
| | | this.addType = addType; |
| | | } |
| | | |
| | | public Integer getAddObjectId() { |
| | | return addObjectId; |
| | | } |
| | | |
| | | public void setAddObjectId(Integer addObjectId) { |
| | | this.addObjectId = addObjectId; |
| | | } |
| | | |
| | | public Date getDrivingLicenseEndTime() { |
| | | return drivingLicenseEndTime; |
| | | } |
| | | |
| | | public void setDrivingLicenseEndTime(Date drivingLicenseEndTime) { |
| | | this.drivingLicenseEndTime = drivingLicenseEndTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Car{" + |
| | | "id=" + id + |
| | | ", isPlatCar=" + isPlatCar + |
| | | ", companyId=" + companyId + |
| | | ", carColor='" + carColor + '\'' + |
| | | ", carModelId=" + carModelId + |
| | | ", carBrandId=" + carBrandId + |
| | | ", carLicensePlate='" + carLicensePlate + '\'' + |
| | | ", carPhoto='" + carPhoto + '\'' + |
| | | ", drivingLicenseNumber='" + drivingLicenseNumber + '\'' + |
| | | ", drivingLicensePhoto='" + drivingLicensePhoto + '\'' + |
| | | ", annualInspectionTime=" + annualInspectionTime + |
| | | ", commercialInsuranceTime=" + commercialInsuranceTime + |
| | | ", insertTime=" + insertTime + |
| | | ", state=" + state + |
| | | ", addType=" + addType + |
| | | ", addObjectId=" + addObjectId + |
| | | '}'; |
| | | } |
| | | /** |
| | | * google车辆id |
| | | */ |
| | | @TableField("vehicleId") |
| | | private String vehicleId; |
| | | } |
| | |
| | | @TableField("money") |
| | | private Double money; |
| | | /** |
| | | * 自动下班时间 |
| | | */ |
| | | @TableField("offlineTime") |
| | | private Double offlineTime; |
| | | /** |
| | | * 活动开始时间 |
| | | */ |
| | | @TableField("startTime") |
| | |
| | | this.money = money; |
| | | } |
| | | |
| | | public Double getOfflineTime() { |
| | | return offlineTime; |
| | | } |
| | | |
| | | public void setOfflineTime(Double offlineTime) { |
| | | this.offlineTime = offlineTime; |
| | | } |
| | | |
| | | public Date getStartTime() { |
| | | return startTime; |
| | | } |
| | |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 获取业务类型(1=专车,2=出租车,3=城际,4=小件物流) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 在线日期 |
| | | */ |
| | | @TableField("date") |
| | |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Date getDate() { |
| | | return date; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 系统提醒规则 |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/18 16:09 |
| | | */ |
| | | @Data |
| | | @TableName("t_sys_reminder_rules") |
| | | public class ReminderRules { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 企业id |
| | | */ |
| | | @TableField("companyId") |
| | | private Integer companyId; |
| | | /** |
| | | * 配置规则 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | } |
| | |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 余额类型(1=奖励余额,2=收入余额) |
| | | */ |
| | | @TableField("balanceType") |
| | | private Integer balanceType; |
| | | /** |
| | | * 支付时间 |
| | | */ |
| | | @TableField("payTime") |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.BalanceUsageRecord1; |
| | | import com.stylefeng.guns.modular.system.warpper.BalanceUsageRecordList; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/13 10:25 |
| | | */ |
| | | public interface IBalanceUsageRecordService extends IService<BalanceUsageRecord1> { |
| | | |
| | | /** |
| | | * 获取使用记录列表 |
| | | * @param driverId |
| | | * @param type |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | */ |
| | | List<BalanceUsageRecordList> queryBalanceUsageRecord(Integer language, Integer driverId, Integer type, Integer pageNum, Integer size); |
| | | |
| | | |
| | | /** |
| | | * 获取使用记录总额 |
| | | * @param driverId |
| | | * @param type |
| | | * @return |
| | | */ |
| | | Double queryBalanceUsageRecordSum(Integer driverId, Integer type); |
| | | |
| | | |
| | | /** |
| | | * 保存数据 |
| | | * @param driverId |
| | | * @param type |
| | | * @param money |
| | | * @param purpose |
| | | */ |
| | | void saveBalanceUsageRecord(Integer driverId, Integer type, Double money, Integer purpose); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.CancleOrder; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/28 10:16 |
| | | */ |
| | | public interface ICancleOrderService extends IService<CancleOrder> { |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | Integer querySumTime(Integer driverId, Integer assessment, Date start, Date end); |
| | | |
| | | |
| | | /** |
| | | * 定时检测司机是否连续接单 |
| | | */ |
| | | void deductionDuration(); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.ReminderRules; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/18 16:11 |
| | | */ |
| | | public interface IReminderRulesService extends IService<ReminderRules> { |
| | | } |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryWithdrawal(Integer language, Integer uid, Integer type, Integer pageNum, Integer size) throws Exception; |
| | | List<Map<String, Object>> queryWithdrawal(Integer language, Integer uid, Integer type, Integer state, Integer pageNum, Integer size) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil withdrawalAudit(Integer id, Integer state, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获提现总额 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Double queryWithdrawalSum(Integer uid, Integer type) throws Exception; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.BalanceUsageRecordMapper; |
| | | import com.stylefeng.guns.modular.system.model.BalanceUsageRecord1; |
| | | import com.stylefeng.guns.modular.system.service.IBalanceUsageRecordService; |
| | | import com.stylefeng.guns.modular.system.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BalanceUsageRecordList; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/13 10:25 |
| | | */ |
| | | @Service |
| | | public class BalanceUsageRecordServiceImpl extends ServiceImpl<BalanceUsageRecordMapper, BalanceUsageRecord1> implements IBalanceUsageRecordService { |
| | | |
| | | |
| | | /** |
| | | * 获取使用记录列表 |
| | | * @param driverId |
| | | * @param type |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<BalanceUsageRecordList> queryBalanceUsageRecord(Integer language, Integer driverId, Integer type, Integer pageNum, Integer size) { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> list = this.baseMapper.queryBalanceUsageRecord(driverId, type, pageNum, size); |
| | | List<BalanceUsageRecordList> datas = new ArrayList<>(); |
| | | for (Map<String, Object> map : list) { |
| | | BalanceUsageRecordList balanceUsageRecordList = new BalanceUsageRecordList(); |
| | | if(null != map.get("createTime")){ |
| | | balanceUsageRecordList.setTime(DateUtil.conversionFormat(language, map.get("createTime").toString())); |
| | | } |
| | | if(null != map.get("money")){ |
| | | balanceUsageRecordList.setMoney(Double.valueOf(map.get("money").toString())); |
| | | } |
| | | if(null != map.get("purpose")){ |
| | | switch (map.get("purpose").toString()){ |
| | | case "1": |
| | | balanceUsageRecordList.setContent(language == 1 ? "打车支付" : language == 2 ? "" : ""); |
| | | break; |
| | | case "2": |
| | | balanceUsageRecordList.setContent(language == 1 ? "包裹支付" : language == 2 ? "" : ""); |
| | | break; |
| | | case "3": |
| | | balanceUsageRecordList.setContent(language == 1 ? "日结算" : language == 2 ? "Daily settlement" : "Règlement quotidien"); |
| | | break; |
| | | case "4": |
| | | balanceUsageRecordList.setContent(language == 1 ? "周结算" : language == 2 ? "Weekly settlement" : "Règlement hebdomadaire"); |
| | | break; |
| | | case "5": |
| | | balanceUsageRecordList.setContent(language == 1 ? "月结算" : language == 2 ? "Monthly settlement" : "Règlement mensuel"); |
| | | break; |
| | | case "6": |
| | | balanceUsageRecordList.setContent(language == 1 ? "提现" : language == 2 ? "Withdraw" : "Retirer"); |
| | | break; |
| | | } |
| | | } |
| | | datas.add(balanceUsageRecordList); |
| | | } |
| | | return datas; |
| | | } |
| | | |
| | | /** |
| | | * 获取使用记录总额 |
| | | * @param driverId |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Double queryBalanceUsageRecordSum(Integer driverId, Integer type) { |
| | | return this.baseMapper.queryBalanceUsageRecordSum(driverId, type); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存数据 |
| | | * @param driverId |
| | | * @param type |
| | | * @param money |
| | | * @param purpose |
| | | */ |
| | | @Override |
| | | public void saveBalanceUsageRecord(Integer driverId, Integer type, Double money, Integer purpose) { |
| | | BalanceUsageRecord1 balanceUsageRecord = new BalanceUsageRecord1(); |
| | | balanceUsageRecord.setDriverId(driverId); |
| | | balanceUsageRecord.setType(type); |
| | | balanceUsageRecord.setMoney(money); |
| | | balanceUsageRecord.setPurpose(purpose); |
| | | balanceUsageRecord.setCreateTime(new Date()); |
| | | this.insert(balanceUsageRecord); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.CancleOrderMapper; |
| | | import com.stylefeng.guns.modular.system.model.CancleOrder; |
| | | import com.stylefeng.guns.modular.system.service.ICancleOrderService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/28 10:17 |
| | | */ |
| | | @Service |
| | | public class CancleOrderServiceImpl extends ServiceImpl<CancleOrderMapper, CancleOrder> implements ICancleOrderService { |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.dao.DriverActivityHistoryMapper; |
| | | import com.stylefeng.guns.modular.system.dao.DriverActivityOnlineMapper; |
| | | import com.stylefeng.guns.modular.system.dao.DriverOnlineMapper; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.DriverAssessment; |
| | | import com.stylefeng.guns.modular.system.model.DriverOnline; |
| | | import com.stylefeng.guns.modular.system.model.DriverWork; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.IDriverAssessmentService; |
| | | import com.stylefeng.guns.modular.system.service.IDriverOnlineService; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.service.IDriverWorkService; |
| | | import com.stylefeng.guns.modular.system.util.PushUtil; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class DriverOnlineServiceImpl extends ServiceImpl<DriverOnlineMapper, DriverOnline> implements IDriverOnlineService { |
| | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Resource |
| | | private DriverActivityOnlineMapper driverActivityOnlineMapper; |
| | | |
| | | @Resource |
| | | private DriverActivityHistoryMapper driverActivityHistoryMapper; |
| | | |
| | | @Autowired |
| | | private IOrderPrivateCarService orderPrivateCarService; |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加数据 |
| | |
| | | public void addDriverOnline(Integer driverId) throws Exception { |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driverId).eq("state", 1)); |
| | | if(null == driverWork){//非上班状态不记录 |
| | | redisUtil.remove("ONLINE_" + driverId); |
| | | for (int i = 1; i < 5; i++) { |
| | | redisUtil.remove("ONLINE_" + i + "_" + driverId); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | String[] split1 = driverWork.getType().split(","); |
| | | for (String ty : split1) { |
| | | //查询数据及条件判断 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | DriverOnline query = driverOnlineMapper.query(driverId, sdf.format(new Date()), 0);//正常记录数据 |
| | | DriverOnline query = driverOnlineMapper.query(driverId, sdf.format(new Date()), Integer.valueOf(ty), 0);//正常记录数据 |
| | | DriverOnline query1 = null;//考勤范围内的数据 |
| | | DriverAssessment driverAssessment = driverAssessmentService.selectOne(new EntityWrapper<DriverAssessment>() |
| | | .eq("companyId", driverService.selectById(driverId).getCompanyId())); |
| | |
| | | s = sdf1.parse(sdf.format(new Date()) + " " + split[0]); |
| | | e = sdf1.parse(sdf.format(new Date()) + " " + split[1]); |
| | | if(now > s.getTime() && now <= e.getTime()){ |
| | | query1 = driverOnlineMapper.query(driverId, sdf.format(new Date()), 1); |
| | | query1 = driverOnlineMapper.query(driverId, sdf.format(new Date()), Integer.valueOf(ty), 1); |
| | | } |
| | | } |
| | | |
| | | //开始修改数据 |
| | | if(query != null){ |
| | | String value = redisUtil.getValue("ONLINE_" + driverId); |
| | | String value = redisUtil.getValue("ONLINE_" + ty + "_" + driverId); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | redisUtil.setStrValue("ONLINE_" + driverId, String.valueOf(now / 1000));//存入秒 |
| | | redisUtil.setStrValue("ONLINE_" + ty + "_" + driverId, String.valueOf(now / 1000));//存入秒 |
| | | return; |
| | | } |
| | | Long ss = (now / 1000) - Long.valueOf(value); |
| | | if(ss.longValue() >= 600){//间隔时间大于10分钟则为离线 |
| | | redisUtil.remove("ONLINE_" + driverId); |
| | | redisUtil.remove("ONLINE_" + ty + "_" + driverId); |
| | | return; |
| | | } |
| | | |
| | |
| | | }else{ |
| | | query1 = new DriverOnline(); |
| | | query1.setDriverId(driverId); |
| | | query1.setType(Integer.valueOf(ty)); |
| | | query1.setDate(new Date()); |
| | | query1.setAssessment(1); |
| | | query1.setDuration(ss); |
| | |
| | | }else{ |
| | | DriverOnline driverOnline = new DriverOnline(); |
| | | driverOnline.setDriverId(driverId); |
| | | driverOnline.setType(Integer.valueOf(ty)); |
| | | driverOnline.setDate(new Date()); |
| | | driverOnline.setAssessment(0); |
| | | driverOnline.setDuration(0L); |
| | | driverOnlineMapper.insert(driverOnline); |
| | | } |
| | | redisUtil.setStrValue("ONLINE_" + driverId, String.valueOf(now / 1000));//存入秒 |
| | | redisUtil.setStrValue("ONLINE_" + ty + "_" + driverId, String.valueOf(now / 1000));//存入秒 |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | public Integer querySumTime(Integer driverId, Integer assessment, Date start, Date end) { |
| | | return driverOnlineMapper.querySumTime(driverId, assessment, start, end); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时检测司机是否连续接单 |
| | | */ |
| | | @Override |
| | | public void deductionDuration() { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String format = sdf.format(new Date()); |
| | | List<DriverActivityHistory> driverActivityHistories = driverActivityHistoryMapper.selectList(new EntityWrapper<DriverActivityHistory>().eq("DATE_FORMAT(day, '%Y-%m-%d')", format).eq("type", 3).eq("carryOut", 1)); |
| | | List<Integer> collect = driverActivityHistories.stream().map(DriverActivityHistory::getDriverId).collect(Collectors.toList()); |
| | | if(collect.size() == 0){ |
| | | return; |
| | | } |
| | | for (DriverActivityHistory driverActivityHistory : driverActivityHistories) { |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driverActivityHistory.getDriverId()).eq("state", 1)); |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | DriverActivityOnline driverActivityOnline = driverActivityOnlineMapper.selectById(driverActivityHistory.getActivityId()); |
| | | DriverOnline driverOnline = this.selectOne(new EntityWrapper<DriverOnline>().eq("DATE_FORMAT(date, '%Y-%m-%d')", format) |
| | | .eq("driverId", driverActivityHistory.getDriverId()).eq("type", driverActivityOnline.getType())); |
| | | if(null == driverOnline){ |
| | | continue; |
| | | } |
| | | Integer driverId = driverOnline.getDriverId(); |
| | | Driver driver1 = driverService.selectById(driverId); |
| | | long m = Double.valueOf(driverActivityOnline.getOfflineTime() * 3600000L).longValue(); |
| | | |
| | | //找出最后一次接单的时间 |
| | | long mm = 0L; |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectOne(new EntityWrapper<OrderPrivateCar>().eq("driverId", driverId).eq("isDelete", 1).ne("state", 10)); |
| | | Date snatchOrderTime = null; |
| | | if(null != orderPrivateCar){ |
| | | snatchOrderTime = orderPrivateCar.getSnatchOrderTime(); |
| | | mm = snatchOrderTime.getTime(); |
| | | } |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectOne(new EntityWrapper<OrderLogistics>().eq("driverId", driverId).eq("isDelete", 1).ne("state", 10)); |
| | | if(null != orderLogistics && snatchOrderTime.before(orderLogistics.getSnatchOrderTime())){ |
| | | mm = orderLogistics.getSnatchOrderTime().getTime(); |
| | | } |
| | | |
| | | //超时不接单,直接将之前的在线时长清零 |
| | | //推送司机下班提醒 |
| | | if(mm >= m){ |
| | | this.deleteById(driverOnline.getId()); |
| | | driverWork.setState(2); |
| | | driverWork.setEndTime(new Date()); |
| | | driverWorkService.updateById(driverWork); |
| | | Driver driver = driverService.selectById(driverWork.getDriverId()); |
| | | driver.setState(1); |
| | | driverService.updateById(driver); |
| | | Integer language = driver.getLanguage(); |
| | | pushUtil.pushOffline(driverOnline.getDriverId(), 2, language == 1 ? "您已连续" + driverActivityOnline.getOfflineTime() + "小时未接单,系统将强制更改您的状态为:下班" : |
| | | language == 2 ? "You have not been accepting orders for " + driverActivityOnline.getOfflineTime() + " hour(s) System will change your state to Off-work" : |
| | | "Vous n’acceptez pas de commandes depuis " + driverActivityOnline.getOfflineTime() + " heure(s) Le système changera votre état en Hors travail"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.AddressComponentsVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.ReverseGeocodeVo; |
| | | import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; |
| | |
| | | import org.apache.shiro.authc.credential.HashedCredentialsMatcher; |
| | | import org.apache.shiro.crypto.hash.Md5Hash; |
| | | import org.apache.shiro.util.ByteSource; |
| | | import org.apache.shiro.util.StringUtils; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | |
| | | |
| | | @Autowired |
| | | private TEmailService emailService; |
| | | |
| | | @Autowired |
| | | private FleetEngineUtil fleetEngineUtil; |
| | | |
| | | |
| | | @Resource |
| | | private CarModelMapper carModelMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | loginWarpper.setJumpCode("200000"); |
| | | } |
| | | } |
| | | |
| | | //司机登录,添加谷歌上的车辆信息 |
| | | Car car = carService.selectById(driver.getCarId()); |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carService.updateById(car); |
| | | } |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | loginWarpper.setVehicleId(car.getVehicleId()); |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | |
| | |
| | | public ResultUtil work(Integer uid, String type, Integer language) throws Exception { |
| | | DriverWork driverWork = driverWorkMapper.queryNewWork(uid, null, 1); |
| | | Driver driver = this.selectById(uid); |
| | | Car car = carService.selectById(driver.getCarId()); |
| | | if(null != driverWork){//作下班操作 |
| | | //检测是否有未完成的订单 |
| | | List<Map<String, Object>> list = orderService.queryOrderList(1, 1, 10, uid, language); |
| | |
| | | driverWork.setState(2); |
| | | driverWorkMapper.updateById(driverWork); |
| | | driver.setState(1); |
| | | |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carService.updateById(car); |
| | | } |
| | | |
| | | //司机下班,修改谷歌上的车辆信息 |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | }else{ |
| | | fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | }else{ |
| | | LoginWarpper loginWarpper = new LoginWarpper(); |
| | | if(driver.getCompanyId()==null){ |
| | |
| | | if(driver.getAuthState()==4){ |
| | | return ResultUtil.error(language == 1 ? "请完善资料后再出车" : language == 2 ? "Please complete data before driving." : "Veuillez compléter les données avant de conduire."); |
| | | } |
| | | Car car = carService.selectById(driver.getCarId()); |
| | | if(car==null){ |
| | | return ResultUtil.error(language == 1 ? "请完善资料后再出车" : language == 2 ? "Please complete data before driving." : "Veuillez compléter les données avant de conduire."); |
| | | } |
| | |
| | | driverWork.setType(type); |
| | | driverWorkMapper.insert(driverWork); |
| | | driver.setState(2); |
| | | |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carService.updateById(car); |
| | | } |
| | | |
| | | //司机上班,修改谷歌上的车辆信息 |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | }else{ |
| | | fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | } |
| | | this.updateById(driver); |
| | | return ResultUtil.success(); |
| | |
| | | activityWarpper.setId(driverActivityOnline.getId()); |
| | | StringBuffer sb = new StringBuffer(language == 1 ? "今日" : |
| | | language == 2 ? "Today, stay online receiving orders of " : "Aujourd’hui, reste en ligne à recevoir des commandes "); |
| | | DriverOnline query = driverOnlineMapper.query(uid, sdf1.format(new Date()), 0); |
| | | DriverOnline query = driverOnlineMapper.query(uid, sdf1.format(new Date()), driverActivityOnline.getType(), 0); |
| | | Integer hour = 0; |
| | | if(null != query){ |
| | | hour = Long.valueOf(query.getDuration() / 3600).intValue(); |
| | |
| | | continue; |
| | | } |
| | | Long duration = Long.valueOf(dao.getOnline() * 3600); |
| | | List<DriverOnline> driverOnlines = driverOnlineMapper.queryList(sdf.format(new Date()), duration); |
| | | List<DriverOnline> driverOnlines = driverOnlineMapper.queryList(sdf.format(new Date()), dao.getType(), duration); |
| | | for (DriverOnline driverOnline : driverOnlines) { |
| | | if(dah.getDriverId().compareTo(driverOnline.getDriverId()) == 0){ |
| | | dah.setCarryOut(2);//完成状态 |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.common.constant.state.Order; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | |
| | | import com.stylefeng.guns.modular.system.dao.PhoneMapper; |
| | | import com.stylefeng.guns.modular.system.dao.RegionMapper; |
| | | import com.stylefeng.guns.modular.system.dao.SysReformistMapper; |
| | | import com.stylefeng.guns.modular.system.model.BankCard; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.OrderPosition; |
| | | import com.stylefeng.guns.modular.system.model.Region; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo; |
| | |
| | | |
| | | @Autowired |
| | | private IBankCardService bankCardService; |
| | | |
| | | @Autowired |
| | | private ICancleOrderService cancleOrderService; |
| | | |
| | | @Autowired |
| | | private ISettlementDetailService settlementDetailService; |
| | | |
| | | @Autowired |
| | | private ISettlementRecordService settlementRecordService; |
| | | |
| | | @Resource |
| | | private IBalanceUsageRecordService balanceUsageRecordService; |
| | | |
| | | |
| | | |
| | |
| | | // datas.addAll(list); |
| | | //专车 |
| | | List<Map<String, Object>> list1 = orderPrivateCarService.queryMyAllOrder(state, uid, language); |
| | | for (Map<String, Object> map : list1) { |
| | | Integer id = Integer.valueOf(map.get("id").toString()); |
| | | map.put("settleAccounts", 1); |
| | | SettlementDetail settlementDetail = settlementDetailService.selectOne(new EntityWrapper<SettlementDetail>().eq("orderId", id).eq("orderType", 1)); |
| | | if(null != settlementDetail){ |
| | | SettlementRecord settlementRecord = settlementRecordService.selectById(settlementDetail.getSettlementRecordId()); |
| | | map.put("settleAccounts", settlementRecord.getPaymentStatus() == 1 ? 0 : 1); |
| | | } |
| | | } |
| | | datas.addAll(list1); |
| | | //跨城 |
| | | // List<Map<String, Object>> list2 = orderCrossCityService.queryMyAllOrder(state, uid); |
| | | // datas.addAll(list2); |
| | | //小件物流 |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryMyAllOrder(state, uid, language); |
| | | for (Map<String, Object> map : list3) { |
| | | Integer id = Integer.valueOf(map.get("id").toString()); |
| | | map.put("settleAccounts", 1); |
| | | SettlementDetail settlementDetail = settlementDetailService.selectOne(new EntityWrapper<SettlementDetail>().eq("orderId", id).eq("orderType", 4)); |
| | | if(null != settlementDetail){ |
| | | SettlementRecord settlementRecord = settlementRecordService.selectById(settlementDetail.getSettlementRecordId()); |
| | | map.put("settleAccounts", settlementRecord.getPaymentStatus() == 1 ? 0 : 1); |
| | | } |
| | | } |
| | | datas.addAll(list3); |
| | | |
| | | List<OrderListWarpper> orderListWarpper = OrderListWarpper.getOrderListWarpper(datas); |
| | |
| | | if(null != map.get("telX")){ |
| | | map.put("phone", map.get("telX")); |
| | | } |
| | | Integer companyId = 1; |
| | | if(null != map.get("driverId")){ |
| | | companyId = Integer.valueOf(String.valueOf(map.get("companyId"))); |
| | | } |
| | | CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", companyId)); |
| | | JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); |
| | | map.put("timeOutCancel", jsonObject.getIntValue("driverTimeout")); |
| | | return map; |
| | | } |
| | | |
| | |
| | | case 3://城际(没有此流程) |
| | | break; |
| | | case 4:// |
| | | break; |
| | | return orderLogisticsService.confirmFees(language, orderId, type, parkingFee, crossingFee); |
| | | case 5: |
| | | break; |
| | | case 6: |
| | |
| | | case 3://城际(没有此流程) |
| | | return null; |
| | | case 4:// |
| | | break; |
| | | return orderLogisticsService.queryOrderInfo(language, orderId); |
| | | case 5: |
| | | break; |
| | | case 6: |
| | |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString()); |
| | | } |
| | | break; |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | if(orderLogistics.getState() == 8 || orderLogistics.getState() == 9){ |
| | | return ResultUtil.error(language == 1 ? "订单已完成支付,不允许重复支付" : language == 2 ? "The order has been paid, recurring payments is not allowed." : "La commande a été payée, les paiements récurrents ne sont pas autorisés."); |
| | | } |
| | | if(orderLogistics.getState() != 7){ |
| | | return ResultUtil.error(language == 1 ? "订单不在待支付,无法完成订单" : language == 2 ? "The order is no longer with Pending Payment, unable to complete the order." : "La commande n’est plus en attente de paiement, il est impossible de terminer la commande."); |
| | | } |
| | | orderLogistics.setPayManner(2);//其他方式支付 |
| | | orderLogistics.setRedPacketMoney(0D); |
| | | orderLogistics.setCouponMoney(0D); |
| | | orderLogistics.setDiscount(0D); |
| | | orderLogistics.setDiscountMoney(0D); |
| | | orderLogistics.setPayMoney(orderLogistics.getOrderMoney()); |
| | | orderLogistics.setState(8); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | userId = orderLogistics.getUserId(); |
| | | driverId = orderLogistics.getDriverId(); |
| | | state = orderLogistics.getState(); |
| | | break; |
| | | } |
| | | |
| | | |
| | |
| | | return orderPrivateCarService.queryMoneyInfo(orderId); |
| | | case 2: |
| | | break; |
| | | case 4: |
| | | return orderLogisticsService.queryMoneyInfo(orderId); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | |
| | | for(OrderPrivateCar order : orderList){ |
| | | if(order.getSmsTime()==null ){ |
| | | if(order.getGetoffTime().getTime()+24*60*60*1000L<day.getTime()){ |
| | | if(null != order.getGetoffTime() && order.getGetoffTime().getTime()+24*60*60*1000L<day.getTime()){ |
| | | order.setSmsNumber(order.getSmsNumber()+1); |
| | | order.setSmsTime(day); |
| | | //发送短信 |
| | |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | driver.setBalance(driver.getBalance() - money); |
| | | if(driver.getLaveBusinessMoney().compareTo(money) < 0){ |
| | | double b = money - driver.getLaveBusinessMoney(); |
| | | Double laveBusinessMoney = driver.getLaveBusinessMoney(); |
| | | if(laveBusinessMoney.compareTo(money) < 0){ |
| | | double b = money - laveBusinessMoney; |
| | | driver.setLaveBusinessMoney(0D); |
| | | driver.setLaveActivityMoney(driver.getLaveActivityMoney() - b); |
| | | driverService.updateById(driver); |
| | | balanceUsageRecordService.saveBalanceUsageRecord(driver.getId(), 1, b, orderType == 1 ? 1 : 2); |
| | | balanceUsageRecordService.saveBalanceUsageRecord(driver.getId(), 2, laveBusinessMoney, orderType == 1 ? 1 : 2); |
| | | }else{ |
| | | driver.setLaveBusinessMoney(driver.getLaveBusinessMoney() - money); |
| | | driverService.updateById(driver); |
| | | balanceUsageRecordService.saveBalanceUsageRecord(driver.getId(), 2, money, orderType == 1 ? 1 : 2); |
| | | } |
| | | |
| | | if(orderType == 1){//专车 |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.ReminderRulesMapper; |
| | | import com.stylefeng.guns.modular.system.model.ReminderRules; |
| | | import com.stylefeng.guns.modular.system.service.IReminderRulesService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/18 16:12 |
| | | */ |
| | | @Service |
| | | public class ReminderRulesServiceImpl extends ServiceImpl<ReminderRulesMapper, ReminderRules> implements IReminderRulesService { |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.system.warpper.QueryHistoricalSettlement; |
| | | import com.stylefeng.guns.modular.system.warpper.QuerySettlementAmount; |
| | | import com.stylefeng.guns.modular.system.warpper.QuerySettlementAmountDetails; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath;//支付回调网关地址 |
| | | |
| | | @Resource |
| | | private IBalanceUsageRecordService balanceUsageRecordService; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | Double laveActivityMoney = driver1.getLaveActivityMoney(); |
| | | Double laveBusinessMoney = driver1.getLaveBusinessMoney(); |
| | | if(laveBusinessMoney.compareTo(payMoney) < 0){ |
| | | driver1.setLaveBusinessMoney(0D); |
| | | BigDecimal m = new BigDecimal(payMoney).subtract(new BigDecimal(laveBusinessMoney)); |
| | | driver1.setLaveActivityMoney(new BigDecimal(laveActivityMoney).subtract(m).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | if(laveActivityMoney.compareTo(payMoney) < 0){ |
| | | driver1.setLaveActivityMoney(0D); |
| | | BigDecimal m = new BigDecimal(payMoney).subtract(new BigDecimal(laveActivityMoney)); |
| | | driver1.setLaveBusinessMoney(new BigDecimal(laveBusinessMoney).subtract(m).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | settlementRecord.setPayMoney(laveActivityMoney); |
| | | settlementRecord.setPaymentStatus(2); |
| | | settlementRecord.setPayType(payType); |
| | | settlementRecord.setBalanceType(1); |
| | | settlementRecord.setPayTime(new Date()); |
| | | this.updateById(settlementRecord); |
| | | balanceUsageRecordService.saveBalanceUsageRecord(settlementRecord.getDriverId(), 1, laveActivityMoney, settlementRecord.getType() + 2); |
| | | balanceUsageRecordService.saveBalanceUsageRecord(settlementRecord.getDriverId(), 2, m.doubleValue(), settlementRecord.getType() + 2); |
| | | |
| | | SettlementRecord settlementRecord1 = new SettlementRecord(); |
| | | BeanUtils.copyProperties(settlementRecord, settlementRecord1); |
| | | settlementRecord1.setId(null); |
| | | settlementRecord1.setPayMoney(m.doubleValue()); |
| | | settlementRecord1.setBalanceType(2); |
| | | this.insert(settlementRecord1); |
| | | |
| | | }else{ |
| | | driver1.setLaveBusinessMoney(new BigDecimal(laveBusinessMoney).subtract(new BigDecimal(payMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver1.setLaveActivityMoney(new BigDecimal(laveActivityMoney).subtract(new BigDecimal(payMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | settlementRecord.setPaymentStatus(2); |
| | | settlementRecord.setPayType(payType); |
| | | settlementRecord.setBalanceType(1); |
| | | settlementRecord.setPayTime(new Date()); |
| | | this.updateById(settlementRecord); |
| | | balanceUsageRecordService.saveBalanceUsageRecord(settlementRecord.getDriverId(), 1, payMoney, settlementRecord.getType() + 2); |
| | | } |
| | | driver1.setBalance(new BigDecimal(driver1.getBalance()).subtract(new BigDecimal(payMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(driverId, "线下结算", payMoney, 2, 1, 2, null, null); |
| | | driverService.updateById(driver1); |
| | | |
| | | settlementRecord.setPaymentStatus(2); |
| | | settlementRecord.setPayType(payType); |
| | | settlementRecord.setPayTime(new Date()); |
| | | this.updateById(settlementRecord); |
| | | return ResultUtil.success(""); |
| | | } |
| | | return resultUtil; |
| | |
| | | @Override |
| | | public List<QueryHistoricalSettlement> queryHistoricalSettlement(Integer language, Integer driverId, Integer pageNum, Integer size) { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<QueryHistoricalSettlement> list = this.baseMapper.queryHistoricalSettlement(driverId, pageNum, size); |
| | | for (QueryHistoricalSettlement queryHistoricalSettlement : list) { |
| | | if(ToolUtil.isNotEmpty(queryHistoricalSettlement.getCreateTime())){ |
| | | String createTime = queryHistoricalSettlement.getCreateTime(); |
| | | queryHistoricalSettlement.setCreateTime(DateUtil.conversionFormat(language, createTime)); |
| | | List<Map<String, Object>> list = this.baseMapper.queryHistoricalSettlement(driverId, pageNum, size); |
| | | List<QueryHistoricalSettlement> datas = new ArrayList<>(); |
| | | for (Map<String, Object> map : list) { |
| | | QueryHistoricalSettlement queryHistoricalSettlement = new QueryHistoricalSettlement(); |
| | | if(null != map.get("createTime")){ |
| | | queryHistoricalSettlement.setCreateTime(DateUtil.conversionFormat(language, map.get("createTime").toString())); |
| | | } |
| | | if(null != map.get("price")){ |
| | | queryHistoricalSettlement.setPrice(Double.valueOf(map.get("price").toString())); |
| | | } |
| | | if(null != map.get("type")){ |
| | | queryHistoricalSettlement.setType(Integer.valueOf(map.get("type").toString())); |
| | | } |
| | | if(null != map.get("payType")){ |
| | | Integer balanceType = Integer.valueOf(map.get("balanceType").toString()); |
| | | switch (map.get("payType").toString()){ |
| | | case "1": |
| | | queryHistoricalSettlement.setPayType(language == 1 ? "手机支付" : language == 2 ? "Mobile Money" : "Paiement mobile"); |
| | | break; |
| | | case "2": |
| | | queryHistoricalSettlement.setPayType(language == 1 ? "线上支付" : language == 2 ? "Bank Card" : "Carte bancaire"); |
| | | break; |
| | | default: |
| | | queryHistoricalSettlement.setPayType(language == 1 ? "余额支付(" + (balanceType == 1 ? "奖励" : "收入") + ")" : language == 2 ? "Wallet (" + (balanceType == 1 ? "Reward" : "Income") + ")" : "Portefeuille (" + (balanceType == 1 ? "Récompense" : "Revenu") + ")"); |
| | | break; |
| | | } |
| | | } |
| | | return list; |
| | | datas.add(queryHistoricalSettlement); |
| | | } |
| | | return datas; |
| | | } |
| | | |
| | | |
| | |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.model.Withdrawal; |
| | | import com.stylefeng.guns.modular.system.service.IBalanceUsageRecordService; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.service.IWithdrawalService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Resource |
| | | private IBalanceUsageRecordService balanceUsageRecordService; |
| | | |
| | | |
| | | |
| | |
| | | driver.setLaveActivityMoney(v); |
| | | v = new BigDecimal(driver.getBalance()).subtract(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | driver.setBalance(v); |
| | | balanceUsageRecordService.saveBalanceUsageRecord(driver.getId(), 1, money, 6); |
| | | } |
| | | if(type == 2){ |
| | | double v = new BigDecimal(driver.getLaveBusinessMoney()).subtract(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | driver.setLaveBusinessMoney(v); |
| | | balanceUsageRecordService.saveBalanceUsageRecord(driver.getId(), 2, money, 6); |
| | | } |
| | | driverService.updateById(driver); |
| | | return ResultUtil.success(); |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryWithdrawal(Integer language, Integer uid, Integer type, Integer pageNum, Integer size) throws Exception { |
| | | public List<Map<String, Object>> queryWithdrawal(Integer language, Integer uid, Integer type, Integer state, Integer pageNum, Integer size) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> list = withdrawalMapper.queryWithdrawal(uid, 2, type, pageNum, size); |
| | | List<Map<String, Object>> list = withdrawalMapper.queryWithdrawal(uid, 2, type, state, pageNum, size); |
| | | for (Map<String, Object> map : list) { |
| | | if(null != map.get("insertTime")){ |
| | | String insertTime = map.get("insertTime").toString(); |
| | |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | /** |
| | | * 获取提现总额 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Double queryWithdrawalSum(Integer uid, Integer type) throws Exception { |
| | | return this.baseMapper.queryWithdrawalSum(uid, 2, type); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.GoogleMap; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import cn.hutool.http.Method; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.fleetengine.auth.AuthTokenMinter; |
| | | import com.google.fleetengine.auth.token.FleetEngineToken; |
| | | import com.google.fleetengine.auth.token.TripClaims; |
| | | import com.google.fleetengine.auth.token.VehicleClaims; |
| | | import com.google.fleetengine.auth.token.factory.signer.*; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * Fleet Engine API 工具类 |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/17 9:59 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class FleetEngineUtil { |
| | | |
| | | static Logger logger = LoggerFactory.getLogger(FleetEngineUtil.class); |
| | | |
| | | private final String SERVICE_ACCOUNT = "odrd2024@i-go-odrd-testing.iam.gserviceaccount.com"; |
| | | |
| | | private final String privateKeyId = "0a9a480fafb6469c0c1b2fa6dbdf6d4bebe1ebed"; |
| | | |
| | | private final String privateKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDXZoPEFZeZb0C7DXzpPsloB+rQVQAJuR+z4T9uRCz33gBsIqrz1s5Iwd8vXYKKWzukMdXkwqR4WapI/4GtcpbJkRK93mKXvEE3sDz27BnRrZL4gHeECVpFy0egw29sqFM/x/cpst0goqq4/f3ZFGtQGIhSEEHMySQgTbZDIhXMIls1etRsM4K2bTXeMPn89ablPBdbKtTAJy1EI+ZLKbxnl9StyqBam+d+UsfVmNG19MsNbSzCKc+QPnPXb7dj9KxJ/2whog8w15qXQdJHAMeHZyNlqE0zVP7G1VdWo6Q4QtzmENANxBpJIEbAqY2sq3BZSqDd5XS9Dr9BR4XzQqQnAgMBAAECggEABFABAj4eph1vxVYRBH2TpvDGFU3uW7VBPjwp7JzntLAN8eNoPlqmEDP16y6D/HMmfftpAI3TvWA3+ZEPkiX6nVDyW6sGCodyP0QuJEob1HKHFYntzGtHhGg1KCOacLey6TYbJJmUtcsduQXGkocOPaLXNvjzr2mY2zthTDzJ6HzjDo3d2x/O+lUVlNjubTFydgU9bQP8zS389GgZkO/YebK9+qPRBXv1R2fmj0rhpLqC03jL/mUMKi5tW628OiJGdvzLXlAGyJ9CtVDjfrwUgLf8ML+3yfdmv7yFeWuJ2NEgQxKACixHM05qkCW2bOkPIi9+wb1BbVvMdYL+GCPvmQKBgQD/DZ8zpWfNAkl8h8NI0E7sPdN6wgGfPpaC8VpOE3EM2eEijkZZT6XjfxXjMv1vXg1UoeYVscPb99Ux6u2gq+ZJj6+IstNIObXgvrqNxKPw6OO2xCb6UmA4rQ74xe4d1KLN+C1zepgFYgU4ejungWzuPVL7x8xjdyBAvqgPqP1IbQKBgQDYMzXs2QcWr9tVwq1O3D/H6qX2DvelAj7j0vuXGtop1/aJW7bPlGJd9NGim8dnXLVSFyRteuVl4epa/C9h50g3FM/lFMl9lmp1HwpDeiSJYAGRH8cnPJjN/IV3cRl5qN8KUQE2a3BRP+6IPHJiF1Bc1vj08nTMsWmN+K6VcAzqYwKBgGGJ7RNMM0kkkcPtC5LCDxyrfD/bB9HFlrvW3ykyqC44+K9FZ8PqAM/inxU3P9KiTkjKbXpodDWgLskbResHMld5erC1arWZVGPxrNhgli2gcs1HcHyUmjWygSJEV47S7bwFKCScgpy0Yri5jiy+A1GM5Dpjq1dyjEQWZaEviEV1AoGBALoKn023l/T60QgkZNQmjS/wCG4LhSjWHN4ZMOxfa/pz369lX5OSwW7OfBKscFPOoC0Kwwr+pSYd2HgA6Jkb17WmUBt13skWRXeRhVh5Y7VfCxohuVNXPrqKoSMeDOj22y9ac2ur2lPgateLBHbKTxoE1uiZNs7pn8ZOh5UKfeK3AoGBAKjklIbZ05nvM/mzdPk9JfCFJ6SaQqeaQcU9AoLEQdOzIrrI660Ignn4hOzLSYac0GxytYTQzDt5xDHKBYqJfem7IqxkIj9hSnIZFnUxp6+VfBhXdWHGn+GDTQa1iDvfpy/h6Gr4NL+p/EoA17qtUqOlYxJ1Dkbaw3SqUtkbuv2G"; |
| | | |
| | | private final String provider = "i-go-odrd-testing"; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取jwt token |
| | | * @param type 0=服务端,1=乘客,2=司机 |
| | | * @return |
| | | */ |
| | | public Map<String, Object> fleetEngineAuth(int type, Integer id){ |
| | | try { |
| | | //谷歌云服务器使用这部分代码 |
| | | // AuthTokenMinter minter = AuthTokenMinter.builder() |
| | | // //服务端签名 |
| | | // .setServerSigner(DefaultServiceAccountSigner.create()) |
| | | // //司机端签名 |
| | | // .setDriverSigner(ImpersonatedSigner.create(SERVICE_ACCOUNT)) |
| | | // //乘客端签名 |
| | | // .setConsumerSigner(ImpersonatedSigner.create(SERVICE_ACCOUNT)) |
| | | // .build(); |
| | | AuthTokenMinter minter = AuthTokenMinter.builder() |
| | | //服务端签名 |
| | | .setServerSigner(LocalSigner.create(SERVICE_ACCOUNT, privateKeyId, privateKey)) |
| | | //司机端签名 |
| | | .setDriverSigner(LocalSigner.create(SERVICE_ACCOUNT, privateKeyId, privateKey)) |
| | | //乘客端签名 |
| | | .setConsumerSigner(LocalSigner.create(SERVICE_ACCOUNT, privateKeyId, privateKey)) |
| | | .build(); |
| | | |
| | | String jwt = ""; |
| | | Long expirationTimestamp = 0L; |
| | | if(0 == type){ |
| | | FleetEngineToken serverToken = minter.getServerToken(); |
| | | jwt = serverToken.jwt(); |
| | | expirationTimestamp = serverToken.expirationTimestamp().getTime(); |
| | | } |
| | | if(1 == type){ |
| | | FleetEngineToken consumerToken = minter.getConsumerToken(TripClaims.create("I-GO-USER" + id)); |
| | | jwt = consumerToken.jwt(); |
| | | expirationTimestamp = consumerToken.expirationTimestamp().getTime(); |
| | | } |
| | | if(2 == type){ |
| | | FleetEngineToken driverToken = minter.getDriverToken(VehicleClaims.create("I-GO-CAR" + id)); |
| | | jwt = driverToken.jwt(); |
| | | expirationTimestamp = driverToken.expirationTimestamp().getTime(); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("token", jwt); |
| | | map.put("expirationTimestamp", expirationTimestamp); |
| | | return map; |
| | | } catch (SigningTokenException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public String getToken(){ |
| | | String token_json = redisUtil.getValue("google_token"); |
| | | String google_token = ""; |
| | | if(!StringUtils.hasLength(token_json)){ |
| | | Map<String, Object> map = fleetEngineAuth(0, null); |
| | | redisUtil.setStrValue("google_token", JSON.toJSONString(map)); |
| | | google_token = map.get("token").toString(); |
| | | }else{ |
| | | JSONObject jsonObject1 = JSON.parseObject(token_json); |
| | | Long expirationTimestamp = jsonObject1.getLong("expirationTimestamp"); |
| | | google_token = jsonObject1.getString("token"); |
| | | if((expirationTimestamp - 10000L) <= System.currentTimeMillis()){ |
| | | Map<String, Object> map = fleetEngineAuth(0, null); |
| | | redisUtil.setStrValue("google_token", JSON.toJSONString(map)); |
| | | google_token = map.get("token").toString(); |
| | | } |
| | | } |
| | | return google_token; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加车辆 |
| | | * @param maximumCapacity 这辆车可以搭载的乘客总数 |
| | | * @param licensePlate 车牌号 |
| | | * @param id 车辆id |
| | | */ |
| | | public String createVehicles(int maximumCapacity, String licensePlate, String id) throws Exception{ |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/vehicles?vehicleId=" + id; |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | post.addHeaders(headers); |
| | | |
| | | JSONObject body = new JSONObject(); |
| | | body.put("vehicleState", "OFFLINE"); |
| | | body.put("supportedTripTypes", Arrays.asList("SHARED", "EXCLUSIVE")); |
| | | body.put("maximumCapacity", maximumCapacity); |
| | | |
| | | JSONObject category = new JSONObject(); |
| | | category.put("category", "TAXI"); |
| | | body.put("vehicleType", category); |
| | | JSONObject licensePlate1 = new JSONObject(); |
| | | licensePlate1.put("countryCode", "GH"); |
| | | licensePlate1.put("lastCharacter", getLastNumber(licensePlate)); |
| | | body.put("licensePlate", licensePlate1); |
| | | logger.info("创建车辆请求:{}", body.toJSONString()); |
| | | HttpRequest request = post.body(body.toJSONString()); |
| | | HttpResponse response = request.execute(); |
| | | logger.info("创建车辆结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return createVehicles(maximumCapacity, licensePlate, id); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/vehicles/I-GO-CAR1", |
| | | * "vehicleState": "OFFLINE", |
| | | * "supportedTripTypes": [ |
| | | * "EXCLUSIVE", |
| | | * "SHARED" |
| | | * ], |
| | | * "maximumCapacity": 4, |
| | | * "vehicleType": { |
| | | * "category": "AUTO" |
| | | * }, |
| | | * "licensePlate": { |
| | | * "countryCode": "GH", |
| | | * "lastCharacter": "3" |
| | | * }, |
| | | * "currentRouteSegmentVersion": "2024-05-23T03:05:23.293329Z", |
| | | * "waypointsVersion": "2024-05-23T03:05:23.293329Z" |
| | | * } |
| | | */ |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改车辆信息 |
| | | * @param maximumCapacity |
| | | * @param licensePlate |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public String updateVehicles(String vehicleState, Integer maximumCapacity, String licensePlate, String id) throws Exception{ |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/vehicles/" + id + "?updateMask="; |
| | | List<String> sb = new ArrayList<>(); |
| | | if(StringUtils.hasLength(vehicleState)){ |
| | | sb.add("vehicleState"); |
| | | } |
| | | if(null != maximumCapacity){ |
| | | sb.add("maximumCapacity"); |
| | | } |
| | | if(StringUtils.hasLength(licensePlate)){ |
| | | sb.add("licensePlate"); |
| | | } |
| | | String collect = sb.stream().collect(Collectors.joining(",")); |
| | | url += collect; |
| | | |
| | | HttpRequest put = HttpUtil.createRequest(Method.PUT, url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | put.addHeaders(headers); |
| | | |
| | | JSONObject body = new JSONObject(); |
| | | /** |
| | | * UNKNOWN_VEHICLE_STATE 默认,用于未指定或无法识别的车辆状态。 |
| | | * OFFLINE 车辆不接受新行程。注意:在完成分配给车辆的行程时,车辆仍可继续在此状态下运行。 |
| | | * ONLINE 车辆正在接受新行程。 |
| | | */ |
| | | if(StringUtils.hasLength(vehicleState)){ |
| | | body.put("vehicleState", vehicleState); |
| | | } |
| | | if(null != maximumCapacity){ |
| | | body.put("maximumCapacity", maximumCapacity); |
| | | } |
| | | if(StringUtils.hasLength(licensePlate)){ |
| | | JSONObject licensePlate1 = new JSONObject(); |
| | | licensePlate1.put("countryCode", "GH"); |
| | | licensePlate1.put("lastCharacter", getLastNumber(licensePlate)); |
| | | body.put("licensePlate", licensePlate1); |
| | | } |
| | | body.put("supportedTripTypes", Arrays.asList("SHARED", "EXCLUSIVE")); |
| | | |
| | | JSONObject category = new JSONObject(); |
| | | category.put("category", "TAXI"); |
| | | body.put("vehicleType", category); |
| | | put.body(body.toJSONString()); |
| | | logger.info("修改车辆信息请求:{}", body.toJSONString()); |
| | | HttpResponse response = put.execute(); |
| | | logger.info("修改车辆信息结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return updateVehicles(vehicleState, maximumCapacity, licensePlate, id); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/vehicles/I-GO-CAR1", |
| | | * "vehicleState": "OFFLINE", |
| | | * "supportedTripTypes": [ |
| | | * "EXCLUSIVE", |
| | | * "SHARED" |
| | | * ], |
| | | * "maximumCapacity": 4, |
| | | * "vehicleType": { |
| | | * "category": "TAXI" |
| | | * }, |
| | | * "licensePlate": { |
| | | * "countryCode": "GH", |
| | | * "lastCharacter": "5" |
| | | * }, |
| | | * "currentRouteSegmentVersion": "2024-05-23T06:08:14.968942Z", |
| | | * "waypointsVersion": "2024-05-23T03:05:23.293329Z" |
| | | * } |
| | | */ |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取车辆信息 |
| | | * @param id 车辆id |
| | | * @return |
| | | */ |
| | | public String getVehicles(String id) throws Exception{ |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/vehicles/" + (null != id ? id : ""); |
| | | HttpRequest get = HttpUtil.createGet(url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | get.addHeaders(headers); |
| | | |
| | | HttpResponse response = get.execute(); |
| | | logger.info("查询车辆结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 404){ |
| | | return ""; |
| | | } |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return getVehicles(id); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "vehicles": [ |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/vehicles/I-GO-CAR1", |
| | | * "vehicleState": "OFFLINE", |
| | | * "supportedTripTypes": [ |
| | | * "EXCLUSIVE", |
| | | * "SHARED" |
| | | * ], |
| | | * "maximumCapacity": 4, |
| | | * "vehicleType": { |
| | | * "category": "AUTO" |
| | | * }, |
| | | * "licensePlate": { |
| | | * "countryCode": "GH", |
| | | * "lastCharacter": "3" |
| | | * }, |
| | | * "currentRouteSegmentVersion": "2024-05-23T03:05:23.293329Z", |
| | | * "waypointsVersion": "2024-05-23T03:05:23.293329Z" |
| | | * } |
| | | * ], |
| | | * "totalSize": "1" |
| | | * } |
| | | * |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/vehicles/I-GO-CAR1", |
| | | * "vehicleState": "OFFLINE", |
| | | * "supportedTripTypes": [ |
| | | * "EXCLUSIVE", |
| | | * "SHARED" |
| | | * ], |
| | | * "maximumCapacity": 4, |
| | | * "vehicleType": { |
| | | * "category": "TAXI" |
| | | * }, |
| | | * "licensePlate": { |
| | | * "countryCode": "GH", |
| | | * "lastCharacter": "5" |
| | | * }, |
| | | * "currentRouteSegmentVersion": "2024-05-23T06:08:14.968942Z", |
| | | * "waypointsVersion": "2024-05-23T03:05:23.293329Z" |
| | | * } |
| | | */ |
| | | |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取最后一个数字 |
| | | * @param str |
| | | * @return |
| | | */ |
| | | private String getLastNumber(String str){ |
| | | for (int i = str.length(); i > 0; i--) { |
| | | char c = str.charAt(i - 1); |
| | | if(String.valueOf(c).matches("\\d")){ |
| | | return str.substring(i - 1, i); |
| | | } |
| | | } |
| | | return "-1"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建新的行程 |
| | | * @param vehicleId 车辆id |
| | | * @param numberOfPassengers 人数 |
| | | * @param tripId 订单id |
| | | * @param start_lat 起点纬度 |
| | | * @param start_lng 起点经度 |
| | | * @param end_lat 终点纬度 |
| | | * @param end_lng 终点经度 |
| | | * @return |
| | | */ |
| | | public String createTrip(String vehicleId, Integer numberOfPassengers, String tripId, String start_lat, String start_lng, String end_lat, String end_lng) throws Exception{ |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/trips?tripId=" + tripId; |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | post.addHeaders(headers); |
| | | |
| | | JSONObject body = new JSONObject(); |
| | | if(StringUtils.hasLength(vehicleId)){ |
| | | body.put("vehicleId", vehicleId); |
| | | } |
| | | body.put("tripStatus", "NEW"); |
| | | body.put("tripType", "SHARED"); |
| | | body.put("numberOfPassengers", numberOfPassengers); |
| | | |
| | | JSONObject pickupPoint = new JSONObject(); |
| | | JSONObject point = new JSONObject(); |
| | | point.put("latitude", start_lat); |
| | | point.put("longitude", start_lng); |
| | | pickupPoint.put("point", point); |
| | | body.put("pickupPoint", pickupPoint); |
| | | |
| | | JSONObject dropoffPoint = new JSONObject(); |
| | | JSONObject end_point = new JSONObject(); |
| | | end_point.put("latitude", end_lat); |
| | | end_point.put("longitude", end_lng); |
| | | dropoffPoint.put("point", end_point); |
| | | body.put("dropoffPoint", dropoffPoint); |
| | | logger.info("创建行程请求:{}", body.toJSONString()); |
| | | HttpRequest request = post.body(body.toJSONString()); |
| | | HttpResponse response = request.execute(); |
| | | logger.info("创建行程结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return createTrip(vehicleId, numberOfPassengers, tripId, start_lat, start_lng, end_lat, end_lng); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/trips/I-GO-RIDE1", |
| | | * "vehicleId": "I-GO-CAR1", |
| | | * "tripStatus": "NEW", |
| | | * "tripType": "SHARED", |
| | | * "pickupPoint": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * }* }, |
| | | * "pickupTime": "2024-05-27T02:05:37.935052Z", |
| | | * "dropoffPoint": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "dropoffTime": "2024-05-27T02:18:35.934167Z", |
| | | * "numberOfPassengers": 1, |
| | | * "remainingDistanceMeters": 0, |
| | | * "etaToFirstWaypoint": "2024-05-27T02:05:37.935052Z", |
| | | * "remainingWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "distanceMeters": 0, |
| | | * "eta": "2024-05-27T02:05:37.935052Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:18:35.934167Z", |
| | | * "duration": "777.999115s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "currentRouteSegmentVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "remainingWaypointsVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "vehicleWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "distanceMeters": 0, |
| | | * "eta": "2024-05-27T02:05:37.935052Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:18:35.934167Z", |
| | | * "duration": "777.999115s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "currentRouteSegmentEndPoint": { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE" |
| | | * }, |
| | | * "remainingWaypointsRouteVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "currentRouteSegmentTrafficVersion": "2024-05-27T02:05:37.941167Z" |
| | | * } |
| | | */ |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改行程 |
| | | * @param tripStatus 行程状态 |
| | | * @param vehicleId 车辆id |
| | | * @param numberOfPassengers 人数 |
| | | * @param tripId 订单id |
| | | * @param start_lat 起点纬度 |
| | | * @param start_lng 起点经度 |
| | | * @param end_lat 终点纬度 |
| | | * @param end_lng 终点经度 |
| | | * @return |
| | | */ |
| | | public String updateTrip(String tripStatus, String vehicleId, Integer numberOfPassengers, String tripId, String start_lat, String start_lng, String end_lat, String end_lng) throws Exception { |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/trips/" + tripId + "?updateMask="; |
| | | List<String> sb = new ArrayList<>(); |
| | | if(StringUtils.hasLength(vehicleId)){ |
| | | sb.add("vehicleId"); |
| | | } |
| | | if(StringUtils.hasLength(tripStatus)){ |
| | | sb.add("tripStatus"); |
| | | } |
| | | if(null != numberOfPassengers){ |
| | | sb.add("numberOfPassengers"); |
| | | } |
| | | if(StringUtils.hasLength(start_lat) && StringUtils.hasLength(start_lng)){ |
| | | sb.add("pickupPoint"); |
| | | } |
| | | |
| | | if(StringUtils.hasLength(end_lat) && StringUtils.hasLength(end_lng)){ |
| | | sb.add("dropoffPoint"); |
| | | } |
| | | String collect = sb.stream().collect(Collectors.joining(",")); |
| | | url += collect; |
| | | |
| | | HttpRequest put = HttpUtil.createRequest(Method.PUT, url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | put.addHeaders(headers); |
| | | |
| | | JSONObject body = new JSONObject(); |
| | | if(StringUtils.hasLength(vehicleId)){ |
| | | body.put("vehicleId", vehicleId); |
| | | } |
| | | /** |
| | | * UNKNOWN_TRIP_STATUS 默认,用于未指定或无法识别的行程状态。 |
| | | * NEW 新建行程。 |
| | | * ENROUTE_TO_PICKUP 司机正在前往上车点。 |
| | | * ARRIVED_AT_PICKUP 司机已到达上车点。 |
| | | * ARRIVED_AT_INTERMEDIATE_DESTINATION 司机已到达中转目的地,正在等待乘客。 |
| | | * ENROUTE_TO_INTERMEDIATE_DESTINATION 司机正在前往中间目的地(而非下车点)。 |
| | | * ENROUTE_TO_DROPOFF 司机已接起乘客,正在前往下一个目的地。 |
| | | * COMPLETE 乘客已下车,行程已完成。 |
| | | * CANCELED 在司机、乘客或拼车服务提供商取车之前,行程被取消。 |
| | | */ |
| | | if(StringUtils.hasLength(tripStatus)){ |
| | | body.put("tripStatus", tripStatus); |
| | | } |
| | | if(null != numberOfPassengers){ |
| | | body.put("numberOfPassengers", numberOfPassengers); |
| | | } |
| | | if(StringUtils.hasLength(start_lat) && StringUtils.hasLength(start_lng)){ |
| | | JSONObject pickupPoint = new JSONObject(); |
| | | JSONObject point = new JSONObject(); |
| | | point.put("latitude", start_lat); |
| | | point.put("longitude", start_lng); |
| | | pickupPoint.put("point", point); |
| | | body.put("pickupPoint", pickupPoint); |
| | | } |
| | | |
| | | if(StringUtils.hasLength(end_lat) && StringUtils.hasLength(end_lng)){ |
| | | JSONObject dropoffPoint = new JSONObject(); |
| | | JSONObject end_point = new JSONObject(); |
| | | end_point.put("latitude", end_lat); |
| | | end_point.put("longitude", end_lng); |
| | | dropoffPoint.put("point", end_point); |
| | | body.put("dropoffPoint", dropoffPoint); |
| | | } |
| | | logger.info("修改行程请求:{}", body.toJSONString()); |
| | | HttpRequest request = put.body(body.toJSONString()); |
| | | HttpResponse response = request.execute(); |
| | | logger.info("修改行程结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return updateTrip(tripStatus, vehicleId, numberOfPassengers, tripId, start_lat, start_lng, end_lat, end_lng); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/trips/I-GO-RIDE1", |
| | | * "vehicleId": "I-GO-CAR1", |
| | | * "tripStatus": "ENROUTE_TO_PICKUP", |
| | | * "tripType": "SHARED", |
| | | * "pickupPoint": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * }* }, |
| | | * "pickupTime": "2024-05-27T02:07:38.562717Z", |
| | | * "dropoffPoint": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "dropoffTime": "2024-05-27T02:20:36.562375Z", |
| | | * "numberOfPassengers": 1, |
| | | * "remainingWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "eta": "2024-05-27T02:07:38.562717Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:20:36.562375Z", |
| | | * "duration": "777.999658s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "remainingWaypointsVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "vehicleWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "eta": "2024-05-27T02:07:38.562717Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:20:36.562375Z", |
| | | * "duration": "777.999658s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "remainingWaypointsRouteVersion": "2024-05-27T02:07:38.570569Z" |
| | | * } |
| | | * |
| | | * 取消订单后返回的结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/trips/I-GO-RIDE1", |
| | | * "tripStatus": "CANCELED", |
| | | * "tripType": "SHARED", |
| | | * "pickupPoint": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * }* }, |
| | | * "dropoffPoint": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "numberOfPassengers": 1 |
| | | * } |
| | | */ |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取行程信息 |
| | | * @param tripId 订单id |
| | | * @return |
| | | */ |
| | | public String getTrip(String tripId) throws Exception { |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/trips/" + tripId; |
| | | HttpRequest get = HttpUtil.createGet(url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | get.addHeaders(headers); |
| | | |
| | | HttpResponse response = get.execute(); |
| | | logger.info("查询行程结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 404){ |
| | | return ""; |
| | | } |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return getTrip(tripId); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/trips/I-GO-RIDE1", |
| | | * "vehicleId": "I-GO-CAR1", |
| | | * "tripStatus": "ENROUTE_TO_PICKUP", |
| | | * "tripType": "SHARED", |
| | | * "pickupPoint": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * }* }, |
| | | * "pickupTime": "2024-05-27T02:10:39.763347Z", |
| | | * "dropoffPoint": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "dropoffTime": "2024-05-27T02:23:37.762549Z", |
| | | * "numberOfPassengers": 1, |
| | | * "remainingDistanceMeters": 0, |
| | | * "etaToFirstWaypoint": "2024-05-27T02:10:39.763347Z", |
| | | * "remainingWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "distanceMeters": 0, |
| | | * "eta": "2024-05-27T02:10:39.763347Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:23:37.762549Z", |
| | | * "duration": "777.999202s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "currentRouteSegmentVersion": "2024-05-27T02:10:39.773373Z", |
| | | * "remainingWaypointsVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "currentRouteSegmentEndPoint": { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE" |
| | | * }, |
| | | * "remainingWaypointsRouteVersion": "2024-05-27T02:10:39.773373Z", |
| | | * "currentRouteSegmentTrafficVersion": "2024-05-27T02:10:39.773373Z", |
| | | * "view": "SDK" |
| | | * } |
| | | */ |
| | | |
| | | return response.body(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | public class GoogleMapUtil { |
| | | |
| | | private final static String key = "AIzaSyA_FEliOkbkL1IAHQsnBpbpo9MlIp729H0"; |
| | | private final static String key = "AIzaSyCG6PsfkaCEc94VK2vIAZk1YYKvOS_Ewts"; |
| | | |
| | | |
| | | /** |
| | |
| | | private IOrderTaxiService orderTaxiService; |
| | | |
| | | @Autowired |
| | | private GDMapElectricFenceUtil gdMapElectricFenceUtil; |
| | | |
| | | @Autowired |
| | | private IOrderPrivateCarService orderPrivateCarService; |
| | | |
| | | @Autowired |
| | |
| | | * @param id |
| | | * @param type |
| | | */ |
| | | public void pushOffline(Integer id, Integer type){ |
| | | public void pushOffline(Integer id, Integer type, Object object){ |
| | | JSONObject msg = new JSONObject(); |
| | | msg.put("code", 200); |
| | | msg.put("msg", "SUCCESS"); |
| | | msg.put("method", "OFFLINE"); |
| | | msg.put("data", new Object()); |
| | | msg.put("data", object); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | |
| | | * @param orderId |
| | | * @param orderType |
| | | * @param money |
| | | * @param status 1=申请,2=同意,3=拒绝 |
| | | */ |
| | | public void pushPayDifference(Integer type, Integer uid, Integer orderId, Integer orderType, Double money){ |
| | | public void pushPayDifference(Integer type, Integer uid, Integer orderId, Integer orderType, Double money, Integer status){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | |
| | | map.put("orderId", orderId); |
| | | map.put("orderType", orderType); |
| | | map.put("money", money); |
| | | map.put("status", status); |
| | | jsonObject.put("data", map); |
| | | |
| | | //调用推送 |
| | |
| | | pushMap.remove(orderId + "_" + orderType); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改目的地推送通知 |
| | | * @param type |
| | | * @param uid |
| | | * @param orderId |
| | | * @param orderType |
| | | * @param status 1=申请,2=同意,3=拒绝 |
| | | */ |
| | | public void pushModifyAddress(Integer type, Integer uid, Integer orderId, Integer orderType, Integer status){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | | jsonObject.put("method", "MODIFY_ADDRESS"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("orderId", orderId); |
| | | map.put("orderType", orderType); |
| | | map.put("status", status); |
| | | jsonObject.put("data", map); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", jsonObject.toJSONString()); |
| | | params.add("id", String.valueOf(uid)); |
| | | params.add("type", String.valueOf(type)); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 司机超时推送 |
| | | * @param type |
| | | * @param uid |
| | | * @param orderId |
| | | * @param orderType |
| | | * @param describe |
| | | */ |
| | | public void pushOrderTimeOut(Integer type, Integer uid, Integer orderId, Integer orderType, String describe){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | | jsonObject.put("method", "ORDER_TIME_OUT"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("orderId", orderId); |
| | | map.put("orderType", orderType); |
| | | map.put("describe", describe); |
| | | jsonObject.put("data", map); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", jsonObject.toJSONString()); |
| | | params.add("id", String.valueOf(uid)); |
| | | params.add("type", String.valueOf(type)); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.util; |
| | | |
| | | import com.stylefeng.guns.modular.system.service.IDriverOnlineService; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.service.IOrderService; |
| | | import com.stylefeng.guns.modular.system.service.ISettlementRecordService; |
| | |
| | | |
| | | public Set<Integer> driverIds = new HashSet<>();//存储需要提醒司机预约单的司机id |
| | | |
| | | @Autowired |
| | | private IDriverOnlineService driverOnlineService; |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MMM-dd"); |
| | |
| | | driverService.taskMinute(); |
| | | //处于预约单 |
| | | orderService.reservationOrder(); |
| | | // //处理车载端断电后的自动下班 |
| | | // driverService.taskOffWork(); |
| | | //处理结束订单后30分钟解绑小号功能 |
| | | orderService.taskMidAxbUnBindSend(); |
| | | //处理司机连续不接单的情况 |
| | | driverOnlineService.deductionDuration(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.quartz; |
| | | |
| | | import com.stylefeng.guns.modular.system.util.quartz.model.QuartzEnum; |
| | | import com.stylefeng.guns.modular.system.util.quartz.model.QuartzJob; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.quartz.*; |
| | | import org.quartz.impl.matchers.GroupMatcher; |
| | | |
| | | import java.io.InputStream; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * quartz任务调度工具类 |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/20 11:12 |
| | | */ |
| | | @Slf4j |
| | | public class QuartzUtil { |
| | | /** |
| | | * 构建调度器 |
| | | */ |
| | | public static Scheduler scheduler; |
| | | |
| | | |
| | | /** |
| | | * 启动调度器 |
| | | * @param propertiesStream 配置文件流 |
| | | * @return |
| | | */ |
| | | public static void start(InputStream propertiesStream) throws SchedulerException { |
| | | if(null == scheduler){ |
| | | scheduler = SchedulerUtil.getScheduler(propertiesStream); |
| | | } |
| | | scheduler.start(); |
| | | log.info(QuartzEnum.SCHEDULER_START_SUCCESS.getValue()); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加普通定时任务 |
| | | * @param quartzJob 任务类 |
| | | * @param startTime 任务开始执行时间,为空则立即执行 |
| | | * @param intervalInMilliseconds 执行间隔毫秒数 |
| | | * @param repeatCount 重复执行次数,-1表示永远执行 |
| | | * @throws SchedulerException |
| | | */ |
| | | public static void addSimpleQuartzTask(QuartzJob quartzJob, Date startTime, long intervalInMilliseconds, int repeatCount) throws SchedulerException { |
| | | if(null == scheduler){ |
| | | log.error("请先加载任务调取器"); |
| | | return; |
| | | } |
| | | JobDetail jobDetail = getJobDetail(quartzJob); |
| | | Trigger simpleTrigger = getSimpleTrigger(quartzJob, startTime, intervalInMilliseconds, repeatCount); |
| | | scheduler.scheduleJob(jobDetail, simpleTrigger); |
| | | log.info(QuartzEnum.ADD_SIMPLE_TRIGGER_SUCCESS.getValue()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加Cron表达式的定时任务 |
| | | * @param quartzJob 任务类 |
| | | * @param cron cron表达式 |
| | | * @throws SchedulerException |
| | | */ |
| | | public static void addCronQuartzTask(QuartzJob quartzJob, String cron) throws SchedulerException { |
| | | if(null == scheduler){ |
| | | log.error("请先加载任务调取器"); |
| | | return; |
| | | } |
| | | JobDetail jobDetail = getJobDetail(quartzJob); |
| | | Trigger cronTrigger = getCronTrigger(quartzJob, cron); |
| | | scheduler.scheduleJob(jobDetail, cronTrigger); |
| | | log.info(QuartzEnum.ADD_CRON_TRIGGER_SUCCESS.getValue()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除任务 |
| | | * @param name 任务名称 |
| | | * @param group 任务分组 |
| | | * @return |
| | | */ |
| | | public static boolean deleteQuartzTask(String name, String group){ |
| | | JobKey jobKey = new JobKey(name, group); |
| | | boolean b = false; |
| | | try { |
| | | b = scheduler.deleteJob(jobKey); |
| | | } catch (SchedulerException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return b; |
| | | } |
| | | |
| | | /** |
| | | * 删除任务 |
| | | * @param jobKey |
| | | * @return |
| | | */ |
| | | public static boolean deleteQuartzTask(JobKey jobKey){ |
| | | boolean b = false; |
| | | try { |
| | | b = scheduler.deleteJob(jobKey); |
| | | } catch (SchedulerException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return b; |
| | | } |
| | | |
| | | /** |
| | | * 删除分组下的所有定时任务 |
| | | * @param group 分组名称 |
| | | * @return |
| | | */ |
| | | public static boolean deleteGroupQuartzTask(String group){ |
| | | try { |
| | | GroupMatcher<JobKey> groupMatcher = GroupMatcher.groupEquals(group); |
| | | Set<JobKey> jobKeys = scheduler.getJobKeys(groupMatcher); |
| | | boolean b = scheduler.deleteJobs(jobKeys.stream().collect(Collectors.toList())); |
| | | if(!b){ |
| | | return false; |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 清空所有定时任务 |
| | | * @return |
| | | */ |
| | | public static boolean deleteAllQuartzTask(){ |
| | | try { |
| | | List<String> jobGroupNames = scheduler.getJobGroupNames(); |
| | | for (String jobGroupName : jobGroupNames) { |
| | | GroupMatcher<JobKey> groupMatcher = GroupMatcher.groupEquals(jobGroupName); |
| | | Set<JobKey> jobKeys = scheduler.getJobKeys(groupMatcher); |
| | | boolean b = scheduler.deleteJobs(jobKeys.stream().collect(Collectors.toList())); |
| | | if(!b){ |
| | | return false; |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 构建任务描述JobDetail对象 |
| | | * @param quartzJob 任务对象 |
| | | * @return |
| | | */ |
| | | private static JobDetail getJobDetail(QuartzJob quartzJob){ |
| | | String name = quartzJob.getName(); |
| | | String group = quartzJob.getGroup(); |
| | | if(null == name || "".equals(name)){ |
| | | name = QuartzEnum.JOB_NAME.getValue(); |
| | | } |
| | | if(null == group || "".equals(group)){ |
| | | group = QuartzEnum.DEFAULT_GROUP.getValue(); |
| | | } |
| | | return getJobDetail(quartzJob, name, group, quartzJob.getJobDataMap()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 构建任务描述JobDetail对象 |
| | | * @param job 任务类 |
| | | * @param job_name 任务名称 |
| | | * @param group_name 任务分组名称 |
| | | * @param jobDataMap 自定义参数 |
| | | * @return |
| | | */ |
| | | private static JobDetail getJobDetail(Job job, String job_name, String group_name, JobDataMap jobDataMap){ |
| | | JobDetail jobDetail = JobBuilder.newJob(job.getClass()) |
| | | .withIdentity(job_name, group_name) |
| | | .usingJobData(jobDataMap) |
| | | .build(); |
| | | return jobDetail; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 构建Trigger执行器 |
| | | * @param quartzJob 任务类 |
| | | * @param startTime 任务开始执行时间,为空则立即执行 |
| | | * @param intervalInMilliseconds 执行间隔毫秒数 |
| | | * @param repeatCount 重读执行次数,-1表示永远执行 |
| | | * @return |
| | | */ |
| | | private static Trigger getSimpleTrigger(QuartzJob quartzJob, Date startTime, long intervalInMilliseconds, int repeatCount){ |
| | | String name = quartzJob.getName(); |
| | | String group = quartzJob.getGroup(); |
| | | if(null == name || "".equals(name)){ |
| | | name = QuartzEnum.JOB_NAME.getValue(); |
| | | } |
| | | if(null == group || "".equals(group)){ |
| | | group = QuartzEnum.DEFAULT_GROUP.getValue(); |
| | | } |
| | | TriggerBuilder<Trigger> triggerTriggerBuilder = TriggerBuilder.newTrigger(); |
| | | if(null == startTime){ |
| | | triggerTriggerBuilder.startNow(); |
| | | }else{ |
| | | triggerTriggerBuilder.startAt(startTime); |
| | | } |
| | | |
| | | SimpleTrigger trigger = triggerTriggerBuilder |
| | | .withIdentity(name, group) |
| | | .withSchedule( |
| | | SimpleScheduleBuilder |
| | | .simpleSchedule() |
| | | .withIntervalInMilliseconds(intervalInMilliseconds) |
| | | .withRepeatCount(repeatCount) |
| | | ).build(); |
| | | return trigger; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 构建cronExpression表达式执行器 |
| | | * @param quartzJob 任务类 |
| | | * @param cron cron表达式 |
| | | * @return |
| | | */ |
| | | private static Trigger getCronTrigger(QuartzJob quartzJob, String cron) { |
| | | String name = quartzJob.getName(); |
| | | String group = quartzJob.getGroup(); |
| | | if(null == name || "".equals(name)){ |
| | | name = QuartzEnum.JOB_NAME.getValue(); |
| | | } |
| | | if(null == group || "".equals(group)){ |
| | | group = QuartzEnum.DEFAULT_GROUP.getValue(); |
| | | } |
| | | CronTrigger trigger = TriggerBuilder.newTrigger() |
| | | .startNow() |
| | | .withIdentity(name, group) |
| | | .withSchedule( |
| | | CronScheduleBuilder.cronSchedule(cron) |
| | | ).build(); |
| | | return trigger; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.quartz; |
| | | |
| | | import org.quartz.Scheduler; |
| | | import org.quartz.impl.StdSchedulerFactory; |
| | | |
| | | import java.io.InputStream; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/20 10:56 |
| | | */ |
| | | public class SchedulerUtil { |
| | | |
| | | |
| | | /** |
| | | * 获取调度器 |
| | | * 加载自定义配置文件 |
| | | * @param propertiesStream 配置文件流 |
| | | * @return |
| | | */ |
| | | public static Scheduler getScheduler(InputStream propertiesStream) { |
| | | try { |
| | | StdSchedulerFactory stdSchedulerFactory = new StdSchedulerFactory(); |
| | | if(null == propertiesStream){ |
| | | stdSchedulerFactory.initialize("quartz.properties"); |
| | | }else{ |
| | | stdSchedulerFactory.initialize(propertiesStream); |
| | | } |
| | | return stdSchedulerFactory.getScheduler(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.quartz.jobs; |
| | | |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.util.PushUtil; |
| | | import com.stylefeng.guns.modular.system.util.quartz.QuartzUtil; |
| | | import com.stylefeng.guns.modular.system.util.quartz.model.QuartzJob; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobDetail; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobKey; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 订单司机超时提醒任务 |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/18 15:19 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class OrderTimeOutJob extends QuartzJob { |
| | | |
| | | @Resource |
| | | private PushUtil pushUtil; |
| | | @Resource |
| | | private IOrderPrivateCarService orderPrivateCarService; |
| | | @Resource |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public QuartzJob buildQuartzJob() { |
| | | return super.buildQuartzJob(); |
| | | } |
| | | |
| | | @Override |
| | | public QuartzJob buildQuartzJob(String name) { |
| | | return super.buildQuartzJob(name); |
| | | } |
| | | |
| | | @Override |
| | | public QuartzJob buildQuartzJob(String name, String group) { |
| | | return super.buildQuartzJob(name, group); |
| | | } |
| | | |
| | | @Override |
| | | public QuartzJob buildQuartzJob(String name, String group, JobDataMap jobDataMap) { |
| | | return super.buildQuartzJob(name, group, jobDataMap); |
| | | } |
| | | |
| | | /** |
| | | * 执行的业务逻辑 |
| | | * @param jobExecutionContext 定时任务上下文对象 |
| | | */ |
| | | @Override |
| | | public void run(JobExecutionContext jobExecutionContext) { |
| | | JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap(); |
| | | Integer driverId = jobDataMap.getIntegerFromString("driverId"); |
| | | Integer orderId = jobDataMap.getIntegerFromString("orderId"); |
| | | Integer orderType = jobDataMap.getIntegerFromString("orderType"); |
| | | String describe = jobDataMap.getString("describe"); |
| | | if(1 == orderType){ |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | if(2 != orderPrivateCar.getState()){ |
| | | JobKey key = jobExecutionContext.getJobDetail().getKey(); |
| | | boolean b = QuartzUtil.deleteQuartzTask(key); |
| | | if(!b){ |
| | | log.error("定时任务关闭失败:" + key.toString()); |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | if(4 == orderType){ |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | if(2 != orderLogistics.getState()){ |
| | | JobKey key = jobExecutionContext.getJobDetail().getKey(); |
| | | boolean b = QuartzUtil.deleteQuartzTask(key); |
| | | if(!b){ |
| | | log.error("定时任务关闭失败:" + key.toString()); |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | pushUtil.pushOrderTimeOut(2, driverId, orderId, orderType, describe); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 初始化任务对象 |
| | | * @return |
| | | */ |
| | | public static QuartzJob init(){ |
| | | return new OrderTimeOutJob().buildQuartzJob(); |
| | | } |
| | | |
| | | /** |
| | | * 初始化任务对象 |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public static QuartzJob init(String name){ |
| | | return new OrderTimeOutJob().buildQuartzJob(name); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 初始化任务对象 |
| | | * @param name |
| | | * @param group |
| | | * @return |
| | | */ |
| | | public static QuartzJob init(String name, String group){ |
| | | return new OrderTimeOutJob().buildQuartzJob(name, group); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 初始化任务对象 |
| | | * @param name |
| | | * @param group |
| | | * @return |
| | | */ |
| | | public static QuartzJob init(String name, String group, JobDataMap jobDataMap){ |
| | | return new OrderTimeOutJob().buildQuartzJob(name, group, jobDataMap); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.quartz.model; |
| | | |
| | | /** |
| | | * |
| | | * quartz枚举常量 |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/20 11:20 |
| | | */ |
| | | public enum QuartzEnum { |
| | | /** |
| | | * 任务名称 |
| | | */ |
| | | JOB_NAME("quartz_job"), |
| | | /** |
| | | * 任务分组 |
| | | */ |
| | | DEFAULT_GROUP("quartz_group"), |
| | | /** |
| | | * quartz任务调度器启动成功 |
| | | */ |
| | | SCHEDULER_START_SUCCESS("Quartz Scheduler start success!"), |
| | | /** |
| | | * 任务添加到调度器成功 |
| | | */ |
| | | ADD_SIMPLE_TRIGGER_SUCCESS("add Quartz SimpleTrigger success!"), |
| | | /** |
| | | * 任务添加到调度器成功 |
| | | */ |
| | | ADD_CRON_TRIGGER_SUCCESS("add Quartz CronTrigger success!") |
| | | ; |
| | | |
| | | |
| | | QuartzEnum(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | private String value; |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | private void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.quartz.model; |
| | | |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import lombok.Data; |
| | | import lombok.Getter; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | |
| | | /** |
| | | * quartz任务类 |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/20 11:14 |
| | | */ |
| | | @Slf4j |
| | | @Data |
| | | public abstract class QuartzJob implements Job { |
| | | /** |
| | | * 任务名称 |
| | | */ |
| | | @Getter |
| | | private String name; |
| | | /** |
| | | * 任务分组 |
| | | */ |
| | | @Getter |
| | | private String group; |
| | | /** |
| | | * 自定义参数 |
| | | */ |
| | | @Getter |
| | | private JobDataMap jobDataMap; |
| | | |
| | | |
| | | /** |
| | | * 构建QuartzJob对象 |
| | | * @return |
| | | */ |
| | | public QuartzJob buildQuartzJob() { |
| | | return buildQuartzJob(QuartzEnum.JOB_NAME.getValue()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 构建QuartzJob对象 |
| | | * @param name 任务名称 |
| | | * @return |
| | | */ |
| | | public QuartzJob buildQuartzJob(String name) { |
| | | return buildQuartzJob(name, QuartzEnum.DEFAULT_GROUP.getValue()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 构建QuartzJob对象 |
| | | * @param name 任务名称 |
| | | * @param group 任务分组名称 |
| | | * @return |
| | | */ |
| | | public QuartzJob buildQuartzJob(String name, String group) { |
| | | return buildQuartzJob(name, QuartzEnum.DEFAULT_GROUP.getValue(), null); |
| | | } |
| | | |
| | | /** |
| | | * 构建QuartzJob对象 |
| | | * @param name 任务名称 |
| | | * @param group 任务分组名称 |
| | | * @param jobDataMap 自定义参数 |
| | | * @return |
| | | */ |
| | | public QuartzJob buildQuartzJob(String name, String group, JobDataMap jobDataMap) { |
| | | if(ToolUtil.isNotEmpty(name)){ |
| | | this.name = name; |
| | | }else{ |
| | | this.name = QuartzEnum.JOB_NAME.getValue(); |
| | | } |
| | | if(ToolUtil.isNotEmpty(group)){ |
| | | this.group = group; |
| | | }else{ |
| | | this.group = QuartzEnum.DEFAULT_GROUP.getValue(); |
| | | } |
| | | this.jobDataMap = jobDataMap; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 需要执行的任务的业务逻辑方法 |
| | | * @param jobExecutionContext 定时任务上下文对象 |
| | | */ |
| | | public abstract void run(JobExecutionContext jobExecutionContext); |
| | | |
| | | /** |
| | | * 执行器执行任务调用的方式 |
| | | * @param jobExecutionContext 定时任务上下文对象 |
| | | * @throws JobExecutionException |
| | | */ |
| | | @Override |
| | | public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { |
| | | String name = jobExecutionContext.getJobDetail().getKey().getName(); |
| | | log.info(name + " scheduled task start!"); |
| | | run(jobExecutionContext); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/6 11:16 |
| | | */ |
| | | @ApiModel |
| | | @Data |
| | | public class BalanceUsageRecord { |
| | | @ApiModelProperty("总金额") |
| | | private Double total; |
| | | @ApiModelProperty("明细列表") |
| | | private List<BalanceUsageRecordList> list; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/6 11:17 |
| | | */ |
| | | @ApiModel |
| | | @Data |
| | | public class BalanceUsageRecordList { |
| | | @ApiModelProperty("日期") |
| | | private String time; |
| | | @ApiModelProperty("金额") |
| | | private Double money; |
| | | @ApiModelProperty("用途") |
| | | private String content; |
| | | |
| | | } |
| | |
| | | private String birthday; |
| | | @ApiModelProperty("居住地") |
| | | private String driverAddress; |
| | | @ApiModelProperty("google车辆id") |
| | | private String vehicleId; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | driverInfoWarpper.setLanguage(null != map.get("language") ? Integer.valueOf(String.valueOf(map.get("language"))) : 2); |
| | | driverInfoWarpper.setBirthday(null != map.get("birthday") ? String.valueOf(map.get("birthday")) : ""); |
| | | driverInfoWarpper.setDriverAddress(null != map.get("driverAddress") ? String.valueOf(map.get("driverAddress")) : ""); |
| | | driverInfoWarpper.setVehicleId(null != map.get("vehicleId") ? String.valueOf(map.get("vehicleId")) : ""); |
| | | } |
| | | return driverInfoWarpper; |
| | | } |
| | | |
| | | |
| | | public String getVehicleId() { |
| | | return vehicleId; |
| | | } |
| | | |
| | | public void setVehicleId(String vehicleId) { |
| | | this.vehicleId = vehicleId; |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty("跳转页面 100000=跳转至【完善个人资料】 200000=跳转至【完善车辆信息】") |
| | | private String jumpCode; |
| | | |
| | | @ApiModelProperty("google车辆id") |
| | | private String vehicleId; |
| | | |
| | | |
| | | public String getJumpCode() { |
| | | return jumpCode; |
| | |
| | | public void setTerminalId(String terminalId) { |
| | | this.terminalId = terminalId; |
| | | } |
| | | |
| | | public String getVehicleId() { |
| | | return vehicleId; |
| | | } |
| | | |
| | | public void setVehicleId(String vehicleId) { |
| | | this.vehicleId = vehicleId; |
| | | } |
| | | } |
| | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 费用明细 |
| | | */ |
| | | @Data |
| | | @ApiModel("费用明细") |
| | | public class MoneyInfoWarpper { |
| | | @ApiModelProperty("订单总金额") |
| | |
| | | private Double discountMoney; |
| | | @ApiModelProperty("折扣") |
| | | private Double discount; |
| | | |
| | | public Double getOrderMoney() { |
| | | return orderMoney; |
| | | } |
| | | |
| | | public void setOrderMoney(Double orderMoney) { |
| | | this.orderMoney = orderMoney; |
| | | } |
| | | |
| | | public Double getStartMoney() { |
| | | return startMoney; |
| | | } |
| | | |
| | | public void setStartMoney(Double startMoney) { |
| | | this.startMoney = startMoney; |
| | | } |
| | | |
| | | public Double getMileageMoney() { |
| | | return mileageMoney; |
| | | } |
| | | |
| | | public void setMileageMoney(Double mileageMoney) { |
| | | this.mileageMoney = mileageMoney; |
| | | } |
| | | |
| | | public Double getDurationMoney() { |
| | | return durationMoney; |
| | | } |
| | | |
| | | public void setDurationMoney(Double durationMoney) { |
| | | this.durationMoney = durationMoney; |
| | | } |
| | | |
| | | public Double getWaitMoney() { |
| | | return waitMoney; |
| | | } |
| | | |
| | | public void setWaitMoney(Double waitMoney) { |
| | | this.waitMoney = waitMoney; |
| | | } |
| | | |
| | | public Double getLongDistanceMoney() { |
| | | return longDistanceMoney; |
| | | } |
| | | |
| | | public void setLongDistanceMoney(Double longDistanceMoney) { |
| | | this.longDistanceMoney = longDistanceMoney; |
| | | } |
| | | |
| | | public Double getParkMoney() { |
| | | return parkMoney; |
| | | } |
| | | |
| | | public void setParkMoney(Double parkMoney) { |
| | | this.parkMoney = parkMoney; |
| | | } |
| | | |
| | | public Double getRoadTollMoney() { |
| | | return roadTollMoney; |
| | | } |
| | | |
| | | public void setRoadTollMoney(Double roadTollMoney) { |
| | | this.roadTollMoney = roadTollMoney; |
| | | } |
| | | |
| | | public Double getRedPacketMoney() { |
| | | return redPacketMoney; |
| | | } |
| | | |
| | | public void setRedPacketMoney(Double redPacketMoney) { |
| | | this.redPacketMoney = redPacketMoney; |
| | | } |
| | | |
| | | public Double getCouponMoney() { |
| | | return couponMoney; |
| | | } |
| | | |
| | | public void setCouponMoney(Double couponMoney) { |
| | | this.couponMoney = couponMoney; |
| | | } |
| | | |
| | | public Double getDiscountMoney() { |
| | | return discountMoney; |
| | | } |
| | | |
| | | public void setDiscountMoney(Double discountMoney) { |
| | | this.discountMoney = discountMoney; |
| | | } |
| | | |
| | | public Double getDiscount() { |
| | | return discount; |
| | | } |
| | | |
| | | public void setDiscount(Double discount) { |
| | | this.discount = discount; |
| | | } |
| | | |
| | | public Double getMileage() { |
| | | return mileage; |
| | | } |
| | | |
| | | public void setMileage(Double mileage) { |
| | | this.mileage = mileage; |
| | | } |
| | | |
| | | public Double getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(Double duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public Double getWait() { |
| | | return wait; |
| | | } |
| | | |
| | | public void setWait(Double wait) { |
| | | this.wait = wait; |
| | | } |
| | | |
| | | public Double getLongDistance() { |
| | | return longDistance; |
| | | } |
| | | |
| | | public void setLongDistance(Double longDistance) { |
| | | this.longDistance = longDistance; |
| | | } |
| | | |
| | | public Double getStartMileage() { |
| | | return startMileage; |
| | | } |
| | | |
| | | public void setStartMileage(Double startMileage) { |
| | | this.startMileage = startMileage; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "MoneyInfoWarpper{" + |
| | | "orderMoney=" + orderMoney + |
| | | ", startMoney=" + startMoney + |
| | | ", mileageMoney=" + mileageMoney + |
| | | ", mileage=" + mileage + |
| | | ", durationMoney=" + durationMoney + |
| | | ", duration=" + duration + |
| | | ", waitMoney=" + waitMoney + |
| | | ", wait=" + wait + |
| | | ", longDistanceMoney=" + longDistanceMoney + |
| | | ", longDistance=" + longDistance + |
| | | ", parkMoney=" + parkMoney + |
| | | ", roadTollMoney=" + roadTollMoney + |
| | | ", redPacketMoney=" + redPacketMoney + |
| | | ", couponMoney=" + couponMoney + |
| | | ", discountMoney=" + discountMoney + |
| | | ", discount=" + discount + |
| | | '}'; |
| | | } |
| | | @ApiModelProperty("补差价") |
| | | private Double priceDifference; |
| | | |
| | | public static MoneyInfoWarpper getMoneyInfoWarpper(Map<String, Object> map){ |
| | | MoneyInfoWarpper moneyInfoWarpper = new MoneyInfoWarpper(); |
| | |
| | | moneyInfoWarpper.setCouponMoney(null != map.get("couponMoney") ? Double.valueOf(map.get("couponMoney").toString()) : 0D); |
| | | moneyInfoWarpper.setDiscountMoney(null != map.get("discountMoney") ? Double.valueOf(map.get("discountMoney").toString()) : 0D); |
| | | moneyInfoWarpper.setDiscount(null != map.get("discount") ? Double.valueOf(map.get("discount").toString()) : 0D); |
| | | moneyInfoWarpper.setPriceDifference(null != map.get("priceDifference") ? Double.valueOf(map.get("priceDifference").toString()) : 0D); |
| | | } |
| | | return moneyInfoWarpper; |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.OrderPosition; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("订单详情22") |
| | |
| | | public class OrderInfoWarpper { |
| | | @ApiModelProperty("订单id") |
| | | private Integer orderId; |
| | | @ApiModelProperty("1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中)<br/>" + |
| | | "小件物流订单状态(状态(1=待接单,2=待出发,3=待到达预约地点,4=待取货,5=送货中,6=已送达,7=待支付,8=需补差价,9=已取货,10=已取消,11=已支付差价))") |
| | | @ApiModelProperty("状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付,13=补差价)") |
| | | private Integer orderState; |
| | | @ApiModelProperty("订单名称") |
| | | private String orderName; |
| | |
| | | private Integer historyNum; |
| | | @ApiModelProperty("订单总金额") |
| | | private Double orderMoney; |
| | | @ApiModelProperty(value = "支付方式(1=OK平台支付(线上支付),2=其他方式支付(线下支付))11111", example = "1") |
| | | @ApiModelProperty(value = "支付方式(1=OK平台支付(线上支付),2=其他方式支付(线下支付))", example = "1") |
| | | private Integer payManner; |
| | | @ApiModelProperty("支付金额") |
| | | private Double payMoney; |
| | | |
| | | |
| | | @ApiModelProperty("是否是改派单(1=否,2=是)") |
| | | private Integer isReassign; |
| | | @ApiModelProperty("高德猎鹰轨迹id(订单开始后需要上传坐标到指定轨迹中)") |
| | |
| | | private Integer urgent; |
| | | @ApiModelProperty("下单用户姓名") |
| | | private String userName; |
| | | @ApiModelProperty("下单用户电话") |
| | | private String userPhone; |
| | | @ApiModelProperty("司机支付状态【现金支付需要司机代支付】(1=待支付,2=已支付)") |
| | | private Integer driverPay; |
| | | |
| | | @ApiModelProperty("轨迹") |
| | | private String orderPositionList; |
| | | |
| | | private Integer startDuration; |
| | | @ApiModelProperty("是否冻结(1=否,2=是)") |
| | | private Integer isFrozen; |
| | | @ApiModelProperty("超时取消时间") |
| | | private Integer timeOutCancel; |
| | | @ApiModelProperty("接单时间") |
| | | private String snatchOrderTime; |
| | | private String tripId; |
| | | |
| | | public Integer getStartDuration() { |
| | | return startDuration; |
| | |
| | | this.driverPay = driverPay; |
| | | } |
| | | |
| | | public Integer getIsFrozen() { |
| | | return isFrozen; |
| | | } |
| | | |
| | | public void setIsFrozen(Integer isFrozen) { |
| | | this.isFrozen = isFrozen; |
| | | } |
| | | |
| | | public Integer getTimeOutCancel() { |
| | | return timeOutCancel; |
| | | } |
| | | |
| | | public void setTimeOutCancel(Integer timeOutCancel) { |
| | | this.timeOutCancel = timeOutCancel; |
| | | } |
| | | |
| | | public String getSnatchOrderTime() { |
| | | return snatchOrderTime; |
| | | } |
| | | |
| | | public void setSnatchOrderTime(String snatchOrderTime) { |
| | | this.snatchOrderTime = snatchOrderTime; |
| | | } |
| | | |
| | | public String getUserPhone() { |
| | | return userPhone; |
| | | } |
| | | |
| | | public void setUserPhone(String userPhone) { |
| | | this.userPhone = userPhone; |
| | | } |
| | | |
| | | public String getTripId() { |
| | | return tripId; |
| | | } |
| | | |
| | | public void setTripId(String tripId) { |
| | | this.tripId = tripId; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderInfoWarpper{" + |
| | |
| | | orderInfoWarpper.setUrgent(null != map.get("urgent") ? Integer.valueOf(map.get("urgent").toString()) : 0); |
| | | orderInfoWarpper.setUserName(null != map.get("userName") ? String.valueOf(map.get("userName")) : ""); |
| | | orderInfoWarpper.setDriverPay(null != map.get("driverPay") ? Integer.valueOf(map.get("driverPay").toString()) : 0); |
| | | orderInfoWarpper.setIsFrozen(null != map.get("isFrozen") ? Integer.valueOf(map.get("isFrozen").toString()) : 1); |
| | | orderInfoWarpper.setTimeOutCancel(null != map.get("timeOutCancel") ? Integer.valueOf(map.get("timeOutCancel").toString()) : 0); |
| | | orderInfoWarpper.setSnatchOrderTime(null != map.get("snatchOrderTime") ? map.get("snatchOrderTime").toString() : ""); |
| | | orderInfoWarpper.setUserPhone(null != map.get("userPhone") ? map.get("userPhone").toString() : ""); |
| | | orderInfoWarpper.setTripId(null != map.get("tripId") ? map.get("tripId").toString() : ""); |
| | | } |
| | | return orderInfoWarpper; |
| | | } |
| | |
| | | private Double redMoney; |
| | | @ApiModelProperty("订单金额") |
| | | private Double orderMoney; |
| | | @ApiModelProperty("订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中)<br/>" + |
| | | "小件物流订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待取货,5=送货中,6=已送达,7=待支付,8=需补差价,9=已取货,10=已取消,11=已支付差价)") |
| | | @ApiModelProperty("状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付,13=补差价)") |
| | | private Integer state; |
| | | @ApiModelProperty("人数") |
| | | private Integer peopleNumber; |
| | |
| | | private Long travelTime; |
| | | @ApiModelProperty("司机支付状态(现金支付司机代支付)1待支付 2已支付") |
| | | private Integer driverPay; |
| | | @ApiModelProperty("中途取消(0=否,1=是)") |
| | | private Integer cancelMidway; |
| | | @ApiModelProperty("结算状态(0=否,1=是)") |
| | | private Integer settleAccounts; |
| | | @ApiModelProperty("是否冻结(1=否,2=是)") |
| | | private Integer isFrozen; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | this.driverPay = driverPay; |
| | | } |
| | | |
| | | public Integer getCancelMidway() { |
| | | return cancelMidway; |
| | | } |
| | | |
| | | public void setCancelMidway(Integer cancelMidway) { |
| | | this.cancelMidway = cancelMidway; |
| | | } |
| | | |
| | | public Integer getSettleAccounts() { |
| | | return settleAccounts; |
| | | } |
| | | |
| | | public void setSettleAccounts(Integer settleAccounts) { |
| | | this.settleAccounts = settleAccounts; |
| | | } |
| | | |
| | | public Integer getIsFrozen() { |
| | | return isFrozen; |
| | | } |
| | | |
| | | public void setIsFrozen(Integer isFrozen) { |
| | | this.isFrozen = isFrozen; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderListWarpper{" + |
| | |
| | | orderListWarpper.setPayManner(null != map.get("payManner") ? Integer.valueOf(String.valueOf(map.get("payManner"))) : 0); |
| | | orderListWarpper.setTravelTime(null != map.get("travelTime") ? Long.valueOf(String.valueOf(map.get("travelTime"))) : 0); |
| | | orderListWarpper.setDriverPay(null != map.get("driverPay") ? Integer.valueOf(map.get("driverPay").toString()) : 1); |
| | | orderListWarpper.setCancelMidway(null != map.get("cancelMidway") ? Integer.valueOf(map.get("cancelMidway").toString()) : 0); |
| | | orderListWarpper.setSettleAccounts(null != map.get("settleAccounts") ? Integer.valueOf(map.get("settleAccounts").toString()) : 0); |
| | | orderListWarpper.setIsFrozen(null != map.get("isFrozen") ? Integer.valueOf(map.get("isFrozen").toString()) : 0); |
| | | list.add(orderListWarpper); |
| | | } |
| | | } |
| | |
| | | private Integer orderId; |
| | | @ApiModelProperty("订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)") |
| | | private Integer orderType; |
| | | @ApiModelProperty("订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中)") |
| | | @ApiModelProperty("状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付,13=补差价)") |
| | | private Integer state; |
| | | |
| | | public Integer getOrderId() { |
| | |
| | | private Double price; |
| | | @ApiModelProperty("结算周期(1=日结算,2=周结算,3=月结算)") |
| | | private Integer type; |
| | | @ApiModelProperty("支付方式") |
| | | private String payType; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("提现历史记录") |
| | | public class WithdrawalListWarpper { |
| | | @ApiModelProperty("主键") |
| | | private Integer id; |
| | | @ApiModelProperty("提现时间") |
| | | private String insertTime; |
| | | @ApiModelProperty("提现金额") |
| | | private Double money; |
| | | @ApiModelProperty("提现方式") |
| | | private String name; |
| | | @ApiModelProperty("备注") |
| | | private String remark; |
| | | @ApiModelProperty("提现状态(1=待处理,2=成功,3=失败)") |
| | | private Integer state; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(String insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Double getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(Double money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "WithdrawalWarpper{" + |
| | | "id=" + id + |
| | | ", insertTime='" + insertTime + '\'' + |
| | | ", money=" + money + |
| | | ", name='" + name + '\'' + |
| | | ", remark='" + remark + '\'' + |
| | | ", state=" + state + |
| | | '}'; |
| | | } |
| | | |
| | | public static List<WithdrawalListWarpper> getWithdrawalWarpper(List<Map<String, Object>> maps){ |
| | | List<WithdrawalListWarpper> list = new ArrayList<>(); |
| | | if(null != maps){ |
| | | for(Map<String, Object> map : maps){ |
| | | WithdrawalListWarpper withdrawalWarpper = new WithdrawalListWarpper(); |
| | | withdrawalWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); |
| | | withdrawalWarpper.setMoney(null != map.get("money") ? Double.valueOf(String.valueOf(map.get("money"))) : 0); |
| | | withdrawalWarpper.setName(null != map.get("name") ? String.valueOf(map.get("name")) : ""); |
| | | withdrawalWarpper.setRemark(null != map.get("remark") ? String.valueOf(map.get("remark")) : ""); |
| | | withdrawalWarpper.setState(null != map.get("state") ? Integer.valueOf(String.valueOf(map.get("state"))) : 0); |
| | | withdrawalWarpper.setInsertTime(null != map.get("insertTime") ? String.valueOf(map.get("insertTime")) : ""); |
| | | list.add(withdrawalWarpper); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | } |
| | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("提现历史记录") |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/6 11:09 |
| | | */ |
| | | @ApiModel |
| | | @Data |
| | | public class WithdrawalWarpper { |
| | | @ApiModelProperty("主键") |
| | | private Integer id; |
| | | @ApiModelProperty("提现时间") |
| | | private String insertTime; |
| | | @ApiModelProperty("提现金额") |
| | | private Double money; |
| | | @ApiModelProperty("提现方式") |
| | | private String name; |
| | | @ApiModelProperty("备注") |
| | | private String remark; |
| | | @ApiModelProperty("提现状态(1=待处理,2=成功,3=失败)") |
| | | private Integer state; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(String insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Double getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(Double money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "WithdrawalWarpper{" + |
| | | "id=" + id + |
| | | ", insertTime='" + insertTime + '\'' + |
| | | ", money=" + money + |
| | | ", name='" + name + '\'' + |
| | | ", remark='" + remark + '\'' + |
| | | ", state=" + state + |
| | | '}'; |
| | | } |
| | | |
| | | public static List<WithdrawalWarpper> getWithdrawalWarpper(List<Map<String, Object>> maps){ |
| | | List<WithdrawalWarpper> list = new ArrayList<>(); |
| | | if(null != maps){ |
| | | for(Map<String, Object> map : maps){ |
| | | WithdrawalWarpper withdrawalWarpper = new WithdrawalWarpper(); |
| | | withdrawalWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); |
| | | withdrawalWarpper.setMoney(null != map.get("money") ? Double.valueOf(String.valueOf(map.get("money"))) : 0); |
| | | withdrawalWarpper.setName(null != map.get("name") ? String.valueOf(map.get("name")) : ""); |
| | | withdrawalWarpper.setRemark(null != map.get("remark") ? String.valueOf(map.get("remark")) : ""); |
| | | withdrawalWarpper.setState(null != map.get("state") ? Integer.valueOf(String.valueOf(map.get("state"))) : 0); |
| | | withdrawalWarpper.setInsertTime(null != map.get("insertTime") ? String.valueOf(map.get("insertTime")) : ""); |
| | | list.add(withdrawalWarpper); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | @ApiModelProperty("提现总金额") |
| | | private Double total; |
| | | @ApiModelProperty("明细列表") |
| | | private List<WithdrawalListWarpper> list; |
| | | } |
| | |
| | | } |
| | | }).start(); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushDriverPosition(orderId, 2); |
| | | } |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(2, "您已成功抢得出租车订单,请及时联系客户!", orderTaxi.getDriverId()); |
| | | systemNoticeService.addSystemNotice(1, "您的订单已指派给" + driver.getLastName().substring(0, 1) + "师傅,请保持电话畅通!", orderTaxi.getUserId()); |
| | |
| | | } |
| | | }).start(); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushDriverPosition(orderId, 2); |
| | | } |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(2, "您已成功抢得出租车订单,请及时联系客户!", orderTaxi.getDriverId()); |
| | | systemNoticeService.addSystemNotice(1, "您的订单已指派给" + driver.getLastName().substring(0, 1) + "师傅,请保持电话畅通!", orderTaxi.getUserId()); |
| | | |
| | |
| | | orderTaxi.setState(3); |
| | | orderTaxi.setSetOutTime(new Date()); |
| | | systemNoticeService.addSystemNotice(1, "司机已出发,请耐心等待", orderTaxi.getUserId()); |
| | | pushUtil.pushDriverPosition(orderTaxi.getId(), 2);//主动推送司机定位 |
| | | break; |
| | | case 4://到达预约点,等待客户上车 |
| | | orderTaxi.setState(4); |
| | |
| | | orderTaxi.setBoardingTime(new Date()); |
| | | orderTaxi.setState(5); |
| | | orderTaxi.setStartServiceTime(new Date()); |
| | | |
| | | pushUtil.pushDriverPosition(orderTaxi.getId(), 2);//主动推送司机定位 |
| | | break; |
| | | case 6://结束服务 |
| | | orderTaxi.setGetoffLon(lon); |
| | |
| | | --- |
| | | spring: |
| | | datasource: |
| | | url: jdbc:mysql://127.0.0.1:3306/igotravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | url: jdbc:mysql://127.0.0.1:3306/igotravel2.0?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: 123456 |
| | | db-name: guns #用来搜集数据库的所有表 |
| | |
| | | |
| | | spring: |
| | | datasource: |
| | | url: jdbc:mysql://127.0.0.1:3306/igotravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B0 |
| | | url: jdbc:mysql://127.0.0.1:3306/igotravel2.0?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B0 |
| | | username: root |
| | | password: HjKbXilb9zajmXbl |
| | | db-name: guns #用来搜集数据库的所有表 |
| | |
| | | </springProfile> |
| | | |
| | | <springProfile name="produce"> |
| | | <root level="warn"> |
| | | <root level="info"> |
| | | <!-- 生产环境最好不配置console写文件 --> |
| | | <appender-ref ref="DEBUG_FILE" /> |
| | | <appender-ref ref="INFO_FILE" /> |
New file |
| | |
| | | # Default Properties file for use by StdSchedulerFactory |
| | | # to create a Quartz Scheduler Instance, if a different |
| | | # properties file is not explicitly specified. |
| | | # |
| | | # 调度器的配置 |
| | | # 实例名称,在集群环境中区分实例 |
| | | org.quartz.scheduler.instanceName=MyScheduler |
| | | # 自动生成实例id,在集群环境中区分实例 |
| | | org.quartz.scheduler.instanceId=AUTO |
| | | org.quartz.scheduler.rmi.export=false |
| | | org.quartz.scheduler.rmi.proxy=false |
| | | org.quartz.scheduler.wrapJobExecutionInUserTransaction=false |
| | | |
| | | # 线程池的配置 |
| | | # 线程实现类 |
| | | org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool |
| | | # 线程总数量 |
| | | org.quartz.threadPool.threadCount=10 |
| | | org.quartz.threadPool.threadPriority=5 |
| | | org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true |
| | | # misfire阈值设置 |
| | | org.quartz.jobStore.misfireThreshold=60000 |
| | | |
| | | # 任务存储配置 |
| | | ## 内存存储 |
| | | #org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore |
| | | # 数据库存储 |
| | | org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX |
| | | # 驱动委托类 |
| | | org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate |
| | | # 数据表名前缀 |
| | | org.quartz.jobStore.tablePrefix=qrtz_ |
| | | # 数据源配置 |
| | | org.quartz.jobStore.dataSource=myDS |
| | | org.quartz.dataSource.myDS.driver=com.mysql.cj.jdbc.Driver |
| | | org.quartz.dataSource.myDS.URL=jdbc:mysql://127.0.0.1:3306/igotravel2.0?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B0 |
| | | org.quartz.dataSource.myDS.user=root |
| | | org.quartz.dataSource.myDS.password=HjKbXilb9zajmXbl |
| | | org.quartz.dataSource.myDS.maxConnections=10 |
| | |
| | | <artifactId>slf4j-simple</artifactId> |
| | | <version>1.7.25</version> |
| | | </dependency> |
| | | <!--Google ODRD--> |
| | | <dependency> |
| | | <groupId>com.google.maps</groupId> |
| | | <artifactId>fleetengine-auth</artifactId> |
| | | <version>1.11.0</version> |
| | | </dependency> |
| | | <!--邮件发送依赖--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.ExcelExportUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | |
| | | if (state!=null){ |
| | | if (state == 1){ |
| | | // 查询已结算的 |
| | | if (settlementRecord.getPaymentStatus() == 1){ |
| | | if (settlementRecord!=null &&settlementRecord.getPaymentStatus() == 1){ |
| | | continue; |
| | | } |
| | | } |
| | | if (state == 2){ |
| | | // 查询未结算的 |
| | | if (settlementRecord.getPaymentStatus() == 2){ |
| | | if (settlementRecord!=null &&settlementRecord.getPaymentStatus() == 2){ |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | if (settlementRecord.getPaymentStatus() == 2){ |
| | | if (settlementRecord!=null && settlementRecord.getPaymentStatus() == 2){ |
| | | // 已结算 |
| | | platformVO.setState(1); |
| | | balance = balance.add(new BigDecimal(settlementDetail.getPrice())); |
| | |
| | | if (state!=null){ |
| | | if (state == 1){ |
| | | // 查询已结算的 |
| | | if (settlementRecord1.getPaymentStatus() == 1){ |
| | | if (settlementRecord1!=null && settlementRecord1.getPaymentStatus() == 1){ |
| | | continue; |
| | | } |
| | | } |
| | | if (state == 2){ |
| | | // 查询未结算的 |
| | | if (settlementRecord1.getPaymentStatus() == 2){ |
| | | if (settlementRecord1!=null && settlementRecord1.getPaymentStatus() == 2){ |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | if (settlementRecord1.getPaymentStatus() == 2){ |
| | | if (settlementRecord1!=null && settlementRecord1.getPaymentStatus() == 2){ |
| | | // 已结算 |
| | | platformVO.setState(1); |
| | | balance = balance.add(new BigDecimal(settlementDetail.getPrice())); |
| | |
| | | if (state!=null){ |
| | | if (state == 1){ |
| | | // 查询已结算的 |
| | | if (settlementRecord.getPaymentStatus() == 1){ |
| | | if (settlementRecord!=null&&settlementRecord.getPaymentStatus() == 1){ |
| | | continue; |
| | | } |
| | | } |
| | | if (state == 2){ |
| | | // 查询未结算的 |
| | | if (settlementRecord.getPaymentStatus() == 2){ |
| | | if (settlementRecord!=null&&settlementRecord.getPaymentStatus() == 2){ |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | if (settlementRecord.getPaymentStatus() == 2){ |
| | | if (settlementRecord!=null&&settlementRecord.getPaymentStatus() == 2){ |
| | | // 已结算 |
| | | platformVO.setState(1); |
| | | balance = balance.add(new BigDecimal(settlementDetail.getPrice())); |
| | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.ExcelExportUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.vo.GrantMoneyVO; |
| | | import com.stylefeng.guns.modular.system.vo.GrantVO; |
| | | import com.stylefeng.guns.modular.system.vo.PlatformVO; |
| | | import com.stylefeng.guns.modular.system.vo.UseMoneyVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | |
| | | private IIncomeService incomeService; |
| | | @Autowired |
| | | private ISettlementRecordService settlementRecordService; |
| | | |
| | | @Autowired |
| | | private IBalanceUsageRecordService balanceUsageRecordService; |
| | | @Autowired |
| | | private ISettlementDetailService settlementDetailService; |
| | | @Autowired |
| | |
| | | break; |
| | | } |
| | | } |
| | | Page<Map<String,Object>> page = new PageFactory<Map<String,Object>>().defaultPage(); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // 列表res |
| | | List<GrantVO> res = new ArrayList<>(); |
| | |
| | | // 红包领取记录 |
| | | List<TOrderPrivateCar> userRedPacketRecords = new ArrayList<>(); |
| | | List<TOrderLogistics> userRedPacketRecords1 = new ArrayList<>(); |
| | | |
| | | // 司机消费 |
| | | List<TPubTransactionDetails> driverActivityHistories = new ArrayList<>(); |
| | | List<BalanceUsageRecord> balanceUsageRecords = new ArrayList<>(); |
| | | // 司机提现 |
| | | List<TPubWithdrawal> driverWithdrawal = new ArrayList<>(); |
| | | List<BalanceUsageRecord> driverWithdrawal = new ArrayList<>(); |
| | | // 司机提现wrapper |
| | | Wrapper<TPubWithdrawal> driverWrapper = new EntityWrapper<TPubWithdrawal>() |
| | | .eq("state", 2) |
| | |
| | | .between("handleTime", start, end); |
| | | // 专车wrapper |
| | | Wrapper<TOrderPrivateCar> between = new EntityWrapper<TOrderPrivateCar>() |
| | | .eq("state", 8) |
| | | .eq("state", 9) |
| | | .isNotNull("activityId") |
| | | .isNotNull("discountMoney") |
| | | |
| | | |
| | | .between("insertTime", start, end); |
| | | // 小件物流wrapper |
| | | Wrapper<TOrderLogistics> between1 = new EntityWrapper<TOrderLogistics>() |
| | | .eq("state", 8) |
| | | .eq("state", 9) |
| | | .isNotNull("activityId") |
| | | .isNotNull("discountMoney") |
| | | |
| | | |
| | | .between("insertTime", start, end); |
| | | // 已使用优惠券记录wrapper |
| | | Wrapper<TOrderPrivateCar> between2 = new EntityWrapper<TOrderPrivateCar>() |
| | | .eq("state", 8) |
| | | .eq("state", 9) |
| | | .isNotNull("couponId") |
| | | .isNotNull("couponMoney") |
| | | |
| | | |
| | | .between("insertTime", start, end); |
| | | Wrapper<TOrderLogistics> between22 = new EntityWrapper<TOrderLogistics>() |
| | | .eq("state", 8) |
| | | .eq("state", 9) |
| | | .isNotNull("couponId") |
| | | .isNotNull("couponMoney") |
| | | |
| | | |
| | | .between("insertTime", start, end); |
| | | // 已使用红包记录wrapper |
| | | Wrapper<TOrderPrivateCar> between3 = new EntityWrapper<TOrderPrivateCar>() |
| | | .eq("state", 8) |
| | | .eq("state", 9) |
| | | .isNotNull("redPacketId") |
| | | .isNotNull("redPacketMoney") |
| | | |
| | | |
| | | .between("insertTime", start, end); |
| | | Wrapper<TOrderLogistics> between33 = new EntityWrapper<TOrderLogistics>() |
| | | .eq("state", 8) |
| | | .eq("state", 9) |
| | | .isNotNull("redPacketId") |
| | | .isNotNull("redPacketMoney") |
| | | |
| | | |
| | | .between("insertTime", start, end); |
| | | // 司机已消费金额 |
| | | Wrapper<TPubTransactionDetails> between4 = new EntityWrapper<TPubTransactionDetails>() |
| | | .eq("state", 2) |
| | | .eq("type", 1) |
| | | .eq("userType", 2) |
| | | .ne("orderType", 2) |
| | | .ne("orderType", 3) |
| | | .between("insertTime", start, end); |
| | | Wrapper<BalanceUsageRecord> between4 = new EntityWrapper<BalanceUsageRecord>() |
| | | .ne("purpose", 6) |
| | | .between("createTime", start, end); |
| | | // 司机提现 |
| | | Wrapper<BalanceUsageRecord> between44 = new EntityWrapper<BalanceUsageRecord>() |
| | | .eq("purpose", 6) |
| | | .between("createTime", start, end); |
| | | |
| | | if (type!=null){ |
| | | switch (type){ |
| | | case 1: |
| | |
| | | break; |
| | | case 3: |
| | | // 司机消费记录 |
| | | driverActivityHistories = pubTransactionDetailsService.selectList(between4); |
| | | balanceUsageRecords = balanceUsageRecordService.selectList(between4); |
| | | |
| | | driverWithdrawal = pubWithdrawalService.selectList(driverWrapper); |
| | | driverWithdrawal = balanceUsageRecordService.selectList(between44); |
| | | break; |
| | | case 4: |
| | | // 专车订单 |
| | |
| | | // 小件物流订单 |
| | | tOrderLogistics = orderLogisticsService.selectList(between1); |
| | | // 消费 |
| | | driverActivityHistories = pubTransactionDetailsService.selectList(between4); |
| | | driverWithdrawal = pubWithdrawalService.selectList(driverWrapper); |
| | | balanceUsageRecords = balanceUsageRecordService.selectList(between4); |
| | | // 提现 |
| | | driverWithdrawal = balanceUsageRecordService.selectList(between44); |
| | | } |
| | | |
| | | // 已发放补贴总额 |
| | |
| | | BigDecimal driverWithdrawal1 = new BigDecimal("0"); |
| | | // 查询已使用折扣总额 |
| | | for (TOrderPrivateCar tOrderPrivateCar : tOrderPrivateCars) { |
| | | if (tOrderPrivateCar.getState() != 9 &&tOrderPrivateCar.getState() != 8){ |
| | | continue; |
| | | } |
| | | discount = discount.add(new BigDecimal(tOrderPrivateCar.getDiscountMoney().toString())); |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(tOrderPrivateCar.getInsertTime())); |
| | |
| | | |
| | | } |
| | | for (TOrderLogistics tOrderPrivateCar : tOrderLogistics) { |
| | | if (tOrderPrivateCar.getState() != 9 &&tOrderPrivateCar.getState() != 8){ |
| | | continue; |
| | | } |
| | | discount = discount.add(new BigDecimal(tOrderPrivateCar.getDiscountMoney().toString())); |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(tOrderPrivateCar.getInsertTime())); |
| | |
| | | } |
| | | // 查询已领取红包总额 |
| | | for (TOrderPrivateCar userRedPacketRecord : userRedPacketRecords) { |
| | | if (userRedPacketRecord.getState() != 9 &&userRedPacketRecord.getState() != 8){ |
| | | continue; |
| | | } |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(userRedPacketRecord.getInsertTime())); |
| | | grantVO.setType("红包"); |
| | |
| | | redPackage = redPackage.add(new BigDecimal(userRedPacketRecord.getPayMoney().toString())); |
| | | } |
| | | for (TOrderLogistics userRedPacketRecord : userRedPacketRecords1) { |
| | | if (userRedPacketRecord.getState() != 9 &&userRedPacketRecord.getState() != 8){ |
| | | continue; |
| | | } |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(userRedPacketRecord.getInsertTime())); |
| | | grantVO.setType("红包"); |
| | |
| | | } |
| | | // 查询已领取优惠券总额 |
| | | for (TOrderPrivateCar userCouponRecord : userCouponRecords) { |
| | | if (userCouponRecord.getState() != 9 &&userCouponRecord.getState() != 8){ |
| | | continue; |
| | | } |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(userCouponRecord.getInsertTime())); |
| | | grantVO.setType("优惠券"); |
| | |
| | | res.add(grantVO); |
| | | } |
| | | for (TOrderLogistics userCouponRecord : userCouponRecords1) { |
| | | if (userCouponRecord.getState() != 9 &&userCouponRecord.getState() != 8){ |
| | | continue; |
| | | } |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(userCouponRecord.getInsertTime())); |
| | | grantVO.setType("优惠券"); |
| | |
| | | coupon = coupon.add(new BigDecimal(userCouponRecord.getPayMoney().toString())); |
| | | res.add(grantVO); |
| | | } |
| | | // 已领取司机奖励 |
| | | // for (DriverActivityHistory driverActivityHistory : driverActivityHistories) { |
| | | // GrantVO grantVO = new GrantVO(); |
| | | // grantVO.setInsertTime(format.format(driverActivityHistory.getInsertTime())); |
| | | // grantVO.setType("司机奖励"); |
| | | // grantVO.setAmount(driverActivityHistory.getMoney().toString()); |
| | | // TDriver tDriver = driverService.selectById(driverActivityHistory.getDriverId()); |
| | | // if (tDriver!=null){ |
| | | // grantVO.setName(tDriver.getFirstName()+tDriver.getLastName()); |
| | | // } |
| | | // Integer type1 = driverActivityHistory.getType(); |
| | | // switch (type1){ |
| | | // case 1: |
| | | // grantVO.setRemark("邀请司机注册"); |
| | | // break; |
| | | // case 2: |
| | | // grantVO.setRemark("邀请用户注册"); |
| | | // break; |
| | | // case 3: |
| | | // grantVO.setRemark("累计在线"); |
| | | // break; |
| | | // case 4: |
| | | // grantVO.setRemark("订单量"); |
| | | // break; |
| | | // } |
| | | // driver = driver.add(new BigDecimal(driverActivityHistory.getMoney().toString())); |
| | | // res.add(grantVO); |
| | | // } |
| | | total = total.add(redPackage).add(coupon).add(discount).add(driver); |
| | | // 司机消费奖励 |
| | | for (BalanceUsageRecord balanceUsageRecord : balanceUsageRecords) { |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(balanceUsageRecord.getCreateTime())); |
| | | grantVO.setType("司机奖励"); |
| | | grantVO.setAmount(balanceUsageRecord.getMoney().toString()); |
| | | TDriver tUser = driverService.selectById(balanceUsageRecord.getDriverId()); |
| | | if (tUser!=null){ |
| | | grantVO.setName(tUser.getFirstName()+tUser.getLastName()); |
| | | } |
| | | switch (balanceUsageRecord.getPurpose()){ |
| | | case 1: |
| | | //打车支付 |
| | | grantVO.setRemark("余额支付"+"【打车支付】"); |
| | | break; |
| | | case 2: |
| | | grantVO.setRemark("余额支付"+"【包裹支付】"); |
| | | // 包裹支付 |
| | | break; |
| | | case 3: |
| | | grantVO.setRemark("余额支付"+"【日结算】"); |
| | | // 日结算 |
| | | break; |
| | | case 4: |
| | | grantVO.setRemark("余额支付"+"【周结算】"); |
| | | // 周结算 |
| | | break; |
| | | case 5: |
| | | grantVO.setRemark("余额支付"+"【月结算】"); |
| | | // 月结算 |
| | | break; |
| | | } |
| | | driverConsume = driverConsume.add(new BigDecimal(balanceUsageRecord.getMoney().toString())); |
| | | res.add(grantVO); |
| | | } |
| | | // 司机提现 |
| | | for (BalanceUsageRecord balanceUsageRecord : driverWithdrawal) { |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(balanceUsageRecord.getCreateTime())); |
| | | grantVO.setType("司机奖励"); |
| | | grantVO.setAmount(balanceUsageRecord.getMoney().toString()); |
| | | TDriver tUser = driverService.selectById(balanceUsageRecord.getDriverId()); |
| | | if (tUser!=null){ |
| | | grantVO.setName(tUser.getFirstName()+tUser.getLastName()); |
| | | } |
| | | switch (balanceUsageRecord.getPurpose()){ |
| | | case 6: |
| | | grantVO.setRemark("司机提现"); |
| | | break; |
| | | } |
| | | driverWithdrawal1 = driverWithdrawal1.add(new BigDecimal(balanceUsageRecord.getMoney().toString())); |
| | | res.add(grantVO); |
| | | } |
| | | |
| | | // 总额 |
| | | total = total.add(redPackage).add(coupon).add(discount).add(driverConsume).add(driverWithdrawal1); |
| | | // 已使用司机奖励合计 |
| | | driver = driverConsume.add(driverWithdrawal1); |
| | | return res; |
| | | } |
| | | @RequestMapping(value = "/use/getCount") |
| | | @ResponseBody |
| | | public Object getCount1(Integer time,String insertTime,Integer type) { |
| | | GrantMoneyVO result = new GrantMoneyVO(); |
| | | if (time == null){ |
| | | time = 1; |
| | | } |
| | |
| | | // 小件物流 |
| | | List<TOrderLogistics> tOrderLogistics = new ArrayList<>(); |
| | | // 优惠券领取记录 |
| | | List<UserCouponRecord> userCouponRecords = new ArrayList<>(); |
| | | List<TOrderPrivateCar> userCouponRecords = new ArrayList<>(); |
| | | List<TOrderLogistics> userCouponRecords1 = new ArrayList<>(); |
| | | // 红包领取记录 |
| | | List<UserRedPacketRecord> userRedPacketRecords = new ArrayList<>(); |
| | | // 司机奖励 |
| | | List<DriverActivityHistory> driverActivityHistories = new ArrayList<>(); |
| | | List<TOrderPrivateCar> userRedPacketRecords = new ArrayList<>(); |
| | | List<TOrderLogistics> userRedPacketRecords1 = new ArrayList<>(); |
| | | |
| | | // 司机消费 |
| | | List<BalanceUsageRecord> balanceUsageRecords = new ArrayList<>(); |
| | | // 司机提现 |
| | | List<BalanceUsageRecord> driverWithdrawal = new ArrayList<>(); |
| | | // 司机提现wrapper |
| | | Wrapper<TPubWithdrawal> driverWrapper = new EntityWrapper<TPubWithdrawal>() |
| | | .eq("state", 2) |
| | | .eq("userType", 2) |
| | | .between("handleTime", start, end); |
| | | // 专车wrapper |
| | | Wrapper<TOrderPrivateCar> between = new EntityWrapper<TOrderPrivateCar>() |
| | | .eq("state", 8) |
| | | .eq("state", 9) |
| | | .isNotNull("activityId") |
| | | .isNotNull("discountMoney") |
| | | .between("insertTime", start, end); |
| | | .between("insertTime", start, end) |
| | | |
| | | ; |
| | | // 小件物流wrapper |
| | | Wrapper<TOrderLogistics> between1 = new EntityWrapper<TOrderLogistics>() |
| | | .eq("state", 8) |
| | | .eq("state", 9) |
| | | .isNotNull("activityId") |
| | | .isNotNull("discountMoney") |
| | | .between("insertTime", start, end); |
| | | // 优惠券领取记录wrapper |
| | | Wrapper<UserCouponRecord> between2 = new EntityWrapper<UserCouponRecord>() |
| | | .ne("couponUseType", 2) |
| | | .ne("couponUseType", 3) |
| | | .between("insertTime", start, end); |
| | | // 红包领取记录wrapper |
| | | Wrapper<UserRedPacketRecord> between3 = new EntityWrapper<UserRedPacketRecord>() |
| | | .ne("orderType", 2) |
| | | .ne("orderType", 3) |
| | | .between("insertTime", start, end); |
| | | // 司机奖励 |
| | | Wrapper<DriverActivityHistory> between4 = new EntityWrapper<DriverActivityHistory>() |
| | | .eq("carryOut", 2) |
| | | .between("insertTime", start, end); |
| | | if (type!=null){ |
| | | .between("insertTime", start, end) |
| | | |
| | | ; |
| | | // 已使用优惠券记录wrapper |
| | | Wrapper<TOrderPrivateCar> between2 = new EntityWrapper<TOrderPrivateCar>() |
| | | .isNotNull("couponId") |
| | | .isNotNull("couponMoney") |
| | | .between("insertTime", start, end) |
| | | |
| | | |
| | | ; |
| | | Wrapper<TOrderLogistics> between22 = new EntityWrapper<TOrderLogistics>() |
| | | .isNotNull("couponId") |
| | | .isNotNull("couponMoney") |
| | | .between("insertTime", start, end) |
| | | |
| | | |
| | | ; |
| | | // 已使用红包记录wrapper |
| | | Wrapper<TOrderPrivateCar> between3 = new EntityWrapper<TOrderPrivateCar>() |
| | | .isNotNull("redPacketId") |
| | | .isNotNull("redPacketMoney") |
| | | .between("insertTime", start, end) |
| | | |
| | | ; |
| | | Wrapper<TOrderLogistics> between33 = new EntityWrapper<TOrderLogistics>() |
| | | .isNotNull("redPacketId") |
| | | .isNotNull("redPacketMoney") |
| | | .between("insertTime", start, end) |
| | | |
| | | |
| | | ; |
| | | // 司机已消费金额 |
| | | Wrapper<BalanceUsageRecord> between4 = new EntityWrapper<BalanceUsageRecord>() |
| | | .ne("purpose", 6) |
| | | .between("createTime", start, end); |
| | | // 司机提现 |
| | | Wrapper<BalanceUsageRecord> between44 = new EntityWrapper<BalanceUsageRecord>() |
| | | .eq("purpose", 6) |
| | | .between("createTime", start, end); |
| | | |
| | | if (type!=null){ |
| | | switch (type){ |
| | | case 1: |
| | | // 红包 |
| | | userRedPacketRecords = userRedPacketRecordService.selectList(between3); |
| | | userRedPacketRecords = orderPrivateCarService.selectList(between3); |
| | | userRedPacketRecords1 = orderLogisticsService.selectList(between33); |
| | | break; |
| | | case 2: |
| | | userCouponRecords = userCouponRecordService.selectList(between2); |
| | | userCouponRecords = orderPrivateCarService.selectList(between2); |
| | | userCouponRecords1 = orderLogisticsService.selectList(between22); |
| | | // 优惠券 |
| | | break; |
| | | case 3: |
| | | // 司机奖励 |
| | | driverActivityHistories = driverActivityHistoryService.selectList(between4); |
| | | // 司机消费记录 |
| | | balanceUsageRecords = balanceUsageRecordService.selectList(between4); |
| | | |
| | | driverWithdrawal = balanceUsageRecordService.selectList(between44); |
| | | break; |
| | | case 4: |
| | | // 专车订单 |
| | |
| | | break; |
| | | } |
| | | }else{ |
| | | // 红包 |
| | | userRedPacketRecords = orderPrivateCarService.selectList(between3); |
| | | userRedPacketRecords1 = orderLogisticsService.selectList(between33); |
| | | // 优惠券 |
| | | userCouponRecords = orderPrivateCarService.selectList(between2); |
| | | userCouponRecords1 = orderLogisticsService.selectList(between22); |
| | | // 专车订单 |
| | | tOrderPrivateCars = orderPrivateCarService.selectList(between); |
| | | // 小件物流订单 |
| | | tOrderLogistics = orderLogisticsService.selectList(between1); |
| | | // 司机奖励 |
| | | driverActivityHistories = driverActivityHistoryService.selectList(between4); |
| | | userCouponRecords = userCouponRecordService.selectList(between2); |
| | | userRedPacketRecords = userRedPacketRecordService.selectList(between3); |
| | | // 消费 |
| | | balanceUsageRecords = balanceUsageRecordService.selectList(between4); |
| | | // 提现 |
| | | driverWithdrawal = balanceUsageRecordService.selectList(between44); |
| | | } |
| | | |
| | | // 已发放补贴总额 |
| | | BigDecimal total = new BigDecimal("0"); |
| | | // 已使用折扣总额(用户端) |
| | | BigDecimal discount = new BigDecimal("0"); |
| | | // 已领取红包总额(用户端) |
| | | // 已使用红包总额(用户端) |
| | | BigDecimal redPackage = new BigDecimal("0"); |
| | | // 已领取优惠券总额(用户端) |
| | | // 已使用优惠券总额(用户端) |
| | | BigDecimal coupon = new BigDecimal("0"); |
| | | // 已领取司机奖励总额(司机端) |
| | | // 已使用司机奖励总额(司机端) |
| | | BigDecimal driver = new BigDecimal("0"); |
| | | // 司机已消费 |
| | | BigDecimal driverConsume = new BigDecimal("0"); |
| | | // 司机已提现 |
| | | BigDecimal driverWithdrawal1 = new BigDecimal("0"); |
| | | // 查询已使用折扣总额 |
| | | for (TOrderPrivateCar tOrderPrivateCar : tOrderPrivateCars) { |
| | | if (tOrderPrivateCar.getState() != 9 &&tOrderPrivateCar.getState() != 8){ |
| | | continue; |
| | | } |
| | | discount = discount.add(new BigDecimal(tOrderPrivateCar.getDiscountMoney().toString())); |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(tOrderPrivateCar.getInsertTime())); |
| | |
| | | if (tUser!=null){ |
| | | grantVO.setName(tUser.getNickName()); |
| | | } |
| | | UserActivityDiscount1 userActivityDiscount1 = userActivityDiscount1Service.selectById(tOrderPrivateCar.getActivityId()); |
| | | if (userActivityDiscount1!=null){ |
| | | UserActivity userActivity = userActivityService.selectById(userActivityDiscount1.getUserActivityId()); |
| | | if (userActivity!=null){ |
| | | grantVO.setRemark(userActivity.getName()); |
| | | } |
| | | } |
| | | grantVO.setRemark("订单号:"+tOrderPrivateCar.getOrderNum()); |
| | | |
| | | } |
| | | for (TOrderLogistics tOrderPrivateCar : tOrderLogistics) { |
| | | if (tOrderPrivateCar.getState() != 9 &&tOrderPrivateCar.getState() != 8){ |
| | | continue; |
| | | } |
| | | discount = discount.add(new BigDecimal(tOrderPrivateCar.getDiscountMoney().toString())); |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(tOrderPrivateCar.getInsertTime())); |
| | |
| | | if (tUser!=null){ |
| | | grantVO.setName(tUser.getNickName()); |
| | | } |
| | | UserActivityDiscount1 userActivityDiscount1 = userActivityDiscount1Service.selectById(tOrderPrivateCar.getActivityId()); |
| | | if (userActivityDiscount1!=null){ |
| | | UserActivity userActivity = userActivityService.selectById(userActivityDiscount1.getUserActivityId()); |
| | | if (userActivity!=null){ |
| | | grantVO.setRemark(userActivity.getName()); |
| | | } |
| | | } |
| | | grantVO.setRemark("订单号:"+tOrderPrivateCar.getOrderNum()); |
| | | } |
| | | // 查询已领取红包总额 |
| | | for (UserRedPacketRecord userRedPacketRecord : userRedPacketRecords) { |
| | | for (TOrderPrivateCar userRedPacketRecord : userRedPacketRecords) { |
| | | if (userRedPacketRecord.getState() != 9 &&userRedPacketRecord.getState() != 8){ |
| | | continue; |
| | | } |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(userRedPacketRecord.getInsertTime())); |
| | | grantVO.setType("红包"); |
| | | grantVO.setAmount(userRedPacketRecord.getMoney().toString()); |
| | | grantVO.setAmount(userRedPacketRecord.getPayMoney().toString()); |
| | | TUser tUser = appUserService.selectById(userRedPacketRecord.getUserId()); |
| | | if (tUser!=null){ |
| | | grantVO.setName(tUser.getNickName()); |
| | | } |
| | | UserActivityRedenvelope userActivityRedenvelope = |
| | | userActivityRedenvelopeService.selectById(userRedPacketRecord.getRedPacketActivityId()); |
| | | if (userActivityRedenvelope!=null){ |
| | | UserActivity userActivity = userActivityService.selectById(userActivityRedenvelope.getUserActivityId()); |
| | | if (userActivity!=null){ |
| | | grantVO.setRemark(userActivity.getName()); |
| | | } |
| | | } |
| | | grantVO.setRemark("订单号:"+userRedPacketRecord.getOrderNum()); |
| | | res.add(grantVO); |
| | | redPackage = redPackage.add(new BigDecimal(userRedPacketRecord.getMoney().toString())); |
| | | redPackage = redPackage.add(new BigDecimal(userRedPacketRecord.getPayMoney().toString())); |
| | | } |
| | | for (TOrderLogistics userRedPacketRecord : userRedPacketRecords1) { |
| | | if (userRedPacketRecord.getState() != 9 &&userRedPacketRecord.getState() != 8){ |
| | | continue; |
| | | } |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(userRedPacketRecord.getInsertTime())); |
| | | grantVO.setType("红包"); |
| | | grantVO.setAmount(userRedPacketRecord.getPayMoney().toString()); |
| | | TUser tUser = appUserService.selectById(userRedPacketRecord.getUserId()); |
| | | if (tUser!=null){ |
| | | grantVO.setName(tUser.getNickName()); |
| | | } |
| | | grantVO.setRemark("订单号:"+userRedPacketRecord.getOrderNum()); |
| | | res.add(grantVO); |
| | | redPackage = redPackage.add(new BigDecimal(userRedPacketRecord.getPayMoney().toString())); |
| | | } |
| | | // 查询已领取优惠券总额 |
| | | for (UserCouponRecord userCouponRecord : userCouponRecords) { |
| | | for (TOrderPrivateCar userCouponRecord : userCouponRecords) { |
| | | if (userCouponRecord.getState() != 9 &&userCouponRecord.getState() != 8){ |
| | | continue; |
| | | } |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(userCouponRecord.getInsertTime())); |
| | | grantVO.setType("优惠券"); |
| | | grantVO.setAmount(userCouponRecord.getMoney().toString()); |
| | | grantVO.setAmount(userCouponRecord.getPayMoney().toString()); |
| | | TUser tUser = appUserService.selectById(userCouponRecord.getUserId()); |
| | | if (tUser!=null){ |
| | | grantVO.setName(tUser.getNickName()); |
| | | } |
| | | SysCouponRecord sysCouponRecord = |
| | | sysCouponRecordService.selectById(userCouponRecord.getCouponId()); |
| | | if (sysCouponRecord!=null){ |
| | | grantVO.setRemark(sysCouponRecord.getName()); |
| | | } |
| | | coupon = coupon.add(new BigDecimal(userCouponRecord.getMoney().toString())); |
| | | grantVO.setRemark("订单号:"+userCouponRecord.getOrderNum()); |
| | | coupon = coupon.add(new BigDecimal(userCouponRecord.getPayMoney().toString())); |
| | | res.add(grantVO); |
| | | } |
| | | // 已领取司机奖励 |
| | | for (DriverActivityHistory driverActivityHistory : driverActivityHistories) { |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(driverActivityHistory.getInsertTime())); |
| | | grantVO.setType("司机奖励"); |
| | | grantVO.setAmount(driverActivityHistory.getMoney().toString()); |
| | | TDriver tDriver = driverService.selectById(driverActivityHistory.getDriverId()); |
| | | if (tDriver!=null){ |
| | | grantVO.setName(tDriver.getFirstName()+tDriver.getLastName()); |
| | | for (TOrderLogistics userCouponRecord : userCouponRecords1) { |
| | | if (userCouponRecord.getState() != 9 &&userCouponRecord.getState() != 8){ |
| | | continue; |
| | | } |
| | | Integer type1 = driverActivityHistory.getType(); |
| | | switch (type1){ |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(userCouponRecord.getInsertTime())); |
| | | grantVO.setType("优惠券"); |
| | | grantVO.setAmount(userCouponRecord.getPayMoney().toString()); |
| | | TUser tUser = appUserService.selectById(userCouponRecord.getUserId()); |
| | | if (tUser!=null){ |
| | | grantVO.setName(tUser.getNickName()); |
| | | } |
| | | grantVO.setRemark("订单号:"+userCouponRecord.getOrderNum()); |
| | | coupon = coupon.add(new BigDecimal(userCouponRecord.getPayMoney().toString())); |
| | | res.add(grantVO); |
| | | } |
| | | // 司机消费奖励 |
| | | for (BalanceUsageRecord balanceUsageRecord : balanceUsageRecords) { |
| | | |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(balanceUsageRecord.getCreateTime())); |
| | | grantVO.setType("司机奖励"); |
| | | grantVO.setAmount(balanceUsageRecord.getMoney().toString()); |
| | | TDriver tUser = driverService.selectById(balanceUsageRecord.getDriverId()); |
| | | if (tUser!=null){ |
| | | grantVO.setName(tUser.getFirstName()+tUser.getLastName()); |
| | | } |
| | | switch (balanceUsageRecord.getPurpose()){ |
| | | case 1: |
| | | grantVO.setRemark("邀请司机注册"); |
| | | //打车支付 |
| | | grantVO.setRemark("余额支付"+"【打车支付】"); |
| | | break; |
| | | case 2: |
| | | grantVO.setRemark("邀请用户注册"); |
| | | grantVO.setRemark("余额支付"+"【包裹支付】"); |
| | | // 包裹支付 |
| | | break; |
| | | case 3: |
| | | grantVO.setRemark("累计在线"); |
| | | grantVO.setRemark("余额支付"+"【日结算】"); |
| | | // 日结算 |
| | | break; |
| | | case 4: |
| | | grantVO.setRemark("订单量"); |
| | | grantVO.setRemark("余额支付"+"【周结算】"); |
| | | // 周结算 |
| | | break; |
| | | case 5: |
| | | grantVO.setRemark("余额支付"+"【月结算】"); |
| | | // 月结算 |
| | | break; |
| | | } |
| | | driver = driver.add(new BigDecimal(driverActivityHistory.getMoney().toString())); |
| | | driverConsume = driverConsume.add(new BigDecimal(balanceUsageRecord.getMoney().toString())); |
| | | res.add(grantVO); |
| | | } |
| | | total = total.add(redPackage).add(coupon).add(discount).add(driver); |
| | | result.setTotal(total); |
| | | result.setDiscount(discount); |
| | | result.setCoupon(coupon); |
| | | result.setDriver(driver); |
| | | result.setRedPackage(redPackage); |
| | | return result; |
| | | // 司机提现 |
| | | for (BalanceUsageRecord balanceUsageRecord : driverWithdrawal) { |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(balanceUsageRecord.getCreateTime())); |
| | | grantVO.setType("司机奖励"); |
| | | grantVO.setAmount(balanceUsageRecord.getMoney().toString()); |
| | | TDriver tUser = driverService.selectById(balanceUsageRecord.getDriverId()); |
| | | if (tUser!=null){ |
| | | grantVO.setName(tUser.getFirstName()+tUser.getLastName()); |
| | | } |
| | | switch (balanceUsageRecord.getPurpose()){ |
| | | case 6: |
| | | grantVO.setRemark("司机提现"); |
| | | break; |
| | | } |
| | | driverWithdrawal1 = driverWithdrawal1.add(new BigDecimal(balanceUsageRecord.getMoney().toString())); |
| | | res.add(grantVO); |
| | | } |
| | | |
| | | // 总额 |
| | | total = total.add(redPackage).add(coupon).add(discount).add(driverConsume).add(driverWithdrawal1); |
| | | // 已使用司机奖励合计 |
| | | driver = driverConsume.add(driverWithdrawal1); |
| | | UseMoneyVO useMoneyVO = new UseMoneyVO(); |
| | | useMoneyVO.setTotal(total); |
| | | useMoneyVO.setDiscount(discount); |
| | | useMoneyVO.setRedPackage(redPackage); |
| | | useMoneyVO.setCoupon(coupon); |
| | | useMoneyVO.setDriver(driver); |
| | | useMoneyVO.setDriverWithdrawal(driverWithdrawal1); |
| | | useMoneyVO.setDriverConsume(driverConsume); |
| | | |
| | | return useMoneyVO; |
| | | } |
| | | |
| | | /** |
| | | * 发放补贴统计 |
| | | */ |
| | |
| | | break; |
| | | } |
| | | } |
| | | Page<Map<String,Object>> page = new PageFactory<Map<String,Object>>().defaultPage(); |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // 列表res |
| | | List<GrantVO> res = new ArrayList<>(); |
| | |
| | | |
| | | // 专车wrapper |
| | | Wrapper<TOrderPrivateCar> between = new EntityWrapper<TOrderPrivateCar>() |
| | | .eq("state", 8) |
| | | .eq("state", 9) |
| | | .isNotNull("activityId") |
| | | .isNotNull("discountMoney") |
| | | .between("insertTime", start, end); |
| | | .between("insertTime", start, end) |
| | | |
| | | ; |
| | | // 小件物流wrapper |
| | | Wrapper<TOrderLogistics> between1 = new EntityWrapper<TOrderLogistics>() |
| | | .eq("state", 8) |
| | | .eq("state", 9) |
| | | .isNotNull("activityId") |
| | | .between("insertTime", start, end) |
| | | .isNotNull("discountMoney") |
| | | .between("insertTime", start, end); |
| | | |
| | | |
| | | ; |
| | | // 优惠券领取记录wrapper |
| | | Wrapper<UserCouponRecord> between2 = new EntityWrapper<UserCouponRecord>() |
| | | .ne("couponUseType", 2) |
| | |
| | | BigDecimal driver = new BigDecimal("0"); |
| | | // 查询已使用折扣总额 |
| | | for (TOrderPrivateCar tOrderPrivateCar : tOrderPrivateCars) { |
| | | if (tOrderPrivateCar.getDiscountMoney()==null){ |
| | | continue; |
| | | } |
| | | if (tOrderPrivateCar.getState() != 8 && tOrderPrivateCar.getState()!=9){ |
| | | continue; |
| | | |
| | | } |
| | | discount = discount.add(new BigDecimal(tOrderPrivateCar.getDiscountMoney().toString())); |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(tOrderPrivateCar.getInsertTime())); |
| | |
| | | grantVO.setRemark(userActivity.getName()); |
| | | } |
| | | } |
| | | res.add(grantVO); |
| | | } |
| | | for (TOrderLogistics tOrderPrivateCar : tOrderLogistics) { |
| | | if (tOrderPrivateCar.getDiscountMoney()==null){ |
| | | continue; |
| | | } |
| | | if (tOrderPrivateCar.getState() != 9 &&tOrderPrivateCar.getState() != 8){ |
| | | continue; |
| | | } |
| | | discount = discount.add(new BigDecimal(tOrderPrivateCar.getDiscountMoney().toString())); |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(tOrderPrivateCar.getInsertTime())); |
| | | grantVO.setType("折扣"); |
| | | |
| | | grantVO.setAmount(tOrderPrivateCar.getDiscountMoney().toString()); |
| | | TUser tUser = appUserService.selectById(tOrderPrivateCar.getUserId()); |
| | | if (tUser!=null){ |
| | |
| | | grantVO.setRemark(userActivity.getName()); |
| | | } |
| | | } |
| | | res.add(grantVO); |
| | | } |
| | | // 查询已领取红包总额 |
| | | for (UserRedPacketRecord userRedPacketRecord : userRedPacketRecords) { |
| | |
| | | |
| | | // 专车wrapper |
| | | Wrapper<TOrderPrivateCar> between = new EntityWrapper<TOrderPrivateCar>() |
| | | .eq("state", 8) |
| | | .eq("state", 9) |
| | | .isNotNull("activityId") |
| | | .between("insertTime", start, end) |
| | | .isNotNull("discountMoney") |
| | | .between("insertTime", start, end); |
| | | // .eq("state", 8) |
| | | // .or() |
| | | // .eq("state", 9) |
| | | ; |
| | | // 小件物流wrapper |
| | | Wrapper<TOrderLogistics> between1 = new EntityWrapper<TOrderLogistics>() |
| | | .eq("state", 8) |
| | | .eq("state", 9) |
| | | .isNotNull("activityId") |
| | | .between("insertTime", start, end) |
| | | .isNotNull("discountMoney") |
| | | .between("insertTime", start, end); |
| | | // .eq("state", 8) |
| | | // .or() |
| | | // .eq("state", 9) |
| | | ; |
| | | // 优惠券领取记录wrapper |
| | | Wrapper<UserCouponRecord> between2 = new EntityWrapper<UserCouponRecord>() |
| | | .ne("couponUseType", 2) |
| | |
| | | BigDecimal driver = new BigDecimal("0"); |
| | | // 查询已使用折扣总额 |
| | | for (TOrderPrivateCar tOrderPrivateCar : tOrderPrivateCars) { |
| | | if (tOrderPrivateCar.getDiscountMoney()== null){ |
| | | continue; |
| | | } |
| | | if (tOrderPrivateCar.getState() != 9 &&tOrderPrivateCar.getState() != 8){ |
| | | continue; |
| | | } |
| | | discount = discount.add(new BigDecimal(tOrderPrivateCar.getDiscountMoney().toString())); |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(tOrderPrivateCar.getInsertTime())); |
| | |
| | | grantVO.setRemark(userActivity.getName()); |
| | | } |
| | | } |
| | | res.add(grantVO); |
| | | } |
| | | for (TOrderLogistics tOrderPrivateCar : tOrderLogistics) { |
| | | if (tOrderPrivateCar.getDiscountMoney()== null){ |
| | | continue; |
| | | } |
| | | if (tOrderPrivateCar.getState() != 9 &&tOrderPrivateCar.getState() != 8){ |
| | | continue; |
| | | } |
| | | discount = discount.add(new BigDecimal(tOrderPrivateCar.getDiscountMoney().toString())); |
| | | GrantVO grantVO = new GrantVO(); |
| | | grantVO.setInsertTime(format.format(tOrderPrivateCar.getInsertTime())); |
| | |
| | | grantVO.setRemark(userActivity.getName()); |
| | | } |
| | | } |
| | | res.add(grantVO); |
| | | } |
| | | // 查询已领取红包总额 |
| | | for (UserRedPacketRecord userRedPacketRecord : userRedPacketRecords) { |
| | |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | /** |
| | | * 操作司机状态 |
| | | */ |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | |
| | | private IDriverAssessmentService driverAssessmentService; |
| | | @Autowired |
| | | private ITSysOverTimeService sysOverTimeService; |
| | | @Autowired |
| | | private IRedEnvelopePaymentSettingsService redEnvelopePaymentSettingsService; |
| | | |
| | | /** |
| | | * 2.0新增红包支付设置 |
| | |
| | | List<String> strings = new ArrayList<>(); |
| | | strings.add("updateTime"); |
| | | // 查询生效的红包折扣比例 |
| | | List<TSysRedSet> isDelete = sysRedSetService.selectList(new EntityWrapper<TSysRedSet>() |
| | | .eq("isDelete", 0) |
| | | List<RedEnvelopePaymentSettings> isDelete = redEnvelopePaymentSettingsService.selectList(new EntityWrapper<RedEnvelopePaymentSettings>() |
| | | .eq("status", 1) |
| | | .orderDesc(strings)); |
| | | if (isDelete.size()>0){ |
| | | model.addAttribute("new",isDelete.get(0).getProportion()); |
| | | model.addAttribute("new",isDelete.get(0).getDeductionRatio()); |
| | | }else{ |
| | | model.addAttribute("new","_"); |
| | | } |
| | |
| | | } |
| | | @RequestMapping("/redSet/updateHtml/{id}") |
| | | public String updateHtml(@PathVariable("id") Integer id,Model model) { |
| | | TSysRedSet tSysRedSet = sysRedSetService.selectById(id); |
| | | RedEnvelopePaymentSettings tSysRedSet = redEnvelopePaymentSettingsService.selectById(id); |
| | | List<String> strings = new ArrayList<>(); |
| | | strings.add("updateTime"); |
| | | // 查询生效的红包折扣比例 |
| | | List<TSysRedSet> isDelete = sysRedSetService.selectList(new EntityWrapper<TSysRedSet>() |
| | | .eq("isDelete", 0) |
| | | List<RedEnvelopePaymentSettings> isDelete = redEnvelopePaymentSettingsService.selectList(new EntityWrapper<RedEnvelopePaymentSettings>() |
| | | .eq("status", 1) |
| | | .orderDesc(strings)); |
| | | if (isDelete.size()>0){ |
| | | model.addAttribute("new",isDelete.get(0).getProportion()); |
| | | model.addAttribute("new",isDelete.get(0).getDeductionRatio()); |
| | | }else{ |
| | | model.addAttribute("new","_"); |
| | | } |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"); |
| | | String format = simpleDateFormat.format(tSysRedSet.getStartTime()); |
| | | String format = simpleDateFormat.format(tSysRedSet.getEffectiveDate()); |
| | | |
| | | model.addAttribute("time",format); |
| | | model.addAttribute("data",tSysRedSet); |
| | |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(sysRedSetService.getList(page)); |
| | | List<Map<String, Object>> list = sysRedSetService.getList(page); |
| | | for (Map<String, Object> stringObjectMap : list) { |
| | | stringObjectMap.put(stringObjectMap.get("deductionRatio").toString(),stringObjectMap.get("deductionRatio")+"%"); |
| | | } |
| | | page.setRecords(list); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | |
| | | @ResponseBody |
| | | public Object redSetAdd(String proportion, String startTime) throws ParseException { |
| | | // 新增红包设置 |
| | | TSysRedSet tSysRedSet = new TSysRedSet(); |
| | | RedEnvelopePaymentSettings tSysRedSet = new RedEnvelopePaymentSettings(); |
| | | RedEnvelopePaymentSettings redEnvelopePaymentSettings = new RedEnvelopePaymentSettings(); |
| | | String name = ShiroKit.getUser().getName(); |
| | | tSysRedSet.setHandle(name); |
| | | tSysRedSet.setProportion(proportion); |
| | | |
| | | tSysRedSet.setInsertUserId(ShiroKit.getUser().getId()); |
| | | |
| | | tSysRedSet.setDeductionRatio(new BigDecimal(proportion)); |
| | | String replace = startTime.replace("T", " "); |
| | | String s = replace + ":00"; |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date date = dateFormat.parse(s); |
| | | tSysRedSet.setStartTime(date); |
| | | sysRedSetService.insert(tSysRedSet); |
| | | tSysRedSet.setInsertTime(new Date()); |
| | | tSysRedSet.setEffectiveDate(date); |
| | | tSysRedSet.setStatus(1); |
| | | redEnvelopePaymentSettingsService.insert(tSysRedSet); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | public Object redSetUpdate(Integer id,String proportion, String startTime) throws ParseException { |
| | | // 修改红包设置 |
| | | TSysRedSet tSysRedSet = sysRedSetService.selectById(id); |
| | | RedEnvelopePaymentSettings tSysRedSet = redEnvelopePaymentSettingsService.selectById(id); |
| | | String name = ShiroKit.getUser().getName(); |
| | | tSysRedSet.setHandle(name); |
| | | tSysRedSet.setProportion(proportion); |
| | | tSysRedSet.setInsertUserId(ShiroKit.getUser().getId()); |
| | | tSysRedSet.setDeductionRatio(new BigDecimal(proportion)); |
| | | String replace = startTime.replace("T", " "); |
| | | String s = replace + ":00"; |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date date = dateFormat.parse(s); |
| | | tSysRedSet.setStartTime(date); |
| | | tSysRedSet.setInsertTime(date); |
| | | tSysRedSet.setUpdateTime(new Date()); |
| | | sysRedSetService.updateById(tSysRedSet); |
| | | redEnvelopePaymentSettingsService.updateById(tSysRedSet); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | public Object redSetDelete(Integer id) { |
| | | // 删除红包设置 |
| | | TSysRedSet tSysRedSet = sysRedSetService.selectById(id); |
| | | tSysRedSet.setIsDelete(1); |
| | | sysRedSetService.updateById(tSysRedSet); |
| | | RedEnvelopePaymentSettings tSysRedSet = redEnvelopePaymentSettingsService.selectById(id); |
| | | tSysRedSet.setStatus(3); |
| | | redEnvelopePaymentSettingsService.updateById(tSysRedSet); |
| | | return SUCCESS_TIP; |
| | | } |
| | | /** |
| | |
| | | |
| | | //普通取消设置(专车) |
| | | TSysCancleOrder ptCancel1 = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>() |
| | | .eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1).eq("orderType", 1)); |
| | | .eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("ptCancel1",ptCancel1); |
| | | //普通取消设置(出租车) |
| | | TSysCancleOrder ptCancel2 = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>() |
| | | .eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1).eq("orderType", 2)); |
| | | .eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("ptCancel2",ptCancel2); |
| | | //普通取消设置(跨城出行) |
| | | TSysCancleOrder ptCancel3 = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1).eq("orderType", 3)); |
| | | TSysCancleOrder ptCancel3 = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("ptCancel3",ptCancel3); |
| | | |
| | | // 司机超时 |
| | | JSONObject jsonObject = JSON.parseObject(ptCancel1.getContent()); |
| | | model.addAttribute("driverTimeout",jsonObject.getIntValue("driverTimeout")); |
| | | // 订单取消规则 |
| | | JSONObject order = jsonObject.getJSONObject("order"); |
| | | String orderAcceptanceTime = order.getString("orderAcceptanceTime"); |
| | | String money = order.getString("money"); |
| | | String mileageFee = order.getString("mileageFee"); |
| | | String durationFee = order.getString("durationFee"); |
| | | // 接单xx分钟后 |
| | | model.addAttribute("orderAcceptanceTime",orderAcceptanceTime); |
| | | // 取消订单金额 |
| | | model.addAttribute("money",money); |
| | | // 时长费 |
| | | model.addAttribute("mileageFee",mileageFee); |
| | | // 分钟 |
| | | model.addAttribute("durationFee",durationFee); |
| | | // 预约单取消规则 |
| | | JSONObject reservationOrder = jsonObject.getJSONObject("reservationOrder"); |
| | | String orderAcceptanceTime1 = reservationOrder.getString("orderAcceptanceTime"); |
| | | String money1 = reservationOrder.getString("money"); |
| | | String mileageFee1 = reservationOrder.getString("mileageFee"); |
| | | String durationFee1 = reservationOrder.getString("durationFee"); |
| | | String reservationFee = reservationOrder.getString("reservationFee"); |
| | | // 预约单接单xx分钟后 |
| | | model.addAttribute("orderAcceptanceTime1",orderAcceptanceTime1); |
| | | // 预约单取消订单金额 |
| | | model.addAttribute("money1",money1); |
| | | // 预约单时长费 |
| | | model.addAttribute("mileageFee1",mileageFee1); |
| | | // 预约单分钟 |
| | | model.addAttribute("durationFee1",durationFee1); |
| | | // 预定费用 |
| | | model.addAttribute("reservationFee",reservationFee); |
| | | // 超时设置 |
| | | |
| | | TSysOverTime overTime = sysOverTimeService.selectOne(new EntityWrapper<TSysOverTime>().eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("overTime",overTime); |
| | | |
| | | //预约取消设置(专车) |
| | | TSysCancleOrder yyCancel1 = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 2).eq("orderType", 1)); |
| | | TSysCancleOrder yyCancel1 = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("yyCancel1",yyCancel1); |
| | | //预约取消设置(出租车) |
| | | TSysCancleOrder yyCancel2 = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 2).eq("orderType", 2)); |
| | | TSysCancleOrder yyCancel2 = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("yyCancel2",yyCancel2); |
| | | |
| | | //报警电话 |
| | |
| | | //司机考勤 |
| | | DriverAssessment driverAssessment = driverAssessmentService.selectOne(new EntityWrapper<DriverAssessment>().eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("assessment", driverAssessment == null ? "" : driverAssessment.getAssessment()); |
| | | // 超时设置 |
| | | TSysOverTime overTime = sysOverTimeService.selectOne(new EntityWrapper<TSysOverTime>() |
| | | .eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("overTime", overTime); |
| | | |
| | | |
| | | return PREFIX + "tSysReformist.html"; |
| | | } |
| | |
| | | @RequestParam Double czc7,@RequestParam Integer czc8,@RequestParam Double czc9, |
| | | @RequestParam Double zcAssignOrder,@RequestParam Double czcAssignOrder, |
| | | @RequestParam Integer zcPeople,@RequestParam Integer czcPeople, |
| | | @RequestParam Integer ptCancel1,@RequestParam BigDecimal ptCancel2,@RequestParam Integer ptCancel3,@RequestParam BigDecimal ptCancel4,@RequestParam Integer ptCancel5,@RequestParam BigDecimal ptCancel6, |
| | | @RequestParam Integer yyCancel1,@RequestParam BigDecimal yyCancel2,@RequestParam Integer yyCancel3,@RequestParam BigDecimal yyCancel4, |
| | | @RequestParam Integer ptCancel1,@RequestParam String ptCancel2,@RequestParam Integer ptCancel3,@RequestParam BigDecimal ptCancel4,@RequestParam Integer ptCancel5,@RequestParam BigDecimal ptCancel6, |
| | | @RequestParam Integer yyCancel1,@RequestParam String yyCancel2,@RequestParam Integer yyCancel3,@RequestParam BigDecimal yyCancel4, |
| | | @RequestParam String phone1,@RequestParam String phone2,@RequestParam String phone3,@RequestParam String assessment, |
| | | |
| | | @RequestParam String km,@RequestParam Integer kmMinute,@RequestParam String km2, |
| | | @RequestParam Integer kmMinute2, |
| | | @RequestParam String km,@RequestParam String kmMinute,@RequestParam String km2, |
| | | @RequestParam String kmMinute2, |
| | | @RequestParam Integer overtime,@RequestParam Integer overtime1,@RequestParam Integer packageTime, |
| | | @RequestParam Integer reserveTime, |
| | | @RequestParam Integer reserveNext,@RequestParam String reserveMoney |
| | |
| | | assignOrder.setPeople(czcPeople); |
| | | assignOrderService.insert(assignOrder1); |
| | | } |
| | | |
| | | //普通取消设置(专车) |
| | | TSysCancleOrder ptCancelOne = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1).eq("orderType", 1)); |
| | | if (SinataUtil.isNotEmpty(ptCancelOne)){ |
| | | ptCancelOne.setMinuteNum(ptCancel1); |
| | | ptCancelOne.setMoney(ptCancel2); |
| | | |
| | | ptCancelOne.setKm(Integer.valueOf(km)); |
| | | ptCancelOne.setKmMinute(kmMinute); |
| | | ptCancelOne.setOvertime(overtime); |
| | | |
| | | tSysCancleOrderService.updateById(ptCancelOne); |
| | | }else{ |
| | | ptCancelOne = new TSysCancleOrder(); |
| | | ptCancelOne.setMinuteNum(ptCancel1); |
| | | ptCancelOne.setMoney(ptCancel2); |
| | | ptCancelOne.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | ptCancelOne.setType(1); |
| | | ptCancelOne.setOrderType(1); |
| | | ptCancelOne.setKm(Integer.valueOf(km)); |
| | | ptCancelOne.setKmMinute(kmMinute); |
| | | ptCancelOne.setOvertime(overtime); |
| | | |
| | | tSysCancleOrderService.insert(ptCancelOne); |
| | | TSysCancleOrder cancleOrder = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | // {"order":{"orderAcceptanceTime":5,"money":2.5,"mileageFee":1,"durationFee":0.5},"reservationOrder":{"orderAcceptanceTime":5,"money":2.5,"mileageFee":1,"durationFee":0.5,"reservationFee":5},"driverTimeout":10} |
| | | // 将数据拼接为json格式存储 |
| | | if (ptCancel1 == null){ |
| | | ptCancel1 = 0; |
| | | } |
| | | |
| | | //普通取消设置(出租车) |
| | | TSysCancleOrder ptCancelTwo = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1).eq("orderType", 2)); |
| | | if (SinataUtil.isNotEmpty(ptCancelTwo)){ |
| | | ptCancelTwo.setMinuteNum(ptCancel3); |
| | | ptCancelTwo.setMoney(ptCancel4); |
| | | |
| | | ptCancelTwo.setKm(Integer.valueOf(km)); |
| | | ptCancelTwo.setKmMinute(kmMinute); |
| | | ptCancelTwo.setOvertime(overtime); |
| | | tSysCancleOrderService.updateById(ptCancelTwo); |
| | | }else{ |
| | | ptCancelTwo = new TSysCancleOrder(); |
| | | ptCancelTwo.setMinuteNum(ptCancel3); |
| | | ptCancelTwo.setMoney(ptCancel4); |
| | | ptCancelTwo.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | |
| | | ptCancelTwo.setKm(Integer.valueOf(km)); |
| | | ptCancelTwo.setKmMinute(kmMinute); |
| | | ptCancelTwo.setOvertime(overtime); |
| | | ptCancelTwo.setType(1); |
| | | ptCancelTwo.setOrderType(2); |
| | | tSysCancleOrderService.insert(ptCancelTwo); |
| | | if (ptCancel2 == null){ |
| | | ptCancel2 = "0"; |
| | | } |
| | | |
| | | //普通取消设置(跨城出行) |
| | | TSysCancleOrder ptCancelThree = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1).eq("orderType", 3)); |
| | | if (SinataUtil.isNotEmpty(ptCancelThree)){ |
| | | ptCancelThree.setMinuteNum(ptCancel5); |
| | | ptCancelThree.setMoney(ptCancel6); |
| | | |
| | | BigDecimal bigDecimal1 = new BigDecimal(reserveMoney); |
| | | ptCancelThree.setKm(Integer.valueOf(km)); |
| | | ptCancelThree.setKmMinute(kmMinute); |
| | | ptCancelThree.setOvertime(overtime); |
| | | ptCancelThree.setReserveMoney(bigDecimal1); |
| | | tSysCancleOrderService.updateById(ptCancelThree); |
| | | }else{ |
| | | ptCancelThree = new TSysCancleOrder(); |
| | | ptCancelThree.setMinuteNum(ptCancel5); |
| | | ptCancelThree.setMoney(ptCancel6); |
| | | ptCancelThree.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | ptCancelThree.setType(1); |
| | | ptCancelThree.setOrderType(3); |
| | | |
| | | BigDecimal bigDecimal1 = new BigDecimal(reserveMoney); |
| | | ptCancelThree.setKm(Integer.valueOf(km)); |
| | | ptCancelThree.setKmMinute(kmMinute); |
| | | ptCancelThree.setOvertime(overtime); |
| | | ptCancelThree.setReserveMoney(bigDecimal1); |
| | | tSysCancleOrderService.insert(ptCancelThree); |
| | | if (yyCancel2 == null){ |
| | | yyCancel2 = "0"; |
| | | } |
| | | |
| | | //预约取消设置(专车) |
| | | TSysCancleOrder yyCancelOne = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 2).eq("orderType", 1)); |
| | | if (SinataUtil.isNotEmpty(yyCancelOne)){ |
| | | yyCancelOne.setMinuteNum(yyCancel1); |
| | | yyCancelOne.setMoney(yyCancel2); |
| | | |
| | | BigDecimal bigDecimal1 = new BigDecimal(reserveMoney); |
| | | yyCancelOne.setKm(Integer.valueOf(km2)); |
| | | yyCancelOne.setKmMinute(kmMinute2); |
| | | yyCancelOne.setOvertime(overtime); |
| | | yyCancelOne.setReserveMoney(bigDecimal1); |
| | | tSysCancleOrderService.updateById(yyCancelOne); |
| | | }else{ |
| | | yyCancelOne = new TSysCancleOrder(); |
| | | yyCancelOne.setMinuteNum(yyCancel1); |
| | | yyCancelOne.setMoney(yyCancel2); |
| | | yyCancelOne.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | yyCancelOne.setType(2); |
| | | yyCancelOne.setOrderType(1); |
| | | |
| | | BigDecimal bigDecimal1 = new BigDecimal(reserveMoney); |
| | | yyCancelOne.setKm(Integer.valueOf(km2)); |
| | | yyCancelOne.setKmMinute(kmMinute2); |
| | | yyCancelOne.setOvertime(overtime); |
| | | yyCancelOne.setReserveMoney(bigDecimal1); |
| | | tSysCancleOrderService.insert(yyCancelOne); |
| | | if (yyCancel1 == null){ |
| | | yyCancel1 = 0; |
| | | } |
| | | //预约取消设置(出租车) |
| | | TSysCancleOrder yyCancelTwo = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 2).eq("orderType", 2)); |
| | | if (SinataUtil.isNotEmpty(yyCancelTwo)){ |
| | | yyCancelTwo.setMinuteNum(yyCancel3); |
| | | yyCancelTwo.setMoney(yyCancel4); |
| | | BigDecimal bigDecimal1 = new BigDecimal(reserveMoney); |
| | | yyCancelTwo.setKm(Integer.valueOf(km2)); |
| | | yyCancelTwo.setKmMinute(kmMinute2); |
| | | yyCancelTwo.setOvertime(overtime); |
| | | yyCancelTwo.setReserveMoney(bigDecimal1); |
| | | tSysCancleOrderService.updateById(yyCancelTwo); |
| | | }else{ |
| | | yyCancelTwo = new TSysCancleOrder(); |
| | | yyCancelTwo.setMinuteNum(yyCancel3); |
| | | yyCancelTwo.setMoney(yyCancel4); |
| | | yyCancelTwo.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | yyCancelTwo.setType(2); |
| | | yyCancelTwo.setOrderType(2); |
| | | |
| | | BigDecimal bigDecimal1 = new BigDecimal(reserveMoney); |
| | | yyCancelTwo.setKm(Integer.valueOf(km2)); |
| | | yyCancelTwo.setKmMinute(kmMinute2); |
| | | yyCancelTwo.setOvertime(overtime); |
| | | yyCancelTwo.setReserveMoney(bigDecimal1); |
| | | tSysCancleOrderService.insert(yyCancelTwo); |
| | | if (km == null){ |
| | | km = "0"; |
| | | }if (kmMinute == null){ |
| | | kmMinute = "0"; |
| | | } |
| | | if (km2 == null){ |
| | | km2 = "0"; |
| | | }if (kmMinute2 == null){ |
| | | kmMinute2 = "0"; |
| | | }if (reserveMoney == null){ |
| | | reserveMoney = "0"; |
| | | }if (overtime == null){ |
| | | overtime = 0; |
| | | } |
| | | String result = "{\""+"order\":{\"orderAcceptanceTime\":"+ptCancel1+","+"\"money\":"+ptCancel2+","+"\"mileageFee\":"+km+","+"\"durationFee\":"+kmMinute+"},"+"\"reservationOrder\":{\"orderAcceptanceTime\":"+yyCancel1+","+"\"money\":"+yyCancel2+","+"\"mileageFee\":"+km2+","+"\"durationFee\":"+kmMinute2+","+"\"reservationFee\":"+reserveMoney+"},"+"\"driverTimeout\":"+overtime+"}"; |
| | | System.err.println("看看"); |
| | | System.err.println(result); |
| | | cancleOrder.setContent(result); |
| | | tSysCancleOrderService.updateById(cancleOrder); |
| | | // JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); |
| | | // map.put("timeOutCancel", jsonObject.getIntValue("driverTimeout")); |
| | | // //普通取消设置(专车) |
| | | // TSysCancleOrder ptCancelOne = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1).eq("orderType", 1)); |
| | | // if (SinataUtil.isNotEmpty(ptCancelOne)){ |
| | | // ptCancelOne.setMinuteNum(ptCancel1); |
| | | // ptCancelOne.setMoney(ptCancel2); |
| | | // |
| | | // ptCancelOne.setKm(Integer.valueOf(km)); |
| | | // ptCancelOne.setKmMinute(kmMinute); |
| | | // ptCancelOne.setOvertime(overtime); |
| | | // |
| | | // tSysCancleOrderService.updateById(ptCancelOne); |
| | | // }else{ |
| | | // ptCancelOne = new TSysCancleOrder(); |
| | | // ptCancelOne.setMinuteNum(ptCancel1); |
| | | // ptCancelOne.setMoney(ptCancel2); |
| | | // ptCancelOne.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | // ptCancelOne.setType(1); |
| | | // ptCancelOne.setOrderType(1); |
| | | // ptCancelOne.setKm(Integer.valueOf(km)); |
| | | // ptCancelOne.setKmMinute(kmMinute); |
| | | // ptCancelOne.setOvertime(overtime); |
| | | // |
| | | // tSysCancleOrderService.insert(ptCancelOne); |
| | | // } |
| | | // |
| | | // //普通取消设置(出租车) |
| | | // TSysCancleOrder ptCancelTwo = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1).eq("orderType", 2)); |
| | | // if (SinataUtil.isNotEmpty(ptCancelTwo)){ |
| | | // ptCancelTwo.setMinuteNum(ptCancel3); |
| | | // ptCancelTwo.setMoney(ptCancel4); |
| | | // |
| | | // ptCancelTwo.setKm(Integer.valueOf(km)); |
| | | // ptCancelTwo.setKmMinute(kmMinute); |
| | | // ptCancelTwo.setOvertime(overtime); |
| | | // tSysCancleOrderService.updateById(ptCancelTwo); |
| | | // }else{ |
| | | // ptCancelTwo = new TSysCancleOrder(); |
| | | // ptCancelTwo.setMinuteNum(ptCancel3); |
| | | // ptCancelTwo.setMoney(ptCancel4); |
| | | // ptCancelTwo.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | // |
| | | // ptCancelTwo.setKm(Integer.valueOf(km)); |
| | | // ptCancelTwo.setKmMinute(kmMinute); |
| | | // ptCancelTwo.setOvertime(overtime); |
| | | // ptCancelTwo.setType(1); |
| | | // ptCancelTwo.setOrderType(2); |
| | | // tSysCancleOrderService.insert(ptCancelTwo); |
| | | // } |
| | | // |
| | | // //普通取消设置(跨城出行) |
| | | // TSysCancleOrder ptCancelThree = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1).eq("orderType", 3)); |
| | | // if (SinataUtil.isNotEmpty(ptCancelThree)){ |
| | | // ptCancelThree.setMinuteNum(ptCancel5); |
| | | // ptCancelThree.setMoney(ptCancel6); |
| | | // |
| | | // BigDecimal bigDecimal1 = new BigDecimal(reserveMoney); |
| | | // ptCancelThree.setKm(Integer.valueOf(km)); |
| | | // ptCancelThree.setKmMinute(kmMinute); |
| | | // ptCancelThree.setOvertime(overtime); |
| | | // ptCancelThree.setReserveMoney(bigDecimal1); |
| | | // tSysCancleOrderService.updateById(ptCancelThree); |
| | | // }else{ |
| | | // ptCancelThree = new TSysCancleOrder(); |
| | | // ptCancelThree.setMinuteNum(ptCancel5); |
| | | // ptCancelThree.setMoney(ptCancel6); |
| | | // ptCancelThree.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | // ptCancelThree.setType(1); |
| | | // ptCancelThree.setOrderType(3); |
| | | // |
| | | // BigDecimal bigDecimal1 = new BigDecimal(reserveMoney); |
| | | // ptCancelThree.setKm(Integer.valueOf(km)); |
| | | // ptCancelThree.setKmMinute(kmMinute); |
| | | // ptCancelThree.setOvertime(overtime); |
| | | // ptCancelThree.setReserveMoney(bigDecimal1); |
| | | // tSysCancleOrderService.insert(ptCancelThree); |
| | | // } |
| | | // |
| | | // //预约取消设置(专车) |
| | | // TSysCancleOrder yyCancelOne = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 2).eq("orderType", 1)); |
| | | // if (SinataUtil.isNotEmpty(yyCancelOne)){ |
| | | // yyCancelOne.setMinuteNum(yyCancel1); |
| | | // yyCancelOne.setMoney(yyCancel2); |
| | | // |
| | | // BigDecimal bigDecimal1 = new BigDecimal(reserveMoney); |
| | | // yyCancelOne.setKm(Integer.valueOf(km2)); |
| | | // yyCancelOne.setKmMinute(kmMinute2); |
| | | // yyCancelOne.setOvertime(overtime); |
| | | // yyCancelOne.setReserveMoney(bigDecimal1); |
| | | // tSysCancleOrderService.updateById(yyCancelOne); |
| | | // }else{ |
| | | // yyCancelOne = new TSysCancleOrder(); |
| | | // yyCancelOne.setMinuteNum(yyCancel1); |
| | | // yyCancelOne.setMoney(yyCancel2); |
| | | // yyCancelOne.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | // yyCancelOne.setType(2); |
| | | // yyCancelOne.setOrderType(1); |
| | | // |
| | | // BigDecimal bigDecimal1 = new BigDecimal(reserveMoney); |
| | | // yyCancelOne.setKm(Integer.valueOf(km2)); |
| | | // yyCancelOne.setKmMinute(kmMinute2); |
| | | // yyCancelOne.setOvertime(overtime); |
| | | // yyCancelOne.setReserveMoney(bigDecimal1); |
| | | // tSysCancleOrderService.insert(yyCancelOne); |
| | | // } |
| | | // //预约取消设置(出租车) |
| | | // TSysCancleOrder yyCancelTwo = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 2).eq("orderType", 2)); |
| | | // if (SinataUtil.isNotEmpty(yyCancelTwo)){ |
| | | // yyCancelTwo.setMinuteNum(yyCancel3); |
| | | // yyCancelTwo.setMoney(yyCancel4); |
| | | // BigDecimal bigDecimal1 = new BigDecimal(reserveMoney); |
| | | // yyCancelTwo.setKm(Integer.valueOf(km2)); |
| | | // yyCancelTwo.setKmMinute(kmMinute2); |
| | | // yyCancelTwo.setOvertime(overtime); |
| | | // yyCancelTwo.setReserveMoney(bigDecimal1); |
| | | // tSysCancleOrderService.updateById(yyCancelTwo); |
| | | // }else{ |
| | | // yyCancelTwo = new TSysCancleOrder(); |
| | | // yyCancelTwo.setMinuteNum(yyCancel3); |
| | | // yyCancelTwo.setMoney(yyCancel4); |
| | | // yyCancelTwo.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | // yyCancelTwo.setType(2); |
| | | // yyCancelTwo.setOrderType(2); |
| | | // |
| | | // BigDecimal bigDecimal1 = new BigDecimal(reserveMoney); |
| | | // yyCancelTwo.setKm(Integer.valueOf(km2)); |
| | | // yyCancelTwo.setKmMinute(kmMinute2); |
| | | // yyCancelTwo.setOvertime(overtime); |
| | | // yyCancelTwo.setReserveMoney(bigDecimal1); |
| | | // tSysCancleOrderService.insert(yyCancelTwo); |
| | | // } |
| | | |
| | | //报警电话 |
| | | TPhone phoneOne = tPhoneService.selectOne(new EntityWrapper<TPhone>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1)); |
| | |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.TEmail; |
| | | import com.stylefeng.guns.modular.system.model.TOrderCharter; |
| | | import com.stylefeng.guns.modular.system.model.TUser; |
| | | import com.stylefeng.guns.modular.system.service.ITUserService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.service.TEmailService; |
| | | import com.stylefeng.guns.modular.system.util.EmailUtil; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | |
| | | import com.stylefeng.guns.modular.system.model.TIntegralOrder; |
| | | import com.stylefeng.guns.modular.system.service.ITIntegralOrderService; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FileWriter; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private ITIntegralOrderService tIntegralOrderService; |
| | | |
| | | @Autowired |
| | | private ITUserService userService; |
| | | |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | | |
| | | @Resource |
| | | private TEmailService emailService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到积分兑换订单首页 |
| | |
| | | tIntegralOrder.setRemark(null); |
| | | |
| | | tIntegralOrderService.updateById(tIntegralOrder); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | TUser tUser = userService.selectById(tIntegralOrder.getUserId()); |
| | | if(ToolUtil.isNotEmpty(tUser.getEmail())){ |
| | | try { |
| | | Integer language = tUser.getLanguage(); |
| | | String nickName = tUser.getNickName(); |
| | | String email = tUser.getEmail(); |
| | | |
| | | String path = templatePath + "user/pointExchange.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | if(1 == language){ |
| | | document.getElementById("english").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("积分兑换已通过审核"); |
| | | Element user_chinese = document.getElementById("user_chinese"); |
| | | user_chinese.text("您好 " + nickName + ","); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("Points redemption approved"); |
| | | Element user_chinese = document.getElementById("user_english"); |
| | | user_chinese.text("Hello " + nickName + ","); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("english").remove(); |
| | | document.getElementsByTag("title").get(0).text("Approbation de l’échange de points"); |
| | | Element user_french = document.getElementById("user_french"); |
| | | user_french.text("Bonjour " + nickName + ","); |
| | | } |
| | | EmailUtil.send(email, language == 1 ? "积分兑换已通过审核" : language == 2 ? "Points redemption approved" : "Approbation de l’échange de points", document.html()); |
| | | |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | String randomString = ToolUtil.getRandomString(10); |
| | | file = new File("/usr/local/nginx/html/files/html/complaint_" + randomString + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/complaint_" + randomString + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(tUser.getId()); |
| | | tEmail.setType(1); |
| | | tEmail.setName(language == 1 ? "积分兑换已通过审核" : language == 2 ? "Points redemption approved" : "Approbation de l’échange de points"); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | tEmail.setWeek(EmailUtil.getWeek(language,i)); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | }).start(); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | import com.stylefeng.guns.modular.system.model.TDriver; |
| | | import com.stylefeng.guns.modular.system.model.TOrderPrivateCar; |
| | | import com.stylefeng.guns.modular.system.service.ITDriverService; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.HttpRequestUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushURL; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | |
| | | @Autowired |
| | | private ITOrderLogisticsService tOrderLogisticsService; |
| | | |
| | | @Autowired |
| | | private FleetEngineUtil fleetEngineUtil; |
| | | |
| | | /** |
| | | * 跳转到小件物流订单首页 |
| | |
| | | tOrderLogistics.setState(10); |
| | | tOrderLogisticsService.updateById(tOrderLogistics); |
| | | |
| | | //修改行程信息 |
| | | try { |
| | | fleetEngineUtil.updateTrip("CANCELED", null, null, tOrderLogistics.getTripId(), null, null, null, null); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | |
| | | //增加推送 |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("id", tOrderLogistics.getId().toString()); |
| | |
| | | import com.stylefeng.guns.modular.system.dao.OrderCancelMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.HttpRequestUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushURL; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | @Autowired |
| | | private FleetEngineUtil fleetEngineUtil; |
| | | |
| | | |
| | | |
| | |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancelMapper.insert(orderCancel); |
| | | |
| | | //修改行程信息 |
| | | try { |
| | | fleetEngineUtil.updateTrip("CANCELED", null, null, tOrderPrivateCar.getTripId(), null, null, null, null); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | |
| | | //增加推送 |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("id", tOrderPrivateCar.getId().toString()); |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.BalanceUsageRecord; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/13 10:24 |
| | | */ |
| | | public interface BalanceUsageRecordMapper extends BaseMapper<BalanceUsageRecord> { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.RedEnvelopePaymentSettings; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/15 15:07 |
| | | */ |
| | | public interface RedEnvelopePaymentSettingsMapper extends BaseMapper<RedEnvelopePaymentSettings> { |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.system.dao.BalanceUsageRecordMapper"> |
| | | |
| | | |
| | | |
| | | <select id="queryBalanceUsageRecord" resultType="map"> |
| | | select |
| | | DATE_FORMAT(createTime, '%Y-%m-%d') as createTime, |
| | | money, |
| | | purpose |
| | | from t_balance_usage_record type = #{type} and driverId = #{driverId} order by createTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryBalanceUsageRecordSum" resultType="double"> |
| | | select ifnull(sum(money), 0) from t_balance_usage_record where type = #{type} and driverId = #{driverId} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.system.dao.RedEnvelopePaymentSettingsMapper"> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | |
| | | |
| | | <select id="getList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> |
| | | select * |
| | | from t_red_set |
| | | where t_red_set.isDelete = 0 |
| | | order by updateTime desc |
| | | select t_red_envelope_payment_settings.*,sys_user.name as handle |
| | | from t_red_envelope_payment_settings |
| | | left join sys_user on t_red_envelope_payment_settings.insertUserId = sys_user.id |
| | | where t_red_envelope_payment_settings.status = 1 |
| | | order by insertTime desc |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/13 10:21 |
| | | */ |
| | | @Data |
| | | @TableName("t_balance_usage_record") |
| | | public class BalanceUsageRecord { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 余额类型(1=奖励,2=收入) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 使用金额 |
| | | */ |
| | | @TableField("money") |
| | | private Double money; |
| | | /** |
| | | * 用途 |
| | | */ |
| | | @TableField("purpose") |
| | | private Integer purpose; |
| | | /** |
| | | * 使用时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/15 15:04 |
| | | */ |
| | | @Data |
| | | @TableName("t_red_envelope_payment_settings") |
| | | public class RedEnvelopePaymentSettings { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | public Integer id; |
| | | /** |
| | | * 红包抵扣比例 |
| | | */ |
| | | @TableField("deductionRatio") |
| | | private BigDecimal deductionRatio; |
| | | /** |
| | | * 生效日期 |
| | | */ |
| | | @TableField("effectiveDate") |
| | | private Date effectiveDate; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @TableField("updateTime") |
| | | private Date updateTime; |
| | | /** |
| | | * 添加人id |
| | | */ |
| | | @TableField("insertUserId") |
| | | private Integer insertUserId; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | } |
| | |
| | | */ |
| | | private String bindId; |
| | | |
| | | private String tripId; |
| | | |
| | | public Integer getOldState() { |
| | | return oldState; |
| | | } |
| | |
| | | this.bindId = bindId; |
| | | } |
| | | |
| | | public String getTripId() { |
| | | return tripId; |
| | | } |
| | | |
| | | public void setTripId(String tripId) { |
| | | this.tripId = tripId; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | |
| | | private Integer isFrozen; |
| | | |
| | | private String tripId; |
| | | |
| | | public Integer getIsFrozen() { |
| | | return isFrozen; |
| | | } |
| | |
| | | this.serverCarModelId = serverCarModelId; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public String getTripId() { |
| | | return tripId; |
| | | } |
| | | |
| | | public void setTripId(String tripId) { |
| | | this.tripId = tripId; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import java.math.BigDecimal; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键id |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 企业id |
| | | */ |
| | | @TableField("companyId") |
| | | private Integer companyId; |
| | | /** |
| | | * 时间(分钟) |
| | | * 取消规则 |
| | | */ |
| | | private Integer minuteNum; |
| | | /** |
| | | * 金额 |
| | | */ |
| | | private BigDecimal money; |
| | | /** |
| | | *预定费用 |
| | | */ |
| | | private BigDecimal reserveMoney; |
| | | /** |
| | | *取消里程费 |
| | | */ |
| | | private Integer km; |
| | | /** |
| | | * 司机超时xx分钟 未到达指定地点 用户取消订单 不收取费用 |
| | | */ |
| | | private Integer overtime; |
| | | /** |
| | | * 取消时长费 |
| | | */ |
| | | private Integer kmMinute; |
| | | /** |
| | | * 1=普通单取消,2=预约单取消 |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 1=专车,2=出租车,3=跨城出行 |
| | | */ |
| | | private Integer orderType; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Integer getMinuteNum() { |
| | | return minuteNum; |
| | | } |
| | | |
| | | public void setMinuteNum(Integer minuteNum) { |
| | | this.minuteNum = minuteNum; |
| | | } |
| | | |
| | | public BigDecimal getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(BigDecimal money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | @TableField("content") |
| | | private String content; |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "TSysCancleOrder{" + |
| | | "id=" + id + |
| | | ", companyId=" + companyId + |
| | | ", minuteNum=" + minuteNum + |
| | | ", money=" + money + |
| | | ", type=" + type + |
| | | ", orderType=" + orderType + |
| | | "}"; |
| | | return null; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @TableField("uid") |
| | | private Integer uid; |
| | | /** |
| | | * 语言类型(1=简体中文,2=英语,3=法语) |
| | | */ |
| | | @TableField("language") |
| | | private Integer language; |
| | | |
| | | |
| | | public Integer getId() { |
| | |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public Integer getLanguage() { |
| | | return language; |
| | | } |
| | | |
| | | public void setLanguage(Integer language) { |
| | | this.language = language; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.BalanceUsageRecord; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/13 10:25 |
| | | */ |
| | | public interface IBalanceUsageRecordService extends IService<BalanceUsageRecord> { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.RedEnvelopePaymentSettings; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/15 15:08 |
| | | */ |
| | | public interface IRedEnvelopePaymentSettingsService extends IService<RedEnvelopePaymentSettings> { |
| | | |
| | | |
| | | /** |
| | | * 获取当前执行的红包支付配置 |
| | | * @return |
| | | */ |
| | | RedEnvelopePaymentSettings getRedEnvelopePaymentSettings(); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.BalanceUsageRecordMapper; |
| | | import com.stylefeng.guns.modular.system.model.BalanceUsageRecord; |
| | | import com.stylefeng.guns.modular.system.service.IBalanceUsageRecordService; |
| | | import com.stylefeng.guns.modular.system.util.DateUtil; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/13 10:25 |
| | | */ |
| | | @Service |
| | | public class BalanceUsageRecordServiceImpl extends ServiceImpl<BalanceUsageRecordMapper, BalanceUsageRecord> implements IBalanceUsageRecordService { |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.RedEnvelopePaymentSettingsMapper; |
| | | import com.stylefeng.guns.modular.system.model.RedEnvelopePaymentSettings; |
| | | import com.stylefeng.guns.modular.system.service.IRedEnvelopePaymentSettingsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/15 15:08 |
| | | */ |
| | | @Service |
| | | public class RedEnvelopePaymentSettingsServiceImpl extends ServiceImpl<RedEnvelopePaymentSettingsMapper, RedEnvelopePaymentSettings> implements IRedEnvelopePaymentSettingsService { |
| | | |
| | | /** |
| | | * 获取当前执行的红包支付配置 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public RedEnvelopePaymentSettings getRedEnvelopePaymentSettings() { |
| | | RedEnvelopePaymentSettings redEnvelopePaymentSettings = this.selectOne(new EntityWrapper<RedEnvelopePaymentSettings>() |
| | | .eq("status", 1) |
| | | .last(" and now() >= effectiveDate order by effectiveDate desc limit 0, 1")); |
| | | return redEnvelopePaymentSettings; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.GoogleMap; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import cn.hutool.http.Method; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.fleetengine.auth.AuthTokenMinter; |
| | | import com.google.fleetengine.auth.token.FleetEngineToken; |
| | | import com.google.fleetengine.auth.token.TripClaims; |
| | | import com.google.fleetengine.auth.token.VehicleClaims; |
| | | import com.google.fleetengine.auth.token.factory.signer.*; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * Fleet Engine API 工具类 |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/17 9:59 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class FleetEngineUtil { |
| | | |
| | | static Logger logger = LoggerFactory.getLogger(FleetEngineUtil.class); |
| | | |
| | | private final String SERVICE_ACCOUNT = "odrd2024@i-go-odrd-testing.iam.gserviceaccount.com"; |
| | | |
| | | private final String privateKeyId = "0a9a480fafb6469c0c1b2fa6dbdf6d4bebe1ebed"; |
| | | |
| | | private final String privateKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDXZoPEFZeZb0C7DXzpPsloB+rQVQAJuR+z4T9uRCz33gBsIqrz1s5Iwd8vXYKKWzukMdXkwqR4WapI/4GtcpbJkRK93mKXvEE3sDz27BnRrZL4gHeECVpFy0egw29sqFM/x/cpst0goqq4/f3ZFGtQGIhSEEHMySQgTbZDIhXMIls1etRsM4K2bTXeMPn89ablPBdbKtTAJy1EI+ZLKbxnl9StyqBam+d+UsfVmNG19MsNbSzCKc+QPnPXb7dj9KxJ/2whog8w15qXQdJHAMeHZyNlqE0zVP7G1VdWo6Q4QtzmENANxBpJIEbAqY2sq3BZSqDd5XS9Dr9BR4XzQqQnAgMBAAECggEABFABAj4eph1vxVYRBH2TpvDGFU3uW7VBPjwp7JzntLAN8eNoPlqmEDP16y6D/HMmfftpAI3TvWA3+ZEPkiX6nVDyW6sGCodyP0QuJEob1HKHFYntzGtHhGg1KCOacLey6TYbJJmUtcsduQXGkocOPaLXNvjzr2mY2zthTDzJ6HzjDo3d2x/O+lUVlNjubTFydgU9bQP8zS389GgZkO/YebK9+qPRBXv1R2fmj0rhpLqC03jL/mUMKi5tW628OiJGdvzLXlAGyJ9CtVDjfrwUgLf8ML+3yfdmv7yFeWuJ2NEgQxKACixHM05qkCW2bOkPIi9+wb1BbVvMdYL+GCPvmQKBgQD/DZ8zpWfNAkl8h8NI0E7sPdN6wgGfPpaC8VpOE3EM2eEijkZZT6XjfxXjMv1vXg1UoeYVscPb99Ux6u2gq+ZJj6+IstNIObXgvrqNxKPw6OO2xCb6UmA4rQ74xe4d1KLN+C1zepgFYgU4ejungWzuPVL7x8xjdyBAvqgPqP1IbQKBgQDYMzXs2QcWr9tVwq1O3D/H6qX2DvelAj7j0vuXGtop1/aJW7bPlGJd9NGim8dnXLVSFyRteuVl4epa/C9h50g3FM/lFMl9lmp1HwpDeiSJYAGRH8cnPJjN/IV3cRl5qN8KUQE2a3BRP+6IPHJiF1Bc1vj08nTMsWmN+K6VcAzqYwKBgGGJ7RNMM0kkkcPtC5LCDxyrfD/bB9HFlrvW3ykyqC44+K9FZ8PqAM/inxU3P9KiTkjKbXpodDWgLskbResHMld5erC1arWZVGPxrNhgli2gcs1HcHyUmjWygSJEV47S7bwFKCScgpy0Yri5jiy+A1GM5Dpjq1dyjEQWZaEviEV1AoGBALoKn023l/T60QgkZNQmjS/wCG4LhSjWHN4ZMOxfa/pz369lX5OSwW7OfBKscFPOoC0Kwwr+pSYd2HgA6Jkb17WmUBt13skWRXeRhVh5Y7VfCxohuVNXPrqKoSMeDOj22y9ac2ur2lPgateLBHbKTxoE1uiZNs7pn8ZOh5UKfeK3AoGBAKjklIbZ05nvM/mzdPk9JfCFJ6SaQqeaQcU9AoLEQdOzIrrI660Ignn4hOzLSYac0GxytYTQzDt5xDHKBYqJfem7IqxkIj9hSnIZFnUxp6+VfBhXdWHGn+GDTQa1iDvfpy/h6Gr4NL+p/EoA17qtUqOlYxJ1Dkbaw3SqUtkbuv2G"; |
| | | |
| | | private final String provider = "i-go-odrd-testing"; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取jwt token |
| | | * @param type 0=服务端,1=乘客,2=司机 |
| | | * @return |
| | | */ |
| | | public Map<String, Object> fleetEngineAuth(int type, Integer id){ |
| | | try { |
| | | //谷歌云服务器使用这部分代码 |
| | | // AuthTokenMinter minter = AuthTokenMinter.builder() |
| | | // //服务端签名 |
| | | // .setServerSigner(DefaultServiceAccountSigner.create()) |
| | | // //司机端签名 |
| | | // .setDriverSigner(ImpersonatedSigner.create(SERVICE_ACCOUNT)) |
| | | // //乘客端签名 |
| | | // .setConsumerSigner(ImpersonatedSigner.create(SERVICE_ACCOUNT)) |
| | | // .build(); |
| | | AuthTokenMinter minter = AuthTokenMinter.builder() |
| | | //服务端签名 |
| | | .setServerSigner(LocalSigner.create(SERVICE_ACCOUNT, privateKeyId, privateKey)) |
| | | //司机端签名 |
| | | .setDriverSigner(LocalSigner.create(SERVICE_ACCOUNT, privateKeyId, privateKey)) |
| | | //乘客端签名 |
| | | .setConsumerSigner(LocalSigner.create(SERVICE_ACCOUNT, privateKeyId, privateKey)) |
| | | .build(); |
| | | |
| | | String jwt = ""; |
| | | Long expirationTimestamp = 0L; |
| | | if(0 == type){ |
| | | FleetEngineToken serverToken = minter.getServerToken(); |
| | | jwt = serverToken.jwt(); |
| | | expirationTimestamp = serverToken.expirationTimestamp().getTime(); |
| | | } |
| | | if(1 == type){ |
| | | FleetEngineToken consumerToken = minter.getConsumerToken(TripClaims.create("I-GO-USER" + id)); |
| | | jwt = consumerToken.jwt(); |
| | | expirationTimestamp = consumerToken.expirationTimestamp().getTime(); |
| | | } |
| | | if(2 == type){ |
| | | FleetEngineToken driverToken = minter.getDriverToken(VehicleClaims.create("I-GO-CAR" + id)); |
| | | jwt = driverToken.jwt(); |
| | | expirationTimestamp = driverToken.expirationTimestamp().getTime(); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("token", jwt); |
| | | map.put("expirationTimestamp", expirationTimestamp); |
| | | return map; |
| | | } catch (SigningTokenException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public String getToken(){ |
| | | String token_json = redisUtil.getValue("google_token"); |
| | | String google_token = ""; |
| | | if(!StringUtils.hasLength(token_json)){ |
| | | Map<String, Object> map = fleetEngineAuth(0, null); |
| | | redisUtil.setStrValue("google_token", JSON.toJSONString(map)); |
| | | google_token = map.get("token").toString(); |
| | | }else{ |
| | | JSONObject jsonObject1 = JSON.parseObject(token_json); |
| | | Long expirationTimestamp = jsonObject1.getLong("expirationTimestamp"); |
| | | google_token = jsonObject1.getString("token"); |
| | | if((expirationTimestamp - 10000L) <= System.currentTimeMillis()){ |
| | | Map<String, Object> map = fleetEngineAuth(0, null); |
| | | redisUtil.setStrValue("google_token", JSON.toJSONString(map)); |
| | | google_token = map.get("token").toString(); |
| | | } |
| | | } |
| | | return google_token; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加车辆 |
| | | * @param maximumCapacity 这辆车可以搭载的乘客总数 |
| | | * @param licensePlate 车牌号 |
| | | * @param id 车辆id |
| | | */ |
| | | public String createVehicles(int maximumCapacity, String licensePlate, String id) throws Exception{ |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/vehicles?vehicleId=" + id; |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | post.addHeaders(headers); |
| | | |
| | | JSONObject body = new JSONObject(); |
| | | body.put("vehicleState", "OFFLINE"); |
| | | body.put("supportedTripTypes", Arrays.asList("SHARED", "EXCLUSIVE")); |
| | | body.put("maximumCapacity", maximumCapacity); |
| | | |
| | | JSONObject category = new JSONObject(); |
| | | category.put("category", "TAXI"); |
| | | body.put("vehicleType", category); |
| | | JSONObject licensePlate1 = new JSONObject(); |
| | | licensePlate1.put("countryCode", "GH"); |
| | | licensePlate1.put("lastCharacter", getLastNumber(licensePlate)); |
| | | body.put("licensePlate", licensePlate1); |
| | | logger.info("创建车辆请求:{}", body.toJSONString()); |
| | | HttpRequest request = post.body(body.toJSONString()); |
| | | HttpResponse response = request.execute(); |
| | | logger.info("创建车辆结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return createVehicles(maximumCapacity, licensePlate, id); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/vehicles/I-GO-CAR1", |
| | | * "vehicleState": "OFFLINE", |
| | | * "supportedTripTypes": [ |
| | | * "EXCLUSIVE", |
| | | * "SHARED" |
| | | * ], |
| | | * "maximumCapacity": 4, |
| | | * "vehicleType": { |
| | | * "category": "AUTO" |
| | | * }, |
| | | * "licensePlate": { |
| | | * "countryCode": "GH", |
| | | * "lastCharacter": "3" |
| | | * }, |
| | | * "currentRouteSegmentVersion": "2024-05-23T03:05:23.293329Z", |
| | | * "waypointsVersion": "2024-05-23T03:05:23.293329Z" |
| | | * } |
| | | */ |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改车辆信息 |
| | | * @param maximumCapacity |
| | | * @param licensePlate |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public String updateVehicles(String vehicleState, Integer maximumCapacity, String licensePlate, String id) throws Exception{ |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/vehicles/" + id + "?updateMask="; |
| | | List<String> sb = new ArrayList<>(); |
| | | if(StringUtils.hasLength(vehicleState)){ |
| | | sb.add("vehicleState"); |
| | | } |
| | | if(null != maximumCapacity){ |
| | | sb.add("maximumCapacity"); |
| | | } |
| | | if(StringUtils.hasLength(licensePlate)){ |
| | | sb.add("licensePlate"); |
| | | } |
| | | String collect = sb.stream().collect(Collectors.joining(",")); |
| | | url += collect; |
| | | |
| | | HttpRequest put = HttpUtil.createRequest(Method.PUT, url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | put.addHeaders(headers); |
| | | |
| | | JSONObject body = new JSONObject(); |
| | | /** |
| | | * UNKNOWN_VEHICLE_STATE 默认,用于未指定或无法识别的车辆状态。 |
| | | * OFFLINE 车辆不接受新行程。注意:在完成分配给车辆的行程时,车辆仍可继续在此状态下运行。 |
| | | * ONLINE 车辆正在接受新行程。 |
| | | */ |
| | | if(StringUtils.hasLength(vehicleState)){ |
| | | body.put("vehicleState", vehicleState); |
| | | } |
| | | if(null != maximumCapacity){ |
| | | body.put("maximumCapacity", maximumCapacity); |
| | | } |
| | | if(StringUtils.hasLength(licensePlate)){ |
| | | JSONObject licensePlate1 = new JSONObject(); |
| | | licensePlate1.put("countryCode", "GH"); |
| | | licensePlate1.put("lastCharacter", getLastNumber(licensePlate)); |
| | | body.put("licensePlate", licensePlate1); |
| | | } |
| | | body.put("supportedTripTypes", Arrays.asList("SHARED", "EXCLUSIVE")); |
| | | |
| | | JSONObject category = new JSONObject(); |
| | | category.put("category", "TAXI"); |
| | | body.put("vehicleType", category); |
| | | put.body(body.toJSONString()); |
| | | logger.info("修改车辆信息请求:{}", body.toJSONString()); |
| | | HttpResponse response = put.execute(); |
| | | logger.info("修改车辆信息结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return updateVehicles(vehicleState, maximumCapacity, licensePlate, id); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/vehicles/I-GO-CAR1", |
| | | * "vehicleState": "OFFLINE", |
| | | * "supportedTripTypes": [ |
| | | * "EXCLUSIVE", |
| | | * "SHARED" |
| | | * ], |
| | | * "maximumCapacity": 4, |
| | | * "vehicleType": { |
| | | * "category": "TAXI" |
| | | * }, |
| | | * "licensePlate": { |
| | | * "countryCode": "GH", |
| | | * "lastCharacter": "5" |
| | | * }, |
| | | * "currentRouteSegmentVersion": "2024-05-23T06:08:14.968942Z", |
| | | * "waypointsVersion": "2024-05-23T03:05:23.293329Z" |
| | | * } |
| | | */ |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取车辆信息 |
| | | * @param id 车辆id |
| | | * @return |
| | | */ |
| | | public String getVehicles(String id) throws Exception{ |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/vehicles/" + (null != id ? id : ""); |
| | | HttpRequest get = HttpUtil.createGet(url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | get.addHeaders(headers); |
| | | |
| | | HttpResponse response = get.execute(); |
| | | logger.info("查询车辆结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 404){ |
| | | return ""; |
| | | } |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return getVehicles(id); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "vehicles": [ |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/vehicles/I-GO-CAR1", |
| | | * "vehicleState": "OFFLINE", |
| | | * "supportedTripTypes": [ |
| | | * "EXCLUSIVE", |
| | | * "SHARED" |
| | | * ], |
| | | * "maximumCapacity": 4, |
| | | * "vehicleType": { |
| | | * "category": "AUTO" |
| | | * }, |
| | | * "licensePlate": { |
| | | * "countryCode": "GH", |
| | | * "lastCharacter": "3" |
| | | * }, |
| | | * "currentRouteSegmentVersion": "2024-05-23T03:05:23.293329Z", |
| | | * "waypointsVersion": "2024-05-23T03:05:23.293329Z" |
| | | * } |
| | | * ], |
| | | * "totalSize": "1" |
| | | * } |
| | | * |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/vehicles/I-GO-CAR1", |
| | | * "vehicleState": "OFFLINE", |
| | | * "supportedTripTypes": [ |
| | | * "EXCLUSIVE", |
| | | * "SHARED" |
| | | * ], |
| | | * "maximumCapacity": 4, |
| | | * "vehicleType": { |
| | | * "category": "TAXI" |
| | | * }, |
| | | * "licensePlate": { |
| | | * "countryCode": "GH", |
| | | * "lastCharacter": "5" |
| | | * }, |
| | | * "currentRouteSegmentVersion": "2024-05-23T06:08:14.968942Z", |
| | | * "waypointsVersion": "2024-05-23T03:05:23.293329Z" |
| | | * } |
| | | */ |
| | | |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取最后一个数字 |
| | | * @param str |
| | | * @return |
| | | */ |
| | | private String getLastNumber(String str){ |
| | | for (int i = str.length(); i > 0; i--) { |
| | | char c = str.charAt(i - 1); |
| | | if(String.valueOf(c).matches("\\d")){ |
| | | return str.substring(i - 1, i); |
| | | } |
| | | } |
| | | return "-1"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建新的行程 |
| | | * @param vehicleId 车辆id |
| | | * @param numberOfPassengers 人数 |
| | | * @param tripId 订单id |
| | | * @param start_lat 起点纬度 |
| | | * @param start_lng 起点经度 |
| | | * @param end_lat 终点纬度 |
| | | * @param end_lng 终点经度 |
| | | * @return |
| | | */ |
| | | public String createTrip(String vehicleId, Integer numberOfPassengers, String tripId, String start_lat, String start_lng, String end_lat, String end_lng) throws Exception{ |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/trips?tripId=" + tripId; |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | post.addHeaders(headers); |
| | | |
| | | JSONObject body = new JSONObject(); |
| | | if(StringUtils.hasLength(vehicleId)){ |
| | | body.put("vehicleId", vehicleId); |
| | | } |
| | | body.put("tripStatus", "NEW"); |
| | | body.put("tripType", "SHARED"); |
| | | body.put("numberOfPassengers", numberOfPassengers); |
| | | |
| | | JSONObject pickupPoint = new JSONObject(); |
| | | JSONObject point = new JSONObject(); |
| | | point.put("latitude", start_lat); |
| | | point.put("longitude", start_lng); |
| | | pickupPoint.put("point", point); |
| | | body.put("pickupPoint", pickupPoint); |
| | | |
| | | JSONObject dropoffPoint = new JSONObject(); |
| | | JSONObject end_point = new JSONObject(); |
| | | end_point.put("latitude", end_lat); |
| | | end_point.put("longitude", end_lng); |
| | | dropoffPoint.put("point", end_point); |
| | | body.put("dropoffPoint", dropoffPoint); |
| | | logger.info("创建行程请求:{}", body.toJSONString()); |
| | | HttpRequest request = post.body(body.toJSONString()); |
| | | HttpResponse response = request.execute(); |
| | | logger.info("创建行程结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return createTrip(vehicleId, numberOfPassengers, tripId, start_lat, start_lng, end_lat, end_lng); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/trips/I-GO-RIDE1", |
| | | * "vehicleId": "I-GO-CAR1", |
| | | * "tripStatus": "NEW", |
| | | * "tripType": "SHARED", |
| | | * "pickupPoint": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * }* }, |
| | | * "pickupTime": "2024-05-27T02:05:37.935052Z", |
| | | * "dropoffPoint": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "dropoffTime": "2024-05-27T02:18:35.934167Z", |
| | | * "numberOfPassengers": 1, |
| | | * "remainingDistanceMeters": 0, |
| | | * "etaToFirstWaypoint": "2024-05-27T02:05:37.935052Z", |
| | | * "remainingWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "distanceMeters": 0, |
| | | * "eta": "2024-05-27T02:05:37.935052Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:18:35.934167Z", |
| | | * "duration": "777.999115s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "currentRouteSegmentVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "remainingWaypointsVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "vehicleWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "distanceMeters": 0, |
| | | * "eta": "2024-05-27T02:05:37.935052Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:18:35.934167Z", |
| | | * "duration": "777.999115s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "currentRouteSegmentEndPoint": { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE" |
| | | * }, |
| | | * "remainingWaypointsRouteVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "currentRouteSegmentTrafficVersion": "2024-05-27T02:05:37.941167Z" |
| | | * } |
| | | */ |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改行程 |
| | | * @param tripStatus 行程状态 |
| | | * @param vehicleId 车辆id |
| | | * @param numberOfPassengers 人数 |
| | | * @param tripId 订单id |
| | | * @param start_lat 起点纬度 |
| | | * @param start_lng 起点经度 |
| | | * @param end_lat 终点纬度 |
| | | * @param end_lng 终点经度 |
| | | * @return |
| | | */ |
| | | public String updateTrip(String tripStatus, String vehicleId, Integer numberOfPassengers, String tripId, String start_lat, String start_lng, String end_lat, String end_lng) throws Exception { |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/trips/" + tripId + "?updateMask="; |
| | | List<String> sb = new ArrayList<>(); |
| | | if(StringUtils.hasLength(vehicleId)){ |
| | | sb.add("vehicleId"); |
| | | } |
| | | if(StringUtils.hasLength(tripStatus)){ |
| | | sb.add("tripStatus"); |
| | | } |
| | | if(null != numberOfPassengers){ |
| | | sb.add("numberOfPassengers"); |
| | | } |
| | | if(StringUtils.hasLength(start_lat) && StringUtils.hasLength(start_lng)){ |
| | | sb.add("pickupPoint"); |
| | | } |
| | | |
| | | if(StringUtils.hasLength(end_lat) && StringUtils.hasLength(end_lng)){ |
| | | sb.add("dropoffPoint"); |
| | | } |
| | | String collect = sb.stream().collect(Collectors.joining(",")); |
| | | url += collect; |
| | | |
| | | HttpRequest put = HttpUtil.createRequest(Method.PUT, url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | put.addHeaders(headers); |
| | | |
| | | JSONObject body = new JSONObject(); |
| | | if(StringUtils.hasLength(vehicleId)){ |
| | | body.put("vehicleId", vehicleId); |
| | | } |
| | | /** |
| | | * UNKNOWN_TRIP_STATUS 默认,用于未指定或无法识别的行程状态。 |
| | | * NEW 新建行程。 |
| | | * ENROUTE_TO_PICKUP 司机正在前往上车点。 |
| | | * ARRIVED_AT_PICKUP 司机已到达上车点。 |
| | | * ARRIVED_AT_INTERMEDIATE_DESTINATION 司机已到达中转目的地,正在等待乘客。 |
| | | * ENROUTE_TO_INTERMEDIATE_DESTINATION 司机正在前往中间目的地(而非下车点)。 |
| | | * ENROUTE_TO_DROPOFF 司机已接起乘客,正在前往下一个目的地。 |
| | | * COMPLETE 乘客已下车,行程已完成。 |
| | | * CANCELED 在司机、乘客或拼车服务提供商取车之前,行程被取消。 |
| | | */ |
| | | if(StringUtils.hasLength(tripStatus)){ |
| | | body.put("tripStatus", tripStatus); |
| | | } |
| | | if(null != numberOfPassengers){ |
| | | body.put("numberOfPassengers", numberOfPassengers); |
| | | } |
| | | if(StringUtils.hasLength(start_lat) && StringUtils.hasLength(start_lng)){ |
| | | JSONObject pickupPoint = new JSONObject(); |
| | | JSONObject point = new JSONObject(); |
| | | point.put("latitude", start_lat); |
| | | point.put("longitude", start_lng); |
| | | pickupPoint.put("point", point); |
| | | body.put("pickupPoint", pickupPoint); |
| | | } |
| | | |
| | | if(StringUtils.hasLength(end_lat) && StringUtils.hasLength(end_lng)){ |
| | | JSONObject dropoffPoint = new JSONObject(); |
| | | JSONObject end_point = new JSONObject(); |
| | | end_point.put("latitude", end_lat); |
| | | end_point.put("longitude", end_lng); |
| | | dropoffPoint.put("point", end_point); |
| | | body.put("dropoffPoint", dropoffPoint); |
| | | } |
| | | logger.info("修改行程请求:{}", body.toJSONString()); |
| | | HttpRequest request = put.body(body.toJSONString()); |
| | | HttpResponse response = request.execute(); |
| | | logger.info("修改行程结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return updateTrip(tripStatus, vehicleId, numberOfPassengers, tripId, start_lat, start_lng, end_lat, end_lng); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/trips/I-GO-RIDE1", |
| | | * "vehicleId": "I-GO-CAR1", |
| | | * "tripStatus": "ENROUTE_TO_PICKUP", |
| | | * "tripType": "SHARED", |
| | | * "pickupPoint": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * }* }, |
| | | * "pickupTime": "2024-05-27T02:07:38.562717Z", |
| | | * "dropoffPoint": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "dropoffTime": "2024-05-27T02:20:36.562375Z", |
| | | * "numberOfPassengers": 1, |
| | | * "remainingWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "eta": "2024-05-27T02:07:38.562717Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:20:36.562375Z", |
| | | * "duration": "777.999658s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "remainingWaypointsVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "vehicleWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "eta": "2024-05-27T02:07:38.562717Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:20:36.562375Z", |
| | | * "duration": "777.999658s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "remainingWaypointsRouteVersion": "2024-05-27T02:07:38.570569Z" |
| | | * } |
| | | * |
| | | * 取消订单后返回的结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/trips/I-GO-RIDE1", |
| | | * "tripStatus": "CANCELED", |
| | | * "tripType": "SHARED", |
| | | * "pickupPoint": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * }* }, |
| | | * "dropoffPoint": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "numberOfPassengers": 1 |
| | | * } |
| | | */ |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取行程信息 |
| | | * @param tripId 订单id |
| | | * @return |
| | | */ |
| | | public String getTrip(String tripId) throws Exception { |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/trips/" + tripId; |
| | | HttpRequest get = HttpUtil.createGet(url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | get.addHeaders(headers); |
| | | |
| | | HttpResponse response = get.execute(); |
| | | logger.info("查询行程结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 404){ |
| | | return ""; |
| | | } |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return getTrip(tripId); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/trips/I-GO-RIDE1", |
| | | * "vehicleId": "I-GO-CAR1", |
| | | * "tripStatus": "ENROUTE_TO_PICKUP", |
| | | * "tripType": "SHARED", |
| | | * "pickupPoint": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * }* }, |
| | | * "pickupTime": "2024-05-27T02:10:39.763347Z", |
| | | * "dropoffPoint": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "dropoffTime": "2024-05-27T02:23:37.762549Z", |
| | | * "numberOfPassengers": 1, |
| | | * "remainingDistanceMeters": 0, |
| | | * "etaToFirstWaypoint": "2024-05-27T02:10:39.763347Z", |
| | | * "remainingWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "distanceMeters": 0, |
| | | * "eta": "2024-05-27T02:10:39.763347Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:23:37.762549Z", |
| | | * "duration": "777.999202s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "currentRouteSegmentVersion": "2024-05-27T02:10:39.773373Z", |
| | | * "remainingWaypointsVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "currentRouteSegmentEndPoint": { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE" |
| | | * }, |
| | | * "remainingWaypointsRouteVersion": "2024-05-27T02:10:39.773373Z", |
| | | * "currentRouteSegmentTrafficVersion": "2024-05-27T02:10:39.773373Z", |
| | | * "view": "SDK" |
| | | * } |
| | | */ |
| | | |
| | | return response.body(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | public class GoogleMapUtil { |
| | | |
| | | private final static String key = "AIzaSyA_FEliOkbkL1IAHQsnBpbpo9MlIp729H0"; |
| | | private final static String key = "AIzaSyCG6PsfkaCEc94VK2vIAZk1YYKvOS_Ewts"; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | spring: |
| | | datasource: |
| | | url: jdbc:mysql://127.0.0.1:3306/igotravel2.0?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B0 |
| | | url: jdbc:mysql://192.168.110.80:3306/igotravel2.0?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B0 |
| | | username: root |
| | | # password: HjKbXilb9zajmXbl |
| | | password: 123456 |
| | | db-name: igotravel #用来搜集数据库的所有表 |
| | | filters: wall,mergeStat |
| | |
| | | spring: |
| | | profiles: |
| | | active: test |
| | | active: "@spring.active@" |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script async src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA_FEliOkbkL1IAHQsnBpbpo9MlIp729H0&callback=initMap&v=weekly"></script> |
| | | <script async src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCG6PsfkaCEc94VK2vIAZk1YYKvOS_Ewts&callback=initMap&v=weekly"></script> |
| | | <script src="${ctxPath}/static/home.js"></script> |
| | | <script src="${ctxPath}/static/js/jquery.sparkline 2.1.2.js"></script> |
| | | @} |
| | |
| | | <option value="1">红包</option> |
| | | <option value="2">优惠券</option> |
| | | <option value="3">司机奖励</option> |
| | | <option value="4">折扣</option> |
| | | </#SelectCon> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | |
| | | margin-left: 40px; /* 设置矩形框之间的间距 */ |
| | | margin-top: 15px; |
| | | } |
| | | .rectangle4 { |
| | | width: 250px; /* 设置框的宽度 */ |
| | | height: 170px; /* 自适应高度 */ |
| | | background-color: #cecece; /* 设置底色为灰色 */ |
| | | border-radius: 30px; /* 设置圆角半径为10px */ |
| | | display: flex; /* 使用 Flex 布局 */ |
| | | flex-direction: column; /* 设置主轴方向为垂直 */ |
| | | justify-content: center; /* 垂直居中 */ |
| | | align-items: center; /* 水平居中 */ |
| | | margin-right: 40px; /* 设置矩形框之间的间距 */ |
| | | margin-left: 40px; /* 设置矩形框之间的间距 */ |
| | | margin-top: 15px; |
| | | } |
| | | h1, h2 { |
| | | margin: 0; /* 去除默认的外边距 */ |
| | | } |
| | |
| | | <#TimeCon id="insertTime" name="时间" isTime="false"/> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#SelectCon id="type" name="流水项目" > |
| | | <#SelectCon id="type" name="补贴类型" > |
| | | <option value="">全部</option> |
| | | <option value="1">用户订单消费</option> |
| | | <option value="2">用户充值</option> |
| | | <option value="3">司机结算</option> |
| | | <option value="4">司机提现</option> |
| | | <option value="5">用户提现</option> |
| | | </#SelectCon> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#SelectCon id="payType" name="支付方式" > |
| | | <option value="">全部</option> |
| | | <option value="1">银行卡支付</option> |
| | | <option value="2">手机支付</option> |
| | | <option value="1">红包</option> |
| | | <option value="2">优惠券</option> |
| | | <option value="3">司机奖励</option> |
| | | <option value="4">折扣</option> |
| | | </#SelectCon> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | |
| | | <div class="rectangle1"> |
| | | <h1 id="num1">0</h1> |
| | | <br> |
| | | <h2 id="text1">第三方流水余额合计</h2> |
| | | <h2 id="text1">已使用补贴总额</h2> |
| | | |
| | | </div> |
| | | <img style="margin-top: 70px" width="25px" height="25px" src="${ctxPath}/static/img/=.png."> |
| | | <div class="rectangle2"> |
| | | <h1 id="num2">0</h1> |
| | | <br> |
| | | <h2 id="text2">用户订单消费</h2> |
| | | <h2 id="text2">已使用折扣总额(用户端)</h2> |
| | | </div> |
| | | <img style="margin-top: 70px" width="25px" height="25px" src="${ctxPath}/static/img/+.png."> |
| | | <div class="rectangle3"> |
| | | <h1 id="num3">0</h1> |
| | | <br> |
| | | <h2 id="text3">用户充值总额</h2> |
| | | <h2 id="text3">已使用红包总额(用户端)</h2> |
| | | </div> |
| | | <img style="margin-top: 70px" width="25px" height="25px" src="${ctxPath}/static/img/+.png."> |
| | | <div class="rectangle3"> |
| | | <h1 id="num4">0</h1> |
| | | <br> |
| | | <h2 id="text4">司机结算总额</h2> |
| | | <h2 id="text4">已使用优惠券总额(用户端)</h2> |
| | | </div> |
| | | <img style="margin-top: 70px" width="25px" height="25px" src="${ctxPath}/static/img/-.png."> |
| | | <div class="rectangle3"> |
| | | <div class="rectangle4"> |
| | | <h1 id="num5">0</h1> |
| | | <br> |
| | | <h2 id="text5">司机提现总额</h2> |
| | | </div> |
| | | <img style="margin-top: 70px" width="25px" height="25px" src="${ctxPath}/static/img/-.png."> |
| | | <div class="rectangle3"> |
| | | <h1 id="num6">0</h1> |
| | | <h2 id="text5">已使用司机奖励合计</h2> |
| | | <br> |
| | | <h2 id="text6">用户提现总额</h2> |
| | | <div style="display: flex"> |
| | | <span>已提现</span> <span id="num6">0</span> |
| | | </div> |
| | | <br> |
| | | <div style="display: flex"> |
| | | <span>已消费</span> <span id="num7">0</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <#table id="TUserTable"/> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/platform/water.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/subsidy/use.js"></script> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#insertTime' |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA_FEliOkbkL1IAHQsnBpbpo9MlIp729H0&callback=initMap&v=weekly"></script> |
| | | <script defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCG6PsfkaCEc94VK2vIAZk1YYKvOS_Ewts&callback=initMap&v=weekly"></script> |
| | | <script src="${ctxPath}/static/modular/system/tOrderPrivateCar/tOrderPrivateCar_info.js"></script> |
| | | @} |
| | |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">红包可抵扣比例:</label> |
| | | <div class="col-sm-9" style="display: flex;"> |
| | | <input style="width: 300px" class="form-control" id="proportion" value="${data.proportion}" name="proportion" placeholder="请输入红包可抵扣比例" type="text"> |
| | | <input style="width: 300px" class="form-control" id="proportion" value="${data.deductionRatio}" name="proportion" placeholder="请输入红包可抵扣比例" type="text"> |
| | | <span id="priceLabel1" style="margin-left: 5px;margin-top: 5px">%</span> |
| | | </div> |
| | | </div> |
| | |
| | | <label class="col-sm-2 control-label">打车/包裹订单取消设置:</label> |
| | | <div class="col-sm-10"> |
| | | 订单取消规则:订单在司机接单 <input type="text" oninput="checkIsInt(this)" |
| | | @if(isNotEmpty(ptCancel1)){ |
| | | value="${ptCancel1.minuteNum}" |
| | | @if(isNotEmpty(orderAcceptanceTime)){ |
| | | value="${orderAcceptanceTime}" |
| | | @}else{ |
| | | value="" |
| | | @} |
| | | name="ptCancel1" id="ptCancel1" class="form-control newWidth" /> 分钟后, |
| | | 取消订单收取 <input type="text" oninput="checkIsDouble(this)" |
| | | @if(isNotEmpty(ptCancel1)){ |
| | | value="${ptCancel1.money}" |
| | | @if(isNotEmpty(money)){ |
| | | value="${money}" |
| | | @}else{ |
| | | value="" |
| | | @} |
| | | name="ptCancel2" id="ptCancel2" class="form-control newWidth" /> GHS取消费用 |
| | | 里程费 <input type="text" oninput="checkIsDouble(this)" |
| | | @if(isNotEmpty(ptCancel1)){ |
| | | value="${ptCancel1.km}" |
| | | @if(isNotEmpty(mileageFee)){ |
| | | value="${mileageFee}" |
| | | @}else{ |
| | | value="" |
| | | @} |
| | | name="km" id="km" class="form-control newWidth" /> GHS/km |
| | | 时长费 <input type="text" oninput="checkIsDouble(this)" |
| | | @if(isNotEmpty(ptCancel1)){ |
| | | value="${ptCancel1.kmMinute}" |
| | | @if(isNotEmpty(durationFee)){ |
| | | value="${durationFee}" |
| | | @}else{ |
| | | value="" |
| | | @} |
| | | name="kmMinute" id="kmMinute" class="form-control newWidth" /> GHS/分钟 |
| | | <br/> |
| | | <br/> |
| | | <div class="col-sm-10" hidden> |
| | | 出租车订单取消规则:出租车订单在司机接单 <input type="text" oninput="checkIsInt(this)" |
| | | @if(isNotEmpty(ptCancel2)){ |
| | | value="${ptCancel2.minuteNum}" |
| | | @}else{ |
| | | value="" |
| | | @} |
| | | name="ptCancel3" id="ptCancel3" class="form-control newWidth" /> 分钟后, |
| | | 取消订单收取 <input type="text" oninput="checkIsDouble(this)" |
| | | @if(isNotEmpty(ptCancel2)){ |
| | | value="${ptCancel2.money}" |
| | | @}else{ |
| | | value="" |
| | | @} |
| | | name="ptCancel4" id="ptCancel4" class="form-control newWidth" /> 元取消费用; |
| | | <br/> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">预约订单取消规则:</label> |
| | | <div class="col-sm-10"> |
| | | 订单在司机接单 <input type="text" oninput="checkIsInt(this)" |
| | | @if(isNotEmpty(yyCancel1)){ |
| | | value="${yyCancel1.minuteNum}" |
| | | @if(isNotEmpty(orderAcceptanceTime1)){ |
| | | value="${orderAcceptanceTime1}" |
| | | @}else{ |
| | | value="" |
| | | @} |
| | | name="yyCancel1" id="yyCancel1" class="form-control newWidth" /> 分钟后, |
| | | 取消订单收取 <input type="text" oninput="checkIsDouble(this)" |
| | | @if(isNotEmpty(yyCancel1)){ |
| | | value="${yyCancel1.money}" |
| | | @if(isNotEmpty(money1)){ |
| | | value="${money1}" |
| | | @}else{ |
| | | value="" |
| | | @} |
| | | name="yyCancel2" id="yyCancel2" class="form-control newWidth" /> 元取消费用; |
| | | 里程费 <input type="text" oninput="checkIsDouble(this)" |
| | | @if(isNotEmpty(yyCancel1)){ |
| | | value="${yyCancel1.km}" |
| | | @if(isNotEmpty(mileageFee1)){ |
| | | value="${mileageFee1}" |
| | | @}else{ |
| | | value="" |
| | | @} |
| | | name="km2" id="km2" class="form-control newWidth" /> GHS/km |
| | | 时长费 <input type="text" oninput="checkIsDouble(this)" |
| | | @if(isNotEmpty(yyCancel1)){ |
| | | value="${yyCancel1.kmMinute}" |
| | | @if(isNotEmpty(durationFee1)){ |
| | | value="${durationFee1}" |
| | | @}else{ |
| | | value="" |
| | | @} |
| | |
| | | </br> |
| | | </br> |
| | | 预定费用 <input type="text" oninput="checkIsDouble(this)" |
| | | @if(isNotEmpty(yyCancel1)){ |
| | | value="${yyCancel1.reserveMoney}" |
| | | @if(isNotEmpty(reservationFee)){ |
| | | value="${reservationFee}" |
| | | @}else{ |
| | | value="" |
| | | @} |
| | | name="reserveMoney" id="reserveMoney" class="form-control newWidth" /> GHS |
| | | <br/> |
| | | <br/> |
| | | <div class="col-sm-10" hidden> |
| | | 出租车订单取消规则:出租车订单在司机接单 <input type="text" oninput="checkIsInt(this)" |
| | | @if(isNotEmpty(yyCancel2)){ |
| | | value="${yyCancel2.minuteNum}" |
| | | @}else{ |
| | | value="" |
| | | @} |
| | | name="yyCancel3" id="yyCancel3" class="form-control newWidth" /> 分钟后, |
| | | 取消订单收取 <input type="text" oninput="checkIsDouble(this)" |
| | | @if(isNotEmpty(yyCancel2)){ |
| | | value="${yyCancel2.money}" |
| | | @}else{ |
| | | value="" |
| | | @} |
| | | name="yyCancel4" id="yyCancel4" class="form-control newWidth" /> 元取消费用 |
| | | <br/> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">司机超时(地图计算时间或者预定时间):</label> |
| | | <div class="col-sm-10"> |
| | | <input type="text" oninput="checkIsInt(this)" |
| | | @if(isNotEmpty(ptCancel2)){ |
| | | value="${ptCancel2.overtime}" |
| | | @if(isNotEmpty(driverTimeout)){ |
| | | value="${driverTimeout}" |
| | | @}else{ |
| | | value="" |
| | | @} |
| | |
| | | |
| | | var ptCancel1 = $("#ptCancel1").val().trim(); |
| | | var ptCancel2 = $("#ptCancel2").val().trim(); |
| | | var ptCancel3 = $("#ptCancel3").val().trim(); |
| | | var ptCancel4 = $("#ptCancel4").val().trim(); |
| | | // var ptCancel3 = $("#ptCancel3").val().trim(); |
| | | // var ptCancel4 = $("#ptCancel4").val().trim(); |
| | | // var ptCancel5 = $("#ptCancel5").val().trim(); |
| | | // var ptCancel6 = $("#ptCancel6").val().trim(); |
| | | |
| | | var yyCancel1 = $("#yyCancel1").val().trim(); |
| | | var yyCancel2 = $("#yyCancel2").val().trim(); |
| | | var yyCancel3 = $("#yyCancel3").val().trim(); |
| | | var yyCancel4 = $("#yyCancel4").val().trim(); |
| | | // var yyCancel3 = $("#yyCancel3").val().trim(); |
| | | // var yyCancel4 = $("#yyCancel4").val().trim(); |
| | | |
| | | var phone1 = $("#phone1").val().trim(); |
| | | var phone2 = $("#phone2").val().trim(); |
| | |
| | | |
| | | ajax.set("ptCancel1", ptCancel1); |
| | | ajax.set("ptCancel2", ptCancel2); |
| | | ajax.set("ptCancel3", ptCancel3); |
| | | ajax.set("ptCancel4", ptCancel4); |
| | | ajax.set("ptCancel3", null); |
| | | ajax.set("ptCancel4", null); |
| | | ajax.set("ptCancel5", 0); |
| | | ajax.set("ptCancel6", 0); |
| | | |
| | | ajax.set("yyCancel1", yyCancel1); |
| | | ajax.set("yyCancel2", yyCancel2); |
| | | ajax.set("yyCancel3", yyCancel3); |
| | | ajax.set("yyCancel4", yyCancel4); |
| | | ajax.set("yyCancel3", null); |
| | | ajax.set("yyCancel4", null); |
| | | |
| | | ajax.set("phone1", phone1); |
| | | ajax.set("phone2", phone2); |
| | |
| | | var ajax = new $ax(Feng.ctxPath + "/platform/water/getCount", function(data){ |
| | | |
| | | document.getElementById("num1").innerHTML = data.total; |
| | | document.getElementById("num2").innerHTML = data.balance; |
| | | document.getElementById("num3").innerHTML = data.unBalance; |
| | | document.getElementById("num2").innerHTML = data.userOrder; |
| | | document.getElementById("num3").innerHTML = data.userCharge; |
| | | document.getElementById("num4").innerHTML = data.balance; |
| | | document.getElementById("num5").innerHTML = data.driverWithdrawal; |
| | | document.getElementById("num6").innerHTML = data.userWithdrawal; |
| | | },function(data){ |
| | | Feng.error("修改失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | |
| | | TUser.resetSearch = function () { |
| | | $("#time").val(""); |
| | | $("#insertTime").val(""); |
| | | $("#state").val(""); |
| | | $("#type").val(""); |
| | | $("#payType").val(""); |
| | | TUser.search(); |
| | | }; |
| | | |
| | |
| | | var ajax = new $ax(Feng.ctxPath + "/subsidy/use/getCount", function(data){ |
| | | |
| | | document.getElementById("num1").innerHTML = data.total; |
| | | document.getElementById("num2").innerHTML = data.balance; |
| | | document.getElementById("num3").innerHTML = data.unBalance; |
| | | document.getElementById("num2").innerHTML = data.discount; |
| | | document.getElementById("num3").innerHTML = data.redPackage; |
| | | document.getElementById("num4").innerHTML = data.coupon; |
| | | document.getElementById("num5").innerHTML = data.driver; |
| | | document.getElementById("num6").innerHTML = data.driverWithdrawal; |
| | | document.getElementById("num7").innerHTML = data.driverConsume; |
| | | },function(data){ |
| | | Feng.error("修改失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | |
| | | var ajax = new $ax(Feng.ctxPath + "/subsidy/use/getCount", function(data){ |
| | | |
| | | document.getElementById("num1").innerHTML = data.total; |
| | | document.getElementById("num2").innerHTML = data.userOrder; |
| | | document.getElementById("num3").innerHTML = data.userCharge; |
| | | document.getElementById("num4").innerHTML = data.balance; |
| | | document.getElementById("num5").innerHTML = data.driverWithdrawal; |
| | | document.getElementById("num6").innerHTML = data.userWithdrawal; |
| | | document.getElementById("num2").innerHTML = data.discount; |
| | | document.getElementById("num3").innerHTML = data.redPackage; |
| | | document.getElementById("num4").innerHTML = data.coupon; |
| | | document.getElementById("num5").innerHTML = data.driver; |
| | | document.getElementById("num6").innerHTML = data.driverWithdrawal; |
| | | document.getElementById("num7").innerHTML = data.driverConsume; |
| | | },function(data){ |
| | | Feng.error("修改失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | |
| | | {title: '操作人', field: 'handle', visible: true, align: 'center', valign: 'middle', |
| | | |
| | | }, |
| | | {title: '红包可抵扣比例', field: 'proportion', visible: true, align: 'center', valign: 'middle', |
| | | {title: '红包可抵扣比例', field: 'deductionRatio', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | var btn = ""; |
| | | if(row.proportion != '' && row.proportion != null) { |
| | | var time = row.proportion; |
| | | btn = time+"%" |
| | | } |
| | | return btn; |
| | | |
| | | return value+"%"; |
| | | } |
| | | }, |
| | | {title: '生效时间', field: 'startTime', visible: true, align: 'center', valign: 'middle',}, |
| | | {title: '生效时间', field: 'effectiveDate', visible: true, align: 'center', valign: 'middle',}, |
| | | ]; |
| | | }; |
| | | |
| | |
| | | <artifactId>font-asian</artifactId> |
| | | <version>7.1.13</version> |
| | | </dependency> |
| | | |
| | | <!--Google ODRD--> |
| | | <dependency> |
| | | <groupId>com.google.maps</groupId> |
| | | <artifactId>fleetengine-auth</artifactId> |
| | | <version>1.11.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.OrderCancel; |
| | | import com.stylefeng.guns.modular.system.model.OrderPosition; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.*; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | /*@Autowired |
| | | private ICBCPayUtil icbcPayUtil;*/ |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Autowired |
| | | private IRedEnvelopePaymentSettingsService redEnvelopePaymentSettingsService; |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | @Autowired |
| | | private IUserRedPacketRecordService userRedPacketRecordService; |
| | | |
| | | /** |
| | | * 获取正在进行中的订单 |
| | |
| | | orderStatusWarpper.setOrderId(orderPrivateCar.getId()); |
| | | orderStatusWarpper.setOrderType(1); |
| | | orderStatusWarpper.setState(orderPrivateCar.getState()); |
| | | orderStatusWarpper.setTripId(orderPrivateCar.getTripId()); |
| | | data.add(orderStatusWarpper); |
| | | } |
| | | List<OrderTaxi> list = orderTaxiService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12); |
| | |
| | | orderStatusWarpper.setOrderId(orderTaxi.getId()); |
| | | orderStatusWarpper.setOrderType(2); |
| | | orderStatusWarpper.setState(orderTaxi.getState()); |
| | | // orderStatusWarpper.setTripId(orderTaxi.getTripId()); |
| | | data.add(orderStatusWarpper); |
| | | } |
| | | List<OrderCrossCity> orderCrossCities = orderCrossCityService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12); |
| | |
| | | orderStatusWarpper.setOrderId(orderCrossCity.getId()); |
| | | orderStatusWarpper.setOrderType(3); |
| | | orderStatusWarpper.setState(orderCrossCity.getState()); |
| | | // orderStatusWarpper.setTripId(orderPrivateCar.getTripId()); |
| | | data.add(orderStatusWarpper); |
| | | } |
| | | return ResultUtil.success(data); |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryMyTravelRecord") |
| | | @ApiOperation(value = "获取消费记录", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取消费记录【2.0】", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码(首页1)", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<TravelRecordWarpper>> queryMyTravelRecord(Integer pageNum, Integer size, Integer language, HttpServletRequest request){ |
| | | public ResultUtil<List<TravelRecordListWarpper>> queryMyTravelRecord(Integer pageNum, Integer size, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | |
| | | for (Map<String, Object> map : list3) { |
| | | map.put("name", name); |
| | | } |
| | | List<TransactionDetails> transactionDetails = transactionDetailsService.selectList(new EntityWrapper<TransactionDetails>().eq("state", 1) |
| | | .eq("type", 1).eq("userType", 1).eq("userId", uid).eq("orderType", 3).like("remark", "%跨城订单取消退款%")); |
| | | List<Map<String, Object>> list4 = new ArrayList<>(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | for(TransactionDetails transactionDetails1 : transactionDetails){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("money", transactionDetails1.getMoney()); |
| | | map.put("time", DateUtil.conversionFormat(language, sdf.format(transactionDetails1.getInsertTime()))); |
| | | map.put("name", "跨城订单取消退款"); |
| | | map.put("insertTime", Double.valueOf(transactionDetails1.getInsertTime().getTime() / 1000).intValue()); |
| | | list4.add(map); |
| | | } |
| | | // List<TransactionDetails> transactionDetails = transactionDetailsService.selectList(new EntityWrapper<TransactionDetails>().eq("state", 1) |
| | | // .eq("type", 1).eq("userType", 1).eq("userId", uid).eq("orderType", 3).like("remark", "%跨城订单取消退款%")); |
| | | // List<Map<String, Object>> list4 = new ArrayList<>(); |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | // for(TransactionDetails transactionDetails1 : transactionDetails){ |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("money", transactionDetails1.getMoney()); |
| | | // map.put("time", DateUtil.conversionFormat(language, sdf.format(transactionDetails1.getInsertTime()))); |
| | | // map.put("name", "跨城订单取消退款"); |
| | | // map.put("insertTime", Double.valueOf(transactionDetails1.getInsertTime().getTime() / 1000).intValue()); |
| | | // list4.add(map); |
| | | // } |
| | | list.addAll(maps); |
| | | // list.addAll(list1); |
| | | // list.addAll(list2); |
| | | list.addAll(list3); |
| | | // list.addAll(list4); |
| | | |
| | | List<TravelRecordWarpper> orderWarpper = TravelRecordWarpper.getTravelRecordWarpper(list); |
| | | List<TravelRecordListWarpper> orderWarpper = TravelRecordListWarpper.getTravelRecordWarpper(list); |
| | | |
| | | double sum = orderWarpper.stream().mapToDouble(TravelRecordListWarpper::getMoney).sum(); |
| | | |
| | | //分页 |
| | | if(orderWarpper.size() >= (pageNum + 1) * size){ |
| | |
| | | }else{ |
| | | orderWarpper = new ArrayList<>(); |
| | | } |
| | | orderWarpper.forEach(s->{ |
| | | s.setTotal(sum); |
| | | }); |
| | | return ResultUtil.success(orderWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryOrderInfo") |
| | | @ApiOperation(value = "获取服务中的详情数据【1.0】", tags = {"用户端-服务中"}, notes = "") |
| | | @ApiOperation(value = "获取服务中的详情数据【2.0】", tags = {"用户端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=同城小件,5=跨城小件)", name = "orderType", required = true, dataType = "int"), |
| | |
| | | map.put("driverPhone", map.get("telX")); |
| | | } |
| | | OrderInfoWarpper orderInfoWarpper = OrderInfoWarpper.getOrderInfoWarpper(map); |
| | | // String driverName = orderInfoWarpper.getDriverName(); |
| | | // if(language == 2){ |
| | | // driverName = "Master " + driverName.replace("师傅", ""); |
| | | // } |
| | | // if(language == 3){ |
| | | // driverName = "Maître " + driverName.replace("师傅", ""); |
| | | // } |
| | | // orderInfoWarpper.setDriverName(driverName); |
| | | |
| | | File file = new File(filePath + orderId + "_1.txt"); |
| | | File file = new File(filePath + orderId + "_" + orderType + ".txt"); |
| | | if(file.exists()){ |
| | | //读取文件(字符流) |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")); |
| | |
| | | @ApiOperation(value = "获取订单取消支付页面详情", tags = {"用户端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=同城小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<OrderInfoWarpper> queryCancelPage(Integer orderId, Integer orderType, Integer language){ |
| | |
| | | ResultUtil<BaseWarpper> r = orderCrossCityService.queryCancleAmount(orderId); |
| | | map.put("cancelPayMoney", r.getData().getAmount()); |
| | | break; |
| | | case 4://同城小件物流 |
| | | map = orderLogisticsService.queryOrderInfo(language, orderId); |
| | | ResultUtil<BaseWarpper> r1 = orderLogisticsService.queryCancleAmount(orderId, language); |
| | | map.put("cancelPayMoney", r1.getData().getAmount()); |
| | | break; |
| | | } |
| | | OrderInfoWarpper orderInfoWarpper = OrderInfoWarpper.getOrderInfoWarpper(map); |
| | | // String driverName = orderInfoWarpper.getDriverName(); |
| | | // if(language == 2){ |
| | | // driverName = "Master " + driverName.replace("师傅", ""); |
| | | // } |
| | | // if(language == 3){ |
| | | // driverName = "Maître " + driverName.replace("师傅", ""); |
| | | // } |
| | | // orderInfoWarpper.setDriverName(driverName); |
| | | return ResultUtil.success(orderInfoWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | @ApiOperation(value = "获取取消订单需要支付的费用金额", tags = {"用户端-出租车", "用户端-专车"}, notes = "返回金额为0则不需要支付") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城, 4=同城小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BaseWarpper> queryCancleAmount(Integer id, Integer orderType, Integer language){ |
| | |
| | | return orderTaxiService.queryCancleAmount(id); |
| | | case 3: |
| | | return orderCrossCityService.queryCancleAmount(id); |
| | | case 4: |
| | | return orderLogisticsService.queryCancleAmount(id, language); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/addCancle") |
| | | @ApiOperation(value = "添加取消记录", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "添加取消记录【2.0】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "取消原因", name = "reason", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "当前经度", name = "lon", required = true, dataType = "Double"), |
| | | @ApiImplicitParam(value = "当前纬度", name = "lat", required = true, dataType = "Double"), |
| | | @ApiImplicitParam(value = "详细地址", name = "address", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "备注", name = "remark", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "语言类型(1=简体中文,2=英语,3=法语)", name = "language", required = false, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil addCancle(Integer id, Integer orderType, String reason, String remark, Integer language, HttpServletRequest request){ |
| | | public ResultUtil addCancle(Integer id, Integer orderType, String reason, String remark, Double lon, Double lat, String address, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | |
| | | } |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.addCancle(id, reason, remark, uid, language); |
| | | return orderPrivateCarService.addCancle(id, reason, remark, uid, lon, lat, address, language); |
| | | // case 2: |
| | | // return orderTaxiService.addCancle(id, reason, remark, uid); |
| | | // case 3: |
| | | // return orderCrossCityService.addCancle(id, reason, remark, uid); |
| | | case 4: |
| | | return orderLogisticsService.addCancle(id, reason, remark, uid, language); |
| | | return orderLogisticsService.addCancle(id, reason, remark, uid, lon, lat, address, language); |
| | | // case 5: |
| | | // return orderLogisticsService.addCancle(id, reason, remark, uid); |
| | | // case 6: |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/cancleOrderTaxi") |
| | | @ApiOperation(value = "取消操作支付【1.1】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "取消操作支付【1.1】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=同城小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付方式(1=手机支付,2=银行卡支付,3=余额)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "银行卡id", name = "bankCardId", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "取消单id(取消操作返回)", name = "cancleId", required = false, dataType = "int"), |
| | |
| | | // return orderTaxiService.cancleOrderTaxi(id, payType, cancleId, type); |
| | | // case 3: |
| | | // return orderCrossCityService.cancleOrderCrossCity(id, payType, cancleId, type); |
| | | case 4: |
| | | return orderLogisticsService.cancleOrderPrivateCar(id, payType, bankCardId, cancleId, type, language); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/complaintService") |
| | | @ApiOperation(value = "添加投诉操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "添加投诉操作【2.0】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "司机id", name = "driverId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "投诉原因", name = "reason", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "投诉描述", name = "description", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "语言类型(1=简体中文,2=英语,3=法语)", name = "language", required = false, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil complaintService(Integer driverId, String reason, String description, Integer language, HttpServletRequest request){ |
| | | public ResultUtil complaintService(Integer orderId, Integer orderType, Integer driverId, String reason, String description, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | complaintService.saveData(driverId, reason, description, uid, language); |
| | | complaintService.saveData(orderId, orderType, driverId, reason, description, uid, language); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Double payMoney = 0D; |
| | | switch (orderType){ |
| | | case 1: |
| | | map = orderPrivateCarService.queryBalance(orderId, uid); |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | payMoney = orderPrivateCar.getPayMoney(); |
| | | break; |
| | | // case 2: |
| | | // map = orderTaxiService.queryBalance(orderId, uid); |
| | |
| | | // break; |
| | | case 4: |
| | | map = orderLogisticsService.queryBalance(orderId, uid); |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | payMoney = orderLogistics.getPayMoney(); |
| | | break; |
| | | // case 5: |
| | | // map = orderLogisticsService.queryBalance(orderId, uid); |
| | | // break; |
| | | } |
| | | Double aDouble = userRedPacketRecordService.queryRemainingAmount(uid); |
| | | map.put("redTotal", aDouble); |
| | | RedEnvelopePaymentSettings redEnvelopePaymentSettings = redEnvelopePaymentSettingsService.getRedEnvelopePaymentSettings(); |
| | | if(null == redEnvelopePaymentSettings){ |
| | | map.put("deductionAmount", 0D); |
| | | }else{ |
| | | Double deductionAmount = new BigDecimal(payMoney).multiply(redEnvelopePaymentSettings.getDeductionRatio().divide(new BigDecimal(100))).doubleValue(); |
| | | map.put("deductionAmount", deductionAmount); |
| | | } |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/queryCoupon") |
| | | @ApiOperation(value = "获取支付页面的优惠券列表", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "获取支付页面的优惠券列表", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/payTaxiOrder") |
| | | @ApiOperation(value = "订单完成支付订单操作【1.1】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiOperation(value = "订单完成支付订单操作【2.0】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "支付方式(1=手机支付,2=银行卡支付,3=余额,4=线下支付)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "银行卡id", name = "bankCardId", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=同城小件物流,5=跨城小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "优惠券id", name = "couponId", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "是否红包抵扣(0=否,1=是)", name = "redDeduction", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil payTaxiOrder(Integer payType, Integer bankCardId, Integer orderId, Integer orderType, Integer couponId, Integer type, Integer language, HttpServletRequest request){ |
| | | public ResultUtil payTaxiOrder(Integer payType, Integer bankCardId, Integer orderId, Integer orderType, Integer couponId, Integer redDeduction, Integer type, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | |
| | | } |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.payPrivateCarOrder(payType, bankCardId, orderId, couponId, type, language); |
| | | return orderPrivateCarService.payPrivateCarOrder(payType, bankCardId, orderId, couponId, redDeduction, type, language); |
| | | // case 2: |
| | | // return orderTaxiService.payTaxiOrder(payType, orderId, couponId, type); |
| | | // case 3: |
| | | // return orderCrossCityService.payCrossCityOrder(payType, orderId, couponId, type); |
| | | case 4: |
| | | return orderLogisticsService.payLogisticsOrder(payType, bankCardId, orderId,couponId, type, language); |
| | | return orderLogisticsService.payLogisticsOrder(payType, bankCardId, orderId,couponId, redDeduction, type, language); |
| | | // case 5: |
| | | // return orderLogisticsService.payLogisticsOrder(payType, orderId, type, language); |
| | | } |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/orderEvaluate") |
| | | @ApiOperation(value = "订单完成后添加评价操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "订单完成后添加评价操作【2.0】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "评分", name = "fraction", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "评价内容", name = "content", required = false, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | |
| | | orderCrossCity.setState(9); |
| | | orderCrossCityService.updateById(orderCrossCity); |
| | | break; |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | orderLogistics.setState(9); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | break; |
| | | } |
| | | } |
| | | return resultUtil.getCode() == 200 ? ResultUtil.success() : resultUtil; |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/queryRedMoney") |
| | | @ApiOperation(value = "评论成功后获取红包金额", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "评论成功后获取红包金额", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BaseWarpper> queryRedMoney(Integer orderId, Integer orderType){ |
| | |
| | | return orderTaxiService.queryRedMoney(orderId); |
| | | case 3: |
| | | return orderCrossCityService.queryRedMoney(orderId); |
| | | case 4: |
| | | return orderLogisticsService.queryRedMoney(orderId); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/shareRedEnvelope") |
| | | @ApiOperation(value = "分享成功后添加红包操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "分享成功后添加红包操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"), |
| | |
| | | return orderTaxiService.shareRedEnvelope(orderId); |
| | | case 3: |
| | | return orderCrossCityService.shareRedEnvelope(orderId); |
| | | case 4: |
| | | return orderLogisticsService.shareRedEnvelope(orderId, language); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | |
| | | // case 3: |
| | | // orderCrossCityService.payCancelOrderCrossCity(id, order_id, 1); |
| | | // break; |
| | | case 4: |
| | | orderLogisticsService.payCancelOrderPrivateCar(id, order_id, language); |
| | | break; |
| | | } |
| | | callbackResponse.setCheckout_request_id(order_id); |
| | | callbackResponse.setMerchant_transaction_id(out_trade_no); |
| | |
| | | payoutCallbackResponse.setResults(results); |
| | | return payoutCallbackResponse; |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/updateEndAddress") |
| | | @ApiOperation(value = "修改目的地【2.0】", tags = {"用户端-专车", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "终点经度", name = "endLon", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "终点纬度", name = "endLat", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "终点地址", name = "endAddress", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "语言", name = "language", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil updateEndAddress(Integer orderId, Integer orderType, String endLon, String endLat, String endAddress){ |
| | | switch (orderType){ |
| | | case 1: |
| | | orderPrivateCarService.updateEndAddress(orderId, endLon, endLat, endAddress); |
| | | break; |
| | | case 4: |
| | | orderLogisticsService.updateEndAddress(orderId, endLon, endLat, endAddress); |
| | | break; |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/redEnvelopeDeductionAmount") |
| | | @ApiOperation(value = "获取支付页红包抵扣金额【2.0】", tags = {"用户端-专车", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "语言", name = "language", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil redEnvelopeDeductionAmount(Integer orderId, Integer orderType, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Double payMoney = 0D; |
| | | switch (orderType){ |
| | | case 1: |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | payMoney = orderPrivateCar.getPayMoney(); |
| | | break; |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | payMoney = orderLogistics.getPayMoney(); |
| | | break; |
| | | } |
| | | |
| | | Double aDouble = userRedPacketRecordService.queryRemainingAmount(uid); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("redTotal", aDouble); |
| | | RedEnvelopePaymentSettings redEnvelopePaymentSettings = redEnvelopePaymentSettingsService.getRedEnvelopePaymentSettings(); |
| | | if(null == redEnvelopePaymentSettings){ |
| | | map.put("deductionAmount", 0D); |
| | | return ResultUtil.success(map); |
| | | } |
| | | Double deductionAmount = new BigDecimal(payMoney).multiply(redEnvelopePaymentSettings.getDeductionRatio().divide(new BigDecimal(100))).doubleValue(); |
| | | map.put("deductionAmount", deductionAmount); |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.model.UserRedPacketRecord; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.service.IUserRedPacketRecordService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.MyRedEnvelope; |
| | | import com.stylefeng.guns.modular.system.warpper.TravelRecordListWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.TravelRecordWarpper; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Queue; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 红包控制器 |
| | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | |
| | | /** |
| | | * 获取红包列表 |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryMyRedEnvelope") |
| | | @ApiOperation(value = "获取红包列表", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取红包列表【2.0】", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码(首页1)", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<BaseWarpper>> queryMyRedEnvelope(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | public ResultUtil<List<MyRedEnvelope>> queryMyRedEnvelope(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<UserRedPacketRecord> userRedPacketRecords = userRedPacketRecordService.selectList(new EntityWrapper<UserRedPacketRecord>().eq("userId", uid).ne("state", 0)); |
| | | List<Double> collect = userRedPacketRecords.stream().map(UserRedPacketRecord::getMoney).collect(Collectors.toList()); |
| | | double sum = collect.stream().mapToDouble(Double::doubleValue).sum(); |
| | | |
| | | double sum1 = userRedPacketRecords.stream().filter(v -> v.getRemainingAmount().compareTo(0D) > 0).map(UserRedPacketRecord::getRemainingAmount).mapToDouble(Double::doubleValue).sum(); |
| | | |
| | | List<Map<String, Object>> list = userRedPacketRecordService.queryMyRedEnvelope(pageNum, size, uid); |
| | | List<BaseWarpper> baseWarppers = new ArrayList<>(); |
| | | List<MyRedEnvelope> baseWarppers = new ArrayList<>(); |
| | | for(Map<String, Object> map : list){ |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | MyRedEnvelope baseWarpper = new MyRedEnvelope(); |
| | | baseWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); |
| | | baseWarpper.setAmount(null != map.get("money") ? Double.valueOf(String.valueOf(map.get("money"))) : 0); |
| | | baseWarpper.setName(null != map.get("name") ? String.valueOf(map.get("name")) : ""); |
| | | baseWarpper.setContent(null != map.get("insertTime") ? String.valueOf(map.get("insertTime")) : ""); |
| | | baseWarpper.setTotalAmount(sum); |
| | | baseWarpper.setRemainingAmount(sum1); |
| | | baseWarppers.add(baseWarpper); |
| | | } |
| | | return ResultUtil.success(baseWarppers); |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryRedEnvelope") |
| | | @ApiOperation(value = "获取红包使用记录", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取红包使用记录【2.0】", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码(首页1)", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<TravelRecordWarpper>> queryRedEnvelope(Integer language, Integer pageNum, Integer size, HttpServletRequest request){ |
| | | public ResultUtil<List<TravelRecordListWarpper>> queryRedEnvelope(Integer language, Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | |
| | | } |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> list = orderPrivateCarService.queryRedEnvelope(language, uid);//专车 |
| | | List<Map<String, Object>> list1 = orderTaxiService.queryRedEnvelope(language, uid);//出租车 |
| | | List<Map<String, Object>> list2 = orderCrossCityService.queryRedEnvelope(language, uid);//跨城 |
| | | // List<Map<String, Object>> list1 = orderTaxiService.queryRedEnvelope(language, uid);//出租车 |
| | | // List<Map<String, Object>> list2 = orderCrossCityService.queryRedEnvelope(language, uid);//跨城 |
| | | // list.addAll(list1); |
| | | // list.addAll(list2); |
| | | List<Map<String, Object>> list1 = orderLogisticsService.queryRedEnvelope(language, uid); |
| | | list.addAll(list1); |
| | | list.addAll(list2); |
| | | |
| | | List<TravelRecordWarpper> orderWarpper = TravelRecordWarpper.getTravelRecordWarpper(list); |
| | | List<TravelRecordListWarpper> orderWarpper = TravelRecordListWarpper.getTravelRecordWarpper(list); |
| | | double sum = orderWarpper.stream().mapToDouble(TravelRecordListWarpper::getMoney).sum(); |
| | | for (TravelRecordListWarpper travelRecordListWarpper : orderWarpper) { |
| | | travelRecordListWarpper.setTotal(sum); |
| | | } |
| | | |
| | | //分页 |
| | | if(orderWarpper.size() >= (pageNum + 1) * size){ |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryServerCarModel") |
| | | @ApiOperation(value = "选择起点终点后获取车型和预估价格", tags = {"用户端-专车"}, notes = "") |
| | | @ApiOperation(value = "选择起点终点后获取车型和预估价格【2.0】", tags = {"用户端-专车", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "起点经纬度(103.22121,,30.26123)", name = "startLonLat", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "终点经纬度(103.22121,,30.26123)", name = "endLonLat", required = true, dataType = "string"), |
| | |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | | import com.stylefeng.guns.modular.taxi.model.TransactionDetails; |
| | |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | @Autowired |
| | | private IPaymentRecordService paymentRecordService; |
| | | |
| | | @Autowired |
| | | private FleetEngineUtil fleetEngineUtil; |
| | | |
| | | |
| | | |
| | |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | // RechargeRecordWarpper rechargeRecordWarpper = new RechargeRecordWarpper(); |
| | | RechargeRecordWarpper rechargeRecordWarpper = new RechargeRecordWarpper(); |
| | | List<Map<String,Object>> paymentRecord = paymentRecordService.queryRechargeRecord(uid, pageNum, size); |
| | | for (Map<String, Object> map : paymentRecord) { |
| | | if(null != map.get("insertTime")){ |
| | |
| | | List<TransactionDetailsWarpper> transactionDetailsWarpper = TransactionDetailsWarpper.getTransactionDetailsWarpper(paymentRecord); |
| | | |
| | | // 查询充值金额总和 |
| | | // double sum = paymentRecordService.queryRechargeMoneySum(uid); |
| | | // rechargeRecordWarpper.setSum(sum); |
| | | // rechargeRecordWarpper.setTransactionDetailsWarpper(transactionDetailsWarpper); |
| | | return ResultUtil.success(transactionDetailsWarpper); |
| | | double sum = paymentRecordService.queryRechargeMoneySum(uid); |
| | | rechargeRecordWarpper.setSum(sum); |
| | | rechargeRecordWarpper.setTransactionDetailsWarpper(transactionDetailsWarpper); |
| | | return ResultUtil.success(rechargeRecordWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/user/getFleetEngineAuth") |
| | | @ApiOperation(value = "获取google地图授权token", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<Map<String, Object>> getFleetEngineAuth(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Map<String, Object> s = fleetEngineUtil.fleetEngineAuth(1, uid); |
| | | return ResultUtil.success(s); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.modular.system.model.Withdrawal; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.service.IWithdrawalService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.WithdrawalVo; |
| | | import com.stylefeng.guns.modular.system.warpper.WithdrawalWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 提现控制器 |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/withdrawal/queryWithdrawal") |
| | | @ApiOperation(value = "获取历史提现数据", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取历史提现数据【2.0】", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "提现状态(1=待处理,2=已提现,3=提现失败)", name = "state", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<WithdrawalWarpper>> queryWithdrawal(Integer pageNum, Integer size, Integer language, HttpServletRequest request){ |
| | | public ResultUtil<List<WithdrawalWarpper>> queryWithdrawal(Integer pageNum, Integer size, Integer state, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> list = withdrawalService.queryWithdrawal(uid, pageNum, size, language); |
| | | List<Map<String, Object>> list = withdrawalService.queryWithdrawal(uid, pageNum, size, state, language); |
| | | List<Withdrawal> withdrawals = withdrawalService.selectList(new EntityWrapper<Withdrawal>().eq("userId", uid).eq("userType", 1).ne("flag", 3)); |
| | | double withdrawn = withdrawals.stream().filter(s -> s.getState().compareTo(2) == 0).mapToDouble(Withdrawal::getMoney).sum(); |
| | | double processing = withdrawals.stream().filter(s -> s.getState().compareTo(1) == 0).mapToDouble(Withdrawal::getMoney).sum(); |
| | | double fail = withdrawals.stream().filter(s -> s.getState().compareTo(3) == 0).mapToDouble(Withdrawal::getMoney).sum(); |
| | | for (Map<String, Object> map : list) { |
| | | map.put("withdrawn", withdrawn); |
| | | map.put("processing", processing); |
| | | map.put("fail", fail); |
| | | } |
| | | return ResultUtil.success(WithdrawalWarpper.getWithdrawalWarpper(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderCrossCity.getUserId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | pushUtil.pushDriverPosition(orderCrossCity.getId(), 3); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderCrossCity.getUserId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | pushUtil.pushDriverPosition(orderCrossCity.getId(), 3); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | return ResultUtil.error("获取数据失败,订单信息有误"); |
| | | } |
| | | double amount = 0; |
| | | CancleOrder query = cancleOrderService.query(1, 3, orderCrossCity.getCompanyId()); |
| | | if(null != orderCrossCity.getDriverId() && |
| | | (orderCrossCity.getSnatchOrderTime().getTime() + query.getMinuteNum() * 60 * 1000) < new Date().getTime()){//收费的情况 |
| | | if(null != query){ |
| | | amount += query.getMoney(); |
| | | } |
| | | } |
| | | // CancleOrder query = cancleOrderService.query(1, 3, orderCrossCity.getCompanyId()); |
| | | // if(null != orderCrossCity.getDriverId() && |
| | | // (orderCrossCity.getSnatchOrderTime().getTime() + query.getMinuteNum() * 60 * 1000) < new Date().getTime()){//收费的情况 |
| | | // if(null != query){ |
| | | // amount += query.getMoney(); |
| | | // } |
| | | // } |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | |
| | | orderCancel = orderCancelService.selectById(cancleId); |
| | | } |
| | | |
| | | CancleOrder query = cancleOrderService.query(1, 3, orderCrossCity.getCompanyId()); |
| | | if(null != query){ |
| | | if(payType == 1){//微信支付 |
| | | orderCancel.setPayType(1); |
| | | orderCancelService.updateById(orderCancel); |
| | | resultUtil = payMoneyUtil.weixinpay("订单取消",id +"",id + "_3_fei",query.getMoney()+"","/base/wxCancelOrderTaxi","JSAPI",userInfo.getAppletsOpenId()); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, id, 3, 1, query.getMoney(), null, 1);//添加预支付数据 |
| | | resultUtil = resultUtil; |
| | | }else{ |
| | | resultUtil = ResultUtil.error(language == 1 ? "获取支付信息失败" : language == 2 ? "Failed to obtain payment information" : "Impossible d’obtenir les informations de paiement", ""); |
| | | } |
| | | } |
| | | if(payType == 2){//支付宝支付 |
| | | orderCancel.setPayType(2); |
| | | orderCancelService.updateById(orderCancel); |
| | | resultUtil = payMoneyUtil.alipay("订单取消","订单取消",id + ",3",query.getMoney()+"","/base/aliCancelOrderTaxi"); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, id, 3, 2, query.getMoney(), null, 1);//添加预支付数据 |
| | | resultUtil = resultUtil; |
| | | }else{ |
| | | resultUtil = ResultUtil.error(language == 1 ? "获取支付信息失败" : language == 2 ? "Failed to obtain payment information" : "Impossible d’obtenir les informations de paiement", ""); |
| | | } |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient balance" : "Solde insuffisant"); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "取消订单", query.getMoney(), 2, 1, 1, 3, id); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | //解除小号绑定 |
| | | if(orderCrossCity.getBindId() != null){ |
| | | chinaMobileUtil.midAxbUnBindSend(orderCrossCity.getBindId(),orderCrossCity.getTelX()); |
| | | } |
| | | |
| | | orderCrossCity.setState(10); |
| | | orderCrossCity.setTelX(""); |
| | | orderCrossCity.setBindId(""); |
| | | this.updateById(orderCrossCity); |
| | | |
| | | orderCancel.setState(2); |
| | | orderCancel.setPayType(3); |
| | | orderCancelService.updateById(orderCancel); |
| | | |
| | | //添加已收入明细 |
| | | incomeService.saveData(1, orderCrossCity.getCompanyId(), 3, orderCrossCity.getId(), 3, query.getMoney()); |
| | | |
| | | this.deleteTask(id);//删除定时任务 |
| | | |
| | | // new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | // CancleOrder query = cancleOrderService.query(1, 3, orderCrossCity.getCompanyId()); |
| | | // if(null != query){ |
| | | // if(payType == 1){//微信支付 |
| | | // orderCancel.setPayType(1); |
| | | // orderCancelService.updateById(orderCancel); |
| | | // resultUtil = payMoneyUtil.weixinpay("订单取消",id +"",id + "_3_fei",query.getMoney()+"","/base/wxCancelOrderTaxi","JSAPI",userInfo.getAppletsOpenId()); |
| | | // if(resultUtil.getCode()==200){ |
| | | // paymentRecordService.saveData(1, null, null, id, 3, 1, query.getMoney(), null, 1);//添加预支付数据 |
| | | // resultUtil = resultUtil; |
| | | // }else{ |
| | | // resultUtil = ResultUtil.error(language == 1 ? "获取支付信息失败" : language == 2 ? "Failed to obtain payment information" : "Impossible d’obtenir les informations de paiement", ""); |
| | | // } |
| | | // }).start(); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, "您已使用余额成功支付取消订单费用,谢谢使用!", orderCrossCity.getUserId(), 1); |
| | | } |
| | | } |
| | | // } |
| | | // if(payType == 2){//支付宝支付 |
| | | // orderCancel.setPayType(2); |
| | | // orderCancelService.updateById(orderCancel); |
| | | // resultUtil = payMoneyUtil.alipay("订单取消","订单取消",id + ",3",query.getMoney()+"","/base/aliCancelOrderTaxi"); |
| | | // if(resultUtil.getCode()==200){ |
| | | // paymentRecordService.saveData(1, null, null, id, 3, 2, query.getMoney(), null, 1);//添加预支付数据 |
| | | // resultUtil = resultUtil; |
| | | // }else{ |
| | | // resultUtil = ResultUtil.error(language == 1 ? "获取支付信息失败" : language == 2 ? "Failed to obtain payment information" : "Impossible d’obtenir les informations de paiement", ""); |
| | | // } |
| | | // } |
| | | // if(payType == 3){//余额支付 |
| | | // if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ |
| | | // return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient balance" : "Solde insuffisant"); |
| | | // } |
| | | // |
| | | // userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // //添加交易明细 |
| | | // transactionDetailsService.saveData(uid, "取消订单", query.getMoney(), 2, 1, 1, 3, id); |
| | | // userInfoService.updateById(userInfo); |
| | | // |
| | | // //解除小号绑定 |
| | | // if(orderCrossCity.getBindId() != null){ |
| | | // chinaMobileUtil.midAxbUnBindSend(orderCrossCity.getBindId(),orderCrossCity.getTelX()); |
| | | // } |
| | | // |
| | | // orderCrossCity.setState(10); |
| | | // orderCrossCity.setTelX(""); |
| | | // orderCrossCity.setBindId(""); |
| | | // this.updateById(orderCrossCity); |
| | | // |
| | | // orderCancel.setState(2); |
| | | // orderCancel.setPayType(3); |
| | | // orderCancelService.updateById(orderCancel); |
| | | // |
| | | // //添加已收入明细 |
| | | // incomeService.saveData(1, orderCrossCity.getCompanyId(), 3, orderCrossCity.getId(), 3, query.getMoney()); |
| | | // |
| | | // this.deleteTask(id);//删除定时任务 |
| | | // |
| | | //// new Thread(new Runnable() { |
| | | //// @Override |
| | | //// public void run() { |
| | | //// pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | //// } |
| | | //// }).start(); |
| | | // |
| | | // //添加消息 |
| | | // systemNoticeService.addSystemNotice(1, "您已使用余额成功支付取消订单费用,谢谢使用!", orderCrossCity.getUserId(), 1); |
| | | // } |
| | | // } |
| | | return resultUtil; |
| | | } |
| | | |
| | |
| | | }else{//随机金额 |
| | | Double startMoney = Double.valueOf(String.valueOf(query.get("startMoney"))); |
| | | Double endMoney = Double.valueOf(String.valueOf(query.get("endMoney"))); |
| | | int i = new BigDecimal(endMoney).subtract(new BigDecimal(startMoney)).intValue(); |
| | | Random random = new Random(); |
| | | int num = random.nextInt(i); |
| | | money = new BigDecimal(startMoney).add(new BigDecimal(num)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | money = new BigDecimal(startMoney + (Math.random() * (endMoney - startMoney))).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | //判断当前红包是否大于剩余可领取总金额 |
| | | if(money.compareTo(Double.valueOf(query.get("lavePrice").toString())) > 0){ |
| | |
| | | //添加临时红包数据 |
| | | UserRedPacketRecord userRedPacketRecord = new UserRedPacketRecord(); |
| | | userRedPacketRecord.setMoney(money); |
| | | userRedPacketRecord.setRemainingAmount(money); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) + Integer.valueOf(String.valueOf(query.get("effective")))); |
| | | userRedPacketRecord.setExpirationTime(calendar.getTime()); |
| | | userRedPacketRecord.setInsertTime(new Date()); |
| | | userRedPacketRecord.setCompanyId(Integer.valueOf(String.valueOf(query.get("companyId")))); |
| | | userRedPacketRecord.setState(0); |
| | |
| | | } |
| | | |
| | | //还原座位 |
| | | CancleOrder query1 = cancleOrderService.query(1, 3, orderCrossCity.getCompanyId()); |
| | | if (null != query1) { |
| | | integer = orderCancelService.saveData(id, 3, reason, remark, null, null, 2, 1, uid); |
| | | orderCrossCity.setState(10); |
| | | this.updateById(orderCrossCity); |
| | | |
| | | if(orderCrossCity.getState() != 7){//已经支付的情况推送给司机提醒 |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | System.err.println("推送取消操作---------------------"); |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | //修改司机座位 |
| | | LineShiftDriver lineShiftDriver = lineShiftDriverMapper.selectById(orderCrossCity.getLineShiftDriverId()); |
| | | lineShiftDriver.setLaveSeat(lineShiftDriver.getLaveSeat() + orderCrossCity.getPeopleNumber()); |
| | | lineShiftDriver.setLaveSeatNumber(lineShiftDriver.getLaveSeatNumber() + (orderCrossCity.getTravelMode() == 1 ? "," : "") + orderCrossCity.getSeatNumber()); |
| | | lineShiftDriverMapper.updateById(lineShiftDriver); |
| | | |
| | | //修改司机为空闲 |
| | | List<OrderCrossCity> orderCrossCities = orderCrossCityMapper.queryByDriverId(orderCrossCity.getDriverId(), 2, 3, 4, 5, 11); |
| | | if(orderCrossCities.size() == 0){ |
| | | Driver driver = driverService.selectById(orderCrossCity.getDriverId()); |
| | | driver.setState(2); |
| | | driverService.updateById(driver); |
| | | } |
| | | }else{ |
| | | return ResultUtil.error("请完善后台取消规则设置"); |
| | | } |
| | | |
| | | //已支付的情况下进行退款操作 |
| | | if(null != orderCrossCity.getPayType() && null != orderCrossCity.getPayMoney()){ |
| | | if(orderCrossCity.getPayType() == 3){//余额支付 |
| | | UserInfo userInfo = userInfoService.selectById(orderCrossCity.getUserId()); |
| | | userInfo.setBalance(userInfo.getBalance() + orderCrossCity.getPayMoney()); |
| | | userInfoService.updateById(userInfo); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城订单取消退款", orderCrossCity.getPayMoney(), 1, 1, 1, 3, id); |
| | | }else{ |
| | | PaymentRecord query = paymentRecordService.query(1, null, null, id, 3, null, 2); |
| | | if(null == query){ |
| | | return ResultUtil.error("订单还未进行支付"); |
| | | } |
| | | if(orderCrossCity.getPayType() == 1){ |
| | | payMoneyUtil.wxRefund(query.getCode(),id + ",3",query.getAmount()+"",query.getAmount()+"",""); |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城订单取消退款", query.getAmount(), 1, 1, 1, 3, id); |
| | | }else{ |
| | | payMoneyUtil.aliRefund(query.getCode(),query.getAmount()+""); |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城订单取消退款", query.getAmount(), 1, 1, 1, 3, id); |
| | | } |
| | | /*Map<String, Object> merrefund = icbcPayUtil.merrefund(query.getCode(), "", query.getAmount(), id + "_3", orderCrossCity.getOrderNum()); |
| | | if(Integer.valueOf(merrefund.get("code").toString()) == 0){ |
| | | Map<String, Object> refundqry = icbcPayUtil.refundqry("", query.getCode(), orderCrossCity.getOrderNum()); |
| | | if(Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 0){//成功 |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城订单取消退款", query.getAmount(), 1, 1, 1, 3, id); |
| | | } |
| | | if(Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 1){//失败 |
| | | return ResultUtil.error("订单取消失败(退款不成功)"); |
| | | } |
| | | if(Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 2){//未知 |
| | | return ResultUtil.error("退款返回未知异常"); |
| | | } |
| | | }*/ |
| | | } |
| | | |
| | | //添加负的收入明细 |
| | | List<Income> incomes = incomeService.selectList(new EntityWrapper<Income>().eq("type", 2).eq("incomeId", id).eq("orderType", 3)); |
| | | for(Income income : incomes){ |
| | | if(income.getUserType() == 2){//处理司机的收入 |
| | | Driver driver = driverService.selectById(income.getObjectId()); |
| | | driver.setBalance(driver.getBalance() - income.getMoney()); |
| | | driver.setBusinessMoney(driver.getBusinessMoney() - income.getMoney()); |
| | | driver.setLaveBusinessMoney(driver.getLaveBusinessMoney() - income.getMoney()); |
| | | driverService.updateById(driver); |
| | | } |
| | | Income income1 = new Income(); |
| | | BeanUtils.copyProperties(income, income1); |
| | | income1.setMoney(income.getMoney() * -1); |
| | | income1.setId(null); |
| | | income1.setInsertTime(new Date()); |
| | | incomeService.insert(income1); |
| | | } |
| | | } |
| | | // CancleOrder query1 = cancleOrderService.query(1, 3, orderCrossCity.getCompanyId()); |
| | | // if (null != query1) { |
| | | // integer = orderCancelService.saveData(id, 3, reason, remark, null, null, 2, 1, uid); |
| | | // orderCrossCity.setState(10); |
| | | // this.updateById(orderCrossCity); |
| | | // |
| | | // if(orderCrossCity.getState() != 7){//已经支付的情况推送给司机提醒 |
| | | // new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | // System.err.println("推送取消操作---------------------"); |
| | | // } |
| | | // }).start(); |
| | | // } |
| | | // |
| | | // //修改司机座位 |
| | | // LineShiftDriver lineShiftDriver = lineShiftDriverMapper.selectById(orderCrossCity.getLineShiftDriverId()); |
| | | // lineShiftDriver.setLaveSeat(lineShiftDriver.getLaveSeat() + orderCrossCity.getPeopleNumber()); |
| | | // lineShiftDriver.setLaveSeatNumber(lineShiftDriver.getLaveSeatNumber() + (orderCrossCity.getTravelMode() == 1 ? "," : "") + orderCrossCity.getSeatNumber()); |
| | | // lineShiftDriverMapper.updateById(lineShiftDriver); |
| | | // |
| | | // //修改司机为空闲 |
| | | // List<OrderCrossCity> orderCrossCities = orderCrossCityMapper.queryByDriverId(orderCrossCity.getDriverId(), 2, 3, 4, 5, 11); |
| | | // if(orderCrossCities.size() == 0){ |
| | | // Driver driver = driverService.selectById(orderCrossCity.getDriverId()); |
| | | // driver.setState(2); |
| | | // driverService.updateById(driver); |
| | | // } |
| | | // }else{ |
| | | // return ResultUtil.error("请完善后台取消规则设置"); |
| | | // } |
| | | // |
| | | // //已支付的情况下进行退款操作 |
| | | // if(null != orderCrossCity.getPayType() && null != orderCrossCity.getPayMoney()){ |
| | | // if(orderCrossCity.getPayType() == 3){//余额支付 |
| | | // UserInfo userInfo = userInfoService.selectById(orderCrossCity.getUserId()); |
| | | // userInfo.setBalance(userInfo.getBalance() + orderCrossCity.getPayMoney()); |
| | | // userInfoService.updateById(userInfo); |
| | | // //添加交易明细 |
| | | // transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城订单取消退款", orderCrossCity.getPayMoney(), 1, 1, 1, 3, id); |
| | | // }else{ |
| | | // PaymentRecord query = paymentRecordService.query(1, null, null, id, 3, null, 2); |
| | | // if(null == query){ |
| | | // return ResultUtil.error("订单还未进行支付"); |
| | | // } |
| | | // if(orderCrossCity.getPayType() == 1){ |
| | | // payMoneyUtil.wxRefund(query.getCode(),id + ",3",query.getAmount()+"",query.getAmount()+"",""); |
| | | // transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城订单取消退款", query.getAmount(), 1, 1, 1, 3, id); |
| | | // }else{ |
| | | // payMoneyUtil.aliRefund(query.getCode(),query.getAmount()+""); |
| | | // transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城订单取消退款", query.getAmount(), 1, 1, 1, 3, id); |
| | | // } |
| | | // /*Map<String, Object> merrefund = icbcPayUtil.merrefund(query.getCode(), "", query.getAmount(), id + "_3", orderCrossCity.getOrderNum()); |
| | | // if(Integer.valueOf(merrefund.get("code").toString()) == 0){ |
| | | // Map<String, Object> refundqry = icbcPayUtil.refundqry("", query.getCode(), orderCrossCity.getOrderNum()); |
| | | // if(Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 0){//成功 |
| | | // //添加交易明细 |
| | | // transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城订单取消退款", query.getAmount(), 1, 1, 1, 3, id); |
| | | // } |
| | | // if(Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 1){//失败 |
| | | // return ResultUtil.error("订单取消失败(退款不成功)"); |
| | | // } |
| | | // if(Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 2){//未知 |
| | | // return ResultUtil.error("退款返回未知异常"); |
| | | // } |
| | | // }*/ |
| | | // } |
| | | // |
| | | // //添加负的收入明细 |
| | | // List<Income> incomes = incomeService.selectList(new EntityWrapper<Income>().eq("type", 2).eq("incomeId", id).eq("orderType", 3)); |
| | | // for(Income income : incomes){ |
| | | // if(income.getUserType() == 2){//处理司机的收入 |
| | | // Driver driver = driverService.selectById(income.getObjectId()); |
| | | // driver.setBalance(driver.getBalance() - income.getMoney()); |
| | | // driver.setBusinessMoney(driver.getBusinessMoney() - income.getMoney()); |
| | | // driver.setLaveBusinessMoney(driver.getLaveBusinessMoney() - income.getMoney()); |
| | | // driverService.updateById(driver); |
| | | // } |
| | | // Income income1 = new Income(); |
| | | // BeanUtils.copyProperties(income, income1); |
| | | // income1.setMoney(income.getMoney() * -1); |
| | | // income1.setId(null); |
| | | // income1.setInsertTime(new Date()); |
| | | // incomeService.insert(income1); |
| | | // } |
| | | // } |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, "您已成功取消出行订单,谢谢使用!", orderCrossCity.getUserId(), 1); |
| | |
| | | package com.stylefeng.guns.modular.smallLogistics.controller; |
| | | |
| | | |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.system.model.Region; |
| | | import com.stylefeng.guns.modular.system.model.UserRedPacketRecord; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderTimeInfo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/orderLogistics/placeOrderPackage") |
| | | @ApiOperation(value = "小件物流下单操作【2.0】", tags = {"用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "备注", name = "remark", required = false, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "下单点经度", name = "placementLon", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "下单点纬度", name = "placementLat", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "起点经度", name = "startLon", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "起点纬度", name = "startLat", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "起点详细地址", name = "startAddress", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "收货人姓名", name = "recipient", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "收货人电话", name = "recipientPhone", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "终点经度", name = "endLon", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "终点纬度", name = "endLat", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "收货详细地址", name = "endAddress", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "车型id", name = "serverCarModelId", required = true, paramType = "query", dataType = "int"), |
| | | @ApiImplicitParam(value = "司机id", name = "driverId", required = false, paramType = "query", dataType = "int"), |
| | | @ApiImplicitParam(value = "下单方式(1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单)", name = "orderSource", required = true, paramType = "query", dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BaseWarpper> placeOrderPackage(String remark, String placementLon, String placementLat, String startLon, String startLat, String startAddress, |
| | | String recipient, String recipientPhone, String endLon, String endLat, String endAddress, Integer serverCarModelId, |
| | | Integer driverId, Integer orderSource, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return orderLogisticsService.placeOrderPackage(remark, placementLon, placementLat, startLon, startLat, startAddress, |
| | | recipient, recipientPhone, endLon, endLat, endAddress, serverCarModelId, driverId, orderSource, uid, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/orderLogistics/queryLogisticsNumber") |
| | | @ApiOperation(value = "获取首页小件物流订单数量", tags = {"用户端-小件物流"}, notes = "") |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/orderLogistics/queryTimeInfo") |
| | | @ApiOperation(value = "获取订单详情中的时间信息内容【2.0】", tags = {"用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<OrderTimeInfo> queryTimeInfo(Integer orderId, Integer language){ |
| | | try { |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | OrderTimeInfo orderTimeInfo = new OrderTimeInfo(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | if(null != orderLogistics.getSnatchOrderTime()){ |
| | | orderTimeInfo.setSnatchOrderTime(sdf.format(orderLogistics.getSnatchOrderTime())); |
| | | } |
| | | if(null != orderLogistics.getStartServiceTime()){ |
| | | orderTimeInfo.setStartServiceTime(sdf.format(orderLogistics.getStartServiceTime())); |
| | | } |
| | | long time = System.currentTimeMillis() - orderLogistics.getSnatchOrderTime().getTime() / 60000; |
| | | |
| | | int h = Double.valueOf(time / 60).intValue(); |
| | | long m = time % 60; |
| | | String usedTime = ""; |
| | | if(0 == h){ |
| | | usedTime = language == 1 ? m + "分钟" : language == 2 ? m + "-minute" : m + "-minute"; |
| | | }else{ |
| | | usedTime = language == 1 ? h + "小时" + m + "分钟" : language == 2 ? h + "-hour" + m + "-minute" : h + "-hour" + m + "-minute"; |
| | | } |
| | | orderTimeInfo.setUsedTime(usedTime); |
| | | if(null != orderLogistics.getEndServiceTime()){ |
| | | orderTimeInfo.setEndServiceTime(sdf.format(orderLogistics.getEndServiceTime())); |
| | | } |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), orderLogistics.getEndLat(), orderLogistics.getEndLon()); |
| | | Long distance = distancematrix.getDistance(); |
| | | orderTimeInfo.setAllMileage(Double.valueOf(distance / 1000)); |
| | | orderTimeInfo.setMileage(orderLogistics.getMileage() / 1000); |
| | | return ResultUtil.success(orderTimeInfo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/orderLogistics/confirmDifferencePrice") |
| | | @ApiOperation(value = "确认补差价【2.0】", tags = {"用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "差价金额", name = "difference", required = true, dataType = "double"), |
| | | @ApiImplicitParam(value = "状态(2=同意,3=拒绝)", name = "status", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil confirmDifferencePrice(Integer orderId, Double difference, Integer status){ |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | if(1 == status){ |
| | | orderLogistics.setPriceDifference(difference); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | } |
| | | pushUtil.pushPayDifference(2, orderLogistics.getDriverId(), orderId, 4, difference, status); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | Map<String, Object> queryOrderInfo(@Param("orderId") Integer orderId); |
| | | |
| | | |
| | | /** |
| | | * 获取红包使用记录 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryRedEnvelope(@Param("uid") Integer uid); |
| | | } |
| | |
| | | trackId as trackId, |
| | | isDelete as isDelete, |
| | | telX as telX, |
| | | bindId as bindId |
| | | bindId as bindId, |
| | | tripId |
| | | from t_order_logistics where isDelete = 1 |
| | | <if test="null != start and null != end"> |
| | | and insertTime between #{start} and #{end} |
| | |
| | | orderMoney as orderMoney, |
| | | payMoney as payMoney, |
| | | ifnull(discountMoney, 0) as discountMoney, |
| | | (select price from t_order_logistics_spread where orderLogisticsId = a.id) as differenceMoney |
| | | (select price from t_order_logistics_spread where orderLogisticsId = a.id) as differenceMoney, |
| | | cancelMidway, |
| | | tripId |
| | | from t_order_logistics as a where userId = #{uid} and isDelete = 1 order by insertTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | |
| | | a.endAddress as endAddress, |
| | | a.driverId as driverId, |
| | | a.orderMoney as orderMoney, |
| | | a.startMileage as startMileage, |
| | | a.mileage as mileage, |
| | | a.startMoney as startMoney, |
| | | a.mileageKilometers as mileageKilometers, |
| | | a.mileageMoney as mileageMoney, |
| | | a.duration as duration, |
| | | a.durationMoney as durationMoney, |
| | | a.wait as wait, |
| | | a.waitMoney as waitMoney, |
| | | a.longDistance as longDistance, |
| | | a.longDistanceMoney as longDistanceMoney, |
| | | a.parkMoney as parkMoney, |
| | | a.roadTollMoney as roadTollMoney, |
| | | a.redPacketMoney as redPacketMoney, |
| | | a.couponMoney as couponMoney, |
| | | a.discount as discount, |
| | | a.discountMoney as discountMoney, |
| | | a.priceDifference, |
| | | a.payType, |
| | | a.payMoney as payMoney, |
| | | a.remark as remark, |
| | | a.companyId, |
| | | b.headImgUrl as driverAvatar, |
| | | CONCAT(b.firstName, " ", b.lastName) as driverName, |
| | | c.carLicensePlate as licensePlate, |
| | |
| | | h.userType as cancelUserType, |
| | | h.money as cancelMoney, |
| | | h.reason as cancelReason, |
| | | h.remark as cancelRemark |
| | | h.remark as cancelRemark, |
| | | a.tripId, |
| | | a.snatchOrderTime |
| | | from t_order_logistics a |
| | | left join t_driver b on (a.driverId = b.id) |
| | | left join t_car c on (a.carId = c.id) |
| | |
| | | left join t_order_cancel h on (a.id = h.orderId and h.orderType = a.type and h.state = 2) |
| | | where a.id = #{orderId} |
| | | </select> |
| | | |
| | | |
| | | <select id="queryRedEnvelope" resultType="map"> |
| | | select |
| | | redPacketMoney as money, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as time, |
| | | ('包裹') as name, |
| | | UNIX_TIMESTAMP(insertTime) as insertTime |
| | | from t_order_logistics where userId = #{uid} and state in (8, 9) and redPacketId is not null |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 小件物流订单 |
| | | */ |
| | | @Data |
| | | @TableName("t_order_logistics") |
| | | public class OrderLogistics { |
| | | /** |
| | |
| | | */ |
| | | @TableField("carId") |
| | | private Integer carId; |
| | | /** |
| | | * 服务车型id |
| | | */ |
| | | @TableField("serverCarModelId") |
| | | private Integer serverCarModelId; |
| | | /** |
| | | * 订单号 |
| | | */ |
| | |
| | | @TableField("orderMoney") |
| | | private Double orderMoney; |
| | | /** |
| | | * 行程费 |
| | | * 起步价 |
| | | */ |
| | | @TableField("travelMoney") |
| | | private Double travelMoney; |
| | | @TableField("startMoney") |
| | | private Double startMoney; |
| | | /** |
| | | * 小费 |
| | | * 里程公里 |
| | | */ |
| | | @TableField("tipMoney") |
| | | private Double tipMoney; |
| | | @TableField("mileageKilometers") |
| | | private Double mileageKilometers; |
| | | /** |
| | | * 里程费 |
| | | */ |
| | | @TableField("mileageMoney") |
| | | private Double mileageMoney; |
| | | /** |
| | | * 时长分钟 |
| | | */ |
| | | @TableField("duration") |
| | | private Double duration; |
| | | /** |
| | | * 时长费 |
| | | */ |
| | | @TableField("durationMoney") |
| | | private Double durationMoney; |
| | | /** |
| | | * 等待分钟 |
| | | */ |
| | | @TableField("wait") |
| | | private Double wait; |
| | | /** |
| | | * 等待费 |
| | | */ |
| | | @TableField("waitMoney") |
| | | private Double waitMoney; |
| | | /** |
| | | * 远途公里 |
| | | */ |
| | | @TableField("longDistance") |
| | | private Double longDistance; |
| | | /** |
| | | * 远途费 |
| | | */ |
| | | @TableField("longDistanceMoney") |
| | | private Double longDistanceMoney; |
| | | /** |
| | | * 停车费 |
| | | */ |
| | | @TableField("parkMoney") |
| | | private Double parkMoney; |
| | | /** |
| | | * 过路费 |
| | | */ |
| | | @TableField("roadTollMoney") |
| | | private Double roadTollMoney; |
| | | /** |
| | | * 红包抵扣金额 |
| | | */ |
| | |
| | | * 红包id |
| | | */ |
| | | @TableField("redPacketId") |
| | | private Integer redPacketId; |
| | | private String redPacketId; |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | |
| | | @TableField("payMoney") |
| | | private Double payMoney; |
| | | /** |
| | | * 状态(1=待接单,2=待出发,3=待到达预约地点,4=待取货,5=送货中,6=已送达,7=待支付,8=需补差价,9=已取货,10=已取消,11=已支付差价) |
| | | * 状态(1=待接单,2=待出发,3=待到达预约地点,4=待取货,5=送货中,6=已送达,7=待支付,8=需补差价,9=已取货,10=已取消,11=改派中,12=已支付差价,13=取消待支付) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | |
| | | */ |
| | | @TableField("driverPay") |
| | | private Integer driverPay; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Integer getDriverId() { |
| | | return driverId; |
| | | } |
| | | |
| | | public void setDriverId(Integer driverId) { |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public Integer getCarId() { |
| | | return carId; |
| | | } |
| | | |
| | | public void setCarId(Integer carId) { |
| | | this.carId = carId; |
| | | } |
| | | |
| | | public String getOrderNum() { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(String orderNum) { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | public Integer getCargoType() { |
| | | return cargoType; |
| | | } |
| | | |
| | | public void setCargoType(Integer cargoType) { |
| | | this.cargoType = cargoType; |
| | | } |
| | | |
| | | public Integer getUrgent() { |
| | | return urgent; |
| | | } |
| | | |
| | | public void setUrgent(Integer urgent) { |
| | | this.urgent = urgent; |
| | | } |
| | | |
| | | public Integer getCargoNumber() { |
| | | return cargoNumber; |
| | | } |
| | | |
| | | public void setCargoNumber(Integer cargoNumber) { |
| | | this.cargoNumber = cargoNumber; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Double getPlacementLon() { |
| | | return placementLon; |
| | | } |
| | | |
| | | public void setPlacementLon(Double placementLon) { |
| | | this.placementLon = placementLon; |
| | | } |
| | | |
| | | public Double getPlacementLat() { |
| | | return placementLat; |
| | | } |
| | | |
| | | public void setPlacementLat(Double placementLat) { |
| | | this.placementLat = placementLat; |
| | | } |
| | | |
| | | public String getPlacementAddress() { |
| | | return placementAddress; |
| | | } |
| | | |
| | | public void setPlacementAddress(String placementAddress) { |
| | | this.placementAddress = placementAddress; |
| | | } |
| | | |
| | | public Double getStartLon() { |
| | | return startLon; |
| | | } |
| | | |
| | | public void setStartLon(Double startLon) { |
| | | this.startLon = startLon; |
| | | } |
| | | |
| | | public Double getStartLat() { |
| | | return startLat; |
| | | } |
| | | |
| | | public void setStartLat(Double startLat) { |
| | | this.startLat = startLat; |
| | | } |
| | | |
| | | public String getStartAddress() { |
| | | return startAddress; |
| | | } |
| | | |
| | | public void setStartAddress(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | public Double getEndLon() { |
| | | return endLon; |
| | | } |
| | | |
| | | public void setEndLon(Double endLon) { |
| | | this.endLon = endLon; |
| | | } |
| | | |
| | | public Double getEndLat() { |
| | | return endLat; |
| | | } |
| | | |
| | | public void setEndLat(Double endLat) { |
| | | this.endLat = endLat; |
| | | } |
| | | |
| | | public String getEndAddress() { |
| | | return endAddress; |
| | | } |
| | | |
| | | public void setEndAddress(String endAddress) { |
| | | this.endAddress = endAddress; |
| | | } |
| | | |
| | | public String getRecipient() { |
| | | return recipient; |
| | | } |
| | | |
| | | public void setRecipient(String recipient) { |
| | | this.recipient = recipient; |
| | | } |
| | | |
| | | public String getRecipientPhone() { |
| | | return recipientPhone; |
| | | } |
| | | |
| | | public void setRecipientPhone(String recipientPhone) { |
| | | this.recipientPhone = recipientPhone; |
| | | } |
| | | |
| | | public Double getBoardingLon() { |
| | | return boardingLon; |
| | | } |
| | | |
| | | public void setBoardingLon(Double boardingLon) { |
| | | this.boardingLon = boardingLon; |
| | | } |
| | | |
| | | public Double getBoardingLat() { |
| | | return boardingLat; |
| | | } |
| | | |
| | | public void setBoardingLat(Double boardingLat) { |
| | | this.boardingLat = boardingLat; |
| | | } |
| | | |
| | | public String getBoardingAddress() { |
| | | return boardingAddress; |
| | | } |
| | | |
| | | public void setBoardingAddress(String boardingAddress) { |
| | | this.boardingAddress = boardingAddress; |
| | | } |
| | | |
| | | public Date getBoardingTime() { |
| | | return boardingTime; |
| | | } |
| | | |
| | | public void setBoardingTime(Date boardingTime) { |
| | | this.boardingTime = boardingTime; |
| | | } |
| | | |
| | | public Double getGetoffLon() { |
| | | return getoffLon; |
| | | } |
| | | |
| | | public void setGetoffLon(Double getoffLon) { |
| | | this.getoffLon = getoffLon; |
| | | } |
| | | |
| | | public Double getGetoffLat() { |
| | | return getoffLat; |
| | | } |
| | | |
| | | public void setGetoffLat(Double getoffLat) { |
| | | this.getoffLat = getoffLat; |
| | | } |
| | | |
| | | public String getGetoffAddress() { |
| | | return getoffAddress; |
| | | } |
| | | |
| | | public void setGetoffAddress(String getoffAddress) { |
| | | this.getoffAddress = getoffAddress; |
| | | } |
| | | |
| | | public Date getGetoffTime() { |
| | | return getoffTime; |
| | | } |
| | | |
| | | public void setGetoffTime(Date getoffTime) { |
| | | this.getoffTime = getoffTime; |
| | | } |
| | | |
| | | public Double getMileage() { |
| | | return mileage; |
| | | } |
| | | |
| | | public void setMileage(Double mileage) { |
| | | this.mileage = mileage; |
| | | } |
| | | |
| | | public Integer getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public void setPayType(Integer payType) { |
| | | this.payType = payType; |
| | | } |
| | | |
| | | public Double getOrderMoney() { |
| | | return orderMoney; |
| | | } |
| | | |
| | | public void setOrderMoney(Double orderMoney) { |
| | | this.orderMoney = orderMoney; |
| | | } |
| | | |
| | | public Double getTravelMoney() { |
| | | return travelMoney; |
| | | } |
| | | |
| | | public void setTravelMoney(Double travelMoney) { |
| | | this.travelMoney = travelMoney; |
| | | } |
| | | |
| | | public Double getTipMoney() { |
| | | return tipMoney; |
| | | } |
| | | |
| | | public void setTipMoney(Double tipMoney) { |
| | | this.tipMoney = tipMoney; |
| | | } |
| | | |
| | | public Double getRedPacketMoney() { |
| | | return redPacketMoney; |
| | | } |
| | | |
| | | public void setRedPacketMoney(Double redPacketMoney) { |
| | | this.redPacketMoney = redPacketMoney; |
| | | } |
| | | |
| | | public Double getCouponMoney() { |
| | | return couponMoney; |
| | | } |
| | | |
| | | public void setCouponMoney(Double couponMoney) { |
| | | this.couponMoney = couponMoney; |
| | | } |
| | | |
| | | public Integer getRedPacketId() { |
| | | return redPacketId; |
| | | } |
| | | |
| | | public void setRedPacketId(Integer redPacketId) { |
| | | this.redPacketId = redPacketId; |
| | | } |
| | | |
| | | public Integer getCouponId() { |
| | | return couponId; |
| | | } |
| | | |
| | | public void setCouponId(Integer couponId) { |
| | | this.couponId = couponId; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Double getPayMoney() { |
| | | return payMoney; |
| | | } |
| | | |
| | | public void setPayMoney(Double payMoney) { |
| | | this.payMoney = payMoney; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Date getTravelTime() { |
| | | return travelTime; |
| | | } |
| | | |
| | | public void setTravelTime(Date travelTime) { |
| | | this.travelTime = travelTime; |
| | | } |
| | | |
| | | public Date getSnatchOrderTime() { |
| | | return snatchOrderTime; |
| | | } |
| | | |
| | | public void setSnatchOrderTime(Date snatchOrderTime) { |
| | | this.snatchOrderTime = snatchOrderTime; |
| | | } |
| | | |
| | | public Date getSetOutTime() { |
| | | return setOutTime; |
| | | } |
| | | |
| | | public void setSetOutTime(Date setOutTime) { |
| | | this.setOutTime = setOutTime; |
| | | } |
| | | |
| | | public Date getArriveTime() { |
| | | return arriveTime; |
| | | } |
| | | |
| | | public void setArriveTime(Date arriveTime) { |
| | | this.arriveTime = arriveTime; |
| | | } |
| | | |
| | | public Date getStartServiceTime() { |
| | | return startServiceTime; |
| | | } |
| | | |
| | | public void setStartServiceTime(Date startServiceTime) { |
| | | this.startServiceTime = startServiceTime; |
| | | } |
| | | |
| | | public Date getEndServiceTime() { |
| | | return endServiceTime; |
| | | } |
| | | |
| | | public void setEndServiceTime(Date endServiceTime) { |
| | | this.endServiceTime = endServiceTime; |
| | | } |
| | | |
| | | public Integer getOrderSource() { |
| | | return orderSource; |
| | | } |
| | | |
| | | public void setOrderSource(Integer orderSource) { |
| | | this.orderSource = orderSource; |
| | | } |
| | | |
| | | |
| | | public Integer getInvoiceId() { |
| | | return invoiceId; |
| | | } |
| | | |
| | | public void setInvoiceId(Integer invoiceId) { |
| | | this.invoiceId = invoiceId; |
| | | } |
| | | |
| | | public Integer getPayManner() { |
| | | return payManner; |
| | | } |
| | | |
| | | public void setPayManner(Integer payManner) { |
| | | this.payManner = payManner; |
| | | } |
| | | |
| | | public String getTrackId() { |
| | | return trackId; |
| | | } |
| | | |
| | | public void setTrackId(String trackId) { |
| | | this.trackId = trackId; |
| | | } |
| | | |
| | | public Double getDiscount() { |
| | | return discount; |
| | | } |
| | | |
| | | public void setDiscount(Double discount) { |
| | | this.discount = discount; |
| | | } |
| | | |
| | | public Double getDiscountMoney() { |
| | | return discountMoney; |
| | | } |
| | | |
| | | public void setDiscountMoney(Double discountMoney) { |
| | | this.discountMoney = discountMoney; |
| | | } |
| | | |
| | | public Integer getActivityId() { |
| | | return activityId; |
| | | } |
| | | |
| | | public void setActivityId(Integer activityId) { |
| | | this.activityId = activityId; |
| | | } |
| | | |
| | | public Integer getIsDelete() { |
| | | return isDelete; |
| | | } |
| | | |
| | | public void setIsDelete(Integer isDelete) { |
| | | this.isDelete = isDelete; |
| | | } |
| | | |
| | | public String getTelX() { |
| | | return telX; |
| | | } |
| | | |
| | | public void setTelX(String telX) { |
| | | this.telX = telX; |
| | | } |
| | | |
| | | public String getBindId() { |
| | | return bindId; |
| | | } |
| | | |
| | | public void setBindId(String bindId) { |
| | | this.bindId = bindId; |
| | | } |
| | | |
| | | public String getPickUpCode() { |
| | | return pickUpCode; |
| | | } |
| | | |
| | | public void setPickUpCode(String pickUpCode) { |
| | | this.pickUpCode = pickUpCode; |
| | | } |
| | | |
| | | public Integer getIsReassign() { |
| | | return isReassign; |
| | | } |
| | | |
| | | public void setIsReassign(Integer isReassign) { |
| | | this.isReassign = isReassign; |
| | | } |
| | | |
| | | public Integer getReassignNotice() { |
| | | return reassignNotice; |
| | | } |
| | | |
| | | public void setReassignNotice(Integer reassignNotice) { |
| | | this.reassignNotice = reassignNotice; |
| | | } |
| | | |
| | | public Integer getDriverPay() { |
| | | return driverPay; |
| | | } |
| | | |
| | | public void setDriverPay(Integer driverPay) { |
| | | this.driverPay = driverPay; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderLogistics{" + |
| | | "id=" + id + |
| | | ", type=" + type + |
| | | ", userId=" + userId + |
| | | ", driverId=" + driverId + |
| | | ", carId=" + carId + |
| | | ", orderNum='" + orderNum + '\'' + |
| | | ", cargoType=" + cargoType + |
| | | ", cargoNumber=" + cargoNumber + |
| | | ", remark=" + remark + |
| | | ", placementLon=" + placementLon + |
| | | ", placementLat=" + placementLat + |
| | | ", placementAddress='" + placementAddress + '\'' + |
| | | ", startLon=" + startLon + |
| | | ", startLat=" + startLat + |
| | | ", startAddress='" + startAddress + '\'' + |
| | | ", endLon=" + endLon + |
| | | ", endLat=" + endLat + |
| | | ", endAddress='" + endAddress + '\'' + |
| | | ", recipient='" + recipient + '\'' + |
| | | ", recipientPhone='" + recipientPhone + '\'' + |
| | | ", boardingLon=" + boardingLon + |
| | | ", boardingLat=" + boardingLat + |
| | | ", boardingAddress='" + boardingAddress + '\'' + |
| | | ", boardingTime=" + boardingTime + |
| | | ", getoffLon=" + getoffLon + |
| | | ", getoffLat=" + getoffLat + |
| | | ", getoffAddress='" + getoffAddress + '\'' + |
| | | ", getoffTime=" + getoffTime + |
| | | ", mileage=" + mileage + |
| | | ", payManner=" + payManner + |
| | | ", payType=" + payType + |
| | | ", orderMoney=" + orderMoney + |
| | | ", travelMoney=" + travelMoney + |
| | | ", tipMoney=" + tipMoney + |
| | | ", redPacketMoney=" + redPacketMoney + |
| | | ", couponMoney=" + couponMoney + |
| | | ", redPacketId=" + redPacketId + |
| | | ", couponId=" + couponId + |
| | | ", discount=" + discount + |
| | | ", discountMoney=" + discountMoney + |
| | | ", activityId=" + activityId + |
| | | ", companyId=" + companyId + |
| | | ", payMoney=" + payMoney + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | ", travelTime=" + travelTime + |
| | | ", snatchOrderTime=" + snatchOrderTime + |
| | | ", setOutTime=" + setOutTime + |
| | | ", arriveTime=" + arriveTime + |
| | | ", startServiceTime=" + startServiceTime + |
| | | ", endServiceTime=" + endServiceTime + |
| | | ", orderSource=" + orderSource + |
| | | ", invoiceId=" + invoiceId + |
| | | ", trackId='" + trackId + '\'' + |
| | | ", isDelete=" + isDelete + |
| | | ", telX='" + telX + '\'' + |
| | | ", bindId='" + bindId + '\'' + |
| | | '}'; |
| | | } |
| | | /** |
| | | * 改派之前的订单状态 |
| | | * @return |
| | | */ |
| | | @TableField("oldState") |
| | | private Integer oldState; |
| | | /** |
| | | * 修改目的地经度 |
| | | */ |
| | | @TableField("destinationLon") |
| | | private String destinationLon; |
| | | /** |
| | | * 修改目的地纬度 |
| | | */ |
| | | @TableField("destinationLat") |
| | | private String destinationLat; |
| | | /** |
| | | * 修改目的地地址 |
| | | */ |
| | | @TableField("destination") |
| | | private String destination; |
| | | private Integer isplatPay; |
| | | @TableField(exist = false) |
| | | private BigDecimal freeMoney; |
| | | /** |
| | | * 补差价金额 |
| | | */ |
| | | @TableField("priceDifference") |
| | | private Double priceDifference; |
| | | /** |
| | | * 起步里程 |
| | | */ |
| | | @TableField("startMileage") |
| | | private Double startMileage; |
| | | /** |
| | | * 中途取消(0=否,1=是) |
| | | */ |
| | | @TableField("cancelMidway") |
| | | private Integer cancelMidway; |
| | | /** |
| | | * google行程id |
| | | */ |
| | | @TableField("tripId") |
| | | private String tripId; |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.system.model.Region; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | String recipient, String recipientPhone, String endLonLat, String endAddress, Integer urgent, Double tipMoney, Date travelTime, Integer orderSource, Integer uid, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 包裹下单2.0 |
| | | * @param remark |
| | | * @param placementLon |
| | | * @param placementLat |
| | | * @param startLon |
| | | * @param startLat |
| | | * @param startAddress |
| | | * @param recipient |
| | | * @param recipientPhone |
| | | * @param endLon |
| | | * @param endLat |
| | | * @param endAddress |
| | | * @param serverCarModelId |
| | | * @param driverId |
| | | * @param orderSource |
| | | * @param language |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | ResultUtil placeOrderPackage(String remark, String placementLon, String placementLat, String startLon, String startLat, String startAddress, |
| | | String recipient, String recipientPhone, String endLon, String endLat, String endAddress, Integer serverCarModelId, |
| | | Integer driverId, Integer orderSource, Integer uid, Integer language) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil payLogisticsOrder(Integer payType, Integer bankCardId, Integer orderId,Integer couponId, Integer type, Integer language)throws Exception; |
| | | ResultUtil payLogisticsOrder(Integer payType, Integer bankCardId, Integer orderId,Integer couponId, Integer redDeduction, Integer type, Integer language)throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil addCancle(Integer id, String reason, String remark, Integer uid, Integer language) throws Exception; |
| | | ResultUtil addCancle(Integer id, String reason, String remark, Integer uid, Double lon, Double lat, String address, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryCoupon(Integer language, Integer orderId, Integer uid, Integer pageNum, Integer size) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取取消订单需要支付的金额 |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil<BaseWarpper> queryCancleAmount(Integer id, Integer language) throws Exception; |
| | | |
| | | /** |
| | | * 删除服务中推送定时任务 |
| | | * @param orderId |
| | | */ |
| | | void deleteTask(Integer orderId); |
| | | |
| | | |
| | | /** |
| | | * 取消订单操作 |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil cancleOrderPrivateCar(Integer id, Integer payType, Integer bankCardId, Integer cancleId, Integer type, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 取消订单支付后的处理 |
| | | * @param id 订单=id |
| | | * @param order_id 工行支付单号 |
| | | * @throws Exception |
| | | */ |
| | | void payCancelOrderPrivateCar(Integer id, String order_id, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 修改目的地 |
| | | * @param orderId |
| | | * @param endLon |
| | | * @param endLat |
| | | * @param endAddress |
| | | */ |
| | | void updateEndAddress(Integer orderId, String endLon, String endLat, String endAddress); |
| | | |
| | | /** |
| | | * 评论成功后获取红包金额 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil<BaseWarpper> queryRedMoney(Integer orderId) throws Exception; |
| | | |
| | | /** |
| | | * 分享成功后添加红包 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil shareRedEnvelope(Integer orderId, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取红包使用记录 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryRedEnvelope(Integer language, Integer uid) throws Exception; |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.smallLogistics.server.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.impl.OrderCrossCityServiceImpl; |
| | | import com.stylefeng.guns.modular.smallLogistics.dao.OrderLogisticsMapper; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogisticsSpread; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsSpreadService; |
| | | import com.stylefeng.guns.modular.specialTrain.dao.OrderPrivateCarMapper; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.specialTrain.server.impl.OrderPrivateCarServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.Results; |
| | | import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | |
| | | import org.jsoup.select.Elements; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | |
| | | |
| | | @Autowired |
| | | private IPhoneService phoneService; |
| | | |
| | | @Autowired |
| | | private ICancleOrderService cancleOrderService; |
| | | |
| | | @Autowired |
| | | private RestTemplate internalRestTemplate; |
| | | |
| | | @Autowired |
| | | private IRedEnvelopePaymentSettingsService redEnvelopePaymentSettingsService; |
| | | |
| | | @Autowired |
| | | private IUserRedPacketRecordService userRedPacketRecordService; |
| | | |
| | | @Autowired |
| | | private IOrderPrivateCarService orderPrivateCarService; |
| | | |
| | | @Resource |
| | | private OrderPrivateCarMapper orderPrivateCarMapper; |
| | | |
| | | @Autowired |
| | | private IDriverServiceService driverServiceService; |
| | | |
| | | @Autowired |
| | | private ISettlementRecordService settlementRecordService; |
| | | |
| | | @Resource |
| | | private CarServiceMapper carServiceMapper; |
| | | |
| | | @Autowired |
| | | private IAssignOrderService assignOrderService; |
| | | |
| | | @Autowired |
| | | private ISettlementDetailService settlementDetailService; |
| | | |
| | | @Autowired |
| | | private ISettlementAllocationService settlementAllocationService; |
| | | |
| | | @Resource |
| | | private CarMapper carMapper; |
| | | |
| | | @Autowired |
| | | private IOrderEvaluateService orderEvaluateService; |
| | | |
| | | @Autowired |
| | | private IUserActivityRedenvelopeService userActivityRedenvelopeService; |
| | | |
| | | @Autowired |
| | | private FleetEngineUtil fleetEngineUtil; |
| | | |
| | | @Resource |
| | | private CarModelMapper carModelMapper; |
| | | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | |
| | | |
| | |
| | | activityId = Integer.valueOf(data.get("activityId").toString()); |
| | | } |
| | | orderLogistics.setOrderMoney((cargoType == 1 ? ordinary : precious) + tipMoney); |
| | | orderLogistics.setTravelMoney((cargoType == 1 ? ordinary : precious)); |
| | | // orderLogistics.setTravelMoney((cargoType == 1 ? ordinary : precious)); |
| | | if(type == 5){ |
| | | orderLogistics.setOrderMoney(((cargoType == 1 ? ordinary : precious) * cargoNumber) + tipMoney); |
| | | orderLogistics.setTravelMoney((cargoType == 1 ? ordinary : precious) * cargoNumber); |
| | | // orderLogistics.setTravelMoney((cargoType == 1 ? ordinary : precious) * cargoNumber); |
| | | } |
| | | orderLogistics.setDiscount(discount); |
| | | orderLogistics.setDiscountMoney(discountMoney); |
| | | orderLogistics.setActivityId(activityId); |
| | | orderLogistics.setTipMoney(tipMoney); |
| | | orderLogistics.setState(7);//待支付 |
| | | orderLogistics.setInsertTime(new Date()); |
| | | orderLogistics.setTravelTime(null == travelTime ? new Date() : travelTime); |
| | |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0); |
| | | //获取空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(orderLogistics.getType(), null, orderLogistics.getStartLon(), orderLogistics.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(orderLogistics.getType(), orderLogistics.getServerCarModelId(), orderLogistics.getStartLon(), orderLogistics.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | System.err.println("【" + orderLogistics.getId() + "】空闲司机:" + JSON.toJSONString(list)); |
| | | if(list.size() > 0){ |
| | | double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 包裹下单2.0 |
| | | * @param remark |
| | | * @param placementLon |
| | | * @param placementLat |
| | | * @param startLon |
| | | * @param startLat |
| | | * @param startAddress |
| | | * @param recipient |
| | | * @param recipientPhone |
| | | * @param endLon |
| | | * @param endLat |
| | | * @param endAddress |
| | | * @param serverCarModelId |
| | | * @param driverId |
| | | * @param orderSource |
| | | * @param uid |
| | | * @param language |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResultUtil placeOrderPackage(String remark, String placementLon, String placementLat, String startLon, String startLat, String startAddress, |
| | | String recipient, String recipientPhone, String endLon, String endLat, String endAddress, |
| | | Integer serverCarModelId, Integer driverId, Integer orderSource, Integer uid, Integer language) throws Exception { |
| | | /** |
| | | * 1.下了即时单就不能下预约单和即时单 |
| | | * 2.下了预约单和再下一张即时单不能再下预约单 |
| | | */ |
| | | List<OrderPrivateCar> orderPrivateCars = orderPrivateCarMapper.queryByState(uid, 1, 1, 1, 2, 3, 4, 5, 6, 11); |
| | | if(orderPrivateCars.size() > 0){ |
| | | return ResultUtil.error(language == 1 ? "有未完成的订单" : language == 2 ? "Uncompleted order(s)" : "Commande(s) non complétée(s)"); |
| | | } |
| | | int selectCount = this.selectCount(new EntityWrapper<OrderLogistics>().eq("userId", uid).eq("isDelete", 1) |
| | | .in("state", Arrays.asList(1, 2, 3, 4, 5, 7, 11, 12))); |
| | | if(0 < selectCount){ |
| | | return ResultUtil.error(language == 1 ? "有未完成的订单" : language == 2 ? "Uncompleted order(s)" : "Commande(s) non complétée(s)"); |
| | | } |
| | | startAddress = startAddress.replaceAll("& #40;", "("); |
| | | startAddress = startAddress.replaceAll("& #41;", ")"); |
| | | endAddress = endAddress.replaceAll("& #40;", "("); |
| | | endAddress = endAddress.replaceAll("& #41;", ")"); |
| | | if((orderSource == 1 || orderSource == 3) && null == serverCarModelId){ |
| | | return ResultUtil.error(language == 1 ? "请选择服务车型" : language == 2 ? "Please select vehicle-type" : "Veuillez sélectionner le type de véhicule"); |
| | | } |
| | | |
| | | OrderLogistics orderLogistics = new OrderLogistics(); |
| | | orderLogistics.setType(4); |
| | | orderLogistics.setUserId(uid); |
| | | orderLogistics.setServerCarModelId(serverCarModelId); |
| | | orderLogistics.setOrderNum(this.getOrderNum()); |
| | | orderLogistics.setPlacementLon(Double.valueOf(placementLon)); |
| | | orderLogistics.setPlacementLat(Double.valueOf(placementLat)); |
| | | orderLogistics.setCargoType(1); |
| | | orderLogistics.setUrgent(1); |
| | | orderLogistics.setCargoNumber(1); |
| | | |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(Double.valueOf(placementLat), Double.valueOf(placementLon)); |
| | | orderLogistics.setPlacementAddress(reverseGeocode.getAddress()); |
| | | orderLogistics.setStartLon(Double.valueOf(startLon)); |
| | | orderLogistics.setStartLat(Double.valueOf(startLat)); |
| | | orderLogistics.setStartAddress(startAddress); |
| | | orderLogistics.setEndLon(Double.valueOf(endLon)); |
| | | orderLogistics.setEndLat(Double.valueOf(endLat)); |
| | | orderLogistics.setEndAddress(endAddress); |
| | | orderLogistics.setRecipient(recipient); |
| | | orderLogistics.setRecipientPhone(recipientPhone); |
| | | orderLogistics.setState(1); |
| | | orderLogistics.setInsertTime(new Date()); |
| | | orderLogistics.setTravelTime(new Date()); |
| | | orderLogistics.setOrderSource(orderSource); |
| | | if(orderSource == 2){//扫码下单 |
| | | Driver driver = driverService.selectById(driverId); |
| | | if(null == driver){ |
| | | return ResultUtil.error(language == 1 ? "司机信息有误,无法完成下单" : language == 2 ? "Wrong driver-information, unable to place an order." : "Informations erronées sur le chauffeur, il ne peut donc pas passer une commande."); |
| | | } |
| | | if(driver.getAuthState() == 1){ |
| | | return ResultUtil.error(language == 1 ? "司机信息还未完成审核,无法完成下单" : language == 2 ? "The driver is not yet done with review, unable to place an order." : "Le chauffeur n’a pas encore terminé son examen, il ne peut donc pas passer une commande."); |
| | | } |
| | | if(driver.getAuthState() == 3){ |
| | | return ResultUtil.error(language == 1 ? "司机账户已被冻结,无法提供服务" : language == 2 ? "Driver account is frozen, unable to provide service." : "Le compte du chauffeur est gelé, il n’est donc pas possible de fournir des services."); |
| | | } |
| | | if(driver.getAuthState() == 4){ |
| | | return ResultUtil.error(language == 1 ? "司机信息未通过审核,无法提供服务" : language == 2 ? "The driver is not verified and qualified, unable to provide service." : "Le chauffeur n’est pas vérifié et qualifié, incapable de fournir le services."); |
| | | } |
| | | if(driver.getState() == 1){ |
| | | return ResultUtil.error(language == 1 ? "司机还未上线,无法提供服务" : language == 2 ? "The driver is not online, unable to provide service." : "Le chauffeur n’est pas en ligne, incapable de fournir le services."); |
| | | } |
| | | if(driver.getState() == 3){ |
| | | return ResultUtil.error(language == 1 ? "司机正在服务中,无法提供服务" : language == 2 ? "The driver is on a trip, unable to provide service." : "Le chauffeur est en service, incapable de fournir des services."); |
| | | } |
| | | List<DriverService> query = driverServiceService.query(driverId, 4); |
| | | if(query.size() == 0){ |
| | | return ResultUtil.error(language == 1 ? "该司机不能服务此业务" : language == 2 ? "Driver has outstanding fees to pay, unable to receive orders." : "Le chauffeur a des frais impayés à payer, incapable de recevoir des commandes."); |
| | | } |
| | | int count = settlementRecordService.selectCount(new EntityWrapper<SettlementRecord>().eq("driverId", driverId).eq("paymentStatus", 1)); |
| | | if(count > 0){ |
| | | return ResultUtil.error(language == 1 ? "司机未支付订单费用,无法进行接单" : language == 2 ? "Driver has outstanding fees to pay, unable to receive orders." : "Le chauffeur a des frais impayés à payer, incapable de recevoir des commandes."); |
| | | } |
| | | |
| | | orderLogistics.setDriverId(driverId); |
| | | orderLogistics.setCompanyId(driver.getFranchiseeId() != null && driver.getFranchiseeId() != 0 ? driver.getFranchiseeId() : ( |
| | | driver.getCompanyId() != null && driver.getCompanyId() != 0 ? driver.getCompanyId() : 1)); |
| | | orderLogistics.setState(2); |
| | | orderLogistics.setCarId(driver.getCarId()); |
| | | CarService query1 = carServiceMapper.query(1, driver.getCarId()); |
| | | orderLogistics.setServerCarModelId(query1.getServerCarModelId()); |
| | | orderLogistics.setSnatchOrderTime(new Date()); |
| | | |
| | | driver.setState(3); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | orderLogistics.setIsReassign(1); |
| | | orderLogistics.setIsDelete(1); |
| | | orderLogistics.setTripId(UUIDUtil.getRandomCode()); |
| | | this.insert(orderLogistics); |
| | | |
| | | |
| | | String vehicleId = null; |
| | | if(null != orderLogistics.getDriverId()){ |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | Car car = carMapper.selectById(driver.getCarId()); |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carMapper.updateById(car); |
| | | } |
| | | //查询车辆信息,没有则创建信息 |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | |
| | | } |
| | | //创建行程数据 |
| | | fleetEngineUtil.createTrip(vehicleId, 1, orderLogistics.getTripId(), |
| | | orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(), orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | |
| | | |
| | | if(orderSource == 2){//扫码下单 |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, uid, orderLogistics.getId(), 4, 2, 0); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, 2, 0); |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | |
| | | // TODO: 2021/5/11 修改,根据后台设定的派单范围查询范围内有无司机,将单子指派给距离最近的司机(距离相同随机取),范围内没有司机再进行推单流程 |
| | | if(orderLogistics.getState() == 1){ |
| | | Company query = companyCityService.query1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString()); |
| | | if(null == query){ |
| | | return ResultUtil.error(language == 1 ? "起点暂未企业提供服务" : language == 2 ? "Starting point no enterprise to provide services" : "Point de départ pas encore disponible pour les entreprises"); |
| | | } |
| | | AssignOrder assignOrder = assignOrderService.selectOne(new EntityWrapper<AssignOrder>().eq("companyId", query.getId()).eq("type", 1)); |
| | | if(null != assignOrder && assignOrder.getPeople() > 0){//配置了指派规则才处理 |
| | | //获取空闲司机 |
| | | List<Driver> drivers = driverService.queryIdleDriver(4, orderLogistics.getServerCarModelId(), orderLogistics.getStartLon(), orderLogistics.getStartLat(), assignOrder.getDistance(), null);//获取范围内空闲司机 |
| | | if(drivers.size() > 0){//有司机,直接指派给司机 |
| | | Driver dr = null; |
| | | if(drivers.size() > 1){ |
| | | List<Driver> ds = new ArrayList<>();//存储直线距离最近的几个司机 |
| | | for(int i = 0; i < assignOrder.getPeople(); i++){ |
| | | Driver driver = null; |
| | | long m = 0; |
| | | int index = 0; |
| | | for(int j = 0; j < drivers.size(); j++){ |
| | | String value = redisUtil.getValue("DRIVER" + drivers.get(j).getId()); |
| | | if(null != value){ |
| | | String[] split = value.split(","); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0])); |
| | | Long distance = distancematrix.getDistance(); |
| | | if((0 == m && null == driver) || (distance < m)){ |
| | | driver = drivers.get(j); |
| | | m = distance; |
| | | index = j; |
| | | } |
| | | } |
| | | } |
| | | ds.add(driver); |
| | | drivers.remove(index); |
| | | } |
| | | |
| | | //再根据直线距离最短的司机中找出行驶距离最短的司机 |
| | | Long m = 0L; |
| | | for(Driver driver : ds){ |
| | | String value = redisUtil.getValue("DRIVER" + driver.getId()); |
| | | if(null != value){ |
| | | String[] split = value.split(","); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0])); |
| | | Long d = distancematrix.getDistance(); |
| | | if((0 == m && null == dr) || (d.intValue() < m.intValue())){ |
| | | dr = driver; |
| | | m = d; |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | | dr = drivers.get(0); |
| | | } |
| | | |
| | | orderLogistics.setDriverId(dr.getId()); |
| | | orderLogistics.setCompanyId(dr.getFranchiseeId() != null && dr.getFranchiseeId() != 0 ? dr.getFranchiseeId() : ( |
| | | dr.getCompanyId() != null && dr.getCompanyId() != 0 ? dr.getCompanyId() : 1)); |
| | | orderLogistics.setState(2); |
| | | orderLogistics.setCarId(dr.getCarId()); |
| | | CarService query1 = carServiceMapper.query(1, dr.getCarId()); |
| | | orderLogistics.setServerCarModelId(query1.getServerCarModelId()); |
| | | orderLogistics.setSnatchOrderTime(new Date()); |
| | | |
| | | dr.setState(3); |
| | | driverService.updateById(dr); |
| | | this.updateById(orderLogistics); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, uid, orderLogistics.getId(), 4, 2, 0); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, 2, 0); |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //推单操作 |
| | | if(orderLogistics.getState() == 1){ |
| | | this.pushOrder(orderLogistics); |
| | | }else{ |
| | | // //接单后定时任务判断司机是否去接乘客,没有则推送提醒 |
| | | // CancleOrder cancleOrder = cancleOrderService.query(orderLogistics.getCompanyId()); |
| | | // if(null != cancleOrder){ |
| | | // JSONObject object = JSON.parseObject(cancleOrder.getContent()); |
| | | // long time = object.getInteger("driverTimeout") * 60000L; |
| | | // new Timer().schedule(new TimerTask() { |
| | | // @Override |
| | | // public void run() { |
| | | // OrderLogistics orderLogistics1 = OrderLogisticsServiceImpl.this.selectById(orderLogistics.getId()); |
| | | // if(orderLogistics1.getState() == 2){ |
| | | // pushUtil.pushDriverTimeOut(1, orderLogistics1.getUserId(), orderLogistics1.getId(), 4); |
| | | // } |
| | | // } |
| | | // }, time); |
| | | // } |
| | | } |
| | | |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您的市内包裹订单已下单成功,我们正在为您指派司机,请稍后!" : |
| | | language == 2 ? "You've placed the delivery order successfully, we are assigning you a driver, please wait." |
| | | : "Vous avez passé la commande de livraison avec succès, nous vous attribuons un chauffeur, veuillez patienter.", orderLogistics.getUserId(), 1); |
| | | |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setState(orderLogistics.getState()); |
| | | baseWarpper.setId(orderLogistics.getId()); |
| | | baseWarpper.setContent(orderLogistics.getTripId()); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | | /** |
| | | * 订单支付 |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil payLogisticsOrder(Integer payType, Integer bankCardId, Integer orderId,Integer couponId, Integer type, Integer language) throws Exception { |
| | | public ResultUtil payLogisticsOrder(Integer payType, Integer bankCardId, Integer orderId,Integer couponId, Integer redDeduction, Integer type, Integer language) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | if(orderLogistics.getState() != 7){ |
| | | return ResultUtil.error(language == 1 ? "订单已完成支付,不允许重复支付" : language == 2 ? "The order has been paid, recurring payments is not allowed." : "La commande a été payée, les paiements récurrents ne sont pas autorisés.", ""); |
| | |
| | | Integer uid = orderLogistics.getUserId(); |
| | | Double orderMoney = orderLogistics.getOrderMoney(); |
| | | if(orderLogistics.getUrgent() == 2){ |
| | | orderMoney += null != orderLogistics.getTipMoney() ? orderLogistics.getTipMoney() : 0; |
| | | // orderMoney += null != orderLogistics.getTipMoney() ? orderLogistics.getTipMoney() : 0; |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(""); |
| | | orderLogistics.setCouponMoney(0D);//初始化历史数据 |
| | | orderLogistics.setCouponId(null); |
| | | //折扣 |
| | | if(null != orderLogistics.getActivityId()){ |
| | | orderMoney = orderMoney - orderLogistics.getDiscountMoney(); |
| | | } |
| | | |
| | | //计算优惠券 |
| | | UserCouponRecord userCouponRecord = null; |
| | | if(null != couponId){ |
| | | //TODO 待翻译 |
| | | if(null != redDeduction && 1 == redDeduction){ |
| | | return ResultUtil.error(language == 1 ? "优惠券和红包不能同时使用" : language == 2 ? "Coupons and lucky-promo cannot be used at the same time." : "Les coupons et les bonus ne peuvent pas être utilisés en même temps", ""); |
| | | } |
| | | userCouponRecord = userCouponRecordService.selectById(couponId); |
| | | if(userCouponRecord.getCompanyId() != orderLogistics.getCompanyId()){ |
| | | return ResultUtil.error(language == 1 ? "优惠券不能用于此订单" : language == 2 ? "Coupon cannot be used for this order." : "Le coupon ne peut pas être utilisé pour cette commande.", ""); |
| | |
| | | orderLogistics.setCouponMoney(userCouponRecord.getMoney()); |
| | | orderLogistics.setCouponId(couponId); |
| | | } |
| | | //折扣 |
| | | if(null != orderLogistics.getActivityId()){ |
| | | orderMoney = orderMoney - orderLogistics.getDiscountMoney(); |
| | | |
| | | //计算红包 |
| | | if(null != redDeduction && 1 == redDeduction){ |
| | | RedEnvelopePaymentSettings redEnvelopePaymentSettings = redEnvelopePaymentSettingsService.getRedEnvelopePaymentSettings(); |
| | | if(null != redEnvelopePaymentSettings){ |
| | | Double total = userRedPacketRecordService.queryRemainingAmount(uid); |
| | | List<UserRedPacketRecord> userRedPacketRecords = userRedPacketRecordService.selectList(new EntityWrapper<UserRedPacketRecord>().eq("userId", uid) |
| | | .eq("state", 1).eq("companyId", orderLogistics.getCompanyId()).gt("remainingAmount", 0).orderBy("insertTime", false)); |
| | | if(total.compareTo(orderMoney) >= 0){ |
| | | BigDecimal deductionRatio = redEnvelopePaymentSettings.getDeductionRatio(); |
| | | BigDecimal multiply = new BigDecimal(orderMoney).multiply(deductionRatio.divide(new BigDecimal(100))); |
| | | orderLogistics.setRedPacketMoney(multiply.doubleValue()); |
| | | orderMoney = orderMoney - multiply.doubleValue(); |
| | | |
| | | //获取红包id |
| | | JSONArray jsonArray = new JSONArray(); |
| | | for (UserRedPacketRecord userRedPacketRecord : userRedPacketRecords) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("id", userRedPacketRecord.getId()); |
| | | BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount()); |
| | | if(multiply.compareTo(remainingAmount) >= 0){ |
| | | multiply = multiply.subtract(remainingAmount); |
| | | jsonObject.put("money", remainingAmount); |
| | | jsonArray.add(jsonObject); |
| | | }else{ |
| | | userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply).doubleValue()); |
| | | jsonObject.put("money", multiply); |
| | | jsonArray.add(jsonObject); |
| | | break; |
| | | } |
| | | } |
| | | orderLogistics.setRedPacketId(jsonArray.toJSONString()); |
| | | }else{ |
| | | orderLogistics.setRedPacketMoney(total); |
| | | orderMoney = orderMoney - total; |
| | | //获取红包id |
| | | JSONArray jsonArray = new JSONArray(); |
| | | BigDecimal multiply = new BigDecimal(total); |
| | | for (UserRedPacketRecord userRedPacketRecord : userRedPacketRecords) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("id", userRedPacketRecord.getId()); |
| | | BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount()); |
| | | if(multiply.compareTo(remainingAmount) >= 0){ |
| | | multiply = multiply.subtract(remainingAmount); |
| | | jsonObject.put("money", remainingAmount); |
| | | jsonArray.add(jsonObject); |
| | | }else{ |
| | | userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply).doubleValue()); |
| | | jsonObject.put("money", multiply); |
| | | jsonArray.add(jsonObject); |
| | | break; |
| | | } |
| | | } |
| | | orderLogistics.setRedPacketId(jsonArray.toJSONString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | orderMoney=new BigDecimal(orderMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | |
| | | if(payType == 1) {//手机支付 |
| | |
| | | userCouponRecord.setEndTime(new Date()); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | if(null != orderLogistics.getRedPacketId()){ |
| | | JSONArray jsonArray = JSON.parseArray(orderLogistics.getRedPacketId()); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id1 = jsonObject.getInteger("id"); |
| | | Double money = jsonObject.getDouble("money"); |
| | | UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(id1); |
| | | userRedPacketRecord.setRemainingAmount(userRedPacketRecord.getRemainingAmount() - money); |
| | | if(0 == userRedPacketRecord.getRemainingAmount()){ |
| | | userRedPacketRecord.setState(2); |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | } |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | } |
| | | } |
| | | |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "包裹下单支付", orderMoney, 2, 1, 1, 4, orderId); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | orderLogistics.setState(1);//小件物流先支付后司机抢单 |
| | | orderLogistics.setState(8); |
| | | orderLogistics.setPayType(3); |
| | | orderLogistics.setPayMoney(orderMoney); |
| | | orderLogistics.setOrderMoney(orderLogistics.getOrderMoney()+orderLogistics.getFreeMoney().doubleValue()); |
| | | |
| | | //处理优惠券和红包 |
| | | if(null != userCouponRecord){ |
| | | userCouponRecord.setState(2); |
| | | userCouponRecord.setEndTime(new Date()); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | if(null != orderLogistics.getRedPacketId()){ |
| | | JSONArray jsonArray = JSON.parseArray(orderLogistics.getRedPacketId()); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id1 = jsonObject.getInteger("id"); |
| | | Double money = jsonObject.getDouble("money"); |
| | | UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(id1); |
| | | userRedPacketRecord.setRemainingAmount(userRedPacketRecord.getRemainingAmount() - money); |
| | | if(0 == userRedPacketRecord.getRemainingAmount()){ |
| | | userRedPacketRecord.setState(2); |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | } |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | } |
| | | } |
| | | |
| | | if(orderLogistics.getIsplatPay()==1){ |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderLogistics.getCompanyId()); |
| | | Double speMoney = company.getSpeMoney(); |
| | | BigDecimal d = null;//企业收入 |
| | | BigDecimal c = null;//司机收入 |
| | | if(company.getIsSpeFixedOrProportional() == 2){//固定 |
| | | d = new BigDecimal(speMoney); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d);//只有出行金额参与抽成,其余归属司机 |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | Double price = orderLogistics.getStartMoney() + orderLogistics.getMileageMoney() + orderLogistics.getWaitMoney() + orderLogistics.getDurationMoney() + orderLogistics.getLongDistanceMoney(); |
| | | d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | incomeService.saveData(1, orderLogistics.getCompanyId(), 2, orderLogistics.getId(), 4, d.doubleValue()); |
| | | incomeService.saveData(2, orderLogistics.getDriverId(), 2, orderLogistics.getId(), 4, c.doubleValue()); |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单支付,谢谢使用!" : language == 2 |
| | | ? "You've paid for the delivery order successfully, thank you for using I-GO" : |
| | | "Vous avez payé la commande de livraison avec succès, merci d’utiliser I-GO", uid, 1); |
| | | this.pushOrder(orderLogistics);//推单 |
| | | |
| | | |
| | | |
| | | language = userInfo.getLanguage(); |
| | | String payTypeChinese = ""; |
| | | String payTypeEnglish = ""; |
| | | String payTypeFrench = ""; |
| | | if(orderLogistics.getPayType() == 3){ |
| | | payTypeChinese = "余额支付"; |
| | | payTypeEnglish = "I-GO Wallet"; |
| | | payTypeFrench = "Portefeuille I-GO"; |
| | | } |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/receiptLogistics.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | Car car = carMapper.selectById(orderLogistics.getCarId()); |
| | | Double aDouble = 0D; |
| | | if(null != orderLogistics.getDriverId()){ |
| | | aDouble = orderEvaluateService.queryDriverScore(orderLogistics.getDriverId()); |
| | | } |
| | | if(1 == language){ |
| | | document.getElementById("english").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("I-GO电子收据"); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",您在I-GO此订单消费GHS " + orderLogistics.getPayMoney()); |
| | | Element xcf_chinese = document.getElementById("xcf_chinese"); |
| | | xcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element bcj_chinese = document.getElementById("bcj_chinese"); |
| | | if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){ |
| | | bcj_chinese.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element bcj_chinese_div = document.getElementById("bcj_chinese_div"); |
| | | bcj_chinese_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){ |
| | | Element yhq_chinese = document.getElementById("yhq_chinese"); |
| | | yhq_chinese.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element yhq_chinese_div = document.getElementById("yhq_chinese_div"); |
| | | yhq_chinese_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){ |
| | | Element zk_chinese = document.getElementById("zk_chinese"); |
| | | zk_chinese.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element zk_chinese_div = document.getElementById("zk_chinese_div"); |
| | | zk_chinese_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){ |
| | | Element hb_chinese = document.getElementById("hb_chinese"); |
| | | hb_chinese.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element hb_chinese_div = document.getElementById("hb_chinese_div"); |
| | | hb_chinese_div.remove(); |
| | | } |
| | | Element xj_chinese = document.getElementById("xj_chinese"); |
| | | xj_chinese.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pay_type_chinese = document.getElementById("pay_type_chinese"); |
| | | pay_type_chinese.text(payTypeChinese); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pdf_chinese = document.getElementById("pdf_chinese"); |
| | | pdf_chinese.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_chinese = document.getElementById("lost_item_chinese"); |
| | | lost_item_chinese.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_chinese = document.getElementById("track_chinese"); |
| | | // track_chinese.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_chinese = document.getElementsByClass("driver_chinese"); |
| | | for (int i = 0; i < driver_chinese.size(); i++) { |
| | | Element element = driver_chinese.get(i); |
| | | element.text(" " + driver.getFirstName() + "." + driver.getLastName()); |
| | | } |
| | | Element cp_chinese = document.getElementById("cp_chinese"); |
| | | cp_chinese.text("车牌:" + car.getCarLicensePlate()); |
| | | Element pf_chinese = document.getElementById("pf_chinese"); |
| | | pf_chinese.text("司机评分:" + aDouble); |
| | | Element start_address_chinese = document.getElementById("start_address_chinese"); |
| | | start_address_chinese.text(orderLogistics.getStartAddress()); |
| | | Element end_address_chinese = document.getElementById("end_address_chinese"); |
| | | end_address_chinese.text(orderLogistics.getEndAddress()); |
| | | Phone phone = phoneService.selectOne(new EntityWrapper<Phone>().eq("type", 2).eq("companyId", driver.getCompanyId())); |
| | | Element server_tel_chinese = document.getElementById("server_tel_chinese"); |
| | | server_tel_chinese.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("Receipt"); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip "); |
| | | Element xcf_english = document.getElementById("xcf_english"); |
| | | xcf_english.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element bcj_english = document.getElementById("bcj_english"); |
| | | if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){ |
| | | bcj_english.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element bcj_english_div = document.getElementById("bcj_english_div"); |
| | | bcj_english_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){ |
| | | Element yhq_english = document.getElementById("yhq_english"); |
| | | yhq_english.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element yhq_english_div = document.getElementById("yhq_english_div"); |
| | | yhq_english_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){ |
| | | Element zk_english = document.getElementById("zk_english"); |
| | | zk_english.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element zk_english_div = document.getElementById("zk_english_div"); |
| | | zk_english_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){ |
| | | Element hb_english = document.getElementById("hb_english"); |
| | | hb_english.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element hb_english_div = document.getElementById("hb_english_div"); |
| | | hb_english_div.remove(); |
| | | } |
| | | Element xj_english = document.getElementById("xj_english"); |
| | | xj_english.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pay_type_english = document.getElementById("pay_type_english"); |
| | | pay_type_english.text(payTypeEnglish); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pdf_english = document.getElementById("pdf_english"); |
| | | pdf_english.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_english = document.getElementById("lost_item_english"); |
| | | lost_item_english.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_english = document.getElementById("track_english"); |
| | | // track_english.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_english = document.getElementsByClass("driver_english"); |
| | | for (int i = 0; i < driver_english.size(); i++) { |
| | | Element element = driver_english.get(i); |
| | | element.text(" " + driver.getFirstName() + "." + driver.getLastName()); |
| | | } |
| | | Element cp_english = document.getElementById("cp_english"); |
| | | cp_english.text("Number Plate:" + car.getCarLicensePlate()); |
| | | Element pf_english = document.getElementById("pf_english"); |
| | | pf_english.text("Driver Rating:" + aDouble); |
| | | Element start_address_english = document.getElementById("start_address_english"); |
| | | start_address_english.text(orderLogistics.getStartAddress()); |
| | | Element end_address_english = document.getElementById("end_address_english"); |
| | | end_address_english.text(orderLogistics.getEndAddress()); |
| | | Phone phone = phoneService.selectOne(new EntityWrapper<Phone>().eq("type", 2).eq("companyId", driver.getCompanyId())); |
| | | Element server_tel_english = document.getElementById("server_tel_english"); |
| | | server_tel_english.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("english").remove(); |
| | | document.getElementsByTag("title").get(0).text("Reçu"); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le "); |
| | | Element xcf_french = document.getElementById("xcf_french"); |
| | | xcf_french.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element bcj_french = document.getElementById("bcj_french"); |
| | | if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){ |
| | | bcj_french.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element bcj_french_div = document.getElementById("bcj_french_div"); |
| | | bcj_french_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){ |
| | | Element yhq_french = document.getElementById("yhq_french"); |
| | | yhq_french.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element yhq_french_div = document.getElementById("yhq_french_div"); |
| | | yhq_french_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){ |
| | | Element zk_french = document.getElementById("zk_french"); |
| | | zk_french.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element zk_french_div = document.getElementById("zk_french_div"); |
| | | zk_french_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){ |
| | | Element hb_french = document.getElementById("hb_french"); |
| | | hb_french.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element hb_french_div = document.getElementById("hb_french_div"); |
| | | hb_french_div.remove(); |
| | | } |
| | | Element xj_french = document.getElementById("xj_french"); |
| | | xj_french.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pay_type_french = document.getElementById("pay_type_french"); |
| | | pay_type_french.text(payTypeFrench); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pdf_french = document.getElementById("pdf_french"); |
| | | pdf_french.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_french = document.getElementById("lost_item_french"); |
| | | lost_item_french.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_french = document.getElementById("track_french"); |
| | | // track_french.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_french = document.getElementsByClass("driver_french"); |
| | | for (int i = 0; i < driver_french.size(); i++) { |
| | | Element element = driver_french.get(i); |
| | | element.text(" " + driver.getFirstName() + "." + driver.getLastName()); |
| | | } |
| | | Element cp_french = document.getElementById("cp_french"); |
| | | cp_french.text("Plaque: GS " + car.getCarLicensePlate()); |
| | | Element pf_french = document.getElementById("pf_french"); |
| | | pf_french.text("Note du chauffeur: " + aDouble); |
| | | Element start_address_french = document.getElementById("start_address_french"); |
| | | start_address_french.text(orderLogistics.getStartAddress()); |
| | | Element end_address_french = document.getElementById("end_address_french"); |
| | | end_address_french.text(orderLogistics.getEndAddress()); |
| | | Phone phone = phoneService.selectOne(new EntityWrapper<Phone>().eq("type", 2).eq("companyId", driver.getCompanyId())); |
| | | Element server_tel_french = document.getElementById("server_tel_french"); |
| | | server_tel_french.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "I-GO电子收据" : language == 2 ? "Receipt" : "Reçu", document.html()); |
| | | |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/parcel_receipt_" + orderId + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | File file1 = new File("/usr/local/nginx/html/files/pdf/"); |
| | | if(!file1.exists()){ |
| | | file1.mkdirs(); |
| | | } |
| | | file1 = new File("/usr/local/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf"); |
| | | if(!file1.exists()){ |
| | | file1.createNewFile(); |
| | | } |
| | | try{ |
| | | FileOutputStream fileOutputStream = new FileOutputStream(file1); |
| | | HtmlToPdfUtils.convertToPdf("/usr/local/nginx/html/files/html/parcel_receipt_" + orderId + ".html", "I-GO", fileOutputStream); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | System.out.println("html转pdf异常"); |
| | | } |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/parcel_receipt_" + orderId + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(userInfo.getId()); |
| | | tEmail.setType(1); |
| | | tEmail.setName(language == 1 ? "I-GO电子收据" : language == 2 ? "Receipt" : "Reçu"); |
| | | tEmail.setOrderId(orderId); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | String week = EmailUtil.getWeek(language, i); |
| | | tEmail.setWeek(week); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | } |
| | | |
| | | |
| | | } |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | if(payType == 4){//现金支付 |
| | | SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 |
| | | |
| | | //处理优惠券和红包 |
| | | if(null != userCouponRecord){ |
| | | userCouponRecord.setState(2); |
| | | userCouponRecord.setEndTime(new Date()); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "包裹下单支付", orderMoney, 2, 1, 1, 4, orderId); |
| | |
| | | orderLogistics.setDriverPay(1); |
| | | orderLogistics.setPayType(4); |
| | | orderLogistics.setPayMoney(orderMoney); |
| | | orderLogistics.setOrderMoney(orderLogistics.getOrderMoney()+orderLogistics.getFreeMoney().doubleValue()); |
| | | |
| | | //处理优惠券和红包 |
| | | if(null != userCouponRecord){ |
| | | userCouponRecord.setState(2); |
| | | userCouponRecord.setEndTime(new Date()); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | //添加优惠收入补贴 |
| | | Double money = userCouponRecord.getMoney(); |
| | | incomeService.saveData(2, orderLogistics.getDriverId(), 5, orderLogistics.getId(), 4, money); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | if(null != orderLogistics.getRedPacketId()){ |
| | | JSONArray jsonArray = JSON.parseArray(orderLogistics.getRedPacketId()); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id1 = jsonObject.getInteger("id"); |
| | | Double money = jsonObject.getDouble("money"); |
| | | UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(id1); |
| | | userRedPacketRecord.setRemainingAmount(userRedPacketRecord.getRemainingAmount() - money); |
| | | if(0 == userRedPacketRecord.getRemainingAmount()){ |
| | | userRedPacketRecord.setState(2); |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | } |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | } |
| | | Double money = orderLogistics.getRedPacketMoney(); |
| | | incomeService.saveData(2, orderLogistics.getDriverId(), 7, orderLogistics.getId(), 4, money); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | if(null != orderLogistics.getDiscountMoney() && 0 < orderLogistics.getDiscountMoney()){ |
| | | Double money = orderLogistics.getDiscountMoney(); |
| | | incomeService.saveData(2, orderLogistics.getDriverId(), 6, orderLogistics.getId(), 4, money); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | |
| | | if(orderLogistics.getIsplatPay()==1){ |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderLogistics.getCompanyId()); |
| | | Double speMoney = company.getSpeMoney(); |
| | | BigDecimal d = null;//企业收入 |
| | | BigDecimal c = null;//司机收入 |
| | | if(company.getIsSpeFixedOrProportional() == 2){//固定 |
| | | d = new BigDecimal(speMoney); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d);//只有出行金额参与抽成,其余归属司机 |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | Double price = orderLogistics.getStartMoney() + orderLogistics.getMileageMoney() + orderLogistics.getWaitMoney() + orderLogistics.getDurationMoney() + orderLogistics.getLongDistanceMoney(); |
| | | d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | // incomeService.saveData(1, orderPrivateCar.getCompanyId(), 2, orderPrivateCar.getId(), 1, d.doubleValue()); |
| | | // incomeService.saveData(2, orderPrivateCar.getDriverId(), 2, orderPrivateCar.getId(), 1, c.doubleValue()); |
| | | |
| | | // driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // driverService.updateById(driver); |
| | | |
| | | |
| | | //记录司机待结算金额 |
| | | if(d.compareTo(new BigDecimal(0)) > 0){ |
| | | SettlementDetail settlementDetail = new SettlementDetail(); |
| | | settlementDetail.setOrderId(orderId); |
| | | settlementDetail.setOrderType(1); |
| | | settlementDetail.setDriverId(driver.getId()); |
| | | settlementDetail.setOrderMoney(orderLogistics.getOrderMoney()); |
| | | settlementDetail.setPrice(d.doubleValue()); |
| | | settlementDetail.setCreateTime(new Date()); |
| | | settlementDetailService.insert(settlementDetail); |
| | | |
| | | SettlementAllocation settlementAllocation = settlementAllocationService.selectOne(null); |
| | | if(null != settlementAllocation){ |
| | | JSONObject jsonObject = JSON.parseObject(settlementAllocation.getContent()); |
| | | Double maxPrice = jsonObject.getDouble("maxPrice"); |
| | | Integer type1 = jsonObject.getInteger("type"); |
| | | if(1 == type1){ |
| | | List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driver.getId()).isNull("settlementRecordId").last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(createTime, '%Y-%m-%d')")); |
| | | BigDecimal total = new BigDecimal(0); |
| | | for (SettlementDetail detail : settlementDetailList) { |
| | | total = total.add(new BigDecimal(detail.getPrice())); |
| | | } |
| | | if(maxPrice.compareTo(total.doubleValue()) <= 0){ |
| | | SettlementRecord settlementRecord = settlementRecordService.selectOne(new EntityWrapper<SettlementRecord>().eq("driverId", orderLogistics.getDriverId()) |
| | | .eq("type", type1).eq("paymentStatus", 1).last(" and day = DATE_FORMAT(now(), '%Y-%m-%d')")); |
| | | if(null == settlementRecord){ |
| | | settlementRecord = new SettlementRecord(); |
| | | settlementRecord.setDay(new Date()); |
| | | settlementRecord.setDriverId(orderLogistics.getDriverId()); |
| | | settlementRecord.setType(type1); |
| | | settlementRecord.setPaymentStatus(1); |
| | | settlementRecord.setPayMoney(total.doubleValue()); |
| | | settlementRecord.setInsertTime(new Date()); |
| | | settlementRecordService.insert(settlementRecord); |
| | | }else{ |
| | | settlementRecord.setPayMoney(total.doubleValue()); |
| | | settlementRecordService.updateById(settlementRecord); |
| | | } |
| | | for (SettlementDetail detail : settlementDetailList) { |
| | | detail.setSettlementRecordId(settlementRecord.getId()); |
| | | settlementDetailService.updateById(detail); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | |
| | | ? "You've paid for the delivery order successfully, thank you for using I-GO" : |
| | | "Vous avez payé la commande de livraison avec succès, merci d’utiliser I-GO", uid, 1); |
| | | |
| | | this.pushOrder(orderLogistics);//推单 |
| | | language = userInfo.getLanguage(); |
| | | String payTypeChinese = ""; |
| | | String payTypeEnglish = ""; |
| | | String payTypeFrench = ""; |
| | | if(orderLogistics.getPayType() == 3){ |
| | | payTypeChinese = "现金"; |
| | | payTypeEnglish = "Cash"; |
| | | payTypeFrench = "En espèces"; |
| | | } |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/receiptLogistics.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Car car = carMapper.selectById(orderLogistics.getCarId()); |
| | | Double aDouble = 0D; |
| | | if(null != orderLogistics.getDriverId()){ |
| | | aDouble = orderEvaluateService.queryDriverScore(orderLogistics.getDriverId()); |
| | | } |
| | | if(1 == language){ |
| | | document.getElementById("english").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("I-GO电子收据"); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",您在I-GO此订单消费GHS " + orderLogistics.getPayMoney()); |
| | | Element xcf_chinese = document.getElementById("xcf_chinese"); |
| | | xcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element bcj_chinese = document.getElementById("bcj_chinese"); |
| | | if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){ |
| | | bcj_chinese.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element bcj_chinese_div = document.getElementById("bcj_chinese_div"); |
| | | bcj_chinese_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){ |
| | | Element yhq_chinese = document.getElementById("yhq_chinese"); |
| | | yhq_chinese.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element yhq_chinese_div = document.getElementById("yhq_chinese_div"); |
| | | yhq_chinese_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){ |
| | | Element zk_chinese = document.getElementById("zk_chinese"); |
| | | zk_chinese.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element zk_chinese_div = document.getElementById("zk_chinese_div"); |
| | | zk_chinese_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){ |
| | | Element hb_chinese = document.getElementById("hb_chinese"); |
| | | hb_chinese.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element hb_chinese_div = document.getElementById("hb_chinese_div"); |
| | | hb_chinese_div.remove(); |
| | | } |
| | | Element xj_chinese = document.getElementById("xj_chinese"); |
| | | xj_chinese.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pay_type_chinese = document.getElementById("pay_type_chinese"); |
| | | pay_type_chinese.text(payTypeChinese); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pdf_chinese = document.getElementById("pdf_chinese"); |
| | | pdf_chinese.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_chinese = document.getElementById("lost_item_chinese"); |
| | | lost_item_chinese.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_chinese = document.getElementById("track_chinese"); |
| | | // track_chinese.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_chinese = document.getElementsByClass("driver_chinese"); |
| | | for (int i = 0; i < driver_chinese.size(); i++) { |
| | | Element element = driver_chinese.get(i); |
| | | element.text(" " + driver.getFirstName() + "." + driver.getLastName()); |
| | | } |
| | | Element cp_chinese = document.getElementById("cp_chinese"); |
| | | cp_chinese.text("车牌:" + car.getCarLicensePlate()); |
| | | Element pf_chinese = document.getElementById("pf_chinese"); |
| | | pf_chinese.text("司机评分:" + aDouble); |
| | | Element start_address_chinese = document.getElementById("start_address_chinese"); |
| | | start_address_chinese.text(orderLogistics.getStartAddress()); |
| | | Element end_address_chinese = document.getElementById("end_address_chinese"); |
| | | end_address_chinese.text(orderLogistics.getEndAddress()); |
| | | Phone phone = phoneService.selectOne(new EntityWrapper<Phone>().eq("type", 2).eq("companyId", driver.getCompanyId())); |
| | | Element server_tel_chinese = document.getElementById("server_tel_chinese"); |
| | | server_tel_chinese.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("Receipt"); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip "); |
| | | Element xcf_english = document.getElementById("xcf_english"); |
| | | xcf_english.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element bcj_english = document.getElementById("bcj_english"); |
| | | if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){ |
| | | bcj_english.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element bcj_english_div = document.getElementById("bcj_english_div"); |
| | | bcj_english_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){ |
| | | Element yhq_english = document.getElementById("yhq_english"); |
| | | yhq_english.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element yhq_english_div = document.getElementById("yhq_english_div"); |
| | | yhq_english_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){ |
| | | Element zk_english = document.getElementById("zk_english"); |
| | | zk_english.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element zk_english_div = document.getElementById("zk_english_div"); |
| | | zk_english_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){ |
| | | Element hb_english = document.getElementById("hb_english"); |
| | | hb_english.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element hb_english_div = document.getElementById("hb_english_div"); |
| | | hb_english_div.remove(); |
| | | } |
| | | Element xj_english = document.getElementById("xj_english"); |
| | | xj_english.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pay_type_english = document.getElementById("pay_type_english"); |
| | | pay_type_english.text(payTypeEnglish); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pdf_english = document.getElementById("pdf_english"); |
| | | pdf_english.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_english = document.getElementById("lost_item_english"); |
| | | lost_item_english.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_english = document.getElementById("track_english"); |
| | | // track_english.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_english = document.getElementsByClass("driver_english"); |
| | | for (int i = 0; i < driver_english.size(); i++) { |
| | | Element element = driver_english.get(i); |
| | | element.text(" " + driver.getFirstName() + "." + driver.getLastName()); |
| | | } |
| | | Element cp_english = document.getElementById("cp_english"); |
| | | cp_english.text("Number Plate:" + car.getCarLicensePlate()); |
| | | Element pf_english = document.getElementById("pf_english"); |
| | | pf_english.text("Driver Rating:" + aDouble); |
| | | Element start_address_english = document.getElementById("start_address_english"); |
| | | start_address_english.text(orderLogistics.getStartAddress()); |
| | | Element end_address_english = document.getElementById("end_address_english"); |
| | | end_address_english.text(orderLogistics.getEndAddress()); |
| | | Phone phone = phoneService.selectOne(new EntityWrapper<Phone>().eq("type", 2).eq("companyId", driver.getCompanyId())); |
| | | Element server_tel_english = document.getElementById("server_tel_english"); |
| | | server_tel_english.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("english").remove(); |
| | | document.getElementsByTag("title").get(0).text("Reçu"); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le "); |
| | | Element xcf_french = document.getElementById("xcf_french"); |
| | | xcf_french.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element bcj_french = document.getElementById("bcj_french"); |
| | | if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){ |
| | | bcj_french.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element bcj_french_div = document.getElementById("bcj_french_div"); |
| | | bcj_french_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){ |
| | | Element yhq_french = document.getElementById("yhq_french"); |
| | | yhq_french.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element yhq_french_div = document.getElementById("yhq_french_div"); |
| | | yhq_french_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){ |
| | | Element zk_french = document.getElementById("zk_french"); |
| | | zk_french.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element zk_french_div = document.getElementById("zk_french_div"); |
| | | zk_french_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){ |
| | | Element hb_french = document.getElementById("hb_french"); |
| | | hb_french.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element hb_french_div = document.getElementById("hb_french_div"); |
| | | hb_french_div.remove(); |
| | | } |
| | | Element xj_french = document.getElementById("xj_french"); |
| | | xj_french.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pay_type_french = document.getElementById("pay_type_french"); |
| | | pay_type_french.text(payTypeFrench); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pdf_french = document.getElementById("pdf_french"); |
| | | pdf_french.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_french = document.getElementById("lost_item_french"); |
| | | lost_item_french.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_french = document.getElementById("track_french"); |
| | | // track_french.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_french = document.getElementsByClass("driver_french"); |
| | | for (int i = 0; i < driver_french.size(); i++) { |
| | | Element element = driver_french.get(i); |
| | | element.text(" " + driver.getFirstName() + "." + driver.getLastName()); |
| | | } |
| | | Element cp_french = document.getElementById("cp_french"); |
| | | cp_french.text("Plaque: GS " + car.getCarLicensePlate()); |
| | | Element pf_french = document.getElementById("pf_french"); |
| | | pf_french.text("Note du chauffeur: " + aDouble); |
| | | Element start_address_french = document.getElementById("start_address_french"); |
| | | start_address_french.text(orderLogistics.getStartAddress()); |
| | | Element end_address_french = document.getElementById("end_address_french"); |
| | | end_address_french.text(orderLogistics.getEndAddress()); |
| | | Phone phone = phoneService.selectOne(new EntityWrapper<Phone>().eq("type", 2).eq("companyId", driver.getCompanyId())); |
| | | Element server_tel_french = document.getElementById("server_tel_french"); |
| | | server_tel_french.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "I-GO电子收据" : language == 2 ? "Receipt" : "Reçu", document.html()); |
| | | |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/parcel_receipt_" + orderId + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | File file1 = new File("/usr/local/nginx/html/files/pdf/"); |
| | | if(!file1.exists()){ |
| | | file1.mkdirs(); |
| | | } |
| | | file1 = new File("/usr/local/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf"); |
| | | if(!file1.exists()){ |
| | | file1.createNewFile(); |
| | | } |
| | | try{ |
| | | FileOutputStream fileOutputStream = new FileOutputStream(file1); |
| | | HtmlToPdfUtils.convertToPdf("/usr/local/nginx/html/files/html/parcel_receipt_" + orderId + ".html", "I-GO", fileOutputStream); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | System.out.println("html转pdf异常"); |
| | | } |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/parcel_receipt_" + orderId + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(userInfo.getId()); |
| | | tEmail.setType(1); |
| | | tEmail.setName(language == 1 ? "I-GO电子收据" : language == 2 ? "Receipt" : "Reçu"); |
| | | tEmail.setOrderId(orderId); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | String week = EmailUtil.getWeek(language, i); |
| | | tEmail.setWeek(week); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | } |
| | | } |
| | | |
| | | this.updateById(orderLogistics); |
| | |
| | | if(null != query){ |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "完成订单", query.getAmount(), 2, 1, 1, orderLogistics.getType(), query.getOrderId()); |
| | | orderLogistics.setState(1);//先支付后抢单 |
| | | orderLogistics.setState(8); |
| | | orderLogistics.setPayType(query.getPayType()); |
| | | orderLogistics.setPayMoney(query.getAmount()); |
| | | this.updateById(orderLogistics); |
| | |
| | | userCouponRecord.setState(2); |
| | | userCouponRecord.setEndTime(new Date()); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | if(null != orderLogistics.getRedPacketId()){ |
| | | JSONArray jsonArray = JSON.parseArray(orderLogistics.getRedPacketId()); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id1 = jsonObject.getInteger("id"); |
| | | Double money = jsonObject.getDouble("money"); |
| | | UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(id1); |
| | | userRedPacketRecord.setRemainingAmount(userRedPacketRecord.getRemainingAmount() - money); |
| | | if(0 == userRedPacketRecord.getRemainingAmount()){ |
| | | userRedPacketRecord.setState(2); |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | } |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | } |
| | | } |
| | | |
| | | query.setState(2); |
| | |
| | | ? "You've paid for the delivery order successfully, thank you for using I-GO" : |
| | | "Vous avez payé la commande de livraison avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1); |
| | | |
| | | this.pushOrder(orderLogistics);//推单 |
| | | language = userInfo.getLanguage(); |
| | | String payTypeChinese = ""; |
| | | String payTypeEnglish = ""; |
| | | String payTypeFrench = ""; |
| | | if(orderLogistics.getPayType() == 1){ |
| | | payTypeChinese = "手机支付"; |
| | | payTypeEnglish = "Mobile money"; |
| | | payTypeFrench = "Argent mobile"; |
| | | } |
| | | if(orderLogistics.getPayType() == 2){ |
| | | payTypeChinese = "银行卡支付"; |
| | | payTypeEnglish = "Bank card"; |
| | | payTypeFrench = "Carte bancaire"; |
| | | } |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/receiptLogistics.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | Car car = carMapper.selectById(orderLogistics.getCarId()); |
| | | Double aDouble = 0D; |
| | | if(null != orderLogistics.getDriverId()){ |
| | | aDouble = orderEvaluateService.queryDriverScore(orderLogistics.getDriverId()); |
| | | } |
| | | if(1 == language){ |
| | | document.getElementById("english").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("I-GO电子收据"); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",您在I-GO此订单消费GHS " + orderLogistics.getPayMoney()); |
| | | Element xcf_chinese = document.getElementById("xcf_chinese"); |
| | | xcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element bcj_chinese = document.getElementById("bcj_chinese"); |
| | | if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){ |
| | | bcj_chinese.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element bcj_chinese_div = document.getElementById("bcj_chinese_div"); |
| | | bcj_chinese_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){ |
| | | Element yhq_chinese = document.getElementById("yhq_chinese"); |
| | | yhq_chinese.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element yhq_chinese_div = document.getElementById("yhq_chinese_div"); |
| | | yhq_chinese_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){ |
| | | Element zk_chinese = document.getElementById("zk_chinese"); |
| | | zk_chinese.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element zk_chinese_div = document.getElementById("zk_chinese_div"); |
| | | zk_chinese_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){ |
| | | Element hb_chinese = document.getElementById("hb_chinese"); |
| | | hb_chinese.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element hb_chinese_div = document.getElementById("hb_chinese_div"); |
| | | hb_chinese_div.remove(); |
| | | } |
| | | Element xj_chinese = document.getElementById("xj_chinese"); |
| | | xj_chinese.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pay_type_chinese = document.getElementById("pay_type_chinese"); |
| | | pay_type_chinese.text(payTypeChinese); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pdf_chinese = document.getElementById("pdf_chinese"); |
| | | pdf_chinese.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=4"); |
| | | Element lost_item_chinese = document.getElementById("lost_item_chinese"); |
| | | lost_item_chinese.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + id + "&orderType=4"); |
| | | // Element track_chinese = document.getElementById("track_chinese"); |
| | | // track_chinese.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_chinese = document.getElementsByClass("driver_chinese"); |
| | | for (int i = 0; i < driver_chinese.size(); i++) { |
| | | Element element = driver_chinese.get(i); |
| | | element.text(" " + driver.getFirstName() + "." + driver.getLastName()); |
| | | } |
| | | Element cp_chinese = document.getElementById("cp_chinese"); |
| | | cp_chinese.text("车牌:" + car.getCarLicensePlate()); |
| | | Element pf_chinese = document.getElementById("pf_chinese"); |
| | | pf_chinese.text("司机评分:" + aDouble); |
| | | Element start_address_chinese = document.getElementById("start_address_chinese"); |
| | | start_address_chinese.text(orderLogistics.getStartAddress()); |
| | | Element end_address_chinese = document.getElementById("end_address_chinese"); |
| | | end_address_chinese.text(orderLogistics.getEndAddress()); |
| | | Phone phone = phoneService.selectOne(new EntityWrapper<Phone>().eq("type", 2).eq("companyId", driver.getCompanyId())); |
| | | Element server_tel_chinese = document.getElementById("server_tel_chinese"); |
| | | server_tel_chinese.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("Receipt"); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip "); |
| | | Element xcf_english = document.getElementById("xcf_english"); |
| | | xcf_english.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element bcj_english = document.getElementById("bcj_english"); |
| | | if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){ |
| | | bcj_english.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element bcj_english_div = document.getElementById("bcj_english_div"); |
| | | bcj_english_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){ |
| | | Element yhq_english = document.getElementById("yhq_english"); |
| | | yhq_english.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element yhq_english_div = document.getElementById("yhq_english_div"); |
| | | yhq_english_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){ |
| | | Element zk_english = document.getElementById("zk_english"); |
| | | zk_english.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element zk_english_div = document.getElementById("zk_english_div"); |
| | | zk_english_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){ |
| | | Element hb_english = document.getElementById("hb_english"); |
| | | hb_english.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element hb_english_div = document.getElementById("hb_english_div"); |
| | | hb_english_div.remove(); |
| | | } |
| | | Element xj_english = document.getElementById("xj_english"); |
| | | xj_english.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pay_type_english = document.getElementById("pay_type_english"); |
| | | pay_type_english.text(payTypeEnglish); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pdf_english = document.getElementById("pdf_english"); |
| | | pdf_english.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=4"); |
| | | Element lost_item_english = document.getElementById("lost_item_english"); |
| | | lost_item_english.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + id + "&orderType=4"); |
| | | // Element track_english = document.getElementById("track_english"); |
| | | // track_english.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_english = document.getElementsByClass("driver_english"); |
| | | for (int i = 0; i < driver_english.size(); i++) { |
| | | Element element = driver_english.get(i); |
| | | element.text(" " + driver.getFirstName() + "." + driver.getLastName()); |
| | | } |
| | | Element cp_english = document.getElementById("cp_english"); |
| | | cp_english.text("Number Plate:" + car.getCarLicensePlate()); |
| | | Element pf_english = document.getElementById("pf_english"); |
| | | pf_english.text("Driver Rating:" + aDouble); |
| | | Element start_address_english = document.getElementById("start_address_english"); |
| | | start_address_english.text(orderLogistics.getStartAddress()); |
| | | Element end_address_english = document.getElementById("end_address_english"); |
| | | end_address_english.text(orderLogistics.getEndAddress()); |
| | | Phone phone = phoneService.selectOne(new EntityWrapper<Phone>().eq("type", 2).eq("companyId", driver.getCompanyId())); |
| | | Element server_tel_english = document.getElementById("server_tel_english"); |
| | | server_tel_english.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("english").remove(); |
| | | document.getElementsByTag("title").get(0).text("Reçu"); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le "); |
| | | Element xcf_french = document.getElementById("xcf_french"); |
| | | xcf_french.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element bcj_french = document.getElementById("bcj_french"); |
| | | if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){ |
| | | bcj_french.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element bcj_french_div = document.getElementById("bcj_french_div"); |
| | | bcj_french_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){ |
| | | Element yhq_french = document.getElementById("yhq_french"); |
| | | yhq_french.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element yhq_french_div = document.getElementById("yhq_french_div"); |
| | | yhq_french_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){ |
| | | Element zk_french = document.getElementById("zk_french"); |
| | | zk_french.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element zk_french_div = document.getElementById("zk_french_div"); |
| | | zk_french_div.remove(); |
| | | } |
| | | if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){ |
| | | Element hb_french = document.getElementById("hb_french"); |
| | | hb_french.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | }else{ |
| | | Element hb_french_div = document.getElementById("hb_french_div"); |
| | | hb_french_div.remove(); |
| | | } |
| | | Element xj_french = document.getElementById("xj_french"); |
| | | xj_french.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pay_type_french = document.getElementById("pay_type_french"); |
| | | pay_type_french.text(payTypeFrench); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element pdf_french = document.getElementById("pdf_french"); |
| | | pdf_french.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=4"); |
| | | Element lost_item_french = document.getElementById("lost_item_french"); |
| | | lost_item_french.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + id + "&orderType=4"); |
| | | // Element track_french = document.getElementById("track_french"); |
| | | // track_french.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_french = document.getElementsByClass("driver_french"); |
| | | for (int i = 0; i < driver_french.size(); i++) { |
| | | Element element = driver_french.get(i); |
| | | element.text(" " + driver.getFirstName() + "." + driver.getLastName()); |
| | | } |
| | | Element cp_french = document.getElementById("cp_french"); |
| | | cp_french.text("Plaque: GS " + car.getCarLicensePlate()); |
| | | Element pf_french = document.getElementById("pf_french"); |
| | | pf_french.text("Note du chauffeur: " + aDouble); |
| | | Element start_address_french = document.getElementById("start_address_french"); |
| | | start_address_french.text(orderLogistics.getStartAddress()); |
| | | Element end_address_french = document.getElementById("end_address_french"); |
| | | end_address_french.text(orderLogistics.getEndAddress()); |
| | | Phone phone = phoneService.selectOne(new EntityWrapper<Phone>().eq("type", 2).eq("companyId", driver.getCompanyId())); |
| | | Element server_tel_french = document.getElementById("server_tel_french"); |
| | | server_tel_french.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "I-GO电子收据" : language == 2 ? "Receipt" : "Reçu", document.html()); |
| | | |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/parcel_receipt_" + id + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | File file1 = new File("/usr/local/nginx/html/files/pdf/"); |
| | | if(!file1.exists()){ |
| | | file1.mkdirs(); |
| | | } |
| | | file1 = new File("/usr/local/nginx/html/files/pdf/parcel_receipt_" + id + ".pdf"); |
| | | if(!file1.exists()){ |
| | | file1.createNewFile(); |
| | | } |
| | | try{ |
| | | FileOutputStream fileOutputStream = new FileOutputStream(file1); |
| | | HtmlToPdfUtils.convertToPdf("/usr/local/nginx/html/files/html/parcel_receipt_" + id + ".html", "I-GO", fileOutputStream); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | System.out.println("html转pdf异常"); |
| | | } |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/parcel_receipt_" + id + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(userInfo.getId()); |
| | | tEmail.setType(1); |
| | | tEmail.setName(language == 1 ? "I-GO电子收据" : language == 2 ? "Receipt" : "Reçu"); |
| | | tEmail.setOrderId(id); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | String week = EmailUtil.getWeek(language, i); |
| | | tEmail.setWeek(week); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | } |
| | | }else{ |
| | | System.err.println("预支付数据异常(orderId = " + id + ")"); |
| | | } |
| | |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil addCancle(Integer id, String reason, String remark, Integer uid, Integer language) throws Exception { |
| | | public ResultUtil addCancle(Integer id, String reason, String remark, Integer uid, Double lon, Double lat, String address, Integer language) throws Exception { |
| | | if(ToolUtil.isNotEmpty(remark)){ |
| | | if(ToolUtil.isNotEmpty(remark)){ |
| | | List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null); |
| | |
| | | if(null == orderLogistics){ |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,订单信息有误" : language == 2 ? "Failed to cancel order, order-information error." : "Échec de l’annulation de la commande, erreur d’information de commande."); |
| | | } |
| | | if(orderLogistics.getState() > 5 && orderLogistics.getState() != 7 && orderLogistics.getState() != 11){ |
| | | if(orderLogistics.getState() > 5 && orderLogistics.getState() != 11){ |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Failed to cancel order, illegal operation." : "Échec de l’annulation de la commande, opération illégale."); |
| | | } |
| | | |
| | | if(orderLogistics.getState() == 7){ |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(id); |
| | | orderCancel.setOrderType(orderLogistics.getType()); |
| | | orderCancel.setReason(reason); |
| | | orderCancel.setRemark(remark); |
| | | orderCancel.setState(2); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancel.setUserType(1); |
| | | orderCancelService.insert(orderCancel); |
| | | if(null == orderLogistics.getDriverId()){//没有接单的情况 |
| | | integer = orderCancelService.saveData(id, 4, language == 1 ? "无司机接单" : language == 2 ? "No driver to take orders" : "Pas de chauffeur pour prendre les commandes", language == 1 ? "无司机接单" : language == 2 ? "No driver to take orders" : "Pas de chauffeur pour prendre les commandes", null, null, 2, 1, uid); |
| | | orderLogistics.setState(10); |
| | | this.updateById(orderLogistics); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | //回退支付金额 |
| | | if(null != orderLogistics.getPayType() && orderLogistics.getPayType() == 1) {//微信 |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(id); |
| | | orderCancel.setOrderType(orderLogistics.getType()); |
| | | orderCancel.setReason(reason); |
| | | orderCancel.setRemark(remark); |
| | | orderCancel.setState(1); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancel.setUserType(1); |
| | | orderCancelService.insert(orderCancel); |
| | | }else { |
| | | BaseWarpper data = queryCancleAmount(id, language).getData(); |
| | | Double amount = data.getAmount(); |
| | | if(0 == amount){ |
| | | integer = orderCancelService.saveData(id, 4, reason, remark, null, null, 2, 1, uid); |
| | | if(5 == orderLogistics.getState()){ |
| | | orderLogistics.setState(6); |
| | | orderLogistics.setGetoffLon(lon); |
| | | orderLogistics.setGetoffLat(lat); |
| | | orderLogistics.setGetoffAddress(address); |
| | | orderLogistics.setGetoffTime(new Date()); |
| | | orderLogistics.setEndServiceTime(new Date()); |
| | | orderLogistics.setCancelMidway(1); |
| | | }else{ |
| | | orderLogistics.setState(10); |
| | | } |
| | | this.updateById(orderLogistics); |
| | | //调用回退接口 |
| | | PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 1, 2); |
| | | if(null == query){ |
| | | return ResultUtil.error("支付数据异常,无法完成退款"); |
| | | }else{ |
| | | if(5 == orderLogistics.getState()){ |
| | | orderLogistics.setGetoffLon(lon); |
| | | orderLogistics.setGetoffLat(lat); |
| | | orderLogistics.setGetoffAddress(address); |
| | | orderLogistics.setGetoffTime(new Date()); |
| | | orderLogistics.setEndServiceTime(new Date()); |
| | | orderLogistics.setCancelMidway(1); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String payerTransactionID = sdf.format(new Date()) + orderCancel.getId(); |
| | | PayoutResponse payoutResponse = tinggPayoutUtil.sendPayout(userInfo.getPhoneOperator(), "+" + userInfo.getPhone(), payerTransactionID, query.getAmount().doubleValue(), callbackPath + "/base/orderCancelRefundCallback", "取消订单退款"); |
| | | AuthStatus authStatus = payoutResponse.getAuthStatus(); |
| | | Results results = payoutResponse.getResults().get(0); |
| | | String statusCode = results.getStatusCode(); |
| | | if(!"131".equals(authStatus.getAuthStatusCode())){ |
| | | return ResultUtil.error(authStatus.getAuthStatusDescription()); |
| | | } |
| | | if(!"139".equals(statusCode)){ |
| | | return ResultUtil.error(results.getStatusDescription()); |
| | | } |
| | | } |
| | | if(null != orderLogistics.getPayType() && orderLogistics.getPayType() == 2){//支付宝 |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(id); |
| | | orderCancel.setOrderType(orderLogistics.getType()); |
| | | orderCancel.setReason(reason); |
| | | orderCancel.setRemark(remark); |
| | | orderCancel.setState(1); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancel.setUserType(1); |
| | | orderCancelService.insert(orderCancel); |
| | | orderLogistics.setState(10); |
| | | orderLogistics.setOldState(orderLogistics.getState()); |
| | | orderLogistics.setState(12); |
| | | this.updateById(orderLogistics); |
| | | integer = orderCancel.getId(); |
| | | //调用回退接口 |
| | | PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 2, 2); |
| | | if(null == query){ |
| | | return ResultUtil.error("支付数据异常,无法完成退款"); |
| | | integer = orderCancelService.saveData(id, 4, reason, remark, null, amount, 1, 1, uid); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String payerTransactionID = sdf.format(new Date()) + orderCancel.getId(); |
| | | PayoutResponse payoutResponse = tinggPayoutUtil.sendPayout(userInfo.getPhoneOperator(), "+" + userInfo.getPhone(), payerTransactionID, query.getAmount().doubleValue(), callbackPath + "/base/orderCancelRefundCallback", "取消订单退款"); |
| | | AuthStatus authStatus = payoutResponse.getAuthStatus(); |
| | | Results results = payoutResponse.getResults().get(0); |
| | | String statusCode = results.getStatusCode(); |
| | | if(!"131".equals(authStatus.getAuthStatusCode())){ |
| | | return ResultUtil.error(authStatus.getAuthStatusDescription()); |
| | | } |
| | | if(!"139".equals(statusCode)){ |
| | | return ResultUtil.error(results.getStatusDescription()); |
| | | } |
| | | } |
| | | if(null != orderLogistics.getPayType() && orderLogistics.getPayType() == 3){//余额 |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | userInfo.setBalance(userInfo.getBalance() + orderLogistics.getPayMoney()); |
| | | this.deleteTask(id);//删除定时任务 |
| | | |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(id); |
| | | orderCancel.setOrderType(orderLogistics.getType()); |
| | | orderCancel.setReason(reason); |
| | | orderCancel.setRemark(remark); |
| | | orderCancel.setState(2); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancel.setUserType(1); |
| | | orderCancelService.insert(orderCancel); |
| | | userInfoService.updateById(userInfo); |
| | | orderLogistics.setState(10); |
| | | this.updateById(orderLogistics); |
| | | integer = orderCancel.getId(); |
| | | |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "包裹取消退款", orderLogistics.getPayMoney(), 1, 1, 1, 4, orderLogistics.getId()); |
| | | } |
| | | |
| | | |
| | | if(null != orderLogistics.getPayType() && orderLogistics.getPayType() == 4){//现金 |
| | | // UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | // userInfo.setBalance(userInfo.getBalance() + orderLogistics.getPayMoney()); |
| | | // userInfoService.updateById(userInfo); |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(id); |
| | | orderCancel.setOrderType(orderLogistics.getType()); |
| | | orderCancel.setReason(reason); |
| | | orderCancel.setRemark(remark); |
| | | orderCancel.setState(2); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancel.setUserType(1); |
| | | orderCancelService.insert(orderCancel); |
| | | |
| | | orderLogistics.setState(10); |
| | | this.updateById(orderLogistics); |
| | | integer = orderCancel.getId(); |
| | | |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "包裹取消退款", orderLogistics.getPayMoney(), 1, 1, 1, 4, orderLogistics.getId()); |
| | | } |
| | | |
| | | if(null != orderLogistics.getDriverId()){ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0); |
| | | } |
| | | }).start(); |
| | | |
| | | //修改司机为空闲 |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | driver.setState(2); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | //修改行程信息 |
| | | fleetEngineUtil.updateTrip("CANCELED", null, null, orderLogistics.getTripId(), null, null, null, null); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功取消包裹订单,谢谢使用!" : language == 2 ? "You've cancelled the delivery order successfully, thank you for using I-GO " |
| | |
| | | if(state == 11){ |
| | | map.put("state", map.get("oldState")); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("state"))) != 8 && Integer.valueOf(String.valueOf(map.get("state"))) != 9){ |
| | | map.put("redPacketMoney", null); |
| | | map.put("couponMoney", null); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("state"))) == 7){ |
| | | UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(Integer.valueOf(String.valueOf(map.get("companyId")))); |
| | | if(null != query2){ |
| | | Integer orderNum=this.selectCount(new EntityWrapper<OrderLogistics>().eq("userId",orderLogistics.getUserId()).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())")); |
| | | if(query2.getDistance()*1000>orderLogistics.getMileage() && query2.getOrderNum()>orderNum){ |
| | | Double special = query2.getSpecial(); |
| | | orderLogistics.setDiscount(special); |
| | | Double orderMoney = orderLogistics.getOrderMoney(); |
| | | double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | if(orderMoney.compareTo(v) > 0){ |
| | | map.put("discountMoney",orderMoney - v); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(map.get("startLon").toString(), map.get("startLat").toString()); |
| | | map.put("startCity", geocode.get("city")); |
| | | geocode = gdMapGeocodingUtil.geocode(map.get("endLon").toString(), map.get("endLat").toString()); |
| | |
| | | }else{ |
| | | map.put("receipt", ""); |
| | | } |
| | | Integer companyId = 1; |
| | | if(null != map.get("driverId")){ |
| | | companyId = Integer.valueOf(String.valueOf(map.get("companyId"))); |
| | | } |
| | | CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", companyId)); |
| | | JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); |
| | | map.put("timeOutCancel", jsonObject.getIntValue("driverTimeout")); |
| | | return map; |
| | | } |
| | | |
| | |
| | | list.addAll(list1); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取取消需要支付的金额 |
| | | * @param id |
| | | * @param language |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil<BaseWarpper> queryCancleAmount(Integer id, Integer language) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(id); |
| | | if(null == orderLogistics){ |
| | | return ResultUtil.error(language == 1 ? "获取数据失败,订单信息有误" : language == 2 ? "Failed to obtain data, order-information error." : "Impossible d’obtenir les données, erreur d’information de commande. "); |
| | | } |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | double amount = 0; |
| | | CancleOrder query = cancleOrderService.query(orderLogistics.getCompanyId()); |
| | | if(null == query || null == orderLogistics.getDriverId()){ |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | JSONObject object = JSON.parseObject(query.getContent()); |
| | | long t = object.getInteger("driverTimeout") * 60000L; |
| | | //司机超时未到达起点,免费取消 |
| | | if(orderLogistics.getState() < 3 && orderLogistics.getSnatchOrderTime().getTime() + t < System.currentTimeMillis()){ |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | | JSONObject order = object.getJSONObject("order"); |
| | | long m = order.getInteger("orderAcceptanceTime") * 60000L; |
| | | //超过免费时间,计算费用 |
| | | if(orderLogistics.getSnatchOrderTime().getTime() + m < System.currentTimeMillis()){ |
| | | BigDecimal money = order.getBigDecimal("money"); |
| | | if(null != orderLogistics.getSetOutTime()){ |
| | | //里程费 |
| | | BigDecimal mileageFee = order.getBigDecimal("mileageFee").multiply(new BigDecimal(orderLogistics.getMileage() / 1000)); |
| | | //时长费 |
| | | int s = Double.valueOf((System.currentTimeMillis() - orderLogistics.getSetOutTime().getTime()) / 60000).intValue(); |
| | | BigDecimal durationFee = order.getBigDecimal("durationFee").multiply(new BigDecimal(s)); |
| | | money = money.add(durationFee).add(mileageFee); |
| | | } |
| | | amount = money.setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | } |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除定时任务 |
| | | * @param orderId |
| | | */ |
| | | @Override |
| | | public void deleteTask(Integer orderId){ |
| | | //发送验证码短信 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("orderId", orderId + ""); |
| | | params.add("orderType", "4"); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://driver-server/base/netty/deleteTask", requestEntity, String.class); |
| | | JSONObject jsonObject = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject.getIntValue("code") != 200){ |
| | | System.err.println("调用driver-server出错了"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取消订单操作 |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil cancleOrderPrivateCar(Integer id, Integer payType, Integer bankCardId, Integer cancleId, Integer type, Integer language) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(id); |
| | | Integer uid = orderLogistics.getUserId(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(""); |
| | | |
| | | if(null == orderLogistics){ |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,订单信息有误" : language == 2 ? "Failed to cancel order, order-information error." : "Échec de l’annulation de la commande, erreur d’information de commande.", ""); |
| | | } |
| | | if(orderLogistics.getState() != 13){ |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Failed to cancel order, illegal operation." : "Échec de l’annulation de la commande, opération illégale.", ""); |
| | | } |
| | | OrderCancel orderCancel = null; |
| | | if(null == cancleId || cancleId==0){ |
| | | orderCancel = orderCancelService.query(id, 4, null, null, 1); |
| | | }else{ |
| | | orderCancel = orderCancelService.selectById(cancleId); |
| | | } |
| | | |
| | | Double amount = queryCancleAmount(id, language).getData().getAmount(); |
| | | if(0 < amount){ |
| | | if(payType == 1){//手机支付 |
| | | orderCancel.setPayType(1); |
| | | orderCancelService.updateById(orderCancel); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + "4" + language + id; |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(userInfo.getPhone())); |
| | | checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | checkoutRequest.setAccountNumber(userInfo.getPhone()); |
| | | checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(userInfo.getLastName()); |
| | | checkoutRequest.setRequestAmount(amount); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Cancel a trip"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxCancelOrderTaxi"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("http://182.160.16.251:81/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html"); |
| | | resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, id, 4, 1, amount, null, 1);//添加预支付数据 |
| | | } |
| | | |
| | | } |
| | | if(payType == 2){//银行卡支付 |
| | | orderCancel.setPayType(2); |
| | | orderCancelService.updateById(orderCancel); |
| | | BankCard bankCard = bankCardService.selectById(bankCardId); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + "4" + id; |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(bankCard.getCode())); |
| | | checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | checkoutRequest.setAccountNumber(bankCard.getCode()); |
| | | checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(bankCard.getLastName()); |
| | | checkoutRequest.setRequestAmount(amount); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Cancel a trip"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxCancelOrderTaxi"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("http://182.160.16.251:81/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html"); |
| | | resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, id, 4, 2, amount, null, 1);//添加预支付数据 |
| | | } |
| | | |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() != null && userInfo.getBalance() < amount){ |
| | | return ResultUtil.error((language == 1 ? "账户余额不足" : language == 2 ? "Insufficient balance" : "Solde insuffisant"), ""); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "取消订单", amount, 2, 1, 1, 4, id); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | //解除小号绑定 |
| | | if(orderLogistics.getBindId() != null){ |
| | | ChinaMobileUtil.midAxbUnBindSend(orderLogistics.getBindId(),orderLogistics.getTelX()); |
| | | } |
| | | |
| | | if(5 == orderLogistics.getOldState()){ |
| | | orderLogistics.setState(6); |
| | | }else{ |
| | | orderLogistics.setState(10); |
| | | } |
| | | orderLogistics.setTelX(""); |
| | | orderLogistics.setBindId(""); |
| | | this.updateById(orderLogistics); |
| | | |
| | | orderCancel.setState(2); |
| | | orderCancel.setPayType(3); |
| | | orderCancelService.updateById(orderCancel); |
| | | |
| | | if(null != orderLogistics.getDriverId()){ |
| | | BigDecimal c =new BigDecimal(amount);//司机收入 |
| | | incomeService.saveData(2, orderLogistics.getDriverId(), 3, orderLogistics.getId(), 4, c.doubleValue()); |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | |
| | | this.deleteTask(id);//删除定时任务 |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0); |
| | | } |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0); |
| | | |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已使用余额成功支付取消订单费用,谢谢使用!" : language == 2 |
| | | ? "You've paid for cancellation fee with the balance successfully, thank you for using I-GO" |
| | | : "Vous avez utilisé avec succès votre solde pour payer les frais d’annulation, merci d’utiliser I-GO", orderLogistics.getUserId(), 1); |
| | | } |
| | | } |
| | | return resultUtil; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取消订单支付后的处理 |
| | | * @param id 订单=id |
| | | * @param order_id 工行支付单号 |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void payCancelOrderPrivateCar(Integer id, String order_id, Integer language) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(id); |
| | | PaymentRecord query = paymentRecordService.query(1, null, null, Integer.valueOf(id), 4, null, 1); |
| | | if(null != query){ |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "取消订单", query.getAmount(), 2, 1, 1, 4, query.getOrderId()); |
| | | |
| | | //解除小号绑定 |
| | | if(orderLogistics.getBindId() != null){ |
| | | ChinaMobileUtil.midAxbUnBindSend(orderLogistics.getBindId(),orderLogistics.getTelX()); |
| | | } |
| | | if(5 == orderLogistics.getOldState()){ |
| | | orderLogistics.setState(6); |
| | | }else{ |
| | | orderLogistics.setState(10); |
| | | } |
| | | orderLogistics.setBindId(""); |
| | | orderLogistics.setTelX(""); |
| | | this.updateById(orderLogistics); |
| | | |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | | |
| | | OrderCancel query1 = orderCancelService.query(query.getOrderId(), query.getOrderType(), query.getAmount(), query.getPayType(), 1); |
| | | if (null != query1){ |
| | | query1.setState(2); |
| | | orderCancelService.updateById(query1); |
| | | } |
| | | |
| | | |
| | | if(null != orderLogistics.getDriverId()){ |
| | | BigDecimal c =new BigDecimal(query.getAmount());//司机收入 |
| | | incomeService.saveData(2, orderLogistics.getDriverId(), 3, orderLogistics.getId(), 4, c.doubleValue()); |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | this.deleteTask(orderLogistics.getId());//删除定时任务 |
| | | |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0); |
| | | } |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已使用余额成功支付取消订单费用,谢谢使用!" : language == 2 |
| | | ? "You've paid for cancellation fee with the balance successfully, thank you for using I-GO" |
| | | : "Vous avez utilisé avec succès votre solde pour payer les frais d’annulation, merci d’utiliser I-GO", orderLogistics.getUserId(), 1); |
| | | }else{ |
| | | System.err.println("预支付数据异常(orderId = " + id + ")"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改目的地 |
| | | * @param orderId |
| | | * @param endLon |
| | | * @param endLat |
| | | * @param endAddress |
| | | */ |
| | | @Override |
| | | public void updateEndAddress(Integer orderId, String endLon, String endLat, String endAddress) { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | if(null != orderLogistics.getDriverId()){ |
| | | orderLogistics.setDestination(endAddress); |
| | | orderLogistics.setDestinationLat(endLat); |
| | | orderLogistics.setDestinationLon(endLon); |
| | | this.updateById(orderLogistics); |
| | | pushUtil.pushModifyAddress(2, orderLogistics.getDriverId(), orderId, 1, 1); |
| | | }else{ |
| | | orderLogistics.setEndAddress(endAddress); |
| | | orderLogistics.setEndLat(Double.valueOf(endLat)); |
| | | orderLogistics.setEndLon(Double.valueOf(endLon)); |
| | | this.updateById(orderLogistics); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public synchronized ResultUtil<BaseWarpper> queryRedMoney(Integer orderId) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | Integer companyId = orderLogistics.getCompanyId(); |
| | | |
| | | Map<String, Object> query = userActivityRedenvelopeService.query(companyId, orderLogistics.getTravelTime()); |
| | | Double money = 0D; |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | if(null != query){ |
| | | Integer type = Integer.valueOf(String.valueOf(query.get("type"))); |
| | | if(type == 1){//固定金额 |
| | | money = Double.valueOf(String.valueOf(query.get("money"))); |
| | | }else{//随机金额 |
| | | Double startMoney = Double.valueOf(String.valueOf(query.get("startMoney"))); |
| | | Double endMoney = Double.valueOf(String.valueOf(query.get("endMoney"))); |
| | | money = new BigDecimal(startMoney + (Math.random() * (endMoney - startMoney))).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | //判断当前红包是否大于剩余可领取总金额 |
| | | if(money.compareTo(Double.valueOf(query.get("lavePrice").toString())) > 0){ |
| | | baseWarpper.setAmount(0D); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | } |
| | | |
| | | baseWarpper.setAmount(money); |
| | | |
| | | if(money > 0){ |
| | | //添加临时红包数据 |
| | | UserRedPacketRecord userRedPacketRecord = new UserRedPacketRecord(); |
| | | userRedPacketRecord.setMoney(money); |
| | | userRedPacketRecord.setRemainingAmount(money); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) + Integer.valueOf(String.valueOf(query.get("effective")))); |
| | | userRedPacketRecord.setInsertTime(new Date()); |
| | | userRedPacketRecord.setCompanyId(Integer.valueOf(String.valueOf(query.get("companyId")))); |
| | | userRedPacketRecord.setState(0); |
| | | userRedPacketRecord.setOrderId(orderLogistics.getId()); |
| | | userRedPacketRecord.setOrderType(4); |
| | | userRedPacketRecord.setUserId(orderLogistics.getUserId()); |
| | | userRedPacketRecordService.insert(userRedPacketRecord); |
| | | } |
| | | |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public synchronized ResultUtil shareRedEnvelope(Integer orderId, Integer language) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | UserRedPacketRecord query = userRedPacketRecordService.query_(orderLogistics.getUserId(), orderLogistics.getCompanyId(), 0, 4, null); |
| | | if(null != query){ |
| | | Double money = query.getMoney(); |
| | | Map<String, Object> map = userActivityRedenvelopeService.query(orderLogistics.getCompanyId(), orderLogistics.getTravelTime()); |
| | | Double laveMoney = Double.valueOf(String.valueOf(map.get("laveMoney"))); |
| | | if(money.compareTo(laveMoney) > 0){ |
| | | return ResultUtil.error(language == 1 ? "手速太慢了,红包已派发完啦!" : language == 2 ? "Too slow, all the lucky-promo has been distributed!" : "Trop lent, toute la promo chanceuse a été distribuée !"); |
| | | } |
| | | //判断当前红包是否大于剩余可领取总金额 |
| | | if(money.compareTo(Double.valueOf(map.get("lavePrice").toString())) > 0){ |
| | | return ResultUtil.error(language == 1 ? "手速太慢了,红包已派发完啦!" : language == 2 ? "Too slow, all the lucky-promo has been distributed!" : "Trop lent, toute la promo chanceuse a été distribuée !"); |
| | | } |
| | | double v = new BigDecimal(laveMoney).subtract(new BigDecimal(money)).doubleValue(); |
| | | |
| | | UserActivityRedenvelope id = userActivityRedenvelopeService.selectById(String.valueOf(map.get("id"))); |
| | | id.setLaveMoney(v); |
| | | id.setLavePrice(new BigDecimal(id.getLavePrice() - money).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | userActivityRedenvelopeService.updateById(id); |
| | | |
| | | query.setState(1); |
| | | query.setRedPacketActivityId(id.getId()); |
| | | userRedPacketRecordService.updateById(query); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/redEnvelopes.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | if(1 == language){ |
| | | document.getElementById("english").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("红包活动"); |
| | | Element user_chinese = document.getElementById("user_chinese"); |
| | | user_chinese.text("您好 " + userInfo.getNickName() + ","); |
| | | Element time_chinese = document.getElementById("time_chinese"); |
| | | time_chinese.text("此活动有效期在 " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " 至 " + DateUtil.conversionFormat(language, sdf.format(id.getEnable())) + ",详情请查看I-GO平台"); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("Lucky-promo activities"); |
| | | Element user_english = document.getElementById("user_english"); |
| | | user_english.text("Hello " + userInfo.getNickName() + ","); |
| | | Element time_english = document.getElementById("time_english"); |
| | | time_english.text("You could use it from " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " to " + DateUtil.conversionFormat(language, sdf.format(id.getEnable())) + ",check more details on the app."); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("english").remove(); |
| | | document.getElementsByTag("title").get(0).text("Activités bonus"); |
| | | Element user_french = document.getElementById("user_french"); |
| | | user_french.text("Bonjour " + userInfo.getNickName() + ","); |
| | | Element time_french = document.getElementById("time_french"); |
| | | time_french.text("Cette promotion est valable du " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " au " + DateUtil.conversionFormat(language, sdf.format(id.getEnable())) + ". Veuillez consulter la plateforme i-go pour plus de détails."); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "红包活动" : language == 2 ? "Lucky-promo activities" : "Activités bonus", document.html()); |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/redpacket_" + orderId + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/redpacket_" + orderId + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(userInfo.getId()); |
| | | tEmail.setType(1); |
| | | tEmail.setName(language == 1 ? "红包活动" : language == 2 ? "Lucky-promo activities" : "Activités bonus"); |
| | | tEmail.setOrderId(orderId); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | tEmail.setWeek(EmailUtil.getWeek(language,i)); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | |
| | | } |
| | | |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取红包使用记录 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryRedEnvelope(Integer language, Integer uid) throws Exception { |
| | | List<Map<String, Object>> list = this.baseMapper.queryRedEnvelope(uid); |
| | | for (Map<String, Object> map : list) { |
| | | map.put("name", language == 1 ? "包裹" : language == 2 ? "Delivery" : "Livraison"); |
| | | if(null != map.get("time")){ |
| | | String time = map.get("time").toString(); |
| | | map.put("time", DateUtil.conversionFormat(language, time)); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 分享成功后添加红包操作 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/orderPrivateCar/updateEndAddress") |
| | | @ApiOperation(value = "修改目的地", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "终点经度", name = "endLon", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "终点纬度", name = "endLat", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "终点地址", name = "endAddress", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil updateEndAddress(Integer orderId, String endLon, String endLat, String endAddress, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | orderPrivateCar.setEndAddress(endAddress); |
| | | orderPrivateCar.setEndLat(Double.valueOf(endLat)); |
| | | orderPrivateCar.setEndLon(Double.valueOf(endLon)); |
| | | orderPrivateCarService.updateById(orderPrivateCar); |
| | | //推送 |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, 15, 1); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | List<OrderPrivateCar> queryByState(@Param("uid") Integer uid, @Param("orderType") Integer orderType, |
| | | @Param("type") Integer type, @Param("state") Integer...state) throws Exception; |
| | | @Param("type") Integer type, @Param("state") Integer...state) ; |
| | | |
| | | |
| | | |
| | |
| | | oldState as oldState, |
| | | telX as telX, |
| | | bindId as bindId |
| | | from t_order_private_car where isDelete = 1 and userId = #{uid} |
| | | from t_order_private_car where isDelete = 1 and isFrozen = 1 and userId = #{uid} |
| | | <if test="null != orderType"> |
| | | and orderType = #{orderType} |
| | | </if> |
| | |
| | | isDelete as isDelete, |
| | | oldState as oldState, |
| | | telX as telX, |
| | | bindId as bindId |
| | | bindId as bindId, |
| | | tripId |
| | | from t_order_private_car where isDelete = 1 and userId = #{uid} |
| | | <if test="null != state"> |
| | | and state in |
| | |
| | | driverId as driverId, |
| | | (1) as orderType, |
| | | state as state, |
| | | oldState as oldState |
| | | oldState as oldState, |
| | | isFrozen, |
| | | cancelMidway, |
| | | tripId |
| | | from t_order_private_car where userId = #{uid} and isDelete = 1 order by insertTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | |
| | | h.money as cancelMoney, |
| | | h.reason as cancelReason, |
| | | h.remark as cancelRemark, |
| | | a.isFree,a.moneyType,a.moneyTime |
| | | a.isFree, |
| | | a.moneyType, |
| | | a.moneyTime, |
| | | a.isFrozen, |
| | | a.tripId, |
| | | DATE_FORMAT(a.snatchOrderTime, '%Y-%m-%d %H:%i:%s') as snatchOrderTime |
| | | 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) |
| | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | |
| | | /** |
| | | * 专车车订单 |
| | | */ |
| | | @Data |
| | | @TableName("t_order_private_car") |
| | | public class OrderPrivateCar { |
| | | /** |
| | |
| | | * 红包id |
| | | */ |
| | | @TableField("redPacketId") |
| | | private Integer redPacketId; |
| | | private String redPacketId; |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | |
| | | */ |
| | | @TableField("driverPay") |
| | | private Integer driverPay; |
| | | |
| | | public Integer getIsplatPay() { |
| | | return isplatPay; |
| | | } |
| | | |
| | | public void setIsplatPay(Integer isplatPay) { |
| | | this.isplatPay = isplatPay; |
| | | } |
| | | |
| | | public BigDecimal getFreeMoney() { |
| | | return freeMoney; |
| | | } |
| | | public void setFreeMoney(BigDecimal freeMoney) { |
| | | this.freeMoney = freeMoney; |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getCrossCityOrderId() { |
| | | return crossCityOrderId; |
| | | } |
| | | |
| | | public void setCrossCityOrderId(Integer crossCityOrderId) { |
| | | this.crossCityOrderId = crossCityOrderId; |
| | | } |
| | | |
| | | public Integer getPlace() { |
| | | return place; |
| | | } |
| | | |
| | | public void setPlace(Integer place) { |
| | | this.place = place; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Integer getServerCarModelId() { |
| | | return serverCarModelId; |
| | | } |
| | | |
| | | public void setServerCarModelId(Integer serverCarModelId) { |
| | | this.serverCarModelId = serverCarModelId; |
| | | } |
| | | |
| | | public Integer getDriverId() { |
| | | return driverId; |
| | | } |
| | | |
| | | public void setDriverId(Integer driverId) { |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public Integer getCarId() { |
| | | return carId; |
| | | } |
| | | |
| | | public void setCarId(Integer carId) { |
| | | this.carId = carId; |
| | | } |
| | | |
| | | public String getOrderNum() { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(String orderNum) { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | public Double getPlacementLon() { |
| | | return placementLon; |
| | | } |
| | | |
| | | public void setPlacementLon(Double placementLon) { |
| | | this.placementLon = placementLon; |
| | | } |
| | | |
| | | public Double getPlacementLat() { |
| | | return placementLat; |
| | | } |
| | | |
| | | public void setPlacementLat(Double placementLat) { |
| | | this.placementLat = placementLat; |
| | | } |
| | | |
| | | public String getPlacementAddress() { |
| | | return placementAddress; |
| | | } |
| | | |
| | | public void setPlacementAddress(String placementAddress) { |
| | | this.placementAddress = placementAddress; |
| | | } |
| | | |
| | | public Double getStartLon() { |
| | | return startLon; |
| | | } |
| | | |
| | | public void setStartLon(Double startLon) { |
| | | this.startLon = startLon; |
| | | } |
| | | |
| | | public Double getStartLat() { |
| | | return startLat; |
| | | } |
| | | |
| | | public void setStartLat(Double startLat) { |
| | | this.startLat = startLat; |
| | | } |
| | | |
| | | public String getStartAddress() { |
| | | return startAddress; |
| | | } |
| | | |
| | | public void setStartAddress(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | public Double getEndLon() { |
| | | return endLon; |
| | | } |
| | | |
| | | public void setEndLon(Double endLon) { |
| | | this.endLon = endLon; |
| | | } |
| | | |
| | | public Double getEndLat() { |
| | | return endLat; |
| | | } |
| | | |
| | | public void setEndLat(Double endLat) { |
| | | this.endLat = endLat; |
| | | } |
| | | |
| | | public String getEndAddress() { |
| | | return endAddress; |
| | | } |
| | | |
| | | public void setEndAddress(String endAddress) { |
| | | this.endAddress = endAddress; |
| | | } |
| | | |
| | | public Double getBoardingLon() { |
| | | return boardingLon; |
| | | } |
| | | |
| | | public void setBoardingLon(Double boardingLon) { |
| | | this.boardingLon = boardingLon; |
| | | } |
| | | |
| | | public Double getBoardingLat() { |
| | | return boardingLat; |
| | | } |
| | | |
| | | public void setBoardingLat(Double boardingLat) { |
| | | this.boardingLat = boardingLat; |
| | | } |
| | | |
| | | public String getBoardingAddress() { |
| | | return boardingAddress; |
| | | } |
| | | |
| | | public void setBoardingAddress(String boardingAddress) { |
| | | this.boardingAddress = boardingAddress; |
| | | } |
| | | |
| | | public Date getBoardingTime() { |
| | | return boardingTime; |
| | | } |
| | | |
| | | public void setBoardingTime(Date boardingTime) { |
| | | this.boardingTime = boardingTime; |
| | | } |
| | | |
| | | public Double getGetoffLon() { |
| | | return getoffLon; |
| | | } |
| | | |
| | | public void setGetoffLon(Double getoffLon) { |
| | | this.getoffLon = getoffLon; |
| | | } |
| | | |
| | | public Double getGetoffLat() { |
| | | return getoffLat; |
| | | } |
| | | |
| | | public void setGetoffLat(Double getoffLat) { |
| | | this.getoffLat = getoffLat; |
| | | } |
| | | |
| | | public String getGetoffAddress() { |
| | | return getoffAddress; |
| | | } |
| | | |
| | | public void setGetoffAddress(String getoffAddress) { |
| | | this.getoffAddress = getoffAddress; |
| | | } |
| | | |
| | | public Date getGetoffTime() { |
| | | return getoffTime; |
| | | } |
| | | |
| | | public void setGetoffTime(Date getoffTime) { |
| | | this.getoffTime = getoffTime; |
| | | } |
| | | |
| | | public Double getMileage() { |
| | | return mileage; |
| | | } |
| | | |
| | | public void setMileage(Double mileage) { |
| | | this.mileage = mileage; |
| | | } |
| | | |
| | | public Integer getPayManner() { |
| | | return payManner; |
| | | } |
| | | |
| | | public void setPayManner(Integer payManner) { |
| | | this.payManner = payManner; |
| | | } |
| | | |
| | | public Integer getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public void setPayType(Integer payType) { |
| | | this.payType = payType; |
| | | } |
| | | |
| | | public Double getOrderMoney() { |
| | | return orderMoney; |
| | | } |
| | | |
| | | public void setOrderMoney(Double orderMoney) { |
| | | this.orderMoney = orderMoney; |
| | | } |
| | | |
| | | public Double getStartMileage() { |
| | | return startMileage; |
| | | } |
| | | |
| | | public void setStartMileage(Double startMileage) { |
| | | this.startMileage = startMileage; |
| | | } |
| | | |
| | | public Double getStartMoney() { |
| | | return startMoney; |
| | | } |
| | | |
| | | public void setStartMoney(Double startMoney) { |
| | | this.startMoney = startMoney; |
| | | } |
| | | |
| | | public Double getMileageKilometers() { |
| | | return mileageKilometers; |
| | | } |
| | | |
| | | public void setMileageKilometers(Double mileageKilometers) { |
| | | this.mileageKilometers = mileageKilometers; |
| | | } |
| | | |
| | | public Double getMileageMoney() { |
| | | return mileageMoney; |
| | | } |
| | | |
| | | public void setMileageMoney(Double mileageMoney) { |
| | | this.mileageMoney = mileageMoney; |
| | | } |
| | | |
| | | public Double getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(Double duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public Double getDurationMoney() { |
| | | return durationMoney; |
| | | } |
| | | |
| | | public void setDurationMoney(Double durationMoney) { |
| | | this.durationMoney = durationMoney; |
| | | } |
| | | |
| | | public Double getWait() { |
| | | return wait; |
| | | } |
| | | |
| | | public void setWait(Double wait) { |
| | | this.wait = wait; |
| | | } |
| | | |
| | | public Double getWaitMoney() { |
| | | return waitMoney; |
| | | } |
| | | |
| | | public void setWaitMoney(Double waitMoney) { |
| | | this.waitMoney = waitMoney; |
| | | } |
| | | |
| | | public Double getLongDistance() { |
| | | return longDistance; |
| | | } |
| | | |
| | | public void setLongDistance(Double longDistance) { |
| | | this.longDistance = longDistance; |
| | | } |
| | | |
| | | public Double getLongDistanceMoney() { |
| | | return longDistanceMoney; |
| | | } |
| | | |
| | | public void setLongDistanceMoney(Double longDistanceMoney) { |
| | | this.longDistanceMoney = longDistanceMoney; |
| | | } |
| | | |
| | | public Double getParkMoney() { |
| | | return parkMoney; |
| | | } |
| | | |
| | | public void setParkMoney(Double parkMoney) { |
| | | this.parkMoney = parkMoney; |
| | | } |
| | | |
| | | public Double getRoadTollMoney() { |
| | | return roadTollMoney; |
| | | } |
| | | |
| | | public void setRoadTollMoney(Double roadTollMoney) { |
| | | this.roadTollMoney = roadTollMoney; |
| | | } |
| | | |
| | | public Double getRedPacketMoney() { |
| | | return redPacketMoney; |
| | | } |
| | | |
| | | public void setRedPacketMoney(Double redPacketMoney) { |
| | | this.redPacketMoney = redPacketMoney; |
| | | } |
| | | |
| | | public Double getCouponMoney() { |
| | | return couponMoney; |
| | | } |
| | | |
| | | public void setCouponMoney(Double couponMoney) { |
| | | this.couponMoney = couponMoney; |
| | | } |
| | | |
| | | public Integer getRedPacketId() { |
| | | return redPacketId; |
| | | } |
| | | |
| | | public void setRedPacketId(Integer redPacketId) { |
| | | this.redPacketId = redPacketId; |
| | | } |
| | | |
| | | public Integer getCouponId() { |
| | | return couponId; |
| | | } |
| | | |
| | | public void setCouponId(Integer couponId) { |
| | | this.couponId = couponId; |
| | | } |
| | | |
| | | public Double getDiscount() { |
| | | return discount; |
| | | } |
| | | |
| | | public void setDiscount(Double discount) { |
| | | this.discount = discount; |
| | | } |
| | | |
| | | public Double getDiscountMoney() { |
| | | return discountMoney; |
| | | } |
| | | |
| | | public void setDiscountMoney(Double discountMoney) { |
| | | this.discountMoney = discountMoney; |
| | | } |
| | | |
| | | public Integer getActivityId() { |
| | | return activityId; |
| | | } |
| | | |
| | | public void setActivityId(Integer activityId) { |
| | | this.activityId = activityId; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Double getPayMoney() { |
| | | return payMoney; |
| | | } |
| | | |
| | | public void setPayMoney(Double payMoney) { |
| | | this.payMoney = payMoney; |
| | | } |
| | | |
| | | public Integer getSubstitute() { |
| | | return substitute; |
| | | } |
| | | |
| | | public void setSubstitute(Integer substitute) { |
| | | this.substitute = substitute; |
| | | } |
| | | |
| | | public String getPassengers() { |
| | | return passengers; |
| | | } |
| | | |
| | | public void setPassengers(String passengers) { |
| | | this.passengers = passengers; |
| | | } |
| | | |
| | | public String getPassengersPhone() { |
| | | return passengersPhone; |
| | | } |
| | | |
| | | public void setPassengersPhone(String passengersPhone) { |
| | | this.passengersPhone = passengersPhone; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Date getTravelTime() { |
| | | return travelTime; |
| | | } |
| | | |
| | | public void setTravelTime(Date travelTime) { |
| | | this.travelTime = travelTime; |
| | | } |
| | | |
| | | public Date getSnatchOrderTime() { |
| | | return snatchOrderTime; |
| | | } |
| | | |
| | | public void setSnatchOrderTime(Date snatchOrderTime) { |
| | | this.snatchOrderTime = snatchOrderTime; |
| | | } |
| | | |
| | | public Date getSetOutTime() { |
| | | return setOutTime; |
| | | } |
| | | |
| | | public void setSetOutTime(Date setOutTime) { |
| | | this.setOutTime = setOutTime; |
| | | } |
| | | |
| | | public Date getArriveTime() { |
| | | return arriveTime; |
| | | } |
| | | |
| | | public void setArriveTime(Date arriveTime) { |
| | | this.arriveTime = arriveTime; |
| | | } |
| | | |
| | | public Date getStartServiceTime() { |
| | | return startServiceTime; |
| | | } |
| | | |
| | | public void setStartServiceTime(Date startServiceTime) { |
| | | this.startServiceTime = startServiceTime; |
| | | } |
| | | |
| | | public Date getEndServiceTime() { |
| | | return endServiceTime; |
| | | } |
| | | |
| | | public void setEndServiceTime(Date endServiceTime) { |
| | | this.endServiceTime = endServiceTime; |
| | | } |
| | | |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | |
| | | public Integer getOrderSource() { |
| | | return orderSource; |
| | | } |
| | | |
| | | public void setOrderSource(Integer orderSource) { |
| | | this.orderSource = orderSource; |
| | | } |
| | | |
| | | public Integer getInvoiceId() { |
| | | return invoiceId; |
| | | } |
| | | |
| | | public void setInvoiceId(Integer invoiceId) { |
| | | this.invoiceId = invoiceId; |
| | | } |
| | | |
| | | public Integer getIsReassign() { |
| | | return isReassign; |
| | | } |
| | | |
| | | public void setIsReassign(Integer isReassign) { |
| | | this.isReassign = isReassign; |
| | | } |
| | | |
| | | public Integer getReassignNotice() { |
| | | return reassignNotice; |
| | | } |
| | | |
| | | public void setReassignNotice(Integer reassignNotice) { |
| | | this.reassignNotice = reassignNotice; |
| | | } |
| | | |
| | | public String getTrackId() { |
| | | return trackId; |
| | | } |
| | | |
| | | public void setTrackId(String trackId) { |
| | | this.trackId = trackId; |
| | | } |
| | | |
| | | public Integer getIsDelete() { |
| | | return isDelete; |
| | | } |
| | | |
| | | public void setIsDelete(Integer isDelete) { |
| | | this.isDelete = isDelete; |
| | | } |
| | | |
| | | public Integer getOldState() { |
| | | return oldState; |
| | | } |
| | | |
| | | public void setOldState(Integer oldState) { |
| | | this.oldState = oldState; |
| | | } |
| | | |
| | | public String getTelX() { |
| | | return telX; |
| | | } |
| | | |
| | | public void setTelX(String telX) { |
| | | this.telX = telX; |
| | | } |
| | | |
| | | public String getBindId() { |
| | | return bindId; |
| | | } |
| | | |
| | | public void setBindId(String bindId) { |
| | | this.bindId = bindId; |
| | | } |
| | | |
| | | public Integer getDriverPay() { |
| | | return driverPay; |
| | | } |
| | | |
| | | public void setDriverPay(Integer driverPay) { |
| | | this.driverPay = driverPay; |
| | | } |
| | | /** |
| | | * 修改目的地经度 |
| | | */ |
| | | @TableField("destinationLon") |
| | | private String destinationLon; |
| | | /** |
| | | * 修改目的地纬度 |
| | | */ |
| | | @TableField("destinationLat") |
| | | private String destinationLat; |
| | | /** |
| | | * 修改目的地地址 |
| | | */ |
| | | @TableField("destination") |
| | | private String destination; |
| | | /** |
| | | * 中途取消(0=否,1=是) |
| | | */ |
| | | @TableField("cancelMidway") |
| | | private Integer cancelMidway; |
| | | /** |
| | | * google行程id |
| | | */ |
| | | @TableField("tripId") |
| | | private String tripId; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderPrivateCar{" + |
| | | "id=" + id + |
| | | ", type=" + type + |
| | | ", crossCityOrderId=" + crossCityOrderId + |
| | | ", place=" + place + |
| | | ", userId=" + userId + |
| | | ", serverCarModelId=" + serverCarModelId + |
| | | ", driverId=" + driverId + |
| | | ", carId=" + carId + |
| | | ", orderNum='" + orderNum + '\'' + |
| | | ", placementLon=" + placementLon + |
| | | ", placementLat=" + placementLat + |
| | | ", placementAddress='" + placementAddress + '\'' + |
| | | ", startLon=" + startLon + |
| | | ", startLat=" + startLat + |
| | | ", startAddress='" + startAddress + '\'' + |
| | | ", endLon=" + endLon + |
| | | ", endLat=" + endLat + |
| | | ", endAddress='" + endAddress + '\'' + |
| | | ", boardingLon=" + boardingLon + |
| | | ", boardingLat=" + boardingLat + |
| | | ", boardingAddress='" + boardingAddress + '\'' + |
| | | ", boardingTime=" + boardingTime + |
| | | ", getoffLon=" + getoffLon + |
| | | ", getoffLat=" + getoffLat + |
| | | ", getoffAddress='" + getoffAddress + '\'' + |
| | | ", getoffTime=" + getoffTime + |
| | | ", mileage=" + mileage + |
| | | ", payManner=" + payManner + |
| | | ", payType=" + payType + |
| | | ", orderMoney=" + orderMoney + |
| | | ", startMileage=" + startMileage + |
| | | ", startMoney=" + startMoney + |
| | | ", mileageKilometers=" + mileageKilometers + |
| | | ", mileageMoney=" + mileageMoney + |
| | | ", duration=" + duration + |
| | | ", durationMoney=" + durationMoney + |
| | | ", wait=" + wait + |
| | | ", waitMoney=" + waitMoney + |
| | | ", longDistance=" + longDistance + |
| | | ", longDistanceMoney=" + longDistanceMoney + |
| | | ", parkMoney=" + parkMoney + |
| | | ", roadTollMoney=" + roadTollMoney + |
| | | ", redPacketMoney=" + redPacketMoney + |
| | | ", couponMoney=" + couponMoney + |
| | | ", redPacketId=" + redPacketId + |
| | | ", couponId=" + couponId + |
| | | ", discount=" + discount + |
| | | ", discountMoney=" + discountMoney + |
| | | ", activityId=" + activityId + |
| | | ", companyId=" + companyId + |
| | | ", payMoney=" + payMoney + |
| | | ", substitute=" + substitute + |
| | | ", passengers='" + passengers + '\'' + |
| | | ", passengersPhone='" + passengersPhone + '\'' + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | ", travelTime=" + travelTime + |
| | | ", snatchOrderTime=" + snatchOrderTime + |
| | | ", setOutTime=" + setOutTime + |
| | | ", arriveTime=" + arriveTime + |
| | | ", startServiceTime=" + startServiceTime + |
| | | ", endServiceTime=" + endServiceTime + |
| | | ", orderType=" + orderType + |
| | | ", orderSource=" + orderSource + |
| | | ", invoiceId=" + invoiceId + |
| | | ", isReassign=" + isReassign + |
| | | ", reassignNotice=" + reassignNotice + |
| | | ", trackId='" + trackId + '\'' + |
| | | ", isDelete=" + isDelete + |
| | | ", oldState=" + oldState + |
| | | ", telX='" + telX + '\'' + |
| | | ", bindId='" + bindId + '\'' + |
| | | '}'; |
| | | } |
| | | } |
| | |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil addCancle(Integer id, String reason, String remark, Integer uid, Integer language) throws Exception; |
| | | ResultUtil addCancle(Integer id, String reason, String remark, Integer uid, Double lon, Double lat, String address, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil payPrivateCarOrder(Integer payType, Integer bankCardId, Integer orderId, Integer couponId, Integer type, Integer language)throws Exception; |
| | | ResultUtil payPrivateCarOrder(Integer payType, Integer bankCardId, Integer orderId, Integer couponId, Integer redDeduction, Integer type, Integer language)throws Exception; |
| | | |
| | | |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryRedEnvelope(Integer language, Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 修改目的地 |
| | | * @param orderId |
| | | * @param endLon |
| | | * @param endLat |
| | | * @param endAddress |
| | | */ |
| | | void updateEndAddress(Integer orderId, String endLon, String endLat, String endAddress); |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.ReverseGeocodeVo; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.TinggPayUtil; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Autowired |
| | | private IPhoneService phoneService; |
| | | |
| | | @Autowired |
| | | private IRedEnvelopePaymentSettingsService redEnvelopePaymentSettingsService; |
| | | |
| | | @Autowired |
| | | private FleetEngineUtil fleetEngineUtil; |
| | | |
| | | @Resource |
| | | private CarModelMapper carModelMapper; |
| | | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | orderPrivateCar.setIsReassign(1); |
| | | orderPrivateCar.setIsDelete(1); |
| | | orderPrivateCar.setTripId(UUIDUtil.getRandomCode()); |
| | | this.insert(orderPrivateCar); |
| | | |
| | | |
| | | String vehicleId = null; |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | Car car = carMapper.selectById(driver.getCarId()); |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carMapper.updateById(car); |
| | | } |
| | | //查询车辆信息,没有则创建信息 |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | |
| | | } |
| | | //创建行程数据 |
| | | fleetEngineUtil.createTrip(vehicleId, 1, orderPrivateCar.getTripId(), |
| | | orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(), orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString()); |
| | | |
| | | |
| | | if(orderSource == 2){//扫码下单 |
| | | new Thread(new Runnable() { |
| | |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, uid, orderPrivateCar.getId(), 1, 2, 0); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, 2, 0); |
| | | pushUtil.pushDriverPosition(orderPrivateCar.getId(), 1); |
| | | } |
| | | }).start(); |
| | | } |
| | |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, uid, orderPrivateCar.getId(), 1, 2, 0); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, 2, 0); |
| | | pushUtil.pushDriverPosition(orderPrivateCar.getId(), 1); |
| | | } |
| | | }).start(); |
| | | } |
| | |
| | | //推单操作 |
| | | if(orderPrivateCar.getState() == 1){ |
| | | this.pushOrder(orderPrivateCar); |
| | | }else{ |
| | | // //接单后定时任务判断司机是否去接乘客,没有则推送提醒 |
| | | // CancleOrder cancleOrder = cancleOrderService.query(orderPrivateCar.getCompanyId()); |
| | | // if(null != cancleOrder){ |
| | | // JSONObject object = JSON.parseObject(cancleOrder.getContent()); |
| | | // long time = object.getInteger("driverTimeout") * 60000L; |
| | | // new Timer().schedule(new TimerTask() { |
| | | // @Override |
| | | // public void run() { |
| | | // OrderPrivateCar orderPrivateCar1 = OrderPrivateCarServiceImpl.this.selectById(orderPrivateCar.getId()); |
| | | // if(orderPrivateCar1.getState() == 2){ |
| | | // pushUtil.pushDriverTimeOut(1, orderPrivateCar1.getUserId(), orderPrivateCar1.getId(), 1); |
| | | // } |
| | | // } |
| | | // }, time); |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setState(orderPrivateCar.getState()); |
| | | baseWarpper.setId(orderPrivateCar.getId()); |
| | | baseWarpper.setContent(orderPrivateCar.getTripId()); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | /** |
| | | * 获取取消需要支付的金额 |
| | | * @param id |
| | | * @param language |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil<BaseWarpper> queryCancleAmount(Integer id, Integer language) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(id); |
| | | if(null == orderPrivateCar){ |
| | | return ResultUtil.error(language == 1 ? "获取数据失败,订单信息有误" : language == 2 ? "Failed to obtain data, order-information error." : "Impossible d’obtenir les données, erreur d’information de commande. "); |
| | | } |
| | | double amount = 0; |
| | | CancleOrder query = cancleOrderService.query(orderPrivateCar.getOrderType(), 1, orderPrivateCar.getCompanyId()); |
| | | if(null != orderPrivateCar.getDriverId() && orderPrivateCar.getSnatchOrderTime()!=null && |
| | | (orderPrivateCar.getSnatchOrderTime().getTime() + query.getMinuteNum() * 60 * 1000) < new Date().getTime()){//收费的情况 |
| | | if(null != query){ |
| | | amount += query.getMoney(); |
| | | } |
| | | } |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | double amount = 0; |
| | | CancleOrder query = cancleOrderService.query(orderPrivateCar.getCompanyId()); |
| | | if(null == query || null == orderPrivateCar.getDriverId()){ |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | JSONObject object = JSON.parseObject(query.getContent()); |
| | | long t = object.getInteger("driverTimeout") * 60000L; |
| | | //司机超时未到达起点,免费取消 |
| | | if(orderPrivateCar.getState() < 3 && orderPrivateCar.getSnatchOrderTime().getTime() + t < System.currentTimeMillis()){ |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | //普通单 |
| | | if(1 == orderPrivateCar.getOrderType()){ |
| | | JSONObject order = object.getJSONObject("order"); |
| | | long m = order.getInteger("orderAcceptanceTime") * 60000L; |
| | | //超过免费时间,计算费用 |
| | | if(orderPrivateCar.getSnatchOrderTime().getTime() + m < System.currentTimeMillis()){ |
| | | BigDecimal money = order.getBigDecimal("money"); |
| | | if(null != orderPrivateCar.getSetOutTime()){ |
| | | //里程费 |
| | | BigDecimal mileageFee = order.getBigDecimal("mileageFee").multiply(new BigDecimal(orderPrivateCar.getMileage() / 1000)); |
| | | //时长费 |
| | | int s = Double.valueOf((System.currentTimeMillis() - orderPrivateCar.getSetOutTime().getTime()) / 60000).intValue(); |
| | | BigDecimal durationFee = order.getBigDecimal("durationFee").multiply(new BigDecimal(s)); |
| | | money = money.add(durationFee).add(mileageFee); |
| | | } |
| | | amount = money.setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | } |
| | | } |
| | | //预约单 |
| | | if(2 == orderPrivateCar.getOrderType()){ |
| | | JSONObject order = object.getJSONObject("reservationOrder"); |
| | | long m = order.getInteger("orderAcceptanceTime") * 60000L; |
| | | //超过免费时间,计算费用 |
| | | if(System.currentTimeMillis() + m > orderPrivateCar.getTravelTime().getTime()){ |
| | | BigDecimal money = order.getBigDecimal("money"); |
| | | if(null != orderPrivateCar.getSetOutTime()){ |
| | | //里程费 |
| | | BigDecimal mileageFee = order.getBigDecimal("mileageFee").multiply(new BigDecimal(orderPrivateCar.getMileage() / 1000)); |
| | | //时长费 |
| | | int s = Double.valueOf((System.currentTimeMillis() - orderPrivateCar.getSetOutTime().getTime()) / 60000).intValue(); |
| | | BigDecimal durationFee = order.getBigDecimal("durationFee").multiply(new BigDecimal(s)); |
| | | //预定费用 |
| | | BigDecimal reservationFee = order.getBigDecimal("reservationFee"); |
| | | money = money.add(durationFee).add(mileageFee).add(reservationFee); |
| | | } |
| | | amount = money.setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | } |
| | | } |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加取消操作 |
| | | * @param id |
| | | * @param reason |
| | | * @param remark |
| | | * @param uid |
| | | * @param language |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil addCancle(Integer id, String reason, String remark, Integer uid, Integer language) throws Exception { |
| | | public ResultUtil addCancle(Integer id, String reason, String remark, Integer uid, Double lon, Double lat, String address, Integer language) throws Exception { |
| | | if(ToolUtil.isNotEmpty(remark)){ |
| | | if(ToolUtil.isNotEmpty(remark)){ |
| | | List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null); |
| | |
| | | if(orderPrivateCar.getState() > 5 && orderPrivateCar.getState() != 11){ |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Failed to cancel order, illegal operation." : "Échec de l’annulation de la commande, opération illégale."); |
| | | } |
| | | |
| | | //服务中也可以取消订单,所以取消订单时需要计算订单费用 |
| | | if(null == orderPrivateCar.getDriverId()){//没有接单的情况 |
| | | if(orderPrivateCar.getType() == 2){//摆渡车 |
| | | OrderCrossCityServiceImpl.pushEndMap.remove(orderPrivateCar.getCrossCityOrderId());//删除标识数据 |
| | |
| | | this.updateById(orderPrivateCar); |
| | | } |
| | | }else { |
| | | CancleOrder query = cancleOrderService.query(orderPrivateCar.getOrderType(), 1, orderPrivateCar.getCompanyId()); |
| | | if (null != query) { |
| | | if ((orderPrivateCar.getSnatchOrderTime().getTime() + query.getMinuteNum() * 60 * 1000) < System.currentTimeMillis() && query.getMoney().compareTo(0D) > 0) {//收费的情况 |
| | | BaseWarpper data = queryCancleAmount(id, language).getData(); |
| | | Double amount = data.getAmount(); |
| | | if(0 == amount){ |
| | | integer = orderCancelService.saveData(id, 1, reason, remark, null, null, 2, 1, uid); |
| | | if(5 == orderPrivateCar.getState()){ |
| | | orderPrivateCar.setState(6); |
| | | orderPrivateCar.setGetoffLon(lon); |
| | | orderPrivateCar.setGetoffLat(lat); |
| | | orderPrivateCar.setGetoffAddress(address); |
| | | orderPrivateCar.setGetoffTime(new Date()); |
| | | orderPrivateCar.setEndServiceTime(new Date()); |
| | | orderPrivateCar.setCancelMidway(1); |
| | | }else{ |
| | | orderPrivateCar.setState(10); |
| | | } |
| | | this.updateById(orderPrivateCar); |
| | | }else{ |
| | | if(5 == orderPrivateCar.getState()){ |
| | | orderPrivateCar.setGetoffLon(lon); |
| | | orderPrivateCar.setGetoffLat(lat); |
| | | orderPrivateCar.setGetoffAddress(address); |
| | | orderPrivateCar.setGetoffTime(new Date()); |
| | | orderPrivateCar.setEndServiceTime(new Date()); |
| | | orderPrivateCar.setCancelMidway(1); |
| | | } |
| | | orderPrivateCar.setOldState(6); |
| | | orderPrivateCar.setState(12); |
| | | this.updateById(orderPrivateCar); |
| | | integer = orderCancelService.saveData(id, 1, reason, remark, null, query.getMoney(), 1, 1, uid); |
| | | } else { |
| | | integer = orderCancelService.saveData(id, 1, reason, remark, null, null, 2, 1, uid); |
| | | |
| | | orderPrivateCar.setState(10); |
| | | this.updateById(orderPrivateCar); |
| | | integer = orderCancelService.saveData(id, 1, reason, remark, null, amount, 1, 1, uid); |
| | | } |
| | | this.deleteTask(id);//删除定时任务 |
| | | |
| | |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | driver.setState(2); |
| | | driverService.updateById(driver); |
| | | }else{ |
| | | return ResultUtil.error(language == 1 ? "请完善后台取消规则设置" : language == 2 ? "Please complete the setting of cancellation rules from the background." : "Veuillez compléter le réglage des règles d’annulation à partir de l’arrière-plan."); |
| | | } |
| | | |
| | | } |
| | | //修改行程信息 |
| | | fleetEngineUtil.updateTrip("CANCELED", null, null, orderPrivateCar.getTripId(), null, null, null, null); |
| | | |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功取消出行订单,谢谢使用!" : language == 2 ? "You've cancelled the ride order successfully, thank you for using I-GO " : "Vous avez annulé la commande de course avec succès, merci d’utiliser I-GO", orderPrivateCar.getUserId(), 1); |
| | |
| | | orderCancel = orderCancelService.selectById(cancleId); |
| | | } |
| | | |
| | | CancleOrder query = cancleOrderService.query(orderPrivateCar.getOrderType(), 1, orderPrivateCar.getCompanyId()); |
| | | if(null != query){ |
| | | Double amount = queryCancleAmount(id, language).getData().getAmount(); |
| | | if(0 < amount){ |
| | | if(payType == 1){//手机支付 |
| | | orderCancel.setPayType(1); |
| | | orderCancelService.updateById(orderCancel); |
| | |
| | | checkoutRequest.setAccountNumber(userInfo.getPhone()); |
| | | checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(userInfo.getLastName()); |
| | | checkoutRequest.setRequestAmount(query.getMoney()); |
| | | checkoutRequest.setRequestAmount(amount); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Cancel a trip"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxCancelOrderTaxi"); |
| | |
| | | checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html"); |
| | | resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, id, 1, 1, query.getMoney(), null, 1);//添加预支付数据 |
| | | paymentRecordService.saveData(1, null, null, id, 1, 1, amount, null, 1);//添加预支付数据 |
| | | } |
| | | |
| | | } |
| | |
| | | checkoutRequest.setAccountNumber(bankCard.getCode()); |
| | | checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(bankCard.getLastName()); |
| | | checkoutRequest.setRequestAmount(query.getMoney()); |
| | | checkoutRequest.setRequestAmount(amount); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Cancel a trip"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxCancelOrderTaxi"); |
| | |
| | | checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html"); |
| | | resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, id, 1, 2, query.getMoney(), null, 1);//添加预支付数据 |
| | | paymentRecordService.saveData(1, null, null, id, 1, 2, amount, null, 1);//添加预支付数据 |
| | | } |
| | | |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ |
| | | if(userInfo.getBalance() != null && userInfo.getBalance() < amount){ |
| | | return ResultUtil.error((language == 1 ? "账户余额不足" : language == 2 ? "Insufficient balance" : "Solde insuffisant"), ""); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "取消订单", query.getMoney(), 2, 1, 1, 1, id); |
| | | transactionDetailsService.saveData(uid, "取消订单", amount, 2, 1, 1, 1, id); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | //解除小号绑定 |
| | | if(orderPrivateCar.getBindId() != null){ |
| | | chinaMobileUtil.midAxbUnBindSend(orderPrivateCar.getBindId(),orderPrivateCar.getTelX()); |
| | | ChinaMobileUtil.midAxbUnBindSend(orderPrivateCar.getBindId(),orderPrivateCar.getTelX()); |
| | | } |
| | | |
| | | if(5 == orderPrivateCar.getOldState()){ |
| | | orderPrivateCar.setState(6); |
| | | }else{ |
| | | orderPrivateCar.setState(10); |
| | | } |
| | | orderPrivateCar.setTelX(""); |
| | | orderPrivateCar.setBindId(""); |
| | | this.updateById(orderPrivateCar); |
| | |
| | | orderCancel.setPayType(3); |
| | | orderCancelService.updateById(orderCancel); |
| | | |
| | | // //添加已收入明细 |
| | | // incomeService.saveData(1, orderPrivateCar.getCompanyId(), 3, orderPrivateCar.getId(), 1, query.getMoney()); |
| | | // //添加已收入明细 |
| | | // Company company = companyService.selectById(orderPrivateCar.getCompanyId()); |
| | | // Double taxi = company.getSpeMoney(); |
| | | BigDecimal c =new BigDecimal(query.getMoney());//司机收入 |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | BigDecimal c =new BigDecimal(amount);//司机收入 |
| | | incomeService.saveData(2, orderPrivateCar.getDriverId(), 3, orderPrivateCar.getId(), 1, c.doubleValue()); |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | driverService.updateById(driver); |
| | | |
| | | this.deleteTask(id);//删除定时任务 |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | } |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已使用余额成功支付取消订单费用,谢谢使用!" : language == 2 |
| | |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil payPrivateCarOrder(Integer payType, Integer bankCardId, Integer orderId, Integer couponId, Integer type, Integer language) throws Exception { |
| | | public ResultUtil payPrivateCarOrder(Integer payType, Integer bankCardId, Integer orderId, Integer couponId, Integer redDeduction, Integer type, Integer language) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | if(orderPrivateCar.getState() == 8 || orderPrivateCar.getState() == 9){ |
| | | return ResultUtil.error(language == 1 ? "订单已完成支付,不允许重复支付" : language == 2 ? "The order has been paid, recurring payments is not allowed." : "La commande a été payée, les paiements récurrents ne sont pas autorisés.", ""); |
| | |
| | | //计算优惠券 |
| | | UserCouponRecord userCouponRecord = null; |
| | | if(null != couponId){ |
| | | if(null != redDeduction && 1 == redDeduction){ |
| | | return ResultUtil.error(language == 1 ? "优惠券和红包不能同时使用" : language == 2 ? "Coupons and lucky-promo cannot be used at the same time." : "Les coupons et les bonus ne peuvent pas être utilisés en même temps", ""); |
| | | } |
| | | userCouponRecord = userCouponRecordService.selectById(couponId); |
| | | if(!userCouponRecord.getCompanyId().equals(orderPrivateCar.getCompanyId())){ |
| | | return ResultUtil.error(language == 1 ? "优惠券不能用于此订单" : language == 2 ? "Coupon cannot be used for this order." : "Le coupon ne peut pas être utilisé pour cette commande.", ""); |
| | |
| | | orderMoney=new BigDecimal(orderMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | |
| | | //计算红包 |
| | | UserRedPacketRecord query = userRedPacketRecordService.query(uid, orderPrivateCar.getCompanyId(), 1, 1, orderMoney); |
| | | if(null != query && query.getMoney().compareTo(orderMoney) < 0){ |
| | | orderMoney = orderMoney - query.getMoney(); |
| | | orderPrivateCar.setRedPacketMoney(query.getMoney()); |
| | | orderPrivateCar.setRedPacketId(query.getId()); |
| | | if(null != redDeduction && 1 == redDeduction){ |
| | | RedEnvelopePaymentSettings redEnvelopePaymentSettings = redEnvelopePaymentSettingsService.getRedEnvelopePaymentSettings(); |
| | | if(null != redEnvelopePaymentSettings){ |
| | | Double total = userRedPacketRecordService.queryRemainingAmount(uid); |
| | | List<UserRedPacketRecord> userRedPacketRecords = userRedPacketRecordService.selectList(new EntityWrapper<UserRedPacketRecord>().eq("userId", uid) |
| | | .eq("state", 1).eq("companyId", orderPrivateCar.getCompanyId()).gt("remainingAmount", 0).orderBy("insertTime", false)); |
| | | if(total.compareTo(orderMoney) >= 0){ |
| | | BigDecimal deductionRatio = redEnvelopePaymentSettings.getDeductionRatio(); |
| | | BigDecimal multiply = new BigDecimal(orderMoney).multiply(deductionRatio.divide(new BigDecimal(100))); |
| | | orderPrivateCar.setRedPacketMoney(multiply.doubleValue()); |
| | | orderMoney = orderMoney - multiply.doubleValue(); |
| | | |
| | | //获取红包id |
| | | JSONArray jsonArray = new JSONArray(); |
| | | for (UserRedPacketRecord userRedPacketRecord : userRedPacketRecords) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("id", userRedPacketRecord.getId()); |
| | | BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount()); |
| | | if(multiply.compareTo(remainingAmount) >= 0){ |
| | | multiply = multiply.subtract(remainingAmount); |
| | | jsonObject.put("money", remainingAmount); |
| | | jsonArray.add(jsonObject); |
| | | }else{ |
| | | userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply).doubleValue()); |
| | | jsonObject.put("money", multiply); |
| | | jsonArray.add(jsonObject); |
| | | break; |
| | | } |
| | | } |
| | | orderPrivateCar.setRedPacketId(jsonArray.toJSONString()); |
| | | }else{ |
| | | orderPrivateCar.setRedPacketMoney(total); |
| | | orderMoney = orderMoney - total; |
| | | //获取红包id |
| | | JSONArray jsonArray = new JSONArray(); |
| | | BigDecimal multiply = new BigDecimal(total); |
| | | for (UserRedPacketRecord userRedPacketRecord : userRedPacketRecords) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("id", userRedPacketRecord.getId()); |
| | | BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount()); |
| | | if(multiply.compareTo(remainingAmount) >= 0){ |
| | | multiply = multiply.subtract(remainingAmount); |
| | | jsonObject.put("money", remainingAmount); |
| | | jsonArray.add(jsonObject); |
| | | }else{ |
| | | userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply).doubleValue()); |
| | | jsonObject.put("money", multiply); |
| | | jsonArray.add(jsonObject); |
| | | break; |
| | | } |
| | | } |
| | | orderPrivateCar.setRedPacketId(jsonArray.toJSONString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | if(payType == 1){//手机支付 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | |
| | | userCouponRecord.setEndTime(new Date()); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | if(null != query){ |
| | | query.setState(2); |
| | | query.setEndTime(new Date()); |
| | | userRedPacketRecordService.updateById(query); |
| | | if(null != orderPrivateCar.getRedPacketId()){ |
| | | JSONArray jsonArray = JSON.parseArray(orderPrivateCar.getRedPacketId()); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id1 = jsonObject.getInteger("id"); |
| | | Double money = jsonObject.getDouble("money"); |
| | | UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(id1); |
| | | userRedPacketRecord.setRemainingAmount(userRedPacketRecord.getRemainingAmount() - money); |
| | | if(0 == userRedPacketRecord.getRemainingAmount()){ |
| | | userRedPacketRecord.setState(2); |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | } |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | } |
| | | } |
| | | |
| | | if(orderPrivateCar.getIsplatPay()==1){ |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderPrivateCar.getCompanyId()); |
| | |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | if(null != query){ |
| | | query.setState(2); |
| | | query.setEndTime(new Date()); |
| | | userRedPacketRecordService.updateById(query); |
| | | |
| | | Double money = query.getMoney(); |
| | | if(null != orderPrivateCar.getRedPacketId()){ |
| | | JSONArray jsonArray = JSON.parseArray(orderPrivateCar.getRedPacketId()); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id1 = jsonObject.getInteger("id"); |
| | | Double money = jsonObject.getDouble("money"); |
| | | UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(id1); |
| | | userRedPacketRecord.setRemainingAmount(userRedPacketRecord.getRemainingAmount() - money); |
| | | if(0 == userRedPacketRecord.getRemainingAmount()){ |
| | | userRedPacketRecord.setState(2); |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | } |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | } |
| | | Double money = orderPrivateCar.getRedPacketMoney(); |
| | | incomeService.saveData(2, orderPrivateCar.getDriverId(), 7, orderPrivateCar.getId(), 1, money); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | if(null != orderPrivateCar.getDiscountMoney() && 0 < orderPrivateCar.getDiscountMoney()){ |
| | | Double money = orderPrivateCar.getDiscountMoney(); |
| | | incomeService.saveData(2, orderPrivateCar.getDriverId(), 6, orderPrivateCar.getId(), 1, money); |
| | |
| | | Double maxPrice = jsonObject.getDouble("maxPrice"); |
| | | Integer type1 = jsonObject.getInteger("type"); |
| | | if(1 == type1){ |
| | | List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driver.getId()).isNull("settlementRecordId").last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(createTime, '%Y-%m-%d')")); |
| | | List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driver.getId()) |
| | | .isNull("settlementRecordId").last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(createTime, '%Y-%m-%d')")); |
| | | BigDecimal total = new BigDecimal(0); |
| | | for (SettlementDetail detail : settlementDetailList) { |
| | | total = total.add(new BigDecimal(detail.getPrice())); |
| | |
| | | }else{//随机金额 |
| | | Double startMoney = Double.valueOf(String.valueOf(query.get("startMoney"))); |
| | | Double endMoney = Double.valueOf(String.valueOf(query.get("endMoney"))); |
| | | int i = new BigDecimal(endMoney).subtract(new BigDecimal(startMoney)).intValue(); |
| | | Random random = new Random(); |
| | | int num = random.nextInt(i); |
| | | money = new BigDecimal(startMoney).add(new BigDecimal(num)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | money = new BigDecimal(startMoney + (Math.random() * (endMoney - startMoney))).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | //判断当前红包是否大于剩余可领取总金额 |
| | | if(money.compareTo(Double.valueOf(query.get("lavePrice").toString())) > 0){ |
| | |
| | | //添加临时红包数据 |
| | | UserRedPacketRecord userRedPacketRecord = new UserRedPacketRecord(); |
| | | userRedPacketRecord.setMoney(money); |
| | | userRedPacketRecord.setRemainingAmount(money); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) + Integer.valueOf(String.valueOf(query.get("effective")))); |
| | | userRedPacketRecord.setExpirationTime(calendar.getTime()); |
| | | userRedPacketRecord.setInsertTime(new Date()); |
| | | userRedPacketRecord.setCompanyId(Integer.valueOf(String.valueOf(query.get("companyId")))); |
| | | userRedPacketRecord.setState(0); |
| | |
| | | query.setRedPacketActivityId(id.getId()); |
| | | userRedPacketRecordService.updateById(query); |
| | | |
| | | String content = 1 == language ? ("您收到一个额度为GHS " + money + " 的红包,请查收") : 2 == language ? "You have received a lucky promo of GHS " + money + ", please check" : "Vous avez reçu un bonus de GHS " + money + ", veuillez vérifier"; |
| | | systemNoticeService.addSystemNotice(1, content, query.getUserId(), 1); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(orderPrivateCar.getUserId()); |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/redEnvelopes.html"; |
| | |
| | | Element user_chinese = document.getElementById("user_chinese"); |
| | | user_chinese.text("您好 " + userInfo.getNickName() + ","); |
| | | Element time_chinese = document.getElementById("time_chinese"); |
| | | time_chinese.text("此活动有效期在 " + DateUtil.conversionFormat(language, sdf.format(query.getInsertTime())) + " 至 " + DateUtil.conversionFormat(language, sdf.format(query.getExpirationTime())) + ",详情请查看I-GO平台"); |
| | | time_chinese.text("此活动有效期在 " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " 至 " + DateUtil.conversionFormat(language, sdf.format(id.getEndTime())) + ",详情请查看I-GO平台"); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").remove(); |
| | |
| | | Element user_english = document.getElementById("user_english"); |
| | | user_english.text("Hello " + userInfo.getNickName() + ","); |
| | | Element time_english = document.getElementById("time_english"); |
| | | time_english.text("You could use it from " + DateUtil.conversionFormat(language, sdf.format(query.getInsertTime())) + " to " + DateUtil.conversionFormat(language, sdf.format(query.getExpirationTime())) + ",check more details on the app."); |
| | | time_english.text("You could use it from " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " to " + DateUtil.conversionFormat(language, sdf.format(id.getEndTime())) + ",check more details on the app."); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").remove(); |
| | |
| | | Element user_french = document.getElementById("user_french"); |
| | | user_french.text("Bonjour " + userInfo.getNickName() + ","); |
| | | Element time_french = document.getElementById("time_french"); |
| | | time_french.text("Cette promotion est valable du " + DateUtil.conversionFormat(language, sdf.format(query.getInsertTime())) + " au " + DateUtil.conversionFormat(language, sdf.format(query.getExpirationTime())) + ". Veuillez consulter la plateforme i-go pour plus de détails."); |
| | | time_french.text("Cette promotion est valable du " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " au " + DateUtil.conversionFormat(language, sdf.format(id.getEndTime())) + ". Veuillez consulter la plateforme i-go pour plus de détails."); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "红包活动" : language == 2 ? "Lucky-promo activities" : "Activités bonus", document.html()); |
| | |
| | | if(null != query){ |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderPrivateCar.getUserId(), "取消订单", query.getAmount(), 2, 1, 1, 1, query.getOrderId()); |
| | | if(5 == orderPrivateCar.getOldState()){ |
| | | orderPrivateCar.setState(6); |
| | | }else{ |
| | | orderPrivateCar.setState(10); |
| | | } |
| | | //解除小号绑定 |
| | | if(orderPrivateCar.getBindId() != null){ |
| | | chinaMobileUtil.midAxbUnBindSend(orderPrivateCar.getBindId(),orderPrivateCar.getTelX()); |
| | | ChinaMobileUtil.midAxbUnBindSend(orderPrivateCar.getBindId(),orderPrivateCar.getTelX()); |
| | | } |
| | | orderPrivateCar.setBindId(""); |
| | | orderPrivateCar.setTelX(""); |
| | |
| | | orderCancelService.updateById(query1); |
| | | } |
| | | |
| | | // //添加已收入明细 |
| | | // incomeService.saveData(1, orderPrivateCar.getCompanyId(), 3, orderPrivateCar.getId(), 1, query.getAmount()); |
| | | // //添加已收入明细 |
| | | // Company company = companyService.selectById(orderPrivateCar.getCompanyId()); |
| | | // Double taxi = company.getSpeMoney(); |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | BigDecimal c =new BigDecimal(query.getAmount());//司机收入 |
| | | incomeService.saveData(2, orderPrivateCar.getDriverId(), 3, orderPrivateCar.getId(), 1, c.doubleValue()); |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | |
| | | driverService.updateById(driver); |
| | | this.deleteTask(orderPrivateCar.getId());//删除定时任务 |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | // new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | // } |
| | | // }).start(); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | } |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已使用余额成功支付取消订单费用,谢谢使用!" : language == 2 |
| | |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | if(null != orderPrivateCar.getRedPacketId()){ |
| | | UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(orderPrivateCar.getRedPacketId()); |
| | | JSONArray jsonArray = JSON.parseArray(orderPrivateCar.getRedPacketId()); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id1 = jsonObject.getInteger("id"); |
| | | Double money = jsonObject.getDouble("money"); |
| | | UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(id1); |
| | | userRedPacketRecord.setRemainingAmount(userRedPacketRecord.getRemainingAmount() - money); |
| | | if(0 == userRedPacketRecord.getRemainingAmount()){ |
| | | userRedPacketRecord.setState(2); |
| | | } |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | }else{ |
| | | map.put("receipt", ""); |
| | | } |
| | | Integer companyId = 1; |
| | | if(null != map.get("driverId")){ |
| | | companyId = Integer.valueOf(String.valueOf(map.get("companyId"))); |
| | | } |
| | | CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", companyId)); |
| | | JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); |
| | | map.put("timeOutCancel", jsonObject.getIntValue("driverTimeout")); |
| | | return map; |
| | | } |
| | | |
| | |
| | | } |
| | | return endPushWarpper; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改目的地 |
| | | * @param orderId |
| | | * @param endLon |
| | | * @param endLat |
| | | * @param endAddress |
| | | */ |
| | | @Override |
| | | public void updateEndAddress(Integer orderId, String endLon, String endLat, String endAddress) { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | orderPrivateCar.setDestination(endAddress); |
| | | orderPrivateCar.setDestinationLat(endLat); |
| | | orderPrivateCar.setDestinationLon(endLon); |
| | | this.updateById(orderPrivateCar); |
| | | pushUtil.pushModifyAddress(2, orderPrivateCar.getDriverId(), orderId, 1, 1); |
| | | }else{ |
| | | orderPrivateCar.setEndAddress(endAddress); |
| | | orderPrivateCar.setEndLat(Double.valueOf(endLat)); |
| | | orderPrivateCar.setEndLon(Double.valueOf(endLon)); |
| | | this.updateById(orderPrivateCar); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 获取取消订单配置 |
| | | * @param type |
| | | * @param orderType |
| | | * @return |
| | | */ |
| | | CancleOrder query(@Param("type") Integer type, @Param("orderType") Integer orderType, |
| | | @Param("companyId") Integer companyId); |
| | | CancleOrder query(@Param("companyId") Integer companyId); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.CarModel; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/27 14:03 |
| | | */ |
| | | public interface CarModelMapper extends BaseMapper<CarModel> { |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.RedEnvelopePaymentSettings; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/15 15:07 |
| | | */ |
| | | public interface RedEnvelopePaymentSettingsMapper extends BaseMapper<RedEnvelopePaymentSettings> { |
| | | } |
| | |
| | | */ |
| | | List<Map<String, Object>> queryMyRedEnvelope(@Param("pageNum") Integer pageNum, @Param("size") Integer size, |
| | | @Param("uid") Integer uid); |
| | | |
| | | |
| | | /** |
| | | * 获取剩余红包总金额 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | Double queryRemainingAmount(@Param("uid") Integer uid); |
| | | } |
| | |
| | | * @param size |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryWithdrawal(@Param("uid") Integer uid, @Param("userType") Integer userType, |
| | | List<Map<String, Object>> queryWithdrawal(@Param("uid") Integer uid, @Param("userType") Integer userType, @Param("state") Integer status, |
| | | @Param("pageNum") Integer pageNum, @Param("size") Integer size); |
| | | } |
| | |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.CancleOrder"> |
| | | <id column="id" property="id"/> |
| | | <result column="companyId" property="companyId"/> |
| | | <result column="minuteNum" property="minuteNum"/> |
| | | <result column="money" property="money"/> |
| | | <result column="type" property="type"/> |
| | | <result column="orderType" property="orderType"/> |
| | | <result column="content" property="content"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="query" resultType="CancleOrder"> |
| | | <select id="query" resultType="com.stylefeng.guns.modular.system.model.CancleOrder"> |
| | | select |
| | | id as id, |
| | | companyId as companyId, |
| | | minuteNum as minuteNum, |
| | | money as money, |
| | | `type` as `type`, |
| | | orderType as orderType |
| | | from t_sys_cancle_order where `type` = #{type} and orderType = #{orderType} and companyId = #{companyId} |
| | | companyId, |
| | | content |
| | | from t_sys_cancle_order where companyId = #{companyId} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.system.dao.CarModelMapper"> |
| | | |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.system.dao.RedEnvelopePaymentSettingsMapper"> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | select |
| | | a.id as id, |
| | | a.money as money, |
| | | b.name as name |
| | | c.name as name, |
| | | DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as insertTime |
| | | from t_user_red_packet_record a |
| | | left join t_company b on (a.companyId = b.id) |
| | | left join t_user_activity_redenvelope b on (a.redPacketActivityId = b.id) |
| | | left join t_user_activity c on (b.userActivityId = c.id) |
| | | where a.state = 1 |
| | | <if test="null != uid"> |
| | | and a.userId = #{uid} |
| | |
| | | limit #{pageNum}, #{size} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="queryRemainingAmount" resultType="double"> |
| | | select ifnull(sum(remainingAmount), 0) from t_user_red_packet_record where userId = #{uid} |
| | | </select> |
| | | </mapper> |
| | |
| | | code, |
| | | remark as remark, |
| | | state as state |
| | | from t_pub_withdrawal where flag != 3 and userType = #{userType} and userId = #{uid} order by insertTime desc limit #{pageNum}, #{size} |
| | | from t_pub_withdrawal where flag != 3 and userType = #{userType} and userId = #{uid} |
| | | <if test="null != state"> |
| | | and `state` = #{state} |
| | | </if> |
| | | order by insertTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 取消订单设置 |
| | | */ |
| | | @Data |
| | | @TableName("t_sys_cancle_order") |
| | | public class CancleOrder { |
| | | /** |
| | |
| | | @TableField("companyId") |
| | | private Integer companyId; |
| | | /** |
| | | * 时间(分钟) |
| | | * 取消规则 |
| | | */ |
| | | @TableField("minuteNum") |
| | | private Integer minuteNum; |
| | | /** |
| | | * 金额 |
| | | */ |
| | | @TableField("money") |
| | | private Double money; |
| | | /** |
| | | * 类型(1=取消,2=预约取消) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 订单类型(1=专车,2=出租车) |
| | | */ |
| | | @TableField("orderType") |
| | | private Integer orderType; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Integer getMinuteNum() { |
| | | return minuteNum; |
| | | } |
| | | |
| | | public void setMinuteNum(Integer minuteNum) { |
| | | this.minuteNum = minuteNum; |
| | | } |
| | | |
| | | public Double getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(Double money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "CancleOrder{" + |
| | | "id=" + id + |
| | | ", companyId=" + companyId + |
| | | ", minuteNum=" + minuteNum + |
| | | ", money=" + money + |
| | | ", type=" + type + |
| | | ", orderType=" + orderType + |
| | | '}'; |
| | | } |
| | | @TableField("content") |
| | | private String content; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 车辆 |
| | | */ |
| | | @Data |
| | | @TableName("t_car") |
| | | public class Car { |
| | | /** |
| | |
| | | */ |
| | | @TableField("addObjectId") |
| | | private Integer addObjectId; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getIsPlatCar() { |
| | | return isPlatCar; |
| | | } |
| | | |
| | | public void setIsPlatCar(Integer isPlatCar) { |
| | | this.isPlatCar = isPlatCar; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Integer getFranchiseeId() { |
| | | return franchiseeId; |
| | | } |
| | | |
| | | public void setFranchiseeId(Integer franchiseeId) { |
| | | this.franchiseeId = franchiseeId; |
| | | } |
| | | |
| | | public String getCarColor() { |
| | | return carColor; |
| | | } |
| | | |
| | | public void setCarColor(String carColor) { |
| | | this.carColor = carColor; |
| | | } |
| | | |
| | | public Integer getCarModelId() { |
| | | return carModelId; |
| | | } |
| | | |
| | | public void setCarModelId(Integer carModelId) { |
| | | this.carModelId = carModelId; |
| | | } |
| | | |
| | | public Integer getCarBrandId() { |
| | | return carBrandId; |
| | | } |
| | | |
| | | public void setCarBrandId(Integer carBrandId) { |
| | | this.carBrandId = carBrandId; |
| | | } |
| | | |
| | | public String getCarLicensePlate() { |
| | | return carLicensePlate; |
| | | } |
| | | |
| | | public void setCarLicensePlate(String carLicensePlate) { |
| | | this.carLicensePlate = carLicensePlate; |
| | | } |
| | | |
| | | public String getCarPhoto() { |
| | | return carPhoto; |
| | | } |
| | | |
| | | public void setCarPhoto(String carPhoto) { |
| | | this.carPhoto = carPhoto; |
| | | } |
| | | |
| | | public String getDrivingLicenseNumber() { |
| | | return drivingLicenseNumber; |
| | | } |
| | | |
| | | public void setDrivingLicenseNumber(String drivingLicenseNumber) { |
| | | this.drivingLicenseNumber = drivingLicenseNumber; |
| | | } |
| | | |
| | | public String getDrivingLicensePhoto() { |
| | | return drivingLicensePhoto; |
| | | } |
| | | |
| | | public void setDrivingLicensePhoto(String drivingLicensePhoto) { |
| | | this.drivingLicensePhoto = drivingLicensePhoto; |
| | | } |
| | | |
| | | public Date getAnnualInspectionTime() { |
| | | return annualInspectionTime; |
| | | } |
| | | |
| | | public void setAnnualInspectionTime(Date annualInspectionTime) { |
| | | this.annualInspectionTime = annualInspectionTime; |
| | | } |
| | | |
| | | public String getInsurancePhoto() { |
| | | return insurancePhoto; |
| | | } |
| | | |
| | | public void setInsurancePhoto(String insurancePhoto) { |
| | | this.insurancePhoto = insurancePhoto; |
| | | } |
| | | |
| | | public Date getCommercialInsuranceTime() { |
| | | return commercialInsuranceTime; |
| | | } |
| | | |
| | | public void setCommercialInsuranceTime(Date commercialInsuranceTime) { |
| | | this.commercialInsuranceTime = commercialInsuranceTime; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Integer getAddType() { |
| | | return addType; |
| | | } |
| | | |
| | | public void setAddType(Integer addType) { |
| | | this.addType = addType; |
| | | } |
| | | |
| | | public Integer getAddObjectId() { |
| | | return addObjectId; |
| | | } |
| | | |
| | | public void setAddObjectId(Integer addObjectId) { |
| | | this.addObjectId = addObjectId; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Car{" + |
| | | "id=" + id + |
| | | ", isPlatCar=" + isPlatCar + |
| | | ", companyId=" + companyId + |
| | | ", carColor='" + carColor + '\'' + |
| | | ", carModelId=" + carModelId + |
| | | ", carBrandId=" + carBrandId + |
| | | ", carLicensePlate='" + carLicensePlate + '\'' + |
| | | ", carPhoto='" + carPhoto + '\'' + |
| | | ", drivingLicenseNumber='" + drivingLicenseNumber + '\'' + |
| | | ", drivingLicensePhoto='" + drivingLicensePhoto + '\'' + |
| | | ", annualInspectionTime=" + annualInspectionTime + |
| | | ", commercialInsuranceTime=" + commercialInsuranceTime + |
| | | ", insertTime=" + insertTime + |
| | | ", state=" + state + |
| | | ", addType=" + addType + |
| | | ", addObjectId=" + addObjectId + |
| | | '}'; |
| | | } |
| | | /** |
| | | * google车辆id |
| | | */ |
| | | @TableField("vehicleId") |
| | | private String vehicleId; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 车辆型号 |
| | | */ |
| | | @TableName("t_car_model") |
| | | public class CarModel { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @TableField("remark") |
| | | private String remark; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 状态(1=正常,2=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 座位数 |
| | | */ |
| | | @TableField("seat") |
| | | private Integer seat; |
| | | /** |
| | | * 车辆品牌id |
| | | */ |
| | | @TableField("brandId") |
| | | private Integer brandId; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Integer getSeat() { |
| | | return seat; |
| | | } |
| | | |
| | | public void setSeat(Integer seat) { |
| | | this.seat = seat; |
| | | } |
| | | |
| | | public Integer getBrandId() { |
| | | return brandId; |
| | | } |
| | | |
| | | public void setBrandId(Integer brandId) { |
| | | this.brandId = brandId; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "CarModel{" + |
| | | "id=" + id + |
| | | ", name='" + name + '\'' + |
| | | ", remark='" + remark + '\'' + |
| | | ", insertTime=" + insertTime + |
| | | ", state=" + state + |
| | | ", seat=" + seat + |
| | | ", brandId=" + brandId + |
| | | '}'; |
| | | } |
| | | } |
| | |
| | | @TableField("reason") |
| | | private String reason; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Integer orderId; |
| | | /** |
| | | * 订单类型 |
| | | */ |
| | | @TableField("orderType") |
| | | private Integer orderType; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | |
| | | this.handleUserId = handleUserId; |
| | | } |
| | | |
| | | public Integer getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public void setOrderId(Integer orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Complaint{" + |
| | |
| | | @TableField("objectId") |
| | | private Integer objectId; |
| | | /** |
| | | * 收入类型(1=活动,2=业务) |
| | | * 收入类型(1=活动收入,2=跑单收入,3=取消订单收入,4=改派订单收入,5=优惠券补贴,6=折扣不贴,7=红包补贴) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/15 15:04 |
| | | */ |
| | | @Data |
| | | @TableName("t_red_envelope_payment_settings") |
| | | public class RedEnvelopePaymentSettings { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | public Integer id; |
| | | /** |
| | | * 红包抵扣比例 |
| | | */ |
| | | @TableField("deductionRatio") |
| | | private BigDecimal deductionRatio; |
| | | /** |
| | | * 生效日期 |
| | | */ |
| | | @TableField("effectiveDate") |
| | | private Date effectiveDate; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 添加人id |
| | | */ |
| | | @TableField("insertUserId") |
| | | private Integer insertUserId; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 用户红包记录 |
| | | */ |
| | | @Data |
| | | @TableName("t_user_red_packet_record") |
| | | public class UserRedPacketRecord { |
| | | /** |
| | |
| | | @TableField("money") |
| | | private Double money; |
| | | /** |
| | | * 过期时间 |
| | | * 剩余金额 |
| | | */ |
| | | @TableField("expirationTime") |
| | | private Date expirationTime; |
| | | @TableField("remainingAmount") |
| | | private Double remainingAmount; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | |
| | | @TableField("redPacketActivityId") |
| | | private Integer redPacketActivityId; |
| | | |
| | | private Double distance; |
| | | |
| | | public Double getDistance() { |
| | | return distance; |
| | | } |
| | | |
| | | public void setDistance(Double distance) { |
| | | this.distance = distance; |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Double getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(Double money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public Date getExpirationTime() { |
| | | return expirationTime; |
| | | } |
| | | |
| | | public void setExpirationTime(Date expirationTime) { |
| | | this.expirationTime = expirationTime; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Integer getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public void setOrderId(Integer orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Integer getRedPacketActivityId() { |
| | | return redPacketActivityId; |
| | | } |
| | | |
| | | public void setRedPacketActivityId(Integer redPacketActivityId) { |
| | | this.redPacketActivityId = redPacketActivityId; |
| | | } |
| | | |
| | | public Date getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(Date endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "UserRedPacketRecord{" + |
| | | "id=" + id + |
| | | ", money=" + money + |
| | | ", expirationTime=" + expirationTime + |
| | | ", insertTime=" + insertTime + |
| | | ", companyId=" + companyId + |
| | | ", state=" + state + |
| | | ", orderId=" + orderId + |
| | | ", orderType=" + orderType + |
| | | ", userId=" + userId + |
| | | ", redPacketActivityId=" + redPacketActivityId + |
| | | '}'; |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 获取取消订单设置 |
| | | * @param type |
| | | * @param orderType |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | CancleOrder query(Integer type, Integer orderType, Integer companyId) throws Exception; |
| | | CancleOrder query(Integer companyId) throws Exception; |
| | | } |
| | |
| | | * @param uid 投诉人 |
| | | * @throws Exception |
| | | */ |
| | | void saveData(Integer driverId, String reason, String description, Integer uid, Integer language) throws Exception; |
| | | void saveData(Integer orderId, Integer orderType, Integer driverId, String reason, String description, Integer uid, Integer language) throws Exception; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.RedEnvelopePaymentSettings; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/15 15:08 |
| | | */ |
| | | public interface IRedEnvelopePaymentSettingsService extends IService<RedEnvelopePaymentSettings> { |
| | | |
| | | |
| | | /** |
| | | * 获取当前执行的红包支付配置 |
| | | * @return |
| | | */ |
| | | RedEnvelopePaymentSettings getRedEnvelopePaymentSettings(); |
| | | } |
| | |
| | | */ |
| | | List<Map<String, Object>> queryMyRedEnvelope(Integer pageNum, Integer size, Integer uid) throws Exception; |
| | | |
| | | /** |
| | | * 获取剩余红包总金额 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | Double queryRemainingAmount(Integer uid); |
| | | } |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryWithdrawal(Integer uid, Integer pageNum, Integer size, Integer language) throws Exception; |
| | | List<Map<String, Object>> queryWithdrawal(Integer uid, Integer pageNum, Integer size, Integer state, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 获取取消订单配置 |
| | | * @param type |
| | | * @param orderType |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public CancleOrder query(Integer type, Integer orderType, Integer companyId) throws Exception { |
| | | return cancleOrderMapper.query(type, orderType, companyId); |
| | | public CancleOrder query(Integer companyId) throws Exception { |
| | | return cancleOrderMapper.query(companyId); |
| | | } |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void saveData(Integer driverId, String reason, String description, Integer uid, Integer language) throws Exception { |
| | | public void saveData(Integer orderId, Integer orderType, Integer driverId, String reason, String description, Integer uid, Integer language) throws Exception { |
| | | if(ToolUtil.isNotEmpty(description)){ |
| | | List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null); |
| | | for(SensitiveWords s : sensitiveWords){ |
| | |
| | | complaint.setInsertTime(new Date()); |
| | | complaint.setDriverId(driverId); |
| | | complaint.setReason(reason); |
| | | complaint.setOrderId(orderId); |
| | | complaint.setOrderType(orderType); |
| | | complaint.setDescription(description); |
| | | complaint.setUserId(uid); |
| | | complaint.setIsHandle(0); |
| | |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.dao.OrderEvaluateMapper; |
| | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | driverId = orderCrossCity.getDriverId(); |
| | | uid = orderCrossCity.getUserId(); |
| | | break; |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | driverId = orderLogistics.getDriverId(); |
| | | uid = orderLogistics.getUserId(); |
| | | break; |
| | | } |
| | | |
| | | orderEvaluate.setOrderId(orderId); |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.RedEnvelopePaymentSettingsMapper; |
| | | import com.stylefeng.guns.modular.system.model.RedEnvelopePaymentSettings; |
| | | import com.stylefeng.guns.modular.system.service.IRedEnvelopePaymentSettingsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/15 15:08 |
| | | */ |
| | | @Service |
| | | public class RedEnvelopePaymentSettingsServiceImpl extends ServiceImpl<RedEnvelopePaymentSettingsMapper, RedEnvelopePaymentSettings> implements IRedEnvelopePaymentSettingsService { |
| | | |
| | | /** |
| | | * 获取当前执行的红包支付配置 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public RedEnvelopePaymentSettings getRedEnvelopePaymentSettings() { |
| | | RedEnvelopePaymentSettings redEnvelopePaymentSettings = this.selectOne(new EntityWrapper<RedEnvelopePaymentSettings>() |
| | | .eq("status", 1) |
| | | .last(" and now() >= effectiveDate order by effectiveDate desc limit 0, 1")); |
| | | return redEnvelopePaymentSettings; |
| | | } |
| | | } |
| | |
| | | UserInfo userInfo = this.selectById(query.getUserId()); |
| | | if(null != query){ |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(Integer.valueOf(query.getUserId()), "余额充值", query.getAmount(), 2, 1, 1, 5, null); |
| | | transactionDetailsService.saveData(Integer.valueOf(query.getUserId()), "余额充值", query.getAmount(), 2, 1, 1, 5, paymentRecordId); |
| | | double v = new BigDecimal(userInfo.getBalance()).add(new BigDecimal(query.getAmount())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | userInfo.setBalance(v); |
| | | this.updateById(userInfo); |
| | |
| | | pageNum = (pageNum - 1) * size; |
| | | return userRedPacketRecordMapper.queryMyRedEnvelope(pageNum, size, uid); |
| | | } |
| | | |
| | | /** |
| | | * 获取剩余红包总金额 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Double queryRemainingAmount(Integer uid) { |
| | | return this.baseMapper.queryRemainingAmount(uid); |
| | | } |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryWithdrawal(Integer uid, Integer pageNum, Integer size, Integer language) throws Exception { |
| | | public List<Map<String, Object>> queryWithdrawal(Integer uid, Integer pageNum, Integer size, Integer state, Integer language) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | String name = language == 1 ? "手机号:" : language == 2 ? "Phone number:" : "Numéro de portable:"; |
| | | List<Map<String, Object>> list = withdrawalMapper.queryWithdrawal(uid, 1, pageNum, size); |
| | | List<Map<String, Object>> list = withdrawalMapper.queryWithdrawal(uid, 1, state, pageNum, size); |
| | | for (Map<String, Object> map : list) { |
| | | map.put("name", name + map.get("code")); |
| | | if(null != map.get("insertTime")){ |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.GoogleMap; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import cn.hutool.http.Method; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.fleetengine.auth.AuthTokenMinter; |
| | | import com.google.fleetengine.auth.token.FleetEngineToken; |
| | | import com.google.fleetengine.auth.token.TripClaims; |
| | | import com.google.fleetengine.auth.token.VehicleClaims; |
| | | import com.google.fleetengine.auth.token.factory.signer.*; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * Fleet Engine API 工具类 |
| | | * @author zhibing.pu |
| | | * @Date 2024/5/17 9:59 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class FleetEngineUtil { |
| | | |
| | | static Logger logger = LoggerFactory.getLogger(FleetEngineUtil.class); |
| | | |
| | | private final String SERVICE_ACCOUNT = "odrd2024@i-go-odrd-testing.iam.gserviceaccount.com"; |
| | | |
| | | private final String privateKeyId = "0a9a480fafb6469c0c1b2fa6dbdf6d4bebe1ebed"; |
| | | |
| | | private final String privateKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDXZoPEFZeZb0C7DXzpPsloB+rQVQAJuR+z4T9uRCz33gBsIqrz1s5Iwd8vXYKKWzukMdXkwqR4WapI/4GtcpbJkRK93mKXvEE3sDz27BnRrZL4gHeECVpFy0egw29sqFM/x/cpst0goqq4/f3ZFGtQGIhSEEHMySQgTbZDIhXMIls1etRsM4K2bTXeMPn89ablPBdbKtTAJy1EI+ZLKbxnl9StyqBam+d+UsfVmNG19MsNbSzCKc+QPnPXb7dj9KxJ/2whog8w15qXQdJHAMeHZyNlqE0zVP7G1VdWo6Q4QtzmENANxBpJIEbAqY2sq3BZSqDd5XS9Dr9BR4XzQqQnAgMBAAECggEABFABAj4eph1vxVYRBH2TpvDGFU3uW7VBPjwp7JzntLAN8eNoPlqmEDP16y6D/HMmfftpAI3TvWA3+ZEPkiX6nVDyW6sGCodyP0QuJEob1HKHFYntzGtHhGg1KCOacLey6TYbJJmUtcsduQXGkocOPaLXNvjzr2mY2zthTDzJ6HzjDo3d2x/O+lUVlNjubTFydgU9bQP8zS389GgZkO/YebK9+qPRBXv1R2fmj0rhpLqC03jL/mUMKi5tW628OiJGdvzLXlAGyJ9CtVDjfrwUgLf8ML+3yfdmv7yFeWuJ2NEgQxKACixHM05qkCW2bOkPIi9+wb1BbVvMdYL+GCPvmQKBgQD/DZ8zpWfNAkl8h8NI0E7sPdN6wgGfPpaC8VpOE3EM2eEijkZZT6XjfxXjMv1vXg1UoeYVscPb99Ux6u2gq+ZJj6+IstNIObXgvrqNxKPw6OO2xCb6UmA4rQ74xe4d1KLN+C1zepgFYgU4ejungWzuPVL7x8xjdyBAvqgPqP1IbQKBgQDYMzXs2QcWr9tVwq1O3D/H6qX2DvelAj7j0vuXGtop1/aJW7bPlGJd9NGim8dnXLVSFyRteuVl4epa/C9h50g3FM/lFMl9lmp1HwpDeiSJYAGRH8cnPJjN/IV3cRl5qN8KUQE2a3BRP+6IPHJiF1Bc1vj08nTMsWmN+K6VcAzqYwKBgGGJ7RNMM0kkkcPtC5LCDxyrfD/bB9HFlrvW3ykyqC44+K9FZ8PqAM/inxU3P9KiTkjKbXpodDWgLskbResHMld5erC1arWZVGPxrNhgli2gcs1HcHyUmjWygSJEV47S7bwFKCScgpy0Yri5jiy+A1GM5Dpjq1dyjEQWZaEviEV1AoGBALoKn023l/T60QgkZNQmjS/wCG4LhSjWHN4ZMOxfa/pz369lX5OSwW7OfBKscFPOoC0Kwwr+pSYd2HgA6Jkb17WmUBt13skWRXeRhVh5Y7VfCxohuVNXPrqKoSMeDOj22y9ac2ur2lPgateLBHbKTxoE1uiZNs7pn8ZOh5UKfeK3AoGBAKjklIbZ05nvM/mzdPk9JfCFJ6SaQqeaQcU9AoLEQdOzIrrI660Ignn4hOzLSYac0GxytYTQzDt5xDHKBYqJfem7IqxkIj9hSnIZFnUxp6+VfBhXdWHGn+GDTQa1iDvfpy/h6Gr4NL+p/EoA17qtUqOlYxJ1Dkbaw3SqUtkbuv2G"; |
| | | |
| | | private final String provider = "i-go-odrd-testing"; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取jwt token |
| | | * @param type 0=服务端,1=乘客,2=司机 |
| | | * @return |
| | | */ |
| | | public Map<String, Object> fleetEngineAuth(int type, Integer id){ |
| | | try { |
| | | //谷歌云服务器使用这部分代码 |
| | | // AuthTokenMinter minter = AuthTokenMinter.builder() |
| | | // //服务端签名 |
| | | // .setServerSigner(DefaultServiceAccountSigner.create()) |
| | | // //司机端签名 |
| | | // .setDriverSigner(ImpersonatedSigner.create(SERVICE_ACCOUNT)) |
| | | // //乘客端签名 |
| | | // .setConsumerSigner(ImpersonatedSigner.create(SERVICE_ACCOUNT)) |
| | | // .build(); |
| | | AuthTokenMinter minter = AuthTokenMinter.builder() |
| | | //服务端签名 |
| | | .setServerSigner(LocalSigner.create(SERVICE_ACCOUNT, privateKeyId, privateKey)) |
| | | //司机端签名 |
| | | .setDriverSigner(LocalSigner.create(SERVICE_ACCOUNT, privateKeyId, privateKey)) |
| | | //乘客端签名 |
| | | .setConsumerSigner(LocalSigner.create(SERVICE_ACCOUNT, privateKeyId, privateKey)) |
| | | .build(); |
| | | |
| | | String jwt = ""; |
| | | Long expirationTimestamp = 0L; |
| | | if(0 == type){ |
| | | FleetEngineToken serverToken = minter.getServerToken(); |
| | | jwt = serverToken.jwt(); |
| | | expirationTimestamp = serverToken.expirationTimestamp().getTime(); |
| | | } |
| | | if(1 == type){ |
| | | FleetEngineToken consumerToken = minter.getConsumerToken(TripClaims.create("I-GO-USER" + id)); |
| | | jwt = consumerToken.jwt(); |
| | | expirationTimestamp = consumerToken.expirationTimestamp().getTime(); |
| | | } |
| | | if(2 == type){ |
| | | FleetEngineToken driverToken = minter.getDriverToken(VehicleClaims.create("I-GO-CAR" + id)); |
| | | jwt = driverToken.jwt(); |
| | | expirationTimestamp = driverToken.expirationTimestamp().getTime(); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("token", jwt); |
| | | map.put("expirationTimestamp", expirationTimestamp); |
| | | return map; |
| | | } catch (SigningTokenException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public String getToken(){ |
| | | String token_json = redisUtil.getValue("google_token"); |
| | | String google_token = ""; |
| | | if(!StringUtils.hasLength(token_json)){ |
| | | Map<String, Object> map = fleetEngineAuth(0, null); |
| | | redisUtil.setStrValue("google_token", JSON.toJSONString(map)); |
| | | google_token = map.get("token").toString(); |
| | | }else{ |
| | | JSONObject jsonObject1 = JSON.parseObject(token_json); |
| | | Long expirationTimestamp = jsonObject1.getLong("expirationTimestamp"); |
| | | google_token = jsonObject1.getString("token"); |
| | | if((expirationTimestamp - 10000L) <= System.currentTimeMillis()){ |
| | | Map<String, Object> map = fleetEngineAuth(0, null); |
| | | redisUtil.setStrValue("google_token", JSON.toJSONString(map)); |
| | | google_token = map.get("token").toString(); |
| | | } |
| | | } |
| | | return google_token; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加车辆 |
| | | * @param maximumCapacity 这辆车可以搭载的乘客总数 |
| | | * @param licensePlate 车牌号 |
| | | * @param id 车辆id |
| | | */ |
| | | public String createVehicles(int maximumCapacity, String licensePlate, String id) throws Exception{ |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/vehicles?vehicleId=" + id; |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | post.addHeaders(headers); |
| | | |
| | | JSONObject body = new JSONObject(); |
| | | body.put("vehicleState", "OFFLINE"); |
| | | body.put("supportedTripTypes", Arrays.asList("SHARED", "EXCLUSIVE")); |
| | | body.put("maximumCapacity", maximumCapacity); |
| | | |
| | | JSONObject category = new JSONObject(); |
| | | category.put("category", "TAXI"); |
| | | body.put("vehicleType", category); |
| | | JSONObject licensePlate1 = new JSONObject(); |
| | | licensePlate1.put("countryCode", "GH"); |
| | | licensePlate1.put("lastCharacter", getLastNumber(licensePlate)); |
| | | body.put("licensePlate", licensePlate1); |
| | | logger.info("创建车辆请求:{}", body.toJSONString()); |
| | | HttpRequest request = post.body(body.toJSONString()); |
| | | HttpResponse response = request.execute(); |
| | | logger.info("创建车辆结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return createVehicles(maximumCapacity, licensePlate, id); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/vehicles/I-GO-CAR1", |
| | | * "vehicleState": "OFFLINE", |
| | | * "supportedTripTypes": [ |
| | | * "EXCLUSIVE", |
| | | * "SHARED" |
| | | * ], |
| | | * "maximumCapacity": 4, |
| | | * "vehicleType": { |
| | | * "category": "AUTO" |
| | | * }, |
| | | * "licensePlate": { |
| | | * "countryCode": "GH", |
| | | * "lastCharacter": "3" |
| | | * }, |
| | | * "currentRouteSegmentVersion": "2024-05-23T03:05:23.293329Z", |
| | | * "waypointsVersion": "2024-05-23T03:05:23.293329Z" |
| | | * } |
| | | */ |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改车辆信息 |
| | | * @param maximumCapacity |
| | | * @param licensePlate |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public String updateVehicles(String vehicleState, Integer maximumCapacity, String licensePlate, String id) throws Exception{ |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/vehicles/" + id + "?updateMask="; |
| | | List<String> sb = new ArrayList<>(); |
| | | if(StringUtils.hasLength(vehicleState)){ |
| | | sb.add("vehicleState"); |
| | | } |
| | | if(null != maximumCapacity){ |
| | | sb.add("maximumCapacity"); |
| | | } |
| | | if(StringUtils.hasLength(licensePlate)){ |
| | | sb.add("licensePlate"); |
| | | } |
| | | String collect = sb.stream().collect(Collectors.joining(",")); |
| | | url += collect; |
| | | |
| | | HttpRequest put = HttpUtil.createRequest(Method.PUT, url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | put.addHeaders(headers); |
| | | |
| | | JSONObject body = new JSONObject(); |
| | | /** |
| | | * UNKNOWN_VEHICLE_STATE 默认,用于未指定或无法识别的车辆状态。 |
| | | * OFFLINE 车辆不接受新行程。注意:在完成分配给车辆的行程时,车辆仍可继续在此状态下运行。 |
| | | * ONLINE 车辆正在接受新行程。 |
| | | */ |
| | | if(StringUtils.hasLength(vehicleState)){ |
| | | body.put("vehicleState", vehicleState); |
| | | } |
| | | if(null != maximumCapacity){ |
| | | body.put("maximumCapacity", maximumCapacity); |
| | | } |
| | | if(StringUtils.hasLength(licensePlate)){ |
| | | JSONObject licensePlate1 = new JSONObject(); |
| | | licensePlate1.put("countryCode", "GH"); |
| | | licensePlate1.put("lastCharacter", getLastNumber(licensePlate)); |
| | | body.put("licensePlate", licensePlate1); |
| | | } |
| | | body.put("supportedTripTypes", Arrays.asList("SHARED", "EXCLUSIVE")); |
| | | |
| | | JSONObject category = new JSONObject(); |
| | | category.put("category", "TAXI"); |
| | | body.put("vehicleType", category); |
| | | put.body(body.toJSONString()); |
| | | logger.info("修改车辆信息请求:{}", body.toJSONString()); |
| | | HttpResponse response = put.execute(); |
| | | logger.info("修改车辆信息结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return updateVehicles(vehicleState, maximumCapacity, licensePlate, id); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/vehicles/I-GO-CAR1", |
| | | * "vehicleState": "OFFLINE", |
| | | * "supportedTripTypes": [ |
| | | * "EXCLUSIVE", |
| | | * "SHARED" |
| | | * ], |
| | | * "maximumCapacity": 4, |
| | | * "vehicleType": { |
| | | * "category": "TAXI" |
| | | * }, |
| | | * "licensePlate": { |
| | | * "countryCode": "GH", |
| | | * "lastCharacter": "5" |
| | | * }, |
| | | * "currentRouteSegmentVersion": "2024-05-23T06:08:14.968942Z", |
| | | * "waypointsVersion": "2024-05-23T03:05:23.293329Z" |
| | | * } |
| | | */ |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取车辆信息 |
| | | * @param id 车辆id |
| | | * @return |
| | | */ |
| | | public String getVehicles(String id) throws Exception{ |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/vehicles/" + (null != id ? id : ""); |
| | | HttpRequest get = HttpUtil.createGet(url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | get.addHeaders(headers); |
| | | |
| | | HttpResponse response = get.execute(); |
| | | logger.info("查询车辆结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 404){ |
| | | return ""; |
| | | } |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return getVehicles(id); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "vehicles": [ |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/vehicles/I-GO-CAR1", |
| | | * "vehicleState": "OFFLINE", |
| | | * "supportedTripTypes": [ |
| | | * "EXCLUSIVE", |
| | | * "SHARED" |
| | | * ], |
| | | * "maximumCapacity": 4, |
| | | * "vehicleType": { |
| | | * "category": "AUTO" |
| | | * }, |
| | | * "licensePlate": { |
| | | * "countryCode": "GH", |
| | | * "lastCharacter": "3" |
| | | * }, |
| | | * "currentRouteSegmentVersion": "2024-05-23T03:05:23.293329Z", |
| | | * "waypointsVersion": "2024-05-23T03:05:23.293329Z" |
| | | * } |
| | | * ], |
| | | * "totalSize": "1" |
| | | * } |
| | | * |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/vehicles/I-GO-CAR1", |
| | | * "vehicleState": "OFFLINE", |
| | | * "supportedTripTypes": [ |
| | | * "EXCLUSIVE", |
| | | * "SHARED" |
| | | * ], |
| | | * "maximumCapacity": 4, |
| | | * "vehicleType": { |
| | | * "category": "TAXI" |
| | | * }, |
| | | * "licensePlate": { |
| | | * "countryCode": "GH", |
| | | * "lastCharacter": "5" |
| | | * }, |
| | | * "currentRouteSegmentVersion": "2024-05-23T06:08:14.968942Z", |
| | | * "waypointsVersion": "2024-05-23T03:05:23.293329Z" |
| | | * } |
| | | */ |
| | | |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取最后一个数字 |
| | | * @param str |
| | | * @return |
| | | */ |
| | | private String getLastNumber(String str){ |
| | | for (int i = str.length(); i > 0; i--) { |
| | | char c = str.charAt(i - 1); |
| | | if(String.valueOf(c).matches("\\d")){ |
| | | return str.substring(i - 1, i); |
| | | } |
| | | } |
| | | return "-1"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建新的行程 |
| | | * @param vehicleId 车辆id |
| | | * @param numberOfPassengers 人数 |
| | | * @param tripId 订单id |
| | | * @param start_lat 起点纬度 |
| | | * @param start_lng 起点经度 |
| | | * @param end_lat 终点纬度 |
| | | * @param end_lng 终点经度 |
| | | * @return |
| | | */ |
| | | public String createTrip(String vehicleId, Integer numberOfPassengers, String tripId, String start_lat, String start_lng, String end_lat, String end_lng) throws Exception{ |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/trips?tripId=" + tripId; |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | post.addHeaders(headers); |
| | | |
| | | JSONObject body = new JSONObject(); |
| | | if(StringUtils.hasLength(vehicleId)){ |
| | | body.put("vehicleId", vehicleId); |
| | | } |
| | | body.put("tripStatus", "NEW"); |
| | | body.put("tripType", "SHARED"); |
| | | body.put("numberOfPassengers", numberOfPassengers); |
| | | |
| | | JSONObject pickupPoint = new JSONObject(); |
| | | JSONObject point = new JSONObject(); |
| | | point.put("latitude", start_lat); |
| | | point.put("longitude", start_lng); |
| | | pickupPoint.put("point", point); |
| | | body.put("pickupPoint", pickupPoint); |
| | | |
| | | JSONObject dropoffPoint = new JSONObject(); |
| | | JSONObject end_point = new JSONObject(); |
| | | end_point.put("latitude", end_lat); |
| | | end_point.put("longitude", end_lng); |
| | | dropoffPoint.put("point", end_point); |
| | | body.put("dropoffPoint", dropoffPoint); |
| | | logger.info("创建行程请求:{}", body.toJSONString()); |
| | | HttpRequest request = post.body(body.toJSONString()); |
| | | HttpResponse response = request.execute(); |
| | | logger.info("创建行程结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return createTrip(vehicleId, numberOfPassengers, tripId, start_lat, start_lng, end_lat, end_lng); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/trips/I-GO-RIDE1", |
| | | * "vehicleId": "I-GO-CAR1", |
| | | * "tripStatus": "NEW", |
| | | * "tripType": "SHARED", |
| | | * "pickupPoint": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * }* }, |
| | | * "pickupTime": "2024-05-27T02:05:37.935052Z", |
| | | * "dropoffPoint": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "dropoffTime": "2024-05-27T02:18:35.934167Z", |
| | | * "numberOfPassengers": 1, |
| | | * "remainingDistanceMeters": 0, |
| | | * "etaToFirstWaypoint": "2024-05-27T02:05:37.935052Z", |
| | | * "remainingWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "distanceMeters": 0, |
| | | * "eta": "2024-05-27T02:05:37.935052Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:18:35.934167Z", |
| | | * "duration": "777.999115s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "currentRouteSegmentVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "remainingWaypointsVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "vehicleWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "distanceMeters": 0, |
| | | * "eta": "2024-05-27T02:05:37.935052Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:18:35.934167Z", |
| | | * "duration": "777.999115s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "currentRouteSegmentEndPoint": { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE" |
| | | * }, |
| | | * "remainingWaypointsRouteVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "currentRouteSegmentTrafficVersion": "2024-05-27T02:05:37.941167Z" |
| | | * } |
| | | */ |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改行程 |
| | | * @param tripStatus 行程状态 |
| | | * @param vehicleId 车辆id |
| | | * @param numberOfPassengers 人数 |
| | | * @param tripId 订单id |
| | | * @param start_lat 起点纬度 |
| | | * @param start_lng 起点经度 |
| | | * @param end_lat 终点纬度 |
| | | * @param end_lng 终点经度 |
| | | * @return |
| | | */ |
| | | public String updateTrip(String tripStatus, String vehicleId, Integer numberOfPassengers, String tripId, String start_lat, String start_lng, String end_lat, String end_lng) throws Exception { |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/trips/" + tripId + "?updateMask="; |
| | | List<String> sb = new ArrayList<>(); |
| | | if(StringUtils.hasLength(vehicleId)){ |
| | | sb.add("vehicleId"); |
| | | } |
| | | if(StringUtils.hasLength(tripStatus)){ |
| | | sb.add("tripStatus"); |
| | | } |
| | | if(null != numberOfPassengers){ |
| | | sb.add("numberOfPassengers"); |
| | | } |
| | | if(StringUtils.hasLength(start_lat) && StringUtils.hasLength(start_lng)){ |
| | | sb.add("pickupPoint"); |
| | | } |
| | | |
| | | if(StringUtils.hasLength(end_lat) && StringUtils.hasLength(end_lng)){ |
| | | sb.add("dropoffPoint"); |
| | | } |
| | | String collect = sb.stream().collect(Collectors.joining(",")); |
| | | url += collect; |
| | | |
| | | HttpRequest put = HttpUtil.createRequest(Method.PUT, url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | put.addHeaders(headers); |
| | | |
| | | JSONObject body = new JSONObject(); |
| | | if(StringUtils.hasLength(vehicleId)){ |
| | | body.put("vehicleId", vehicleId); |
| | | } |
| | | /** |
| | | * UNKNOWN_TRIP_STATUS 默认,用于未指定或无法识别的行程状态。 |
| | | * NEW 新建行程。 |
| | | * ENROUTE_TO_PICKUP 司机正在前往上车点。 |
| | | * ARRIVED_AT_PICKUP 司机已到达上车点。 |
| | | * ARRIVED_AT_INTERMEDIATE_DESTINATION 司机已到达中转目的地,正在等待乘客。 |
| | | * ENROUTE_TO_INTERMEDIATE_DESTINATION 司机正在前往中间目的地(而非下车点)。 |
| | | * ENROUTE_TO_DROPOFF 司机已接起乘客,正在前往下一个目的地。 |
| | | * COMPLETE 乘客已下车,行程已完成。 |
| | | * CANCELED 在司机、乘客或拼车服务提供商取车之前,行程被取消。 |
| | | */ |
| | | if(StringUtils.hasLength(tripStatus)){ |
| | | body.put("tripStatus", tripStatus); |
| | | } |
| | | if(null != numberOfPassengers){ |
| | | body.put("numberOfPassengers", numberOfPassengers); |
| | | } |
| | | if(StringUtils.hasLength(start_lat) && StringUtils.hasLength(start_lng)){ |
| | | JSONObject pickupPoint = new JSONObject(); |
| | | JSONObject point = new JSONObject(); |
| | | point.put("latitude", start_lat); |
| | | point.put("longitude", start_lng); |
| | | pickupPoint.put("point", point); |
| | | body.put("pickupPoint", pickupPoint); |
| | | } |
| | | |
| | | if(StringUtils.hasLength(end_lat) && StringUtils.hasLength(end_lng)){ |
| | | JSONObject dropoffPoint = new JSONObject(); |
| | | JSONObject end_point = new JSONObject(); |
| | | end_point.put("latitude", end_lat); |
| | | end_point.put("longitude", end_lng); |
| | | dropoffPoint.put("point", end_point); |
| | | body.put("dropoffPoint", dropoffPoint); |
| | | } |
| | | logger.info("修改行程请求:{}", body.toJSONString()); |
| | | HttpRequest request = put.body(body.toJSONString()); |
| | | HttpResponse response = request.execute(); |
| | | logger.info("修改行程结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return updateTrip(tripStatus, vehicleId, numberOfPassengers, tripId, start_lat, start_lng, end_lat, end_lng); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/trips/I-GO-RIDE1", |
| | | * "vehicleId": "I-GO-CAR1", |
| | | * "tripStatus": "ENROUTE_TO_PICKUP", |
| | | * "tripType": "SHARED", |
| | | * "pickupPoint": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * }* }, |
| | | * "pickupTime": "2024-05-27T02:07:38.562717Z", |
| | | * "dropoffPoint": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "dropoffTime": "2024-05-27T02:20:36.562375Z", |
| | | * "numberOfPassengers": 1, |
| | | * "remainingWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "eta": "2024-05-27T02:07:38.562717Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:20:36.562375Z", |
| | | * "duration": "777.999658s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "remainingWaypointsVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "vehicleWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "eta": "2024-05-27T02:07:38.562717Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:20:36.562375Z", |
| | | * "duration": "777.999658s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "remainingWaypointsRouteVersion": "2024-05-27T02:07:38.570569Z" |
| | | * } |
| | | * |
| | | * 取消订单后返回的结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/trips/I-GO-RIDE1", |
| | | * "tripStatus": "CANCELED", |
| | | * "tripType": "SHARED", |
| | | * "pickupPoint": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * }* }, |
| | | * "dropoffPoint": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "numberOfPassengers": 1 |
| | | * } |
| | | */ |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取行程信息 |
| | | * @param tripId 订单id |
| | | * @return |
| | | */ |
| | | public String getTrip(String tripId) throws Exception { |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/trips/" + tripId; |
| | | HttpRequest get = HttpUtil.createGet(url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | get.addHeaders(headers); |
| | | |
| | | HttpResponse response = get.execute(); |
| | | logger.info("查询行程结果:{}", response.body()); |
| | | JSONObject jsonObject = JSON.parseObject(response.body().replaceAll("@type", "type")); |
| | | JSONObject error = jsonObject.getJSONObject("error"); |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 404){ |
| | | return ""; |
| | | } |
| | | if(code == 401){ |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | | return getTrip(tripId); |
| | | } |
| | | } |
| | | throw new Exception(response.body()); |
| | | } |
| | | /** |
| | | * 返回结果 |
| | | * { |
| | | * "name": "providers/i-go-odrd-testing/trips/I-GO-RIDE1", |
| | | * "vehicleId": "I-GO-CAR1", |
| | | * "tripStatus": "ENROUTE_TO_PICKUP", |
| | | * "tripType": "SHARED", |
| | | * "pickupPoint": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * }* }, |
| | | * "pickupTime": "2024-05-27T02:10:39.763347Z", |
| | | * "dropoffPoint": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "dropoffTime": "2024-05-27T02:23:37.762549Z", |
| | | * "numberOfPassengers": 1, |
| | | * "remainingDistanceMeters": 0, |
| | | * "etaToFirstWaypoint": "2024-05-27T02:10:39.763347Z", |
| | | * "remainingWaypoints": [ |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE", |
| | | * "distanceMeters": 0, |
| | | * "eta": "2024-05-27T02:10:39.763347Z", |
| | | * "duration": "0s" |
| | | * }, |
| | | * { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.636319, |
| | | * "longitude": 104.129219 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "DROP_OFF_WAYPOINT_TYPE", |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==", |
| | | * "distanceMeters": 8260, |
| | | * "eta": "2024-05-27T02:23:37.762549Z", |
| | | * "duration": "777.999202s", |
| | | * "trafficToWaypoint": { |
| | | * "speedReadingInterval": [ |
| | | * { |
| | | * "endPolylinePointIndex": 284, |
| | | * "speed": "NORMAL" |
| | | * } |
| | | * ], |
| | | * "encodedPathToWaypoint": "AhqdAq8NM2ZcYrZmDgDo4Z0B7887ka5C0v0Y8aUejs8f7gL98gGstAWPpQLU5gvsfcf3JPiXJ8vEDosr0coVsuEEwtYElQ2h6QGXHron0ALV4gTRlQHdiqEC5rWzAq6zBVPRrAX0rQS9mAGazgTx5ASmZ7EknJ4B2ALyGPAC8QO9DKY58RGtGoYGtASJEYAGxkzyFulZ0BbAEpOQAuQR2FfPlgKolAveP7u0CdC_JIy7Aojb6QHL2_EElKUCpgGgsiTbqQHHlgKPqAjHR8SIgQHnhinsjwqhFfZGk-cKlLUIy8cC498CxF28pwLcrginpiGQm5sB36aFAcuTJPCWCdiUCeh1w94JR7PiAsCKC-cTo-MLrLAm3JQJp7ML07sh4KEC0xLMhZAB65U6oO4m_7gh6IkLz-oh2-MCwLAC5OwC-wGbsQuouwiD9gKQsQLPQ_BN0-ICxwWo2QS3zwG_DewHyiTaBbcdzwimVL0jnYMC-5IC8VH3BcBDr2mVFLMKqQX0kQG54QH-Pqm3AdIHirsB8YEBooEBvSDF7QWK4wWhkUbymkPLCNEG_gi1nwTqnATlvgSupwEo5pwExgONJhj9CKEspblC2sVHwaYX8qYXheQF3rsBkrIBgcYRqoMBlpQBx4IB6owBhiq3jgGYpwGfuQHwuQWfKfUBmw70I5-5BeiREFPAC-cI8AgACFvHAgGIAq-HBcyYBefJFMjkFK-fFMyyBbOhAYCREIe_EbeFAcSSAY-wAegI_LwQ6I4BjW3r-hL8gRb_5gXkuAH7AcwMq8IE1C2ckgGHJ_wv--oEkLkBjC3ng17sxooCw5gBwAvz5hCM9BHzsxHomAHcqwW1jQX6gQWpvwGOuwGl-wWSgBPVxATZAa31BP7KEqnFE8LBBL0aiqsOnHBf-pIF6Q6ABNIHxTzezhLl3gSMDcXUBQzCiQG5pAHKiQTdsgGStAGQigGhkgXAuwWXhBD4lhSXlxScMtjEBfubAb-fBOAOgOsEiLETAA==" |
| | | * } |
| | | * } |
| | | * ], |
| | | * "currentRouteSegmentVersion": "2024-05-27T02:10:39.773373Z", |
| | | * "remainingWaypointsVersion": "2024-05-27T02:05:37.941167Z", |
| | | * "currentRouteSegmentEndPoint": { |
| | | * "location": { |
| | | * "point": { |
| | | * "latitude": 30.604131, |
| | | * "longitude": 104.151957 |
| | | * } |
| | | * }, |
| | | * "tripId": "I-GO-RIDE1", |
| | | * "waypointType": "PICKUP_WAYPOINT_TYPE" |
| | | * }, |
| | | * "remainingWaypointsRouteVersion": "2024-05-27T02:10:39.773373Z", |
| | | * "currentRouteSegmentTrafficVersion": "2024-05-27T02:10:39.773373Z", |
| | | * "view": "SDK" |
| | | * } |
| | | */ |
| | | |
| | | return response.body(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | public class GoogleMapUtil { |
| | | |
| | | private final static String key = "AIzaSyA_FEliOkbkL1IAHQsnBpbpo9MlIp729H0"; |
| | | private final static String key = "AIzaSyCG6PsfkaCEc94VK2vIAZk1YYKvOS_Ewts"; |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | // /** |
| | | // * 线下支付数据推送 |
| | | // * @param type |
| | | // * @param uid |
| | | // * @param orderId |
| | | // * @param orderType |
| | | // */ |
| | | // public void pushOfflinePayment(Integer type, Integer uid, Integer orderId, Integer orderType){ |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject.put("code", 200); |
| | | // jsonObject.put("msg", "SUCCESS"); |
| | | // jsonObject.put("method", "OFFLINE_PAYMENT"); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("orderId", orderId); |
| | | // map.put("orderType", orderType); |
| | | // jsonObject.put("data", map); |
| | | // |
| | | // //调用推送 |
| | | // HttpHeaders headers = new HttpHeaders(); |
| | | // // 以表单的方式提交 |
| | | // headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | // //将请求头部和参数合成一个请求 |
| | | // MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | // params.add("msg", jsonObject.toJSONString()); |
| | | // params.add("id", String.valueOf(uid)); |
| | | // params.add("type", String.valueOf(type)); |
| | | // HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | // String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | // JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | // if(jsonObject1.getIntValue("code") != 200){ |
| | | // System.err.println(jsonObject1.getString("msg")); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 司机超时提醒 |
| | | * @param type |
| | | * @param uid |
| | | * @param orderId |
| | | * @param orderType |
| | | */ |
| | | public void pushDriverTimeOut(Integer type, Integer uid, Integer orderId, Integer orderType){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | | jsonObject.put("method", "DRIVER_TIME_OUT"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("orderId", orderId); |
| | | map.put("orderType", orderType); |
| | | jsonObject.put("data", map); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", jsonObject.toJSONString()); |
| | | params.add("id", String.valueOf(uid)); |
| | | params.add("type", String.valueOf(type)); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改目的地推送通知 |
| | | * @param type |
| | | * @param uid |
| | | * @param orderId |
| | | * @param orderType |
| | | * @param status 1=申请,2=同意,3=拒绝 |
| | | */ |
| | | public void pushModifyAddress(Integer type, Integer uid, Integer orderId, Integer orderType, Integer status){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | | jsonObject.put("method", "MODIFY_ADDRESS"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("orderId", orderId); |
| | | map.put("orderType", orderType); |
| | | map.put("status", status); |
| | | jsonObject.put("data", map); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", jsonObject.toJSONString()); |
| | | params.add("id", String.valueOf(uid)); |
| | | params.add("type", String.valueOf(type)); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 小件物流差价支付的推送 |
| | | * @param type |
| | | * @param uid |
| | | * @param orderId |
| | | * @param orderType |
| | | * @param money |
| | | * @param status 1=申请,2=同意,3=拒绝 |
| | | */ |
| | | public void pushPayDifference(Integer type, Integer uid, Integer orderId, Integer orderType, Double money, Integer status){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | | jsonObject.put("method", "DIFFERENCE"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("orderId", orderId); |
| | | map.put("orderType", orderType); |
| | | map.put("money", money); |
| | | map.put("status", status); |
| | | jsonObject.put("data", map); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", jsonObject.toJSONString()); |
| | | params.add("id", String.valueOf(uid)); |
| | | params.add("type", String.valueOf(type)); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * Cellulant短信 |
| | | * 短信 : https://www.nalosolutions.com/ |
| | | * @param toPhone |
| | | * @param msg |
| | | * @return |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/19 14:41 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class MyRedEnvelope { |
| | | @ApiModelProperty("主键id") |
| | | private Integer id; |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | @ApiModelProperty("内容") |
| | | private String content; |
| | | @ApiModelProperty("金额") |
| | | private Double amount = 0D; |
| | | @ApiModelProperty("当前可用余额") |
| | | private Double remainingAmount; |
| | | @ApiModelProperty("红包总额") |
| | | private Double totalAmount; |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.system.model.OrderPosition; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | @ApiModel("订单详情") |
| | | public class OrderInfoWarpper { |
| | | @ApiModelProperty("订单id") |
| | |
| | | private Integer orderType; |
| | | @ApiModelProperty("订单类型(1=普通订单,2=摆渡车)") |
| | | private Integer type; |
| | | @ApiModelProperty("订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付)") |
| | | @ApiModelProperty("订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付,13=补差价)") |
| | | private Integer state; |
| | | @ApiModelProperty("下单时间") |
| | | private String insertTime; |
| | |
| | | private Double discount; |
| | | @ApiModelProperty("折扣优惠金额") |
| | | private Double discountMoney; |
| | | @ApiModelProperty("补差价金额") |
| | | private Double priceDifference; |
| | | @ApiModelProperty("订单支付金额") |
| | | private Double payMoney; |
| | | @ApiModelProperty("订单支付方式(1=手机支付,2=银行卡支付,3=余额支付,4=现金支付)") |
| | |
| | | private String remark; |
| | | @ApiModelProperty("是否首单免费1否,2是") |
| | | private String isFree; |
| | | |
| | | /** |
| | | * 收费方式(1=普通,2=夜间,3=高峰) |
| | | */ |
| | | @ApiModelProperty("收费方式(1=普通,2=夜间,3=高峰)") |
| | | private Integer moneyType; |
| | | /** |
| | | * 收费方式时间段 |
| | | */ |
| | | @ApiModelProperty("收费方式时间段") |
| | | private String moneyTime; |
| | | |
| | | private Integer startDuration; |
| | | /** |
| | | * 收据链接 |
| | | */ |
| | | @ApiModelProperty("收据链接") |
| | | private String receipt; |
| | | |
| | | |
| | | public Integer getStartDuration() { |
| | | return startDuration; |
| | | } |
| | | |
| | | public void setStartDuration(Integer startDuration) { |
| | | this.startDuration = startDuration; |
| | | } |
| | | |
| | | public Integer getMoneyType() { |
| | | return moneyType; |
| | | } |
| | | |
| | | public void setMoneyType(Integer moneyType) { |
| | | this.moneyType = moneyType; |
| | | } |
| | | |
| | | public String getMoneyTime() { |
| | | return moneyTime; |
| | | } |
| | | |
| | | public void setMoneyTime(String moneyTime) { |
| | | this.moneyTime = moneyTime; |
| | | } |
| | | |
| | | @ApiModelProperty("是否冻结(1=否,2=是)") |
| | | private Integer isFrozen; |
| | | @ApiModelProperty("司机接单时间") |
| | | private String snatchOrderTime; |
| | | @ApiModelProperty("超时取消时间") |
| | | private Integer timeOutCancel; |
| | | private String tripId; |
| | | private List<OrderPosition> orderPositionList; |
| | | |
| | | public List<OrderPosition> getOrderPositionList() { |
| | | return orderPositionList; |
| | | } |
| | | |
| | | public void setOrderPositionList(List<OrderPosition> orderPositionList) { |
| | | this.orderPositionList = orderPositionList; |
| | | } |
| | | |
| | | public String getIsFree() { |
| | | return isFree; |
| | | } |
| | | |
| | | public void setIsFree(String isFree) { |
| | | this.isFree = isFree; |
| | | } |
| | | |
| | | public Integer getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public void setOrderId(Integer orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public String getTravelTime() { |
| | | return travelTime; |
| | | } |
| | | |
| | | public void setTravelTime(String travelTime) { |
| | | this.travelTime = travelTime; |
| | | } |
| | | |
| | | public String getStartAddress() { |
| | | return startAddress; |
| | | } |
| | | |
| | | public void setStartAddress(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | public String getEndAddress() { |
| | | return endAddress; |
| | | } |
| | | |
| | | public void setEndAddress(String endAddress) { |
| | | this.endAddress = endAddress; |
| | | } |
| | | |
| | | public Integer getDriverId() { |
| | | return driverId; |
| | | } |
| | | |
| | | public void setDriverId(Integer driverId) { |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public String getDriverAvatar() { |
| | | return driverAvatar; |
| | | } |
| | | |
| | | public void setDriverAvatar(String driverAvatar) { |
| | | this.driverAvatar = driverAvatar; |
| | | } |
| | | |
| | | public String getDriverName() { |
| | | return driverName; |
| | | } |
| | | |
| | | public void setDriverName(String driverName) { |
| | | this.driverName = driverName; |
| | | } |
| | | |
| | | public String getLicensePlate() { |
| | | return licensePlate; |
| | | } |
| | | |
| | | public void setLicensePlate(String licensePlate) { |
| | | this.licensePlate = licensePlate; |
| | | } |
| | | |
| | | public String getBrand() { |
| | | return brand; |
| | | } |
| | | |
| | | public void setBrand(String brand) { |
| | | this.brand = brand; |
| | | } |
| | | |
| | | public Double getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(Double score) { |
| | | this.score = score; |
| | | } |
| | | |
| | | public Integer getOrderNum() { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(Integer orderNum) { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | public String getDriverPhone() { |
| | | return driverPhone; |
| | | } |
| | | |
| | | public void setDriverPhone(String driverPhone) { |
| | | this.driverPhone = driverPhone; |
| | | } |
| | | |
| | | public Double getCancelPayMoney() { |
| | | return cancelPayMoney; |
| | | } |
| | | |
| | | public void setCancelPayMoney(Double cancelPayMoney) { |
| | | this.cancelPayMoney = cancelPayMoney; |
| | | } |
| | | |
| | | public Double getPayMoney() { |
| | | return payMoney; |
| | | } |
| | | |
| | | public void setPayMoney(Double payMoney) { |
| | | this.payMoney = payMoney; |
| | | } |
| | | |
| | | public Double getTipMoney() { |
| | | return tipMoney; |
| | | } |
| | | |
| | | public void setTipMoney(Double tipMoney) { |
| | | this.tipMoney = tipMoney; |
| | | } |
| | | |
| | | public Double getOrderMoney() { |
| | | return orderMoney; |
| | | } |
| | | |
| | | public void setOrderMoney(Double orderMoney) { |
| | | this.orderMoney = orderMoney; |
| | | } |
| | | |
| | | public Double getStartMoney() { |
| | | return startMoney; |
| | | } |
| | | |
| | | public void setStartMoney(Double startMoney) { |
| | | this.startMoney = startMoney; |
| | | } |
| | | |
| | | public Double getMileageMoney() { |
| | | return mileageMoney; |
| | | } |
| | | |
| | | public void setMileageMoney(Double mileageMoney) { |
| | | this.mileageMoney = mileageMoney; |
| | | } |
| | | |
| | | public Double getDurationMoney() { |
| | | return durationMoney; |
| | | } |
| | | |
| | | public void setDurationMoney(Double durationMoney) { |
| | | this.durationMoney = durationMoney; |
| | | } |
| | | |
| | | public Double getLongDistanceMoney() { |
| | | return longDistanceMoney; |
| | | } |
| | | |
| | | public void setLongDistanceMoney(Double longDistanceMoney) { |
| | | this.longDistanceMoney = longDistanceMoney; |
| | | } |
| | | |
| | | public String getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(String insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public String getArriveTime() { |
| | | return arriveTime; |
| | | } |
| | | |
| | | public void setArriveTime(String arriveTime) { |
| | | this.arriveTime = arriveTime; |
| | | } |
| | | |
| | | public Double getStartLon() { |
| | | return startLon; |
| | | } |
| | | |
| | | public void setStartLon(Double startLon) { |
| | | this.startLon = startLon; |
| | | } |
| | | |
| | | public Double getStartLat() { |
| | | return startLat; |
| | | } |
| | | |
| | | public void setStartLat(Double startLat) { |
| | | this.startLat = startLat; |
| | | } |
| | | |
| | | public Double getEndLon() { |
| | | return endLon; |
| | | } |
| | | |
| | | public void setEndLon(Double endLon) { |
| | | this.endLon = endLon; |
| | | } |
| | | |
| | | public Double getEndLat() { |
| | | return endLat; |
| | | } |
| | | |
| | | public void setEndLat(Double endLat) { |
| | | this.endLat = endLat; |
| | | } |
| | | |
| | | public Integer getOrderScore() { |
| | | return orderScore; |
| | | } |
| | | |
| | | public void setOrderScore(Integer orderScore) { |
| | | this.orderScore = orderScore; |
| | | } |
| | | |
| | | public String getEvaluate() { |
| | | return evaluate; |
| | | } |
| | | |
| | | public void setEvaluate(String evaluate) { |
| | | this.evaluate = evaluate; |
| | | } |
| | | |
| | | public String getCarColor() { |
| | | return carColor; |
| | | } |
| | | |
| | | public void setCarColor(String carColor) { |
| | | this.carColor = carColor; |
| | | } |
| | | |
| | | public Integer getCancelId() { |
| | | return cancelId; |
| | | } |
| | | |
| | | public void setCancelId(Integer cancelId) { |
| | | this.cancelId = cancelId; |
| | | } |
| | | |
| | | public Double getTravelMoney() { |
| | | return travelMoney; |
| | | } |
| | | |
| | | public void setTravelMoney(Double travelMoney) { |
| | | this.travelMoney = travelMoney; |
| | | } |
| | | |
| | | public Double getParkMoney() { |
| | | return parkMoney; |
| | | } |
| | | |
| | | public void setParkMoney(Double parkMoney) { |
| | | this.parkMoney = parkMoney; |
| | | } |
| | | |
| | | public Double getRoadTollMoney() { |
| | | return roadTollMoney; |
| | | } |
| | | |
| | | public void setRoadTollMoney(Double roadTollMoney) { |
| | | this.roadTollMoney = roadTollMoney; |
| | | } |
| | | |
| | | public Double getRedPacketMoney() { |
| | | return redPacketMoney; |
| | | } |
| | | |
| | | public void setRedPacketMoney(Double redPacketMoney) { |
| | | this.redPacketMoney = redPacketMoney; |
| | | } |
| | | |
| | | public Double getCouponMoney() { |
| | | return couponMoney; |
| | | } |
| | | |
| | | public void setCouponMoney(Double couponMoney) { |
| | | this.couponMoney = couponMoney; |
| | | } |
| | | |
| | | public Double getDiscountMoney() { |
| | | return discountMoney; |
| | | } |
| | | |
| | | public void setDiscountMoney(Double discountMoney) { |
| | | this.discountMoney = discountMoney; |
| | | } |
| | | |
| | | public Integer getDevice() { |
| | | return device; |
| | | } |
| | | |
| | | public void setDevice(Integer device) { |
| | | this.device = device; |
| | | } |
| | | |
| | | public Integer getPeopleNumber() { |
| | | return peopleNumber; |
| | | } |
| | | |
| | | public void setPeopleNumber(Integer peopleNumber) { |
| | | this.peopleNumber = peopleNumber; |
| | | } |
| | | |
| | | public String getSeatNumber() { |
| | | return seatNumber; |
| | | } |
| | | |
| | | public void setSeatNumber(String seatNumber) { |
| | | this.seatNumber = seatNumber; |
| | | } |
| | | |
| | | public Double getMileage() { |
| | | return mileage; |
| | | } |
| | | |
| | | public void setMileage(Double mileage) { |
| | | this.mileage = mileage; |
| | | } |
| | | |
| | | public Double getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(Double duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public Double getWait() { |
| | | return wait; |
| | | } |
| | | |
| | | public void setWait(Double wait) { |
| | | this.wait = wait; |
| | | } |
| | | |
| | | public Double getWaitMoney() { |
| | | return waitMoney; |
| | | } |
| | | |
| | | public void setWaitMoney(Double waitMoney) { |
| | | this.waitMoney = waitMoney; |
| | | } |
| | | |
| | | public Double getLongDistance() { |
| | | return longDistance; |
| | | } |
| | | |
| | | public void setLongDistance(Double longDistance) { |
| | | this.longDistance = longDistance; |
| | | } |
| | | |
| | | public Double getStartMileage() { |
| | | return startMileage; |
| | | } |
| | | |
| | | public void setStartMileage(Double startMileage) { |
| | | this.startMileage = startMileage; |
| | | } |
| | | |
| | | public String getTravelTime1() { |
| | | return travelTime1; |
| | | } |
| | | |
| | | public void setTravelTime1(String travelTime1) { |
| | | this.travelTime1 = travelTime1; |
| | | } |
| | | |
| | | public Double getDiscount() { |
| | | return discount; |
| | | } |
| | | |
| | | public void setDiscount(Double discount) { |
| | | this.discount = discount; |
| | | } |
| | | |
| | | public Integer getCancelUserType() { |
| | | return cancelUserType; |
| | | } |
| | | |
| | | public void setCancelUserType(Integer cancelUserType) { |
| | | this.cancelUserType = cancelUserType; |
| | | } |
| | | |
| | | public Double getCancelMoney() { |
| | | return cancelMoney; |
| | | } |
| | | |
| | | public void setCancelMoney(Double cancelMoney) { |
| | | this.cancelMoney = cancelMoney; |
| | | } |
| | | |
| | | public String getCancelReason() { |
| | | return cancelReason; |
| | | } |
| | | |
| | | public void setCancelReason(String cancelReason) { |
| | | this.cancelReason = cancelReason; |
| | | } |
| | | |
| | | public String getCancelRemark() { |
| | | return cancelRemark; |
| | | } |
| | | |
| | | public void setCancelRemark(String cancelRemark) { |
| | | this.cancelRemark = cancelRemark; |
| | | } |
| | | |
| | | public String getStartCity() { |
| | | return startCity; |
| | | } |
| | | |
| | | public void setStartCity(String startCity) { |
| | | this.startCity = startCity; |
| | | } |
| | | |
| | | public String getEndCity() { |
| | | return endCity; |
| | | } |
| | | |
| | | public void setEndCity(String endCity) { |
| | | this.endCity = endCity; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public String getLineShiftTime() { |
| | | return lineShiftTime; |
| | | } |
| | | |
| | | public void setLineShiftTime(String lineShiftTime) { |
| | | this.lineShiftTime = lineShiftTime; |
| | | } |
| | | |
| | | public Integer getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public void setPayType(Integer payType) { |
| | | this.payType = payType; |
| | | } |
| | | |
| | | public String getReceipt() { |
| | | return receipt; |
| | | } |
| | | |
| | | public void setReceipt(String receipt) { |
| | | this.receipt = receipt; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderInfoWarpper{" + |
| | | "orderId=" + orderId + |
| | | ", type=" + type + |
| | | ", state=" + state + |
| | | ", insertTime='" + insertTime + '\'' + |
| | | ", travelTime='" + travelTime + '\'' + |
| | | ", travelTime1='" + travelTime1 + '\'' + |
| | | ", arriveTime='" + arriveTime + '\'' + |
| | | ", startLon=" + startLon + |
| | | ", startLat=" + startLat + |
| | | ", startAddress='" + startAddress + '\'' + |
| | | ", startCity='" + startCity + '\'' + |
| | | ", endLon=" + endLon + |
| | | ", endLat=" + endLat + |
| | | ", endAddress='" + endAddress + '\'' + |
| | | ", endCity='" + endCity + '\'' + |
| | | ", driverId=" + driverId + |
| | | ", driverAvatar='" + driverAvatar + '\'' + |
| | | ", driverName='" + driverName + '\'' + |
| | | ", licensePlate='" + licensePlate + '\'' + |
| | | ", brand='" + brand + '\'' + |
| | | ", carColor='" + carColor + '\'' + |
| | | ", score=" + score + |
| | | ", orderNum=" + orderNum + |
| | | ", driverPhone='" + driverPhone + '\'' + |
| | | ", cancelPayMoney=" + cancelPayMoney + |
| | | ", cancelId=" + cancelId + |
| | | ", orderMoney=" + orderMoney + |
| | | ", startMoney=" + startMoney + |
| | | ", startMileage=" + startMileage + |
| | | ", mileage=" + mileage + |
| | | ", mileageMoney=" + mileageMoney + |
| | | ", duration=" + duration + |
| | | ", durationMoney=" + durationMoney + |
| | | ", wait=" + wait + |
| | | ", waitMoney=" + waitMoney + |
| | | ", longDistance=" + longDistance + |
| | | ", longDistanceMoney=" + longDistanceMoney + |
| | | ", travelMoney=" + travelMoney + |
| | | ", parkMoney=" + parkMoney + |
| | | ", roadTollMoney=" + roadTollMoney + |
| | | ", redPacketMoney=" + redPacketMoney + |
| | | ", couponMoney=" + couponMoney + |
| | | ", discount=" + discount + |
| | | ", discountMoney=" + discountMoney + |
| | | ", payMoney=" + payMoney + |
| | | ", tipMoney=" + tipMoney + |
| | | ", orderScore=" + orderScore + |
| | | ", evaluate='" + evaluate + '\'' + |
| | | ", device=" + device + |
| | | ", peopleNumber=" + peopleNumber + |
| | | ", seatNumber='" + seatNumber + '\'' + |
| | | ", cancelUserType=" + cancelUserType + |
| | | ", cancelMoney=" + cancelMoney + |
| | | ", cancelReason='" + cancelReason + '\'' + |
| | | ", cancelRemark='" + cancelRemark + '\'' + |
| | | '}'; |
| | | } |
| | | |
| | | public static OrderInfoWarpper getOrderInfoWarpper(Map<String, Object> map){ |
| | | OrderInfoWarpper orderInfoWarpper = new OrderInfoWarpper(); |
| | |
| | | orderInfoWarpper.setMoneyTime(null != map.get("moneyTime") ? map.get("moneyTime").toString() :""); |
| | | orderInfoWarpper.setPayType(null != map.get("payType") ? Integer.valueOf(map.get("payType").toString()) : 4); |
| | | orderInfoWarpper.setReceipt(null != map.get("receipt") ? map.get("receipt").toString() : ""); |
| | | orderInfoWarpper.setIsFrozen(null != map.get("isFrozen") ? Integer.valueOf(map.get("isFrozen").toString()) : 1); |
| | | orderInfoWarpper.setTimeOutCancel(null != map.get("timeOutCancel") ? Integer.valueOf(map.get("timeOutCancel").toString()) : 0); |
| | | orderInfoWarpper.setSnatchOrderTime(null != map.get("snatchOrderTime") ? map.get("snatchOrderTime").toString() : ""); |
| | | orderInfoWarpper.setPriceDifference(null != map.get("priceDifference") ? Double.valueOf(map.get("priceDifference").toString()) : 0); |
| | | orderInfoWarpper.setTripId(null != map.get("tripId") ? map.get("tripId").toString() : ""); |
| | | } |
| | | if(orderInfoWarpper.getState()==7){ |
| | | orderInfoWarpper.setOrderMoney(orderInfoWarpper.getOrderMoney()-orderInfoWarpper.getDiscountMoney()); |
| | |
| | | @ApiModelProperty("订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付)") |
| | | private Integer state; |
| | | |
| | | private String tripId; |
| | | |
| | | public Integer getOrderId() { |
| | | return orderId; |
| | | } |
| | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public String getTripId() { |
| | | return tripId; |
| | | } |
| | | |
| | | public void setTripId(String tripId) { |
| | | this.tripId = tripId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/18 11:23 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class OrderTimeInfo { |
| | | @ApiModelProperty("接单时间") |
| | | private String snatchOrderTime; |
| | | @ApiModelProperty("取件时间") |
| | | private String startServiceTime; |
| | | @ApiModelProperty("目前用时") |
| | | private String usedTime; |
| | | @ApiModelProperty("剩余时间") |
| | | private String remainingTime; |
| | | @ApiModelProperty("送达时间") |
| | | private String endServiceTime; |
| | | @ApiModelProperty("整体里程") |
| | | private Double allMileage; |
| | | @ApiModelProperty("当前里程") |
| | | private Double mileage; |
| | | } |
| | |
| | | @ApiModelProperty("司机id") |
| | | private Integer driverId; |
| | | @ApiModelProperty("订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付)<br/>" + |
| | | "小件物流订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待取货,5=送货中,6=已送达,7=待支付,8=需补差价,9=已取货,10=已取消,11=已支付差价") |
| | | "小件物流订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付,13=补差价") |
| | | private Integer state; |
| | | @ApiModelProperty("货物类型(小件物流)") |
| | | private String cargoType; |
| | |
| | | private Long insertTime; |
| | | @ApiModelProperty("收据链接") |
| | | private String receipt; |
| | | @ApiModelProperty("是否冻结(1=否,2=是)") |
| | | private Integer isFrozen; |
| | | @ApiModelProperty("中途取消(0=否,1=是)") |
| | | private Integer cancelMidway; |
| | | |
| | | private String tripId; |
| | | |
| | | public Integer getOrderId() { |
| | | return orderId; |
| | |
| | | orderWarpper.setServerCarModel(null != map.get("serverCarModel") ? String.valueOf(map.get("serverCarModel")) : ""); |
| | | orderWarpper.setDifferenceMoney(null != map.get("differenceMoney") ? Double.valueOf(map.get("differenceMoney").toString()) : 0D); |
| | | orderWarpper.setReceipt(null != map.get("receipt") ? String.valueOf(map.get("receipt")) : ""); |
| | | orderWarpper.setIsFrozen(null != map.get("isFrozen") ? Integer.valueOf(String.valueOf(map.get("isFrozen"))) : 1); |
| | | orderWarpper.setCancelMidway(null != map.get("cancelMidway") ? Integer.valueOf(String.valueOf(map.get("cancelMidway"))) : 0); |
| | | orderWarpper.setTripId(null != map.get("tripId") ? String.valueOf(map.get("tripId")) : ""); |
| | | list.add(orderWarpper); |
| | | } |
| | | } |
| | |
| | | return list; |
| | | } |
| | | |
| | | public Integer getIsFrozen() { |
| | | return isFrozen; |
| | | } |
| | | |
| | | public void setIsFrozen(Integer isFrozen) { |
| | | this.isFrozen = isFrozen; |
| | | } |
| | | |
| | | public Integer getCancelMidway() { |
| | | return cancelMidway; |
| | | } |
| | | |
| | | public void setCancelMidway(Integer cancelMidway) { |
| | | this.cancelMidway = cancelMidway; |
| | | } |
| | | |
| | | public String getTripId() { |
| | | return tripId; |
| | | } |
| | | |
| | | public void setTripId(String tripId) { |
| | | this.tripId = tripId; |
| | | } |
| | | |
| | | @Override |
| | | public int compareTo(Object o) { |
| | | if (o instanceof OrderWarpper) { |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 个人中心消费记录列表 |
| | | */ |
| | | @ApiModel("消费记录") |
| | | public class TravelRecordListWarpper implements Comparable { |
| | | @ApiModelProperty("金额") |
| | | private Double money; |
| | | @ApiModelProperty("时间") |
| | | private String time; |
| | | @ApiModelProperty("订单名称") |
| | | private String name; |
| | | private Long insertTime; |
| | | @ApiModelProperty("已使用总额") |
| | | private Double total; |
| | | |
| | | |
| | | public Double getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(Double money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public String getTime() { |
| | | return time; |
| | | } |
| | | |
| | | public void setTime(String time) { |
| | | this.time = time; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Long getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Long insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Double getTotal() { |
| | | return total; |
| | | } |
| | | |
| | | public void setTotal(Double total) { |
| | | this.total = total; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "TravelRecordWarpper{" + |
| | | "money=" + money + |
| | | ", time='" + time + '\'' + |
| | | ", name='" + name + '\'' + |
| | | ", insertTime=" + insertTime + |
| | | '}'; |
| | | } |
| | | |
| | | |
| | | public static List<TravelRecordListWarpper> getTravelRecordWarpper(List<Map<String, Object>> maps){ |
| | | List<TravelRecordListWarpper> list = new ArrayList<>(); |
| | | if(null != maps){ |
| | | for(Map<String, Object> map : maps){ |
| | | TravelRecordListWarpper travelRecordWarpper = new TravelRecordListWarpper(); |
| | | travelRecordWarpper.setMoney(null != map.get("money") ? Double.valueOf(String.valueOf(map.get("money"))) : 0); |
| | | travelRecordWarpper.setTime(null != map.get("time") ? String.valueOf(map.get("time")) : ""); |
| | | travelRecordWarpper.setName(null != map.get("name") ? String.valueOf(map.get("name")) : ""); |
| | | travelRecordWarpper.setInsertTime(null != map.get("insertTime") ? Long.valueOf(String.valueOf(map.get("insertTime"))) : 0); |
| | | travelRecordWarpper.setTotal(null != map.get("total") ? Double.valueOf(String.valueOf(map.get("total"))) : 0); |
| | | list.add(travelRecordWarpper); |
| | | } |
| | | } |
| | | Collections.sort(list); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public int compareTo(Object o) { |
| | | if (o instanceof TravelRecordListWarpper) { |
| | | TravelRecordListWarpper s = (TravelRecordListWarpper) o; |
| | | if(this.insertTime == null || s.insertTime == null){ |
| | | return -1; |
| | | } |
| | | if (this.insertTime > s.insertTime) { |
| | | return -1; |
| | | } else if (this.insertTime == s.insertTime) { |
| | | return 0; |
| | | } else { |
| | | return 1; |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | } |
| | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 个人中心消费记录列表 |
| | | * @author zhibing.pu |
| | | * @Date 2024/4/19 16:08 |
| | | */ |
| | | @ApiModel("消费记录") |
| | | public class TravelRecordWarpper implements Comparable { |
| | | @ApiModelProperty("金额") |
| | | private Double money; |
| | | @ApiModelProperty("时间") |
| | | private String time; |
| | | @ApiModelProperty("订单名称") |
| | | private String name; |
| | | private Long insertTime; |
| | | |
| | | |
| | | public Double getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(Double money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public String getTime() { |
| | | return time; |
| | | } |
| | | |
| | | public void setTime(String time) { |
| | | this.time = time; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Long getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Long insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "TravelRecordWarpper{" + |
| | | "money=" + money + |
| | | ", time='" + time + '\'' + |
| | | ", name='" + name + '\'' + |
| | | ", insertTime=" + insertTime + |
| | | '}'; |
| | | } |
| | | |
| | | |
| | | public static List<TravelRecordWarpper> getTravelRecordWarpper(List<Map<String, Object>> maps){ |
| | | List<TravelRecordWarpper> list = new ArrayList<>(); |
| | | if(null != maps){ |
| | | for(Map<String, Object> map : maps){ |
| | | TravelRecordWarpper travelRecordWarpper = new TravelRecordWarpper(); |
| | | travelRecordWarpper.setMoney(null != map.get("money") ? Double.valueOf(String.valueOf(map.get("money"))) : 0); |
| | | travelRecordWarpper.setTime(null != map.get("time") ? String.valueOf(map.get("time")) : ""); |
| | | travelRecordWarpper.setName(null != map.get("name") ? String.valueOf(map.get("name")) : ""); |
| | | travelRecordWarpper.setInsertTime(null != map.get("insertTime") ? Long.valueOf(String.valueOf(map.get("insertTime"))) : 0); |
| | | list.add(travelRecordWarpper); |
| | | } |
| | | } |
| | | Collections.sort(list); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public int compareTo(Object o) { |
| | | if (o instanceof TravelRecordWarpper) { |
| | | TravelRecordWarpper s = (TravelRecordWarpper) o; |
| | | if(this.insertTime == null || s.insertTime == null){ |
| | | return -1; |
| | | } |
| | | if (this.insertTime > s.insertTime) { |
| | | return -1; |
| | | } else if (this.insertTime == s.insertTime) { |
| | | return 0; |
| | | } else { |
| | | return 1; |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | @Data |
| | | @ApiModel |
| | | public class TravelRecordWarpper { |
| | | @ApiModelProperty("已使用总额") |
| | | private Double total; |
| | | @ApiModelProperty("使用列表") |
| | | private List<TravelRecordListWarpper> list; |
| | | } |
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/WithdrawalVo.java
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/WithdrawalWarpper.java
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
UserIGOTravel/guns-admin/src/main/resources/application-dev.yml
UserIGOTravel/guns-admin/src/main/resources/application-produce.yml
UserIGOTravel/guns-admin/src/main/resources/application.yml
UserIGOTravel/guns-admin/src/main/resources/logback-spring.xml
UserIGOTravel/pom.xml |