| | |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.ReverseGeocodeVo; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.TinggPayUtil; |
| | |
| | | |
| | | @Autowired |
| | | private IRedEnvelopePaymentSettingsService redEnvelopePaymentSettingsService; |
| | | |
| | | @Autowired |
| | | private FleetEngineUtil fleetEngineUtil; |
| | | |
| | | @Resource |
| | | private CarModelMapper carModelMapper; |
| | | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | |
| | | |
| | |
| | | orderPrivateCar.setIsReassign(1); |
| | | orderPrivateCar.setIsDelete(1); |
| | | this.insert(orderPrivateCar); |
| | | |
| | | |
| | | Integer vehicleId = null; |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | vehicleId = driver.getCarId(); |
| | | //查询车辆信息,没有则创建信息 |
| | | String vehicles = fleetEngineUtil.getVehicles(vehicleId); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | Car car = carService.selectById(vehicleId); |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), driver.getCarId()); |
| | | fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), driver.getCarId()); |
| | | } |
| | | |
| | | } |
| | | //创建行程数据 |
| | | fleetEngineUtil.createTrip(vehicleId, 1, 1, orderPrivateCar.getId(), |
| | | orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(), orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString()); |
| | | |
| | | |
| | | if(orderSource == 2){//扫码下单 |
| | | new Thread(new Runnable() { |
| | |
| | | if(orderPrivateCar.getState() == 1){ |
| | | this.pushOrder(orderPrivateCar); |
| | | }else{ |
| | | //接单后定时任务判断司机是否去接乘客,没有则推送提醒 |
| | | CancleOrder cancleOrder = cancleOrderService.query(orderPrivateCar.getCompanyId()); |
| | | if(null != cancleOrder){ |
| | | JSONObject object = JSON.parseObject(cancleOrder.getContent()); |
| | | long time = object.getInteger("driverTimeout") * 60000L; |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | OrderPrivateCar orderPrivateCar1 = OrderPrivateCarServiceImpl.this.selectById(orderPrivateCar.getId()); |
| | | if(orderPrivateCar1.getState() == 2){ |
| | | pushUtil.pushDriverTimeOut(1, orderPrivateCar1.getUserId(), orderPrivateCar1.getId(), 1); |
| | | } |
| | | } |
| | | }, time); |
| | | } |
| | | // //接单后定时任务判断司机是否去接乘客,没有则推送提醒 |
| | | // CancleOrder cancleOrder = cancleOrderService.query(orderPrivateCar.getCompanyId()); |
| | | // if(null != cancleOrder){ |
| | | // JSONObject object = JSON.parseObject(cancleOrder.getContent()); |
| | | // long time = object.getInteger("driverTimeout") * 60000L; |
| | | // new Timer().schedule(new TimerTask() { |
| | | // @Override |
| | | // public void run() { |
| | | // OrderPrivateCar orderPrivateCar1 = OrderPrivateCarServiceImpl.this.selectById(orderPrivateCar.getId()); |
| | | // if(orderPrivateCar1.getState() == 2){ |
| | | // pushUtil.pushDriverTimeOut(1, orderPrivateCar1.getUserId(), orderPrivateCar1.getId(), 1); |
| | | // } |
| | | // } |
| | | // }, time); |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | driver.setState(2); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | //修改行程信息 |
| | | fleetEngineUtil.updateTrip("CANCELED", null, null, 1, orderPrivateCar.getId(), 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); |
| | |
| | | //计算优惠券 |
| | | UserCouponRecord userCouponRecord = null; |
| | | if(null != couponId){ |
| | | //TODO 待翻译 |
| | | if(null != redDeduction && 1 == redDeduction){ |
| | | return ResultUtil.error(language == 1 ? "优惠券和红包不能同时使用" : language == 2 ? "" : "", ""); |
| | | return ResultUtil.error(language == 1 ? "优惠券和红包不能同时使用" : language == 2 ? "Coupons and lucky-promo cannot be used at the same time." : "Les coupons et les bonus ne peuvent pas être utilisés en même temps", ""); |
| | | } |
| | | userCouponRecord = userCouponRecordService.selectById(couponId); |
| | | if(!userCouponRecord.getCompanyId().equals(orderPrivateCar.getCompanyId())){ |
| | |
| | | Double maxPrice = jsonObject.getDouble("maxPrice"); |
| | | Integer type1 = jsonObject.getInteger("type"); |
| | | if(1 == type1){ |
| | | List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driver.getId()).isNull("settlementRecordId").last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(createTime, '%Y-%m-%d')")); |
| | | List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driver.getId()) |
| | | .isNull("settlementRecordId").last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(createTime, '%Y-%m-%d')")); |
| | | BigDecimal total = new BigDecimal(0); |
| | | for (SettlementDetail detail : settlementDetailList) { |
| | | total = total.add(new BigDecimal(detail.getPrice())); |
| | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) + Integer.valueOf(String.valueOf(query.get("effective")))); |
| | | userRedPacketRecord.setExpirationTime(calendar.getTime()); |
| | | userRedPacketRecord.setInsertTime(new Date()); |
| | | userRedPacketRecord.setCompanyId(Integer.valueOf(String.valueOf(query.get("companyId")))); |
| | | userRedPacketRecord.setState(0); |
| | |
| | | query.setRedPacketActivityId(id.getId()); |
| | | userRedPacketRecordService.updateById(query); |
| | | |
| | | // todo 待翻译 |
| | | String content = 1 == language ? ("您收到一个额度为GHS " + money + " 的红包,请查收") : 2 == language ? "" : ""; |
| | | String content = 1 == language ? ("您收到一个额度为GHS " + money + " 的红包,请查收") : 2 == language ? "You have received a lucky promo of GHS " + money + ", please check" : "Vous avez reçu un bonus de GHS " + money + ", veuillez vérifier"; |
| | | systemNoticeService.addSystemNotice(1, content, query.getUserId(), 1); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(orderPrivateCar.getUserId()); |
| | |
| | | Element user_chinese = document.getElementById("user_chinese"); |
| | | user_chinese.text("您好 " + userInfo.getNickName() + ","); |
| | | Element time_chinese = document.getElementById("time_chinese"); |
| | | time_chinese.text("此活动有效期在 " + DateUtil.conversionFormat(language, sdf.format(query.getInsertTime())) + " 至 " + DateUtil.conversionFormat(language, sdf.format(query.getExpirationTime())) + ",详情请查看I-GO平台"); |
| | | time_chinese.text("此活动有效期在 " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " 至 " + DateUtil.conversionFormat(language, sdf.format(id.getEndTime())) + ",详情请查看I-GO平台"); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").remove(); |
| | |
| | | Element user_english = document.getElementById("user_english"); |
| | | user_english.text("Hello " + userInfo.getNickName() + ","); |
| | | Element time_english = document.getElementById("time_english"); |
| | | time_english.text("You could use it from " + DateUtil.conversionFormat(language, sdf.format(query.getInsertTime())) + " to " + DateUtil.conversionFormat(language, sdf.format(query.getExpirationTime())) + ",check more details on the app."); |
| | | time_english.text("You could use it from " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " to " + DateUtil.conversionFormat(language, sdf.format(id.getEndTime())) + ",check more details on the app."); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").remove(); |
| | |
| | | Element user_french = document.getElementById("user_french"); |
| | | user_french.text("Bonjour " + userInfo.getNickName() + ","); |
| | | Element time_french = document.getElementById("time_french"); |
| | | time_french.text("Cette promotion est valable du " + DateUtil.conversionFormat(language, sdf.format(query.getInsertTime())) + " au " + DateUtil.conversionFormat(language, sdf.format(query.getExpirationTime())) + ". Veuillez consulter la plateforme i-go pour plus de détails."); |
| | | time_french.text("Cette promotion est valable du " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " au " + DateUtil.conversionFormat(language, sdf.format(id.getEndTime())) + ". Veuillez consulter la plateforme i-go pour plus de détails."); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "红包活动" : language == 2 ? "Lucky-promo activities" : "Activités bonus", document.html()); |