| | |
| | | import java.io.Serializable; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | if (da == null && db == null) return 0; |
| | | if (da == null) return 1; // a 在后面 |
| | | if (db == null) return -1; // b 在后面 |
| | | return db.compareTo(da); // 都不为空,再按时间倒序 |
| | | return da.compareTo(db); // 按时间正序(升序)排列 |
| | | }); |
| | | // 将经纬度转换为城市并设置到数据中 |
| | | if (list != null && !list.isEmpty()) { |
| | |
| | | List<TripOrderVo> tripOrderVos = processTripOrderVos(orderList); |
| | | String filePath = tripSheetGenerator.generatePdf(tripOrderVos); |
| | | File attachment = new File(filePath); |
| | | emailUtil.sendEmailWithAttachment(tripSheet.getRecipientEmail(), "行程单", "请查收您的行程单", attachment); |
| | | String displayFileName = "贵人家园行程单.pdf"; |
| | | emailUtil.sendEmailWithAttachment(tripSheet.getRecipientEmail(), "行程单", "请查收您的行程单", attachment,displayFileName); |
| | | attachment.delete(); // 发送成功后删除临时文件 |
| | | return ResultUtil.success("邮件发送成功"); |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("orderNum", orderList.size()); |
| | | return ResultUtil.success(result); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.error("邮件发送失败"); |
| | | return ResultUtil.error("邮件发送失败"+e.getMessage()); |
| | | } |
| | | } |
| | | /** |
| | |
| | | */ |
| | | private List<TripOrderVo> queryOrdersByTypeAndIds(Integer userId, Integer orderType, List<Integer> orderIds) throws InvocationTargetException, IllegalAccessException { |
| | | List<TripOrderVo> orderList = new ArrayList<>(); |
| | | |
| | | List<Integer> states = Arrays.asList(8, 9); |
| | | // 根据订单类型查询对应表的订单 |
| | | switch (orderType) { |
| | | case 1: |
| | | EntityWrapper<OrderPrivateCar> wrapper = new EntityWrapper<>(); |
| | | wrapper.in("id", orderIds); |
| | | wrapper.in("state", states); |
| | | List<OrderPrivateCar> orderPrivateCars = orderPrivateCarService.selectList(wrapper); |
| | | for (OrderPrivateCar orderPrivateCar : orderPrivateCars) { |
| | | TripOrderVo vo = new TripOrderVo(); |
| | |
| | | case 2: |
| | | EntityWrapper<OrderTaxi> wrapper2 = new EntityWrapper<>(); |
| | | wrapper2.in("id", orderIds); |
| | | wrapper2.in("state", states); |
| | | List<OrderTaxi> orderTaxis = orderTaxiService.selectList(wrapper2); |
| | | for (OrderTaxi orderTaxi : orderTaxis) { |
| | | TripOrderVo vo = new TripOrderVo(); |
| | |
| | | case 3: |
| | | EntityWrapper<OrderCrossCity> wrapper3 = new EntityWrapper<>(); |
| | | wrapper3.in("id", orderIds); |
| | | wrapper3.in("state", states); |
| | | List<OrderCrossCity> orderCrossCities = orderCrossCityService.selectList(wrapper3); |
| | | for (OrderCrossCity orderCrossCity : orderCrossCities) { |
| | | TripOrderVo vo = new TripOrderVo(); |
| | |
| | | if (da == null && db == null) return 0; |
| | | if (da == null) return 1; // a 在后面 |
| | | if (db == null) return -1; // b 在后面 |
| | | return db.compareTo(da); // 都不为空,再按时间倒序 |
| | | return da.compareTo(db); // 按时间正序(升序)排列 |
| | | }); |
| | | |
| | | |