| | |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | String format = String.format("uid=%s&id=%s&orderType=%s&payType=%s&type=%s", uid, id, orderType, payType, type); |
| | | String key = MD5Util.encrypt(format); |
| | | String value = redisUtil.getValue(key); |
| | | if(ToolUtil.isNotEmpty(value) && (System.currentTimeMillis() - Long.valueOf(value)) <= 1000){ |
| | | return ResultUtil.error(language == 1 ? "请勿重复操作" : language == 2 ? "Don't repeat the operation" : "Ne répétez pas l’opération"); |
| | | } |
| | | redisUtil.setStrValue(key, System.currentTimeMillis() + "", 5); |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.cancleOrderPrivateCar(id, payType, bankCardId, cancleId, type, language); |
| | |
| | | @ResponseBody |
| | | @PostMapping("/base/wxCancelOrderTaxi") |
| | | public CallbackResponse wxCancelOrderTaxi(@RequestBody CallbackRequest callbackRequest){ |
| | | log.info("取消订单支付回调结果:{}", JSON.toJSONString(callbackRequest)); |
| | | CallbackResponse callbackResponse = new CallbackResponse(); |
| | | try { |
| | | /** |
| | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | log.info("取消订单支付回调处理结束:{}", JSON.toJSONString(callbackResponse)); |
| | | return callbackResponse; |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping("/base/wxPayOrderTaxi") |
| | | public CallbackResponse wxPayOrderTaxi(@RequestBody CallbackRequest callbackRequest){ |
| | | log.info("订单完成支付回调结果:{}", JSON.toJSONString(callbackRequest)); |
| | | CallbackResponse callbackResponse = new CallbackResponse(); |
| | | try { |
| | | /** |
| | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | log.info("订单完成支付回调处理结束:{}", JSON.toJSONString(callbackResponse)); |
| | | return callbackResponse; |
| | | } |
| | | |
| | |
| | | userInfo.setLanguage(language); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | new Thread(() -> { |
| | | try { |
| | | //google创建车辆信息 |
| | | String vehicleId = null; |
| | | if(null != orderLogistics.getDriverId()){ |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | //创建行程数据 |
| | | boolean createTrip = fleetEngineUtil.createTrip(vehicleId, 1, orderLogistics.getTripId(), |
| | | String trip = fleetEngineUtil.getTrip(orderLogistics.getTripId()); |
| | | int count = this.selectCount(new EntityWrapper<OrderLogistics>().eq("tripId", orderLogistics.getTripId())); |
| | | int count1 = orderPrivateCarService.selectCount(new EntityWrapper<OrderPrivateCar>().eq("tripId", orderLogistics.getTripId())); |
| | | if(ToolUtil.isNotEmpty(trip) || (count + count1) > 0){ |
| | | String randomCode = UUIDUtil.getRandomCode(); |
| | | redisUtil.setStrValue("trip" + orderLogistics.getUserId(), randomCode); |
| | | OrderLogistics orderLogistics1 = new OrderLogistics(); |
| | | orderLogistics1.setId(orderLogistics.getId()); |
| | | orderLogistics1.setTripId(randomCode); |
| | | this.updateById(orderLogistics1); |
| | | orderLogistics.setTripId(randomCode); |
| | | } |
| | | JSONObject createTrip = fleetEngineUtil.createTrip(vehicleId, 1, orderLogistics.getTripId(), |
| | | orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(), orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | if(!createTrip){ |
| | | JSONObject error = createTrip.getJSONObject("error"); |
| | | if(null != error){ |
| | | for (int i = 0; i < 5; i++) { |
| | | createTrip = fleetEngineUtil.createTrip(vehicleId, 1, orderLogistics.getTripId(), |
| | | orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(), orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | if(createTrip){ |
| | | error = createTrip.getJSONObject("error"); |
| | | String tripStatus = createTrip.getString("tripStatus"); |
| | | if(null == error && "NEW".equals(tripStatus)){ |
| | | break; |
| | | } |
| | | Thread.sleep(5000L); |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | |
| | | if(orderSource == 2){//扫码下单 |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | userRedPacketRecord.setState(2); |
| | | multiply1 = multiply1.subtract(remainingAmount).setScale(2, RoundingMode.HALF_EVEN); |
| | | jsonObject.put("money", remainingAmount); |
| | | jsonObject.put("money", remainingAmount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | jsonArray.add(jsonObject); |
| | | }else if(remainingAmount.compareTo(multiply1) > 0){ |
| | | userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply1).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | jsonObject.put("money", multiply1); |
| | | jsonObject.put("money", multiply1.setScale(2, RoundingMode.HALF_EVEN)); |
| | | jsonArray.add(jsonObject); |
| | | multiply1 = BigDecimal.ZERO; |
| | | } |
| | |
| | | }else{ |
| | | resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Paiement échoué", ""); |
| | | } |
| | | return resultUtil; |
| | | } |
| | | |
| | | if(payType == 2) {//银行卡支付 |
| | |
| | | resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | |
| | | if(resultUtil.getCode()==200){ |
| | | this.updateById(orderLogistics); |
| | | paymentRecordService.saveData(1, null, null, orderId, 4, 2, |
| | | orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), null, 1);//添加预支付数据 |
| | | }else{ |
| | | resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Paiement échoué", ""); |
| | | } |
| | | return resultUtil; |
| | | } |
| | | |
| | | if(payType == 3){//余额支付 |
| | |
| | | } |
| | | } |
| | | |
| | | if(orderLogistics.getIsplatPay()==1){ |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderLogistics.getCompanyId()); |
| | | Double speMoney = company.getSpeMoney(); |
| | |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | Car car = carMapper.selectById(orderLogistics.getCarId()); |
| | | Double aDouble = 0D; |
| | | if(null != orderLogistics.getDriverId()){ |
| | |
| | | } |
| | | |
| | | |
| | | if(orderLogistics.getIsplatPay()==1){ |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderLogistics.getCompanyId()); |
| | | Double speMoney = company.getSpeMoney(); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | this.updateById(orderLogistics); |
| | | this.updateAllColumnById(orderLogistics); |
| | | return resultUtil; |
| | | } |
| | | |
| | |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | | if(orderLogistics.getIsplatPay()==1){ |
| | | |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderLogistics.getCompanyId()); |
| | | Double speMoney = company.getSpeMoney(); |
| | |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | Car car = carMapper.selectById(orderLogistics.getCarId()); |
| | | Double aDouble = 0D; |
| | | if(null != orderLogistics.getDriverId()){ |
| | |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | if((orderLogistics.getState() == 10 || orderLogistics.getState() == 12) && null != orderLogistics.getDriverId()){ |
| | | if(orderLogistics.getState() == 10 || orderLogistics.getState() == 12){ |
| | | //修改行程信息 |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", null, null, orderLogistics.getTripId(), null, null, null, null); |
| | | if(!updateTrip){ |
| | |
| | | if(updateTrip){ |
| | | break; |
| | | } |
| | | Thread.sleep(5000L); |
| | | Thread.sleep(3000L); |
| | | } |
| | | } |
| | | } |
| | | log.warn("取消订单:{} {}", System.currentTimeMillis(), orderLogistics.getTripId()); |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功取消包裹订单,谢谢使用!" : language == 2 ? "You've cancelled the delivery order successfully, thank you for using I-GO " |
| | | : "Vous avez annulé la commande de livraison avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1); |
| | |
| | | userInfo.setLanguage(language); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | new Thread(() -> { |
| | | try { |
| | | //google创建车辆信息 |
| | | String vehicleId = null; |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | Car car = carMapper.selectById(driver.getCarId()); |
| | |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carMapper.updateById(car); |
| | | } |
| | | String vehicleId = car.getVehicleId(); |
| | | vehicleId = car.getVehicleId(); |
| | | //查询车辆信息,没有则创建信息 |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | //创建行程数据 |
| | | boolean createTrip = fleetEngineUtil.createTrip(vehicleId, 1, orderPrivateCar.getTripId(), |
| | | String trip = fleetEngineUtil.getTrip(orderPrivateCar.getTripId()); |
| | | int count = orderLogisticsService.selectCount(new EntityWrapper<OrderLogistics>().eq("tripId", orderPrivateCar.getTripId())); |
| | | int count1 = this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("tripId", orderPrivateCar.getTripId())); |
| | | if(ToolUtil.isNotEmpty(trip) || (count + count1) > 0){ |
| | | String randomCode = UUIDUtil.getRandomCode(); |
| | | redisUtil.setStrValue("trip" + orderPrivateCar.getUserId(), randomCode); |
| | | OrderPrivateCar orderPrivateCar1 = new OrderPrivateCar(); |
| | | orderPrivateCar1.setId(orderPrivateCar.getCarId()); |
| | | orderPrivateCar1.setTripId(randomCode); |
| | | this.updateById(orderPrivateCar1); |
| | | orderPrivateCar.setTripId(randomCode); |
| | | } |
| | | JSONObject createTrip = fleetEngineUtil.createTrip(vehicleId, 1, orderPrivateCar.getTripId(), |
| | | orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(), orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString()); |
| | | if(!createTrip){ |
| | | JSONObject error = createTrip.getJSONObject("error"); |
| | | if(null != error){ |
| | | for (int i = 0; i < 5; i++) { |
| | | createTrip = fleetEngineUtil.createTrip(vehicleId, 1, orderPrivateCar.getTripId(), |
| | | orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(), orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString()); |
| | | if(createTrip){ |
| | | error = createTrip.getJSONObject("error"); |
| | | String tripStatus = createTrip.getString("tripStatus"); |
| | | if(null == error && "NEW".equals(tripStatus)){ |
| | | break; |
| | | } |
| | | Thread.sleep(5000L); |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | |
| | | |
| | | if(orderSource == 2){//扫码下单 |
| | |
| | | } |
| | | |
| | | //修改行程信息 |
| | | if((orderPrivateCar.getState() == 10 || orderPrivateCar.getState() == 12) && null != orderPrivateCar.getDriverId()){ |
| | | if(orderPrivateCar.getState() == 10 || orderPrivateCar.getState() == 12){ |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", null, null, orderPrivateCar.getTripId(), null, null, null, null); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | |
| | | if(updateTrip){ |
| | | break; |
| | | } |
| | | Thread.sleep(5000L); |
| | | Thread.sleep(3000L); |
| | | } |
| | | } |
| | | } |
| | | log.warn("取消订单:{} {}", System.currentTimeMillis(), orderPrivateCar.getTripId()); |
| | | //添加消息 |
| | | 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<>(); |
| | |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | |
| | | if(orderPrivateCar.getIsplatPay()==1){ |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderPrivateCar.getCompanyId()); |
| | | Double speMoney = company.getSpeMoney(); |
| | |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | new Thread(new Runnable() { |
| | |
| | | } |
| | | |
| | | |
| | | if(orderPrivateCar.getIsplatPay()==1){ |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderPrivateCar.getCompanyId()); |
| | | Double speMoney = company.getSpeMoney(); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | | if(orderPrivateCar.getIsplatPay()==1){ |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderPrivateCar.getCompanyId()); |
| | | Double taxi = company.getSpeMoney(); |
| | |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | |
| | | |
| | | |
| | | List<Company> queryList(@Param("city") String[] city, @Param("type") Integer type); |
| | | |
| | | |
| | | List<Company> queryList1(@Param("collect") List<Integer> collect, @Param("type") Integer type); |
| | | } |
| | |
| | | * 根据行政区域获取设置的电话 |
| | | * @return |
| | | */ |
| | | List<Phone> queryPhones(@Param("city") String[] city); |
| | | List<Phone> queryPhones(@Param("companyIds") List<Integer> companyIds); |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | Phone query(@Param("type") Integer type, @Param("platform") Integer platform, |
| | | @Param("city") String[] city); |
| | | @Param("companyId") Integer companyId); |
| | | } |
| | |
| | | and type = #{type} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryList1" resultType="Company"> |
| | | select |
| | | id as id, |
| | | isSpe as isSpe, |
| | | isTaxi as isTaxi, |
| | | isCross as isCross, |
| | | isCrossLogistics as isCrossLogistics, |
| | | isSameLogistics as isSameLogistics, |
| | | isCharter as isCharter, |
| | | isSpeFixedOrProportional as isSpeFixedOrProportional, |
| | | isTaxiFixedOrProportional as isTaxiFixedOrProportional, |
| | | isCrossLogisticsFixedOrProportional as isCrossLogisticsFixedOrProportional, |
| | | isSameLogisticsFixedOrProportional as isSameLogisticsFixedOrProportional, |
| | | speMoney as speMoney, |
| | | taxiMoney as taxiMoney, |
| | | crossLogisticsMoney as crossLogisticsMoney, |
| | | sameLogisticsMoney as sameLogisticsMoney, |
| | | isNeedFerry as isNeedFerry, |
| | | name as name, |
| | | type as type, |
| | | superiorId as superiorId, |
| | | principalName as principalName, |
| | | principalPhone as principalPhone, |
| | | adminName as adminName, |
| | | adminPhone as adminPhone, |
| | | urgentPhoen as urgentPhoen, |
| | | setupTime as setupTime, |
| | | identifier as identifier, |
| | | addressCode as addressCode, |
| | | businessScope as businessScope, |
| | | contactAddress as contactAddress, |
| | | documentAddress as documentAddress, |
| | | economicType as economicType, |
| | | regCapital as regCapital, |
| | | legalName as legalName, |
| | | legalId as legalId, |
| | | legalPhone as legalPhone, |
| | | legalPhotoUrl as legalPhotoUrl, |
| | | licensingAgency as licensingAgency, |
| | | licenseTime as licenseTime, |
| | | licenseStartTime as licenseStartTime, |
| | | licenseEndTime as licenseEndTime, |
| | | licenseNumber as licenseNumber, |
| | | carNum as carNum, |
| | | driverNum as driverNum, |
| | | mac as mac, |
| | | state as state, |
| | | flag as flag, |
| | | upload as upload, |
| | | insertTime as insertTime |
| | | from t_company where flag != 3 and state = 0 and id in ( |
| | | select companyId from t_company_city where state = 1 |
| | | <if test="null != city"> |
| | | and cityId in |
| | | <foreach collection="collect" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | <if test="null != type"> |
| | | and type = #{type} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | platform as platform, |
| | | phone as phone, |
| | | companyId as companyId |
| | | from t_phone where companyId in ( |
| | | select companyId from t_company_city where state = 1 |
| | | <if test="null != city"> |
| | | and cityId in (select id from t_city where englishName in |
| | | <foreach collection="city" item="item" index="index" separator="," open="(" close=")"> |
| | | from t_phone where companyId in |
| | | <foreach collection="companyIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | ) |
| | | </select> |
| | | |
| | |
| | | and platform = #{platform} |
| | | </if> |
| | | <if test="platform != 1"> |
| | | and companyId in ( |
| | | select companyId from t_company_city where state = 1 |
| | | <if test="null != city"> |
| | | and cityId in (select id from t_city where englishName in |
| | | <foreach collection="city" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | ) |
| | | and companyId = #{companyId} |
| | | </if> |
| | | </select> |
| | | |
| | |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.model.CompanyCity; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ICompanyCityService extends IService<CompanyCity> { |
| | | |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | Company query(String[] city) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 根据城市名称获取匹配的企业 |
| | | * @param city |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Company query1(String[] city) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 根据城市名称获取匹配的企业 |
| | | * @param city |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Company> query2(String[] city) throws Exception; |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | |
| | | @Override |
| | | public Company query(String[] city) throws Exception { |
| | | List<City> cities = cityService.selectList(new EntityWrapper<City>().in("chineseName", Arrays.asList(city)).or() |
| | | .in("englishName", Arrays.asList(city)).or().in("frenchName", Arrays.asList(city))); |
| | | List<Integer> collect = cities.stream().map(City::getId).collect(Collectors.toList()); |
| | | List<City> cities1 = cityService.selectList(null); |
| | | List<Integer> collect = new ArrayList<>(); |
| | | for (City city1 : cities1) { |
| | | String chineseName = city1.getChineseName(); |
| | | String englishName = city1.getEnglishName(); |
| | | String frenchName = city1.getFrenchName(); |
| | | for (String s : city) { |
| | | if(s.indexOf(chineseName) != -1 || s.indexOf(englishName) != -1 || s.indexOf(frenchName) != -1){ |
| | | collect.add(city1.getId()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if(collect.size() == 0){ |
| | | return null; |
| | | } |
| | | return companyMapper.query(collect); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Company query1(String[] city) throws Exception { |
| | | List<City> cities1 = cityService.selectList(null); |
| | | List<Integer> collect = new ArrayList<>(); |
| | | for (City city1 : cities1) { |
| | | String chineseName = city1.getChineseName(); |
| | | String englishName = city1.getEnglishName(); |
| | | String frenchName = city1.getFrenchName(); |
| | | for (String s : city) { |
| | | if(s.indexOf(chineseName) != -1 || s.indexOf(englishName) != -1 || s.indexOf(frenchName) != -1){ |
| | | collect.add(city1.getId()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | List<Company> query = companyMapper.queryList1(collect, 3); |
| | | if(query.size() == 0){ |
| | | query = companyMapper.queryList1(collect, 2); |
| | | } |
| | | if(query.size() == 0){ |
| | | query = companyMapper.queryList1(collect, 1); |
| | | } |
| | | if(query.size() > 0){ |
| | | return query.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<Company> query2(String[] city) throws Exception { |
| | | List<City> cities1 = cityService.selectList(null); |
| | | List<Integer> collect = new ArrayList<>(); |
| | | for (City city1 : cities1) { |
| | | String chineseName = city1.getChineseName(); |
| | | String englishName = city1.getEnglishName(); |
| | | String frenchName = city1.getFrenchName(); |
| | | for (String s : city) { |
| | | if(s.indexOf(chineseName) != -1 || s.indexOf(englishName) != -1 || s.indexOf(frenchName) != -1){ |
| | | collect.add(city1.getId()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | List<Company> query = companyMapper.queryList1(collect, 3); |
| | | if(query.size() == 0){ |
| | | query = companyMapper.queryList1(collect, 2); |
| | | } |
| | | if(query.size() == 0){ |
| | | query = companyMapper.queryList1(collect, 1); |
| | | } |
| | | return query; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.PhoneMapper; |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.model.Phone; |
| | | import com.stylefeng.guns.modular.system.service.ICompanyCityService; |
| | | import com.stylefeng.guns.modular.system.service.IPhoneService; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.AddressComponentsVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | @Service |
| | |
| | | |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Resource |
| | | private ICompanyCityService companyCityService; |
| | | |
| | | |
| | | |
| | |
| | | for (int i = 0; i < addressComponentsVos.length; i++) { |
| | | city[i] = addressComponentsVos[i].getLongName(); |
| | | } |
| | | List<Phone> list = phoneMapper.queryPhones(city); |
| | | List<Company> companies = companyCityService.query2(city); |
| | | List<Integer> collect = companies.stream().map(Company::getId).collect(Collectors.toList()); |
| | | List<Phone> list = phoneMapper.queryPhones(collect); |
| | | return list; |
| | | } |
| | | |
| | |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | //平台电话 |
| | | Phone query = phoneMapper.query(2, 1, city); |
| | | Phone query = phoneMapper.query(2, 1, null); |
| | | map.put("platform", null != query ? query.getPhone() : ""); |
| | | |
| | | Company company = companyCityService.query1(city); |
| | | //公司 |
| | | query = phoneMapper.query(2, 2, city); |
| | | query = phoneMapper.query(2, 2, company.getId()); |
| | | map.put("company", null != query ? query.getPhone() : ""); |
| | | return map; |
| | | } |
| | |
| | | * @param end_lng 终点经度 |
| | | * @return |
| | | */ |
| | | public boolean createTrip(String vehicleId, Integer numberOfPassengers, String tripId, String start_lat, String start_lng, String end_lat, String end_lng) { |
| | | public JSONObject createTrip(String vehicleId, Integer numberOfPassengers, String tripId, String start_lat, String start_lng, String end_lat, String end_lng) { |
| | | String url = "https://fleetengine.googleapis.com/v1/providers/" + provider + "/trips?tripId=" + tripId; |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | Map<String, String> headers = new HashMap<>(); |
| | |
| | | end_point.put("longitude", end_lng); |
| | | dropoffPoint.put("point", end_point); |
| | | body.put("dropoffPoint", dropoffPoint); |
| | | logger.info("创建行程请求:{}", body.toJSONString()); |
| | | logger.info("创建行程请求:{} {}", tripId, body.toJSONString()); |
| | | HttpRequest request = post.body(body.toJSONString()); |
| | | HttpResponse response = request.execute(); |
| | | logger.info("创建行程结果:{}", response.body()); |
| | |
| | | } |
| | | } |
| | | logger.error("创建行程异常: tripId={} body={}", tripId, response.body()); |
| | | return false; |
| | | } |
| | | /** |
| | | * 返回结果 |
| | |
| | | * "currentRouteSegmentTrafficVersion": "2024-05-27T02:05:37.941167Z" |
| | | * } |
| | | */ |
| | | return true; |
| | | return jsonObject; |
| | | } |
| | | |
| | | |
| | |
| | | dropoffPoint.put("point", end_point); |
| | | body.put("dropoffPoint", dropoffPoint); |
| | | } |
| | | logger.info("修改行程请求:{}", body.toJSONString()); |
| | | logger.info("修改行程请求:{} {}", tripId, body.toJSONString()); |
| | | HttpRequest request = put.body(body.toJSONString()); |
| | | HttpResponse response = request.execute(); |
| | | logger.info("修改行程结果:{}", response.body()); |
| | |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CheckoutRequest; |
| | | import io.cellulant.model.Payload; |
| | | import io.cellulant.service.CheckoutEncryption; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.BufferedReader; |
| | |
| | | /** |
| | | * Tingg支付工具类 |
| | | */ |
| | | @Slf4j |
| | | public class TinggPayUtil { |
| | | |
| | | private static String accessKey = "8rc1gTV9n91Tc1Sy9oVWry99fgrgrVV8concf9onWooWSg9TVW8nSgo98g88"; |
| | |
| | | CheckoutEncryption checkoutEncrption = new CheckoutEncryption(ivKey, secretKey); |
| | | Payload payload = getPayload(checkoutRequest); |
| | | String param = checkoutEncrption.encrypt(payload); |
| | | System.out.println("Encrpted payload=" + param); |
| | | log.error("调起支付:" + checkoutRequest.getMerchantTransactionId() + "\nEncrpted payload=" + param); |
| | | String url = "https://checkout.tingg.africa/express/checkout?encrypted_payload=" + param + "&access_key=" + accessKey; |
| | | return ResultUtil.success(url); |
| | | }catch (Exception e){ |