From be31c7101407037f861f8cdf34c79083b59b7b5d Mon Sep 17 00:00:00 2001 From: nixj Date: Tue, 2 Jul 2024 16:08:27 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=E3=80=91=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=8A=B6=E6=80=81=E4=B8=BAnull=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E6=8C=89=E6=97=B6=E9=97=B4=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/entity/dto/ItineraryPageDto.java | 2 ++ .../entity/excel/CarOrderDetailExcel.java | 5 +++- .../entity/excel/FlightOrderDetailExcel.java | 5 +++- .../excel/OrderExceedStandardExcel.java | 11 ++++++++ .../entity/excel/TrainOrderDetailExcel.java | 5 +++- .../JdbcOrderDetailBasicRepository.java | 4 +-- .../JdbcConsumptionDetailRepositoryImpl.java | 28 +++++++++---------- .../impl/ManageOrderDetailRepositoryImpl.java | 4 +-- 8 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java b/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java index 94ec51e1..51b5c2eb 100644 --- a/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java +++ b/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java @@ -28,6 +28,8 @@ public class ItineraryPageDto { // private List approveEvents; private String approvalStatus; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime createTime; //差旅订单总价值 private List locationResList; diff --git a/src/main/java/com/chint/manage/entity/excel/CarOrderDetailExcel.java b/src/main/java/com/chint/manage/entity/excel/CarOrderDetailExcel.java index d5b8fb09..ed710453 100644 --- a/src/main/java/com/chint/manage/entity/excel/CarOrderDetailExcel.java +++ b/src/main/java/com/chint/manage/entity/excel/CarOrderDetailExcel.java @@ -37,9 +37,12 @@ public class CarOrderDetailExcel extends BaseExcel{ private String createTime; public String getOrderStatus() { + if (orderStatus==null){ + return ""; + } return switch (orderStatus) { case "0" -> "取消"; - case "1" -> "出票成功"; + case "1" -> "行程结束"; case "2" -> "改签成功"; case "3" -> "退票成功"; default -> orderStatus; diff --git a/src/main/java/com/chint/manage/entity/excel/FlightOrderDetailExcel.java b/src/main/java/com/chint/manage/entity/excel/FlightOrderDetailExcel.java index 872cf4cd..d71eae10 100644 --- a/src/main/java/com/chint/manage/entity/excel/FlightOrderDetailExcel.java +++ b/src/main/java/com/chint/manage/entity/excel/FlightOrderDetailExcel.java @@ -36,9 +36,12 @@ public class FlightOrderDetailExcel extends BaseExcel{ public String getOrderStatus() { + if (orderStatus==null){ + return ""; + } return switch (orderStatus) { case "0" -> "取消"; - case "1" -> "出票成功"; + case "1" -> "行程结束"; case "2" -> "改签成功"; case "3" -> "退票成功"; default -> orderStatus; diff --git a/src/main/java/com/chint/manage/entity/excel/OrderExceedStandardExcel.java b/src/main/java/com/chint/manage/entity/excel/OrderExceedStandardExcel.java index a2ed2d5a..6e9fb8d0 100644 --- a/src/main/java/com/chint/manage/entity/excel/OrderExceedStandardExcel.java +++ b/src/main/java/com/chint/manage/entity/excel/OrderExceedStandardExcel.java @@ -2,9 +2,11 @@ package com.chint.manage.entity.excel; import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.math.BigDecimal; +import java.time.LocalDateTime; /** * @@ -33,5 +35,14 @@ public class OrderExceedStandardExcel extends BaseExcel{ private BigDecimal standardAmount; @ExcelIgnore private String employeeNo; + @ExcelIgnore + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime orderDate; + @ExcelIgnore + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime createTime; + @ExcelIgnore + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime updateTime; } diff --git a/src/main/java/com/chint/manage/entity/excel/TrainOrderDetailExcel.java b/src/main/java/com/chint/manage/entity/excel/TrainOrderDetailExcel.java index b38e53d7..f137ab58 100644 --- a/src/main/java/com/chint/manage/entity/excel/TrainOrderDetailExcel.java +++ b/src/main/java/com/chint/manage/entity/excel/TrainOrderDetailExcel.java @@ -37,9 +37,12 @@ public class TrainOrderDetailExcel extends BaseExcel{ private String createTime; public String getOrderStatus() { + if (orderStatus==null){ + return ""; + } return switch (orderStatus) { case "0" -> "取消"; - case "1" -> "出票成功"; + case "1" -> "行程结束"; case "2" -> "改签成功"; case "3" -> "退票成功"; default -> orderStatus; diff --git a/src/main/java/com/chint/manage/mapper/JdbcOrderDetailBasicRepository.java b/src/main/java/com/chint/manage/mapper/JdbcOrderDetailBasicRepository.java index 00f290c8..8327a590 100644 --- a/src/main/java/com/chint/manage/mapper/JdbcOrderDetailBasicRepository.java +++ b/src/main/java/com/chint/manage/mapper/JdbcOrderDetailBasicRepository.java @@ -36,7 +36,7 @@ public interface JdbcOrderDetailBasicRepository extends CrudRepository findAllOrderId(); - @Query("SELECT * FROM order_detail od " + + @Query("SELECT od.* FROM order_detail od " + "LEFT JOIN route_order_extension_field roef ON roef.route_id=od.route_id "+ "WHERE (roef.company_code IN (:#{#dto.companyCodes})) " + "AND (:#{#dto.routeIdsEmpty} = TRUE OR roef.route_id IN (:#{#dto.routeIds})) " + @@ -45,7 +45,7 @@ public interface JdbcOrderDetailBasicRepository extends CrudRepository listByCondition(@Param("dto") OrderPageQuery dto, @Param("pageRequest") PageRequest pageRequest); @Query("SELECT COUNT(*) FROM order_detail od " + diff --git a/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java b/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java index 1d4f2c17..ca3ef777 100644 --- a/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java +++ b/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java @@ -59,14 +59,14 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai Map params = new HashMap<>(); PageRequest pageRequest = PageRequest - .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending()); + .of(dto.getPageNum() - 1, dto.getPageSize()); params.put("actualOrderNo", dto.getActualOrderNo()); params.put("userIds", dto.getUserIds()); params.put("companyCodes", dto.getCompanyCodes()); params.put("offset", pageRequest.getOffset()); params.put("limit", pageRequest.getPageSize()); - String pagedQuery = "SELECT * FROM route_order ro " + query + " LIMIT :limit OFFSET :offset"; + String pagedQuery = "SELECT ro.* FROM route_order ro " + query + " ORDER BY create_time DESC LIMIT :limit OFFSET :offset"; List results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(ItineraryPageDto.class)); String countQuery = "SELECT COUNT(*) FROM route_order ro " + query; @@ -112,11 +112,11 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai Map params = new HashMap<>(); PageRequest pageRequest = PageRequest - .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending()); + .of(dto.getPageNum() - 1, dto.getPageSize()); query = getString(dto, query, params, pageRequest); - String pagedQuery = "SELECT * FROM train_order_detail tod " - + query + " LIMIT :limit OFFSET :offset"; + String pagedQuery = "SELECT tod.* FROM train_order_detail tod " + + query + " ORDER BY tod.create_time DESC LIMIT :limit OFFSET :offset"; List results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(TrainOrderDetailExcel.class)); String countQuery = "SELECT COUNT(*) FROM train_order_detail tod " + query; @@ -131,11 +131,11 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai Map params = new HashMap<>(); PageRequest pageRequest = PageRequest - .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending()); + .of(dto.getPageNum() - 1, dto.getPageSize()); query = getString(dto, query, params, pageRequest); - String pagedQuery = "SELECT * FROM flight_order_detail tod " - + query + " LIMIT :limit OFFSET :offset"; + String pagedQuery = "SELECT tod.* FROM flight_order_detail tod " + + query + " ORDER BY tod.create_time DESC LIMIT :limit OFFSET :offset"; List results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(FlightOrderDetailExcel.class)); String countQuery = "SELECT COUNT(*) FROM flight_order_detail tod " + query; @@ -150,11 +150,11 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai Map params = new HashMap<>(); PageRequest pageRequest = PageRequest - .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending()); + .of(dto.getPageNum() - 1, dto.getPageSize()); query = getString(dto, query, params, pageRequest); - String pagedQuery = "SELECT * FROM hotel_order_detail tod " - + query + " LIMIT :limit OFFSET :offset"; + String pagedQuery = "SELECT tod.* FROM hotel_order_detail tod " + + query + " ORDER BY tod.create_time DESC LIMIT :limit OFFSET :offset"; List results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(HotelOrderDetailExcel.class)); String countQuery = "SELECT COUNT(*) FROM hotel_order_detail tod " + query; @@ -169,12 +169,12 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai Map params = new HashMap<>(); PageRequest pageRequest = PageRequest - .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending()); + .of(dto.getPageNum() - 1, dto.getPageSize()); query = getString(dto, query, params, pageRequest); - String pagedQuery = "SELECT * FROM car_order_detail tod " - + query + " LIMIT :limit OFFSET :offset"; + String pagedQuery = "SELECT tod.* FROM car_order_detail tod " + + query + " ORDER BY tod.create_time DESC LIMIT :limit OFFSET :offset"; List results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(CarOrderDetailExcel.class)); String countQuery = "SELECT COUNT(*) FROM car_order_detail tod " + query; diff --git a/src/main/java/com/chint/manage/mapper/impl/ManageOrderDetailRepositoryImpl.java b/src/main/java/com/chint/manage/mapper/impl/ManageOrderDetailRepositoryImpl.java index 0cedb558..d0f51a91 100644 --- a/src/main/java/com/chint/manage/mapper/impl/ManageOrderDetailRepositoryImpl.java +++ b/src/main/java/com/chint/manage/mapper/impl/ManageOrderDetailRepositoryImpl.java @@ -64,7 +64,7 @@ public class ManageOrderDetailRepositoryImpl implements ManageOrderDetailReposit Map params = new HashMap<>(); PageRequest pageRequest = PageRequest - .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("order_date").descending()); + .of(dto.getPageNum() - 1, dto.getPageSize()); params.put("actualOrderNo", dto.getActualOrderNo()); params.put("applicant", dto.getApplicant()); params.put("companyName", dto.getCompanyName()); @@ -73,7 +73,7 @@ public class ManageOrderDetailRepositoryImpl implements ManageOrderDetailReposit params.put("offset", pageRequest.getOffset()); params.put("limit", pageRequest.getPageSize()); - String pagedQuery ="SELECT * FROM order_exceed_standard oes "+ query + " LIMIT :limit OFFSET :offset"; + String pagedQuery ="SELECT * FROM order_exceed_standard oes "+ query + " ORDER BY oes.order_date DESC LIMIT :limit OFFSET :offset"; List results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(OrderExceedStandard.class)); String countSql="SELECT COUNT(*) AS count FROM order_exceed_standard oes " + query ;