| | |
| | | <description>guns 的spring boot版本</description> |
| | | |
| | | <packaging>jar</packaging> |
| | | |
| | | <dependencyManagement> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.google.cloud</groupId> |
| | | <artifactId>libraries-bom</artifactId> |
| | | <version>26.42.0</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | </dependencyManagement> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | |
| | | <artifactId>fleetengine-auth</artifactId> |
| | | <version>1.11.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.google.cloud</groupId> |
| | | <artifactId>google-cloud-texttospeech</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | // @PostConstruct |
| | | // void started() { |
| | | // TimeZone.setDefault(TimeZone.getTimeZone("GMT+0")); |
| | | // } |
| | | @PostConstruct |
| | | void started() { |
| | | TimeZone.setDefault(TimeZone.getTimeZone("GMT+0")); |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | 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.UserActivityDiscount1Mapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | |
| | | |
| | | @Autowired |
| | | private IUserRedPacketRecordService userRedPacketRecordService; |
| | | |
| | | @Resource |
| | | private UserActivityDiscount1Mapper userActivityDiscount1Mapper; |
| | | |
| | | /** |
| | | * 获取正在进行中的订单 |
| | |
| | | userId = orderPrivateCar.getUserId(); |
| | | state = orderPrivateCar.getState(); |
| | | if(null != driverId){ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, ""); |
| | | } |
| | | break; |
| | | case 2: |
| | |
| | | userId = orderTaxi.getUserId(); |
| | | state = orderTaxi.getState(); |
| | | if(null != driverId){ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, ""); |
| | | } |
| | | break; |
| | | case 3: |
| | |
| | | if(orderCrossCity.getPayMoney() == null && state == 10){//支付的情况才推送取消 |
| | | break; |
| | | }else{ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, ""); |
| | | } |
| | | break; |
| | | case 4: |
| | |
| | | if(orderLogistics.getPayMoney() == null && state == 10){//支付的情况才推送取消 |
| | | break; |
| | | }else{ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, ""); |
| | | } |
| | | break; |
| | | case 5: |
| | |
| | | if(orderLogistics1.getPayMoney() == null && state == 10){//支付的情况才推送取消 |
| | | break; |
| | | }else{ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, ""); |
| | | } |
| | | break; |
| | | } |
| | | pushUtil.pushOrderState(1, userId, id, orderType, state, 0); |
| | | pushUtil.pushOrderState(1, userId, id, orderType, state, 0, ""); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | case 1: |
| | | map = orderPrivateCarService.queryBalance(orderId, uid); |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | payMoney = orderPrivateCar.getPayMoney(); |
| | | payMoney = orderPrivateCar.getOrderMoney(); |
| | | UserActivityDiscount1 query = userActivityDiscount1Mapper.query(orderPrivateCar.getCompanyId()); |
| | | if(null != query){ |
| | | Integer orderNum=orderPrivateCarService.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId",orderPrivateCar.getUserId()).eq("activityId",query.getId()).last(" and to_days(getoffTime) = to_days(now())")); |
| | | if(query.getDistance()*1000>orderPrivateCar.getMileage() && query.getOrderNum()>orderNum){ |
| | | Double special = query.getSpecial(); |
| | | orderPrivateCar.setDiscount(special); |
| | | Double orderMoney = orderPrivateCar.getOrderMoney(); |
| | | double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | if(orderMoney.compareTo(v) > 0){ |
| | | payMoney = v; |
| | | } |
| | | } |
| | | |
| | | } |
| | | break; |
| | | // case 2: |
| | | // map = orderTaxiService.queryBalance(orderId, uid); |
| | |
| | | case 4: |
| | | map = orderLogisticsService.queryBalance(orderId, uid); |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | payMoney = orderLogistics.getPayMoney(); |
| | | payMoney = orderLogistics.getOrderMoney(); |
| | | UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderLogistics.getCompanyId()); |
| | | if(null != query2){ |
| | | Integer orderNum=orderLogisticsService.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.getLogistics(); |
| | | 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){ |
| | | payMoney = v; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | // case 5: |
| | | // map = orderLogisticsService.queryBalance(orderId, uid); |
| | |
| | | map.put("deductionAmount", 0D); |
| | | }else{ |
| | | Double deductionAmount = new BigDecimal(payMoney).multiply(redEnvelopePaymentSettings.getDeductionRatio().divide(new BigDecimal(100))).doubleValue(); |
| | | map.put("deductionAmount", deductionAmount); |
| | | map.put("deductionAmount", aDouble.compareTo(deductionAmount) >= 0 ? deductionAmount : aDouble); |
| | | } |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | |
| | | @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<MyRedEnvelope>> queryMyRedEnvelope(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | public ResultUtil<List<MyRedEnvelope>> queryMyRedEnvelope(Integer pageNum, Integer size, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | |
| | | 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.setName(null != map.get("name") ? String.valueOf(map.get("name")) : (language == 1 ? "指定发放" : language == 2 ? "Designated distribution" : "Distribution désignée")); |
| | | baseWarpper.setContent(null != map.get("insertTime") ? String.valueOf(map.get("insertTime")) : ""); |
| | | baseWarpper.setTotalAmount(sum); |
| | | baseWarpper.setRemainingAmount(sum1); |
| | |
| | | @PostMapping("/api/user/getFleetEngineAuth") |
| | | @ApiOperation(value = "获取google地图授权token", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "行程id", name = "tripId", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<Map<String, Object>> getFleetEngineAuth(HttpServletRequest request){ |
| | | public ResultUtil<Map<String, Object>> getFleetEngineAuth(String tripId, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Map<String, Object> s = fleetEngineUtil.fleetEngineAuth(1, uid); |
| | | Map<String, Object> s = fleetEngineUtil.fleetEngineAuth(1, tripId); |
| | | return ResultUtil.success(s); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/textToSpeech") |
| | | public String textToSpeech(String languageCode, String text, String fileName){ |
| | | try { |
| | | String s = TextToSpeechUtil.create(languageCode, text, fileName + ".mp3"); |
| | | //定时任务删除语音文件 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Process process = null; |
| | | try { |
| | | process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName + ".mp3"); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (process != null) { |
| | | process.destroy(); |
| | | } |
| | | } |
| | | }, 30000); |
| | | return s; |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | 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.pushOrderState(1, orderCrossCity.getUserId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0, ""); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | 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.pushOrderState(1, orderCrossCity.getUserId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0, ""); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | if(bo){ |
| | | continue; |
| | | } |
| | | pushUtil.pushOrderState(2, driver.getId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), pushOrder.getPushTime()); |
| | | pushUtil.pushOrderState(2, driver.getId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), pushOrder.getPushTime(), ""); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | pushUtil.pushOrderState(2, driver.getId(), orderTaxi.getId(), 2, orderTaxi.getState(), pushOrder.getPushTime()); |
| | | pushUtil.pushOrderState(2, driver.getId(), orderTaxi.getId(), 2, orderTaxi.getState(), pushOrder.getPushTime(), ""); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.stylefeng.guns.modular.smallLogistics.controller; |
| | | |
| | | |
| | | 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.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.Region; |
| | | import com.stylefeng.guns.modular.system.model.UserRedPacketRecord; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.service.IDriverServiceService; |
| | | 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.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.TextToSpeechUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderTimeInfo; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 小件物流控制器 |
| | |
| | | private IUserInfoService userInfoService; |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | if(null != orderLogistics.getStartServiceTime()){ |
| | | orderTimeInfo.setStartServiceTime(sdf.format(orderLogistics.getStartServiceTime())); |
| | | } |
| | | long time = System.currentTimeMillis() - orderLogistics.getSnatchOrderTime().getTime() / 60000; |
| | | //分钟 |
| | | long time = (System.currentTimeMillis() - orderLogistics.getSnatchOrderTime().getTime()) / 60000; |
| | | |
| | | int h = Double.valueOf(time / 60).intValue(); |
| | | long m = time % 60; |
| | |
| | | Long distance = distancematrix.getDistance(); |
| | | orderTimeInfo.setAllMileage(Double.valueOf(distance / 1000)); |
| | | orderTimeInfo.setMileage(orderLogistics.getMileage() / 1000); |
| | | String value = redisUtil.getValue("DRIVER" + orderLogistics.getDriverId()); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | String[] split = value.split(","); |
| | | distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(split[1]), Double.valueOf(split[0]), orderLogistics.getEndLat(), orderLogistics.getEndLon()); |
| | | //分钟 |
| | | Long duration = distancematrix.getDuration() / 60; |
| | | h = Double.valueOf(duration / 60).intValue(); |
| | | m = duration % 60; |
| | | String remainingTime = ""; |
| | | if(0 == h){ |
| | | remainingTime = language == 1 ? m + "分钟" : language == 2 ? m + "-minute" : m + "-minute"; |
| | | }else{ |
| | | remainingTime = language == 1 ? h + "小时" + m + "分钟" : language == 2 ? h + "-hour" + m + "-minute" : h + "-hour" + m + "-minute"; |
| | | } |
| | | orderTimeInfo.setRemainingTime(remainingTime); |
| | | } |
| | | return ResultUtil.success(orderTimeInfo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | }) |
| | | public ResultUtil confirmDifferencePrice(Integer orderId, Double difference, Integer status){ |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | if(1 == status){ |
| | | if(2 == status){ |
| | | orderLogistics.setPriceDifference(difference); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | } |
| | | pushUtil.pushPayDifference(2, orderLogistics.getDriverId(), orderId, 4, difference, status); |
| | | String audioUrl = ""; |
| | | if(3 == status){ |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | Integer language = driver.getLanguage(); |
| | | String text = ""; |
| | | switch (language){ |
| | | case 1: |
| | | text = "您的包裹订单申请补差价 GSH " + difference + " 已被用户拒绝,请重新与用户协商"; |
| | | break; |
| | | case 2: |
| | | text = "Your delivery order,Request difference GSH " + difference + " was rejected, please renegotiate with the subscriber"; |
| | | break; |
| | | case 3: |
| | | text = "Votre commande de livraison,Demande de différence GSH " + difference + " a été rejeté, veuillez renégocier avec l’abonné"; |
| | | break; |
| | | |
| | | } |
| | | try { |
| | | audioUrl = TextToSpeechUtil.create(language == 1 ? "cmn-CN" : language == 2 ? "en-US" : "fr-FR", text, "difference" + driver.getId() + ".mp3"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | //定时任务删除语音文件 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Process process = null; |
| | | try { |
| | | process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/difference" + driver.getId() + ".mp3"); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (process != null) { |
| | | process.destroy(); |
| | | } |
| | | } |
| | | }, 30000); |
| | | } |
| | | pushUtil.pushPayDifference(2, orderLogistics.getDriverId(), orderId, 4, difference, status, audioUrl); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryRedEnvelope(@Param("uid") Integer uid); |
| | | |
| | | |
| | | /** |
| | | * 根据状态数据订单数据 |
| | | * @param uid |
| | | * @param orderType |
| | | * @param state |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<OrderLogistics> queryByState(@Param("uid") Integer uid, @Param("orderType") Integer orderType, |
| | | @Param("type") Integer type, @Param("state") Integer...state) ; |
| | | } |
| | |
| | | ifnull(discountMoney, 0) as discountMoney, |
| | | (select price from t_order_logistics_spread where orderLogisticsId = a.id) as differenceMoney, |
| | | cancelMidway, |
| | | tripId |
| | | tripId, |
| | | remark |
| | | from t_order_logistics as a where userId = #{uid} and isDelete = 1 order by insertTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | |
| | | UNIX_TIMESTAMP(insertTime) as insertTime |
| | | from t_order_logistics where userId = #{uid} and state in (8, 9) and redPacketId is not null |
| | | </select> |
| | | |
| | | |
| | | <select id="queryByState" resultType="OrderLogistics"> |
| | | select * |
| | | from t_order_logistics where isDelete = 1 and isFrozen = 1 and userId = #{uid} |
| | | <if test="null != orderType"> |
| | | and orderType = #{orderType} |
| | | </if> |
| | | <if test="null != state"> |
| | | and state in |
| | | <foreach collection="state" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != type"> |
| | | and `type` = #{type} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | @TableField("payMoney") |
| | | private Double payMoney; |
| | | /** |
| | | * 状态(1=待接单,2=待出发,3=待到达预约地点,4=待取货,5=送货中,6=已送达,7=待支付,8=需补差价,9=已取货,10=已取消,11=改派中,12=已支付差价,13=取消待支付) |
| | | * 状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付,13=补差价) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | |
| | | */ |
| | | @TableField("tripId") |
| | | private String tripId; |
| | | /** |
| | | * 预估里程 |
| | | */ |
| | | @TableField("estimatedMileage") |
| | | private Double estimatedMileage; |
| | | /** |
| | | * 司机预估到达预约单时间 |
| | | */ |
| | | @TableField("estimateArriveTime") |
| | | private Date estimateArriveTime; |
| | | /** |
| | | * 司机预估距离预约点距离(米) |
| | | */ |
| | | @TableField("estimateArriveMileage") |
| | | private Long estimateArriveMileage; |
| | | /** |
| | | * 去往起点的路程数(米) |
| | | */ |
| | | @TableField("toStartPointMileage") |
| | | private Double toStartPointMileage; |
| | | /** |
| | | * 起步分钟 |
| | | */ |
| | | @TableField("startDuration") |
| | | private Integer startDuration; |
| | | } |
| | |
| | | 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 com.stylefeng.guns.modular.system.warpper.EndPushWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderServerWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryRedEnvelope(Integer language, Integer uid) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取服务中的订单数据 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | OrderServerWarpper queryOrderServer(Integer orderId, Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取下单推送完后没有司机下单的提醒 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | EndPushWarpper queryEndPush(Integer uid) throws Exception; |
| | | } |
| | |
| | | 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.system.warpper.EndPushWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderServerWarpper; |
| | | 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 org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileOutputStream; |
| | | import java.io.FileWriter; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | |
| | | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | |
| | | |
| | |
| | | if(bo){ |
| | | continue; |
| | | } |
| | | pushUtil.pushOrderState(2, driver.getId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), pushOrder.getPushTime()); |
| | | String text = ""; |
| | | Integer language1 = driver.getLanguage(); |
| | | switch (language1){ |
| | | case 1: |
| | | text = "收到新的包裹订单,从" + orderLogistics.getStartAddress() + "出发,全程约" + orderLogistics.getEstimatedMileage() + "公里"; |
| | | break; |
| | | case 2: |
| | | text = "Received a new delivery order, starting from " + orderLogistics.getStartAddress() + ", the whole journey is about " + orderLogistics.getEstimatedMileage() + "kilometre"; |
| | | break; |
| | | case 3: |
| | | text = "J'ai reçu une nouvelle commande de livraison, à partir de " + orderLogistics.getStartAddress() + ", le trajet complet est d’environ " + orderLogistics.getEstimatedMileage() + "kilométrage"; |
| | | break; |
| | | |
| | | } |
| | | String audioUrl = ""; |
| | | try { |
| | | audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, "pushOrder" + orderLogistics.getDriverId() + ".mp3"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | //定时任务删除语音文件 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Process process = null; |
| | | try { |
| | | process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/pushOrder" + orderLogistics.getDriverId() + ".mp3"); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (process != null) { |
| | | process.destroy(); |
| | | } |
| | | } |
| | | }, 30000); |
| | | pushUtil.pushOrderState(2, driver.getId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), pushOrder.getPushTime(), audioUrl); |
| | | } |
| | | } |
| | | Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 |
| | |
| | | orderLogistics.setInsertTime(new Date()); |
| | | orderLogistics.setTravelTime(new Date()); |
| | | orderLogistics.setOrderSource(orderSource); |
| | | orderLogistics.setRemark(remark); |
| | | if(orderSource == 2){//扫码下单 |
| | | Driver driver = driverService.selectById(driverId); |
| | | if(null == driver){ |
| | |
| | | CarService query1 = carServiceMapper.query(1, driver.getCarId()); |
| | | orderLogistics.setServerCarModelId(query1.getServerCarModelId()); |
| | | orderLogistics.setSnatchOrderTime(new Date()); |
| | | |
| | | String value = redisUtil.getValue("DRIVER" + driver.getId()); |
| | | if(ToolUtil.isNotEmpty(value)) { |
| | | String[] split = value.split(","); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0])); |
| | | //超时时间 |
| | | long timeOut = System.currentTimeMillis() + (distancematrix.getDuration() * 1000); |
| | | orderLogistics.setEstimateArriveTime(new Date(timeOut)); |
| | | orderLogistics.setEstimateArriveMileage(distancematrix.getDistance()); |
| | | } |
| | | driver.setState(3); |
| | | driverService.updateById(driver); |
| | | } |
| | |
| | | orderLogistics.setIsReassign(1); |
| | | orderLogistics.setIsDelete(1); |
| | | orderLogistics.setTripId(UUIDUtil.getRandomCode()); |
| | | DistancematrixVo distancematrix1 = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), orderLogistics.getEndLat(), orderLogistics.getEndLon()); |
| | | Long distance1 = distancematrix1.getDistance(); |
| | | orderLogistics.setEstimatedMileage(new BigDecimal(distance1).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | this.insert(orderLogistics); |
| | | |
| | | |
| | | new Thread(() -> { |
| | | try { |
| | | String vehicleId = null; |
| | | if(null != orderLogistics.getDriverId()){ |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | |
| | | fleetEngineUtil.createTrip(vehicleId, 1, orderLogistics.getTripId(), |
| | | orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(), orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | |
| | | if(orderSource == 2){//扫码下单 |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | String text = ""; |
| | | Integer language1 = driver.getLanguage(); |
| | | switch (language1){ |
| | | case 1: |
| | | text = "收到新的包裹订单,从" + orderLogistics.getStartAddress() + "出发,全程约" + orderLogistics.getEstimatedMileage() + "公里"; |
| | | break; |
| | | case 2: |
| | | text = "Received a new delivery order, starting from " + orderLogistics.getStartAddress() + ", the whole journey is about " + orderLogistics.getEstimatedMileage() + "kilometre"; |
| | | break; |
| | | case 3: |
| | | text = "J'ai reçu une nouvelle commande de livraison, à partir de " + orderLogistics.getStartAddress() + ", le trajet complet est d’environ " + orderLogistics.getEstimatedMileage() + "kilométrage"; |
| | | break; |
| | | |
| | | } |
| | | String audioUrl = ""; |
| | | try { |
| | | audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, "pushOrder" + orderLogistics.getDriverId() + ".mp3"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | //定时任务删除语音文件 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Process process = null; |
| | | try { |
| | | process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/pushOrder" + orderLogistics.getDriverId() + ".mp3"); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (process != null) { |
| | | process.destroy(); |
| | | } |
| | | } |
| | | }, 30000); |
| | | String finalAudioUrl = audioUrl; |
| | | 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); |
| | | pushUtil.pushOrderState(1, uid, orderLogistics.getId(), 4, 2, 0, ""); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, 2, 0, finalAudioUrl); |
| | | } |
| | | }).start(); |
| | | } |
| | |
| | | driverService.updateById(dr); |
| | | this.updateById(orderLogistics); |
| | | |
| | | String text = ""; |
| | | Integer language1 = dr.getLanguage(); |
| | | switch (language1){ |
| | | case 1: |
| | | text = "收到新的包裹订单,从" + orderLogistics.getStartAddress() + "出发,全程约" + orderLogistics.getEstimatedMileage() + "公里"; |
| | | break; |
| | | case 2: |
| | | text = "Received a new delivery order, starting from " + orderLogistics.getStartAddress() + ", the whole journey is about " + orderLogistics.getEstimatedMileage() + "kilometre"; |
| | | break; |
| | | case 3: |
| | | text = "J'ai reçu une nouvelle commande de livraison, à partir de " + orderLogistics.getStartAddress() + ", le trajet complet est d’environ " + orderLogistics.getEstimatedMileage() + "kilométrage"; |
| | | break; |
| | | |
| | | } |
| | | String audioUrl = ""; |
| | | try { |
| | | audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, "pushOrder" + orderLogistics.getDriverId() + ".mp3"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | //定时任务删除语音文件 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Process process = null; |
| | | try { |
| | | process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/pushOrder" + orderLogistics.getDriverId() + ".mp3"); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (process != null) { |
| | | process.destroy(); |
| | | } |
| | | } |
| | | }, 30000); |
| | | String finalAudioUrl = audioUrl; |
| | | 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); |
| | | pushUtil.pushOrderState(1, uid, orderLogistics.getId(), 4, 2, 0, ""); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, 2, 0, finalAudioUrl); |
| | | } |
| | | }).start(); |
| | | } |
| | |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(""); |
| | | //折扣 |
| | | if(null != orderLogistics.getActivityId()){ |
| | | orderMoney = orderMoney - orderLogistics.getDiscountMoney(); |
| | | //计算折扣 |
| | | UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderLogistics.getCompanyId()); |
| | | 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.getLogistics(); |
| | | if(null != special){ |
| | | orderLogistics.setDiscount(special); |
| | | double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | if(orderMoney.compareTo(v) > 0){ |
| | | orderLogistics.setDiscountMoney(orderMoney - v); |
| | | orderLogistics.setActivityId(query2.getId()); |
| | | orderMoney = v; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //计算优惠券 |
| | |
| | | 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(); |
| | | BigDecimal multiply1 = new BigDecimal(orderMoney).multiply(deductionRatio.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_EVEN); |
| | | if(total.compareTo(multiply1.doubleValue()) >= 0){ |
| | | orderLogistics.setRedPacketMoney(multiply1.doubleValue()); |
| | | orderMoney = orderMoney - multiply1.doubleValue(); |
| | | |
| | | //获取红包id |
| | | JSONArray jsonArray = new JSONArray(); |
| | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("id", userRedPacketRecord.getId()); |
| | | BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount()); |
| | | if(multiply.compareTo(remainingAmount) >= 0){ |
| | | multiply = multiply.subtract(remainingAmount); |
| | | if(multiply1.compareTo(remainingAmount) >= 0){ |
| | | userRedPacketRecord.setRemainingAmount(0D); |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | userRedPacketRecord.setState(2); |
| | | multiply1 = multiply1.subtract(remainingAmount).setScale(2, RoundingMode.HALF_EVEN); |
| | | jsonObject.put("money", remainingAmount); |
| | | jsonArray.add(jsonObject); |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | }else{ |
| | | userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply).doubleValue()); |
| | | jsonObject.put("money", multiply); |
| | | userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply1).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | jsonObject.put("money", multiply1); |
| | | jsonArray.add(jsonObject); |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | break; |
| | | } |
| | | } |
| | |
| | | jsonObject.put("id", userRedPacketRecord.getId()); |
| | | BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount()); |
| | | if(multiply.compareTo(remainingAmount) >= 0){ |
| | | multiply = multiply.subtract(remainingAmount); |
| | | userRedPacketRecord.setRemainingAmount(0D); |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | userRedPacketRecord.setState(2); |
| | | multiply = multiply.subtract(remainingAmount).setScale(2, RoundingMode.HALF_EVEN); |
| | | jsonObject.put("money", remainingAmount); |
| | | jsonArray.add(jsonObject); |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | }else{ |
| | | userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply).doubleValue()); |
| | | userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | jsonObject.put("money", multiply); |
| | | jsonArray.add(jsonObject); |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | break; |
| | | } |
| | | } |
| | |
| | | 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); |
| | |
| | | orderLogistics.setState(8); |
| | | orderLogistics.setPayType(3); |
| | | orderLogistics.setPayMoney(orderMoney); |
| | | orderLogistics.setOrderMoney(orderLogistics.getOrderMoney()+orderLogistics.getFreeMoney().doubleValue()); |
| | | |
| | | //处理优惠券和红包 |
| | | if(null != userCouponRecord){ |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | transactionDetailsService.saveData(uid, "包裹下单支付", orderMoney, 2, 1, 1, 4, orderId); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | orderLogistics.setState(1);//小件物流先支付后司机抢单 |
| | | orderLogistics.setState(8);//小件物流先支付后司机抢单 |
| | | orderLogistics.setDriverPay(1); |
| | | orderLogistics.setPayType(4); |
| | | orderLogistics.setPayMoney(orderMoney); |
| | | orderLogistics.setOrderMoney(orderLogistics.getOrderMoney()+orderLogistics.getFreeMoney().doubleValue()); |
| | | |
| | | //处理优惠券和红包 |
| | | if(null != userCouponRecord){ |
| | |
| | | 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()); |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | pushUtil.pushOfflinePayment(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4); |
| | | } |
| | | }).start(); |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | 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); |
| | | query.setCode(order_id); |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | map.put("receipt", ""); |
| | | } |
| | | if(state == 7){ |
| | | Double discountMoney = Double.valueOf(map.get("discountMoney").toString()); |
| | | Double discountMoney = 0D; |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | 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.getLogistics(); |
| | | 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){ |
| | | discountMoney = orderMoney - v; |
| | | } |
| | | } |
| | | |
| | | } |
| | | Double orderMoney = Double.valueOf(map.get("orderMoney").toString()); |
| | | map.put("orderMoney", orderMoney - discountMoney); |
| | | } |
| | | |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | long timeOutCancel = 0L; |
| | | if(null != orderLogistics.getEstimateArriveTime()){ |
| | | CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", orderLogistics.getCompanyId())); |
| | | JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); |
| | | int driverTimeout = jsonObject.getIntValue("driverTimeout") * 60000; |
| | | timeOutCancel = orderLogistics.getEstimateArriveTime().getTime() + driverTimeout; |
| | | } |
| | | map.put("timeOutCancel", timeOutCancel); |
| | | } |
| | | return maps; |
| | | } |
| | |
| | | } |
| | | this.deleteTask(id);//删除定时任务 |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0); |
| | | } |
| | | }).start(); |
| | | |
| | | //修改司机为空闲 |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Integer language1 = driver.getLanguage(); |
| | | String audioUrl = ""; |
| | | switch (language1){ |
| | | case 1: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/UserCancelledOrder-CN.mp3"; |
| | | break; |
| | | case 2: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/UserCancelledOrder-EN.mp3"; |
| | | break; |
| | | case 3: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/UserCancelledOrder-FR.mp3"; |
| | | break; |
| | | } |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, orderLogistics.getState() == 12 ? orderLogistics.getState() : 10, 0, audioUrl); |
| | | } |
| | | }).start(); |
| | | driver.setState(2); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | if(orderLogistics.getState() == 10 || orderLogistics.getState() == 12){ |
| | | //修改行程信息 |
| | | 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(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(); |
| | | Double special = query2.getLogistics(); |
| | | orderLogistics.setDiscount(special); |
| | | Double orderMoney = orderLogistics.getOrderMoney(); |
| | | double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | |
| | | |
| | | } |
| | | } |
| | | 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()); |
| | | map.put("endCity", geocode.get("city")); |
| | | // 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()); |
| | | // map.put("endCity", geocode.get("city")); |
| | | // GoogleMapUtil.getReverseGeocode() |
| | | |
| | | |
| | | String driverId = redisUtil.getValue("DEVICE_" + map.get("driverId")); |
| | | map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1); |
| | | map.put("orderType", orderLogistics.getType()); |
| | | if(state == 6){ |
| | | if(state == 8){ |
| | | map.put("receipt", "http://182.160.16.251:81/files/html/parcel_receipt_" + orderId + ".html"); |
| | | }else{ |
| | | map.put("receipt", ""); |
| | |
| | | if(null != map.get("driverId")){ |
| | | companyId = Integer.valueOf(String.valueOf(map.get("companyId"))); |
| | | } |
| | | map.put("timeOutCancel", 0); |
| | | if(null != orderLogistics.getEstimateArriveTime()){ |
| | | CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", companyId)); |
| | | JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); |
| | | map.put("timeOutCancel", jsonObject.getIntValue("driverTimeout")); |
| | | int driverTimeout = jsonObject.getIntValue("driverTimeout"); |
| | | long timeOutCancel = orderLogistics.getEstimateArriveTime().getTime() + driverTimeout; |
| | | map.put("timeOutCancel", timeOutCancel); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | |
| | | @Override |
| | | public List<Map<String, Object>> queryCoupon(Integer language, Integer orderId, Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon(language, uid, orderLogistics.getCompanyId(), 1, 4, orderLogistics.getOrderMoney() - orderLogistics.getDiscountMoney(), pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(language, uid, orderLogistics.getCompanyId(), 1, 0, orderLogistics.getOrderMoney() - orderLogistics.getDiscountMoney(), pageNum, size); |
| | | UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderLogistics.getCompanyId()); |
| | | double v = orderLogistics.getOrderMoney(); |
| | | 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.getLogistics(); |
| | | orderLogistics.setDiscount(special); |
| | | Double orderMoney = orderLogistics.getOrderMoney(); |
| | | v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | } |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon(language, uid, orderLogistics.getCompanyId(), 1, 4, v, pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(language, uid, orderLogistics.getCompanyId(), 1, 0, v, pageNum, size); |
| | | list.addAll(list1); |
| | | return list; |
| | | } |
| | |
| | | JSONObject object = JSON.parseObject(query.getContent()); |
| | | long t = object.getInteger("driverTimeout") * 60000L; |
| | | //司机超时未到达起点,免费取消 |
| | | if(orderLogistics.getState() < 3 && orderLogistics.getSnatchOrderTime().getTime() + t < System.currentTimeMillis()){ |
| | | if(orderLogistics.getState() <= 3 && orderLogistics.getEstimateArriveTime().getTime() + t <= System.currentTimeMillis()){ |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | | //非服务中且未超时 |
| | | if(orderLogistics.getState() != 5){ |
| | | JSONObject order = object.getJSONObject("order"); |
| | | long m = order.getInteger("orderAcceptanceTime") * 60000L; |
| | | //超过免费时间,计算费用 |
| | | if(orderLogistics.getSnatchOrderTime().getTime() + m < System.currentTimeMillis()){ |
| | | //超过免费时间,且没有超时,计算费用 |
| | | if(orderLogistics.getSnatchOrderTime().getTime() + m < System.currentTimeMillis() && orderLogistics.getEstimateArriveTime().getTime() + t > System.currentTimeMillis()){ |
| | | BigDecimal money = order.getBigDecimal("money"); |
| | | if(null != orderLogistics.getSetOutTime()){ |
| | | //里程费 |
| | | BigDecimal mileageFee = order.getBigDecimal("mileageFee").multiply(new BigDecimal(orderLogistics.getMileage() / 1000)); |
| | | BigDecimal mileageFee = order.getBigDecimal("mileageFee").multiply(new BigDecimal(orderLogistics.getToStartPointMileage() / 1000)); |
| | | //时长费 |
| | | int s = Double.valueOf((System.currentTimeMillis() - orderLogistics.getSetOutTime().getTime()) / 60000).intValue(); |
| | | int s = Double.valueOf((System.currentTimeMillis() - orderLogistics.getSnatchOrderTime().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); |
| | |
| | | orderCancelService.updateById(orderCancel); |
| | | |
| | | if(null != orderLogistics.getDriverId()){ |
| | | BigDecimal c =new BigDecimal(amount);//司机收入 |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderLogistics.getCompanyId()); |
| | | Double speMoney = company.getSameLogisticsMoney(); |
| | | BigDecimal d = null;//企业收入 |
| | | BigDecimal c = null;//司机收入 |
| | | if(company.getIsSpeFixedOrProportional() == 2){//固定 |
| | | d = new BigDecimal(speMoney); |
| | | c = new BigDecimal(amount).subtract(d);//只有出行金额参与抽成,其余归属司机 |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | d = new BigDecimal(amount).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(amount).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | incomeService.saveData(1, orderLogistics.getCompanyId(), 3, orderLogistics.getId(), 4, d.doubleValue()); |
| | | if(c.doubleValue() > 0){ |
| | | 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(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0, ""); |
| | | }else{ |
| | | incomeService.saveData(1, orderLogistics.getCompanyId(), 3, orderLogistics.getId(), 4, amount.doubleValue()); |
| | | } |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0, ""); |
| | | |
| | | |
| | | //添加消息 |
| | |
| | | orderCancelService.updateById(query1); |
| | | } |
| | | |
| | | |
| | | Double amount = query.getAmount(); |
| | | if(null != orderLogistics.getDriverId()){ |
| | | BigDecimal c =new BigDecimal(query.getAmount());//司机收入 |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderLogistics.getCompanyId()); |
| | | Double speMoney = company.getSameLogisticsMoney(); |
| | | BigDecimal d = null;//企业收入 |
| | | BigDecimal c = null;//司机收入 |
| | | if(company.getIsSpeFixedOrProportional() == 2){//固定 |
| | | d = new BigDecimal(speMoney); |
| | | c = new BigDecimal(amount).subtract(d);//只有出行金额参与抽成,其余归属司机 |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | d = new BigDecimal(amount).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(amount).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | incomeService.saveData(1, orderLogistics.getCompanyId(), 3, orderLogistics.getId(), 4, d.doubleValue()); |
| | | if(c.doubleValue() > 0){ |
| | | 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(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0, ""); |
| | | }else{ |
| | | incomeService.saveData(1, orderLogistics.getCompanyId(), 3, orderLogistics.getId(), 4, amount.doubleValue()); |
| | | } |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0, ""); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已使用余额成功支付取消订单费用,谢谢使用!" : language == 2 |
| | |
| | | orderLogistics.setDestinationLat(endLat); |
| | | orderLogistics.setDestinationLon(endLon); |
| | | this.updateById(orderLogistics); |
| | | pushUtil.pushModifyAddress(2, orderLogistics.getDriverId(), orderId, 1, 1); |
| | | |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | Integer language1 = driver.getLanguage(); |
| | | String audioUrl = ""; |
| | | switch (language1){ |
| | | case 1: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/ChangeAddress-CN.mp3"; |
| | | break; |
| | | case 2: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/ChangeAddress-EN.mp3"; |
| | | break; |
| | | case 3: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/ChangeAddress-FR.mp3"; |
| | | break; |
| | | } |
| | | pushUtil.pushModifyAddress(2, orderLogistics.getDriverId(), orderId, 4, 1, audioUrl); |
| | | }else{ |
| | | orderLogistics.setEndAddress(endAddress); |
| | | orderLogistics.setEndLat(Double.valueOf(endLat)); |
| | |
| | | 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); |
| | |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取服务中的订单数据 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public OrderServerWarpper queryOrderServer(Integer orderId, Integer uid) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | //计算预计距离和剩余时间 |
| | | String value = redisUtil.getValue("DRIVER" + orderLogistics.getDriverId()); |
| | | String d = "0"; |
| | | String t = "0"; |
| | | if(null == value || "".equals(value)){ |
| | | System.err.println("司机没有上传位置信息"); |
| | | |
| | | //调用获取轨迹中的数据 |
| | | File file = new File(filePath + orderId + "_4.txt"); |
| | | if(file.exists()){ |
| | | //读取文件(字符流) |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")); |
| | | //循环取出数据 |
| | | String str = null; |
| | | StringBuffer sb = new StringBuffer(); |
| | | while ((str = in.readLine()) != null) { |
| | | sb.append(str); |
| | | } |
| | | List<OrderPosition> list = JSONArray.parseArray(sb.toString(), OrderPosition.class); |
| | | if(list.size() > 0){ |
| | | OrderPosition orderPosition = list.get(list.size() - 1); |
| | | value = orderPosition.getLon() + "," + orderPosition.getLat(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | String lnt = "0"; |
| | | String lat = "0"; |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | lnt = value.split(",")[0]; |
| | | lat = value.split(",")[1]; |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), Double.valueOf(lat), Double.valueOf(lnt)); |
| | | |
| | | if(null == distancematrix){ |
| | | System.err.println("查询距离出错了"); |
| | | }else if(distancematrix.getDistance() == 0){ |
| | | System.err.println("未获取到有效的距离"); |
| | | }else{ |
| | | d = new BigDecimal(distancematrix.getDistance()).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distancematrix.getDuration()).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | } |
| | | |
| | | OrderServerWarpper orderServerWarpper = new OrderServerWarpper(); |
| | | orderServerWarpper.setOrderId(orderLogistics.getId()); |
| | | orderServerWarpper.setOrderType(4); |
| | | orderServerWarpper.setState(orderLogistics.getState()); |
| | | orderServerWarpper.setLon(lnt); |
| | | orderServerWarpper.setLat(lat); |
| | | orderServerWarpper.setReassignNotice(orderLogistics.getReassignNotice()); |
| | | if(orderLogistics.getState() == 2 || orderLogistics.getState() == 3){//前往预约地 |
| | | orderServerWarpper.setReservationMileage(d); |
| | | orderServerWarpper.setReservationTime(t); |
| | | orderServerWarpper.setServedMileage("0"); |
| | | orderServerWarpper.setServedTime("0"); |
| | | orderServerWarpper.setLaveMileage("0"); |
| | | orderServerWarpper.setLaveTime("0"); |
| | | } |
| | | if(orderLogistics.getState() == 5 || orderLogistics.getState() == 6){//服务中 |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(lat), Double.valueOf(lnt), orderLogistics.getEndLat(), orderLogistics.getEndLon()); |
| | | if(null == distancematrix){ |
| | | System.err.println("查询距离出错了"); |
| | | }else if(distancematrix.getDistance() == 0){ |
| | | System.err.println("未获取到有效的距离"); |
| | | }else{ |
| | | d = new BigDecimal(distancematrix.getDistance()).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distancematrix.getDuration()).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | orderServerWarpper.setReservationMileage("0"); |
| | | orderServerWarpper.setReservationTime("0"); |
| | | orderServerWarpper.setServedMileage(String.valueOf((null == orderLogistics.getMileage() ? 0 : orderLogistics.getMileage()) / 1000)); |
| | | orderServerWarpper.setServedTime("0"); |
| | | if(null != orderLogistics.getStartServiceTime()){ |
| | | orderServerWarpper.setServedTime(Long.valueOf((new Date().getTime() - orderLogistics.getStartServiceTime().getTime()) / 60000).intValue() + ""); |
| | | } |
| | | orderServerWarpper.setLaveMileage(d); |
| | | orderServerWarpper.setLaveTime(t); |
| | | } |
| | | File file = new File(filePath + orderId + "_4.txt"); |
| | | if(file.exists()){ |
| | | //读取文件(字符流) |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")); |
| | | //循环取出数据 |
| | | String str = null; |
| | | StringBuffer sb = new StringBuffer(); |
| | | while ((str = in.readLine()) != null) { |
| | | sb.append(str); |
| | | } |
| | | List<OrderPosition> list = JSONArray.parseArray(sb.toString(), OrderPosition.class); |
| | | orderServerWarpper.setOrderPositionList(JSONObject.toJSONString(list)); |
| | | } |
| | | return orderServerWarpper; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取下单推送完后没有司机接单的提醒 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public EndPushWarpper queryEndPush(Integer uid) throws Exception { |
| | | List<OrderLogistics> list = orderLogisticsMapper.queryByState(uid, null, null, 1); |
| | | EndPushWarpper endPushWarpper = new EndPushWarpper(); |
| | | if(list.size() > 0){ |
| | | OrderLogistics orderPrivateCar = list.get(0); |
| | | if(!orderIds.contains(orderPrivateCar.getId())){ |
| | | endPushWarpper.setOrderId(orderPrivateCar.getId()); |
| | | endPushWarpper.setOrderType(4); |
| | | endPushWarpper.setState(1); |
| | | List<PushOrder> querys = pushOrderService.querys(null, 2, orderPrivateCar.getCompanyId());//获取需要推送的次数 |
| | | int time = 0; |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | PushOrder pushOrder = pushOrderService.querys(i, 2, orderPrivateCar.getCompanyId()).get(0); |
| | | time += pushOrder.getPushTime() * 1000; |
| | | } |
| | | //当前时间减去推单总时间大于下单时间 |
| | | if((System.currentTimeMillis() - time) > orderPrivateCar.getInsertTime().getTime()){ |
| | | endPushWarpper.setState(2); |
| | | } |
| | | } |
| | | } |
| | | return endPushWarpper; |
| | | } |
| | | } |
| | |
| | | oldState as oldState, |
| | | isFrozen, |
| | | cancelMidway, |
| | | tripId |
| | | tripId, |
| | | remark |
| | | from t_order_private_car where userId = #{uid} and isDelete = 1 order by insertTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | |
| | | @TableField("getoffTime") |
| | | private Date getoffTime; |
| | | /** |
| | | * 去往起点的路程数(米) |
| | | */ |
| | | @TableField("toStartPointMileage") |
| | | private Double toStartPointMileage; |
| | | /** |
| | | * 行驶里程数(米) |
| | | */ |
| | | @TableField("mileage") |
| | |
| | | */ |
| | | @TableField("tripId") |
| | | private String tripId; |
| | | |
| | | /** |
| | | * 预估里程 |
| | | */ |
| | | @TableField("estimatedMileage") |
| | | private Double estimatedMileage; |
| | | /** |
| | | * 司机预估到达预约单时间 |
| | | */ |
| | | @TableField("estimateArriveTime") |
| | | private Date estimateArriveTime; |
| | | /** |
| | | * 司机预估距离预约点距离(米) |
| | | */ |
| | | @TableField("estimateArriveMileage") |
| | | private Long estimateArriveMileage; |
| | | } |
| | |
| | | CarService query1 = carServiceMapper.query(1, driver.getCarId()); |
| | | orderPrivateCar.setServerCarModelId(query1.getServerCarModelId()); |
| | | orderPrivateCar.setSnatchOrderTime(new Date()); |
| | | |
| | | if(orderPrivateCar.getOrderType() == 1){ |
| | | String value = redisUtil.getValue("DRIVER" + driver.getId()); |
| | | if(ToolUtil.isNotEmpty(value)) { |
| | | String[] split = value.split(","); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0])); |
| | | //超时时间 |
| | | long timeOut = System.currentTimeMillis() + (distancematrix.getDuration() * 1000); |
| | | orderPrivateCar.setEstimateArriveTime(new Date(timeOut)); |
| | | orderPrivateCar.setEstimateArriveMileage(distancematrix.getDistance()); |
| | | } |
| | | } |
| | | driver.setState(3); |
| | | driverService.updateById(driver); |
| | | } |
| | |
| | | orderPrivateCar.setIsReassign(1); |
| | | orderPrivateCar.setIsDelete(1); |
| | | orderPrivateCar.setTripId(UUIDUtil.getRandomCode()); |
| | | DistancematrixVo distancematrix1 = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), orderPrivateCar.getEndLat(), orderPrivateCar.getEndLon()); |
| | | Long distance1 = distancematrix1.getDistance(); |
| | | orderPrivateCar.setEstimatedMileage(new BigDecimal(distance1).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | this.insert(orderPrivateCar); |
| | | |
| | | |
| | | new Thread(() -> { |
| | | try { |
| | | String vehicleId = null; |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | |
| | | 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()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | |
| | | |
| | | if(orderSource == 2){//扫码下单 |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | Integer language1 = driver.getLanguage(); |
| | | String text = ""; |
| | | switch (language1){ |
| | | case 1: |
| | | text = "收到新的打车订单,从" + orderPrivateCar.getStartAddress() + "出发,全程约" + orderPrivateCar.getEstimatedMileage() + "公里"; |
| | | break; |
| | | case 2: |
| | | text = "Received a new ride order, starting from " + orderPrivateCar.getStartAddress() + ", the whole journey is about " + orderPrivateCar.getEstimatedMileage() + "kilometre"; |
| | | break; |
| | | case 3: |
| | | text = "J'ai reçu une nouvelle commande de course, à partir de " + orderPrivateCar.getStartAddress() + ", le trajet complet est d’environ " + orderPrivateCar.getEstimatedMileage() + "kilométrage"; |
| | | break; |
| | | |
| | | } |
| | | String audioUrl = ""; |
| | | try { |
| | | audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, "pushOrder" + orderPrivateCar.getDriverId() + ".mp3"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | //定时任务删除语音文件 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Process process = null; |
| | | try { |
| | | process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/pushOrder" + orderPrivateCar.getDriverId() + ".mp3"); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (process != null) { |
| | | process.destroy(); |
| | | } |
| | | } |
| | | }, 30000); |
| | | String finalAudioUrl = audioUrl; |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, uid, orderPrivateCar.getId(), 1, 2, 0); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, 2, 0); |
| | | pushUtil.pushOrderState(1, uid, orderPrivateCar.getId(), 1, 2, 0, ""); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, 2, 0, finalAudioUrl); |
| | | } |
| | | }).start(); |
| | | } |
| | |
| | | driverService.updateById(dr); |
| | | this.updateById(orderPrivateCar); |
| | | |
| | | Integer language1 = dr.getLanguage(); |
| | | String text = ""; |
| | | switch (language1){ |
| | | case 1: |
| | | text = "收到新的打车订单,从" + orderPrivateCar.getStartAddress() + "出发,全程约" + orderPrivateCar.getEstimatedMileage() + "公里"; |
| | | break; |
| | | case 2: |
| | | text = "Received a new ride order, starting from " + orderPrivateCar.getStartAddress() + ", the whole journey is about " + orderPrivateCar.getEstimatedMileage() + "kilometre"; |
| | | break; |
| | | case 3: |
| | | text = "J'ai reçu une nouvelle commande de course, à partir de " + orderPrivateCar.getStartAddress() + ", le trajet complet est d’environ " + orderPrivateCar.getEstimatedMileage() + "kilométrage"; |
| | | break; |
| | | |
| | | } |
| | | String audioUrl = ""; |
| | | try { |
| | | audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, "pushOrder" + orderPrivateCar.getDriverId() + ".mp3"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | //定时任务删除语音文件 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Process process = null; |
| | | try { |
| | | process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/pushOrder" + orderPrivateCar.getDriverId() + ".mp3"); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (process != null) { |
| | | process.destroy(); |
| | | } |
| | | } |
| | | }, 30000); |
| | | |
| | | String finalAudioUrl = audioUrl; |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, uid, orderPrivateCar.getId(), 1, 2, 0); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, 2, 0); |
| | | pushUtil.pushOrderState(1, uid, orderPrivateCar.getId(), 1, 2, 0, ""); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, 2, 0, finalAudioUrl); |
| | | } |
| | | }).start(); |
| | | } |
| | |
| | | JSONObject object = JSON.parseObject(query.getContent()); |
| | | long t = object.getInteger("driverTimeout") * 60000L; |
| | | //司机超时未到达起点,免费取消 |
| | | if(orderPrivateCar.getState() < 3 && orderPrivateCar.getSnatchOrderTime().getTime() + t < System.currentTimeMillis()){ |
| | | if(orderPrivateCar.getOrderType() == 1){ |
| | | if(orderPrivateCar.getState() <= 3 && orderPrivateCar.getEstimateArriveTime().getTime() + t <= System.currentTimeMillis()){ |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | }else{ |
| | | if(orderPrivateCar.getState() <= 3 && orderPrivateCar.getTravelTime().getTime() + t <= System.currentTimeMillis()){ |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | } |
| | | |
| | | //非服务中且未超时 |
| | | if(orderPrivateCar.getState() != 5){ |
| | | //普通单 |
| | | if(1 == orderPrivateCar.getOrderType()){ |
| | | JSONObject order = object.getJSONObject("order"); |
| | | long m = order.getInteger("orderAcceptanceTime") * 60000L; |
| | | //超过免费时间,计算费用 |
| | | if(orderPrivateCar.getSnatchOrderTime().getTime() + m < System.currentTimeMillis()){ |
| | | //超过免费时间,且没有超时,计算费用 |
| | | if(orderPrivateCar.getSnatchOrderTime().getTime() + m < System.currentTimeMillis() && orderPrivateCar.getEstimateArriveTime().getTime() + t > System.currentTimeMillis()){ |
| | | BigDecimal money = order.getBigDecimal("money"); |
| | | if(null != orderPrivateCar.getSetOutTime()){ |
| | | //里程费 |
| | | BigDecimal mileageFee = order.getBigDecimal("mileageFee").multiply(new BigDecimal(orderPrivateCar.getMileage() / 1000)); |
| | | BigDecimal mileageFee = order.getBigDecimal("mileageFee").multiply(new BigDecimal(orderPrivateCar.getToStartPointMileage() / 1000)); |
| | | //时长费 |
| | | int s = Double.valueOf((System.currentTimeMillis() - orderPrivateCar.getSetOutTime().getTime()) / 60000).intValue(); |
| | | int s = Double.valueOf((System.currentTimeMillis() - orderPrivateCar.getSnatchOrderTime().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()){ |
| | | //超过免费时间,且没有超时,计算费用 |
| | | if(System.currentTimeMillis() + m > orderPrivateCar.getTravelTime().getTime() && orderPrivateCar.getTravelTime().getTime() + t > System.currentTimeMillis()){ |
| | | BigDecimal money = order.getBigDecimal("money"); |
| | | if(null != orderPrivateCar.getSetOutTime()){ |
| | | //里程费 |
| | | BigDecimal mileageFee = order.getBigDecimal("mileageFee").multiply(new BigDecimal(orderPrivateCar.getMileage() / 1000)); |
| | | BigDecimal mileageFee = order.getBigDecimal("mileageFee").multiply(new BigDecimal(orderPrivateCar.getToStartPointMileage() / 1000)); |
| | | //时长费 |
| | | int s = Double.valueOf((System.currentTimeMillis() - orderPrivateCar.getSetOutTime().getTime()) / 60000).intValue(); |
| | | int s = Double.valueOf((System.currentTimeMillis() - orderPrivateCar.getSnatchOrderTime().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); |
| | |
| | | integer = orderCancelService.saveData(id, 1, reason, remark, null, amount, 1, 1, uid); |
| | | } |
| | | this.deleteTask(id);//删除定时任务 |
| | | |
| | | //修改司机为空闲 |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | Integer language1 = driver.getLanguage(); |
| | | String audioUrl = ""; |
| | | switch (language1){ |
| | | case 1: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/UserCancelledOrder-CN.mp3"; |
| | | break; |
| | | case 2: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/UserCancelledOrder-EN.mp3"; |
| | | break; |
| | | case 3: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/UserCancelledOrder-FR.mp3"; |
| | | break; |
| | | } |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState() == 12 ? orderPrivateCar.getState() : 10, 0, audioUrl); |
| | | System.err.println("推送取消操作---------------------"); |
| | | } |
| | | }).start(); |
| | | |
| | | //修改司机为空闲 |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | |
| | | driver.setState(2); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | //修改行程信息 |
| | | if(orderPrivateCar.getState() == 10 || orderPrivateCar.getState() == 12){ |
| | | 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); |
| | |
| | | } |
| | | |
| | | Double amount = queryCancleAmount(id, language).getData().getAmount(); |
| | | if(orderPrivateCar.getState() == 12){ |
| | | amount = orderCancel.getMoney(); |
| | | } |
| | | if(0 < amount){ |
| | | if(payType == 1){//手机支付 |
| | | orderCancel.setPayType(1); |
| | |
| | | orderCancelService.updateById(orderCancel); |
| | | |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | BigDecimal c =new BigDecimal(amount);//司机收入 |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderPrivateCar.getCompanyId()); |
| | | Double speMoney = company.getSpeMoney(); |
| | | BigDecimal d = null;//企业收入 |
| | | BigDecimal c = null;//司机收入 |
| | | if(company.getIsSpeFixedOrProportional() == 2){//固定 |
| | | d = new BigDecimal(speMoney); |
| | | c = new BigDecimal(amount).subtract(d);//只有出行金额参与抽成,其余归属司机 |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | d = new BigDecimal(amount).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(amount).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | incomeService.saveData(1, orderPrivateCar.getCompanyId(), 3, orderPrivateCar.getId(), 1, d.doubleValue()); |
| | | if(c.doubleValue() > 0){ |
| | | 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()); |
| | | 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, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0, ""); |
| | | }else{ |
| | | incomeService.saveData(1, orderPrivateCar.getCompanyId(), 3, orderPrivateCar.getId(), 1, amount.doubleValue()); |
| | | } |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0, ""); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已使用余额成功支付取消订单费用,谢谢使用!" : language == 2 |
| | |
| | | if(bo){ |
| | | continue; |
| | | } |
| | | pushUtil.pushOrderState(2, driver.getId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), pushOrder.getPushTime()); |
| | | |
| | | String text = ""; |
| | | Integer language = driver.getLanguage(); |
| | | switch (language){ |
| | | case 1: |
| | | text = "收到新的打车订单,从" + orderPrivateCar.getStartAddress() + "出发,全程约" + orderPrivateCar.getEstimatedMileage() + "公里"; |
| | | break; |
| | | case 2: |
| | | text = "Received a new ride order, starting from " + orderPrivateCar.getStartAddress() + ", the whole journey is about " + orderPrivateCar.getEstimatedMileage() + "kilometre"; |
| | | break; |
| | | case 3: |
| | | text = "J'ai reçu une nouvelle commande de course, à partir de " + orderPrivateCar.getStartAddress() + ", le trajet complet est d’environ " + orderPrivateCar.getEstimatedMileage() + "kilométrage"; |
| | | break; |
| | | |
| | | } |
| | | String audioUrl = ""; |
| | | try { |
| | | audioUrl = TextToSpeechUtil.create(language == 1 ? "cmn-CN" : language == 2 ? "en-US" : "fr-FR", text, "pushOrder" + orderPrivateCar.getDriverId() + ".mp3"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | //定时任务删除语音文件 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Process process = null; |
| | | try { |
| | | process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/pushOrder" + orderPrivateCar.getDriverId() + ".mp3"); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (process != null) { |
| | | process.destroy(); |
| | | } |
| | | } |
| | | }, 30000); |
| | | |
| | | pushUtil.pushOrderState(2, driver.getId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), pushOrder.getPushTime(), audioUrl); |
| | | } |
| | | } |
| | | Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 |
| | |
| | | Integer orderNum=this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId",orderPrivateCar.getUserId()).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())")); |
| | | if(query2.getDistance()*1000>orderPrivateCar.getMileage() && query2.getOrderNum()>orderNum){ |
| | | Double special = query2.getSpecial(); |
| | | if(null != special){ |
| | | orderPrivateCar.setDiscount(special); |
| | | double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | if(orderMoney.compareTo(v) > 0){ |
| | | orderPrivateCar.setDiscountMoney(orderMoney - v); |
| | | orderPrivateCar.setActivityId(query2.getId()); |
| | | orderMoney = v; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | orderMoney=new BigDecimal(orderMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | |
| | | //计算红包 |
| | | if(null != redDeduction && 1 == redDeduction){ |
| | | if(null != redDeduction && 1 == redDeduction && null == orderPrivateCar.getRedPacketId()){ |
| | | 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(); |
| | | BigDecimal multiply1 = new BigDecimal(orderMoney).multiply(deductionRatio.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_EVEN); |
| | | if(total.compareTo(multiply1.doubleValue()) >= 0){ |
| | | orderPrivateCar.setRedPacketMoney(multiply1.doubleValue()); |
| | | orderMoney = orderMoney - multiply1.doubleValue(); |
| | | |
| | | //获取红包id |
| | | JSONArray jsonArray = new JSONArray(); |
| | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("id", userRedPacketRecord.getId()); |
| | | BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount()); |
| | | if(multiply.compareTo(remainingAmount) >= 0){ |
| | | multiply = multiply.subtract(remainingAmount); |
| | | if(multiply1.compareTo(remainingAmount) >= 0){ |
| | | userRedPacketRecord.setRemainingAmount(0D); |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | userRedPacketRecord.setState(2); |
| | | multiply1 = multiply1.subtract(remainingAmount).setScale(2, RoundingMode.HALF_EVEN); |
| | | jsonObject.put("money", remainingAmount); |
| | | jsonArray.add(jsonObject); |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | }else{ |
| | | userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply).doubleValue()); |
| | | jsonObject.put("money", multiply); |
| | | userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply1).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | jsonObject.put("money", multiply1); |
| | | jsonArray.add(jsonObject); |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | break; |
| | | } |
| | | } |
| | |
| | | jsonObject.put("id", userRedPacketRecord.getId()); |
| | | BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount()); |
| | | if(multiply.compareTo(remainingAmount) >= 0){ |
| | | multiply = multiply.subtract(remainingAmount); |
| | | userRedPacketRecord.setRemainingAmount(0D); |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | userRedPacketRecord.setState(2); |
| | | multiply = multiply.subtract(remainingAmount).setScale(2, RoundingMode.HALF_EVEN); |
| | | jsonObject.put("money", remainingAmount); |
| | | jsonArray.add(jsonObject); |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | }else{ |
| | | userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply).doubleValue()); |
| | | userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | jsonObject.put("money", multiply); |
| | | jsonArray.add(jsonObject); |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | break; |
| | | } |
| | | } |
| | |
| | | orderPrivateCar.setState(8); |
| | | orderPrivateCar.setPayType(3); |
| | | orderPrivateCar.setPayMoney(orderMoney); |
| | | orderPrivateCar.setOrderMoney(orderPrivateCar.getOrderMoney()+orderPrivateCar.getFreeMoney().doubleValue()); |
| | | |
| | | //处理优惠券和红包 |
| | | if(null != userCouponRecord){ |
| | | userCouponRecord.setState(2); |
| | | userCouponRecord.setEndTime(new Date()); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | 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){ |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0, ""); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | orderPrivateCar.setPayType(4); |
| | | orderPrivateCar.setDriverPay(2); |
| | | orderPrivateCar.setPayMoney(orderMoney); |
| | | orderPrivateCar.setOrderMoney(orderPrivateCar.getOrderMoney()+orderPrivateCar.getFreeMoney().doubleValue()); |
| | | |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | |
| | |
| | | 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.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()); |
| | |
| | | if(null != settlementAllocation){ |
| | | JSONObject jsonObject = JSON.parseObject(settlementAllocation.getContent()); |
| | | Double maxPrice = jsonObject.getDouble("maxPrice"); |
| | | Integer type1 = jsonObject.getInteger("type"); |
| | | if(1 == type1){ |
| | | if(null != maxPrice){ |
| | | 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", orderPrivateCar.getDriverId()) |
| | | .eq("type", type1).eq("paymentStatus", 1).last(" and day = DATE_FORMAT(now(), '%Y-%m-%d')")); |
| | | .eq("type", 1).eq("paymentStatus", 1).last(" and day = DATE_FORMAT(now(), '%Y-%m-%d')")); |
| | | if(null == settlementRecord){ |
| | | settlementRecord = new SettlementRecord(); |
| | | settlementRecord.setDay(new Date()); |
| | | settlementRecord.setDriverId(orderPrivateCar.getDriverId()); |
| | | settlementRecord.setType(type1); |
| | | settlementRecord.setType(1); |
| | | settlementRecord.setPaymentStatus(1); |
| | | settlementRecord.setPayMoney(total.doubleValue()); |
| | | settlementRecord.setInsertTime(new Date()); |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0, ""); |
| | | pushUtil.pushOfflinePayment(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1); |
| | | } |
| | | }).start(); |
| | |
| | | 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); |
| | |
| | | orderCancelService.updateById(query1); |
| | | } |
| | | |
| | | Double amount = query.getAmount(); |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | BigDecimal c =new BigDecimal(query.getAmount());//司机收入 |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderPrivateCar.getCompanyId()); |
| | | Double speMoney = company.getSpeMoney(); |
| | | BigDecimal d = null;//企业收入 |
| | | BigDecimal c = null;//司机收入 |
| | | if(company.getIsSpeFixedOrProportional() == 2){//固定 |
| | | d = new BigDecimal(speMoney); |
| | | c = new BigDecimal(amount).subtract(d);//只有出行金额参与抽成,其余归属司机 |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | d = new BigDecimal(amount).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(amount).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | incomeService.saveData(1, orderPrivateCar.getCompanyId(), 3, orderPrivateCar.getId(), 1, d.doubleValue()); |
| | | if(c.doubleValue() > 0){ |
| | | 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()); |
| | | 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(orderPrivateCar.getId());//删除定时任务 |
| | | |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0, ""); |
| | | }else{ |
| | | incomeService.saveData(1, orderPrivateCar.getCompanyId(), 3, orderPrivateCar.getId(), 1, amount.doubleValue()); |
| | | } |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0, ""); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已使用余额成功支付取消订单费用,谢谢使用!" : language == 2 |
| | |
| | | userCouponRecord.setEndTime(new Date()); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0, ""); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | }else{ |
| | | map.put("receipt", ""); |
| | | } |
| | | |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarMapper.selectById(orderId); |
| | | long timeOutCancel = 0L; |
| | | if(null != orderPrivateCar.getEstimateArriveTime()){ |
| | | CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", orderPrivateCar.getCompanyId())); |
| | | JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); |
| | | int driverTimeout = jsonObject.getIntValue("driverTimeout") * 60000; |
| | | if(orderPrivateCar.getOrderType() == 1){ |
| | | timeOutCancel = orderPrivateCar.getEstimateArriveTime().getTime() + driverTimeout; |
| | | }else{ |
| | | timeOutCancel = orderPrivateCar.getTravelTime().getTime() + driverTimeout; |
| | | } |
| | | } |
| | | map.put("timeOutCancel", timeOutCancel); |
| | | } |
| | | return maps; |
| | | } |
| | |
| | | @Override |
| | | public Map<String, Object> queryOrderInfo(Integer language, Integer orderId) throws Exception { |
| | | Map<String, Object> map = orderPrivateCarMapper.queryOrderInfo(orderId); |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarMapper.selectById(orderId); |
| | | if(null != map.get("travelTime")){ |
| | | String travelTime = map.get("travelTime").toString(); |
| | | map.put("travelTime", DateUtil.conversionFormat1(language, travelTime)); |
| | | } |
| | | Integer state = Integer.valueOf(String.valueOf(map.get("state"))); |
| | | if(null != map.get("reassignNotice") && Integer.valueOf(String.valueOf(map.get("reassignNotice"))) == 2){//改派完成,重新获取了新的司机数据,开始修改数据防止继续调用 |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | orderPrivateCar.setReassignNotice(0); |
| | | this.updateById(orderPrivateCar); |
| | | } |
| | |
| | | map.put("couponMoney", null); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("state"))) == 7){ |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarMapper.selectById(orderId); |
| | | UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(Integer.valueOf(String.valueOf(map.get("companyId")))); |
| | | if(null != query2){ |
| | | Integer orderNum=this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId",orderPrivateCar.getUserId()).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())")); |
| | |
| | | if(null != map.get("driverId")){ |
| | | companyId = Integer.valueOf(String.valueOf(map.get("companyId"))); |
| | | } |
| | | |
| | | long timeOutCancel = 0L; |
| | | long driverTimeOut = 0L; |
| | | CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", companyId)); |
| | | JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); |
| | | map.put("timeOutCancel", jsonObject.getIntValue("driverTimeout")); |
| | | int driverTimeout = jsonObject.getIntValue("driverTimeout") * 60000; |
| | | if(orderPrivateCar.getOrderType() == 1 && null != orderPrivateCar.getEstimateArriveTime()){ |
| | | timeOutCancel = orderPrivateCar.getEstimateArriveTime().getTime() + driverTimeout; |
| | | driverTimeOut = orderPrivateCar.getEstimateArriveTime().getTime(); |
| | | }else{ |
| | | timeOutCancel = orderPrivateCar.getTravelTime().getTime() + driverTimeout; |
| | | driverTimeOut = orderPrivateCar.getTravelTime().getTime(); |
| | | } |
| | | |
| | | map.put("timeOutCancel", timeOutCancel); |
| | | map.put("driverTimeOut", driverTimeOut); |
| | | return map; |
| | | } |
| | | |
| | |
| | | orderPrivateCar.setDestinationLat(endLat); |
| | | orderPrivateCar.setDestinationLon(endLon); |
| | | this.updateById(orderPrivateCar); |
| | | pushUtil.pushModifyAddress(2, orderPrivateCar.getDriverId(), orderId, 1, 1); |
| | | |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | Integer language1 = driver.getLanguage(); |
| | | String audioUrl = ""; |
| | | switch (language1){ |
| | | case 1: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/ChangeAddress-CN.mp3"; |
| | | break; |
| | | case 2: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/ChangeAddress-EN.mp3"; |
| | | break; |
| | | case 3: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/ChangeAddress-FR.mp3"; |
| | | break; |
| | | } |
| | | pushUtil.pushModifyAddress(2, orderPrivateCar.getDriverId(), orderId, 1, 1, audioUrl); |
| | | }else{ |
| | | orderPrivateCar.setEndAddress(endAddress); |
| | | orderPrivateCar.setEndLat(Double.valueOf(endLat)); |
| | |
| | | |
| | | <select id="queryIdleDriver" resultType="Driver"> |
| | | select |
| | | id as id, |
| | | account as account, |
| | | jobNumber as jobNumber, |
| | | phone as phone, |
| | | phoneOperator as phoneOperator, |
| | | password as password, |
| | | lastName as lastName, |
| | | firstName as firstName, |
| | | sex as sex, |
| | | idCard as idCard, |
| | | companyId as companyId, |
| | | franchiseeId as franchiseeId, |
| | | headImgUrl as headImgUrl, |
| | | faceImgUrl as faceImgUrl, |
| | | idCardImgUrl1 as idCardImgUrl1, |
| | | idCardImgUrl2 as idCardImgUrl2, |
| | | placeOfEmployment as placeOfEmployment, |
| | | birthday as birthday, |
| | | bankCardNumber as bankCardNumber, |
| | | driverNationality as driverNationality, |
| | | driverNation as driverNation, |
| | | driverMaritalStatus as driverMaritalStatus, |
| | | driverLanguageLevel as driverLanguageLevel, |
| | | driverEducation as driverEducation, |
| | | driverCensus as driverCensus, |
| | | driverAddress as driverAddress, |
| | | driverContactAddress as driverContactAddress, |
| | | driverAge as driverAge, |
| | | driveCard as driveCard, |
| | | driveCardImgUrl1 as driveCardImgUrl1, |
| | | driveCardImgUrl2 as driveCardImgUrl2, |
| | | driverType as driverType, |
| | | getDriverLicenseDate as getDriverLicenseDate, |
| | | driverLicenseOn as driverLicenseOn, |
| | | driverLicenseOff as driverLicenseOff, |
| | | taxiDriver as taxiDriver, |
| | | taxiAptitudeCard as taxiAptitudeCard, |
| | | networkCarlssueImg as networkCarlssueImg, |
| | | networkCarlssueOrganization as networkCarlssueOrganization, |
| | | networkCarlssueDate as networkCarlssueDate, |
| | | getNetworkCarProofDate as getNetworkCarProofDate, |
| | | networkCarProofOn as networkCarProofOn, |
| | | networkCarProofOff as networkCarProofOff, |
| | | registerDate as registerDate, |
| | | fullTimeDriver as fullTimeDriver, |
| | | inDriverBlacklist as inDriverBlacklist, |
| | | commercialType as commercialType, |
| | | contractCompany as contractCompany, |
| | | contractOn as contractOn, |
| | | contractOff as contractOff, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactPhone as emergencyContactPhone, |
| | | emergencyContactAddress as emergencyContactAddress, |
| | | remark as remark, |
| | | isPlatCar as isPlatCar, |
| | | carId as carId, |
| | | authState as authState, |
| | | state as state, |
| | | addType as addType, |
| | | balance as balance, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | * |
| | | from t_driver |
| | | where flag != 3 and state = 2 and authState = 2 |
| | | <if test="null != companyId"> |
| | |
| | | <select id="queryIdleDriver_" resultType="Driver"> |
| | | select * from ( |
| | | select |
| | | id as id, |
| | | account as account, |
| | | jobNumber as jobNumber, |
| | | phone as phone, |
| | | phoneOperator as phoneOperator, |
| | | password as password, |
| | | lastName as lastName, |
| | | firstName as firstName, |
| | | sex as sex, |
| | | idCard as idCard, |
| | | companyId as companyId, |
| | | franchiseeId as franchiseeId, |
| | | headImgUrl as headImgUrl, |
| | | faceImgUrl as faceImgUrl, |
| | | idCardImgUrl1 as idCardImgUrl1, |
| | | idCardImgUrl2 as idCardImgUrl2, |
| | | placeOfEmployment as placeOfEmployment, |
| | | birthday as birthday, |
| | | bankCardNumber as bankCardNumber, |
| | | driverNationality as driverNationality, |
| | | driverNation as driverNation, |
| | | driverMaritalStatus as driverMaritalStatus, |
| | | driverLanguageLevel as driverLanguageLevel, |
| | | driverEducation as driverEducation, |
| | | driverCensus as driverCensus, |
| | | driverAddress as driverAddress, |
| | | driverContactAddress as driverContactAddress, |
| | | driverAge as driverAge, |
| | | driveCard as driveCard, |
| | | driveCardImgUrl1 as driveCardImgUrl1, |
| | | driveCardImgUrl2 as driveCardImgUrl2, |
| | | driverType as driverType, |
| | | getDriverLicenseDate as getDriverLicenseDate, |
| | | driverLicenseOn as driverLicenseOn, |
| | | driverLicenseOff as driverLicenseOff, |
| | | taxiDriver as taxiDriver, |
| | | taxiAptitudeCard as taxiAptitudeCard, |
| | | networkCarlssueImg as networkCarlssueImg, |
| | | networkCarlssueOrganization as networkCarlssueOrganization, |
| | | networkCarlssueDate as networkCarlssueDate, |
| | | getNetworkCarProofDate as getNetworkCarProofDate, |
| | | networkCarProofOn as networkCarProofOn, |
| | | networkCarProofOff as networkCarProofOff, |
| | | registerDate as registerDate, |
| | | fullTimeDriver as fullTimeDriver, |
| | | inDriverBlacklist as inDriverBlacklist, |
| | | commercialType as commercialType, |
| | | contractCompany as contractCompany, |
| | | contractOn as contractOn, |
| | | contractOff as contractOff, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactPhone as emergencyContactPhone, |
| | | emergencyContactAddress as emergencyContactAddress, |
| | | remark as remark, |
| | | isPlatCar as isPlatCar, |
| | | carId as carId, |
| | | authState as authState, |
| | | state as state, |
| | | addType as addType, |
| | | balance as balance, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | * |
| | | from t_driver |
| | | where flag != 3 and state = 2 and authState = 2 |
| | | <if test="null != companyId"> |
| | |
| | | |
| | | |
| | | |
| | | <select id="queryPhones" resultType="Phone"> |
| | | <select id="queryPhones" resultType="com.stylefeng.guns.modular.system.model.Phone"> |
| | | select |
| | | id as id, |
| | | type as type, |
| | |
| | | select |
| | | id as id, |
| | | content as content |
| | | from t_system_price where companyId = #{companyId} |
| | | from t_system_price where companyId = #{companyId} and state = 1 |
| | | <if test="null != type"> |
| | | and `type` = #{type} |
| | | </if> |
| | |
| | | b.startMoney as startMoney, |
| | | b.endMoney as endMoney, |
| | | b.companyId as companyId, |
| | | b.effective as effective, |
| | | a.totalPrice as totalPrice, |
| | | a.lavePrice as lavePrice |
| | | from t_user_activity_redenvelope a |
| | |
| | | </select> |
| | | |
| | | <select id="queryByPhone" resultType="UserInfo"> |
| | | select |
| | | id as id, |
| | | registIp as registIp, |
| | | registAreaCode as registAreaCode, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | nickName as nickName, |
| | | avatar as avatar, |
| | | birthday as birthday, |
| | | sex as sex, |
| | | email, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactNumber as emergencyContactNumber, |
| | | isAuth as isAuth, |
| | | lastName as lastName, |
| | | firstName as firstName, |
| | | idCard as idCard, |
| | | idCardFront as idCardFront, |
| | | idCardReverse as idCardReverse, |
| | | consumption as consumption, |
| | | balance as balance, |
| | | integral as integral, |
| | | passWord as passWord, |
| | | openId as openId, |
| | | appletsOpenId as appletsOpenId, |
| | | unionid as unionid, |
| | | state as state, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | select * |
| | | from t_user where flag != 3 and phone = #{phone} |
| | | </select> |
| | | |
| | | |
| | | <select id="queryByEmail" resultType="UserInfo"> |
| | | select |
| | | id as id, |
| | | registIp as registIp, |
| | | registAreaCode as registAreaCode, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | nickName as nickName, |
| | | avatar as avatar, |
| | | birthday as birthday, |
| | | sex as sex, |
| | | email, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactNumber as emergencyContactNumber, |
| | | isAuth as isAuth, |
| | | lastName as lastName, |
| | | firstName as firstName, |
| | | idCard as idCard, |
| | | idCardFront as idCardFront, |
| | | idCardReverse as idCardReverse, |
| | | consumption as consumption, |
| | | balance as balance, |
| | | integral as integral, |
| | | passWord as passWord, |
| | | openId as openId, |
| | | appletsOpenId as appletsOpenId, |
| | | unionid as unionid, |
| | | state as state, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | select * |
| | | from t_user where flag != 3 and email = #{email} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryByOpenid" resultType="UserInfo"> |
| | | select |
| | | id as id, |
| | | registIp as registIp, |
| | | registAreaCode as registAreaCode, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | nickName as nickName, |
| | | avatar as avatar, |
| | | birthday as birthday, |
| | | sex as sex, |
| | | email, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactNumber as emergencyContactNumber, |
| | | isAuth as isAuth, |
| | | lastName as lastName, |
| | | firstName as firstName, |
| | | idCard as idCard, |
| | | idCardFront as idCardFront, |
| | | idCardReverse as idCardReverse, |
| | | consumption as consumption, |
| | | balance as balance, |
| | | integral as integral, |
| | | passWord as passWord, |
| | | openId as openId, |
| | | appletsOpenId as appletsOpenId, |
| | | unionid as unionid, |
| | | state as state, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | select * |
| | | from t_user where flag != 3 |
| | | <if test="null != openid"> |
| | | and openId = #{openid} |
| | |
| | | |
| | | |
| | | <select id="queryByOpenid2" resultType="UserInfo"> |
| | | select |
| | | id as id, |
| | | registIp as registIp, |
| | | registAreaCode as registAreaCode, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | nickName as nickName, |
| | | avatar as avatar, |
| | | birthday as birthday, |
| | | sex as sex, |
| | | email, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactNumber as emergencyContactNumber, |
| | | isAuth as isAuth, |
| | | lastName as lastName, |
| | | firstName as firstName, |
| | | idCard as idCard, |
| | | idCardFront as idCardFront, |
| | | idCardReverse as idCardReverse, |
| | | consumption as consumption, |
| | | balance as balance, |
| | | integral as integral, |
| | | passWord as passWord, |
| | | openId as openId, |
| | | appletsOpenId as appletsOpenId, |
| | | unionid as unionid, |
| | | state as state, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | select * |
| | | from t_user where flag != 3 |
| | | <if test="null != openid"> |
| | | and appletsOpenId = #{openid} |
| | |
| | | select |
| | | id as id, |
| | | money as money, |
| | | expirationTime as expirationTime, |
| | | insertTime as insertTime, |
| | | companyId as companyId, |
| | | state as state, |
| | |
| | | from t_user_red_packet_record a |
| | | 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 |
| | | where a.state != 0 |
| | | <if test="null != uid"> |
| | | and a.userId = #{uid} |
| | | </if> |
| | |
| | | |
| | | |
| | | <select id="queryRemainingAmount" resultType="double"> |
| | | select ifnull(sum(remainingAmount), 0) from t_user_red_packet_record where userId = #{uid} |
| | | select ifnull(sum(remainingAmount), 0) from t_user_red_packet_record where userId = #{uid} and state = 1 |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="queryWithdrawal" resultType="map"> |
| | | select |
| | | id as id, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d') as insertTime, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime, |
| | | money as money, |
| | | ('银行卡提现') as name, |
| | | code, |
| | |
| | | List<Driver> drivers = driverMapper.queryIdleDriver_(type, serverCarModelId, companyId); |
| | | List<Driver> list = new ArrayList<>(); |
| | | for(Driver driver : drivers){ |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(driver.getId())); |
| | | String value = redisUtil.getValue("DRIVER" + driver.getId()); |
| | | if(null != value){ |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(lat, lon, Double.parseDouble(value.split(",")[1]), Double.parseDouble(value.split(",")[0])); |
| | | if(null != distancematrix){ |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | 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.service.INettyService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取下单推送完后没有司机接单的提醒 |
| | |
| | | break; |
| | | case 2: |
| | | endPushWarpper = orderTaxiService.queryEndPush(uid); |
| | | break; |
| | | case 4: |
| | | endPushWarpper = orderLogisticsService.queryEndPush(uid); |
| | | break; |
| | | } |
| | | return ResultUtil.success(endPushWarpper); |
| | |
| | | case 3: |
| | | orderServerWarpper = orderCrossCityService.queryOrderServer(orderId, uid);//出租车 |
| | | break; |
| | | case 4: |
| | | orderServerWarpper = orderLogisticsService.queryOrderServer(orderId, uid);//专车 |
| | | break; |
| | | } |
| | | return ResultUtil.success(orderServerWarpper); |
| | | } |
| | |
| | | public RedEnvelopePaymentSettings getRedEnvelopePaymentSettings() { |
| | | RedEnvelopePaymentSettings redEnvelopePaymentSettings = this.selectOne(new EntityWrapper<RedEnvelopePaymentSettings>() |
| | | .eq("status", 1) |
| | | .last(" and now() >= effectiveDate order by effectiveDate desc limit 0, 1")); |
| | | .last(" and now() >= effectiveDate order by effectiveDate desc,insertTime desc limit 0, 1")); |
| | | return redEnvelopePaymentSettings; |
| | | } |
| | | } |
| | |
| | | long duration = distancematrix.getDuration();//时间(秒) |
| | | long duration_ = Long.valueOf(duration).longValue(); |
| | | |
| | | List<ServerCarModelWarpper> price = this.getPrice(query.getId(), distance1_, duration_, 0, 1); |
| | | List<ServerCarModelWarpper> price = this.getPrice(query.getId(), distance1_, duration_, 0, type); |
| | | if(price.size() == 0){ |
| | | return ResultUtil.error(language == 1 ? "未获取到可服务的车型" : language == 2 ? "Not obtaining available vehicle-type" : "Ne pas obtenir le type de véhicule disponible", new ArrayList<>()); |
| | | } |
| | |
| | | } |
| | | //开始根据不同的方式计算金额 |
| | | double amount = 0; |
| | | if(type == 1){//专车 |
| | | if(type == 1 || type == 4){//专车 |
| | | JSONObject jsonObject = JSON.parseObject(query1.get("content").toString()); |
| | | Double num1 = jsonObject.getDouble("num1");//起步价(元) |
| | | Double num2 = jsonObject.getDouble("num2");//起步公里(公里) |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil withdrawal(Double money, Integer uid, String remark, Integer language) throws Exception { |
| | | public synchronized ResultUtil withdrawal(Double money, Integer uid, String remark, Integer language) throws Exception { |
| | | language = userInfoService.queryLanguage(uid, language); |
| | | if(money.compareTo(0D) <= 0){ |
| | | return ResultUtil.error(language == 1 ? "提现金额必须大于0" : language == 2 ? "Withdrawal amount must be greater than zero." : "Le montant du retrait doit être supérieur à zéro."); |
| | |
| | | |
| | | static Logger logger = LoggerFactory.getLogger(FleetEngineUtil.class); |
| | | |
| | | private final String SERVICE_ACCOUNT = "odrd2024@i-go-odrd-testing.iam.gserviceaccount.com"; |
| | | private final String SERVICE_ACCOUNT = "odrd-fleetengine-ondemandadmin@i-go-odrd-testing.iam.gserviceaccount.com"; |
| | | |
| | | private final String privateKeyId = "0a9a480fafb6469c0c1b2fa6dbdf6d4bebe1ebed"; |
| | | private final String DRIVER_ACCOUNT = "odrd-fleetengine-driversdkuser@i-go-odrd-testing.iam.gserviceaccount.com"; |
| | | |
| | | 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 CONSUMER_ACCOUNT = "odrd-fleetengine-consumersdkus@i-go-odrd-testing.iam.gserviceaccount.com"; |
| | | |
| | | private final String serverPrivateKeyId = "254e18eefa9fdcca64d5899cdcd793d466c47c7d"; |
| | | |
| | | private final String serverPrivateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCfbNAWnukqLKIxItqmSABxsH5glySEHJ2gfL5KsRF0M02e0Z8/KNKZkoh7I6bOMt1fEtttFaWOeq70IdI2WAd5wVazL3upvl5FW4P08ly33LklfGyLljlJ7ChPny9x6OjAaiS0yD9fh7NWti7rZKU7gzcGL8HddNYXgXV5OajvoG3TGdu52WTxce9AUzU6gLPboz/RbGqrdrmgVJVb0EPlhTJf/NSsaiW4NoL8SEzf/pJGYBmqJs97mXwCHTY4avaC+CP/zz9yS8AQEJlApbVT6lSOhYoR0hNOBj5B886EZOssjubO6hQaiwRnGrV2RdpHynqA1iekfGpUGEtWTsqjAgMBAAECggEALyPbMd0iP8y71sCiG4nty7Au5ju62e+mMkbAc9CAwzXKTVxZdLEK+MsJ3TNxBsami47FYC+G6SbgpaJ8iIImD7v5+XjgXZRDRsnlLmAdx2YWPv3YELxGS1PvpX+B5XJDpGWeXfBaQNKc1lZ/cC4t53eIpSUo82UxSvkGNea1S8lR6vIByhNyCQOvLG4yqaxUy0hZi0kge37XrjYMGS+BivBBnDiVlBPLBVbrNBxOf31Lzz+XX0iwXX7Zl2jN759oe0xQyuIGWUSj8xBDIF8nNaJrla7rWVml3sZJh6/3r1Acj0mhZtE0ZMu5hiPGiIXgb1ng30j3dMP4yVPhXrpAtQKBgQDaU01VnHsnHxc0DQHE2vEOPGmPxVS0/JAssePAEUmKEueUogGef91YY+Vm/ItbhLwGjbytnXxe88zRAdB1u07efZ83ey93TrGl2CJUzLHIcgb+Q1tT642rqlfl+q8ep86hcZ+63pDiIPt2Z+HkbKIR0SWf5LIH4flquQOTQufXXQKBgQC674qDsjOJepZjMMN6PkVMcWBYDNmXHnqa5Oto0rZM745UulbXqEFGuBOsXPU7O33Kfz1vbtoluubKZi5B6cFNnPypE2SCfvdObHq4FuTuKPV6lN93SyhZchmSEXEs0PU4cGDRt+RRqQcjft1Wigiy4Y1y1SInCtcaP1hLejEJ/wKBgFAhvwKrGnBzctrB42JTUaJ9/eis7rg28tvUttjp/2nUIndlNt7r41vr3mj8TFHc1/43y4aVhO584THdTpvHkd0LkoKUjglmMsHCIGercZ02bOap5j1Y+XiGXxij995yjN6oi43U3qyAmosM+dYTITEU6JBVKhrGj/rhyTQlnF5pAoGBAKFGmo0mR/pbDbYD0xH6+VSLGCC+7VbIT+SkjUjBSdA0eOo2XUfvfGmj1C1HgbcZi1wRzJH/5CrbBdQmtc/d+QyZ3Q2NkpBXM8uwIWwDLH0gTzDzkZvc9rG8k70GWUrd+EI6Cf3FFjExj9wazqCjs/+IQr2Ijc97NbsKXYW4pOhHAoGAKf5wYk+cn0cVTsyAom0UbGD5Uijqh5732MeqFYs2Rcwx0OErJZo68COSFFF40hJmmIKn7p3qycIyd1FcYlXN1l4s8mEWTGTInRE0OlBU0+jLtIV9pwNgffpbPYcrWZU6s6YVeJ2nDwl+aD+4QvN0rkPTfho9kjgeyF3PW0I2u4E="; |
| | | |
| | | private final String driverPrivateKeyId = "859e85fb3aa4d18b4afaac3e24e8f65700da5cc9"; |
| | | |
| | | private final String driverPrivateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCmzL1BqSH+Zh9Fct5mXqe5sYOMTnJtOJhwKXnjjo2tNPXv4alzUHz8Vbj6nMar5u5IuKRZMeRBlhoRSFrLm+J1+sfvpH8N4wsnG7hDANknqWzdsk9a68qMHxNQF3hFzs9+KKrR1LAG8e9ytMfliN0kX+xls4uPZDPu1Q39K6V9KXrH/GrMA56i3TtWi7Hmakt5YTELeGjhx4nGrfuQLFFovs1Z9uJtf7E8R95+65StrOAmbJNf7VciEqwBpWYlU5VeyLXMg/oHwnTv2cjdcFozyDrlUHbDmtTiVeBBsYFVLyAsDGfl1p6eiVTiBBuo56YSYLWfaLgYvTyEcZ9jBQsfAgMBAAECggEAQzbTuObX3PT3+vtb5XKVMf33XY2rDJo2y1PbWzhxnO9vf3e22dIAW4qLnOmaIWFQeht1lr/FFCzRWk+Gzu+FJTemY8osrMLmFp9T9CQeXZ4nUXruAVxs5WQMW0Tp4W+CK3tlwmJrgJDzhYyV1Mf/HQ5Oa3kbbu/ZAY/3MCLrb/ClJQvD2rZSDdzAkNMQm8P2hsE71+rH7mI2hHrSCHl2OIp2A64QT8HjtyRc5yHZtTp6ZST1ge9SSIsT0ZfmXKtKF7yGEIPtKNU+oLrGyK5P30xBWJ/bwb3PEz2MZcPvz31+B2+UvZMm7OTkqfcRwEztAf8Ckiuo4im2BRYbVmd9OQKBgQDd0MeLxR+Qtv12bVA0bHtagFEq36THgWG7IM1/1vS4Cl9sveKSOS8A6oKLy624fGE7PKcuTTIzkVA81GXtWBQ9Coq/4TmllQkFTH7pz9C2PNHSCychPwNNV8qUx3lE3d4DOjGKgoVFD4l90AO7lOvmLTSc3pDpr+jSjUH4lqGrbQKBgQDAgXBmpXfCTxwqkBzGwxX+hwJen9qSkCM47qnQ1L4NnXPL6s0EN6rQ3FnFemGIzBUGJ2tajntkKlUu5DzsQeoBGu/SaSwgqD+1UQDcUyo+retmqZ+QYbpeyd3l53bLJJuJNsfak0X76Ft6hrm4julx6RGlmboQyx4kZWbhx4YNOwKBgEG9/2aNpi1eDwFqpLrk7CqGnYf3gP8gebbcoguhyiZB7MZuARkVmbjLyKVmWLa1JpxH/cTbXGWsS/u7d/pAgL8WwMjeGBfbdDD92x+xWEqq/AUlCRPxeSkTPBech3TBzWtndAd5Z8ZwNG/1lyWhnck63L0huhGI8Zh2BXeILaKBAoGAKK3xq69BvGztPc1QV2w4RJ4RER/kl14gI1LDzd52/veL1cabZk3BKfu2eLWg0MCXnMJNvEgpqQQNFiii+yX+phckIKma6pfDRrSEYwqr/azQ9tPXZTJRqOAtpPyhrNHikD9kQjsm6dGzKxQ3QNnqWOjwkrcGi6/wga5v7Dw2hqsCgYEA2T/kSNQ9dqpVBAkfi2J50hqnfFESPjKeirJJZllqhVqsiV0ly8a8Fz8SjGqTzrq+UErko+QmtSlo5h3Uq9Ln+0CwYfrUL+74q2zLHdS0DpY3QsGTEDJXTxCyy9kO26X2UsM3Ez3YUAkdMwdpVz0uVZtinv2735QZOBxoVQV2kQ8="; |
| | | |
| | | private final String consumerPrivateKeyId = "40acf82cbd5250de2f5123caff40738bdd403b08"; |
| | | |
| | | private final String consumerPrivateKey = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDSwtbSBFgIXna6mWeKFWCK31NXUJH6uGduR1XrODGRedrqrTgr0BdNg8PDo6/zh/T+K0Svor6kgqpwnl9soOdn73oC4Nu+Ad7EiKa38j650jlZdLAr4hR0Ou9Kcnv45x/94auUO8jBz844cu24swLKiPsK9OnX65wVlKRfhhkGFuS/4OI76CmE7NqZDqPOW16o8tBO5TsgPVNkglFAU73fTp0kcHoLauT9QOB0+yZi39mnNXyU+2cL3Ylp5oaQCJpyssDRUqz/EiHa7FxUUgzCadG00+ePf5iYSnZKQRKWoOIawFvcCfcHx8GAl8Nn+79HtVQHB9hLsQ5+jqcdfKPfAgMBAAECggEAE9Ufz912xzrUY1TCKH1Ae3Dub732Lqihmv/9dsfv6ieUURcBvSW0u6eViVhi20DE7hH2QazH0cU18qkEg71UaTRgv9qW8vdMFiRhw9d4zZWZrfBMD6UTlahiEhhZ0B83pHVS5v0FNC+w0SEHe6Tks1hWfz5yrs3N/z3ghdihjC/5i1jeBoHXs1262SMazuwNGHblLApGPG+86taeFtbDI+31TKvZ8nomZHkEVFnARRUoBBcIwowRMqNfwlpcJhlz6kDWnoD08kHJ2zzJokozu7Lim+Ugt/MWwUOcA0hgq2QdymZFpkRkDl7tZmJtwTfTirjbGlpnPHVXEc1bWM7ocQKBgQD0LJ8e7JXf6bVFngq0jSJNKK7XDHYg0KhHXMApF59xxi29hdHXWPzgRJ45KkoUJc7MITpIJLXfCmi1XyDMf9m8lIf/oaqhJ7idYi7iAAPOJkdnHbSt0lebyjBWzCQ6OgS4NfF1+LEibTzRqiFs5K8EAyPYAVSTrpWoguoWtTzIGQKBgQDc9/I2PS+91Eb5RvuidTNsDqZJliTJQFlBjlDViFo3+l1N7jDFYwPBR/Tv4TVM5p9Zb+/Lo9X1pjDbm8QriTR4V+4HaLXkcCnmOsdSRInFUW4UIafwLX5ifjgfyaWgdKdn2UP1Lu/1qBN6GU1xjSfBQ6N3UqQiKkNPb7tuPJGqtwKBgQCQ4hU8vTclGMC14VQK1B/BVt1/vuYtDIJ9bZycBWdXlDc52LitpiDOVgjodJ5mHBT77M9vVVERWlTNIfgNP+OL0TptRZlAbJhP0p1s/oNDhFUj6211InVXfH54UkNAxYJdZ6yxynIYsma/JcsVmQ/8Ony/Q/LSempVBfEurjW1qQKBgQCQWPjFLdtOKqnildg0HFPnNvqx/38waPTluk5b76LgBpGFIyCBEVmWnacIPRpQjidyiYkggnp26oXoMC1KM2svYmGAPYr1G8CDQcqLl3JYkAVU6VeHsnBpbwLC4TttQkdJs8iNFohy9cUjcfwBPbDGs6TJghbuqqUl81uBe9e8qQKBgQDZm8T2KB34J7HAc5A+vqkmAo7mQLZg51OrzB1KnDU86pSAf0o3eSvfDUT6dpU9fRuZ1XYnbPnpoJwjFH3m4u9gqKF3PtVYfZyJrEqYwmhB9z6vd+dcsUlXM0fi37bGZkKBD0JGGt5OljM1qJG15x/LYfC/nwOmqWoOhNPCst2Z7w=="; |
| | | |
| | | private final String provider = "i-go-odrd-testing"; |
| | | |
| | |
| | | * @param type 0=服务端,1=乘客,2=司机 |
| | | * @return |
| | | */ |
| | | public Map<String, Object> fleetEngineAuth(int type, Integer id){ |
| | | public Map<String, Object> fleetEngineAuth(int type, String id){ |
| | | try { |
| | | //谷歌云服务器使用这部分代码 |
| | | // AuthTokenMinter minter = AuthTokenMinter.builder() |
| | | // //服务端签名 |
| | | // .setServerSigner(DefaultServiceAccountSigner.create()) |
| | | // .setServerSigner(ImpersonatedSigner.create(SERVICE_ACCOUNT)) |
| | | // //司机端签名 |
| | | // .setDriverSigner(ImpersonatedSigner.create(SERVICE_ACCOUNT)) |
| | | // .setDriverSigner(ImpersonatedSigner.create(DRIVER_ACCOUNT)) |
| | | // //乘客端签名 |
| | | // .setConsumerSigner(ImpersonatedSigner.create(SERVICE_ACCOUNT)) |
| | | // .setConsumerSigner(ImpersonatedSigner.create(CONSUMER_ACCOUNT)) |
| | | // .build(); |
| | | AuthTokenMinter minter = AuthTokenMinter.builder() |
| | | //服务端签名 |
| | | .setServerSigner(LocalSigner.create(SERVICE_ACCOUNT, privateKeyId, privateKey)) |
| | | .setServerSigner(LocalSigner.create(SERVICE_ACCOUNT, serverPrivateKeyId, serverPrivateKey)) |
| | | //司机端签名 |
| | | .setDriverSigner(LocalSigner.create(SERVICE_ACCOUNT, privateKeyId, privateKey)) |
| | | .setDriverSigner(LocalSigner.create(DRIVER_ACCOUNT, driverPrivateKeyId, driverPrivateKey)) |
| | | //乘客端签名 |
| | | .setConsumerSigner(LocalSigner.create(SERVICE_ACCOUNT, privateKeyId, privateKey)) |
| | | .setConsumerSigner(LocalSigner.create(CONSUMER_ACCOUNT, consumerPrivateKeyId, consumerPrivateKey)) |
| | | .build(); |
| | | |
| | | String jwt = ""; |
| | |
| | | expirationTimestamp = serverToken.expirationTimestamp().getTime(); |
| | | } |
| | | if(1 == type){ |
| | | FleetEngineToken consumerToken = minter.getConsumerToken(TripClaims.create("I-GO-USER" + id)); |
| | | FleetEngineToken consumerToken = minter.getConsumerToken(TripClaims.create(id)); |
| | | jwt = consumerToken.jwt(); |
| | | expirationTimestamp = consumerToken.expirationTimestamp().getTime(); |
| | | } |
| | | if(2 == type){ |
| | | FleetEngineToken driverToken = minter.getDriverToken(VehicleClaims.create("I-GO-CAR" + id)); |
| | | FleetEngineToken driverToken = minter.getDriverToken(VehicleClaims.create(id)); |
| | | jwt = driverToken.jwt(); |
| | | expirationTimestamp = driverToken.expirationTimestamp().getTime(); |
| | | } |
| | |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String status = error.getString("status"); |
| | | if(StringUtils.hasLength(status) && status.equals("UNAUTHENTICATED")){ |
| | | redisUtil.remove("google_token"); |
| | | return createVehicles(maximumCapacity, licensePlate, id); |
| | | } |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String status = error.getString("status"); |
| | | if(StringUtils.hasLength(status) && status.equals("UNAUTHENTICATED")){ |
| | | redisUtil.remove("google_token"); |
| | | return updateVehicles(vehicleState, maximumCapacity, licensePlate, id); |
| | | } |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | |
| | | return ""; |
| | | } |
| | | if(code == 401){ |
| | | String status = error.getString("status"); |
| | | if(StringUtils.hasLength(status) && status.equals("UNAUTHENTICATED")){ |
| | | redisUtil.remove("google_token"); |
| | | return getVehicles(id); |
| | | } |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String status = error.getString("status"); |
| | | if(StringUtils.hasLength(status) && status.equals("UNAUTHENTICATED")){ |
| | | redisUtil.remove("google_token"); |
| | | return createTrip(vehicleId, numberOfPassengers, tripId, start_lat, start_lng, end_lat, end_lng); |
| | | } |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | |
| | | if(null != error){ |
| | | Integer code = error.getInteger("code"); |
| | | if(code == 401){ |
| | | String status = error.getString("status"); |
| | | if(StringUtils.hasLength(status) && status.equals("UNAUTHENTICATED")){ |
| | | redisUtil.remove("google_token"); |
| | | return updateTrip(tripStatus, vehicleId, numberOfPassengers, tripId, start_lat, start_lng, end_lat, end_lng); |
| | | } |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | |
| | | return ""; |
| | | } |
| | | if(code == 401){ |
| | | String status = error.getString("status"); |
| | | if(StringUtils.hasLength(status) && status.equals("UNAUTHENTICATED")){ |
| | | redisUtil.remove("google_token"); |
| | | return getTrip(tripId); |
| | | } |
| | | String reason = error.getJSONArray("details").getJSONObject(0).getString("reason"); |
| | | if(reason.equals("ACCESS_TOKEN_EXPIRED")){ |
| | | redisUtil.remove("google_token"); |
| | |
| | | * @param orderType 订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车) |
| | | * @param state 订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付) |
| | | */ |
| | | public void pushOrderState(Integer type, Integer uid, Integer orderId, Integer orderType, Integer state, Integer time){ |
| | | public void pushOrderState(Integer type, Integer uid, Integer orderId, Integer orderType, Integer state, Integer time, String audioUrl){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | |
| | | map.put("orderType", orderType); |
| | | map.put("state", state); |
| | | map.put("time", time); |
| | | map.put("audioUrl", audioUrl); |
| | | jsonObject.put("data", map); |
| | | |
| | | //调用推送 |
| | |
| | | * @param orderType |
| | | * @param status 1=申请,2=同意,3=拒绝 |
| | | */ |
| | | public void pushModifyAddress(Integer type, Integer uid, Integer orderId, Integer orderType, Integer status){ |
| | | public void pushModifyAddress(Integer type, Integer uid, Integer orderId, Integer orderType, Integer status, String audioUrl){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | |
| | | map.put("orderId", orderId); |
| | | map.put("orderType", orderType); |
| | | map.put("status", status); |
| | | map.put("audioUrl", audioUrl); |
| | | jsonObject.put("data", map); |
| | | |
| | | //调用推送 |
| | |
| | | * @param money |
| | | * @param status 1=申请,2=同意,3=拒绝 |
| | | */ |
| | | public void pushPayDifference(Integer type, Integer uid, Integer orderId, Integer orderType, Double money, Integer status){ |
| | | public void pushPayDifference(Integer type, Integer uid, Integer orderId, Integer orderType, Double money, Integer status, String audioUrl){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | |
| | | map.put("orderType", orderType); |
| | | map.put("money", money); |
| | | map.put("status", status); |
| | | map.put("audioUrl", audioUrl); |
| | | jsonObject.put("data", map); |
| | | |
| | | //调用推送 |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util; |
| | | |
| | | import com.google.cloud.texttospeech.v1.*; |
| | | import com.google.protobuf.ByteString; |
| | | |
| | | import java.io.FileOutputStream; |
| | | import java.io.OutputStream; |
| | | |
| | | /** |
| | | * Google语音合成工具 |
| | | * @author zhibing.pu |
| | | * @Date 2024/7/11 9:09 |
| | | */ |
| | | public class TextToSpeechUtil { |
| | | |
| | | |
| | | /** |
| | | * 合成音频文件 |
| | | * @param languageCode 语言编号 |
| | | * @param text 合成文本 |
| | | * @param fileName 音频文件名称 |
| | | * @throws Exception |
| | | */ |
| | | public static String create(String languageCode, String text, String fileName) throws Exception { |
| | | // Instantiates a client |
| | | try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) { |
| | | // Set the text input to be synthesized |
| | | SynthesisInput input = SynthesisInput.newBuilder().setText(text).build(); |
| | | |
| | | // Build the voice request, select the language code ("en-US") and the ssml voice gender |
| | | // ("neutral") |
| | | VoiceSelectionParams voice = |
| | | VoiceSelectionParams.newBuilder() |
| | | .setLanguageCode(languageCode) |
| | | .setSsmlGender(SsmlVoiceGender.MALE) |
| | | .build(); |
| | | |
| | | // Select the type of audio file you want returned |
| | | AudioConfig audioConfig = |
| | | AudioConfig.newBuilder().setAudioEncoding(AudioEncoding.MP3).build(); |
| | | |
| | | // Perform the text-to-speech request on the text input with the selected voice parameters and |
| | | // audio file type |
| | | SynthesizeSpeechResponse response = |
| | | textToSpeechClient.synthesizeSpeech(input, voice, audioConfig); |
| | | |
| | | // Get the audio contents from the response |
| | | ByteString audioContents = response.getAudioContent(); |
| | | |
| | | // Write the response to the output file. |
| | | try (OutputStream out = new FileOutputStream("/usr/local/nginx/html/files/audio/" + fileName)) { |
| | | out.write(audioContents.toByteArray()); |
| | | return "http://182.160.16.251:81/files/audio/" + fileName; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | |
| | | private Integer isFrozen; |
| | | @ApiModelProperty("司机接单时间") |
| | | private String snatchOrderTime; |
| | | @ApiModelProperty("司机超时时间") |
| | | private Long driverTimeOut; |
| | | @ApiModelProperty("超时取消时间") |
| | | private Integer timeOutCancel; |
| | | private Long timeOutCancel; |
| | | private String tripId; |
| | | private List<OrderPosition> orderPositionList; |
| | | |
| | |
| | | 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.setTimeOutCancel(null != map.get("timeOutCancel") ? Long.valueOf(map.get("timeOutCancel").toString()) : 0L); |
| | | orderInfoWarpper.setDriverTimeOut(null != map.get("driverTimeOut") ? Long.valueOf(map.get("driverTimeOut").toString()) : 0L); |
| | | 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() : ""); |
| | |
| | | private Integer isFrozen; |
| | | @ApiModelProperty("中途取消(0=否,1=是)") |
| | | private Integer cancelMidway; |
| | | @ApiModelProperty("备注") |
| | | private String remark; |
| | | @ApiModelProperty("超时取消时间") |
| | | private Long timeOutCancel; |
| | | |
| | | private String tripId; |
| | | |
| | |
| | | this.receipt = receipt; |
| | | } |
| | | |
| | | public Long getTimeOutCancel() { |
| | | return timeOutCancel; |
| | | } |
| | | |
| | | public void setTimeOutCancel(Long timeOutCancel) { |
| | | this.timeOutCancel = timeOutCancel; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderWarpper{" + |
| | |
| | | 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")) : ""); |
| | | orderWarpper.setRemark(null != map.get("remark") ? String.valueOf(map.get("remark")) : ""); |
| | | orderWarpper.setTimeOutCancel(null != map.get("timeOutCancel") ? Long.valueOf(String.valueOf(map.get("timeOutCancel"))) : 0); |
| | | list.add(orderWarpper); |
| | | } |
| | | } |
| | |
| | | this.tripId = tripId; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | @Override |
| | | public int compareTo(Object o) { |
| | | if (o instanceof OrderWarpper) { |
| | |
| | | </select> |
| | | |
| | | <select id="queryRechargeMoneySum" resultType="java.lang.Double"> |
| | | SELECT SUM(amount) |
| | | SELECT ifnull(SUM(amount), 0) |
| | | FROM t_payment_record |
| | | WHERE category = 2 AND userId = #{uid} AND `type` = 1 AND `state` = 2 |
| | | </select> |
| | |
| | | public void run() { |
| | | if(orderTaxi.getState() == 2){ |
| | | //推送司机订单状态 |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0, ""); |
| | | |
| | | } |
| | | } |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0, ""); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0, ""); |
| | | } |
| | | }).start(); |
| | | return ResultUtil.success(); |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0, ""); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | if(bo){ |
| | | continue; |
| | | } |
| | | pushUtil.pushOrderState(2, driver.getId(), orderTaxi.getId(), 2, orderTaxi.getState(), pushOrder.getPushTime()); |
| | | pushUtil.pushOrderState(2, driver.getId(), orderTaxi.getId(), 2, orderTaxi.getState(), pushOrder.getPushTime(), ""); |
| | | } |
| | | } |
| | | Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 |
| | |
| | | base-package: com.stylefeng.guns.modular |
| | | |
| | | |
| | | #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 |
| | | # username: root |
| | | # password: 123456 |
| | | # db-name: guns #用来搜集数据库的所有表 |
| | | # filters: wall,mergeStat |
| | | |
| | | 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://182.160.16.251:3306/igotravel2.0?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B0 |
| | | username: root |
| | | password: 123456 |
| | | password: HjKbXilb9zajmXbl |
| | | db-name: guns #用来搜集数据库的所有表 |
| | | filters: wall,mergeStat |
| | | |
| | |
| | | template-path: /usr/local/nginx/html/mailbox/ |
| | | |
| | | --- |
| | | |
| | | audioPath: /usr/local/nginx/html/files/audio |