| | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | @Resource |
| | | private IDriverWorkService driverWorkService; |
| | | |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | |
| | | String[] split = endLonLat.split(","); |
| | | Double lng = Double.valueOf(split[0]); |
| | | Double lat = Double.valueOf(split[1]); |
| | | ResultUtil<Map<String, Object>> price = this.getPrice1(type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString(), language); |
| | | ResultUtil<Map<String, Object>> price = this.getPrice1(uid, type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString(), language); |
| | | if(price.getCode() != 200){ |
| | | return price; |
| | | } |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endLonLat, String endAddress, Integer language) throws Exception{ |
| | | public ResultUtil queryPayMoney(Integer uid, Integer number, Integer type, String startLonLat, String endLonLat, String endAddress, Integer language) throws Exception{ |
| | | String[] split = endLonLat.split(","); |
| | | Double lng = Double.valueOf(split[0]); |
| | | Double lat = Double.valueOf(split[1]); |
| | | ResultUtil<Map<String, Object>> price = this.getPrice1(type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString(), language); |
| | | ResultUtil<Map<String, Object>> price = this.getPrice1(uid, type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString(), language); |
| | | if(price.getCode() == 200 && type == 5){ |
| | | Map<String, Object> data = price.getData(); |
| | | Double ordinary = Double.valueOf(data.get("ordinary").toString()); |
| | |
| | | endAddress = endAddress.replaceAll("& #40;", "("); |
| | | endAddress = endAddress.replaceAll("& #41;", ")"); |
| | | OrderLogistics orderLogistics = new OrderLogistics(); |
| | | Company query = companyCityService.query1(placementLon, placementLat); |
| | | Company query = companyCityService.query1(uid, placementLon, placementLat); |
| | | if(null == query){ |
| | | return ResultUtil.error(language == 1 ? "该地点暂无企业服务" : language == 2 ? "No service yet at this area" : "Pas encore de service dans cette zone"); |
| | | } |
| | |
| | | orderLogistics.setRemark(remark); |
| | | orderLogistics.setPlacementLon(Double.valueOf(placementLon)); |
| | | orderLogistics.setPlacementLat(Double.valueOf(placementLat)); |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(Double.valueOf(placementLat), Double.valueOf(placementLon)); |
| | | String tripId = redisUtil.getValue("trip" + uid); |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(Double.valueOf(placementLat), Double.valueOf(placementLon), tripId); |
| | | if(null == reverseGeocode){ |
| | | return ResultUtil.error(language == 1 ? "解析地址出错" : language == 2 ? "Address resolution error" : "Erreur de résolution d’adresse"); |
| | | } |
| | |
| | | orderLogistics.setMileage(0D); |
| | | orderLogistics.setIsReassign(1); |
| | | orderLogistics.setReassignNotice(0); |
| | | ResultUtil<Map<String, Object>> price = this.getPrice1(type, String.valueOf(startLon), String.valueOf(startLat), lng.toString(), lat.toString(), language); |
| | | ResultUtil<Map<String, Object>> price = this.getPrice1(uid, type, String.valueOf(startLon), String.valueOf(startLat), lng.toString(), lat.toString(), language); |
| | | if(price.getCode() != 200){ |
| | | return price; |
| | | } |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil<Map<String, Double>> getPrice(Integer type, String startLon, String startLat, String endLon, String endLat) throws Exception{ |
| | | Company query = companyCityService.query1(startLon, startLat); |
| | | public ResultUtil<Map<String, Double>> getPrice(Integer uid, Integer type, String startLon, String startLat, String endLon, String endLat) throws Exception{ |
| | | Company query = companyCityService.query1(uid, startLon, startLat); |
| | | if(null == query){ |
| | | return ResultUtil.error("预约取货点暂无企业服务"); |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | public ResultUtil<Map<String, Object>> getPrice1(Integer type, String startLon, String startLat, String endLon, String endLat, Integer language) throws Exception{ |
| | | Company query = companyCityService.query1(startLon, startLat); |
| | | public ResultUtil<Map<String, Object>> getPrice1(Integer uid, Integer type, String startLon, String startLat, String endLon, String endLat, Integer language) throws Exception{ |
| | | Company query = companyCityService.query1(uid, startLon, startLat); |
| | | if(null == query){ |
| | | return ResultUtil.error(language == 1 ? "预约取货点暂无企业服务" : language == 2 ? |
| | | "No service yet at the reserved pickup point." : "Les points de ramassage prévus ne sont pas disponibles pour le moment."); |
| | |
| | | Integer activityId = null; |
| | | if(type == 4){//同城 |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(startLat), Double.valueOf(startLon), Double.valueOf(endLat), Double.valueOf(endLon)); |
| | | String tripId = redisUtil.getValue("trip" + uid); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(startLat), Double.valueOf(startLon), Double.valueOf(endLat), Double.valueOf(endLon), tripId); |
| | | if(null == distancematrix){ |
| | | return ResultUtil.error(language == 1 ? "计算距离出错" : language == 2 ? "Errors in computing distance" : "Erreurs dans le calcul de la distance"); |
| | | } |
| | |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | | } |
| | | Company query = companyCityService.query1(String.valueOf(orderLogistics.getStartLon()), String.valueOf(orderLogistics.getStartLat()));//获取起点所属分公司 |
| | | Company query = companyCityService.query1(orderLogistics.getUserId(), String.valueOf(orderLogistics.getStartLon()), String.valueOf(orderLogistics.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//用专车的推单配置 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0); |
| | | //获取空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(orderLogistics.getType(), orderLogistics.getServerCarModelId(), orderLogistics.getStartLon(), orderLogistics.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(orderLogistics.getUserId(), orderLogistics.getType(), orderLogistics.getServerCarModelId(), orderLogistics.getStartLon(), orderLogistics.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | System.err.println("【" + orderLogistics.getId() + "】空闲司机:" + JSON.toJSONString(list)); |
| | | if(list.size() > 0){ |
| | | double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 |
| | |
| | | } |
| | | } |
| | | if(bo){ |
| | | continue; |
| | | } |
| | | |
| | | Driver driver1 = driverService.selectById(driver.getId()); |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()) |
| | | .eq("state", 1).like("type", "4")); |
| | | if(null == driverWork || driver1.getState() != 2){ |
| | | continue; |
| | | } |
| | | String text = ""; |
| | |
| | | public void run() { |
| | | Process process = null; |
| | | try { |
| | | process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName); |
| | | process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | orderLogistics.setUrgent(1); |
| | | orderLogistics.setCargoNumber(1); |
| | | |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(Double.valueOf(placementLat), Double.valueOf(placementLon)); |
| | | String tripId = redisUtil.getValue("trip" + uid); |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(Double.valueOf(placementLat), Double.valueOf(placementLon), tripId); |
| | | orderLogistics.setPlacementAddress(reverseGeocode.getAddress()); |
| | | orderLogistics.setStartLon(Double.valueOf(startLon)); |
| | | orderLogistics.setStartLat(Double.valueOf(startLat)); |
| | |
| | | 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])); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]), tripId); |
| | | //超时时间 |
| | | long timeOut = System.currentTimeMillis() + (distancematrix.getDuration() * 1000); |
| | | orderLogistics.setEstimateArriveTime(new Date(timeOut)); |
| | |
| | | |
| | | orderLogistics.setIsReassign(1); |
| | | orderLogistics.setIsDelete(1); |
| | | orderLogistics.setTripId(UUIDUtil.getRandomCode()); |
| | | DistancematrixVo distancematrix1 = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), orderLogistics.getEndLat(), orderLogistics.getEndLon()); |
| | | orderLogistics.setTripId(tripId); |
| | | DistancematrixVo distancematrix1 = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), orderLogistics.getEndLat(), orderLogistics.getEndLon(), tripId); |
| | | Long distance1 = distancematrix1.getDistance(); |
| | | orderLogistics.setEstimatedMileage(new BigDecimal(distance1).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | this.insert(orderLogistics); |
| | |
| | | public void run() { |
| | | Process process = null; |
| | | try { |
| | | process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName); |
| | | process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | |
| | | // TODO: 2021/5/11 修改,根据后台设定的派单范围查询范围内有无司机,将单子指派给距离最近的司机(距离相同随机取),范围内没有司机再进行推单流程 |
| | | if(orderLogistics.getState() == 1){ |
| | | Company query = companyCityService.query1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString()); |
| | | Company query = companyCityService.query1(uid, orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString()); |
| | | if(null == query){ |
| | | return ResultUtil.error(language == 1 ? "起点暂未企业提供服务" : language == 2 ? "Starting point no enterprise to provide services" : "Point de départ pas encore disponible pour les entreprises"); |
| | | } |
| | | AssignOrder assignOrder = assignOrderService.selectOne(new EntityWrapper<AssignOrder>().eq("companyId", query.getId()).eq("type", 1)); |
| | | if(null != assignOrder && assignOrder.getPeople() > 0){//配置了指派规则才处理 |
| | | //获取空闲司机 |
| | | List<Driver> drivers = driverService.queryIdleDriver(4, orderLogistics.getServerCarModelId(), orderLogistics.getStartLon(), orderLogistics.getStartLat(), assignOrder.getDistance(), null);//获取范围内空闲司机 |
| | | List<Driver> drivers = driverService.queryIdleDriver(uid, 4, orderLogistics.getServerCarModelId(), orderLogistics.getStartLon(), orderLogistics.getStartLat(), assignOrder.getDistance(), null);//获取范围内空闲司机 |
| | | if(drivers.size() > 0){//有司机,直接指派给司机 |
| | | Driver dr = null; |
| | | if(drivers.size() > 1){ |
| | |
| | | String value = redisUtil.getValue("DRIVER" + drivers.get(j).getId()); |
| | | if(null != value){ |
| | | String[] split = value.split(","); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0])); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]), tripId); |
| | | Long distance = distancematrix.getDistance(); |
| | | if((0 == m && null == driver) || (distance < m)){ |
| | | driver = drivers.get(j); |
| | |
| | | String value = redisUtil.getValue("DRIVER" + driver.getId()); |
| | | if(null != value){ |
| | | String[] split = value.split(","); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0])); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]), tripId); |
| | | Long d = distancematrix.getDistance(); |
| | | if((0 == m && null == dr) || (d.intValue() < m.intValue())){ |
| | | dr = driver; |
| | |
| | | dr = drivers.get(0); |
| | | } |
| | | |
| | | orderLogistics.setDriverId(dr.getId()); |
| | | orderLogistics.setCompanyId(dr.getFranchiseeId() != null && dr.getFranchiseeId() != 0 ? dr.getFranchiseeId() : ( |
| | | dr.getCompanyId() != null && dr.getCompanyId() != 0 ? dr.getCompanyId() : 1)); |
| | | orderLogistics.setState(2); |
| | | orderLogistics.setCarId(dr.getCarId()); |
| | | CarService query1 = carServiceMapper.query(1, dr.getCarId()); |
| | | orderLogistics.setServerCarModelId(query1.getServerCarModelId()); |
| | | orderLogistics.setSnatchOrderTime(new Date()); |
| | | |
| | | dr.setState(3); |
| | | driverService.updateById(dr); |
| | | this.updateById(orderLogistics); |
| | | Driver driver1 = driverService.selectById(dr.getId()); |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()) |
| | | .eq("state", 1).like("type", "4")); |
| | | if(driver1.getState() == 2 || null != driverWork){ |
| | | orderLogistics.setDriverId(dr.getId()); |
| | | orderLogistics.setCompanyId(dr.getFranchiseeId() != null && dr.getFranchiseeId() != 0 ? dr.getFranchiseeId() : ( |
| | | dr.getCompanyId() != null && dr.getCompanyId() != 0 ? dr.getCompanyId() : 1)); |
| | | orderLogistics.setState(2); |
| | | orderLogistics.setCarId(dr.getCarId()); |
| | | CarService query1 = carServiceMapper.query(1, dr.getCarId()); |
| | | orderLogistics.setServerCarModelId(query1.getServerCarModelId()); |
| | | orderLogistics.setSnatchOrderTime(new Date()); |
| | | |
| | | 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; |
| | | 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 = ""; |
| | | String fileName = "pushOrder" + orderLogistics.getDriverId() + UUIDUtil.getRandomCode(5) + ".mp3"; |
| | | try { |
| | | audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, fileName); |
| | | } 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/" + fileName); |
| | | } 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, finalAudioUrl); |
| | | String audioUrl = ""; |
| | | String fileName = "pushOrder" + orderLogistics.getDriverId() + UUIDUtil.getRandomCode(5) + ".mp3"; |
| | | try { |
| | | audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, fileName); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }).start(); |
| | | //定时任务删除语音文件 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Process process = null; |
| | | try { |
| | | process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); |
| | | } 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, finalAudioUrl); |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | //推单操作 |
| | | if(orderLogistics.getState() == 1){ |
| | | this.pushOrder(orderLogistics); |
| | | }else{ |
| | | // //接单后定时任务判断司机是否去接乘客,没有则推送提醒 |
| | | // CancleOrder cancleOrder = cancleOrderService.query(orderLogistics.getCompanyId()); |
| | | // if(null != cancleOrder){ |
| | | // JSONObject object = JSON.parseObject(cancleOrder.getContent()); |
| | | // long time = object.getInteger("driverTimeout") * 60000L; |
| | | // new Timer().schedule(new TimerTask() { |
| | | // @Override |
| | | // public void run() { |
| | | // OrderLogistics orderLogistics1 = OrderLogisticsServiceImpl.this.selectById(orderLogistics.getId()); |
| | | // if(orderLogistics1.getState() == 2){ |
| | | // pushUtil.pushDriverTimeOut(1, orderLogistics1.getUserId(), orderLogistics1.getId(), 4); |
| | | // } |
| | | // } |
| | | // }, time); |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | return ResultUtil.error(language == 1 ? "订单已完成支付,不允许重复支付" : language == 2 ? "The order has been paid, recurring payments is not allowed." : "La commande a été payée, les paiements récurrents ne sont pas autorisés.", ""); |
| | | } |
| | | Integer uid = orderLogistics.getUserId(); |
| | | Double orderMoney = orderLogistics.getOrderMoney(); |
| | | BigDecimal orderMoney = new BigDecimal(orderLogistics.getOrderMoney()); |
| | | if(orderLogistics.getUrgent() == 2){ |
| | | // orderMoney += null != orderLogistics.getTipMoney() ? orderLogistics.getTipMoney() : 0; |
| | | } |
| | |
| | | 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(); |
| | | BigDecimal v = orderMoney.multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | if(orderMoney.compareTo(v) > 0){ |
| | | orderLogistics.setDiscountMoney(orderMoney - v); |
| | | orderLogistics.setDiscountMoney(orderMoney.subtract(v).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | orderLogistics.setActivityId(query2.getId()); |
| | | orderMoney = v; |
| | | } |
| | |
| | | if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 4){ |
| | | return ResultUtil.error(language == 1 ? "优惠券不能用于此订单" : language == 2 ? "Coupon cannot be used for this order." : "Le coupon ne peut pas être utilisé pour cette commande.", ""); |
| | | } |
| | | if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(userCouponRecord.getFullMoney()) < 0){ |
| | | if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(new BigDecimal(userCouponRecord.getFullMoney())) < 0){ |
| | | return ResultUtil.error(language == 1 ? "优惠券不能用于此订单" : language == 2 ? "Coupon cannot be used for this order." : "Le coupon ne peut pas être utilisé pour cette commande.", ""); |
| | | } |
| | | orderMoney = orderMoney - userCouponRecord.getMoney(); |
| | | orderMoney = orderMoney.subtract(new BigDecimal(userCouponRecord.getMoney())).setScale(2, RoundingMode.HALF_EVEN); |
| | | orderLogistics.setCouponMoney(userCouponRecord.getMoney()); |
| | | orderLogistics.setCouponId(couponId); |
| | | } |
| | | |
| | | //计算红包 |
| | | if(null != redDeduction && 1 == redDeduction){ |
| | | if(null != redDeduction && 1 == redDeduction && null == orderLogistics.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", orderLogistics.getCompanyId()).gt("remainingAmount", 0).orderBy("insertTime", false)); |
| | | |
| | | |
| | | 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){ |
| | | BigDecimal multiply1 = orderMoney.multiply(deductionRatio.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_EVEN); |
| | | if(total > 0 && multiply1.doubleValue() > 0 && total.compareTo(multiply1.doubleValue()) >= 0){ |
| | | orderLogistics.setRedPacketMoney(multiply1.doubleValue()); |
| | | orderMoney = orderMoney - multiply1.doubleValue(); |
| | | orderMoney = orderMoney.subtract(multiply1).setScale(2, RoundingMode.HALF_EVEN); |
| | | |
| | | //获取红包id |
| | | JSONArray jsonArray = new JSONArray(); |
| | | for (UserRedPacketRecord userRedPacketRecord : userRedPacketRecords) { |
| | | if(multiply1.compareTo(BigDecimal.ZERO) == 0){ |
| | | break; |
| | | } |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("id", userRedPacketRecord.getId()); |
| | | BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount()); |
| | |
| | | multiply1 = multiply1.subtract(remainingAmount).setScale(2, RoundingMode.HALF_EVEN); |
| | | jsonObject.put("money", remainingAmount); |
| | | jsonArray.add(jsonObject); |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | }else{ |
| | | }else if(remainingAmount.compareTo(multiply1) > 0){ |
| | | userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply1).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | jsonObject.put("money", multiply1); |
| | | jsonArray.add(jsonObject); |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | break; |
| | | multiply1 = BigDecimal.ZERO; |
| | | } |
| | | } |
| | | if(userRedPacketRecords.size() > 0){ |
| | | userRedPacketRecordService.updateBatchById(userRedPacketRecords); |
| | | } |
| | | orderLogistics.setRedPacketId(jsonArray.toJSONString()); |
| | | }else{ |
| | | } |
| | | if(total > 0 && total.compareTo(multiply1.doubleValue()) < 0){ |
| | | orderLogistics.setRedPacketMoney(total); |
| | | orderMoney = orderMoney - total; |
| | | orderMoney = orderMoney.subtract(new BigDecimal(total)).setScale(2, RoundingMode.HALF_EVEN); |
| | | //获取红包id |
| | | JSONArray jsonArray = new JSONArray(); |
| | | BigDecimal multiply = new BigDecimal(total); |
| | | for (UserRedPacketRecord userRedPacketRecord : userRedPacketRecords) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("id", userRedPacketRecord.getId()); |
| | | BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount()); |
| | | if(multiply.compareTo(remainingAmount) >= 0){ |
| | | 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).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | jsonObject.put("money", multiply); |
| | | jsonArray.add(jsonObject); |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | break; |
| | | } |
| | | jsonObject.put("money", userRedPacketRecord.getRemainingAmount()); |
| | | jsonArray.add(jsonObject); |
| | | |
| | | userRedPacketRecord.setRemainingAmount(0D); |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | userRedPacketRecord.setState(2); |
| | | } |
| | | if(userRedPacketRecords.size() > 0){ |
| | | userRedPacketRecordService.updateBatchById(userRedPacketRecords); |
| | | } |
| | | orderLogistics.setRedPacketId(jsonArray.toJSONString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | orderMoney=new BigDecimal(orderMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | |
| | | if(payType == 1) {//手机支付 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + "4" + language + orderId; |
| | |
| | | checkoutRequest.setAccountNumber(userInfo.getPhone()); |
| | | checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(userInfo.getLastName()); |
| | | checkoutRequest.setRequestAmount(orderMoney); |
| | | checkoutRequest.setRequestAmount(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("http://182.160.16.251:81/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html"); |
| | | checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, orderId, 4, 1, orderMoney, null, 1);//添加预支付数据 |
| | | paymentRecordService.saveData(1, null, null, orderId, 4, 1, |
| | | orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), null, 1);//添加预支付数据 |
| | | }else{ |
| | | resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Paiement échoué", ""); |
| | | } |
| | |
| | | checkoutRequest.setAccountNumber(bankCard.getCode()); |
| | | checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(bankCard.getLastName()); |
| | | checkoutRequest.setRequestAmount(orderMoney); |
| | | checkoutRequest.setRequestAmount(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("http://182.160.16.251:81/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html"); |
| | | checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, orderId, 4, 2, orderMoney, null, 1);//添加预支付数据 |
| | | 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é", ""); |
| | | } |
| | |
| | | } |
| | | |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){ |
| | | if(userInfo.getBalance() == null || new BigDecimal(userInfo.getBalance()).compareTo(orderMoney) < 0){ |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient balance" : "Solde insuffisant", ""); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(orderMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 |
| | |
| | | } |
| | | |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "包裹下单支付", orderMoney, 2, 1, 1, 4, orderId); |
| | | transactionDetailsService.saveData(uid, "包裹下单支付", |
| | | orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), 2, 1, 1, 4, orderId); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | orderLogistics.setState(8); |
| | | orderLogistics.setPayType(3); |
| | | orderLogistics.setPayMoney(orderMoney); |
| | | orderLogistics.setPayMoney(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | |
| | | //处理优惠券和红包 |
| | | if(null != userCouponRecord){ |
| | |
| | | if(1 == language){ |
| | | document.getElementById("english").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("I-GO电子收据"); |
| | | document.getElementsByTag("title").get(0).text("包裹收据"); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",您在I-GO此订单消费GHS " + orderLogistics.getPayMoney()); |
| | | Element qbj_chinese = document.getElementById("qbj_chinese"); |
| | |
| | | pay_type_chinese.text(payTypeChinese); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element dispute_chinese = document.getElementById("dispute_chinese"); |
| | | if(null != orderLogistics.getIsDispute() && orderLogistics.getIsDispute() == 1){ |
| | | dispute_chinese.text("(注意: 争议订单,经过三方协商,平台最终定价为 GHS" + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); |
| | | }else{ |
| | | dispute_chinese.remove(); |
| | | } |
| | | Element pdf_chinese = document.getElementById("pdf_chinese"); |
| | | pdf_chinese.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | pdf_chinese.attr("href", "https://igo.i-go.group/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_chinese = document.getElementById("lost_item_chinese"); |
| | | lost_item_chinese.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | lost_item_chinese.attr("href", "https://igo.i-go.group/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_chinese = document.getElementById("track_chinese"); |
| | | // track_chinese.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | // track_chinese.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_chinese = document.getElementsByClass("driver_chinese"); |
| | |
| | | if(2 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("Receipt"); |
| | | document.getElementsByTag("title").get(0).text("Delivery receipt"); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip "); |
| | | Element qbj_english = document.getElementById("qbj_english"); |
| | |
| | | pay_type_english.text(payTypeEnglish); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element dispute_english = document.getElementById("dispute_english"); |
| | | if(null != orderLogistics.getIsDispute() && orderLogistics.getIsDispute() == 1){ |
| | | dispute_english.text("(Note: Disputed order, after tripartite negotiation, the final pricing of the platform is GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); |
| | | }else{ |
| | | dispute_english.remove(); |
| | | } |
| | | Element pdf_english = document.getElementById("pdf_english"); |
| | | pdf_english.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | pdf_english.attr("href", "https://igo.i-go.group/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_english = document.getElementById("lost_item_english"); |
| | | lost_item_english.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | lost_item_english.attr("href", "https://igo.i-go.group/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_english = document.getElementById("track_english"); |
| | | // track_english.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | // track_english.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_english = document.getElementsByClass("driver_english"); |
| | |
| | | if(3 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("english").remove(); |
| | | document.getElementsByTag("title").get(0).text("Reçu"); |
| | | document.getElementsByTag("title").get(0).text("Reçu de livraison"); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le "); |
| | | title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande I-GO "); |
| | | Element qbj_french = document.getElementById("qbj_french"); |
| | | qbj_french.text("GHS " + new BigDecimal(orderLogistics.getStartMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element scf_french = document.getElementById("scf_french"); |
| | |
| | | pay_type_french.text(payTypeFrench); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element dispute_french = document.getElementById("dispute_french"); |
| | | if(null != orderLogistics.getIsDispute() && orderLogistics.getIsDispute() == 1){ |
| | | dispute_french.text("(Remarque: Il s’agit d’une commande contestée, et après des négociations entre trois parties, la plateforme l’a finalement tarifée à GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); |
| | | }else{ |
| | | dispute_french.remove(); |
| | | } |
| | | Element pdf_french = document.getElementById("pdf_french"); |
| | | pdf_french.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | pdf_french.attr("href", "https://igo.i-go.group/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_french = document.getElementById("lost_item_french"); |
| | | lost_item_french.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | lost_item_french.attr("href", "https://igo.i-go.group/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_french = document.getElementById("track_french"); |
| | | // track_french.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | // track_french.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_french = document.getElementsByClass("driver_french"); |
| | |
| | | server_tel_french.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "I-GO电子收据" : language == 2 ? "Receipt" : "Reçu", document.html()); |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "包裹收据" : language == 2 ? "Delivery receipt" : "Reçu de livraison", document.html()); |
| | | |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | File file = new File("/home/igotechgh/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/parcel_receipt_" + orderId + ".html"); |
| | | file = new File("/home/igotechgh/nginx/html/files/html/parcel_receipt_" + orderId + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | File file1 = new File("/usr/local/nginx/html/files/pdf/"); |
| | | File file1 = new File("/home/igotechgh/nginx/html/files/pdf/"); |
| | | if(!file1.exists()){ |
| | | file1.mkdirs(); |
| | | } |
| | | file1 = new File("/usr/local/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf"); |
| | | file1 = new File("/home/igotechgh/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf"); |
| | | if(!file1.exists()){ |
| | | file1.createNewFile(); |
| | | } |
| | | try{ |
| | | FileOutputStream fileOutputStream = new FileOutputStream(file1); |
| | | HtmlToPdfUtils.convertToPdf("/usr/local/nginx/html/files/html/parcel_receipt_" + orderId + ".html", "I-GO", fileOutputStream); |
| | | HtmlToPdfUtils.convertToPdf("/home/igotechgh/nginx/html/files/html/parcel_receipt_" + orderId + ".html", "I-GO", fileOutputStream); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | System.out.println("html转pdf异常"); |
| | | } |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/parcel_receipt_" + orderId + ".html"; |
| | | String link ="https://igo.i-go.group/files/html/parcel_receipt_" + orderId + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(userInfo.getId()); |
| | | tEmail.setType(1); |
| | | tEmail.setName(language == 1 ? "I-GO电子收据" : language == 2 ? "Receipt" : "Reçu"); |
| | | tEmail.setName(language == 1 ? "包裹收据" : language == 2 ? "Delivery receipt" : "Reçu de livraison"); |
| | | tEmail.setOrderId(orderId); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | |
| | | userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 |
| | | |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "包裹下单支付", orderMoney, 2, 1, 1, 4, orderId); |
| | | transactionDetailsService.saveData(uid, "包裹下单支付", |
| | | orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), 2, 1, 1, 4, orderId); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | orderLogistics.setState(8);//小件物流先支付后司机抢单 |
| | | orderLogistics.setDriverPay(1); |
| | | orderLogistics.setPayType(4); |
| | | orderLogistics.setPayMoney(orderMoney); |
| | | orderLogistics.setPayMoney(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | |
| | | //处理优惠券和红包 |
| | | if(null != userCouponRecord){ |
| | |
| | | if(null != settlementAllocation){ |
| | | JSONObject jsonObject = JSON.parseObject(settlementAllocation.getContent()); |
| | | Double maxPrice = jsonObject.getDouble("maxPrice"); |
| | | Integer type1 = jsonObject.getInteger("type"); |
| | | if(1 == type1){ |
| | | List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driver.getId()).isNull("settlementRecordId").last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(createTime, '%Y-%m-%d')")); |
| | | 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", orderLogistics.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(orderLogistics.getDriverId()); |
| | | settlementRecord.setType(type1); |
| | | settlementRecord.setType(1); |
| | | settlementRecord.setPaymentStatus(1); |
| | | settlementRecord.setPayMoney(total.doubleValue()); |
| | | settlementRecord.setInsertTime(new Date()); |
| | | settlementRecordService.insert(settlementRecord); |
| | | }else{ |
| | | settlementRecord.setPayMoney(total.doubleValue()); |
| | | settlementRecord.setPayMoney(settlementRecord.getPayMoney() + total.doubleValue()); |
| | | settlementRecordService.updateById(settlementRecord); |
| | | } |
| | | for (SettlementDetail detail : settlementDetailList) { |
| | |
| | | if(1 == language){ |
| | | document.getElementById("english").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("I-GO电子收据"); |
| | | document.getElementsByTag("title").get(0).text("包裹收据"); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",您在I-GO此订单消费GHS " + orderLogistics.getPayMoney()); |
| | | Element qbj_chinese = document.getElementById("qbj_chinese"); |
| | |
| | | pay_type_chinese.text(payTypeChinese); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element dispute_chinese = document.getElementById("dispute_chinese"); |
| | | if(null != orderLogistics.getIsDispute() && orderLogistics.getIsDispute() == 1){ |
| | | dispute_chinese.text("(注意: 争议订单,经过三方协商,平台最终定价为 GHS" + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); |
| | | }else{ |
| | | dispute_chinese.remove(); |
| | | } |
| | | Element pdf_chinese = document.getElementById("pdf_chinese"); |
| | | pdf_chinese.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | pdf_chinese.attr("href", "https://igo.i-go.group/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_chinese = document.getElementById("lost_item_chinese"); |
| | | lost_item_chinese.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | lost_item_chinese.attr("href", "https://igo.i-go.group/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_chinese = document.getElementById("track_chinese"); |
| | | // track_chinese.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | // track_chinese.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_chinese = document.getElementsByClass("driver_chinese"); |
| | |
| | | if(2 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("Receipt"); |
| | | document.getElementsByTag("title").get(0).text("Delivery receipt"); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip "); |
| | | Element qbj_english = document.getElementById("qbj_english"); |
| | |
| | | pay_type_english.text(payTypeEnglish); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element dispute_english = document.getElementById("dispute_english"); |
| | | if(null != orderLogistics.getIsDispute() && orderLogistics.getIsDispute() == 1){ |
| | | dispute_english.text("(Note: Disputed order, after tripartite negotiation, the final pricing of the platform is GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); |
| | | }else{ |
| | | dispute_english.remove(); |
| | | } |
| | | Element pdf_english = document.getElementById("pdf_english"); |
| | | pdf_english.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | pdf_english.attr("href", "https://igo.i-go.group/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_english = document.getElementById("lost_item_english"); |
| | | lost_item_english.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | lost_item_english.attr("href", "https://igo.i-go.group/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_english = document.getElementById("track_english"); |
| | | // track_english.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | // track_english.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_english = document.getElementsByClass("driver_english"); |
| | |
| | | if(3 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("english").remove(); |
| | | document.getElementsByTag("title").get(0).text("Reçu"); |
| | | document.getElementsByTag("title").get(0).text("Reçu de livraison"); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le "); |
| | | title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande I-GO "); |
| | | Element qbj_french = document.getElementById("qbj_french"); |
| | | qbj_french.text("GHS " + new BigDecimal(orderLogistics.getStartMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element scf_french = document.getElementById("scf_french"); |
| | |
| | | pay_type_french.text(payTypeFrench); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element dispute_french = document.getElementById("dispute_french"); |
| | | if(null != orderLogistics.getIsDispute() && orderLogistics.getIsDispute() == 1){ |
| | | dispute_french.text("(Remarque: Il s’agit d’une commande contestée, et après des négociations entre trois parties, la plateforme l’a finalement tarifée à GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); |
| | | }else{ |
| | | dispute_french.remove(); |
| | | } |
| | | Element pdf_french = document.getElementById("pdf_french"); |
| | | pdf_french.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | pdf_french.attr("href", "https://igo.i-go.group/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4"); |
| | | Element lost_item_french = document.getElementById("lost_item_french"); |
| | | lost_item_french.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | lost_item_french.attr("href", "https://igo.i-go.group/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + orderId + "&orderType=4"); |
| | | // Element track_french = document.getElementById("track_french"); |
| | | // track_french.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | // track_french.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_french = document.getElementsByClass("driver_french"); |
| | |
| | | server_tel_french.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "I-GO电子收据" : language == 2 ? "Receipt" : "Reçu", document.html()); |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "包裹收据" : language == 2 ? "Delivery receipt" : "Reçu de livraison", document.html()); |
| | | |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | File file = new File("/home/igotechgh/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/parcel_receipt_" + orderId + ".html"); |
| | | file = new File("/home/igotechgh/nginx/html/files/html/parcel_receipt_" + orderId + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | File file1 = new File("/usr/local/nginx/html/files/pdf/"); |
| | | File file1 = new File("/home/igotechgh/nginx/html/files/pdf/"); |
| | | if(!file1.exists()){ |
| | | file1.mkdirs(); |
| | | } |
| | | file1 = new File("/usr/local/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf"); |
| | | file1 = new File("/home/igotechgh/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf"); |
| | | if(!file1.exists()){ |
| | | file1.createNewFile(); |
| | | } |
| | | try{ |
| | | FileOutputStream fileOutputStream = new FileOutputStream(file1); |
| | | HtmlToPdfUtils.convertToPdf("/usr/local/nginx/html/files/html/parcel_receipt_" + orderId + ".html", "I-GO", fileOutputStream); |
| | | HtmlToPdfUtils.convertToPdf("/home/igotechgh/nginx/html/files/html/parcel_receipt_" + orderId + ".html", "I-GO", fileOutputStream); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | System.out.println("html转pdf异常"); |
| | | } |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/parcel_receipt_" + orderId + ".html"; |
| | | String link ="https://igo.i-go.group/files/html/parcel_receipt_" + orderId + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(userInfo.getId()); |
| | | tEmail.setType(1); |
| | | tEmail.setName(language == 1 ? "I-GO电子收据" : language == 2 ? "Receipt" : "Reçu"); |
| | | tEmail.setName(language == 1 ? "包裹收据" : language == 2 ? "Delivery receipt" : "Reçu de livraison"); |
| | | tEmail.setOrderId(orderId); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | |
| | | checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderLogisticsSpread"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("http://182.160.16.251:81/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html"); |
| | | checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | return TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | } |
| | | if(payType == 2){//银行卡支付 |
| | |
| | | checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderLogisticsSpread"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("http://182.160.16.251:81/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html"); |
| | | checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | return TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | } |
| | | |
| | |
| | | if(1 == language){ |
| | | document.getElementById("english").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("I-GO电子收据"); |
| | | document.getElementsByTag("title").get(0).text("包裹收据"); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",您在I-GO此订单消费GHS " + orderLogistics.getPayMoney()); |
| | | Element qbj_chinese = document.getElementById("qbj_chinese"); |
| | |
| | | pay_type_chinese.text(payTypeChinese); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element dispute_chinese = document.getElementById("dispute_chinese"); |
| | | if(null != orderLogistics.getIsDispute() && orderLogistics.getIsDispute() == 1){ |
| | | dispute_chinese.text("(注意: 争议订单,经过三方协商,平台最终定价为 GHS" + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); |
| | | }else{ |
| | | dispute_chinese.remove(); |
| | | } |
| | | Element pdf_chinese = document.getElementById("pdf_chinese"); |
| | | pdf_chinese.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=4"); |
| | | pdf_chinese.attr("href", "https://igo.i-go.group/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=4"); |
| | | Element lost_item_chinese = document.getElementById("lost_item_chinese"); |
| | | lost_item_chinese.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + id + "&orderType=4"); |
| | | lost_item_chinese.attr("href", "https://igo.i-go.group/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + id + "&orderType=4"); |
| | | // Element track_chinese = document.getElementById("track_chinese"); |
| | | // track_chinese.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | // track_chinese.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_chinese = document.getElementsByClass("driver_chinese"); |
| | |
| | | if(2 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("french").remove(); |
| | | document.getElementsByTag("title").get(0).text("Receipt"); |
| | | document.getElementsByTag("title").get(0).text("Delivery receipt"); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip "); |
| | | Element qbj_english = document.getElementById("qbj_english"); |
| | |
| | | pay_type_english.text(payTypeEnglish); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element dispute_english = document.getElementById("dispute_english"); |
| | | if(null != orderLogistics.getIsDispute() && orderLogistics.getIsDispute() == 1){ |
| | | dispute_english.text("(Note: Disputed order, after tripartite negotiation, the final pricing of the platform is GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); |
| | | }else{ |
| | | dispute_english.remove(); |
| | | } |
| | | Element pdf_english = document.getElementById("pdf_english"); |
| | | pdf_english.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=4"); |
| | | pdf_english.attr("href", "https://igo.i-go.group/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=4"); |
| | | Element lost_item_english = document.getElementById("lost_item_english"); |
| | | lost_item_english.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + id + "&orderType=4"); |
| | | lost_item_english.attr("href", "https://igo.i-go.group/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + id + "&orderType=4"); |
| | | // Element track_english = document.getElementById("track_english"); |
| | | // track_english.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | // track_english.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_english = document.getElementsByClass("driver_english"); |
| | |
| | | if(3 == language){ |
| | | document.getElementById("chinese").remove(); |
| | | document.getElementById("english").remove(); |
| | | document.getElementsByTag("title").get(0).text("Reçu"); |
| | | document.getElementsByTag("title").get(0).text("Reçu de livraison"); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le "); |
| | | title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande I-GO "); |
| | | Element qbj_french = document.getElementById("qbj_french"); |
| | | qbj_french.text("GHS " + new BigDecimal(orderLogistics.getStartMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element scf_french = document.getElementById("scf_french"); |
| | |
| | | pay_type_french.text(payTypeFrench); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | Element dispute_french = document.getElementById("dispute_french"); |
| | | if(null != orderLogistics.getIsDispute() && orderLogistics.getIsDispute() == 1){ |
| | | dispute_french.text("(Remarque: Il s’agit d’une commande contestée, et après des négociations entre trois parties, la plateforme l’a finalement tarifée à GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); |
| | | }else{ |
| | | dispute_french.remove(); |
| | | } |
| | | Element pdf_french = document.getElementById("pdf_french"); |
| | | pdf_french.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=4"); |
| | | pdf_french.attr("href", "https://igo.i-go.group/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=4"); |
| | | Element lost_item_french = document.getElementById("lost_item_french"); |
| | | lost_item_french.attr("href", "http://182.160.16.251:81/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + id + "&orderType=4"); |
| | | lost_item_french.attr("href", "https://igo.i-go.group/mailbox/user/lossGoods.html?language=" + language + "&orderId=" + id + "&orderType=4"); |
| | | // Element track_french = document.getElementById("track_french"); |
| | | // track_french.attr("href", "http://182.160.16.251:81/mailbox/user/location.html"); |
| | | // track_french.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); |
| | | Elements driver_french = document.getElementsByClass("driver_french"); |
| | |
| | | server_tel_french.attr("href", "tel:" + (null != phone ? phone.getPhone() : "")); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "I-GO电子收据" : language == 2 ? "Receipt" : "Reçu", document.html()); |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "包裹收据" : language == 2 ? "Delivery receipt" : "Reçu de livraison", document.html()); |
| | | |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | File file = new File("/home/igotechgh/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/parcel_receipt_" + id + ".html"); |
| | | file = new File("/home/igotechgh/nginx/html/files/html/parcel_receipt_" + id + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | File file1 = new File("/usr/local/nginx/html/files/pdf/"); |
| | | File file1 = new File("/home/igotechgh/nginx/html/files/pdf/"); |
| | | if(!file1.exists()){ |
| | | file1.mkdirs(); |
| | | } |
| | | file1 = new File("/usr/local/nginx/html/files/pdf/parcel_receipt_" + id + ".pdf"); |
| | | file1 = new File("/home/igotechgh/nginx/html/files/pdf/parcel_receipt_" + id + ".pdf"); |
| | | if(!file1.exists()){ |
| | | file1.createNewFile(); |
| | | } |
| | | try{ |
| | | FileOutputStream fileOutputStream = new FileOutputStream(file1); |
| | | HtmlToPdfUtils.convertToPdf("/usr/local/nginx/html/files/html/parcel_receipt_" + id + ".html", "I-GO", fileOutputStream); |
| | | HtmlToPdfUtils.convertToPdf("/home/igotechgh/nginx/html/files/html/parcel_receipt_" + id + ".html", "I-GO", fileOutputStream); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | System.out.println("html转pdf异常"); |
| | | } |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/parcel_receipt_" + id + ".html"; |
| | | String link ="https://igo.i-go.group/files/html/parcel_receipt_" + id + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(userInfo.getId()); |
| | | tEmail.setType(1); |
| | | tEmail.setName(language == 1 ? "I-GO电子收据" : language == 2 ? "Receipt" : "Reçu"); |
| | | tEmail.setName(language == 1 ? "包裹收据" : language == 2 ? "Delivery receipt" : "Reçu de livraison"); |
| | | tEmail.setOrderId(id); |
| | | tEmail.setCreateTime(new Date()); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | |
| | | Integer orderId = Integer.valueOf(String.valueOf(map.get("orderId"))); |
| | | Integer state = Integer.valueOf(String.valueOf(map.get("state"))); |
| | | if(state == 6){ |
| | | map.put("receipt", "http://182.160.16.251:81/files/html/parcel_receipt_" + orderId + ".html"); |
| | | map.put("receipt", "https://igo.i-go.group/files/html/parcel_receipt_" + orderId + ".html"); |
| | | }else{ |
| | | map.put("receipt", ""); |
| | | } |
| | |
| | | } |
| | | |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | long timeOutCancel = 0L; |
| | | long driverTimeOut = 0L; |
| | | map.put("driverTimeOutTime", 0); |
| | | map.put("driverTimeOut", 0); |
| | | 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; |
| | | driverTimeOut = orderLogistics.getEstimateArriveTime().getTime(); |
| | | int driverTimeout1 = jsonObject.getIntValue("driverTimeout"); |
| | | long time = orderLogistics.getEstimateArriveTime().getTime() + driverTimeout1 * 60000; |
| | | if(System.currentTimeMillis() > time){ |
| | | Integer driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue(); |
| | | driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime; |
| | | map.put("driverTimeOutTime", driverTimeOutTime); |
| | | map.put("driverTimeOut", 1); |
| | | } |
| | | } |
| | | map.put("driverTimeOut", driverTimeOut); |
| | | map.put("timeOutCancel", timeOutCancel); |
| | | } |
| | | return maps; |
| | | } |
| | |
| | | if(null == orderLogistics){ |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,订单信息有误" : language == 2 ? "Failed to cancel order, order-information error." : "Échec de l’annulation de la commande, erreur d’information de commande."); |
| | | } |
| | | if(orderLogistics.getState() > 5 && orderLogistics.getState() != 12){ |
| | | if(orderLogistics.getState() > 5 && orderLogistics.getState() != 11 && orderLogistics.getState() != 12){ |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Failed to cancel order, illegal operation." : "Échec de l’annulation de la commande, opération illégale."); |
| | | } |
| | | |
| | |
| | | String audioUrl = ""; |
| | | switch (language1){ |
| | | case 1: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/system/UserCancelledOrder-CN.mp3"; |
| | | audioUrl = "https://igo.i-go.group/files/audio/system/UserCancelledOrder-CN.mp3"; |
| | | break; |
| | | case 2: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/system/UserCancelledOrder-EN.mp3"; |
| | | audioUrl = "https://igo.i-go.group/files/audio/system/UserCancelledOrder-EN.mp3"; |
| | | break; |
| | | case 3: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/system/UserCancelledOrder-FR.mp3"; |
| | | audioUrl = "https://igo.i-go.group/files/audio/system/UserCancelledOrder-FR.mp3"; |
| | | break; |
| | | } |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0, ""); |
| | |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | if(orderLogistics.getState() == 10 || orderLogistics.getState() == 12){ |
| | | if((orderLogistics.getState() == 10 || orderLogistics.getState() == 12) && null != orderLogistics.getDriverId()){ |
| | | //修改行程信息 |
| | | fleetEngineUtil.updateTrip("CANCELED", null, null, orderLogistics.getTripId(), null, null, null, null); |
| | | } |
| | |
| | | map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1); |
| | | map.put("orderType", orderLogistics.getType()); |
| | | if(state == 8 || state == 9){ |
| | | map.put("receipt", "http://182.160.16.251:81/files/html/parcel_receipt_" + orderId + ".html"); |
| | | map.put("receipt", "https://igo.i-go.group/files/html/parcel_receipt_" + orderId + ".html"); |
| | | }else{ |
| | | map.put("receipt", ""); |
| | | } |
| | |
| | | if(null != map.get("driverId")){ |
| | | companyId = Integer.valueOf(String.valueOf(map.get("companyId"))); |
| | | } |
| | | map.put("timeOutCancel", 0); |
| | | map.put("driverTimeOutTime", 0); |
| | | map.put("driverTimeOut", 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); |
| | | map.put("driverTimeOut", orderLogistics.getEstimateArriveTime().getTime()); |
| | | int driverTimeout1 = jsonObject.getIntValue("driverTimeout"); |
| | | long time = orderLogistics.getEstimateArriveTime().getTime() + driverTimeout1 * 60000; |
| | | if(System.currentTimeMillis() > time){ |
| | | Integer driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue(); |
| | | driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime; |
| | | map.put("driverTimeOutTime", driverTimeOutTime); |
| | | map.put("driverTimeOut", 1); |
| | | } |
| | | } |
| | | map.put("isDispute", orderLogistics.getIsDispute()); |
| | | return map; |
| | | } |
| | | |
| | |
| | | @Override |
| | | public ResultUtil cancleOrderPrivateCar(Integer id, Integer payType, Integer bankCardId, Integer cancleId, Integer type, Integer language) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(id); |
| | | Integer uid = orderLogistics.getUserId(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(""); |
| | | |
| | | if(null == orderLogistics){ |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,订单信息有误" : language == 2 ? "Failed to cancel order, order-information error." : "Échec de l’annulation de la commande, erreur d’information de commande.", ""); |
| | | } |
| | |
| | | }else{ |
| | | orderCancel = orderCancelService.selectById(cancleId); |
| | | } |
| | | |
| | | |
| | | Integer uid = orderLogistics.getUserId(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | Double amount = orderCancel.getMoney(); |
| | | if(0 < amount){ |
| | | if(payType == 1){//手机支付 |
| | |
| | | checkoutRequest.setRequestDescription("Cancel a trip"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxCancelOrderTaxi"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("http://182.160.16.251:81/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html"); |
| | | checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, id, 4, 1, amount, null, 1);//添加预支付数据 |
| | |
| | | checkoutRequest.setRequestDescription("Cancel a trip"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxCancelOrderTaxi"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("http://182.160.16.251:81/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html"); |
| | | checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, id, 4, 2, amount, null, 1);//添加预支付数据 |
| | |
| | | String audioUrl = ""; |
| | | switch (language1){ |
| | | case 1: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/system/ChangeAddress-CN.mp3"; |
| | | audioUrl = "https://igo.i-go.group/files/audio/system/ChangeAddress-CN.mp3"; |
| | | break; |
| | | case 2: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/system/ChangeAddress-EN.mp3"; |
| | | audioUrl = "https://igo.i-go.group/files/audio/system/ChangeAddress-EN.mp3"; |
| | | break; |
| | | case 3: |
| | | audioUrl = "http://182.160.16.251:81/files/audio/system/ChangeAddress-FR.mp3"; |
| | | audioUrl = "https://igo.i-go.group/files/audio/system/ChangeAddress-FR.mp3"; |
| | | break; |
| | | } |
| | | pushUtil.pushModifyAddress(2, orderLogistics.getDriverId(), orderId, 4, 1, audioUrl); |
| | |
| | | Element user_chinese = document.getElementById("user_chinese"); |
| | | user_chinese.text("您好 " + userInfo.getNickName() + ","); |
| | | Element time_chinese = document.getElementById("time_chinese"); |
| | | time_chinese.text("此活动有效期在 " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " 至 " + DateUtil.conversionFormat(language, sdf.format(id.getEnable())) + ",详情请查看I-GO平台"); |
| | | 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(id.getStartTime())) + " to " + DateUtil.conversionFormat(language, sdf.format(id.getEnable())) + ",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(id.getStartTime())) + " au " + DateUtil.conversionFormat(language, sdf.format(id.getEnable())) + ". 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()); |
| | | //开始生成pdf收据和html收据 |
| | | File file = new File("/usr/local/nginx/html/files/html/"); |
| | | File file = new File("/home/igotechgh/nginx/html/files/html/"); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | file = new File("/usr/local/nginx/html/files/html/redpacket_" + orderId + ".html"); |
| | | file = new File("/home/igotechgh/nginx/html/files/html/redpacket_" + orderId + ".html"); |
| | | if(!file.exists()){ |
| | | file.createNewFile(); |
| | | } |
| | |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | |
| | | String link ="http://182.160.16.251:81/files/html/redpacket_" + orderId + ".html"; |
| | | String link ="https://igo.i-go.group/files/html/redpacket_" + orderId + ".html"; |
| | | TEmail tEmail = new TEmail(); |
| | | tEmail.setLink(link); |
| | | tEmail.setUserId(userInfo.getId()); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | String tripId = redisUtil.getValue("trip" + uid); |
| | | 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)); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), Double.valueOf(lat), Double.valueOf(lnt), tripId); |
| | | |
| | | if(null == distancematrix){ |
| | | System.err.println("查询距离出错了"); |
| | |
| | | orderServerWarpper.setLaveTime("0"); |
| | | } |
| | | if(orderLogistics.getState() == 5 || orderLogistics.getState() == 6){//服务中 |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(lat), Double.valueOf(lnt), orderLogistics.getEndLat(), orderLogistics.getEndLon()); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(lat), Double.valueOf(lnt), orderLogistics.getEndLat(), orderLogistics.getEndLon(), tripId); |
| | | if(null == distancematrix){ |
| | | System.err.println("查询距离出错了"); |
| | | }else if(distancematrix.getDistance() == 0){ |