备份修改的优化结算查询的代码
This commit is contained in:
parent
4fbcbd779a
commit
37af34dc63
|
@ -1,6 +1,5 @@
|
|||
package com.chint.application.services.login;
|
||||
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Optional;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.chint.application.services.login;
|
||||
|
||||
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.exceptions.AuthException;
|
||||
import com.chint.domain.exceptions.SSOLoginException;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.net.URISyntaxException;
|
|||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.AuthMessageConstant.AUTHENTICATION_FAILED;
|
||||
import static com.chint.infrastructure.constant.BPMConstant.AN_FSSC;
|
||||
|
||||
@Component
|
||||
public class ANFeiShuLoginStrategy implements LoginStrategy {
|
||||
|
|
|
@ -21,10 +21,9 @@ import java.net.URISyntaxException;
|
|||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.AuthMessageConstant.AUTHENTICATION_FAILED;
|
||||
import static com.chint.infrastructure.constant.BPMConstant.AN_FSSC;
|
||||
|
||||
@Component
|
||||
public class FeishuLoginStrategy implements LoginStrategy {
|
||||
public class FeishuLoginStrategy extends PailaLoginStrategy implements LoginStrategy {
|
||||
|
||||
@Value("${feishu.base-url}")
|
||||
private String feishuBaseUrl;
|
||||
|
|
|
@ -74,8 +74,6 @@ public class PailaMobileLoginStrategy implements LoginStrategy {
|
|||
|
||||
@Override
|
||||
public String getUserInfo(String accessToken) {
|
||||
|
||||
|
||||
List<NameValuePair> userInfoParams = Collections.singletonList(
|
||||
new BasicNameValuePair("access_token", accessToken)
|
||||
);
|
||||
|
|
|
@ -576,5 +576,18 @@ public class RouteOrder implements Serializable {
|
|||
return routeOrderDetail;
|
||||
}
|
||||
|
||||
|
||||
public boolean checkIfMine(String routeRequestNo) {
|
||||
if (routeRequestNo == null || routeRequestNo.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (routeRequestNo.equals(this.routeOrderNo)) {
|
||||
return true;
|
||||
}
|
||||
for (RouteRequest routeRequest : this.getRouteRequestList()) {
|
||||
if (routeRequest.getRouteRequestNo().equals(routeRequestNo)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.chint.domain.factoriy.order_record;
|
||||
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
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;
|
||||
|
@ -9,6 +10,8 @@ import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripCa
|
|||
import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderResponse;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.BelongSystemConstant.TRAVAL_SYS_TYPE_CTRIP;
|
||||
|
||||
|
||||
|
@ -44,4 +47,25 @@ public class AmapOrderRecordExtensionFactory implements OrderRecordExtensionFact
|
|||
public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData, RouteOrder routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData, RouteOrder routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData, RouteOrder routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData, RouteOrder routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -717,6 +717,25 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
return orderHotelRecord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData, RouteOrder routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData, RouteOrder routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData, RouteOrder routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData, RouteOrder routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getCustomCode(String name) {
|
||||
UserCustomCode userCustomCode = userCustomCodeRepository.
|
||||
|
|
|
@ -89,6 +89,27 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
return orderHotelRecord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData, RouteOrder routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData, RouteOrder routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData, RouteOrder routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData, RouteOrder routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData) {
|
||||
OrderTrainRecord orderTrainRecord = new OrderTrainRecord();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.chint.domain.factoriy.order_record;
|
||||
|
||||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
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;
|
||||
|
@ -8,6 +8,7 @@ import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
|
|||
|
||||
public interface OrderRecordExtensionFactory {
|
||||
|
||||
|
||||
OrderCarRecord createCarOrderRecord(Object orderCarRecordData);
|
||||
|
||||
OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData);
|
||||
|
@ -16,4 +17,11 @@ public interface OrderRecordExtensionFactory {
|
|||
|
||||
OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData);
|
||||
|
||||
OrderCarRecord createCarOrderRecord(Object orderCarRecordData, RouteOrder routeOrder);
|
||||
|
||||
OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData, RouteOrder routeOrder);
|
||||
|
||||
OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData, RouteOrder routeOrder);
|
||||
|
||||
OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData, RouteOrder routeOrder);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ public interface OrderCarRecordRepository {
|
|||
|
||||
Optional<OrderCarRecord> findByDetailId(String detailId);
|
||||
|
||||
List<OrderCarRecord> findByDetailIdIn(List<String> detailIdList);
|
||||
|
||||
PageResult<OrderCarRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime,
|
||||
Integer pageSize, Integer pageNum ,String systemType);
|
||||
PageResult<OrderCarRecord> findBySystemTypeAndLastMonth(Integer pageSize,
|
||||
|
|
|
@ -13,6 +13,7 @@ public interface OrderFlightRecordRepository {
|
|||
List<OrderFlightRecord> saveAll(List<OrderFlightRecord> orderFlightRecordList);
|
||||
|
||||
Optional<OrderFlightRecord> findByDetailId(String detailId);
|
||||
List<OrderFlightRecord> findByDetailIdIn(List<String> detailId);
|
||||
|
||||
PageResult<OrderFlightRecord> findByUpdateDataTime(LocalDateTime startTime,
|
||||
LocalDateTime endTime,
|
||||
|
|
|
@ -13,6 +13,7 @@ public interface OrderHotelRecordRepository {
|
|||
List<OrderHotelRecord> saveAll(List<OrderHotelRecord> orderHotelRecordList);
|
||||
|
||||
Optional<OrderHotelRecord> findByDetailId(String detailId);
|
||||
List<OrderHotelRecord> findByDetailIdIn(List<String> detailIds);
|
||||
|
||||
PageResult<OrderHotelRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime,
|
||||
Integer pageSize, Integer pageNum, String systemType);
|
||||
|
|
|
@ -16,6 +16,8 @@ public interface OrderTrainRecordRepository {
|
|||
|
||||
Optional<OrderTrainRecord> findByDetailId(String detailId);
|
||||
|
||||
List<OrderTrainRecord> findByDetailIdIn(List<String> detailIds);
|
||||
|
||||
PageResult<OrderTrainRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime,
|
||||
Integer pageSize, Integer pageNum ,String systemType);
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ import java.util.List;
|
|||
public interface RouteRepository {
|
||||
RouteOrder queryById(Long orderId);
|
||||
|
||||
List<RouteOrder> queryByIdIn(List<Long> routeIds);
|
||||
|
||||
List<RouteOrder> queryAllInOneDayAndEffective(LocalDateTime start, LocalDateTime end);
|
||||
|
||||
void deleteById(Long orderId);
|
||||
|
|
|
@ -3,6 +3,10 @@ package com.chint.domain.repository;
|
|||
|
||||
import com.chint.domain.aggregates.order.RouteRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface RouteRequestRepository {
|
||||
RouteRequest findByRouteRequestNo(String routeRequestNo);
|
||||
|
||||
List<RouteRequest> findByRouteRequestNoIn(List<String> routeRequestNoList);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,9 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL;
|
||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
||||
|
@ -86,32 +88,77 @@ public class OrderDetailDomainService {
|
|||
}
|
||||
|
||||
public List<OrderCarRecord> saveCarOrderRecordBatch(List<OrderCarRecord> orderCarRecordList) {
|
||||
//如果发现唯一键已经存在, 那么就做更新处理
|
||||
orderCarRecordList.forEach(needSave-> orderCarRecordRepository
|
||||
.findByDetailId(needSave.getDetailId())
|
||||
.ifPresent(it->
|
||||
needSave.setId(it.getId())));
|
||||
List<String> detailIds = orderCarRecordList.stream().map(OrderCarRecord::getDetailId)
|
||||
.toList();
|
||||
List<OrderCarRecord> byDetailIdIn = orderCarRecordRepository.findByDetailIdIn(detailIds);
|
||||
// 使用Map来映射detailId与对应的OrderCarRecord
|
||||
Map<String, OrderCarRecord> idToExistingRecord = byDetailIdIn.stream()
|
||||
.collect(Collectors.toMap(OrderCarRecord::getDetailId, record -> record));
|
||||
// 遍历提交的list,更新或准备新创建的记录
|
||||
for (OrderCarRecord submittedRecord : orderCarRecordList) {
|
||||
OrderCarRecord existingRecord = idToExistingRecord.get(submittedRecord.getDetailId());
|
||||
if (existingRecord != null) {
|
||||
// 如果记录已存在,则更新它的ID以进行更新操作
|
||||
submittedRecord.setId(existingRecord.getId());
|
||||
}
|
||||
}
|
||||
return orderCarRecordRepository.saveAll(orderCarRecordList);
|
||||
}
|
||||
public List<OrderFlightRecord> saveFlightOrderRecordBatch(List<OrderFlightRecord> orderFlightRecordList) {
|
||||
orderFlightRecordList.forEach(needSave-> orderFlightRecordRepository
|
||||
.findByDetailId(needSave.getDetailId())
|
||||
.ifPresent(it->
|
||||
needSave.setId(it.getId())));
|
||||
List<String> detailIds = orderFlightRecordList.stream().map(OrderFlightRecord::getDetailId)
|
||||
.toList();
|
||||
List<OrderFlightRecord> byDetailIdIn = orderFlightRecordRepository.findByDetailIdIn(detailIds);
|
||||
|
||||
// 使用Map来映射detailId与对应的OrderFlightRecord
|
||||
Map<String, OrderFlightRecord> idToExistingRecord = byDetailIdIn.stream()
|
||||
.collect(Collectors.toMap(OrderFlightRecord::getDetailId, record -> record));
|
||||
|
||||
// 遍历提交的list,更新或准备新创建的记录
|
||||
for (OrderFlightRecord submittedRecord : orderFlightRecordList) {
|
||||
OrderFlightRecord existingRecord = idToExistingRecord.get(submittedRecord.getDetailId());
|
||||
if (existingRecord != null) {
|
||||
// 如果记录已存在,则更新它的ID以进行更新操作
|
||||
submittedRecord.setId(existingRecord.getId());
|
||||
}
|
||||
}
|
||||
return orderFlightRecordRepository.saveAll(orderFlightRecordList);
|
||||
}
|
||||
public List<OrderTrainRecord> saveTrainOrderRecordBatch(List<OrderTrainRecord> orderTrainRecordList) {
|
||||
orderTrainRecordList.forEach(needSave-> orderTrainRecordRepository
|
||||
.findByDetailId(needSave.getDetailId())
|
||||
.ifPresent(it->
|
||||
needSave.setId(it.getId())));
|
||||
List<String> detailIds = orderTrainRecordList.stream().map(OrderTrainRecord::getDetailId)
|
||||
.toList();
|
||||
List<OrderTrainRecord> byDetailIdIn = orderTrainRecordRepository.findByDetailIdIn(detailIds);
|
||||
|
||||
// 使用Map来映射detailId与对应的OrderFlightRecord
|
||||
Map<String, OrderTrainRecord> idToExistingRecord = byDetailIdIn.stream()
|
||||
.collect(Collectors.toMap(OrderTrainRecord::getDetailId, record -> record));
|
||||
|
||||
// 遍历提交的list,更新或准备新创建的记录
|
||||
for (OrderTrainRecord submittedRecord : orderTrainRecordList) {
|
||||
OrderTrainRecord existingRecord = idToExistingRecord.get(submittedRecord.getDetailId());
|
||||
if (existingRecord != null) {
|
||||
// 如果记录已存在,则更新它的ID以进行更新操作
|
||||
submittedRecord.setId(existingRecord.getId());
|
||||
}
|
||||
}
|
||||
return orderTrainRecordRepository.saveAll(orderTrainRecordList);
|
||||
}
|
||||
public List<OrderHotelRecord> saveHotelOrderRecordBatch(List<OrderHotelRecord> orderHotelRecordList) {
|
||||
orderHotelRecordList.forEach(needSave-> orderHotelRecordRepository
|
||||
.findByDetailId(needSave.getDetailId())
|
||||
.ifPresent(it->
|
||||
needSave.setId(it.getId())));
|
||||
List<String> detailIds = orderHotelRecordList.stream().map(OrderHotelRecord::getDetailId)
|
||||
.toList();
|
||||
List<OrderHotelRecord> byDetailIdIn = orderHotelRecordRepository.findByDetailIdIn(detailIds);
|
||||
|
||||
// 使用Map来映射detailId与对应的OrderFlightRecord
|
||||
Map<String, OrderHotelRecord> idToExistingRecord = byDetailIdIn.stream()
|
||||
.collect(Collectors.toMap(OrderHotelRecord::getDetailId, record -> record));
|
||||
|
||||
// 遍历提交的list,更新或准备新创建的记录
|
||||
for (OrderHotelRecord submittedRecord : orderHotelRecordList) {
|
||||
OrderHotelRecord existingRecord = idToExistingRecord.get(submittedRecord.getDetailId());
|
||||
if (existingRecord != null) {
|
||||
// 如果记录已存在,则更新它的ID以进行更新操作
|
||||
submittedRecord.setId(existingRecord.getId());
|
||||
}
|
||||
}
|
||||
return orderHotelRecordRepository.saveAll(orderHotelRecordList);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import com.chint.domain.value_object.SyncLegData;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
@ -221,4 +220,22 @@ public class RouteRequestDomainService {
|
|||
}
|
||||
return routeRepository.queryById(routeRequest.getRouteId());
|
||||
}
|
||||
|
||||
public List<RouteOrder> getRouteOrder(List<String> journeyNoList) {
|
||||
//先通过
|
||||
List<RouteRequest> byRouteRequestNoIn = routeRequestRepository.findByRouteRequestNoIn(journeyNoList);
|
||||
List<String> existedRouteRequestNo = byRouteRequestNoIn.stream().map(RouteRequest::getRouteRequestNo).toList();
|
||||
List<String> needQueryFromDB = journeyNoList
|
||||
.stream()
|
||||
.filter(journeyNo -> !existedRouteRequestNo.contains(journeyNo))
|
||||
.toList();
|
||||
List<Long> routIds = byRouteRequestNoIn.stream().map(RouteRequest::getRouteId).toList();
|
||||
List<RouteOrder> routeOrders = routeRepository.queryByIdIn(routIds);
|
||||
if (!needQueryFromDB.isEmpty()) {
|
||||
List<RouteOrder> routeOrderListFromDB = needQueryFromDB.stream().map(routeRepository::findByOrderNo).toList();
|
||||
routeOrders.addAll(routeOrderListFromDB);
|
||||
return routeOrders;
|
||||
}
|
||||
return routeOrders;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,4 +200,12 @@ public class RouteCacheService {
|
|||
routeCacheManage.getRouteIdsByEmployeeNo(userId, null, newRouteIds);
|
||||
}
|
||||
}
|
||||
|
||||
public List<RouteOrder> queryByIdIn(List<Long> routeIds) {
|
||||
if (routeIds != null && !routeIds.isEmpty()) {
|
||||
return routeCacheManage.getRouteListByIds(routeIds);
|
||||
} else {
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,11 @@ public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository {
|
|||
return orderCarRecordRepository.findByDetailId(detailId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderCarRecord> findByDetailIdIn(List<String> detailIdList) {
|
||||
return orderCarRecordRepository.findByDetailIdIn(detailIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OrderCarRecord> findByUpdateDataTime(LocalDateTime startTime,
|
||||
LocalDateTime endTime,
|
||||
|
|
|
@ -46,6 +46,11 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit
|
|||
return jdbcOrderFlightRecordRepository.findByDetailId(detailId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderFlightRecord> findByDetailIdIn(List<String> detailId) {
|
||||
return jdbcOrderFlightRecordRepository.findByDetailIdIn(detailId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OrderFlightRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) {
|
||||
PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending());
|
||||
|
|
|
@ -2,8 +2,6 @@ package com.chint.infrastructure.repository;
|
|||
|
||||
import com.chint.application.dtos.OrderRecordExtensionParam;
|
||||
import com.chint.application.dtos.OrderRecordQueryDTO;
|
||||
import com.chint.application.queryies.util.QueryUtil;
|
||||
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
||||
import com.chint.domain.repository.OrderHotelRecordRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository;
|
||||
|
@ -47,6 +45,11 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor
|
|||
return jdbcOrderHotelRecordRepository.findByDetailId(detailId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderHotelRecord> findByDetailIdIn(List<String> detailIds) {
|
||||
return jdbcOrderHotelRecordRepository.findByDetailIdIn(detailIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OrderHotelRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) {
|
||||
PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending());
|
||||
|
|
|
@ -44,6 +44,11 @@ public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepositor
|
|||
return jdbcOrderTrainRecordRepository.findByDetailId(detailId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderTrainRecord> findByDetailIdIn(List<String> detailIds) {
|
||||
return jdbcOrderTrainRecordRepository.findByDetailIdIn(detailIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OrderTrainRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) {
|
||||
PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending());
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.chint.infrastructure.repository.jdbc.JdbcRouteRepository;
|
|||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
@ -16,6 +15,7 @@ import org.springframework.stereotype.Repository;
|
|||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Repository
|
||||
public class RouteRepositoryImpl implements RouteRepository {
|
||||
|
@ -32,6 +32,29 @@ public class RouteRepositoryImpl implements RouteRepository {
|
|||
return routeCacheService.getRouteById(orderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RouteOrder> queryByIdIn(List<Long> routeIds) {
|
||||
List<RouteOrder> routeOrders = new java.util.ArrayList<>(routeCacheService.queryByIdIn(routeIds)
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.toList());
|
||||
List<Long> existedRouteIds = routeOrders
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(RouteOrder::getRouteId)
|
||||
.toList();
|
||||
List<Long> needQueryFromDB = routeIds
|
||||
.stream()
|
||||
.filter(id -> !existedRouteIds.contains(id))
|
||||
.toList();
|
||||
List<RouteOrder> byRouteIdIn = jdbcRouteRepository
|
||||
.findByRouteIdIn(needQueryFromDB);
|
||||
//将查询出来的行程规划单缓存到数据库
|
||||
byRouteIdIn.forEach(route -> routeCacheService.cacheRouteOrder(route));
|
||||
routeOrders.addAll(byRouteIdIn);
|
||||
return routeOrders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RouteOrder> queryAllInOneDayAndEffective(LocalDateTime start, LocalDateTime end) {
|
||||
return jdbcRouteRepository.findByCreateTimeBetweenAndApproveOrderNo_ActualOrderNoNotNull(start, end);
|
||||
|
@ -64,7 +87,6 @@ public class RouteRepositoryImpl implements RouteRepository {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public RouteOrder findByOrderNo(String orderNo) {
|
||||
return routeCacheService.getRouteByRouteOrderNo(orderNo);
|
||||
|
|
|
@ -7,6 +7,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public class RouteRequestRepositoryImpl implements RouteRequestRepository {
|
||||
|
||||
|
@ -18,4 +20,8 @@ public class RouteRequestRepositoryImpl implements RouteRequestRepository {
|
|||
public RouteRequest findByRouteRequestNo(String routeRequestNo) {
|
||||
return jdbcRouteRequestRepository.findByRouteRequestNo(routeRequestNo);
|
||||
}
|
||||
@Override
|
||||
public List<RouteRequest> findByRouteRequestNoIn(List<String> routeRequestNoList){
|
||||
return jdbcRouteRequestRepository.findByRouteRequestNoIn(routeRequestNoList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.springframework.data.repository.CrudRepository;
|
|||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -27,6 +28,8 @@ public interface JdbcOrderCarRecordRepository extends CrudRepository<OrderCarRec
|
|||
LocalDateTime updateDataTime4,
|
||||
Pageable pageable);
|
||||
|
||||
List<OrderCarRecord> findByDetailIdIn(Collection<String> detailId);
|
||||
|
||||
|
||||
@Query("""
|
||||
select r1.* from order_car_record r1
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.springframework.data.repository.CrudRepository;
|
|||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -26,6 +27,7 @@ public interface JdbcOrderFlightRecordRepository extends CrudRepository<OrderFli
|
|||
LocalDateTime updateDataTime4,
|
||||
Pageable pageable);
|
||||
|
||||
List<OrderFlightRecord> findByDetailIdIn(Collection<String> detailId);
|
||||
|
||||
@Query("""
|
||||
select r1.* from order_flight_record r1
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
@ -9,6 +8,7 @@ import org.springframework.data.repository.CrudRepository;
|
|||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -28,6 +28,8 @@ public interface JdbcOrderHotelRecordRepository extends CrudRepository<OrderHote
|
|||
LocalDateTime updateDataTime4,
|
||||
Pageable pageable);
|
||||
|
||||
List<OrderHotelRecord> findByDetailIdIn(Collection<String> detailId);
|
||||
|
||||
@Query("""
|
||||
select r1.* from order_hotel_record r1
|
||||
left join order_detail o1 on r1.order_detail_id = o1.order_id
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.springframework.data.repository.CrudRepository;
|
|||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -16,6 +17,7 @@ public interface JdbcOrderTrainRecordRepository extends CrudRepository<OrderTrai
|
|||
Optional<OrderTrainRecord> findByDetailId(String detailId);
|
||||
|
||||
Page<OrderTrainRecord> findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable);
|
||||
|
||||
Page<OrderTrainRecord> findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(String belongSysType, String accountPeriod, String accountPeriod2, Pageable pageable);
|
||||
|
||||
Page<OrderTrainRecord> findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType,
|
||||
|
@ -25,6 +27,7 @@ public interface JdbcOrderTrainRecordRepository extends CrudRepository<OrderTrai
|
|||
LocalDateTime updateDataTime4,
|
||||
Pageable pageable);
|
||||
|
||||
List<OrderTrainRecord> findByDetailIdIn(Collection<String> detailId);
|
||||
|
||||
@Query("""
|
||||
select r1.* from order_train_record r1
|
||||
|
|
|
@ -43,6 +43,8 @@ public interface JdbcRouteRepository extends CrudRepository<RouteOrder, Long> {
|
|||
|
||||
Page<RouteOrder> findAllBy(PageRequest pageResult);
|
||||
|
||||
List<RouteOrder> findByRouteIdIn(List<Long> routeIds);
|
||||
|
||||
@Query("""
|
||||
select * from route_order r1 left join route_custom_extension_field r2 on r1.route_id = r2.route_id where
|
||||
""")
|
||||
|
|
|
@ -4,8 +4,11 @@ import com.chint.domain.aggregates.order.RouteRequest;
|
|||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface JdbcRouteRequestRepository extends CrudRepository<RouteRequest, Long> {
|
||||
RouteRequest findByRouteRequestNo(String routeRequestNo);
|
||||
|
||||
List<RouteRequest> findByRouteRequestNoIn(Collection<String> routeRequestNo);
|
||||
}
|
||||
|
|
|
@ -824,7 +824,7 @@ public class LYTest {
|
|||
|
||||
@Test
|
||||
void searchTrain() {
|
||||
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24032167485837934");
|
||||
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24050872686468359");
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(trainOrderDetail);
|
||||
System.out.println(json);
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.chint.domain.aggregates.location.basedata.CountryLevelInfoEntity;
|
|||
import com.chint.domain.aggregates.location.basedata.PrefectureLevelCityInfoEntity;
|
||||
import com.chint.domain.aggregates.order.Leg;
|
||||
import com.chint.domain.aggregates.order.Location;
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHotelRecord;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.*;
|
||||
|
@ -158,6 +159,12 @@ class RouteApplicationTests {
|
|||
private OrgRequest orgRequest;
|
||||
|
||||
|
||||
@Test
|
||||
void testQueryIdsFromCache(){
|
||||
List<RouteOrder> routeOrders = routeRepository.queryByIdIn(List.of(11822L, 11823L, 11824L, 11825L, 11826L));
|
||||
System.out.println(routeOrders);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSyncOrg(){
|
||||
orgRequest.syncAllOrg();
|
||||
|
@ -295,7 +302,7 @@ class RouteApplicationTests {
|
|||
|
||||
@Test
|
||||
void loginSignProd() {
|
||||
String sfno = "210303016";
|
||||
String sfno = "181008027";
|
||||
String syscode = "FSSC";
|
||||
String billcode = "CLSQ240225000099";
|
||||
String companycode = "正泰集团股份有限公司";
|
||||
|
@ -1021,9 +1028,7 @@ class RouteApplicationTests {
|
|||
|
||||
@Test
|
||||
void deleteByOrderId() {
|
||||
orderDetailRepository.deleteById(1440L);
|
||||
orderDetailRepository.deleteById(1441L);
|
||||
orderDetailRepository.deleteById(1448L);
|
||||
orderDetailRepository.deleteById(3037L);
|
||||
}
|
||||
|
||||
// @Test
|
||||
|
|
Loading…
Reference in New Issue