同程结算接口编写
This commit is contained in:
parent
5ba9a05f34
commit
7d042f808e
|
@ -1,7 +1,10 @@
|
||||||
package com.chint.application.commands;
|
package com.chint.application.commands;
|
||||||
|
|
||||||
import com.chint.infrastructure.echo_framework.command.Command;
|
import com.chint.infrastructure.echo_framework.command.Command;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package com.chint.application.in;
|
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.infrastructure.util.Result;
|
||||||
import com.chint.interfaces.rest.ctrip.order.CTripOrderRecordAutoSave;
|
import com.chint.interfaces.rest.ctrip.order.CTripOrderRecordAutoSave;
|
||||||
import io.swagger.annotations.ApiOperation;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
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;
|
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -27,19 +35,21 @@ public class AutoWorkController {
|
||||||
@Transactional
|
@Transactional
|
||||||
@ApiOperation("自动拉取昨天的流水号,每天晚上8点执行")
|
@ApiOperation("自动拉取昨天的流水号,每天晚上8点执行")
|
||||||
@PostMapping("/cTrip/record/save")
|
@PostMapping("/cTrip/record/save")
|
||||||
public Result<String> autoSaveCTripRecord(){
|
public Result<String> autoSaveCTripRecord() {
|
||||||
cTripOrderRecordAutoSave.saveAll();
|
cTripOrderRecordAutoSave.saveAll();
|
||||||
//将昨天的结算数据生成为财务共享需要的数据
|
//将昨天的结算数据生成为财务共享需要的数据
|
||||||
Command.of(OrderRecordGenerateCommand.class).sendToQueue();
|
Command.of(OrderRecordGenerateCommand.class).sendToQueue();
|
||||||
return Result.Success(SUCCESS);
|
return Result.Success(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@ApiOperation("自动拉取同程上个月的流水号")
|
@ApiOperation("自动拉取同程上个月的流水号")
|
||||||
@PostMapping("/ly/record/save")
|
@PostMapping("/ly/record/save")
|
||||||
public Result<String> autoSaveLYRecord() {
|
public Result<String> autoSaveLYRecord() {
|
||||||
|
//同步拉取上月数据
|
||||||
lyStatementOrder.saveAll();
|
lyStatementOrder.saveAll();
|
||||||
|
//将上月的结算数据生成为财务共享需要的数据
|
||||||
|
Command.of(OrderRecordGenerateCommand.class).sendToQueue();
|
||||||
return Result.Success(SUCCESS);
|
return Result.Success(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
package com.chint.domain.aggregates.order.order_record;
|
package com.chint.domain.aggregates.order.order_record;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.relational.core.mapping.Table;
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Table("order_car_record")
|
@Table("order_car_record")
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
public class OrderCarRecord extends OrderBaseRecord {
|
public class OrderCarRecord extends OrderBaseRecord {
|
||||||
@Id
|
@Id
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
package com.chint.domain.aggregates.order.order_record;
|
package com.chint.domain.aggregates.order.order_record;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.relational.core.mapping.Table;
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Table("order_flight_record")
|
@Table("order_flight_record")
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
public class OrderFlightRecord extends OrderBaseRecord{
|
public class OrderFlightRecord extends OrderBaseRecord{
|
||||||
@Id
|
@Id
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
package com.chint.domain.aggregates.order.order_record;
|
package com.chint.domain.aggregates.order.order_record;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.relational.core.mapping.Table;
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Table("order_hotel_record")
|
@Table("order_hotel_record")
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
public class OrderHotelRecord extends OrderBaseRecord{
|
public class OrderHotelRecord extends OrderBaseRecord{
|
||||||
@Id
|
@Id
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
package com.chint.domain.aggregates.order.order_record;
|
package com.chint.domain.aggregates.order.order_record;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.relational.core.mapping.Table;
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Table("order_train_record")
|
@Table("order_train_record")
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
public class OrderTrainRecord extends OrderBaseRecord{
|
public class OrderTrainRecord extends OrderBaseRecord{
|
||||||
@Id
|
@Id
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||||
import org.springframework.data.relational.core.mapping.Table;
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
@ -137,4 +138,7 @@ public class LyOrderCarRecord implements Serializable {
|
||||||
private String reserveManExpand4;
|
private String reserveManExpand4;
|
||||||
//差旅备注
|
//差旅备注
|
||||||
private String travelRemark;
|
private String travelRemark;
|
||||||
|
|
||||||
|
//状态 默认为null, 1:已经转为财务共享数据
|
||||||
|
private Integer status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,4 +179,6 @@ public class LyOrderFlightRecord implements Serializable {
|
||||||
//差旅备注
|
//差旅备注
|
||||||
private String travelRemark;
|
private String travelRemark;
|
||||||
|
|
||||||
|
//状态 默认为null, 1:已经转为财务共享数据
|
||||||
|
private Integer status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,4 +151,6 @@ public class LyOrderHotelRecord implements Serializable {
|
||||||
//差旅备注
|
//差旅备注
|
||||||
private String travelRemark;
|
private String travelRemark;
|
||||||
|
|
||||||
|
//状态 默认为null, 1:已经转为财务共享数据
|
||||||
|
private Integer status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,5 +144,7 @@ public class LyOrderTrainRecord implements Serializable {
|
||||||
private String reserveManExpand4;
|
private String reserveManExpand4;
|
||||||
//差旅备注
|
//差旅备注
|
||||||
private String travelRemark;
|
private String travelRemark;
|
||||||
|
//状态 默认为null, 1:已经转为财务共享数据
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -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.OrderFlightRecord;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
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.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.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
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
|
@Override
|
||||||
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
|
@Transactional
|
||||||
LocalDateTime startTime = command.getStartTime();
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<OrderTrainRecord> generateTrainRecord(OrderRecordGenerateCommand command) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command) {
|
public List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command) {
|
||||||
return null;
|
ArrayList<OrderFlightRecord> orderFlightRecordList = new ArrayList<>();
|
||||||
|
int count = 0;//初始化变量
|
||||||
|
int pageSize = 100; // 假设每页大小为10
|
||||||
|
int LoopNum;//需要的循环数
|
||||||
|
do {
|
||||||
|
PageRequest pageResult = PageRequest.of(count, pageSize);
|
||||||
|
Page<LyOrderFlightRecord> lyOrderFlightRecordPage = jdbcLyOrderFlightRecord.findAllByStatusIsNull(pageResult);
|
||||||
|
long totalElements = lyOrderFlightRecordPage.getTotalElements();//总数
|
||||||
|
LoopNum = (int) Math.ceil((double) totalElements / pageSize); // 计算总页数并向上取整
|
||||||
|
//数据
|
||||||
|
List<LyOrderFlightRecord> lyOrderFlightRecordPageList = lyOrderFlightRecordPage.toList();
|
||||||
|
ArrayList<OrderFlightRecord> 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
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
|
||||||
|
ArrayList<OrderHotelRecord> orderHotelRecordList = new ArrayList<>();
|
||||||
|
int count = 0;//初始化变量
|
||||||
|
int pageSize = 100; // 假设每页大小为10
|
||||||
|
int LoopNum;//需要的循环数
|
||||||
|
do {
|
||||||
|
PageRequest pageResult = PageRequest.of(count, pageSize);
|
||||||
|
Page<LyOrderHotelRecord> lyOrderHotelRecordPage = jdbcLyOrderHotelRecord.findAllByStatusIsNull(pageResult);
|
||||||
|
long totalElements = lyOrderHotelRecordPage.getTotalElements();//总数
|
||||||
|
LoopNum = (int) Math.ceil((double) totalElements / pageSize); // 计算总页数并向上取整
|
||||||
|
//数据
|
||||||
|
List<LyOrderHotelRecord> lyOrderHotelRecordPageList = lyOrderHotelRecordPage.toList();
|
||||||
|
ArrayList<OrderHotelRecord> 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<OrderTrainRecord> generateTrainRecord(OrderRecordGenerateCommand command) {
|
||||||
|
ArrayList<OrderTrainRecord> orderTrainRecordsList = new ArrayList<>();
|
||||||
|
int count = 0;//初始化变量
|
||||||
|
int pageSize = 100; // 假设每页大小为10
|
||||||
|
int LoopNum;//需要的循环数
|
||||||
|
do {
|
||||||
|
PageRequest pageResult = PageRequest.of(count, pageSize);
|
||||||
|
Page<LyOrderTrainRecord> lyOrderTrainRecordPage = jdbcLyOrderTrainRecord.findAllByStatusIsNull(pageResult);
|
||||||
|
long totalElements = lyOrderTrainRecordPage.getTotalElements();//总数
|
||||||
|
LoopNum = (int) Math.ceil((double) totalElements / pageSize); // 计算总页数并向上取整
|
||||||
|
//数据
|
||||||
|
List<LyOrderTrainRecord> lyOrderTrainRecordPageList = lyOrderTrainRecordPage.toList();
|
||||||
|
ArrayList<OrderTrainRecord> 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<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) {
|
public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) {
|
||||||
return null;
|
ArrayList<OrderCarRecord> orderCarRecordsList = new ArrayList<>();
|
||||||
|
int count = 0;//初始化变量
|
||||||
|
int pageSize = 100; // 假设每页大小为10
|
||||||
|
int LoopNum;//需要的循环数
|
||||||
|
do {
|
||||||
|
PageRequest pageResult = PageRequest.of(count, pageSize);
|
||||||
|
Page<LyOrderCarRecord> lyOrderCarRecordPage = jdbcLyOrderCarRecord.findAllByStatusIsNull(pageResult);
|
||||||
|
long totalElements = lyOrderCarRecordPage.getTotalElements();//总数
|
||||||
|
LoopNum = (int) Math.ceil((double) totalElements / pageSize); // 计算总页数并向上取整
|
||||||
|
//数据
|
||||||
|
List<LyOrderCarRecord> lyOrderCarRecordPageList = lyOrderCarRecordPage.toList();
|
||||||
|
ArrayList<OrderCarRecord> 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.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.jdbc.repository.query.Query;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
@ -13,4 +17,10 @@ import java.util.List;
|
||||||
public interface JdbcLyOrderCarRecord extends CrudRepository<LyOrderCarRecord, Long> {
|
public interface JdbcLyOrderCarRecord extends CrudRepository<LyOrderCarRecord, Long> {
|
||||||
@Query(value = "SELECT bill_order_no FROM ly_order_car_record WHERE enter_account BETWEEN :beginDate AND :endDate")
|
@Query(value = "SELECT bill_order_no FROM ly_order_car_record WHERE enter_account BETWEEN :beginDate AND :endDate")
|
||||||
List<String> queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
List<String> queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
||||||
|
|
||||||
|
Page<LyOrderCarRecord> findAllByStatusIsNull(PageRequest pageResult);
|
||||||
|
|
||||||
|
@Modifying
|
||||||
|
@Query("UPDATE ly_order_car_record l SET l.status = 1 WHERE l.status IS NULL")
|
||||||
|
void updateStatusByNullStatus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package com.chint.infrastructure.repository.jdbc;
|
package com.chint.infrastructure.repository.jdbc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderFlightRecord;
|
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.jdbc.repository.query.Query;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
@ -15,4 +17,10 @@ import java.util.List;
|
||||||
public interface JdbcLyOrderFlightRecord extends CrudRepository<LyOrderFlightRecord, Long> {
|
public interface JdbcLyOrderFlightRecord extends CrudRepository<LyOrderFlightRecord, Long> {
|
||||||
@Query(value = "SELECT bill_order_no FROM ly_order_flight_record WHERE enter_account BETWEEN :beginDate AND :endDate")
|
@Query(value = "SELECT bill_order_no FROM ly_order_flight_record WHERE enter_account BETWEEN :beginDate AND :endDate")
|
||||||
List<String> queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
List<String> queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
||||||
|
|
||||||
|
Page<LyOrderFlightRecord> findAllByStatusIsNull(PageRequest pageResult);
|
||||||
|
|
||||||
|
@Modifying
|
||||||
|
@Query("UPDATE ly_order_flight_record l SET l.status = 1 WHERE l.status IS NULL")
|
||||||
|
void updateStatusByNullStatus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 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.jdbc.repository.query.Query;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
@ -14,4 +18,10 @@ import java.util.List;
|
||||||
public interface JdbcLyOrderHotelRecord extends CrudRepository<LyOrderHotelRecord, Long> {
|
public interface JdbcLyOrderHotelRecord extends CrudRepository<LyOrderHotelRecord, Long> {
|
||||||
@Query(value = "SELECT bill_order_no FROM ly_order_hotel_record WHERE enter_account BETWEEN :beginDate AND :endDate")
|
@Query(value = "SELECT bill_order_no FROM ly_order_hotel_record WHERE enter_account BETWEEN :beginDate AND :endDate")
|
||||||
List<String> queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
List<String> queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
||||||
|
|
||||||
|
Page<LyOrderHotelRecord> findAllByStatusIsNull(PageRequest pageResult);
|
||||||
|
|
||||||
|
@Modifying
|
||||||
|
@Query("UPDATE ly_order_hotel_record l SET l.status = 1 WHERE l.status IS NULL")
|
||||||
|
void updateStatusByNullStatus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package com.chint.infrastructure.repository.jdbc;
|
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 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.jdbc.repository.query.Query;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
@ -14,4 +17,10 @@ import java.util.List;
|
||||||
public interface JdbcLyOrderTrainRecord extends CrudRepository<LyOrderTrainRecord, Long> {
|
public interface JdbcLyOrderTrainRecord extends CrudRepository<LyOrderTrainRecord, Long> {
|
||||||
@Query(value = "SELECT bill_order_no FROM ly_order_train_record WHERE enter_account BETWEEN :beginDate AND :endDate")
|
@Query(value = "SELECT bill_order_no FROM ly_order_train_record WHERE enter_account BETWEEN :beginDate AND :endDate")
|
||||||
List<String> queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
List<String> queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
||||||
|
|
||||||
|
Page<LyOrderTrainRecord> findAllByStatusIsNull(PageRequest pageResult);
|
||||||
|
|
||||||
|
@Modifying
|
||||||
|
@Query("UPDATE ly_order_train_record l SET l.status = 1 WHERE l.status IS NULL")
|
||||||
|
void updateStatusByNullStatus();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue