From 7d042f808effe2231e78e5bdc234a194d027aafe Mon Sep 17 00:00:00 2001 From: dengwc Date: Thu, 28 Mar 2024 09:49:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E7=A8=8B=E7=BB=93=E7=AE=97=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E7=BC=96=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/OrderRecordGenerateCommand.java | 3 + .../application/in/AutoWorkController.java | 14 +- .../order/order_record/OrderCarRecord.java | 6 + .../order/order_record/OrderFlightRecord.java | 6 + .../order/order_record/OrderHotelRecord.java | 6 + .../order/order_record/OrderTrainRecord.java | 6 + .../ly_order_record/LyOrderCarRecord.java | 4 + .../ly_order_record/LyOrderFlightRecord.java | 2 + .../ly_order_record/LyOrderHotelRecord.java | 2 + .../ly_order_record/LyOrderTrainRecord.java | 2 + .../LyOrderRecordExtensionFactory.java | 99 +++++++++++ .../LYOrderRecordDomainService.java | 159 ++++++++++++++++-- .../repository/jdbc/JdbcLyOrderCarRecord.java | 10 ++ .../jdbc/JdbcLyOrderFlightRecord.java | 12 +- .../jdbc/JdbcLyOrderHotelRecord.java | 10 ++ .../jdbc/JdbcLyOrderTrainRecord.java | 11 +- 16 files changed, 332 insertions(+), 20 deletions(-) create mode 100644 src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java diff --git a/src/main/java/com/chint/application/commands/OrderRecordGenerateCommand.java b/src/main/java/com/chint/application/commands/OrderRecordGenerateCommand.java index b0013e98..b93f456b 100644 --- a/src/main/java/com/chint/application/commands/OrderRecordGenerateCommand.java +++ b/src/main/java/com/chint/application/commands/OrderRecordGenerateCommand.java @@ -1,7 +1,10 @@ package com.chint.application.commands; import com.chint.infrastructure.echo_framework.command.Command; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; import java.time.LocalDate; import java.time.LocalDateTime; diff --git a/src/main/java/com/chint/application/in/AutoWorkController.java b/src/main/java/com/chint/application/in/AutoWorkController.java index 6c18df82..2e24783c 100644 --- a/src/main/java/com/chint/application/in/AutoWorkController.java +++ b/src/main/java/com/chint/application/in/AutoWorkController.java @@ -1,6 +1,9 @@ package com.chint.application.in; +import com.chint.application.commands.OrderRecordGenerateCommand; +import com.chint.domain.factoriy.order_record.LyStatementOrder; +import com.chint.infrastructure.echo_framework.command.Command; import com.chint.infrastructure.util.Result; import com.chint.interfaces.rest.ctrip.order.CTripOrderRecordAutoSave; import io.swagger.annotations.ApiOperation; @@ -10,6 +13,11 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; + import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS; @RestController @@ -27,19 +35,21 @@ public class AutoWorkController { @Transactional @ApiOperation("自动拉取昨天的流水号,每天晚上8点执行") @PostMapping("/cTrip/record/save") - public Result autoSaveCTripRecord(){ + public Result autoSaveCTripRecord() { cTripOrderRecordAutoSave.saveAll(); //将昨天的结算数据生成为财务共享需要的数据 Command.of(OrderRecordGenerateCommand.class).sendToQueue(); return Result.Success(SUCCESS); } - @Transactional @ApiOperation("自动拉取同程上个月的流水号") @PostMapping("/ly/record/save") public Result autoSaveLYRecord() { + //同步拉取上月数据 lyStatementOrder.saveAll(); + //将上月的结算数据生成为财务共享需要的数据 + Command.of(OrderRecordGenerateCommand.class).sendToQueue(); return Result.Success(SUCCESS); } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java index 88d633a6..158ae546 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java @@ -1,11 +1,17 @@ package com.chint.domain.aggregates.order.order_record; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; @Data @Table("order_car_record") +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public class OrderCarRecord extends OrderBaseRecord { @Id private Long id; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java index c41565e2..c18cdf3c 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java @@ -1,11 +1,17 @@ package com.chint.domain.aggregates.order.order_record; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; @Data @Table("order_flight_record") +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public class OrderFlightRecord extends OrderBaseRecord{ @Id private Long id; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java index 08854f0c..54fdf380 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java @@ -1,11 +1,17 @@ package com.chint.domain.aggregates.order.order_record; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; @Data @Table("order_hotel_record") +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public class OrderHotelRecord extends OrderBaseRecord{ @Id private Long id; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java index de177373..5c50fd5a 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java @@ -1,11 +1,17 @@ package com.chint.domain.aggregates.order.order_record; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; @Data @Table("order_train_record") +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public class OrderTrainRecord extends OrderBaseRecord{ @Id private Long id; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderCarRecord.java index c24cd791..398dc579 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderCarRecord.java @@ -9,6 +9,7 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import com.fasterxml.jackson.annotation.JsonInclude; + import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.MappedCollection; import org.springframework.data.relational.core.mapping.Table; @@ -137,4 +138,7 @@ public class LyOrderCarRecord implements Serializable { private String reserveManExpand4; //差旅备注 private String travelRemark; + + //状态 默认为null, 1:已经转为财务共享数据 + private Integer status; } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderFlightRecord.java index d62c27c1..026901ce 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderFlightRecord.java @@ -179,4 +179,6 @@ public class LyOrderFlightRecord implements Serializable { //差旅备注 private String travelRemark; + //状态 默认为null, 1:已经转为财务共享数据 + private Integer status; } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderHotelRecord.java index f1fe000f..6897503c 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderHotelRecord.java @@ -151,4 +151,6 @@ public class LyOrderHotelRecord implements Serializable { //差旅备注 private String travelRemark; + //状态 默认为null, 1:已经转为财务共享数据 + private Integer status; } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderTrainRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderTrainRecord.java index 5f91a78f..f266be19 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderTrainRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderTrainRecord.java @@ -144,5 +144,7 @@ public class LyOrderTrainRecord implements Serializable { private String reserveManExpand4; //差旅备注 private String travelRemark; + //状态 默认为null, 1:已经转为财务共享数据 + private Integer status; } diff --git a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java new file mode 100644 index 00000000..0d6751f3 --- /dev/null +++ b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java @@ -0,0 +1,99 @@ +package com.chint.domain.factoriy.order_record; + +import com.chint.domain.aggregates.order.order_record.OrderCarRecord; +import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; +import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; +import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; +import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderCarRecord; +import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderFlightRecord; +import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderHotelRecord; +import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderTrainRecord; +import com.chint.domain.service.OrderDetailDomainService; +import com.chint.infrastructure.repository.jdbc.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 同程数据转换 + */ + +@Component +public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactory { + + @Autowired + private OrderDetailDomainService orderDetailDomainService; + + @Autowired + private JdbcLyOrderFlightRecord jdbcLyOrderFlightRecord; + + @Autowired + private JdbcLyOrderHotelRecord jdbcLyOrderHotelRecord; + + @Autowired + private JdbcLyOrderTrainRecord jdbcLyOrderTrainRecord; + + @Autowired + private JdbcLyOrderCarRecord jdbcLyOrderCarRecord; + + @Override + public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) { + OrderFlightRecord orderFlightRecord = new OrderFlightRecord(); + if (orderFlightRecordData instanceof LyOrderFlightRecord) { + LyOrderFlightRecord lyOrderFlightRecord = (LyOrderFlightRecord) orderFlightRecordData; + createFlightOrder(orderFlightRecord, lyOrderFlightRecord); + } + return orderFlightRecord; + } + + + @Override + public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData) { + OrderHotelRecord orderHotelRecord = new OrderHotelRecord(); + if (orderHotelRecordData instanceof LyOrderHotelRecord) { + LyOrderHotelRecord lyOrderHotelRecord = (LyOrderHotelRecord) orderHotelRecordData; + createHotelOrder(orderHotelRecord, lyOrderHotelRecord); + } + return orderHotelRecord; + } + + @Override + public OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData) { + OrderTrainRecord orderTrainRecord = new OrderTrainRecord(); + if (orderTrainRecordData instanceof LyOrderTrainRecord) { + LyOrderTrainRecord lyOrderTrainRecord = (LyOrderTrainRecord) orderTrainRecordData; + createTrainOrder(orderTrainRecord, lyOrderTrainRecord); + } + return orderTrainRecord; + } + + @Override + public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) { + OrderCarRecord orderCarRecord = new OrderCarRecord(); + if (orderCarRecordData instanceof LyOrderCarRecord) { + LyOrderCarRecord lyOrderCarRecord = (LyOrderCarRecord) orderCarRecordData; + createCarOrder(orderCarRecord, lyOrderCarRecord); + } + return orderCarRecord; + } + + + private void createFlightOrder(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord) { + + + } + + private void createHotelOrder(OrderHotelRecord orderHotelRecord, LyOrderHotelRecord lyOrderHotelRecord) { + + + } + + private void createTrainOrder(OrderTrainRecord orderTrainRecord, LyOrderTrainRecord lyOrderTrainRecord) { + + + } + + private void createCarOrder(OrderCarRecord orderCarRecord, LyOrderCarRecord lyOrderCarRecord) { + + + } +} diff --git a/src/main/java/com/chint/domain/service/order_record/LYOrderRecordDomainService.java b/src/main/java/com/chint/domain/service/order_record/LYOrderRecordDomainService.java index 730ca53f..1089a02f 100644 --- a/src/main/java/com/chint/domain/service/order_record/LYOrderRecordDomainService.java +++ b/src/main/java/com/chint/domain/service/order_record/LYOrderRecordDomainService.java @@ -5,32 +5,161 @@ import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; +import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderCarRecord; +import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderFlightRecord; +import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderHotelRecord; +import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderTrainRecord; +import com.chint.domain.factoriy.order_record.CTripOrderRecordExtensionFactory; +import com.chint.domain.factoriy.order_record.LyOrderRecordExtensionFactory; +import com.chint.domain.service.OrderDetailDomainService; +import com.chint.infrastructure.repository.jdbc.*; +import com.chint.infrastructure.util.PageResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; -public class LYOrderRecordDomainService implements OrderRecordDomainService{ +@Component +public class LYOrderRecordDomainService implements OrderRecordDomainService { + @Autowired + private JdbcLyOrderFlightRecord jdbcLyOrderFlightRecord; + + @Autowired + private JdbcLyOrderHotelRecord jdbcLyOrderHotelRecord; + + @Autowired + private JdbcLyOrderTrainRecord jdbcLyOrderTrainRecord; + + @Autowired + private JdbcLyOrderCarRecord jdbcLyOrderCarRecord; + + + @Autowired + private LyOrderRecordExtensionFactory lyOrderRecordExtensionFactory; + + @Autowired + private OrderDetailDomainService orderDetailDomainService; @Override - public List generateHotelRecord(OrderRecordGenerateCommand command) { - LocalDateTime startTime = command.getStartTime(); - - return null; - } - - @Override - public List generateTrainRecord(OrderRecordGenerateCommand command) { - return null; - } - - @Override + @Transactional public List generateFlightRecord(OrderRecordGenerateCommand command) { - return null; + ArrayList orderFlightRecordList = new ArrayList<>(); + int count = 0;//初始化变量 + int pageSize = 100; // 假设每页大小为10 + int LoopNum;//需要的循环数 + do { + PageRequest pageResult = PageRequest.of(count, pageSize); + Page lyOrderFlightRecordPage = jdbcLyOrderFlightRecord.findAllByStatusIsNull(pageResult); + long totalElements = lyOrderFlightRecordPage.getTotalElements();//总数 + LoopNum = (int) Math.ceil((double) totalElements / pageSize); // 计算总页数并向上取整 + //数据 + List lyOrderFlightRecordPageList = lyOrderFlightRecordPage.toList(); + ArrayList orderFlightRecords = new ArrayList<>(100); + for (LyOrderFlightRecord lyOrderFlightRecord : lyOrderFlightRecordPageList) { + OrderFlightRecord orderFlightRecord = lyOrderRecordExtensionFactory.createFlightOrderRecord(lyOrderFlightRecord);//转换 + orderFlightRecords.add(orderFlightRecord); + } + //保存数据 + orderDetailDomainService.saveFlightOrderRecordBatch(orderFlightRecords); + orderFlightRecordList.addAll(orderFlightRecords); + count++; + } while (count < LoopNum); + //修改数据,将状态为null的设置为1 + jdbcLyOrderFlightRecord.updateStatusByNullStatus(); + return orderFlightRecordList; } @Override + @Transactional + public List generateHotelRecord(OrderRecordGenerateCommand command) { + ArrayList orderHotelRecordList = new ArrayList<>(); + int count = 0;//初始化变量 + int pageSize = 100; // 假设每页大小为10 + int LoopNum;//需要的循环数 + do { + PageRequest pageResult = PageRequest.of(count, pageSize); + Page lyOrderHotelRecordPage = jdbcLyOrderHotelRecord.findAllByStatusIsNull(pageResult); + long totalElements = lyOrderHotelRecordPage.getTotalElements();//总数 + LoopNum = (int) Math.ceil((double) totalElements / pageSize); // 计算总页数并向上取整 + //数据 + List lyOrderHotelRecordPageList = lyOrderHotelRecordPage.toList(); + ArrayList orderHotelRecords = new ArrayList<>(100); + for (LyOrderHotelRecord lyOrderHotelRecord : lyOrderHotelRecordPageList) { + OrderHotelRecord orderHotelRecord = lyOrderRecordExtensionFactory.createHotelOrderRecord(lyOrderHotelRecord);//转换 + orderHotelRecords.add(orderHotelRecord); + } + //保存数据 + orderDetailDomainService.saveHotelOrderRecordBatch(orderHotelRecords); + orderHotelRecordList.addAll(orderHotelRecords); + count++; + } while (count < LoopNum); + //修改数据,将状态为null的设置为1 + jdbcLyOrderHotelRecord.updateStatusByNullStatus(); + return orderHotelRecordList; + } + + @Override + @Transactional + public List generateTrainRecord(OrderRecordGenerateCommand command) { + ArrayList orderTrainRecordsList = new ArrayList<>(); + int count = 0;//初始化变量 + int pageSize = 100; // 假设每页大小为10 + int LoopNum;//需要的循环数 + do { + PageRequest pageResult = PageRequest.of(count, pageSize); + Page lyOrderTrainRecordPage = jdbcLyOrderTrainRecord.findAllByStatusIsNull(pageResult); + long totalElements = lyOrderTrainRecordPage.getTotalElements();//总数 + LoopNum = (int) Math.ceil((double) totalElements / pageSize); // 计算总页数并向上取整 + //数据 + List lyOrderTrainRecordPageList = lyOrderTrainRecordPage.toList(); + ArrayList orderTrainRecords = new ArrayList<>(100); + for (LyOrderTrainRecord lyOrderTrainRecord : lyOrderTrainRecordPageList) { + OrderTrainRecord orderTrainRecord = lyOrderRecordExtensionFactory.createTrainOrderRecord(lyOrderTrainRecord);//转换 + orderTrainRecords.add(orderTrainRecord); + } + //保存数据 + orderDetailDomainService.saveTrainOrderRecordBatch(orderTrainRecords); + orderTrainRecordsList.addAll(orderTrainRecords); + count++; + } while (count < LoopNum); + //修改数据,将状态为null的设置为1 + jdbcLyOrderTrainRecord.updateStatusByNullStatus(); + return orderTrainRecordsList; + } + + + @Override + @Transactional public List generateCarRecord(OrderRecordGenerateCommand command) { - return null; + ArrayList orderCarRecordsList = new ArrayList<>(); + int count = 0;//初始化变量 + int pageSize = 100; // 假设每页大小为10 + int LoopNum;//需要的循环数 + do { + PageRequest pageResult = PageRequest.of(count, pageSize); + Page lyOrderCarRecordPage = jdbcLyOrderCarRecord.findAllByStatusIsNull(pageResult); + long totalElements = lyOrderCarRecordPage.getTotalElements();//总数 + LoopNum = (int) Math.ceil((double) totalElements / pageSize); // 计算总页数并向上取整 + //数据 + List lyOrderCarRecordPageList = lyOrderCarRecordPage.toList(); + ArrayList orderCarRecords = new ArrayList<>(100); + for (LyOrderCarRecord lyOrderCarRecord : lyOrderCarRecordPageList) { + OrderCarRecord orderCarRecord = lyOrderRecordExtensionFactory.createCarOrderRecord(lyOrderCarRecord);//转换 + orderCarRecords.add(orderCarRecord); + } + //保存数据 + orderDetailDomainService.saveCarOrderRecordBatch(orderCarRecords); + orderCarRecordsList.addAll(orderCarRecords); + count++; + } while (count < LoopNum); + //修改数据,将状态为null的设置为1 + jdbcLyOrderCarRecord.updateStatusByNullStatus(); + return orderCarRecordsList; } } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderCarRecord.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderCarRecord.java index 757b69de..b4f165c0 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderCarRecord.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderCarRecord.java @@ -2,6 +2,10 @@ package com.chint.infrastructure.repository.jdbc; import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderCarRecord; +import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderFlightRecord; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.jdbc.repository.query.Modifying; import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; @@ -13,4 +17,10 @@ import java.util.List; public interface JdbcLyOrderCarRecord extends CrudRepository { @Query(value = "SELECT bill_order_no FROM ly_order_car_record WHERE enter_account BETWEEN :beginDate AND :endDate") List queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate); + + Page findAllByStatusIsNull(PageRequest pageResult); + + @Modifying + @Query("UPDATE ly_order_car_record l SET l.status = 1 WHERE l.status IS NULL") + void updateStatusByNullStatus(); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderFlightRecord.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderFlightRecord.java index ad9e1b83..450728a5 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderFlightRecord.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderFlightRecord.java @@ -1,9 +1,11 @@ package com.chint.infrastructure.repository.jdbc; - - import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderFlightRecord; +import com.chint.infrastructure.config.LogConfig.SystemLog; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.jdbc.repository.query.Modifying; import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; @@ -15,4 +17,10 @@ import java.util.List; public interface JdbcLyOrderFlightRecord extends CrudRepository { @Query(value = "SELECT bill_order_no FROM ly_order_flight_record WHERE enter_account BETWEEN :beginDate AND :endDate") List queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate); + + Page findAllByStatusIsNull(PageRequest pageResult); + + @Modifying + @Query("UPDATE ly_order_flight_record l SET l.status = 1 WHERE l.status IS NULL") + void updateStatusByNullStatus(); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderHotelRecord.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderHotelRecord.java index e9c62fca..1b5fbf1b 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderHotelRecord.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderHotelRecord.java @@ -2,7 +2,11 @@ package com.chint.infrastructure.repository.jdbc; +import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderCarRecord; import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderHotelRecord; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.jdbc.repository.query.Modifying; import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; @@ -14,4 +18,10 @@ import java.util.List; public interface JdbcLyOrderHotelRecord extends CrudRepository { @Query(value = "SELECT bill_order_no FROM ly_order_hotel_record WHERE enter_account BETWEEN :beginDate AND :endDate") List queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate); + + Page findAllByStatusIsNull(PageRequest pageResult); + + @Modifying + @Query("UPDATE ly_order_hotel_record l SET l.status = 1 WHERE l.status IS NULL") + void updateStatusByNullStatus(); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderTrainRecord.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderTrainRecord.java index 8bc7b8cb..ff720591 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderTrainRecord.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLyOrderTrainRecord.java @@ -1,8 +1,11 @@ package com.chint.infrastructure.repository.jdbc; - +import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderCarRecord; import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderTrainRecord; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.jdbc.repository.query.Modifying; import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; @@ -14,4 +17,10 @@ import java.util.List; public interface JdbcLyOrderTrainRecord extends CrudRepository { @Query(value = "SELECT bill_order_no FROM ly_order_train_record WHERE enter_account BETWEEN :beginDate AND :endDate") List queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate); + + Page findAllByStatusIsNull(PageRequest pageResult); + + @Modifying + @Query("UPDATE ly_order_train_record l SET l.status = 1 WHERE l.status IS NULL") + void updateStatusByNullStatus(); }