Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/IgoTravel into 2.0
| | |
| | | <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> |
| | | |
| | |
| | | <artifactId>fleetengine-auth</artifactId> |
| | | <version>1.11.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.google.cloud</groupId> |
| | | <artifactId>google-cloud-texttospeech</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | | |
| | | <build> |
| | | |
| | |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(GunsApplication.class, args); |
| | | |
| | | try { |
| | | //启动定时任务调度器 |
| | | QuartzUtil.start(GunsApplication.class.getClassLoader().getResourceAsStream("quartz.properties")); |
| | | } catch (SchedulerException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | //启动定时任务调度器 |
| | | QuartzUtil.start(GunsApplication.class.getClassLoader().getResourceAsStream("quartz.properties")); |
| | | logger.info("GunsApplication is success!"); |
| | | } |
| | | |
| | | |
| | | // @PostConstruct |
| | | // void started() { |
| | | // TimeZone.setDefault(TimeZone.getTimeZone("GMT+0")); |
| | | // } |
| | | @PostConstruct |
| | | void started() { |
| | | TimeZone.setDefault(TimeZone.getTimeZone("GMT+0")); |
| | | } |
| | | |
| | | |
| | | @Bean //SpringCloud内部服务质检使用服务名调用 |
| | |
| | | import com.stylefeng.guns.modular.system.dao.DriverActivityHistoryMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.ALiSendSms; |
| | | import com.stylefeng.guns.modular.system.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.util.EmailUtil; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | | import com.stylefeng.guns.modular.system.warpper.BalanceUsageRecord; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | |
| | | switch (Integer.valueOf(String.valueOf(null != map.get("orderType") ? map.get("orderType") : 0))){ |
| | | case 1: |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(map.get("incomeId").toString()); |
| | | if(null == orderPrivateCar){ |
| | | continue; |
| | | } |
| | | baseWarpper.setName(language == 1 ? (orderPrivateCar.getCancelMidway() == 0 ? "" : "【途中取消】") + "打车" : language == 2 ? (orderPrivateCar.getCancelMidway() == 0 ? "" : "【Cancelled during the trip】") + "Ride" : (orderPrivateCar.getCancelMidway() == 0 ? "" : "【Annulé en cours de voyage】") + "Course"); |
| | | break; |
| | | case 2: |
| | |
| | | break; |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(map.get("incomeId").toString()); |
| | | if(null == orderLogistics){ |
| | | continue; |
| | | } |
| | | baseWarpper.setName(language == 1 ? (orderLogistics.getCancelMidway() == 0 ? "" : "【途中取消】") + "包裹" : language == 2 ? (orderLogistics.getCancelMidway() == 0 ? "" : "【Cancelled during the trip】") + "Delivery" : (orderLogistics.getCancelMidway() == 0 ? "" : "【Annulé en cours de voyage】") + "Livraison"); |
| | | break; |
| | | case 5: |
| | |
| | | break; |
| | | case 2: |
| | | OrderTaxi orderTaxi = orderTaxiService.selectById(map.get("incomeId").toString()); |
| | | if(null == orderTaxi){ |
| | | continue; |
| | | } |
| | | List<Income> incomes1 = incomeService.queryData(1, null, 2, orderTaxi.getId(), 2); |
| | | map1.put("travelMoney", orderTaxi != null ? orderTaxi.getTravelMoney() : 0);//行程费 |
| | | map1.put("parkMoney", orderTaxi != null ? orderTaxi.getParkMoney() : 0);//停车费 |
| | |
| | | break; |
| | | case 3: |
| | | OrderCrossCity orderCrossCity = orderCrossCityService.selectById(map.get("incomeId").toString()); |
| | | if(null == orderCrossCity){ |
| | | continue; |
| | | } |
| | | List<Income> incomes2 = incomeService.queryData(1, null, 2, orderCrossCity.getId(), 3); |
| | | map1.put("travelMoney", orderCrossCity != null ? orderCrossCity.getOrderMoney() : 0);//行程费 |
| | | map1.put("parkMoney", 0);//停车费 |
| | |
| | | break; |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(map.get("incomeId").toString()); |
| | | if(null == orderLogistics){ |
| | | continue; |
| | | } |
| | | List<Income> incomes3 = incomeService.queryData(1, null, 2, orderLogistics.getId(), 4); |
| | | map1.put("parkMoney", orderLogistics != null ? orderLogistics.getParkMoney() : 0);//停车费 |
| | | map1.put("tipMoney", 0);//小费 |
| | |
| | | break; |
| | | case 5: |
| | | OrderLogistics orderLogistics1 = orderLogisticsService.selectById(map.get("incomeId").toString()); |
| | | if(null == orderLogistics1){ |
| | | continue; |
| | | } |
| | | List<Income> incomes4 = incomeService.queryData(1, null, 2, orderLogistics1.getId(), 5); |
| | | map1.put("travelMoney", orderLogistics1 != null ? orderLogistics1.getOrderMoney() : 0);//行程费 |
| | | map1.put("parkMoney", 0);//停车费 |
| | |
| | | break; |
| | | } |
| | | baseWarpper.setName(language == 1 ? "取消订单费用" : language == 2 ? "Cancellation fee" : "Frais d'annulation"); |
| | | baseWarpper.setData(new Object()); |
| | | List<Income> incomes = incomeService.queryData(1, 1, 3, Integer.valueOf(map.get("incomeId").toString()), Integer.valueOf(map.get("orderType").toString())); |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | map1.put("rakeMoney", incomes.size() > 0 ? incomes.get(0).getMoney() : 0);//抽成 |
| | | baseWarpper.setData(map1); |
| | | } |
| | | if("5".equals(type)){ |
| | | switch (Integer.valueOf(String.valueOf(null != map.get("orderType") ? map.get("orderType") : 0))){ |
| | |
| | | @PostMapping("/api/driver/getFleetEngineAuth") |
| | | @ApiOperation(value = "获取google地图授权token", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "车辆id", name = "vehicleId", 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 vehicleId, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Map<String, Object> s = fleetEngineUtil.fleetEngineAuth(2, uid); |
| | | Map<String, Object> s = fleetEngineUtil.fleetEngineAuth(2, vehicleId); |
| | | return ResultUtil.success(s); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/textToSpeech") |
| | | @ApiOperation(value = "获取语音播报文件地址", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "语言", name = "languageCode", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "内容", name = "text", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "文件名称", name = "fileName", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil 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 ResultUtil.success(s); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 手动添加当日活动 |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/base/driver/addTodayActivity") |
| | | public void addTodayActivity(){ |
| | | try { |
| | | driverService.addTodayActivity(); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | |
| | | @PostMapping("/addDriverOnline") |
| | | public String addDriverOnline(Integer driverId){ |
| | | try { |
| | | driverOnlineService.addDriverOnline(driverId); |
| | | driverOnlineService.addDriverOnline1(driverId); |
| | | return JSON.toJSONString(ResultUtil.success()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil updateEndAddress(Integer orderId, Integer orderType, Integer status){ |
| | | if(null == orderId){ |
| | | return ResultUtil.error("订单id不能为空"); |
| | | } |
| | | if(null == orderType){ |
| | | return ResultUtil.error("订单类型不能为空"); |
| | | } |
| | | if(null == status){ |
| | | return ResultUtil.error("状态不能为空"); |
| | | } |
| | | switch (orderType){ |
| | | case 1: |
| | | orderPrivateCarService.updateEndAddress(orderId, status); |
| | |
| | | * @param driverId |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryOrderList(@Param("driverId") Integer driverId, |
| | | List<Map<String, Object>> queryOrderList(@Param("state") Integer state, @Param("driverId") Integer driverId, |
| | | @Param("language") Integer language); |
| | | |
| | | |
| | |
| | | a.isFrozen, |
| | | a.priceDifference, |
| | | a.tripId, |
| | | DATE_FORMAT(a.snatchOrderTime, '%Y-%m-%d %H:%i:%s') as snatchOrderTime |
| | | a.companyId, |
| | | DATE_FORMAT(a.snatchOrderTime, '%Y-%m-%d %H:%i:%s') as snatchOrderTime, |
| | | a.cancelMidway, |
| | | a.remark, |
| | | DATE_FORMAT(a.estimateArriveTime, '%Y-%m-%d %H:%i:%s') as estimateArriveTime, |
| | | a.estimateArriveMileage, |
| | | 1 as orderType |
| | | from t_order_logistics a |
| | | left join t_user b on (a.userId = b.id) |
| | | left join t_order_cancel c on (a.id = c.orderId and c.orderType = a.type and c.state = 2) |
| | |
| | | |
| | | |
| | | <select id="queryOrderList" resultType="map"> |
| | | select |
| | | id as id, |
| | | type as type, |
| | | if(#{language} = 1, '包裹', if(#{language} = 2, 'Delivery', 'Livraison')) as `name`, |
| | | DATE_FORMAT(travelTime, '%Y-%m-%d %H:%i:%s') as `time`, |
| | | startAddress as startAddress, |
| | | endAddress as endAddress, |
| | | state as state, |
| | | CONCAT(recipient, '-', recipientPhone) as `user`, |
| | | CONCAT(if(#{language} = 1, if(cargoType = 1, '普通货物 x ', '贵重货物 x '), if(#{language} = 2, if(cargoType = 1, 'General cargo x ', 'Valuable cargo x '), if(cargoType = 1, 'Pour marchandises générales x ', 'Marchandises de valeur x '))), cargoNumber) as cargoNumber, |
| | | driverId as driverId, |
| | | isFrozen |
| | | from t_order_logistics where 1 = 1 |
| | | <if test="null != driverId"> |
| | | and driverId = #{driverId} |
| | | <if test="1 == state"> |
| | | select |
| | | id as id, |
| | | type as type, |
| | | if(#{language} = 1, '包裹', if(#{language} = 2, 'Delivery', 'Livraison')) as `name`, |
| | | DATE_FORMAT(travelTime, '%Y-%m-%d %H:%i:%s') as `time`, |
| | | startAddress as startAddress, |
| | | endAddress as endAddress, |
| | | state as state, |
| | | CONCAT(recipient, '-', recipientPhone) as `user`, |
| | | CONCAT(if(#{language} = 1, if(cargoType = 1, '普通货物 x ', '贵重货物 x '), if(#{language} = 2, if(cargoType = 1, 'General cargo x ', 'Valuable cargo x '), if(cargoType = 1, 'Pour marchandises générales x ', 'Marchandises de valeur x '))), cargoNumber) as cargoNumber, |
| | | driverId as driverId, |
| | | isFrozen |
| | | from t_order_logistics where 1 = 1 |
| | | <if test="null != driverId"> |
| | | and driverId = #{driverId} |
| | | </if> |
| | | and (state in (3, 4, 5, 6, 11) or (state = 2 and (UNIX_TIMESTAMP(travelTime) - UNIX_TIMESTAMP(now())) < 1800)) |
| | | </if> |
| | | and state in (2, 3, 4, 5, 8, 11,12) |
| | | <if test="2 == state"> |
| | | select |
| | | id as id, |
| | | type as type, |
| | | if(#{language} = 1, '包裹', if(#{language} = 2, 'Delivery', 'Livraison')) as `name`, |
| | | DATE_FORMAT(travelTime, '%Y-%m-%d %H:%i:%s') as `time`, |
| | | startAddress as startAddress, |
| | | endAddress as endAddress, |
| | | state as state, |
| | | CONCAT(recipient, '-', recipientPhone) as `user`, |
| | | CONCAT(if(#{language} = 1, if(cargoType = 1, '普通货物 x ', '贵重货物 x '), if(#{language} = 2, if(cargoType = 1, 'General cargo x ', 'Valuable cargo x '), if(cargoType = 1, 'Pour marchandises générales x ', 'Marchandises de valeur x '))), cargoNumber) as cargoNumber, |
| | | driverId as driverId, |
| | | isFrozen |
| | | from t_order_logistics where 1 = 1 |
| | | <if test="null != driverId"> |
| | | and driverId = #{driverId} |
| | | </if> |
| | | and state = 2 and (UNIX_TIMESTAMP(travelTime) - UNIX_TIMESTAMP(now())) >= 1800 |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | |
| | | UNIX_TIMESTAMP(travelTime) as travelTime, |
| | | remark as remark, |
| | | driverPay, |
| | | cancelMidway |
| | | cancelMidway, |
| | | isFrozen |
| | | from t_order_logistics where driverId = #{uid} |
| | | <if test="state == 1"> |
| | | and state not in (1, 7) |
| | | </if> |
| | | <if test="state == 2"> |
| | | and state = 8 |
| | | and state = 7 |
| | | </if> |
| | | <if test="state == 3"> |
| | | and state = 10 |
| | | </if> |
| | | <if test="state == 4"> |
| | | and state in (6, 9) |
| | | and state in (8, 9) |
| | | </if> |
| | | order by insertTime desc |
| | | </select> |
| | |
| | | */ |
| | | @TableField("tripId") |
| | | private String tripId; |
| | | /** |
| | | * 司机预估到达预约单时间 |
| | | */ |
| | | @TableField("estimateArriveTime") |
| | | private Date estimateArriveTime; |
| | | /** |
| | | * 司机预估距离预约点距离(米) |
| | | */ |
| | | @TableField("estimateArriveMileage") |
| | | private Long estimateArriveMileage; |
| | | /** |
| | | * 去往起点的路程数(米) |
| | | */ |
| | | @TableField("toStartPointMileage") |
| | | private Double toStartPointMileage; |
| | | /** |
| | | * 起步分钟 |
| | | */ |
| | | @TableField("startDuration") |
| | | private Integer startDuration; |
| | | } |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryOrderList(Integer driverId, Integer language) throws Exception; |
| | | List<Map<String, Object>> queryOrderList(Integer state, Integer driverId, Integer language) throws Exception; |
| | | |
| | | |
| | | |
| | |
| | | ResultUtil confirmFees(Integer language, Integer orderId, Integer type, Double parkingFee, Double crossingFee) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 计算已服务的实时里程 |
| | | * @param orderId |
| | | * @param lon |
| | | * @param lat |
| | | */ |
| | | boolean calculateMileage(Integer orderId, String lon, String lat) throws Exception; |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; |
| | | import com.stylefeng.guns.modular.system.util.quartz.QuartzUtil; |
| | | import com.stylefeng.guns.modular.system.util.quartz.jobs.OrderTimeOutJob; |
| | |
| | | import org.jsoup.nodes.Element; |
| | | import org.jsoup.select.Elements; |
| | | import org.quartz.JobDataMap; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Service |
| | | public class OrderLogisticsServiceImpl extends ServiceImpl<OrderLogisticsMapper, OrderLogistics> implements IOrderLogisticsService { |
| | | |
| | | Logger log = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | @Resource |
| | | private OrderLogisticsMapper orderLogisticsMapper; |
| | |
| | | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | @Autowired |
| | | private ISysOvertimeService sysOvertimeService; |
| | | |
| | | @Resource |
| | | private ICancleOrderService cancleOrderService; |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | |
| | | |
| | |
| | | if(!StringUtils.hasLength(orderLogistics.getTripId())){ |
| | | orderLogistics.setTripId(UUIDUtil.getRandomCode()); |
| | | } |
| | | 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()); |
| | | } |
| | | this.updateById(orderLogistics); |
| | | //修改司机为服务中 |
| | | driver.setState(3); |
| | | driverService.updateById(driver); |
| | | |
| | | /** |
| | | * 超时用户取消不收费的提醒 |
| | | * 即时单:预估到达预约点时间 + 配置不收费的时间 > 当前时间 (只弹一次) |
| | | * |
| | | * 超时用户取消订单后需要弹给司机提醒弹框,超时时间 = 当前时间 - 行程时间 - 配置不收费的时间 |
| | | * |
| | | * 定时提醒弹框 |
| | | * 司机只要开始超时且还未到达预约点,则需要定时提醒 |
| | | */ |
| | | |
| | | //添加定时任务(普通任务) |
| | | ReminderRules reminderRules = reminderRulesService.selectOne(new EntityWrapper<ReminderRules>().eq("companyId", driver.getCompanyId())); |
| | | SysOvertime reminderRules = sysOvertimeService.selectOne(new EntityWrapper<SysOvertime>().eq("companyId", driver.getCompanyId())); |
| | | if(null != reminderRules){ |
| | | JSONObject jsonObject = JSON.parseObject(reminderRules.getContent()); |
| | | long packageTimeoutReminderInterval = jsonObject.getInteger("packageTimeoutReminderInterval") * 60000L; |
| | | long m = (System.currentTimeMillis() - orderLogistics.getSnatchOrderTime().getTime()) / 60000; |
| | | CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", driver.getCompanyId())); |
| | | Integer driverTimeout = JSON.parseObject(cancleOrder.getContent()).getInteger("driverTimeout"); |
| | | //超时时间 |
| | | long timeOut = orderLogistics.getEstimateArriveTime().getTime() + (driverTimeout * 60 * 1000); |
| | | //乘客取消不收费提醒 |
| | | JobDataMap jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("driverId", uid); |
| | | jobDataMap.put("timeOutType", 1); |
| | | jobDataMap.put("orderId", orderLogistics.getId()); |
| | | jobDataMap.put("orderType", 4); |
| | | jobDataMap.put("describe", language == 1 ? "您的包裹订单已超时" + m + "分钟,请抓紧!" : language == 2 ? "Your delivery order is overdue for " + m + " minute(s), please go faster." : "Votre commande de livraison est en retard depuis " + m + " minute(s), veuillez aller plus vite."); |
| | | jobDataMap.put("language", language); |
| | | jobDataMap.put("timeOut", timeOut); |
| | | jobDataMap.put("describe", language == 1 ? "您已超时" + driverTimeout + "分钟,用户可免费取消订单" : language == 2 ? "Reminder You are overdue for " + driverTimeout + " minutes The subscriber could cancel the order for free Confirm" : "Rappel Vous êtes en retard de " + driverTimeout + " minutes L’abonné peut annuler la commande gratuitement Confirmer"); |
| | | QuartzUtil.addSimpleQuartzTask( |
| | | new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderLogistics.getId() + "_4", "ORDER_TIME_OUT", jobDataMap) |
| | | , new Date(packageTimeoutReminderInterval), packageTimeoutReminderInterval, -1); |
| | | , new Date(timeOut), timeOut, 0); |
| | | |
| | | //超时循环提醒 |
| | | jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("driverId", uid); |
| | | jobDataMap.put("timeOutType", 3); |
| | | jobDataMap.put("orderId", orderLogistics.getId()); |
| | | jobDataMap.put("orderType", 4); |
| | | jobDataMap.put("language", language); |
| | | jobDataMap.put("timeOut", orderLogistics.getEstimateArriveTime().getTime()); |
| | | jobDataMap.put("describe", ""); |
| | | QuartzUtil.addSimpleQuartzTask( |
| | | new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderLogistics.getId() + "_4", "ORDER_TIME_OUT", jobDataMap) |
| | | , orderLogistics.getEstimateArriveTime(), reminderRules.getCar() * 60000, -1); |
| | | } |
| | | |
| | | Car car = carService.selectById(orderLogistics.getCarId()); |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carService.updateById(car); |
| | | } |
| | | String trip = fleetEngineUtil.getTrip(orderLogistics.getTripId()); |
| | | if(ToolUtil.isEmpty(trip)){ |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | new Thread(()->{ |
| | | try { |
| | | Car car = carService.selectById(orderLogistics.getCarId()); |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carService.updateById(car); |
| | | } |
| | | String trip = fleetEngineUtil.getTrip(orderLogistics.getTripId()); |
| | | if(ToolUtil.isEmpty(trip)){ |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | fleetEngineUtil.createTrip(car.getVehicleId(), 1, orderLogistics.getTripId(), |
| | | orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(), orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | }else{ |
| | | //开始修改行程数据 |
| | | fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | fleetEngineUtil.createTrip(car.getVehicleId(), 1, orderLogistics.getTripId(), |
| | | orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(), orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | }else{ |
| | | //开始修改行程数据 |
| | | fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); |
| | | } |
| | | }).start(); |
| | | |
| | | //推送相关代码------------------start---------------- |
| | | new Thread(new Runnable() { |
| | |
| | | this.updateById(orderLogistics); |
| | | |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | Car car = carMapper.selectById(driver.getCarId()); |
| | | //修改行程数据 |
| | | fleetEngineUtil.updateTrip(tripStatus, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); |
| | | String finalTripStatus = tripStatus; |
| | | new Thread(()->{ |
| | | Car car = carMapper.selectById(driver.getCarId()); |
| | | //修改行程数据 |
| | | try { |
| | | fleetEngineUtil.updateTrip(finalTripStatus, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }).start(); |
| | | |
| | | // TODO: 2020/6/5 推送状态 |
| | | new Thread(new Runnable() { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> queryOrderList(Integer driverId, Integer language) throws Exception { |
| | | List<Map<String, Object>> list = orderLogisticsMapper.queryOrderList(driverId, language); |
| | | public List<Map<String, Object>> queryOrderList(Integer state, Integer driverId, Integer language) throws Exception { |
| | | List<Map<String, Object>> list = orderLogisticsMapper.queryOrderList(state, driverId, language); |
| | | for (Map<String, Object> map : list) { |
| | | if(null != map.get("time")){ |
| | | String time = map.get("time").toString(); |
| | |
| | | orderLogistics.setEndLon(Double.valueOf(orderLogistics.getDestinationLon())); |
| | | orderLogistics.setEndLat(Double.valueOf(orderLogistics.getDestinationLat())); |
| | | orderLogistics.setEndAddress(orderLogistics.getDestination()); |
| | | //修改google地图行程终点 |
| | | try { |
| | | fleetEngineUtil.updateTrip(null, null, null, orderLogistics.getTripId(), |
| | | null, null, orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | orderLogistics.setDestinationLon(""); |
| | | orderLogistics.setDestination(""); |
| | |
| | | @Override |
| | | public Map<String, Object> queryMoneyInfo(Integer orderId) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | if(orderLogistics.getState() == 5){//服务中的时候获取实时费用数据 |
| | | if(orderLogistics.getState() == 6){//服务中的时候获取实时费用数据 |
| | | this.setMoney(orderLogistics, 0D, 0D); |
| | | } |
| | | |
| | |
| | | amount = num25 + (d1 * num26) + (t1 * num27) + (w1 * num7) + yt1 + yt2 + yt3; |
| | | orderLogistics.setStartMileage(num2); |
| | | orderLogistics.setStartMoney(num25);//起步价 |
| | | orderLogistics.setStartDuration((int)(num3.doubleValue())); |
| | | orderLogistics.setMileageKilometers(new BigDecimal(d1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | orderLogistics.setMileageMoney(new BigDecimal(d1 * num26).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//里程费 |
| | | orderLogistics.setDuration(new BigDecimal(t1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | orderLogistics.setDiscount(0D);//优惠抵扣 |
| | | orderLogistics.setPayMoney(0D);//支付金额 |
| | | orderLogistics.setOrderMoney(new BigDecimal(amount + parkingFee + crossingFee).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | |
| | | return orderLogistics; |
| | | } |
| | | |
| | |
| | | amount = num1 + (d1 * num4) + (t1 * num5) + (w1 * num7) + yt1 + yt2 + yt3; |
| | | orderLogistics.setStartMileage(num2); |
| | | orderLogistics.setStartMoney(num1);//起步价 |
| | | orderLogistics.setStartDuration((int)(num3.doubleValue())); |
| | | orderLogistics.setMileageKilometers(new BigDecimal(d1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | orderLogistics.setMileageMoney(new BigDecimal(d1 * num4).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//里程费 |
| | | orderLogistics.setDuration(new BigDecimal(t1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | @Override |
| | | public ResultUtil confirmFees(Integer language, Integer orderId, Integer type, Double parkingFee, Double crossingFee) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | if(6 != orderLogistics.getState()){ |
| | | return ResultUtil.error("操作异常,请刷新订单"); |
| | | } |
| | | if(orderLogistics.getArriveTime()==null){ |
| | | orderLogistics.setArriveTime(orderLogistics.getStartServiceTime()); |
| | | } |
| | |
| | | pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 4, finalOrderTaxi.getState()); |
| | | } |
| | | }).start(); |
| | | |
| | | //上报google |
| | | OrderLogistics finalOrderLogistics = orderLogistics; |
| | | new Thread(()->{ |
| | | try { |
| | | fleetEngineUtil.reportBillableEvent(finalOrderLogistics.getTripId()); |
| | | log.warn("上报时间:{},tripid:{},created_at:{},completed_at:{}", System.currentTimeMillis(), finalOrderLogistics.getTripId(), |
| | | finalOrderLogistics.getInsertTime().getTime(), finalOrderLogistics.getEndServiceTime().getTime()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 计算已服务的实时里程 |
| | | * @param orderId |
| | | * @param lon |
| | | * @param lat |
| | | */ |
| | | @Override |
| | | public boolean calculateMileage(Integer orderId, String lon, String lat) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | OrderPosition orderPosition = orderPositionService.queryNew(orderId, 4); |
| | | String now = lon + "," + lat; |
| | | String old = null; |
| | | if(null != orderPosition){ |
| | | old = orderPosition.getLon() + "," + orderPosition.getLat(); |
| | | }else{ |
| | | orderLogistics.setToStartPointMileage(0D); |
| | | orderLogistics.setMileage(0D); |
| | | this.updateById(orderLogistics); |
| | | return true;//第一条数据不作处理,直接存储 |
| | | } |
| | | |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(now, old); |
| | | if(null != distance){ |
| | | Double distance1 = distance.get("WGS84"); |
| | | if(distance1 > 50 && orderLogistics.getState() < 5){//大于50米表示在移动 |
| | | orderLogistics.setToStartPointMileage(new BigDecimal(orderLogistics.getToStartPointMileage()).add(new BigDecimal(distance1)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | this.updateById(orderLogistics); |
| | | return true; |
| | | } |
| | | if(distance1 > 50 && orderLogistics.getState()==5){//大于50米表示在移动 |
| | | orderLogistics.setMileage(new BigDecimal(orderLogistics.getMileage()).add(new BigDecimal(distance1)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | this.updateById(orderLogistics); |
| | | return true; |
| | | } |
| | | return false; |
| | | }else{ |
| | | System.err.println("调用高德计算距离出错"); |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | |
| | | <if test="null != driverId"> |
| | | and driverId = #{driverId} |
| | | </if> |
| | | and state = 2 and (UNIX_TIMESTAMP(travelTime) - UNIX_TIMESTAMP(now())) < 1800 |
| | | |
| | | UNION ALL |
| | | |
| | | select |
| | | id as id, |
| | | (1) as type, |
| | | if(#{language} = 1, '打车', if(#{language} = 2 , 'Ride', 'Course')) as `name`, |
| | | DATE_FORMAT(travelTime, '%Y-%m-%d %H:%i:%s') as time, |
| | | startAddress as startAddress, |
| | | endAddress as endAddress, |
| | | state as state, |
| | | orderType as reservation, |
| | | driverId as driverId, |
| | | isFrozen |
| | | from t_order_private_car where 1 = 1 |
| | | <if test="null != driverId"> |
| | | and driverId = #{driverId} |
| | | </if> |
| | | and state in (3, 4, 5, 6, 11) |
| | | and (state in (3, 4, 5, 6, 11) or (state = 2 and (UNIX_TIMESTAMP(travelTime) - UNIX_TIMESTAMP(now())) < 1800)) |
| | | </if> |
| | | <if test="state == 2"> |
| | | select |
| | |
| | | remark as remark, |
| | | driverPay, |
| | | cancelMidway, |
| | | as settleAccounts |
| | | isFrozen |
| | | from t_order_private_car |
| | | where driverId = #{driverId} |
| | | <if test="state == 1"> |
| | |
| | | a.driverPay, |
| | | a.isFrozen, |
| | | a.tripId, |
| | | DATE_FORMAT(a.snatchOrderTime, '%Y-%m-%d %H:%i:%s') as snatchOrderTime |
| | | a.companyId, |
| | | DATE_FORMAT(a.snatchOrderTime, '%Y-%m-%d %H:%i:%s') as snatchOrderTime, |
| | | a.cancelMidway, |
| | | DATE_FORMAT(a.estimateArriveTime, '%Y-%m-%d %H:%i:%s') as estimateArriveTime, |
| | | a.estimateArriveMileage, |
| | | a.orderType |
| | | from t_order_private_car a |
| | | left join t_user b on (a.userId = b.id) |
| | | left join t_order_cancel c on (a.id = c.orderId and c.orderType = 1 and c.state = 2) |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="taskMidAxbUnBindSend" resultType="OrderPrivateCar"> |
| | | select |
| | | id as id, |
| | | `type` as `type`, |
| | | userId as userId, |
| | | serverCarModelId as serverCarModelId, |
| | | driverId as driverId, |
| | | carId as carId, |
| | | orderNum as orderNum, |
| | | placementLon as placementLon, |
| | | placementLat as placementLat, |
| | | placementAddress as placementAddress, |
| | | startLon as startLon, |
| | | startLat as startLat, |
| | | startAddress as startAddress, |
| | | endLon as endLon, |
| | | endLat as endLat, |
| | | endAddress as endAddress, |
| | | boardingLon as boardingLon, |
| | | boardingLat as boardingLat, |
| | | boardingAddress as boardingAddress, |
| | | boardingTime as boardingTime, |
| | | getoffLon as getoffLon, |
| | | getoffLat as getoffLat, |
| | | getoffAddress as getoffAddress, |
| | | getoffTime as getoffTime, |
| | | mileage as mileage, |
| | | payManner as payManner, |
| | | payType as payType, |
| | | orderMoney as orderMoney, |
| | | startMileage as startMileage, |
| | | startMoney as startMoney, |
| | | mileageKilometers as mileageKilometers, |
| | | mileageMoney as mileageMoney, |
| | | duration as duration, |
| | | durationMoney as durationMoney, |
| | | wait as wait, |
| | | waitMoney as waitMoney, |
| | | longDistance as longDistance, |
| | | longDistanceMoney as longDistanceMoney, |
| | | parkMoney as parkMoney, |
| | | roadTollMoney as roadTollMoney, |
| | | redPacketMoney as redPacketMoney, |
| | | couponMoney as couponMoney, |
| | | redPacketId as redPacketId, |
| | | couponId as couponId, |
| | | discount as discount, |
| | | discountMoney as discountMoney, |
| | | activityId as activityId, |
| | | companyId as companyId, |
| | | payMoney as payMoney, |
| | | substitute as substitute, |
| | | passengers as passengers, |
| | | passengersPhone as passengersPhone, |
| | | state as state, |
| | | insertTime as insertTime, |
| | | travelTime as travelTime, |
| | | snatchOrderTime as snatchOrderTime, |
| | | setOutTime as setOutTime, |
| | | arriveTime as arriveTime, |
| | | startServiceTime as startServiceTime, |
| | | endServiceTime as endServiceTime, |
| | | orderType as orderType, |
| | | orderSource as orderSource, |
| | | invoiceId as invoiceId, |
| | | isReassign as isReassign, |
| | | reassignNotice as reassignNotice, |
| | | trackId as trackId, |
| | | isDelete as isDelete, |
| | | oldState as oldState, |
| | | telX as telX, |
| | | bindId as bindId |
| | | from t_order_private_car where (state in (8, 9) and telX != '' and telX is not null and (UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(endServiceTime)) > 1800) or (state = 10 and telX != '' and telX is not null) |
| | | <select id="taskMidAxbUnBindSend" resultType="com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar"> |
| | | select * from t_order_private_car where (state in (8, 9) and telX != '' and telX is not null and (UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(endServiceTime)) > 1800) or (state = 10 and telX != '' and telX is not null) |
| | | </select> |
| | | |
| | | |
| | | <select id="queryByState" resultType="OrderPrivateCar"> |
| | | select |
| | | id as id, |
| | | `type` as `type`, |
| | | userId as userId, |
| | | serverCarModelId as serverCarModelId, |
| | | driverId as driverId, |
| | | carId as carId, |
| | | orderNum as orderNum, |
| | | placementLon as placementLon, |
| | | placementLat as placementLat, |
| | | placementAddress as placementAddress, |
| | | startLon as startLon, |
| | | startLat as startLat, |
| | | startAddress as startAddress, |
| | | endLon as endLon, |
| | | endLat as endLat, |
| | | endAddress as endAddress, |
| | | boardingLon as boardingLon, |
| | | boardingLat as boardingLat, |
| | | boardingAddress as boardingAddress, |
| | | boardingTime as boardingTime, |
| | | getoffLon as getoffLon, |
| | | getoffLat as getoffLat, |
| | | getoffAddress as getoffAddress, |
| | | getoffTime as getoffTime, |
| | | mileage as mileage, |
| | | payManner as payManner, |
| | | payType as payType, |
| | | orderMoney as orderMoney, |
| | | startMileage as startMileage, |
| | | startMoney as startMoney, |
| | | mileageKilometers as mileageKilometers, |
| | | mileageMoney as mileageMoney, |
| | | duration as duration, |
| | | durationMoney as durationMoney, |
| | | wait as wait, |
| | | waitMoney as waitMoney, |
| | | longDistance as longDistance, |
| | | longDistanceMoney as longDistanceMoney, |
| | | parkMoney as parkMoney, |
| | | roadTollMoney as roadTollMoney, |
| | | redPacketMoney as redPacketMoney, |
| | | couponMoney as couponMoney, |
| | | redPacketId as redPacketId, |
| | | couponId as couponId, |
| | | discount as discount, |
| | | discountMoney as discountMoney, |
| | | activityId as activityId, |
| | | companyId as companyId, |
| | | payMoney as payMoney, |
| | | substitute as substitute, |
| | | passengers as passengers, |
| | | passengersPhone as passengersPhone, |
| | | state as state, |
| | | insertTime as insertTime, |
| | | travelTime as travelTime, |
| | | snatchOrderTime as snatchOrderTime, |
| | | setOutTime as setOutTime, |
| | | arriveTime as arriveTime, |
| | | startServiceTime as startServiceTime, |
| | | endServiceTime as endServiceTime, |
| | | orderType as orderType, |
| | | orderSource as orderSource, |
| | | invoiceId as invoiceId, |
| | | isReassign as isReassign, |
| | | reassignNotice as reassignNotice, |
| | | trackId as trackId, |
| | | isDelete as isDelete, |
| | | oldState as oldState, |
| | | telX as telX, |
| | | bindId as bindId |
| | | from t_order_private_car where isDelete = 1 and userId = #{uid} |
| | | <select id="queryByState" resultType="com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar"> |
| | | select * from t_order_private_car where isDelete = 1 and userId = #{uid} |
| | | <if test="null != orderType"> |
| | | and orderType = #{orderType} |
| | | </if> |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="query" resultType="OrderPrivateCar"> |
| | | select |
| | | id as id, |
| | | userId as userId, |
| | | driverId as driverId, |
| | | carId as carId, |
| | | orderNum as orderNum, |
| | | placementLon as placementLon, |
| | | placementLat as placementLat, |
| | | placementAddress as placementAddress, |
| | | startLon as startLon, |
| | | startLat as startLat, |
| | | startAddress as startAddress, |
| | | endLon as endLon, |
| | | endLat as endLat, |
| | | endAddress as endAddress, |
| | | boardingLon as boardingLon, |
| | | boardingLat as boardingLat, |
| | | boardingAddress as boardingAddress, |
| | | boardingTime as boardingTime, |
| | | getoffLon as getoffLon, |
| | | getoffLat as getoffLat, |
| | | getoffAddress as getoffAddress, |
| | | getoffTime as getoffTime, |
| | | mileage as mileage, |
| | | payManner as payManner, |
| | | payType as payType, |
| | | orderMoney as orderMoney, |
| | | parkMoney as parkMoney, |
| | | roadTollMoney as roadTollMoney, |
| | | redPacketMoney as redPacketMoney, |
| | | couponMoney as couponMoney, |
| | | redPacketId as redPacketId, |
| | | couponId as couponId, |
| | | discount as discount, |
| | | discountMoney as discountMoney, |
| | | activityId as activityId, |
| | | companyId as companyId, |
| | | payMoney as payMoney, |
| | | substitute as substitute, |
| | | passengers as passengers, |
| | | passengersPhone as passengersPhone, |
| | | state as state, |
| | | insertTime as insertTime, |
| | | travelTime as travelTime, |
| | | snatchOrderTime as snatchOrderTime, |
| | | setOutTime as setOutTime, |
| | | arriveTime as arriveTime, |
| | | startServiceTime as startServiceTime, |
| | | endServiceTime as endServiceTime, |
| | | orderType as orderType, |
| | | orderSource as orderSource, |
| | | invoiceId as invoiceId, |
| | | isReassign as isReassign, |
| | | trackId as trackId, |
| | | orderType as reservation |
| | | from t_order_private_car where 1 = 1 |
| | | <select id="query" resultType="com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar"> |
| | | select * from t_order_private_car where 1 = 1 |
| | | <if test="null != state"> |
| | | and state in |
| | | <foreach collection="state" item="item" index="index" open="(" separator="," close=")"> |
| | |
| | | @TableField("getoffTime") |
| | | private Date getoffTime; |
| | | /** |
| | | * 去往起点的路程数(米) |
| | | */ |
| | | @TableField("toStartPointMileage") |
| | | private Double toStartPointMileage; |
| | | /** |
| | | * 行驶里程数(米) |
| | | */ |
| | | @TableField("mileage") |
| | |
| | | * 红包id |
| | | */ |
| | | @TableField("redPacketId") |
| | | private Integer redPacketId; |
| | | private String redPacketId; |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | |
| | | */ |
| | | @TableField("tripId") |
| | | private String tripId; |
| | | /** |
| | | * 司机预估到达预约单时间 |
| | | */ |
| | | @TableField("estimateArriveTime") |
| | | private Date estimateArriveTime; |
| | | /** |
| | | * 司机预估距离预约点距离(米) |
| | | */ |
| | | @TableField("estimateArriveMileage") |
| | | private Long estimateArriveMileage; |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.quartz.QuartzUtil; |
| | | import com.stylefeng.guns.modular.system.util.quartz.jobs.OrderTimeOutJob; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.apache.shiro.util.StringUtils; |
| | | import org.quartz.JobDataMap; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Service |
| | | public class OrderPrivateCarServiceImpl extends ServiceImpl<OrderPrivateCarMapper, OrderPrivateCar> implements IOrderPrivateCarService { |
| | | |
| | | Logger log = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | @Resource |
| | | private OrderPrivateCarMapper orderPrivateCarMapper; |
| | |
| | | private String filePath; |
| | | |
| | | @Autowired |
| | | private IReminderRulesService reminderRulesService; |
| | | private ISysOvertimeService sysOvertimeService; |
| | | |
| | | @Autowired |
| | | private FleetEngineUtil fleetEngineUtil; |
| | |
| | | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | @Resource |
| | | private ICancleOrderService cancleOrderService; |
| | | |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | |
| | |
| | | if(!StringUtils.hasLength(orderPrivateCar.getTripId())){ |
| | | orderPrivateCar.setTripId(UUIDUtil.getRandomCode()); |
| | | } |
| | | |
| | | 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()); |
| | | } |
| | | } |
| | | this.updateById(orderPrivateCar); |
| | | |
| | | //如果是预约单,则不修改司机为服务中 |
| | |
| | | driver.setState(3); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | |
| | | //添加定时任务(普通任务) |
| | | ReminderRules reminderRules = reminderRulesService.selectOne(new EntityWrapper<ReminderRules>().eq("companyId", driver.getCompanyId())); |
| | | if(null != reminderRules){ |
| | | JSONObject jsonObject = JSON.parseObject(reminderRules.getContent()); |
| | | //预约单 |
| | | if(orderPrivateCar.getOrderType() == 1){ |
| | | long specialCarTimeoutReminderInterval = jsonObject.getInteger("specialCarTimeoutReminderInterval") * 60000L; |
| | | long m = (System.currentTimeMillis() - orderPrivateCar.getSnatchOrderTime().getTime()) / 60000; |
| | | JobDataMap jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("driverId", uid); |
| | | jobDataMap.put("orderId", orderPrivateCar.getId()); |
| | | jobDataMap.put("orderType", 1); |
| | | jobDataMap.put("describe", language == 1 ? "您的打车订单已超时" + m + "分钟,请抓紧!" : language == 2 ? "Your ride order is overdue for " + m + " minute(s), please go faster." : "Votre commande de course est en retard depuis " + m + " minute(s), veuillez aller plus vite."); |
| | | QuartzUtil.addSimpleQuartzTask( |
| | | new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderPrivateCar.getId() + "_1", "ORDER_TIME_OUT", jobDataMap) |
| | | , new Date(specialCarTimeoutReminderInterval), specialCarTimeoutReminderInterval, -1); |
| | | }else{ |
| | | UserInfo userInfo = userInfoMapper.selectById(orderPrivateCar.getUserId()); |
| | | JSONObject reservationOrder = jsonObject.getJSONObject("reservationOrder"); |
| | | long appointmentReminder = reservationOrder.getInteger("appointmentReminder") * 60000L; |
| | | long appointmentTimeoutReminderInterval = reservationOrder.getInteger("appointmentTimeoutReminderInterval") * 60000L; |
| | | SimpleDateFormat sdf = new SimpleDateFormat(""); |
| | | JobDataMap jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("driverId", uid); |
| | | jobDataMap.put("orderId", orderPrivateCar.getId()); |
| | | jobDataMap.put("orderType", 1); |
| | | jobDataMap.put("describe", "您将于" + sdf.format(orderPrivateCar.getTravelTime()) + "去接" + userInfo.getFirstName() + " " + userInfo.getLastName() + ",请准时!"); |
| | | QuartzUtil.addSimpleQuartzTask( |
| | | new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderPrivateCar.getId() + "_1", "ORDER_TIME_OUT", jobDataMap) |
| | | , new Date(appointmentReminder), appointmentReminder, 0); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 超时用户取消不收费的提醒 |
| | | * 预约单:行程时间 + 配置不收费的时间 > 当前时间 (只弹一次) |
| | | * 即时单:预估到达预约点时间 + 配置不收费的时间 > 当前时间 (只弹一次) |
| | | * |
| | | * 超时用户取消订单后需要弹给司机提醒弹框,超时时间 = 当前时间 - 行程时间 - 配置不收费的时间 |
| | | * |
| | | * 定时提醒弹框 |
| | | * 司机只要开始超时且还未到达预约点,则需要定时提醒 |
| | | * |
| | | * 预约单需要提前xx分钟提醒司机需要接乘客,过后每隔xx分钟提醒一次。超时后停止提醒 |
| | | */ |
| | | |
| | | //添加定时任务(普通任务) |
| | | SysOvertime reminderRules = sysOvertimeService.selectOne(new EntityWrapper<SysOvertime>().eq("companyId", driver.getCompanyId())); |
| | | if(null != reminderRules){ |
| | | CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", driver.getCompanyId())); |
| | | Integer driverTimeout = JSON.parseObject(cancleOrder.getContent()).getInteger("driverTimeout"); |
| | | |
| | | //即时单 |
| | | if(orderPrivateCar.getOrderType() == 1){ |
| | | //超时时间 |
| | | long timeOut = orderPrivateCar.getEstimateArriveTime().getTime() + (driverTimeout * 60 * 1000); |
| | | //乘客取消不收费提醒 |
| | | JobDataMap jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("driverId", uid); |
| | | jobDataMap.put("timeOutType", 1); |
| | | jobDataMap.put("orderId", orderPrivateCar.getId()); |
| | | jobDataMap.put("orderType", 1); |
| | | jobDataMap.put("language", language); |
| | | jobDataMap.put("timeOut", timeOut); |
| | | jobDataMap.put("describe", language == 1 ? "您已超时" + driverTimeout + "分钟,用户可免费取消订单" : language == 2 ? "Reminder You are overdue for " + driverTimeout + " minutes The subscriber could cancel the order for free Confirm" : "Rappel Vous êtes en retard de " + driverTimeout + " minutes L’abonné peut annuler la commande gratuitement Confirmer"); |
| | | QuartzUtil.addSimpleQuartzTask( |
| | | new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderPrivateCar.getId() + "_1", "ORDER_TIME_OUT", jobDataMap) |
| | | , new Date(timeOut), timeOut, 0); |
| | | |
| | | //超时循环提醒 |
| | | jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("driverId", uid); |
| | | jobDataMap.put("timeOutType", 3); |
| | | jobDataMap.put("orderId", orderPrivateCar.getId()); |
| | | jobDataMap.put("orderType", 1); |
| | | jobDataMap.put("describe", "您将于" + sdf.format(orderPrivateCar.getTravelTime()) + "去接" + userInfo.getFirstName() + " " + userInfo.getLastName() + ",请准时!"); |
| | | jobDataMap.put("language", language); |
| | | jobDataMap.put("timeOut", orderPrivateCar.getEstimateArriveTime().getTime()); |
| | | jobDataMap.put("describe", ""); |
| | | QuartzUtil.addSimpleQuartzTask( |
| | | new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderPrivateCar.getId() + "_1", "ORDER_TIME_OUT", jobDataMap) |
| | | , new Date(appointmentReminder + appointmentTimeoutReminderInterval), appointmentTimeoutReminderInterval, -1); |
| | | , orderPrivateCar.getEstimateArriveTime(), reminderRules.getCar() * 60000, -1); |
| | | }else{ |
| | | //超时时间 |
| | | long timeOut = orderPrivateCar.getTravelTime().getTime() + (driverTimeout * 60000); |
| | | //乘客取消不收费提醒 |
| | | JobDataMap jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("driverId", uid); |
| | | jobDataMap.put("timeOutType", 1); |
| | | jobDataMap.put("orderId", orderPrivateCar.getId()); |
| | | jobDataMap.put("orderType", 1); |
| | | jobDataMap.put("language", language); |
| | | jobDataMap.put("timeOut", timeOut); |
| | | jobDataMap.put("describe", language == 1 ? "您已超时" + driverTimeout + "分钟,用户可免费取消订单" : language == 2 ? "Reminder You are overdue for " + driverTimeout + " minutes The subscriber could cancel the order for free Confirm" : "Rappel Vous êtes en retard de " + driverTimeout + " minutes L’abonné peut annuler la commande gratuitement Confirmer"); |
| | | QuartzUtil.addSimpleQuartzTask( |
| | | new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderPrivateCar.getId() + "_1", "ORDER_TIME_OUT", jobDataMap) |
| | | , new Date(timeOut), timeOut, 0); |
| | | |
| | | |
| | | UserInfo userInfo = userInfoMapper.selectById(orderPrivateCar.getUserId()); |
| | | |
| | | //预约单出发首次提醒 |
| | | long travelTime = orderPrivateCar.getTravelTime().getTime() - reminderRules.getReserveTime() * 60000; |
| | | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); |
| | | jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("driverId", uid); |
| | | jobDataMap.put("timeOutType", 2); |
| | | jobDataMap.put("orderId", orderPrivateCar.getId()); |
| | | jobDataMap.put("orderType", 1); |
| | | jobDataMap.put("language", language); |
| | | jobDataMap.put("timeOut", timeOut); |
| | | jobDataMap.put("describe", language == 1 ? "您将于" + sdf.format(orderPrivateCar.getTravelTime()) + "去接" + (ToolUtil.isEmpty(userInfo.getFirstName()) ? userInfo.getNickName() : userInfo.getFirstName() + " " + userInfo.getLastName()) + ",请准时!" : |
| | | language == 2 ? "You are going to pick up " + (ToolUtil.isEmpty(userInfo.getFirstName()) ? userInfo.getNickName() : userInfo.getFirstName() + " " + userInfo.getLastName()) + " at " + sdf.format(orderPrivateCar.getTravelTime()) + ", please be on time. " : |
| | | "Vous allez chercher " + (ToolUtil.isEmpty(userInfo.getFirstName()) ? userInfo.getNickName() : userInfo.getFirstName() + " " + userInfo.getLastName()) + " à " + sdf.format(orderPrivateCar.getTravelTime()) + ", s’il vous plaît soyez à l’heure."); |
| | | QuartzUtil.addSimpleQuartzTask( |
| | | new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderPrivateCar.getId() + "_1", "ORDER_TIME_OUT", jobDataMap) |
| | | , new Date(travelTime), travelTime, 0); |
| | | |
| | | //预约单出发循环提醒 |
| | | jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("driverId", uid); |
| | | jobDataMap.put("timeOutType", 2); |
| | | jobDataMap.put("orderId", orderPrivateCar.getId()); |
| | | jobDataMap.put("orderType", 1); |
| | | jobDataMap.put("language", language); |
| | | jobDataMap.put("timeOut", orderPrivateCar.getTravelTime().getTime()); |
| | | jobDataMap.put("describe", language == 1 ? "您将于" + sdf.format(orderPrivateCar.getTravelTime()) + "去接" + (ToolUtil.isEmpty(userInfo.getFirstName()) ? userInfo.getNickName() : userInfo.getFirstName() + " " + userInfo.getLastName()) + ",请准时!" : |
| | | language == 2 ? "You are going to pick up " + (ToolUtil.isEmpty(userInfo.getFirstName()) ? userInfo.getNickName() : userInfo.getFirstName() + " " + userInfo.getLastName()) + " at " + sdf.format(orderPrivateCar.getTravelTime()) + ", please be on time. " : |
| | | "Vous allez chercher " + (ToolUtil.isEmpty(userInfo.getFirstName()) ? userInfo.getNickName() : userInfo.getFirstName() + " " + userInfo.getLastName()) + " à " + sdf.format(orderPrivateCar.getTravelTime()) + ", s’il vous plaît soyez à l’heure."); |
| | | QuartzUtil.addSimpleQuartzTask( |
| | | new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderPrivateCar.getId() + "_1", "ORDER_TIME_OUT", jobDataMap) |
| | | , new Date(travelTime + reminderRules.getReserveNext() * 60000), reminderRules.getReserveNext() * 60000, -1); |
| | | |
| | | //超时循环提醒 |
| | | jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("driverId", uid); |
| | | jobDataMap.put("timeOutType", 3); |
| | | jobDataMap.put("orderId", orderPrivateCar.getId()); |
| | | jobDataMap.put("orderType", 1); |
| | | jobDataMap.put("language", language); |
| | | jobDataMap.put("timeOut", orderPrivateCar.getTravelTime().getTime()); |
| | | jobDataMap.put("describe", ""); |
| | | QuartzUtil.addSimpleQuartzTask( |
| | | new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderPrivateCar.getId() + "_1", "ORDER_TIME_OUT", jobDataMap) |
| | | , orderPrivateCar.getTravelTime(), reminderRules.getCar() * 60000, -1); |
| | | } |
| | | } |
| | | |
| | | Car car = carService.selectById(orderPrivateCar.getCarId()); |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carService.updateById(car); |
| | | } |
| | | String trip = fleetEngineUtil.getTrip(orderPrivateCar.getTripId()); |
| | | if(ToolUtil.isEmpty(trip)){ |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | new Thread(()->{ |
| | | try { |
| | | Car car = carService.selectById(orderPrivateCar.getCarId()); |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carService.updateById(car); |
| | | } |
| | | String trip = fleetEngineUtil.getTrip(orderPrivateCar.getTripId()); |
| | | if(ToolUtil.isEmpty(trip)){ |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | fleetEngineUtil.createTrip(car.getVehicleId(), 1, orderPrivateCar.getTripId(), |
| | | orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(), orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString()); |
| | | } |
| | | //开始修改行程数据 |
| | | fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderPrivateCar.getTripId(), null, null, null, null); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | fleetEngineUtil.createTrip(car.getVehicleId(), 1, orderPrivateCar.getTripId(), |
| | | orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(), orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString()); |
| | | } |
| | | //开始修改行程数据 |
| | | fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderPrivateCar.getTripId(), null, null, null, null); |
| | | }).start(); |
| | | |
| | | //推送相关代码------------------start---------------- |
| | | new Thread(new Runnable() { |
| | |
| | | return ResultUtil.error(language == 1 ? "当前订单不能到达预约地点" : language == 2 ? "The current order cannot arrive at the reservation" : "La commande en cours ne peut pas atteindre le rendez-vous"); |
| | | } |
| | | String tripStatus = "UNKNOWN_TRIP_STATUS"; |
| | | String audioUrl = ""; |
| | | switch (state){ |
| | | case 3://出发前往预约点 |
| | | orderPrivateCar.setState(3); |
| | |
| | | out.flush(); |
| | | out.close(); |
| | | tripStatus = "ENROUTE_TO_DROPOFF"; |
| | | switch (language){ |
| | | case 1: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/OnboardReminder-CN.mp3"; |
| | | break; |
| | | case 2: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/OnboardReminder-EN.mp3"; |
| | | break; |
| | | case 3: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/OnboardReminder-FR.mp3"; |
| | | break; |
| | | } |
| | | break; |
| | | case 6://结束服务(专车可以返回继续服务)不修改状态 |
| | | orderPrivateCar.setState(6); |
| | |
| | | orderPrivateCar.setGetoffTime(new Date()); |
| | | orderPrivateCar.setEndServiceTime(new Date()); |
| | | tripStatus = "COMPLETE"; |
| | | switch (language){ |
| | | case 1: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/ReachDestination-CN.mp3"; |
| | | break; |
| | | case 2: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/ReachDestination-EN.mp3"; |
| | | break; |
| | | case 3: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/ReachDestination-FR.mp3"; |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | this.updateById(orderPrivateCar); |
| | | |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | //修改行程数据 |
| | | fleetEngineUtil.updateTrip(tripStatus, null, 1, orderPrivateCar.getTripId(), null, null, null, null); |
| | | String finalTripStatus = tripStatus; |
| | | new Thread(()->{ |
| | | //修改行程数据 |
| | | try { |
| | | fleetEngineUtil.updateTrip(finalTripStatus, null, 1, orderPrivateCar.getTripId(), null, null, null, null); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }).start(); |
| | | |
| | | // TODO: 2020/6/5 推送状态 |
| | | OrderPrivateCar finalOrderPrivateCar = orderPrivateCar; |
| | |
| | | pushUtil.pushOrderState(2, finalOrderPrivateCar.getDriverId(), finalOrderPrivateCar.getId(), 1, finalOrderPrivateCar.getState()); |
| | | } |
| | | }).start(); |
| | | return ResultUtil.success(); |
| | | return ResultUtil.success(audioUrl); |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public ResultUtil confirmFees(Integer language, Integer orderId, Integer type, Double parkingFee, Double crossingFee) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | if(6 != orderPrivateCar.getState()){ |
| | | return ResultUtil.error("操作异常,请刷新订单"); |
| | | } |
| | | if(orderPrivateCar.getArriveTime()==null){ |
| | | orderPrivateCar.setArriveTime(orderPrivateCar.getStartServiceTime()); |
| | | } |
| | |
| | | pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 1, finalOrderTaxi.getState()); |
| | | } |
| | | }).start(); |
| | | |
| | | OrderPrivateCar finalOrderPrivateCar = orderPrivateCar; |
| | | new Thread(()->{ |
| | | try { |
| | | //上报google |
| | | fleetEngineUtil.reportBillableEvent(finalOrderPrivateCar.getTripId()); |
| | | log.warn("上报时间:{},tripid:{},created_at:{},completed_at:{}", System.currentTimeMillis(), finalOrderPrivateCar.getTripId(), |
| | | finalOrderPrivateCar.getInsertTime().getTime(), finalOrderPrivateCar.getEndServiceTime().getTime()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public Map<String, Object> queryMoneyInfo(Integer orderId) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | if(orderPrivateCar.getState() == 5){//服务中的时候获取实时费用数据 |
| | | if(orderPrivateCar.getState() == 6){//服务中的时候获取实时费用数据 |
| | | this.setMoney(orderPrivateCar, 0D, 0D); |
| | | } |
| | | |
| | |
| | | if(null != orderPosition){ |
| | | old = orderPosition.getLon() + "," + orderPosition.getLat(); |
| | | }else{ |
| | | orderPrivateCar.setToStartPointMileage(0D); |
| | | orderPrivateCar.setMileage(0D); |
| | | this.updateById(orderPrivateCar); |
| | | return true;//第一条数据不作处理,直接存储 |
| | |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(now, old); |
| | | if(null != distance){ |
| | | Double distance1 = distance.get("WGS84"); |
| | | if(distance1 > 50 && orderPrivateCar.getState()==5/* && orderPosition.getInsertTime().getTime()>=orderPrivateCar.getBoardingTime().getTime()*/){//大于50米表示在移动 |
| | | if(distance1 > 50 && orderPrivateCar.getState() < 5){//大于50米表示在移动 |
| | | orderPrivateCar.setToStartPointMileage(new BigDecimal(orderPrivateCar.getToStartPointMileage()).add(new BigDecimal(distance1)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | this.updateById(orderPrivateCar); |
| | | return true; |
| | | } |
| | | if(distance1 > 50 && orderPrivateCar.getState()==5){//大于50米表示在移动 |
| | | orderPrivateCar.setMileage(new BigDecimal(orderPrivateCar.getMileage()).add(new BigDecimal(distance1)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | this.updateById(orderPrivateCar); |
| | | return true; |
| | |
| | | orderPrivateCar.setEndLon(Double.valueOf(orderPrivateCar.getDestinationLon())); |
| | | orderPrivateCar.setEndLat(Double.valueOf(orderPrivateCar.getDestinationLat())); |
| | | orderPrivateCar.setEndAddress(orderPrivateCar.getDestination()); |
| | | //修改google地图行程终点 |
| | | try { |
| | | fleetEngineUtil.updateTrip(null, null, null, orderPrivateCar.getTripId(), |
| | | null, null, orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | orderPrivateCar.setDestinationLon(""); |
| | | orderPrivateCar.setDestination(""); |
| | |
| | | |
| | | |
| | | |
| | | List<DriverOnline> queryList(@Param("day") String day, @Param("type") Integer type, @Param("duration") Long duration); |
| | | List<DriverOnline> queryList(@Param("day") String day, @Param("type") Integer type, |
| | | @Param("driverId") Integer driverId, @Param("duration") Long duration); |
| | | } |
| | |
| | | */ |
| | | List<Map<String, Object>> queryHistoricalSettlement(@Param("driverId") Integer driverId, @Param("pageNum") Integer pageNum, |
| | | @Param("size") Integer size); |
| | | |
| | | |
| | | |
| | | Double queryHistoricalSettlementTotal(@Param("driverId") Integer driverId); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.SysOvertime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/7/17 10:17 |
| | | */ |
| | | public interface SysOvertimeMapper extends BaseMapper<SysOvertime> { |
| | | } |
| | |
| | | DATE_FORMAT(createTime, '%Y-%m-%d') as createTime, |
| | | money, |
| | | purpose |
| | | from t_balance_usage_record type = #{type} and driverId = #{driverId} order by createTime desc limit #{pageNum}, #{size} |
| | | from t_balance_usage_record where type = #{type} and driverId = #{driverId} and purpose != 6 order by createTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryBalanceUsageRecordSum" resultType="double"> |
| | | select ifnull(sum(money), 0) from t_balance_usage_record where type = #{type} and driverId = #{driverId} |
| | | select ifnull(sum(money), 0) from t_balance_usage_record where type = #{type} and driverId = #{driverId} and purpose != 6 |
| | | </select> |
| | | </mapper> |
| | |
| | | a.money as money |
| | | from t_driver_activity_online a |
| | | left join t_driver_activity b on (a.driverActivityId = b.id) |
| | | where (now() between a.startTime and a.endTime) and a.companyId = #{companyId} and b.status = 3 |
| | | where (now() between b.startTime and b.endTime) and a.companyId = #{companyId} and b.status = 3 |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | |
| | | <select id="queryByPhone" resultType="Driver"> |
| | | select |
| | | id as id, |
| | | account as account, |
| | | jobNumber as jobNumber, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | password as password, |
| | | firstName as firstName, |
| | | lastName as lastName, |
| | | 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, |
| | | activityMoney as activityMoney, |
| | | laveActivityMoney as laveActivityMoney, |
| | | businessMoney as businessMoney, |
| | | laveBusinessMoney as laveBusinessMoney, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | select * |
| | | from t_driver where flag != 3 and authState != 4 and phone = #{phone} |
| | | </select> |
| | | |
| | | |
| | | <select id="queryAccount" resultType="Driver"> |
| | | select |
| | | id as id, |
| | | account as account, |
| | | jobNumber as jobNumber, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | password as password, |
| | | firstName as firstName, |
| | | lastName as lastName, |
| | | 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, |
| | | activityMoney as activityMoney, |
| | | laveActivityMoney as laveActivityMoney, |
| | | businessMoney as businessMoney, |
| | | laveBusinessMoney as laveBusinessMoney, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | select * |
| | | from t_driver where flag != 3 and authState != 4 and account = #{account} |
| | | </select> |
| | | |
| | |
| | | |
| | | |
| | | <select id="queryByPhone_" resultType="Driver"> |
| | | select |
| | | id as id, |
| | | account as account, |
| | | jobNumber as jobNumber, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | password as password, |
| | | firstName as firstName, |
| | | lastName as lastName, |
| | | 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, |
| | | activityMoney as activityMoney, |
| | | laveActivityMoney as laveActivityMoney, |
| | | businessMoney as businessMoney, |
| | | laveBusinessMoney as laveBusinessMoney, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | select * |
| | | from t_driver where flag != 3 and authState = #{authState} and phone = #{phone} |
| | | </select> |
| | | |
| | |
| | | |
| | | |
| | | <select id="queryByJobNum" resultType="Driver"> |
| | | select |
| | | id as id, |
| | | account as account, |
| | | jobNumber as jobNumber, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | password as password, |
| | | firstName as firstName, |
| | | lastName as lastName, |
| | | 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, |
| | | activityMoney as activityMoney, |
| | | laveActivityMoney as laveActivityMoney, |
| | | businessMoney as businessMoney, |
| | | laveBusinessMoney as laveBusinessMoney, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | from t_driver where flag != 3 and jobNumber = #{jobNum} |
| | | select * from t_driver where flag != 3 and jobNumber = #{jobNum} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryWorkDriver" resultType="Driver"> |
| | | select |
| | | a.id as id, |
| | | a.account as account, |
| | | a.jobNumber as jobNumber, |
| | | a.phoneOperator as phoneOperator, |
| | | a.phone as phone, |
| | | a.password as password, |
| | | a.firstName as firstName, |
| | | a.lastName as lastName, |
| | | a.sex as sex, |
| | | a.idCard as idCard, |
| | | a.companyId as companyId, |
| | | a.franchiseeId as franchiseeId, |
| | | a.headImgUrl as headImgUrl, |
| | | a.faceImgUrl as faceImgUrl, |
| | | a.idCardImgUrl1 as idCardImgUrl1, |
| | | a.idCardImgUrl2 as idCardImgUrl2, |
| | | a.placeOfEmployment as placeOfEmployment, |
| | | a.birthday as birthday, |
| | | a.bankCardNumber as bankCardNumber, |
| | | a.driverNationality as driverNationality, |
| | | a.driverNation as driverNation, |
| | | a.driverMaritalStatus as driverMaritalStatus, |
| | | a.driverLanguageLevel as driverLanguageLevel, |
| | | a.driverEducation as driverEducation, |
| | | a.driverCensus as driverCensus, |
| | | a.driverAddress as driverAddress, |
| | | a.driverContactAddress as driverContactAddress, |
| | | a.driverAge as driverAge, |
| | | a.driveCard as driveCard, |
| | | a.driveCardImgUrl1 as driveCardImgUrl1, |
| | | a.driveCardImgUrl2 as driveCardImgUrl2, |
| | | a.driverType as driverType, |
| | | a.getDriverLicenseDate as getDriverLicenseDate, |
| | | a.driverLicenseOn as driverLicenseOn, |
| | | a.driverLicenseOff as driverLicenseOff, |
| | | a.taxiDriver as taxiDriver, |
| | | a.taxiAptitudeCard as taxiAptitudeCard, |
| | | a.networkCarlssueImg as networkCarlssueImg, |
| | | a.networkCarlssueOrganization as networkCarlssueOrganization, |
| | | a.networkCarlssueDate as networkCarlssueDate, |
| | | a.getNetworkCarProofDate as getNetworkCarProofDate, |
| | | a.networkCarProofOn as networkCarProofOn, |
| | | a.networkCarProofOff as networkCarProofOff, |
| | | a.registerDate as registerDate, |
| | | a.fullTimeDriver as fullTimeDriver, |
| | | a.inDriverBlacklist as inDriverBlacklist, |
| | | a.commercialType as commercialType, |
| | | a.contractCompany as contractCompany, |
| | | a.contractOn as contractOn, |
| | | a.contractOff as contractOff, |
| | | a.emergencyContact as emergencyContact, |
| | | a.emergencyContactPhone as emergencyContactPhone, |
| | | a.emergencyContactAddress as emergencyContactAddress, |
| | | a.remark as remark, |
| | | a.isPlatCar as isPlatCar, |
| | | a.carId as carId, |
| | | a.authState as authState, |
| | | a.state as state, |
| | | a.addType as addType, |
| | | a.balance as balance, |
| | | a.activityMoney as activityMoney, |
| | | a.laveActivityMoney as laveActivityMoney, |
| | | a.businessMoney as businessMoney, |
| | | a.laveBusinessMoney as laveBusinessMoney, |
| | | a.flag as flag, |
| | | a.insertTime as insertTime, |
| | | a.insertUser as insertUser, |
| | | a.updateTime as updateTime, |
| | | a.updateUser as updateUser |
| | | a.* |
| | | from t_driver a |
| | | left join t_driver_work b on (a.id = b.driverId) |
| | | where flag != 3 and b.state = 1 |
| | |
| | | |
| | | |
| | | <select id="queryByCompanyId" resultType="Driver"> |
| | | select |
| | | id as id, |
| | | account as account, |
| | | jobNumber as jobNumber, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | password as password, |
| | | firstName as firstName, |
| | | lastName as lastName, |
| | | 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, |
| | | activityMoney as activityMoney, |
| | | laveActivityMoney as laveActivityMoney, |
| | | businessMoney as businessMoney, |
| | | laveBusinessMoney as laveBusinessMoney, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | select * |
| | | from t_driver where flag != 3 |
| | | <choose> |
| | | <when test="companyId == 1"> |
| | |
| | | |
| | | |
| | | <select id="queryByIdentification" resultType="Driver"> |
| | | select |
| | | id as id, |
| | | account as account, |
| | | jobNumber as jobNumber, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | password as password, |
| | | firstName as firstName, |
| | | lastName as lastName, |
| | | 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, |
| | | activityMoney as activityMoney, |
| | | laveActivityMoney as laveActivityMoney, |
| | | businessMoney as businessMoney, |
| | | laveBusinessMoney as laveBusinessMoney, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | select * |
| | | from t_driver where flag != 3 and idCard = #{identification} |
| | | </select> |
| | | |
| | |
| | | |
| | | |
| | | <select id="queryByTaxiAptitudeCard" resultType="Driver"> |
| | | select |
| | | id as id, |
| | | account as account, |
| | | jobNumber as jobNumber, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | password as password, |
| | | firstName as firstName, |
| | | lastName as lastName, |
| | | 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, |
| | | activityMoney as activityMoney, |
| | | laveActivityMoney as laveActivityMoney, |
| | | businessMoney as businessMoney, |
| | | laveBusinessMoney as laveBusinessMoney, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | select * |
| | | from t_driver where flag != 3 and taxiAptitudeCard = #{taxiAptitudeCard} |
| | | </select> |
| | | |
| | |
| | | `date` as `date`, |
| | | duration as duration, |
| | | assessment as assessment |
| | | from t_driver_online where DATE_FORMAT(`date`, '%Y-%m-%d') = #{day} and type = #{type} and duration >= #{duration} |
| | | from t_driver_online where DATE_FORMAT(`date`, '%Y-%m-%d') = #{day} |
| | | <if test="null != driverId"> |
| | | and driverId = #{driverId} |
| | | </if> |
| | | <if test="null != type"> |
| | | and type = #{type} |
| | | </if> |
| | | and duration >= #{duration} |
| | | </select> |
| | | </mapper> |
| | |
| | | incomeId as incomeId, |
| | | orderType as orderType, |
| | | money as money, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as time, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d') as time, |
| | | type |
| | | from t_income where money > 0 |
| | | <if test="null != userType"> |
| | |
| | | balanceType |
| | | from t_settlement_record where driverId = #{driverId} and paymentStatus = 2 order by insertTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | | |
| | | <select id="queryHistoricalSettlementTotal" resultType="double"> |
| | | select |
| | | ifnull(sum(payMoney), 0) as price |
| | | from t_settlement_record where driverId = #{driverId} and paymentStatus = 2 group by driverId |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.system.dao.SysOvertimeMapper"> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | |
| | | |
| | | <select id="queryByPhone" resultType="UserInfo"> |
| | | select |
| | | id as id, |
| | | registIp as registIp, |
| | | registAreaCode as registAreaCode, |
| | | phone as phone, |
| | | nickName as nickName, |
| | | avatar as avatar, |
| | | birthday as birthday, |
| | | sex as sex, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactNumber as emergencyContactNumber, |
| | | isAuth as isAuth, |
| | | CONCAT(firstName, ' ', lastName) as name, |
| | | 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="queryByOpenid" resultType="UserInfo"> |
| | | select |
| | | id as id, |
| | | registIp as registIp, |
| | | registAreaCode as registAreaCode, |
| | | phone as phone, |
| | | nickName as nickName, |
| | | avatar as avatar, |
| | | birthday as birthday, |
| | | sex as sex, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactNumber as emergencyContactNumber, |
| | | isAuth as isAuth, |
| | | CONCAT(firstName, ' ', lastName) as name, |
| | | 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, |
| | | phone as phone, |
| | | nickName as nickName, |
| | | avatar as avatar, |
| | | birthday as birthday, |
| | | sex as sex, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactNumber as emergencyContactNumber, |
| | | isAuth as isAuth, |
| | | CONCAT(firstName, ' ', lastName) as name, |
| | | 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="queryWithdrawal" resultType="map"> |
| | | select |
| | | id as id, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as insertTime, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d') as insertTime, |
| | | money as money, |
| | | ('手机提现') as name, |
| | | remark as remark, |
| | |
| | | select |
| | | ifnull(sum(money), 0) as money |
| | | from t_pub_withdrawal |
| | | where flag != 3 and userType = #{userType} and userId = #{uid} and type = #{type} |
| | | where flag != 3 and userType = #{userType} and userId = #{uid} and type = #{type} and state = 2 |
| | | </select> |
| | | </mapper> |
| | |
| | | * 在线小时数 |
| | | */ |
| | | @TableField("online") |
| | | private Integer online; |
| | | private Double online; |
| | | /** |
| | | * 奖励金额 |
| | | */ |
| | |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getOnline() { |
| | | public Double getOnline() { |
| | | return online; |
| | | } |
| | | |
| | | public void setOnline(Integer online) { |
| | | public void setOnline(Double online) { |
| | | this.online = online; |
| | | } |
| | | |
| | |
| | | */ |
| | | @TableField("assessment") |
| | | private Integer assessment; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | public void setAssessment(Integer assessment) { |
| | | this.assessment = assessment; |
| | | } |
| | | |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "DriverOnline{" + |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/7/17 10:15 |
| | | */ |
| | | @Data |
| | | @TableName("t_sys_overtime") |
| | | public class SysOvertime { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 打车订单每隔xx分钟提醒一次 |
| | | */ |
| | | @TableField("car") |
| | | private Integer car; |
| | | /** |
| | | * 包裹订单每隔xx分钟提醒一次 |
| | | */ |
| | | @TableField("packageTime") |
| | | private Integer packageTime; |
| | | /** |
| | | * 预约订单 在预定时间前x分钟首次提醒 |
| | | */ |
| | | @TableField("reserveTime") |
| | | private Integer reserveTime; |
| | | /** |
| | | * 预约订单每隔xx分钟提醒一次 |
| | | */ |
| | | @TableField("reserveNext") |
| | | private Integer reserveNext; |
| | | /** |
| | | * 公司id |
| | | */ |
| | | @TableField("companyId") |
| | | private Integer companyId; |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | void addDriverOnline(Integer driverId) throws Exception; |
| | | |
| | | |
| | | void addDriverOnline1(Integer driverId) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * 定时检测司机是否连续接单 |
| | | */ |
| | | void deductionDuration(); |
| | | |
| | | |
| | | /** |
| | | * 定时检测司机是否连续接单 |
| | | */ |
| | | void deductionDuration1(); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.SysOvertime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/7/17 10:18 |
| | | */ |
| | | public interface ISysOvertimeService extends IService<SysOvertime> { |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | |
| | | import com.stylefeng.guns.modular.system.service.IDriverWorkService; |
| | | import com.stylefeng.guns.modular.system.util.PushUtil; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.TextToSpeechUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | redisUtil.setStrValue("ONLINE_" + ty + "_" + driverId, String.valueOf(now / 1000));//存入秒 |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void addDriverOnline1(Integer driverId) throws Exception { |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driverId).eq("state", 1)); |
| | | if(null == driverWork){//非上班状态不记录 |
| | | return; |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<DriverActivityHistory> driverActivityHistories = driverActivityHistoryMapper.selectList(new EntityWrapper<DriverActivityHistory>().eq("driverId", driverId) |
| | | .eq("type", 3).eq("carryOut", 1).last(" and day = '" + sdf.format(new Date()) + "'")); |
| | | //生成每个活动从开始上班到当前时间的时长记录 |
| | | for (DriverActivityHistory driverActivityHistory : driverActivityHistories) { |
| | | String value = redisUtil.getValue("driverActivity_" + driverId + "_" + driverActivityHistory.getId()); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | JSONObject jsonObject = JSON.parseObject(value); |
| | | Long startTime = jsonObject.getLong("startTime"); |
| | | long time = System.currentTimeMillis() - startTime; |
| | | redisUtil.setStrValue("driverActivity_" + driverId + "_" + driverActivityHistory.getId(), "{\"startTime\":" + startTime + ", \"time\":" + time + "}"); |
| | | }else{ |
| | | long time = System.currentTimeMillis() - driverWork.getStartTime().getTime(); |
| | | redisUtil.setStrValue("driverActivity_" + driverId + "_" + driverActivityHistory.getId(), "{\"startTime\":" + driverWork.getStartTime().getTime() + ", \"time\":" + time + "}"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取给定日期范围的在线时长 |
| | | * @param driverId |
| | |
| | | mm = snatchOrderTime.getTime(); |
| | | } |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectOne(new EntityWrapper<OrderLogistics>().eq("driverId", driverId).eq("isDelete", 1).ne("state", 10)); |
| | | if(null != orderLogistics && snatchOrderTime.before(orderLogistics.getSnatchOrderTime())){ |
| | | if(null != orderLogistics && (null == snatchOrderTime || snatchOrderTime.before(orderLogistics.getSnatchOrderTime()))){ |
| | | mm = orderLogistics.getSnatchOrderTime().getTime(); |
| | | } |
| | | |
| | | //超时不接单,直接将之前的在线时长清零 |
| | | //推送司机下班提醒 |
| | | if(mm >= m){ |
| | | if((System.currentTimeMillis() - mm) >= m){ |
| | | this.deleteById(driverOnline.getId()); |
| | | driverWork.setState(2); |
| | | driverWork.setEndTime(new Date()); |
| | |
| | | driver.setState(1); |
| | | driverService.updateById(driver); |
| | | Integer language = driver.getLanguage(); |
| | | pushUtil.pushOffline(driverOnline.getDriverId(), 2, language == 1 ? "您已连续" + driverActivityOnline.getOfflineTime() + "小时未接单,系统将强制更改您的状态为:下班" : |
| | | |
| | | String msg = language == 1 ? "您已连续" + driverActivityOnline.getOfflineTime() + "小时未接单,系统将强制更改您的状态为:下班" : |
| | | language == 2 ? "You have not been accepting orders for " + driverActivityOnline.getOfflineTime() + " hour(s) System will change your state to Off-work" : |
| | | "Vous n’acceptez pas de commandes depuis " + driverActivityOnline.getOfflineTime() + " heure(s) Le système changera votre état en Hors travail"); |
| | | "Vous n’acceptez pas de commandes depuis " + driverActivityOnline.getOfflineTime() + " heure(s) Le système changera votre état en Hors travail"; |
| | | String audioUrl = null; |
| | | try { |
| | | audioUrl = TextToSpeechUtil.create(language == 1 ? "cmn-CN" : language == 2 ? "en-US" : "fr-FR", msg, "OffLine" + driver.getId() + ".mp3"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("msg", msg); |
| | | map.put("audioUrl", audioUrl); |
| | | pushUtil.pushOffline(driverOnline.getDriverId(), 2, map); |
| | | |
| | | //定时任务删除语音文件 |
| | | 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/OffLine" + driver.getId() + ".mp3"); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (process != null) { |
| | | process.destroy(); |
| | | } |
| | | } |
| | | }, 30000); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void deductionDuration1() { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<DriverActivityHistory> driverActivityHistories = driverActivityHistoryMapper.selectList(new EntityWrapper<DriverActivityHistory>() |
| | | .eq("type", 3).eq("carryOut", 1).last(" and day = '" + sdf.format(new Date()) + "'")); |
| | | for (DriverActivityHistory driverActivityHistory : driverActivityHistories) { |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driverActivityHistory.getDriverId()).eq("state", 1)); |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | DriverActivityOnline driverActivityOnline = driverActivityOnlineMapper.selectById(driverActivityHistory.getActivityId()); |
| | | //在线连续xx小时不接单,司机下线,时长不计入总累计时长 |
| | | int m = Double.valueOf(driverActivityOnline.getOfflineTime() * 60).intValue(); |
| | | String value = redisUtil.getValue("driverActivity_" + driverActivityHistory.getDriverId() + "_" + driverActivityHistory.getId()); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(value); |
| | | //开始记录时长的时间开始时间戳 |
| | | Long startTime = jsonObject.getLong("startTime"); |
| | | //在线时长累计 |
| | | Long time = jsonObject.getLong("time") / 60000; |
| | | int count1 = orderPrivateCarService.selectCount(new EntityWrapper<OrderPrivateCar>().eq("driverId", driverActivityHistory.getDriverId()) |
| | | .eq("isDelete", 1).ne("state", 10).last(" and UNIX_TIMESTAMP(snatchOrderTime) > " + (startTime) / 1000)); |
| | | int count2 = orderLogisticsService.selectCount(new EntityWrapper<OrderLogistics>().eq("driverId", driverActivityHistory.getDriverId()) |
| | | .eq("isDelete", 1).ne("state", 10).last(" and UNIX_TIMESTAMP(snatchOrderTime) > " + (startTime) / 1000)); |
| | | |
| | | Driver driver = driverService.selectById(driverWork.getDriverId()); |
| | | //阶段时间累计时长超过设定时长且没有接单,不计入累计总时长(司机服务中不下班) |
| | | if(m <= time && count1 + count2 == 0 && driver.getState() != 3){ |
| | | //司机下班,清空当前阶段的累计时长 |
| | | driverWork.setState(2); |
| | | driverWork.setEndTime(new Date()); |
| | | driverWorkService.updateById(driverWork); |
| | | driver.setState(1); |
| | | driverService.updateById(driver); |
| | | redisUtil.remove("driverActivity_" + driverActivityHistory.getDriverId() + "_" + driverActivityHistory.getId()); |
| | | Integer language = driver.getLanguage(); |
| | | |
| | | String msg = language == 1 ? "您已连续" + driverActivityOnline.getOfflineTime() + "小时未接单,系统将强制更改您的状态为:下班" : |
| | | language == 2 ? "You have not been accepting orders for " + driverActivityOnline.getOfflineTime() + " hour(s) System will change your state to Off-work" : |
| | | "Vous n’acceptez pas de commandes depuis " + driverActivityOnline.getOfflineTime() + " heure(s) Le système changera votre état en Hors travail"; |
| | | String audioUrl = null; |
| | | try { |
| | | audioUrl = TextToSpeechUtil.create(language == 1 ? "cmn-CN" : language == 2 ? "en-US" : "fr-FR", msg, "OffLine" + driver.getId() + ".mp3"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("msg", msg); |
| | | map.put("audioUrl", audioUrl); |
| | | pushUtil.pushOffline(driverWork.getDriverId(), 2, map); |
| | | |
| | | //定时任务删除语音文件 |
| | | 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/OffLine" + driver.getId() + ".mp3"); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (process != null) { |
| | | process.destroy(); |
| | | } |
| | | } |
| | | }, 30000); |
| | | } |
| | | //阶段时间累计有新的订单,计入累计总时长,重置新的开始统计时间戳 |
| | | if(m <= time && count1 + count2 > 0){ |
| | | DriverOnline driverOnline = this.selectOne(new EntityWrapper<DriverOnline>().eq("DATE_FORMAT(date, '%Y-%m-%d')", sdf.format(new Date())) |
| | | .eq("driverId", driverActivityHistory.getDriverId())); |
| | | if(null == driverOnline){ |
| | | driverOnline = new DriverOnline(); |
| | | driverOnline.setDriverId(driverActivityHistory.getDriverId()); |
| | | driverOnline.setDate(new Date()); |
| | | driverOnline.setDuration(time * 60); |
| | | driverOnline.setInsertTime(new Date()); |
| | | this.insert(driverOnline); |
| | | }else{ |
| | | driverOnline.setDuration(driverOnline.getDuration() + (time * 60)); |
| | | this.updateById(driverOnline); |
| | | } |
| | | redisUtil.setStrValue("driverActivity_" + driverActivityHistory.getDriverId() + "_" + driverActivityHistory.getId(), "{\"startTime\":" + System.currentTimeMillis() + ", \"time\":" + 0 + "}"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | 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.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | |
| | | //司机登录,添加谷歌上的车辆信息 |
| | | Car car = carService.selectById(driver.getCarId()); |
| | | if(null == car){ |
| | | return ResultUtil.error(language == 1 ? "登录失败,请先绑定车辆" : language == 2 ? "Login failed, please bind the vehicle first" : "La connexion a échoué, veuillez d’abord lier le véhicule"); |
| | | } |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carService.updateById(car); |
| | |
| | | DriverWork driverWork = driverWorkMapper.queryNewWork(uid, null, 1); |
| | | Driver driver = this.selectById(uid); |
| | | Car car = carService.selectById(driver.getCarId()); |
| | | String audioUrl = ""; |
| | | if(null != driverWork){//作下班操作 |
| | | //检测是否有未完成的订单 |
| | | List<Map<String, Object>> list = orderService.queryOrderList(1, 1, 10, uid, language); |
| | |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | }else{ |
| | | fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | switch (language){ |
| | | case 1: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/AfterWork-CN.mp3"; |
| | | break; |
| | | case 2: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/AfterWork-EN.mp3"; |
| | | break; |
| | | case 3: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/AfterWork-FR.mp3"; |
| | | break; |
| | | } |
| | | }else{ |
| | | LoginWarpper loginWarpper = new LoginWarpper(); |
| | |
| | | }else{ |
| | | fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | |
| | | switch (language){ |
| | | case 1: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/AtWork-CN.mp3"; |
| | | break; |
| | | case 2: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/AtWork-EN.mp3"; |
| | | break; |
| | | case 3: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/AtWork-FR.mp3"; |
| | | break; |
| | | } |
| | | } |
| | | this.updateById(driver); |
| | | return ResultUtil.success(); |
| | | return ResultUtil.success(audioUrl); |
| | | } |
| | | |
| | | |
| | |
| | | map.put("service", list.size());//服务中 |
| | | list = orderTaxiService.queryOrderList(language, 2, uid); |
| | | map.put("reservation", list.size());//预约 |
| | | List<Map<String, Object>> list1 = orderLogisticsService.queryOrderList(uid, language); |
| | | List<Map<String, Object>> list1 = orderLogisticsService.queryOrderList(1, uid, language); |
| | | map.put("small", list1.size());//小件 |
| | | int size = this.queryMyActivity(uid, new Date(), language).size(); |
| | | map.put("activity", size);//活动 |
| | |
| | | */ |
| | | @Override |
| | | public List<BaseWarpper> queryMyBusiness(Integer uid, Integer language) throws Exception { |
| | | List<DriverService> list = driverServiceMapper.queryMyBusiness(uid); |
| | | List<Integer> list = Arrays.asList(1, 4); |
| | | List<BaseWarpper> maps = new ArrayList<>(); |
| | | for (DriverService d : list){ |
| | | for (Integer d : list){ |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setId(d.getType()); |
| | | switch (d.getType()){ |
| | | baseWarpper.setId(d); |
| | | switch (d){ |
| | | case 1: |
| | | baseWarpper.setName(language == 1 ? "打车" : language == 2 ? "Ride" : "Course"); |
| | | break; |
| | |
| | | driverActivityHistoryMapper.insert(driverActivityHistory); |
| | | |
| | | if(ToolUtil.isNotEmpty(driver.getEmail())) { |
| | | String path1 = templatePath + "driver/index.html"; |
| | | Document document1 = Jsoup.parse(new File(path1), "UTF-8"); |
| | | if (1 == language) { |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite").remove(); |
| | | document1.getElementById("user").remove(); |
| | | document1.getElementById("settle").remove(); |
| | | document1.getElementById("pass").remove(); |
| | | document1.getElementById("email").remove(); |
| | | document1.getElementById("bill").remove(); |
| | | document1.getElementById("reward").remove(); |
| | | document1.getElementById("driverAudit").remove(); |
| | | document1.getElementById("carAudit").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("邀请司机奖励(活动)"); |
| | | Element rewardToday_user = document1.getElementById("rewardToday_user"); |
| | | rewardToday_user.text("您好 " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday_award = document1.getElementById("rewardToday_award"); |
| | | rewardToday_award.text("奖金 GHS" + driverActivityHistory.getMoney()); |
| | | Element rewardToday_content = document1.getElementById("rewardToday_content"); |
| | | rewardToday_content.text("邀请司机注册即可获得奖励。\n注意此活动是有时间限制的,详情请查看I-GO平台。"); |
| | | } |
| | | if (2 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite1").remove(); |
| | | document1.getElementById("user1").remove(); |
| | | document1.getElementById("settle1").remove(); |
| | | document1.getElementById("pass1").remove(); |
| | | document1.getElementById("email1").remove(); |
| | | document1.getElementById("bill1").remove(); |
| | | document1.getElementById("reward1").remove(); |
| | | document1.getElementById("driverAudit1").remove(); |
| | | document1.getElementById("carAudit1").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Invite drivers and earn"); |
| | | Element rewardToday1_user = document1.getElementById("rewardToday1_user"); |
| | | rewardToday1_user.text("Hello " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday1_award = document1.getElementById("rewardToday1_award"); |
| | | rewardToday1_award.text("GHS " + driverActivityHistory.getMoney() + " BONUS"); |
| | | Element rewardToday1_content = document1.getElementById("rewardToday1_content"); |
| | | rewardToday1_content.text("Get a bonus on I-GO today.\nInvite drivers to register to get the bonus.\nNote that this is a limited-time offer. Check your app for more details."); |
| | | } |
| | | if (3 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("invite2").remove(); |
| | | document1.getElementById("user2").remove(); |
| | | document1.getElementById("settle2").remove(); |
| | | document1.getElementById("pass2").remove(); |
| | | document1.getElementById("email2").remove(); |
| | | document1.getElementById("bill2").remove(); |
| | | document1.getElementById("reward2").remove(); |
| | | document1.getElementById("driverAudit2").remove(); |
| | | document1.getElementById("carAudit2").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Invitez des chauffeurs et gagnez de l’argent"); |
| | | Element rewardToday2_user = document1.getElementById("rewardToday2_user"); |
| | | rewardToday2_user.text("Cher(ère) " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday2_award = document1.getElementById("rewardToday2_award"); |
| | | rewardToday2_award.text("Bonus GHS " + driverActivityHistory.getMoney()); |
| | | Element rewardToday2_content = document1.getElementById("rewardToday2_content"); |
| | | rewardToday2_content.text("Obtenez un bonus sur I-GO dès aujourd’hui.\nInvitez les chauffeurs à s’inscrire pour obtenir le bonus.\nNotez qu’il s’agit d’une offre d’une durée limitée. Consultez votre application pour plus de détails."); |
| | | } |
| | | EmailUtil.send(driver.getEmail(), language == 1 ? "邀请司机奖励(活动)" : language == 2 ? "Invite drivers and earn" : "Invitez des chauffeurs et gagnez de l’argent", document1.html()); |
| | | String randomString = ToolUtil.getRandomString(10); |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/activity_" + randomString + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document1.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/activity_" + randomString + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(driver.getId()); |
| | | tEmail.setType(2); |
| | | tEmail.setName(language == 1 ? "邀请司机奖励(活动)" : language == 2 ? "Invite drivers and earn" : "Invitez des chauffeurs et gagnez de l’argent"); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | String week = EmailUtil.getWeek(language, i); |
| | | tEmail.setWeek(week); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | new Thread(() -> { |
| | | try { |
| | | String path1 = templatePath + "driver/index.html"; |
| | | Document document1 = null; |
| | | try { |
| | | document1 = Jsoup.parse(new File(path1), "UTF-8"); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (1 == language) { |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite").remove(); |
| | | document1.getElementById("user").remove(); |
| | | document1.getElementById("settle").remove(); |
| | | document1.getElementById("pass").remove(); |
| | | document1.getElementById("email").remove(); |
| | | document1.getElementById("bill").remove(); |
| | | document1.getElementById("reward").remove(); |
| | | document1.getElementById("driverAudit").remove(); |
| | | document1.getElementById("carAudit").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("邀请司机奖励(活动)"); |
| | | Element rewardToday_user = document1.getElementById("rewardToday_user"); |
| | | rewardToday_user.text("您好 " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday_award = document1.getElementById("rewardToday_award"); |
| | | rewardToday_award.text("奖金 GHS" + driverActivityHistory.getMoney()); |
| | | Element rewardToday_content = document1.getElementById("rewardToday_content"); |
| | | rewardToday_content.text("邀请司机注册即可获得奖励。\n注意此活动是有时间限制的,详情请查看I-GO平台。"); |
| | | } |
| | | if (2 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite1").remove(); |
| | | document1.getElementById("user1").remove(); |
| | | document1.getElementById("settle1").remove(); |
| | | document1.getElementById("pass1").remove(); |
| | | document1.getElementById("email1").remove(); |
| | | document1.getElementById("bill1").remove(); |
| | | document1.getElementById("reward1").remove(); |
| | | document1.getElementById("driverAudit1").remove(); |
| | | document1.getElementById("carAudit1").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Invite drivers and earn"); |
| | | Element rewardToday1_user = document1.getElementById("rewardToday1_user"); |
| | | rewardToday1_user.text("Hello " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday1_award = document1.getElementById("rewardToday1_award"); |
| | | rewardToday1_award.text("GHS " + driverActivityHistory.getMoney() + " BONUS"); |
| | | Element rewardToday1_content = document1.getElementById("rewardToday1_content"); |
| | | rewardToday1_content.text("Get a bonus on I-GO today.\nInvite drivers to register to get the bonus.\nNote that this is a limited-time offer. Check your app for more details."); |
| | | } |
| | | if (3 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("invite2").remove(); |
| | | document1.getElementById("user2").remove(); |
| | | document1.getElementById("settle2").remove(); |
| | | document1.getElementById("pass2").remove(); |
| | | document1.getElementById("email2").remove(); |
| | | document1.getElementById("bill2").remove(); |
| | | document1.getElementById("reward2").remove(); |
| | | document1.getElementById("driverAudit2").remove(); |
| | | document1.getElementById("carAudit2").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Invitez des chauffeurs et gagnez de l’argent"); |
| | | Element rewardToday2_user = document1.getElementById("rewardToday2_user"); |
| | | rewardToday2_user.text("Cher(ère) " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday2_award = document1.getElementById("rewardToday2_award"); |
| | | rewardToday2_award.text("Bonus GHS " + driverActivityHistory.getMoney()); |
| | | Element rewardToday2_content = document1.getElementById("rewardToday2_content"); |
| | | rewardToday2_content.text("Obtenez un bonus sur I-GO dès aujourd’hui.\nInvitez les chauffeurs à s’inscrire pour obtenir le bonus.\nNotez qu’il s’agit d’une offre d’une durée limitée. Consultez votre application pour plus de détails."); |
| | | } |
| | | EmailUtil.send(driver.getEmail(), language == 1 ? "邀请司机奖励(活动)" : language == 2 ? "Invite drivers and earn" : "Invitez des chauffeurs et gagnez de l’argent", document1.html()); |
| | | String randomString = ToolUtil.getRandomString(10); |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/activity_" + randomString + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document1.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/activity_" + randomString + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(driver.getId()); |
| | | tEmail.setType(2); |
| | | tEmail.setName(language == 1 ? "邀请司机奖励(活动)" : language == 2 ? "Invite drivers and earn" : "Invitez des chauffeurs et gagnez de l’argent"); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | String week = EmailUtil.getWeek(language, i); |
| | | tEmail.setWeek(week); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | } |
| | |
| | | driverActivityHistoryMapper.insert(driverActivityHistory); |
| | | |
| | | if(ToolUtil.isNotEmpty(driver.getEmail())) { |
| | | String path1 = templatePath + "driver/index.html"; |
| | | Document document1 = Jsoup.parse(new File(path1), "UTF-8"); |
| | | if (1 == language) { |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite").remove(); |
| | | document1.getElementById("user").remove(); |
| | | document1.getElementById("settle").remove(); |
| | | document1.getElementById("pass").remove(); |
| | | document1.getElementById("email").remove(); |
| | | document1.getElementById("bill").remove(); |
| | | document1.getElementById("reward").remove(); |
| | | document1.getElementById("driverAudit").remove(); |
| | | document1.getElementById("carAudit").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("邀请用户奖励(活动)"); |
| | | Element rewardToday_user = document1.getElementById("rewardToday_user"); |
| | | rewardToday_user.text("您好 " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday_award = document1.getElementById("rewardToday_award"); |
| | | rewardToday_award.text("奖金 GHS" + driverActivityHistory.getMoney()); |
| | | Element rewardToday_content = document1.getElementById("rewardToday_content"); |
| | | rewardToday_content.text("邀请用户注册即可获得奖励。\n 注意此活动是有时间限制的,详情请查看I-GO平台。"); |
| | | } |
| | | if (2 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite1").remove(); |
| | | document1.getElementById("user1").remove(); |
| | | document1.getElementById("settle1").remove(); |
| | | document1.getElementById("pass1").remove(); |
| | | document1.getElementById("email1").remove(); |
| | | document1.getElementById("bill1").remove(); |
| | | document1.getElementById("reward1").remove(); |
| | | document1.getElementById("driverAudit1").remove(); |
| | | document1.getElementById("carAudit1").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Invite users and earn"); |
| | | Element rewardToday1_user = document1.getElementById("rewardToday1_user"); |
| | | rewardToday1_user.text("Hello " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday1_award = document1.getElementById("rewardToday1_award"); |
| | | rewardToday1_award.text("GHS " + driverActivityHistory.getMoney() + " BONUS"); |
| | | Element rewardToday1_content = document1.getElementById("rewardToday1_content"); |
| | | rewardToday1_content.text("Get a bonus on I-GO today.\nInvite users to register to get the bonus.\nNote that this is a limited-time offer. Check your app for more details."); |
| | | } |
| | | if (3 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("invite2").remove(); |
| | | document1.getElementById("user2").remove(); |
| | | document1.getElementById("settle2").remove(); |
| | | document1.getElementById("pass2").remove(); |
| | | document1.getElementById("email2").remove(); |
| | | document1.getElementById("bill2").remove(); |
| | | document1.getElementById("reward2").remove(); |
| | | document1.getElementById("driverAudit2").remove(); |
| | | document1.getElementById("carAudit2").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Invitez des utilisateurs et gagnez de l’argent"); |
| | | Element rewardToday2_user = document1.getElementById("rewardToday2_user"); |
| | | rewardToday2_user.text("Cher(ère) " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday2_award = document1.getElementById("rewardToday2_award"); |
| | | rewardToday2_award.text("Bonus GHS " + driverActivityHistory.getMoney()); |
| | | Element rewardToday2_content = document1.getElementById("rewardToday2_content"); |
| | | rewardToday2_content.text("Obtenez un bonus sur I-GO dès aujourd’hui.\nInvitez les utilisateurs à s’inscrire pour obtenir le bonus.\nNotez qu’il s’agit d’une offre d’une durée limitée. Consultez votre application pour plus de détails."); |
| | | } |
| | | EmailUtil.send(driver.getEmail(), language == 1 ? "邀请用户奖励(活动)" : language == 2 ? "Invite users and earn" : "Invitez des utilisateurs et gagnez de l’argent", document1.html()); |
| | | String randomString = ToolUtil.getRandomString(10); |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/activity_" + randomString + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document1.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/activity_" + randomString + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(driver.getId()); |
| | | tEmail.setType(2); |
| | | tEmail.setName(language == 1 ? "邀请用户奖励(活动)" : language == 2 ? "Invite users and earn" : "Invitez des utilisateurs et gagnez de l’argent"); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | String week = EmailUtil.getWeek(language, i); |
| | | tEmail.setWeek(week); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | new Thread(() -> { |
| | | try { |
| | | String path1 = templatePath + "driver/index.html"; |
| | | Document document1 = Jsoup.parse(new File(path1), "UTF-8"); |
| | | if (1 == language) { |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite").remove(); |
| | | document1.getElementById("user").remove(); |
| | | document1.getElementById("settle").remove(); |
| | | document1.getElementById("pass").remove(); |
| | | document1.getElementById("email").remove(); |
| | | document1.getElementById("bill").remove(); |
| | | document1.getElementById("reward").remove(); |
| | | document1.getElementById("driverAudit").remove(); |
| | | document1.getElementById("carAudit").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("邀请用户奖励(活动)"); |
| | | Element rewardToday_user = document1.getElementById("rewardToday_user"); |
| | | rewardToday_user.text("您好 " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday_award = document1.getElementById("rewardToday_award"); |
| | | rewardToday_award.text("奖金 GHS" + driverActivityHistory.getMoney()); |
| | | Element rewardToday_content = document1.getElementById("rewardToday_content"); |
| | | rewardToday_content.text("邀请用户注册即可获得奖励。\n 注意此活动是有时间限制的,详情请查看I-GO平台。"); |
| | | } |
| | | if (2 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite1").remove(); |
| | | document1.getElementById("user1").remove(); |
| | | document1.getElementById("settle1").remove(); |
| | | document1.getElementById("pass1").remove(); |
| | | document1.getElementById("email1").remove(); |
| | | document1.getElementById("bill1").remove(); |
| | | document1.getElementById("reward1").remove(); |
| | | document1.getElementById("driverAudit1").remove(); |
| | | document1.getElementById("carAudit1").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Invite users and earn"); |
| | | Element rewardToday1_user = document1.getElementById("rewardToday1_user"); |
| | | rewardToday1_user.text("Hello " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday1_award = document1.getElementById("rewardToday1_award"); |
| | | rewardToday1_award.text("GHS " + driverActivityHistory.getMoney() + " BONUS"); |
| | | Element rewardToday1_content = document1.getElementById("rewardToday1_content"); |
| | | rewardToday1_content.text("Get a bonus on I-GO today.\nInvite users to register to get the bonus.\nNote that this is a limited-time offer. Check your app for more details."); |
| | | } |
| | | if (3 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("invite2").remove(); |
| | | document1.getElementById("user2").remove(); |
| | | document1.getElementById("settle2").remove(); |
| | | document1.getElementById("pass2").remove(); |
| | | document1.getElementById("email2").remove(); |
| | | document1.getElementById("bill2").remove(); |
| | | document1.getElementById("reward2").remove(); |
| | | document1.getElementById("driverAudit2").remove(); |
| | | document1.getElementById("carAudit2").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Invitez des utilisateurs et gagnez de l’argent"); |
| | | Element rewardToday2_user = document1.getElementById("rewardToday2_user"); |
| | | rewardToday2_user.text("Cher(ère) " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday2_award = document1.getElementById("rewardToday2_award"); |
| | | rewardToday2_award.text("Bonus GHS " + driverActivityHistory.getMoney()); |
| | | Element rewardToday2_content = document1.getElementById("rewardToday2_content"); |
| | | rewardToday2_content.text("Obtenez un bonus sur I-GO dès aujourd’hui.\nInvitez les utilisateurs à s’inscrire pour obtenir le bonus.\nNotez qu’il s’agit d’une offre d’une durée limitée. Consultez votre application pour plus de détails."); |
| | | } |
| | | EmailUtil.send(driver.getEmail(), language == 1 ? "邀请用户奖励(活动)" : language == 2 ? "Invite users and earn" : "Invitez des utilisateurs et gagnez de l’argent", document1.html()); |
| | | String randomString = ToolUtil.getRandomString(10); |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/activity_" + randomString + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document1.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/activity_" + randomString + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(driver.getId()); |
| | | tEmail.setType(2); |
| | | tEmail.setName(language == 1 ? "邀请用户奖励(活动)" : language == 2 ? "Invite users and earn" : "Invitez des utilisateurs et gagnez de l’argent"); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | String week = EmailUtil.getWeek(language, i); |
| | | tEmail.setWeek(week); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | } |
| | |
| | | driverActivityHistoryMapper.insert(driverActivityHistory); |
| | | |
| | | if(ToolUtil.isNotEmpty(driver.getEmail())) { |
| | | String path1 = templatePath + "driver/index.html"; |
| | | Document document1 = Jsoup.parse(new File(path1), "UTF-8"); |
| | | if (1 == language) { |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite").remove(); |
| | | document1.getElementById("user").remove(); |
| | | document1.getElementById("settle").remove(); |
| | | document1.getElementById("pass").remove(); |
| | | document1.getElementById("email").remove(); |
| | | document1.getElementById("bill").remove(); |
| | | document1.getElementById("reward").remove(); |
| | | document1.getElementById("driverAudit").remove(); |
| | | document1.getElementById("carAudit").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("在线时长奖励(活动)"); |
| | | Element rewardToday_user = document1.getElementById("rewardToday_user"); |
| | | rewardToday_user.text("您好 " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday_award = document1.getElementById("rewardToday_award"); |
| | | rewardToday_award.text("奖金 GHS" + driverActivityHistory.getMoney()); |
| | | Element rewardToday_content = document1.getElementById("rewardToday_content"); |
| | | rewardToday_content.text("今日累计在线" + driverActivityOnline.getOnline() + "小时即可活动奖励。\n 注意此活动是有时间限制的,详情请查看I-GO平台。"); |
| | | } |
| | | if (2 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite1").remove(); |
| | | document1.getElementById("user1").remove(); |
| | | document1.getElementById("settle1").remove(); |
| | | document1.getElementById("pass1").remove(); |
| | | document1.getElementById("email1").remove(); |
| | | document1.getElementById("bill1").remove(); |
| | | document1.getElementById("reward1").remove(); |
| | | document1.getElementById("driverAudit1").remove(); |
| | | document1.getElementById("carAudit1").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Online-duration reward activity"); |
| | | Element rewardToday1_user = document1.getElementById("rewardToday1_user"); |
| | | rewardToday1_user.text("Hello " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday1_award = document1.getElementById("rewardToday1_award"); |
| | | rewardToday1_award.text("GHS " + driverActivityHistory.getMoney() + " BONUS"); |
| | | Element rewardToday1_content = document1.getElementById("rewardToday1_content"); |
| | | rewardToday1_content.text("Get a bonus for driving on I-GO today.\nStay online for " + driverActivityOnline.getOnline() + " hours to get the bonus.\nNote that this is a limited-time offer. Check your app for more details."); |
| | | } |
| | | if (3 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("invite2").remove(); |
| | | document1.getElementById("user2").remove(); |
| | | document1.getElementById("settle2").remove(); |
| | | document1.getElementById("pass2").remove(); |
| | | document1.getElementById("email2").remove(); |
| | | document1.getElementById("bill2").remove(); |
| | | document1.getElementById("reward2").remove(); |
| | | document1.getElementById("driverAudit2").remove(); |
| | | document1.getElementById("carAudit2").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Activité de récompense en ligne"); |
| | | Element rewardToday2_user = document1.getElementById("rewardToday2_user"); |
| | | rewardToday2_user.text("Cher(ère) " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday2_award = document1.getElementById("rewardToday2_award"); |
| | | rewardToday2_award.text("Bonus GHS " + driverActivityHistory.getMoney()); |
| | | Element rewardToday2_content = document1.getElementById("rewardToday2_content"); |
| | | rewardToday2_content.text("Obtenez un bonus pour conduire sur I-GO dès aujourd’hui.\nRestez en ligne pendant " + driverActivityOnline.getOnline() + " heures pour obtenir le bonus.\nNotez qu’il s’agit d’une offre d’une durée limitée. Consultez votre application pour plus de détails."); |
| | | } |
| | | EmailUtil.send(driver.getEmail(), language == 1 ? "在线时长奖励(活动)" : language == 2 ? "Online-duration reward activity" : "Activité de récompense en ligne", document1.html()); |
| | | String randomString = ToolUtil.getRandomString(10); |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/activity_" + randomString + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document1.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/activity_" + randomString + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(driver.getId()); |
| | | tEmail.setType(2); |
| | | tEmail.setName(language == 1 ? "在线时长奖励(活动)" : language == 2 ? "Online-duration reward activity" : "Activité de récompense en ligne"); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | String week = EmailUtil.getWeek(language, i); |
| | | tEmail.setWeek(week); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | new Thread(() -> { |
| | | try { |
| | | String path1 = templatePath + "driver/index.html"; |
| | | Document document1 = Jsoup.parse(new File(path1), "UTF-8"); |
| | | if (1 == language) { |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite").remove(); |
| | | document1.getElementById("user").remove(); |
| | | document1.getElementById("settle").remove(); |
| | | document1.getElementById("pass").remove(); |
| | | document1.getElementById("email").remove(); |
| | | document1.getElementById("bill").remove(); |
| | | document1.getElementById("reward").remove(); |
| | | document1.getElementById("driverAudit").remove(); |
| | | document1.getElementById("carAudit").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("在线时长奖励(活动)"); |
| | | Element rewardToday_user = document1.getElementById("rewardToday_user"); |
| | | rewardToday_user.text("您好 " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday_award = document1.getElementById("rewardToday_award"); |
| | | rewardToday_award.text("奖金 GHS" + driverActivityHistory.getMoney()); |
| | | Element rewardToday_content = document1.getElementById("rewardToday_content"); |
| | | rewardToday_content.text("今日累计在线" + driverActivityOnline.getOnline() + "小时即可活动奖励。\n 注意此活动是有时间限制的,详情请查看I-GO平台。"); |
| | | } |
| | | if (2 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite1").remove(); |
| | | document1.getElementById("user1").remove(); |
| | | document1.getElementById("settle1").remove(); |
| | | document1.getElementById("pass1").remove(); |
| | | document1.getElementById("email1").remove(); |
| | | document1.getElementById("bill1").remove(); |
| | | document1.getElementById("reward1").remove(); |
| | | document1.getElementById("driverAudit1").remove(); |
| | | document1.getElementById("carAudit1").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Online-duration reward activity"); |
| | | Element rewardToday1_user = document1.getElementById("rewardToday1_user"); |
| | | rewardToday1_user.text("Hello " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday1_award = document1.getElementById("rewardToday1_award"); |
| | | rewardToday1_award.text("GHS " + driverActivityHistory.getMoney() + " BONUS"); |
| | | Element rewardToday1_content = document1.getElementById("rewardToday1_content"); |
| | | rewardToday1_content.text("Get a bonus for driving on I-GO today.\nStay online for " + driverActivityOnline.getOnline() + " hours to get the bonus.\nNote that this is a limited-time offer. Check your app for more details."); |
| | | } |
| | | if (3 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("invite2").remove(); |
| | | document1.getElementById("user2").remove(); |
| | | document1.getElementById("settle2").remove(); |
| | | document1.getElementById("pass2").remove(); |
| | | document1.getElementById("email2").remove(); |
| | | document1.getElementById("bill2").remove(); |
| | | document1.getElementById("reward2").remove(); |
| | | document1.getElementById("driverAudit2").remove(); |
| | | document1.getElementById("carAudit2").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Activité de récompense en ligne"); |
| | | Element rewardToday2_user = document1.getElementById("rewardToday2_user"); |
| | | rewardToday2_user.text("Cher(ère) " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday2_award = document1.getElementById("rewardToday2_award"); |
| | | rewardToday2_award.text("Bonus GHS " + driverActivityHistory.getMoney()); |
| | | Element rewardToday2_content = document1.getElementById("rewardToday2_content"); |
| | | rewardToday2_content.text("Obtenez un bonus pour conduire sur I-GO dès aujourd’hui.\nRestez en ligne pendant " + driverActivityOnline.getOnline() + " heures pour obtenir le bonus.\nNotez qu’il s’agit d’une offre d’une durée limitée. Consultez votre application pour plus de détails."); |
| | | } |
| | | EmailUtil.send(driver.getEmail(), language == 1 ? "在线时长奖励(活动)" : language == 2 ? "Online-duration reward activity" : "Activité de récompense en ligne", document1.html()); |
| | | String randomString = ToolUtil.getRandomString(10); |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/activity_" + randomString + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document1.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/activity_" + randomString + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(driver.getId()); |
| | | tEmail.setType(2); |
| | | tEmail.setName(language == 1 ? "在线时长奖励(活动)" : language == 2 ? "Online-duration reward activity" : "Activité de récompense en ligne"); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | String week = EmailUtil.getWeek(language, i); |
| | | tEmail.setWeek(week); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | } |
| | |
| | | driverActivityHistoryMapper.insert(driverActivityHistory); |
| | | |
| | | if(ToolUtil.isNotEmpty(driver.getEmail())) { |
| | | String path1 = templatePath + "driver/index.html"; |
| | | Document document1 = Jsoup.parse(new File(path1), "UTF-8"); |
| | | if (1 == language) { |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite").remove(); |
| | | document1.getElementById("user").remove(); |
| | | document1.getElementById("settle").remove(); |
| | | document1.getElementById("pass").remove(); |
| | | document1.getElementById("email").remove(); |
| | | document1.getElementById("bill").remove(); |
| | | document1.getElementById("reward").remove(); |
| | | document1.getElementById("driverAudit").remove(); |
| | | document1.getElementById("carAudit").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("累计接单奖励(活动)"); |
| | | Element rewardToday_user = document1.getElementById("rewardToday_user"); |
| | | rewardToday_user.text("您好 " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday_award = document1.getElementById("rewardToday_award"); |
| | | rewardToday_award.text("奖金 GHS" + driverActivityHistory.getMoney()); |
| | | Element rewardToday_content = document1.getElementById("rewardToday_content"); |
| | | rewardToday_content.text("今日累计完成" + driverActivityOrder.getOrderNum() + "单即可活动奖励。\n 注意此活动是有时间限制的,详情请查看I-GO平台。"); |
| | | } |
| | | if (2 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite1").remove(); |
| | | document1.getElementById("user1").remove(); |
| | | document1.getElementById("settle1").remove(); |
| | | document1.getElementById("pass1").remove(); |
| | | document1.getElementById("email1").remove(); |
| | | document1.getElementById("bill1").remove(); |
| | | document1.getElementById("reward1").remove(); |
| | | document1.getElementById("driverAudit1").remove(); |
| | | document1.getElementById("carAudit1").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Cumulative order activity"); |
| | | Element rewardToday1_user = document1.getElementById("rewardToday1_user"); |
| | | rewardToday1_user.text("Hello " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday1_award = document1.getElementById("rewardToday1_award"); |
| | | rewardToday1_award.text("GHS " + driverActivityHistory.getMoney() + " BONUS"); |
| | | Element rewardToday1_content = document1.getElementById("rewardToday1_content"); |
| | | rewardToday1_content.text("Get a bonus for driving on I-GO today.\nStay online and complete " + driverActivityOrder.getOrderNum() + " trips to get the bonus.\nNote that this is a limited-time offer. Check your app for more details."); |
| | | } |
| | | if (3 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("invite2").remove(); |
| | | document1.getElementById("user2").remove(); |
| | | document1.getElementById("settle2").remove(); |
| | | document1.getElementById("pass2").remove(); |
| | | document1.getElementById("email2").remove(); |
| | | document1.getElementById("bill2").remove(); |
| | | document1.getElementById("reward2").remove(); |
| | | document1.getElementById("driverAudit2").remove(); |
| | | document1.getElementById("carAudit2").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Activité cumulée des commandes"); |
| | | Element rewardToday2_user = document1.getElementById("rewardToday2_user"); |
| | | rewardToday2_user.text("Cher(ère) " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday2_award = document1.getElementById("rewardToday2_award"); |
| | | rewardToday2_award.text("Bonus GHS " + driverActivityHistory.getMoney()); |
| | | Element rewardToday2_content = document1.getElementById("rewardToday2_content"); |
| | | rewardToday2_content.text("Obtenez un bonus pour conduire sur I-GO dès aujourd’hui.\nRestez en ligne et effectuez " + driverActivityOrder.getOrderNum() + " trajets pour obtenir le bonus.\nNotez qu’il s’agit d’une offre d’une durée limitée. Consultez votre application pour plus de détails."); |
| | | } |
| | | EmailUtil.send(driver.getEmail(), language == 1 ? "累计接单奖励(活动)" : language == 2 ? "Cumulative order activity" : "Activité cumulée des commandes", document1.html()); |
| | | String randomString = ToolUtil.getRandomString(10); |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/activity_" + randomString + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document1.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/activity_" + randomString + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(driver.getId()); |
| | | tEmail.setType(2); |
| | | tEmail.setName(language == 1 ? "累计接单奖励(活动)" : language == 2 ? "Cumulative order activity" : "Activité cumulée des commandes"); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | String week = EmailUtil.getWeek(language, i); |
| | | tEmail.setWeek(week); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | new Thread(() -> { |
| | | try { |
| | | String path1 = templatePath + "driver/index.html"; |
| | | Document document1 = Jsoup.parse(new File(path1), "UTF-8"); |
| | | if (1 == language) { |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite").remove(); |
| | | document1.getElementById("user").remove(); |
| | | document1.getElementById("settle").remove(); |
| | | document1.getElementById("pass").remove(); |
| | | document1.getElementById("email").remove(); |
| | | document1.getElementById("bill").remove(); |
| | | document1.getElementById("reward").remove(); |
| | | document1.getElementById("driverAudit").remove(); |
| | | document1.getElementById("carAudit").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("累计接单奖励(活动)"); |
| | | Element rewardToday_user = document1.getElementById("rewardToday_user"); |
| | | rewardToday_user.text("您好 " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday_award = document1.getElementById("rewardToday_award"); |
| | | rewardToday_award.text("奖金 GHS" + driverActivityHistory.getMoney()); |
| | | Element rewardToday_content = document1.getElementById("rewardToday_content"); |
| | | rewardToday_content.text("今日累计完成" + driverActivityOrder.getOrderNum() + "单即可活动奖励。\n 注意此活动是有时间限制的,详情请查看I-GO平台。"); |
| | | } |
| | | if (2 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite1").remove(); |
| | | document1.getElementById("user1").remove(); |
| | | document1.getElementById("settle1").remove(); |
| | | document1.getElementById("pass1").remove(); |
| | | document1.getElementById("email1").remove(); |
| | | document1.getElementById("bill1").remove(); |
| | | document1.getElementById("reward1").remove(); |
| | | document1.getElementById("driverAudit1").remove(); |
| | | document1.getElementById("carAudit1").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Cumulative order activity"); |
| | | Element rewardToday1_user = document1.getElementById("rewardToday1_user"); |
| | | rewardToday1_user.text("Hello " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday1_award = document1.getElementById("rewardToday1_award"); |
| | | rewardToday1_award.text("GHS " + driverActivityHistory.getMoney() + " BONUS"); |
| | | Element rewardToday1_content = document1.getElementById("rewardToday1_content"); |
| | | rewardToday1_content.text("Get a bonus for driving on I-GO today.\nStay online and complete " + driverActivityOrder.getOrderNum() + " trips to get the bonus.\nNote that this is a limited-time offer. Check your app for more details."); |
| | | } |
| | | if (3 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("invite2").remove(); |
| | | document1.getElementById("user2").remove(); |
| | | document1.getElementById("settle2").remove(); |
| | | document1.getElementById("pass2").remove(); |
| | | document1.getElementById("email2").remove(); |
| | | document1.getElementById("bill2").remove(); |
| | | document1.getElementById("reward2").remove(); |
| | | document1.getElementById("driverAudit2").remove(); |
| | | document1.getElementById("carAudit2").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Activité cumulée des commandes"); |
| | | Element rewardToday2_user = document1.getElementById("rewardToday2_user"); |
| | | rewardToday2_user.text("Cher(ère) " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element rewardToday2_award = document1.getElementById("rewardToday2_award"); |
| | | rewardToday2_award.text("Bonus GHS " + driverActivityHistory.getMoney()); |
| | | Element rewardToday2_content = document1.getElementById("rewardToday2_content"); |
| | | rewardToday2_content.text("Obtenez un bonus pour conduire sur I-GO dès aujourd’hui.\nRestez en ligne et effectuez " + driverActivityOrder.getOrderNum() + " trajets pour obtenir le bonus.\nNotez qu’il s’agit d’une offre d’une durée limitée. Consultez votre application pour plus de détails."); |
| | | } |
| | | EmailUtil.send(driver.getEmail(), language == 1 ? "累计接单奖励(活动)" : language == 2 ? "Cumulative order activity" : "Activité cumulée des commandes", document1.html()); |
| | | String randomString = ToolUtil.getRandomString(10); |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/activity_" + randomString + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document1.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/activity_" + randomString + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(driver.getId()); |
| | | tEmail.setType(2); |
| | | tEmail.setName(language == 1 ? "累计接单奖励(活动)" : language == 2 ? "Cumulative order activity" : "Activité cumulée des commandes"); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | String week = EmailUtil.getWeek(language, i); |
| | | tEmail.setWeek(week); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public void taskMinute() throws Exception { |
| | | Map<String, Date> date = dateUtil.getStartAndEndDate(new Date()); |
| | | Integer language = 2; |
| | | //在线时长 |
| | | List<DriverActivityHistory> list = driverActivityHistoryMapper.queryList(null, 3, 1, date.get("startTime"), date.get("endTime")); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | |
| | | if(null == dao){ |
| | | continue; |
| | | } |
| | | Long duration = Long.valueOf(dao.getOnline() * 3600); |
| | | List<DriverOnline> driverOnlines = driverOnlineMapper.queryList(sdf.format(new Date()), dao.getType(), duration); |
| | | for (DriverOnline driverOnline : driverOnlines) { |
| | | if(dah.getDriverId().compareTo(driverOnline.getDriverId()) == 0){ |
| | | dah.setCarryOut(2);//完成状态 |
| | | driverActivityHistoryMapper.updateById(dah); |
| | | //修改余额 |
| | | Driver driver = this.selectById(dah.getDriverId()); |
| | | driver.setActivityMoney(new BigDecimal(null != driver.getActivityMoney() ? driver.getActivityMoney() : 0) |
| | | .add(new BigDecimal(dah.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveActivityMoney(new BigDecimal(null != driver.getLaveActivityMoney() ? driver.getLaveActivityMoney() : 0) |
| | | .add(new BigDecimal(dah.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0) |
| | | .add(new BigDecimal(dah.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | this.updateById(driver); |
| | | |
| | | //添加收入记录 |
| | | incomeService.saveData(2, driverOnline.getDriverId(), 1, dah.getId(), null, dah.getMoney()); |
| | | |
| | | |
| | | if(ToolUtil.isNotEmpty(driver.getEmail())) { |
| | | String path1 = templatePath + "driver/index.html"; |
| | | Document document1 = Jsoup.parse(new File(path1), "UTF-8"); |
| | | if (1 == language) { |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite").remove(); |
| | | document1.getElementById("user").remove(); |
| | | document1.getElementById("settle").remove(); |
| | | document1.getElementById("pass").remove(); |
| | | document1.getElementById("email").remove(); |
| | | document1.getElementById("bill").remove(); |
| | | document1.getElementById("rewardToday").remove(); |
| | | document1.getElementById("driverAudit").remove(); |
| | | document1.getElementById("carAudit").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("司机奖励通知"); |
| | | Element reward_user = document1.getElementById("reward_user"); |
| | | reward_user.text("您好 " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element reward_content = document1.getElementById("reward_content"); |
| | | reward_content.text("今日累计在线" + dao.getOnline() + "小时,获得奖励GHS" + dah.getMoney() + ",请查收。\n详情请查看I-GO平台。"); |
| | | } |
| | | if (2 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite1").remove(); |
| | | document1.getElementById("user1").remove(); |
| | | document1.getElementById("settle1").remove(); |
| | | document1.getElementById("pass1").remove(); |
| | | document1.getElementById("email1").remove(); |
| | | document1.getElementById("bill1").remove(); |
| | | document1.getElementById("rewardToday1").remove(); |
| | | document1.getElementById("driverAudit1").remove(); |
| | | document1.getElementById("carAudit1").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Reward-driver notice"); |
| | | Element reward1_user = document1.getElementById("reward1_user"); |
| | | reward1_user.text("Hello " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element reward1_content = document1.getElementById("reward1_content"); |
| | | reward1_content.text("You stayed online for " + dao.getOnline() + " hours today, and got a bonus of GHS" + dah.getMoney() + ", please check.\nCheck your app for more details."); |
| | | } |
| | | if (3 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("invite2").remove(); |
| | | document1.getElementById("user2").remove(); |
| | | document1.getElementById("settle2").remove(); |
| | | document1.getElementById("pass2").remove(); |
| | | document1.getElementById("email2").remove(); |
| | | document1.getElementById("bill2").remove(); |
| | | document1.getElementById("rewardToday2").remove(); |
| | | document1.getElementById("driverAudit2").remove(); |
| | | document1.getElementById("carAudit2").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Avis de chauffeur de récompense"); |
| | | Element reward2_user = document1.getElementById("reward2_user"); |
| | | reward2_user.text("Cher(ère) " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element reward2_content = document1.getElementById("reward2_content"); |
| | | reward2_content.text("Vous êtes resté en ligne pendant " + dao.getOnline() + " heures aujourd’hui et avez obtenu un bonus de GHS" + dah.getMoney() + ", veuillez vérifier.\nConsultez votre application pour plus de détails."); |
| | | } |
| | | EmailUtil.send(driver.getEmail(), language == 1 ? "司机奖励通知" : language == 2 ? "Reward-driver notice" : "Avis de chauffeur de récompense", document1.html()); |
| | | String randomString = ToolUtil.getRandomString(10); |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/rewards_" + randomString + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document1.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/rewards_" + randomString + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(driver.getId()); |
| | | tEmail.setType(2); |
| | | tEmail.setName(language == 1 ? "司机奖励通知" : language == 2 ? "Reward-driver notice" : "Avis de chauffeur de récompense"); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | String week = EmailUtil.getWeek(language, i); |
| | | tEmail.setWeek(week); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | Long duration = Double.valueOf(dao.getOnline() * 3600).longValue(); |
| | | List<DriverOnline> driverOnlines = driverOnlineMapper.queryList(sdf.format(new Date()), null, dah.getDriverId(), duration); |
| | | if(driverOnlines.size() > 0){ |
| | | dah.setCarryOut(2);//完成状态 |
| | | driverActivityHistoryMapper.updateById(dah); |
| | | |
| | | redisUtil.remove("driverActivity_" + dah.getDriverId() + "_" + dah.getId()); |
| | | |
| | | //修改余额 |
| | | Driver driver = this.selectById(dah.getDriverId()); |
| | | driver.setActivityMoney(new BigDecimal(null != driver.getActivityMoney() ? driver.getActivityMoney() : 0) |
| | | .add(new BigDecimal(dah.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveActivityMoney(new BigDecimal(null != driver.getLaveActivityMoney() ? driver.getLaveActivityMoney() : 0) |
| | | .add(new BigDecimal(dah.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0) |
| | | .add(new BigDecimal(dah.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | this.updateById(driver); |
| | | |
| | | //添加收入记录 |
| | | incomeService.saveData(2, dah.getDriverId(), 1, dah.getId(), null, dah.getMoney()); |
| | | |
| | | Integer language = driver.getLanguage(); |
| | | if(ToolUtil.isNotEmpty(driver.getEmail())) { |
| | | String path1 = templatePath + "driver/index.html"; |
| | | Document document1 = Jsoup.parse(new File(path1), "UTF-8"); |
| | | if (1 == language) { |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite").remove(); |
| | | document1.getElementById("user").remove(); |
| | | document1.getElementById("settle").remove(); |
| | | document1.getElementById("pass").remove(); |
| | | document1.getElementById("email").remove(); |
| | | document1.getElementById("bill").remove(); |
| | | document1.getElementById("rewardToday").remove(); |
| | | document1.getElementById("driverAudit").remove(); |
| | | document1.getElementById("carAudit").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("司机奖励通知"); |
| | | Element reward_user = document1.getElementById("reward_user"); |
| | | reward_user.text("您好 " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element reward_content = document1.getElementById("reward_content"); |
| | | reward_content.text("今日累计在线" + dao.getOnline() + "小时,获得奖励GHS" + dah.getMoney() + ",请查收。\n详情请查看I-GO平台。"); |
| | | } |
| | | if (2 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("french").remove(); |
| | | document1.getElementById("invite1").remove(); |
| | | document1.getElementById("user1").remove(); |
| | | document1.getElementById("settle1").remove(); |
| | | document1.getElementById("pass1").remove(); |
| | | document1.getElementById("email1").remove(); |
| | | document1.getElementById("bill1").remove(); |
| | | document1.getElementById("rewardToday1").remove(); |
| | | document1.getElementById("driverAudit1").remove(); |
| | | document1.getElementById("carAudit1").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Reward-driver notice"); |
| | | Element reward1_user = document1.getElementById("reward1_user"); |
| | | reward1_user.text("Hello " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element reward1_content = document1.getElementById("reward1_content"); |
| | | reward1_content.text("You stayed online for " + dao.getOnline() + " hours today, and got a bonus of GHS" + dah.getMoney() + ", please check.\nCheck your app for more details."); |
| | | } |
| | | if (3 == language) { |
| | | document1.getElementById("chinese").remove(); |
| | | document1.getElementById("english").remove(); |
| | | document1.getElementById("invite2").remove(); |
| | | document1.getElementById("user2").remove(); |
| | | document1.getElementById("settle2").remove(); |
| | | document1.getElementById("pass2").remove(); |
| | | document1.getElementById("email2").remove(); |
| | | document1.getElementById("bill2").remove(); |
| | | document1.getElementById("rewardToday2").remove(); |
| | | document1.getElementById("driverAudit2").remove(); |
| | | document1.getElementById("carAudit2").remove(); |
| | | |
| | | document1.getElementsByTag("title").get(0).text("Avis de chauffeur de récompense"); |
| | | Element reward2_user = document1.getElementById("reward2_user"); |
| | | reward2_user.text("Cher(ère) " + driver.getFirstName() + "" + driver.getLastName() + ","); |
| | | Element reward2_content = document1.getElementById("reward2_content"); |
| | | reward2_content.text("Vous êtes resté en ligne pendant " + dao.getOnline() + " heures aujourd’hui et avez obtenu un bonus de GHS" + dah.getMoney() + ", veuillez vérifier.\nConsultez votre application pour plus de détails."); |
| | | } |
| | | EmailUtil.send(driver.getEmail(), language == 1 ? "司机奖励通知" : language == 2 ? "Reward-driver notice" : "Avis de chauffeur de récompense", document1.html()); |
| | | String randomString = ToolUtil.getRandomString(10); |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/rewards_" + randomString + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(document1.html()); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/rewards_" + randomString + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(driver.getId()); |
| | | tEmail.setType(2); |
| | | tEmail.setName(language == 1 ? "司机奖励通知" : language == 2 ? "Reward-driver notice" : "Avis de chauffeur de récompense"); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | String week = EmailUtil.getWeek(language, i); |
| | | tEmail.setWeek(week); |
| | | boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); |
| | | if(am){ |
| | | tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); |
| | | }else { |
| | | tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); |
| | | } |
| | | emailService.insert(tEmail); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | //添加收入记录 |
| | | incomeService.saveData(2, dah.getDriverId(), 1, dah.getId(), null, dah.getMoney()); |
| | | |
| | | |
| | | Integer language = driver.getLanguage(); |
| | | if(ToolUtil.isNotEmpty(driver.getEmail())) { |
| | | String path1 = templatePath + "driver/index.html"; |
| | | Document document1 = Jsoup.parse(new File(path1), "UTF-8"); |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import cn.hutool.core.util.CharsetUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | |
| | | file.createNewFile(); |
| | | } |
| | | //写入相应的文件 |
| | | PrintWriter out = new PrintWriter(new FileWriter(file)); |
| | | orderPositions.add(orderPosition); |
| | | System.err.println("存储新数据:" + JSON.toJSONString(orderPositions)); |
| | | out.write(JSON.toJSONString(orderPositions)); |
| | | out.flush(); |
| | | out.close(); |
| | | FileUtil.writeUtf8String(JSON.toJSONString(orderPositions), file); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | return new ArrayList<>(); |
| | | } |
| | | //读取文件(字符流) |
| | | 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); |
| | | } |
| | | String s = FileUtil.readString(file, CharsetUtil.CHARSET_UTF_8); |
| | | List<OrderPosition> list = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(sb.toString())){ |
| | | list = JSONArray.parseArray(sb.toString(), OrderPosition.class); |
| | | if(ToolUtil.isNotEmpty(s)){ |
| | | list = JSONArray.parseArray(s, OrderPosition.class); |
| | | } |
| | | System.err.println("坐标:" + sb); |
| | | return list; |
| | | } |
| | | } |
| | |
| | | // List<Map<String, Object>> list2 = orderCrossCityService.queryOrderList(state, uid); |
| | | // datas.addAll(list2); |
| | | //小件物流 |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryOrderList(uid, language); |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryOrderList(state, uid, language); |
| | | datas.addAll(list3); |
| | | |
| | | //分页 |
| | |
| | | List<Map<String, Object>> list2 = orderCrossCityService.queryOrderList(language, state, uid); |
| | | datas.addAll(list2); |
| | | }else{//小件物流 |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryOrderList(uid, language); |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryOrderList(state, uid, language); |
| | | datas.addAll(list3); |
| | | } |
| | | |
| | |
| | | List<Map<String, Object>> list1 = orderPrivateCarService.queryMyAllOrder(state, uid, language); |
| | | for (Map<String, Object> map : list1) { |
| | | Integer id = Integer.valueOf(map.get("id").toString()); |
| | | map.put("settleAccounts", 1); |
| | | map.put("settleAccounts", 0); |
| | | SettlementDetail settlementDetail = settlementDetailService.selectOne(new EntityWrapper<SettlementDetail>().eq("orderId", id).eq("orderType", 1)); |
| | | if(null != settlementDetail){ |
| | | SettlementRecord settlementRecord = settlementRecordService.selectById(settlementDetail.getSettlementRecordId()); |
| | | map.put("settleAccounts", settlementRecord.getPaymentStatus() == 1 ? 0 : 1); |
| | | map.put("settleAccounts", null == settlementRecord || settlementRecord.getPaymentStatus() == 1 ? 0 : 1); |
| | | } |
| | | } |
| | | datas.addAll(list1); |
| | |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryMyAllOrder(state, uid, language); |
| | | for (Map<String, Object> map : list3) { |
| | | Integer id = Integer.valueOf(map.get("id").toString()); |
| | | map.put("settleAccounts", 1); |
| | | map.put("settleAccounts", 0); |
| | | SettlementDetail settlementDetail = settlementDetailService.selectOne(new EntityWrapper<SettlementDetail>().eq("orderId", id).eq("orderType", 4)); |
| | | if(null != settlementDetail){ |
| | | SettlementRecord settlementRecord = settlementRecordService.selectById(settlementDetail.getSettlementRecordId()); |
| | | map.put("settleAccounts", settlementRecord.getPaymentStatus() == 1 ? 0 : 1); |
| | | map.put("settleAccounts", null == settlementRecord || settlementRecord.getPaymentStatus() == 1 ? 0 : 1); |
| | | } |
| | | } |
| | | datas.addAll(list3); |
| | |
| | | } |
| | | 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"); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Integer type = Integer.valueOf(map.get("orderType").toString()); |
| | | if(type == 2){ |
| | | String travelTime = map.get("travelTime").toString(); |
| | | long time = System.currentTimeMillis() - sdf.parse(travelTime).getTime() - (driverTimeout * 60000); |
| | | map.put("timeOutCancel", Double.valueOf(time / 60000).intValue()); |
| | | }else{ |
| | | String estimateArriveTime = map.get("estimateArriveTime").toString(); |
| | | long time = System.currentTimeMillis() - sdf.parse(estimateArriveTime).getTime() - (driverTimeout * 60000); |
| | | map.put("timeOutCancel", Double.valueOf(time / 60000).intValue()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | |
| | | case 3://城际 |
| | | return orderCrossCityService.calculateMileage(orderPosition); |
| | | case 4:// |
| | | break; |
| | | return orderLogisticsService.calculateMileage(orderPosition.getOrderId(), orderPosition.getLon(), orderPosition.getLat()); |
| | | case 5: |
| | | break; |
| | | case 6: |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | |
| | | |
| | | Double laveActivityMoney = driver1.getLaveActivityMoney(); |
| | | Double laveBusinessMoney = driver1.getLaveBusinessMoney(); |
| | | if(laveActivityMoney.compareTo(payMoney) < 0){ |
| | | //活动余额小于结算金额 |
| | | if(null != laveActivityMoney && 0 < laveActivityMoney && laveActivityMoney.compareTo(payMoney) < 0){ |
| | | driver1.setLaveActivityMoney(0D); |
| | | BigDecimal m = new BigDecimal(payMoney).subtract(new BigDecimal(laveActivityMoney)); |
| | | BigDecimal m = new BigDecimal(payMoney).subtract(new BigDecimal(laveActivityMoney)).setScale(2, RoundingMode.HALF_EVEN); |
| | | driver1.setLaveBusinessMoney(new BigDecimal(laveBusinessMoney).subtract(m).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | settlementRecord.setPayMoney(laveActivityMoney); |
| | | settlementRecord.setPaymentStatus(2); |
| | |
| | | settlementRecord1.setPayMoney(m.doubleValue()); |
| | | settlementRecord1.setBalanceType(2); |
| | | this.insert(settlementRecord1); |
| | | |
| | | }else{ |
| | | } |
| | | //活动余额大于结算金额 |
| | | if(null != laveActivityMoney && 0 < laveActivityMoney && laveActivityMoney.compareTo(payMoney) >= 0){ |
| | | driver1.setLaveActivityMoney(new BigDecimal(laveActivityMoney).subtract(new BigDecimal(payMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | settlementRecord.setPaymentStatus(2); |
| | | settlementRecord.setPayType(payType); |
| | |
| | | this.updateById(settlementRecord); |
| | | balanceUsageRecordService.saveBalanceUsageRecord(settlementRecord.getDriverId(), 1, payMoney, settlementRecord.getType() + 2); |
| | | } |
| | | if(null == laveActivityMoney || 0 == laveActivityMoney){ |
| | | driver1.setLaveActivityMoney(0D); |
| | | driver1.setLaveBusinessMoney(new BigDecimal(laveBusinessMoney).subtract(new BigDecimal(payMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | settlementRecord.setPaymentStatus(2); |
| | | settlementRecord.setPayType(payType); |
| | | settlementRecord.setBalanceType(1); |
| | | settlementRecord.setPayTime(new Date()); |
| | | this.updateById(settlementRecord); |
| | | balanceUsageRecordService.saveBalanceUsageRecord(settlementRecord.getDriverId(), 2, payMoney, settlementRecord.getType() + 2); |
| | | } |
| | | |
| | | driver1.setBalance(new BigDecimal(driver1.getBalance()).subtract(new BigDecimal(payMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | //添加交易明细 |
| | |
| | | public List<QueryHistoricalSettlement> queryHistoricalSettlement(Integer language, Integer driverId, Integer pageNum, Integer size) { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> list = this.baseMapper.queryHistoricalSettlement(driverId, pageNum, size); |
| | | Double aDouble = this.baseMapper.queryHistoricalSettlementTotal(driverId); |
| | | List<QueryHistoricalSettlement> datas = new ArrayList<>(); |
| | | for (Map<String, Object> map : list) { |
| | | QueryHistoricalSettlement queryHistoricalSettlement = new QueryHistoricalSettlement(); |
| | |
| | | break; |
| | | } |
| | | } |
| | | queryHistoricalSettlement.setTotalPrice(aDouble); |
| | | datas.add(queryHistoricalSettlement); |
| | | } |
| | | return datas; |
| | |
| | | w = w == 1 ? 7 : w - 1; |
| | | int d = today.get(Calendar.DAY_OF_MONTH); |
| | | if(null != settlementAllocation){ |
| | | List<Map<String, Object>> list = settlementDetailService.queryGroupDriver(); |
| | | JSONObject jsonObject = JSON.parseObject(settlementAllocation.getContent()); |
| | | Integer type = jsonObject.getInteger("type"); |
| | | Integer day = jsonObject.getInteger("day"); |
| | | if(type == 2 && w == day){//周结算 |
| | | List<Map<String, Object>> list = settlementDetailService.queryGroupDriver(); |
| | | for (Map<String, Object> map : list) { |
| | | Integer driverId = Integer.valueOf(map.get("driverId").toString()); |
| | | Double price = Double.valueOf(map.get("price").toString()); |
| | |
| | | } |
| | | } |
| | | if(type == 3 && d == day){//月结算 |
| | | List<Map<String, Object>> list = settlementDetailService.queryGroupDriver(); |
| | | for (Map<String, Object> map : list) { |
| | | Integer driverId = Integer.valueOf(map.get("driverId").toString()); |
| | | Double price = Double.valueOf(map.get("price").toString()); |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.SysOvertimeMapper; |
| | | import com.stylefeng.guns.modular.system.model.SysOvertime; |
| | | import com.stylefeng.guns.modular.system.service.ISysOvertimeService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/7/17 10:18 |
| | | */ |
| | | @Service |
| | | public class SysOvertimeServiceImpl extends ServiceImpl<SysOvertimeMapper, SysOvertime> implements ISysOvertimeService { |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil withdrawal(Double money, Integer uid, Integer type, String remark, Integer language) throws Exception { |
| | | public synchronized ResultUtil withdrawal(Double money, Integer uid, Integer type, String remark, Integer language) throws Exception { |
| | | 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."); |
| | | } |
| | |
| | | import com.google.fleetengine.auth.token.VehicleClaims; |
| | | import com.google.fleetengine.auth.token.factory.signer.*; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.UUIDUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | |
| | | 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"; |
| | | |
| | | private final static String key = "AIzaSyCG6PsfkaCEc94VK2vIAZk1YYKvOS_Ewts"; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | |
| | | * @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"); |
| | |
| | | |
| | | return response.body(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 上报google可结算订单 |
| | | * @param tripId 行程id |
| | | * @return |
| | | */ |
| | | public boolean reportBillableEvent(String tripId) throws Exception { |
| | | String billableEventId = UUIDUtil.getRandomCode(); |
| | | String url = "https://mobilitybilling.googleapis.com/v1:reportBillableEvent?regionCode=GH&key=" + key + "&billableEventId=" + billableEventId; |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", "Bearer " + getToken()); |
| | | headers.put("Content-Type", "application/json"); |
| | | post.addHeaders(headers); |
| | | JSONObject body = new JSONObject(); |
| | | body.put("related_ids", "[\"" + tripId + "\"]"); |
| | | post.body(body.toJSONString()); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //上线客户测试和上线运营开放 |
| | | // HttpResponse response = post.execute(); |
| | | // if(200 != response.getStatus()){ |
| | | // logger.error(response.body()); |
| | | // throw new Exception(response.body()); |
| | | // } |
| | | return true; |
| | | } |
| | | |
| | | } |
| | |
| | | * 司机超时推送 |
| | | * @param type |
| | | * @param uid |
| | | * @param orderId |
| | | * @param orderType |
| | | * @param describe |
| | | * @param timeOutType 超时类型(1=用户可免费取消提醒,2=预约单接单提醒,3=超时循环提醒) |
| | | * @param orderId 订单id |
| | | * @param orderType 订单类型(1=打车,4=包裹) |
| | | * @param describe 展示内容 |
| | | * @param audioUrl 语音播报音频地址 |
| | | */ |
| | | public void pushOrderTimeOut(Integer type, Integer uid, Integer orderId, Integer orderType, String describe){ |
| | | public void pushOrderTimeOut(Integer type, Integer uid, Integer timeOutType, Integer orderId, Integer orderType, String describe, String audioUrl){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | | jsonObject.put("method", "ORDER_TIME_OUT"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("timeOutType", timeOutType); |
| | | map.put("orderId", orderId); |
| | | map.put("orderType", orderType); |
| | | map.put("describe", describe); |
| | | map.put("audioUrl", audioUrl); |
| | | jsonObject.put("data", map); |
| | | |
| | | //调用推送 |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util; |
| | | |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.ApplicationContextAware; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/7/18 9:33 |
| | | */ |
| | | @Component |
| | | public class SpringUtils implements ApplicationContextAware { |
| | | |
| | | private static ApplicationContext applicationContext; |
| | | |
| | | @Override |
| | | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
| | | SpringUtils.applicationContext = applicationContext; |
| | | } |
| | | |
| | | //获取applicationContext |
| | | public static ApplicationContext getApplicationContext() { |
| | | return applicationContext; |
| | | } |
| | | |
| | | public static <T> T getBean(String beanName) { |
| | | if(applicationContext.containsBean(beanName)){ |
| | | return (T) applicationContext.getBean(beanName); |
| | | }else{ |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | //通过class获取Bean. |
| | | public static <T> T getBean(Class<T> clazz) { |
| | | return getApplicationContext().getBean(clazz); |
| | | } |
| | | } |
| | |
| | | private IDriverOnlineService driverOnlineService; |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MMM-dd"); |
| | | System.err.println(sdf.format(new Date())); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | //处理结束订单后30分钟解绑小号功能 |
| | | orderService.taskMidAxbUnBindSend(); |
| | | //处理司机连续不接单的情况 |
| | | driverOnlineService.deductionDuration(); |
| | | driverOnlineService.deductionDuration1(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
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; |
| | | } |
| | | } |
| | | } |
| | |
| | | * @param propertiesStream 配置文件流 |
| | | * @return |
| | | */ |
| | | public static void start(InputStream propertiesStream) throws SchedulerException { |
| | | public static void start(InputStream propertiesStream){ |
| | | if(null == scheduler){ |
| | | scheduler = SchedulerUtil.getScheduler(propertiesStream); |
| | | } |
| | | scheduler.start(); |
| | | log.info(QuartzEnum.SCHEDULER_START_SUCCESS.getValue()); |
| | | try { |
| | | scheduler.start(); |
| | | log.info(QuartzEnum.SCHEDULER_START_SUCCESS.getValue()); |
| | | } catch (SchedulerException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | private static JobDetail getJobDetail(Job job, String job_name, String group_name, JobDataMap jobDataMap){ |
| | | JobDetail jobDetail = JobBuilder.newJob(job.getClass()) |
| | | .withIdentity(job_name, group_name) |
| | | .usingJobData(jobDataMap) |
| | | .setJobData(jobDataMap) |
| | | .build(); |
| | | return jobDetail; |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.util.quartz.jobs; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.util.PushUtil; |
| | | import com.stylefeng.guns.modular.system.util.TextToSpeechUtil; |
| | | import com.stylefeng.guns.modular.system.util.quartz.QuartzUtil; |
| | | import com.stylefeng.guns.modular.system.util.quartz.model.QuartzEnum; |
| | | import com.stylefeng.guns.modular.system.util.quartz.model.QuartzJob; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobDetail; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobKey; |
| | | import org.quartz.*; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Timer; |
| | | import java.util.TimerTask; |
| | | |
| | | /** |
| | | * 订单司机超时提醒任务 |
| | |
| | | |
| | | @Override |
| | | public QuartzJob buildQuartzJob() { |
| | | return super.buildQuartzJob(); |
| | | return buildQuartzJob(QuartzEnum.JOB_NAME.getValue()); |
| | | } |
| | | |
| | | @Override |
| | | public QuartzJob buildQuartzJob(String name) { |
| | | return super.buildQuartzJob(name); |
| | | return buildQuartzJob(name, QuartzEnum.DEFAULT_GROUP.getValue()); |
| | | } |
| | | |
| | | @Override |
| | | public QuartzJob buildQuartzJob(String name, String group) { |
| | | return super.buildQuartzJob(name, group); |
| | | return buildQuartzJob(name, QuartzEnum.DEFAULT_GROUP.getValue(), null); |
| | | } |
| | | |
| | | @Override |
| | | public QuartzJob buildQuartzJob(String name, String group, JobDataMap jobDataMap) { |
| | | return super.buildQuartzJob(name, group, jobDataMap); |
| | | QuartzJob job = new OrderTimeOutJob(); |
| | | if(ToolUtil.isNotEmpty(name)){ |
| | | job.setName(name); |
| | | }else{ |
| | | job.setName(QuartzEnum.JOB_NAME.getValue()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(group)){ |
| | | job.setGroup(group); |
| | | }else{ |
| | | job.setGroup(QuartzEnum.DEFAULT_GROUP.getValue()); |
| | | } |
| | | if(null != jobDataMap){ |
| | | job.setJobDataMap(jobDataMap); |
| | | } |
| | | return job; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void run(JobExecutionContext jobExecutionContext) { |
| | | JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap(); |
| | | Integer driverId = jobDataMap.getIntegerFromString("driverId"); |
| | | Integer orderId = jobDataMap.getIntegerFromString("orderId"); |
| | | Integer orderType = jobDataMap.getIntegerFromString("orderType"); |
| | | JobDetail jobDetail = jobExecutionContext.getJobDetail(); |
| | | JobDataMap jobDataMap = jobDetail.getJobDataMap(); |
| | | String name = jobDetail.getKey().getName(); |
| | | log.info("执行{}定时任务逻辑 JobDataMap:{}", name, JSON.toJSONString(jobDataMap)); |
| | | Integer timeOutType = jobDataMap.getIntValue("timeOutType"); |
| | | Integer driverId = jobDataMap.getIntValue("driverId"); |
| | | Integer orderId = jobDataMap.getIntValue("orderId"); |
| | | Integer orderType = jobDataMap.getIntValue("orderType"); |
| | | Integer language = jobDataMap.getIntValue("language"); |
| | | long timeOut = jobDataMap.getLongValue("timeOut"); |
| | | String describe = jobDataMap.getString("describe"); |
| | | if(3 == timeOutType){ |
| | | Integer m = Double.valueOf((System.currentTimeMillis() - timeOut) / 60000).intValue(); |
| | | if(orderType == 1){ |
| | | if(0 == m){ |
| | | describe = language == 1 ? "您的打车订单已超时,请抓紧!" : language == 2 ? "Your ride order is overdue, please go faster." : "Votre commande de course est en retard, veuillez aller plus vite."; |
| | | }else{ |
| | | describe = language == 1 ? "您的打车订单已超时" + m + "分钟,请抓紧!" : language == 2 ? "Your ride order is overdue for " + m + " minute(s), please go faster." : "Votre commande de course est en retard depuis " + m + " minute(s), veuillez aller plus vite."; |
| | | } |
| | | } |
| | | if(orderType == 4){ |
| | | if(0 == m){ |
| | | describe = language == 1 ? "您的包裹订单已超时,请抓紧!" : language == 2 ? "Your delivery order is overdue, please go faster." : "Votre commande de Delivery est en retard, veuillez aller plus vite."; |
| | | }else{ |
| | | describe = language == 1 ? "您的包裹订单已超时" + m + "分钟,请抓紧!" : language == 2 ? "Your delivery order is overdue for " + m + " minute(s), please go faster." : "Votre commande de Delivery est en retard depuis " + m + " minute(s), veuillez aller plus vite."; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | if(1 == orderType){ |
| | | //结束预约单出发循环提醒定时 |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | if(2 != orderPrivateCar.getState()){ |
| | | List<Integer> list = Arrays.asList(4, 5, 6, 7, 8, 9, 10, 11, 12); |
| | | if(1 == timeOutType && list.contains(orderPrivateCar.getState())){ |
| | | JobKey key = jobExecutionContext.getJobDetail().getKey(); |
| | | boolean b = QuartzUtil.deleteQuartzTask(key); |
| | | if(!b){ |
| | |
| | | } |
| | | return; |
| | | } |
| | | if(2 == timeOutType && (System.currentTimeMillis() >= timeOut || list.contains(orderPrivateCar.getState()))){ |
| | | JobKey key = jobExecutionContext.getJobDetail().getKey(); |
| | | boolean b = QuartzUtil.deleteQuartzTask(key); |
| | | if(!b){ |
| | | log.error("定时任务关闭失败:" + key.toString()); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | //结束超时循环提醒定时 |
| | | if(3 == timeOutType && list.contains(orderPrivateCar.getState())){ |
| | | JobKey key = jobExecutionContext.getJobDetail().getKey(); |
| | | boolean b = QuartzUtil.deleteQuartzTask(key); |
| | | if(!b){ |
| | | log.error("定时任务关闭失败:" + key.toString()); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | |
| | | } |
| | | if(4 == orderType){ |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | if(2 != orderLogistics.getState()){ |
| | | List<Integer> list = Arrays.asList(4, 5, 6, 7, 8, 9, 10, 11, 12, 13); |
| | | if(1 == timeOutType && list.contains(orderLogistics.getState())){ |
| | | JobKey key = jobExecutionContext.getJobDetail().getKey(); |
| | | boolean b = QuartzUtil.deleteQuartzTask(key); |
| | | if(!b){ |
| | | log.error("定时任务关闭失败:" + key.toString()); |
| | | } |
| | | return; |
| | | } |
| | | //结束超时循环提醒定时 |
| | | if(3 == timeOutType && list.contains(orderLogistics.getState())){ |
| | | JobKey key = jobExecutionContext.getJobDetail().getKey(); |
| | | boolean b = QuartzUtil.deleteQuartzTask(key); |
| | | if(!b){ |
| | |
| | | return; |
| | | } |
| | | } |
| | | pushUtil.pushOrderTimeOut(2, driverId, orderId, orderType, describe); |
| | | |
| | | String audioUrl = null; |
| | | try { |
| | | audioUrl = TextToSpeechUtil.create(language == 1 ? "cmn-CN" : language == 2 ? "en-US" : "fr-FR", describe, "orderTimeOut" + driverId + "_" + timeOutType + ".mp3"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | //定时任务删除语音文件 |
| | | 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/orderTimeOut" + driverId + "_" + timeOutType + ".mp3"); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (process != null) { |
| | | process.destroy(); |
| | | } |
| | | } |
| | | }, 30000); |
| | | |
| | | log.info("开始推送提醒-{}:orderId={};orderType={};timeOutType={};describe={};audioUrl={}", System.currentTimeMillis(), orderId, orderType, timeOutType, describe, audioUrl); |
| | | pushUtil.pushOrderTimeOut(2, driverId, timeOutType, orderId, orderType, describe, audioUrl); |
| | | } |
| | | |
| | | |
| | |
| | | package com.stylefeng.guns.modular.system.util.quartz.model; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.util.SpringUtils; |
| | | import lombok.Data; |
| | | import lombok.Getter; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | import org.quartz.*; |
| | | |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * quartz任务类 |
| | |
| | | /** |
| | | * 任务名称 |
| | | */ |
| | | @Getter |
| | | private String name; |
| | | /** |
| | | * 任务分组 |
| | | */ |
| | | @Getter |
| | | private String group; |
| | | /** |
| | | * 自定义参数 |
| | | */ |
| | | @Getter |
| | | private JobDataMap jobDataMap; |
| | | |
| | | |
| | |
| | | * 构建QuartzJob对象 |
| | | * @return |
| | | */ |
| | | public QuartzJob buildQuartzJob() { |
| | | return buildQuartzJob(QuartzEnum.JOB_NAME.getValue()); |
| | | } |
| | | public abstract QuartzJob buildQuartzJob(); |
| | | |
| | | |
| | | |
| | |
| | | * @param name 任务名称 |
| | | * @return |
| | | */ |
| | | public QuartzJob buildQuartzJob(String name) { |
| | | return buildQuartzJob(name, QuartzEnum.DEFAULT_GROUP.getValue()); |
| | | } |
| | | public abstract QuartzJob buildQuartzJob(String name); |
| | | |
| | | |
| | | |
| | |
| | | * @param group 任务分组名称 |
| | | * @return |
| | | */ |
| | | public QuartzJob buildQuartzJob(String name, String group) { |
| | | return buildQuartzJob(name, QuartzEnum.DEFAULT_GROUP.getValue(), null); |
| | | } |
| | | public abstract QuartzJob buildQuartzJob(String name, String group); |
| | | |
| | | /** |
| | | * 构建QuartzJob对象 |
| | |
| | | * @param jobDataMap 自定义参数 |
| | | * @return |
| | | */ |
| | | public QuartzJob buildQuartzJob(String name, String group, JobDataMap jobDataMap) { |
| | | if(ToolUtil.isNotEmpty(name)){ |
| | | this.name = name; |
| | | }else{ |
| | | this.name = QuartzEnum.JOB_NAME.getValue(); |
| | | } |
| | | if(ToolUtil.isNotEmpty(group)){ |
| | | this.group = group; |
| | | }else{ |
| | | this.group = QuartzEnum.DEFAULT_GROUP.getValue(); |
| | | } |
| | | this.jobDataMap = jobDataMap; |
| | | return this; |
| | | } |
| | | public abstract QuartzJob buildQuartzJob(String name, String group, JobDataMap jobDataMap); |
| | | |
| | | /** |
| | | * 需要执行的任务的业务逻辑方法 |
| | |
| | | */ |
| | | public abstract void run(JobExecutionContext jobExecutionContext); |
| | | |
| | | /** |
| | | * 执行器执行任务调用的方式 |
| | | * @param jobExecutionContext 定时任务上下文对象 |
| | | * @throws JobExecutionException |
| | | */ |
| | | @Override |
| | | public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { |
| | | String name = jobExecutionContext.getJobDetail().getKey().getName(); |
| | | log.info(name + " scheduled task start!"); |
| | | run(jobExecutionContext); |
| | | } |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext jobExecutionContext){ |
| | | JobDetail jobDetail = jobExecutionContext.getJobDetail(); |
| | | String name = jobDetail.getKey().getName(); |
| | | log.info(name + " scheduled task start!\nJobDataMap:{}", JSON.toJSONString(jobDetail.getJobDataMap())); |
| | | try { |
| | | Class jobClass = jobDetail.getJobClass(); |
| | | Method run = jobClass.getMethod("run", JobExecutionContext.class); |
| | | Object o = SpringUtils.getBean(jobClass); |
| | | Object invoke = run.invoke(o, jobExecutionContext); |
| | | } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | private Double orderMoney; |
| | | @ApiModelProperty(value = "支付方式(1=OK平台支付(线上支付),2=其他方式支付(线下支付))", example = "1") |
| | | private Integer payManner; |
| | | @ApiModelProperty("小件物流差价") |
| | | private Double priceDifference; |
| | | @ApiModelProperty("支付金额") |
| | | private Double payMoney; |
| | | @ApiModelProperty("是否是改派单(1=否,2=是)") |
| | |
| | | private Integer isFrozen; |
| | | @ApiModelProperty("超时取消时间") |
| | | private Integer timeOutCancel; |
| | | @ApiModelProperty("超时语音文件地址") |
| | | private String audioUrl; |
| | | @ApiModelProperty("接单时间") |
| | | private String snatchOrderTime; |
| | | private String tripId; |
| | | @ApiModelProperty("中途取消(0=否,1=是)") |
| | | private Integer cancelMidway; |
| | | |
| | | public Integer getStartDuration() { |
| | | return startDuration; |
| | |
| | | this.tripId = tripId; |
| | | } |
| | | |
| | | public Integer getCancelMidway() { |
| | | return cancelMidway; |
| | | } |
| | | |
| | | public void setCancelMidway(Integer cancelMidway) { |
| | | this.cancelMidway = cancelMidway; |
| | | } |
| | | |
| | | public String getAudioUrl() { |
| | | return audioUrl; |
| | | } |
| | | |
| | | public void setAudioUrl(String audioUrl) { |
| | | this.audioUrl = audioUrl; |
| | | } |
| | | |
| | | public Double getPriceDifference() { |
| | | return priceDifference; |
| | | } |
| | | |
| | | public void setPriceDifference(Double priceDifference) { |
| | | this.priceDifference = priceDifference; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderInfoWarpper{" + |
| | |
| | | orderInfoWarpper.setSnatchOrderTime(null != map.get("snatchOrderTime") ? map.get("snatchOrderTime").toString() : ""); |
| | | orderInfoWarpper.setUserPhone(null != map.get("userPhone") ? map.get("userPhone").toString() : ""); |
| | | orderInfoWarpper.setTripId(null != map.get("tripId") ? map.get("tripId").toString() : ""); |
| | | orderInfoWarpper.setCancelMidway(null != map.get("cancelMidway") ? Integer.valueOf(map.get("cancelMidway").toString()) : 0); |
| | | orderInfoWarpper.setAudioUrl(null != map.get("audioUrl") ? map.get("audioUrl").toString() : ""); |
| | | orderInfoWarpper.setPriceDifference(null != map.get("priceDifference") ? Double.valueOf(map.get("priceDifference").toString()) : 0); |
| | | } |
| | | return orderInfoWarpper; |
| | | } |
| | |
| | | private String createTime; |
| | | @ApiModelProperty("结算金额") |
| | | private Double price; |
| | | @ApiModelProperty("结算总金额") |
| | | private Double totalPrice; |
| | | @ApiModelProperty("结算周期(1=日结算,2=周结算,3=月结算)") |
| | | private Integer type; |
| | | @ApiModelProperty("支付方式") |
| | |
| | | |
| | | 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"); |
| | |
| | | |
| | | spring: |
| | | datasource: |
| | | url: jdbc:mysql://127.0.0.1:3306/igotravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B0 |
| | | url: jdbc:mysql://127.0.0.1:3306/igotravel2.0?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B0 |
| | | username: root |
| | | password: HjKbXilb9zajmXbl |
| | | db-name: guns #用来搜集数据库的所有表 |
| | |
| | | <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(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @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); |
| | | |
| | | |
| | | String vehicleId = null; |
| | | if(null != orderLogistics.getDriverId()){ |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | Car car = carMapper.selectById(driver.getCarId()); |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carMapper.updateById(car); |
| | | } |
| | | //查询车辆信息,没有则创建信息 |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | new Thread(() -> { |
| | | try { |
| | | String vehicleId = null; |
| | | if(null != orderLogistics.getDriverId()){ |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | Car car = carMapper.selectById(driver.getCarId()); |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carMapper.updateById(car); |
| | | } |
| | | //查询车辆信息,没有则创建信息 |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | |
| | | } |
| | | //创建行程数据 |
| | | fleetEngineUtil.createTrip(vehicleId, 1, orderLogistics.getTripId(), |
| | | orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(), orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | } |
| | | //创建行程数据 |
| | | 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(); |
| | | } |
| | |
| | | dr.setState(3); |
| | | 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 deductionRatio = redEnvelopePaymentSettings.getDeductionRatio(); |
| | | 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; |
| | | } |
| | |
| | | integer = orderCancelService.saveData(id, 4, reason, remark, null, amount, 1, 1, uid); |
| | | } |
| | | this.deleteTask(id);//删除定时任务 |
| | | |
| | | |
| | | |
| | | //修改司机为空闲 |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, orderLogistics.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, 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 driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | driver.setState(2); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | //修改行程信息 |
| | | fleetEngineUtil.updateTrip("CANCELED", null, null, orderLogistics.getTripId(), null, null, null, null); |
| | | 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"))); |
| | | } |
| | | CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", companyId)); |
| | | JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); |
| | | map.put("timeOutCancel", jsonObject.getIntValue("driverTimeout")); |
| | | map.put("timeOutCancel", 0); |
| | | if(null != orderLogistics.getEstimateArriveTime()){ |
| | | CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", companyId)); |
| | | JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); |
| | | 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); |
| | | } |
| | | |
| | | JSONObject order = object.getJSONObject("order"); |
| | | long m = order.getInteger("orderAcceptanceTime") * 60000L; |
| | | //超过免费时间,计算费用 |
| | | if(orderLogistics.getSnatchOrderTime().getTime() + m < System.currentTimeMillis()){ |
| | | BigDecimal money = order.getBigDecimal("money"); |
| | | if(null != orderLogistics.getSetOutTime()){ |
| | | //非服务中且未超时 |
| | | if(orderLogistics.getState() != 5){ |
| | | JSONObject order = object.getJSONObject("order"); |
| | | long m = order.getInteger("orderAcceptanceTime") * 60000L; |
| | | //超过免费时间,且没有超时,计算费用 |
| | | if(orderLogistics.getSnatchOrderTime().getTime() + m < System.currentTimeMillis() && orderLogistics.getEstimateArriveTime().getTime() + t > System.currentTimeMillis()){ |
| | | BigDecimal money = order.getBigDecimal("money"); |
| | | //里程费 |
| | | 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(); |
| | | } |
| | | 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);//司机收入 |
| | | 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); |
| | | //添加已收入明细 |
| | | 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, ""); |
| | | |
| | | |
| | | //添加消息 |
| | |
| | | query1.setState(2); |
| | | orderCancelService.updateById(query1); |
| | | } |
| | | |
| | | |
| | | |
| | | Double amount = query.getAmount(); |
| | | if(null != orderLogistics.getDriverId()){ |
| | | BigDecimal c =new BigDecimal(query.getAmount());//司机收入 |
| | | incomeService.saveData(2, orderLogistics.getDriverId(), 3, orderLogistics.getId(), 4, c.doubleValue()); |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | //添加已收入明细 |
| | | 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; |
| | | } |
| | |
| | | return ResultUtil.error(language == 1 ? "有未完成的订单" : language == 2 ? "Uncompleted order(s)" : "Commande(s) non complétée(s)"); |
| | | } |
| | | |
| | | orderPrivateCars = orderPrivateCarMapper.queryByState(uid, 2, 1, 1, 2, 3, 4, 5, 6, 11); |
| | | orderPrivateCars = orderPrivateCarMapper.queryByState(uid, 2, 1, 1, 2, 3, 4, 5, 6, 11); |
| | | if(orderPrivateCars.size() > 0 && reservation == 2){ |
| | | return ResultUtil.error(language == 1 ? "有未完成的订单" : language == 2 ? "Uncompleted order(s)" : "Commande(s) non complétée(s)"); |
| | | } |
| | | |
| | | orderPrivateCars = orderPrivateCarMapper.queryByState(uid, 1, 1, 7,12); |
| | | orderPrivateCars = orderPrivateCarMapper.queryByState(uid, 1, 1, 7, 12); |
| | | if(orderPrivateCars.size() > 0){ |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setState(7); |
| | |
| | | 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); |
| | | |
| | | |
| | | String vehicleId = null; |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | Car car = carMapper.selectById(driver.getCarId()); |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carMapper.updateById(car); |
| | | new Thread(() -> { |
| | | try { |
| | | String vehicleId = null; |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | Car car = carMapper.selectById(driver.getCarId()); |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carMapper.updateById(car); |
| | | } |
| | | //查询车辆信息,没有则创建信息 |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | } |
| | | //创建行程数据 |
| | | fleetEngineUtil.createTrip(vehicleId, 1, orderPrivateCar.getTripId(), |
| | | orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(), orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | //查询车辆信息,没有则创建信息 |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | } |
| | | |
| | | } |
| | | //创建行程数据 |
| | | fleetEngineUtil.createTrip(vehicleId, 1, orderPrivateCar.getTripId(), |
| | | orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(), orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString()); |
| | | }).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(); |
| | | } |
| | |
| | | dr.setState(3); |
| | | 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()){ |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | //普通单 |
| | | if(1 == orderPrivateCar.getOrderType()){ |
| | | JSONObject order = object.getJSONObject("order"); |
| | | long m = order.getInteger("orderAcceptanceTime") * 60000L; |
| | | //超过免费时间,计算费用 |
| | | if(orderPrivateCar.getSnatchOrderTime().getTime() + m < System.currentTimeMillis()){ |
| | | BigDecimal money = order.getBigDecimal("money"); |
| | | if(null != orderPrivateCar.getSetOutTime()){ |
| | | //里程费 |
| | | BigDecimal mileageFee = order.getBigDecimal("mileageFee").multiply(new BigDecimal(orderPrivateCar.getMileage() / 1000)); |
| | | //时长费 |
| | | int s = Double.valueOf((System.currentTimeMillis() - orderPrivateCar.getSetOutTime().getTime()) / 60000).intValue(); |
| | | BigDecimal durationFee = order.getBigDecimal("durationFee").multiply(new BigDecimal(s)); |
| | | money = money.add(durationFee).add(mileageFee); |
| | | } |
| | | amount = money.setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | if(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(2 == orderPrivateCar.getOrderType()){ |
| | | JSONObject order = object.getJSONObject("reservationOrder"); |
| | | long m = order.getInteger("orderAcceptanceTime") * 60000L; |
| | | //超过免费时间,计算费用 |
| | | if(System.currentTimeMillis() + m > orderPrivateCar.getTravelTime().getTime()){ |
| | | BigDecimal money = order.getBigDecimal("money"); |
| | | if(null != orderPrivateCar.getSetOutTime()){ |
| | | |
| | | //非服务中且未超时 |
| | | 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() && orderPrivateCar.getEstimateArriveTime().getTime() + t > System.currentTimeMillis()){ |
| | | BigDecimal money = order.getBigDecimal("money"); |
| | | //里程费 |
| | | 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() && orderPrivateCar.getTravelTime().getTime() + t > System.currentTimeMillis()){ |
| | | BigDecimal money = order.getBigDecimal("money"); |
| | | //里程费 |
| | | BigDecimal mileageFee = order.getBigDecimal("mileageFee").multiply(new BigDecimal(orderPrivateCar.getToStartPointMileage() / 1000)); |
| | | //时长费 |
| | | 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(); |
| | | } |
| | | 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); |
| | | } |
| | | |
| | | //修改行程信息 |
| | | fleetEngineUtil.updateTrip("CANCELED", null, null, orderPrivateCar.getTripId(), null, null, null, null); |
| | | 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); |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | } |
| | | |
| | | 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);//司机收入 |
| | | 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); |
| | | //添加已收入明细 |
| | | 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(); |
| | | 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; |
| | | 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 deductionRatio = redEnvelopePaymentSettings.getDeductionRatio(); |
| | | 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); |
| | |
| | | query1.setState(2); |
| | | orderCancelService.updateById(query1); |
| | | } |
| | | |
| | | |
| | | Double amount = query.getAmount(); |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | BigDecimal c =new BigDecimal(query.getAmount());//司机收入 |
| | | incomeService.saveData(2, orderPrivateCar.getDriverId(), 3, orderPrivateCar.getId(), 1, c.doubleValue()); |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | 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); |
| | | //添加已收入明细 |
| | | 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; |
| | | |
| | |
| | | public void setReceipt(String receipt) { |
| | | 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 id="queryRechargeRecord" resultType="java.util.Map"> |
| | | SELECT |
| | | id as id, |
| | | category as category, |
| | | userId as userId, |
| | | `type` as `type`, |
| | | orderId as orderId, |
| | | orderType as orderType, |
| | | payType as payType, |
| | | amount as amount, |
| | | code as code, |
| | | `state` as state, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as insertTime |
| | | id as id, |
| | | category as category, |
| | | userId as userId, |
| | | `type` as `type`, |
| | | orderId as orderId, |
| | | orderType as orderType, |
| | | payType as payType, |
| | | amount as amount, |
| | | code as code, |
| | | `state` as state, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as insertTime |
| | | FROM t_payment_record |
| | | WHERE category = 2 AND userId = #{uid} AND `type` = 1 |
| | | ORDER BY insertTime DESC |
| | |
| | | </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 |
| | |
| | | </parent> |
| | | <groupId>com.sinata</groupId> |
| | | <artifactId>zuul</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <version>1.0.0</version> |
| | | <name>zuul</name> |
| | | <description>Zuul project for Spring Boot</description> |
| | | |
| | | <packaging>war</packaging> |
| | | <packaging>jar</packaging> |
| | | |
| | | <properties> |
| | | <java.version>1.8</java.version> |
| | |
| | | @EnableZuulProxy//开启网关服务 |
| | | @EnableDiscoveryClient//开启eureka客户端的消费者 |
| | | @SpringBootApplication |
| | | public class ZuulApplication extends SpringBootServletInitializer { |
| | | public class ZuulApplication /*extends SpringBootServletInitializer*/ { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(ZuulApplication.class, args); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| | | return builder.sources(ZuulApplication.class); |
| | | } |
| | | // @Override |
| | | // protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| | | // return builder.sources(ZuulApplication.class); |
| | | // } |
| | | } |
| | |
| | | Thread thread = new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | NettyServer nettyServer = new NettyServer(); |
| | | nettyServer.bind(); |
| | | |
| | | NettyServer0 nettyServer0 = new NettyServer0(); |
| | | nettyServer0.bind(); |
| | | |
| | | TimeZone.setDefault(TimeZone.getTimeZone("GMT+0")); |
| | | // NettyServer nettyServer = new NettyServer(); |
| | | // nettyServer.bind(); |
| | | // |
| | | // NettyServer0 nettyServer0 = new NettyServer0(); |
| | | // nettyServer0.bind(); |
| | | // |
| | | // TimeZone.setDefault(TimeZone.getTimeZone("GMT+0")); |
| | | } |
| | | }); |
| | | thread.start(); |
| | |
| | | Integer type = jsonCon.getInteger("type"); |
| | | String token = jsonCon.getString("token"); |
| | | String userId1 = jsonCon.getString("userId"); |
| | | Integer language = jsonCon.getInteger("language"); |
| | | String device = jsonCon.getString("device"); |
| | | String version = jsonCon.getString("version"); |
| | | if(StringUtil.isNotEmpty(userId1)){ |
| | | |
| | | //判断用户或者司机长连接 |
| | | if(type==1){ |
| | | //确保账号在单个设备上登录 |
| | |
| | | msg_.put("msg", "SUCCESS"); |
| | | msg_.put("method", "OFFLINE"); |
| | | msg_.put("data", new Object()); |
| | | this.sendMsgToClient(ctx, msg_.toJSONString());//给当前通道发送消息 |
| | | sendMsgToClient(ctx, msg_.toJSONString());//给当前通道发送消息 |
| | | TimerTask timerTask = new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | |
| | | if(StringUtil.isEmpty(token_)){//确保登录的时候存储token失败的情况 |
| | | redisUtil.setStrValue("USER_" + userId1, token); |
| | | } |
| | | |
| | | //设置语言环境 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | headers.set("Authorization", "Bearer " + token); |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("language", language); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String w = internalRestTemplate.postForObject("http://user-server/api/user/editLanguage",requestEntity , String.class); |
| | | } |
| | | |
| | | |
| | | }else{ |
| | | //添加司机在线 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | |
| | | msg_.put("msg", "SUCCESS"); |
| | | msg_.put("method", "OFFLINE"); |
| | | msg_.put("data", new Object()); |
| | | this.sendMsgToClient(ctx, msg_.toJSONString());//给当前通道发送消息 |
| | | sendMsgToClient(ctx, msg_.toJSONString());//给当前通道发送消息 |
| | | TimerTask timerTask = new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | |
| | | if(StringUtil.isEmpty(token_)){//确保登录的时候存储token失败的情况 |
| | | redisUtil.setStrValue("DRIVER_" + userId1, token); |
| | | } |
| | | |
| | | //设置语言环境 |
| | | headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | headers.set("Authorization", "Bearer " + token); |
| | | params = new LinkedMultiValueMap<>(); |
| | | params.add("language", language); |
| | | requestEntity = new HttpEntity<>(params, headers); |
| | | w = internalRestTemplate.postForObject("http://driver-server/api/driver/editLanguage",requestEntity , String.class); |
| | | } |
| | | |
| | | |