This commit is contained in:
Superdandan 2024-04-08 22:21:31 +08:00
parent afd80ca727
commit ba6c824fd0
3 changed files with 33 additions and 5 deletions

View File

@ -1,5 +1,8 @@
package com.chint.application.in; package com.chint.application.in;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.order.RouteRequest;
import com.chint.domain.repository.RouteRepository;
import com.chint.domain.service.RouteRequestDomainService; import com.chint.domain.service.RouteRequestDomainService;
import com.chint.domain.value_object.SyncLegData; import com.chint.domain.value_object.SyncLegData;
import com.chint.infrastructure.util.Result; import com.chint.infrastructure.util.Result;
@ -11,6 +14,10 @@ import org.springframework.web.bind.annotation.RequestBody;
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 javax.swing.*;
import java.util.List;
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS; import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
@RestController @RestController
@ -20,21 +27,37 @@ public class RouteRequestController {
@Autowired @Autowired
private RouteRequestDomainService routeRequestDomainService; private RouteRequestDomainService routeRequestDomainService;
@Autowired
private RouteRepository routeRepository;
@Transactional @Transactional
@ApiOperation("同步行程规划单到差旅平台") @ApiOperation("同步行程规划单到差旅平台")
@PostMapping("/sync/whole") @PostMapping("/sync")
public Result<String> syncRouterOrder(@RequestBody SyncLegData syncLegData) { public Result<String> syncRouterOrder(@RequestBody SyncLegData syncLegData) {
routeRequestDomainService.syncRouteRequestToSupplier(syncLegData); routeRequestDomainService.syncRouteRequestToSupplier(syncLegData);
return Result.Success(SUCCESS); return Result.Success(SUCCESS);
} }
@Transactional
@ApiOperation("查询差旅申请单")
@PostMapping("/query")
public Result<List<RouteRequest>> queryByRouterId(@RequestBody SyncLegData syncLegData) {
RouteOrder routeOrder = routeRepository.queryById(syncLegData.getRouteId());
List<RouteRequest> routeRequestList = routeOrder.getRouteRequestList();
routeRequestList.forEach(RouteRequest::reloadStatus);
return Result.Success(SUCCESS, routeRequestList);
}
@Transactional @Transactional
@ApiOperation("取消行程规划单到差旅平台") @ApiOperation("取消行程规划单到差旅平台")
@PostMapping("/sync/whole") @PostMapping("/cancel")
public Result<String> cancelWholeRouterOrder(@RequestBody SyncLegData syncLegData) { public Result<String> cancelWholeRouterOrder(@RequestBody SyncLegData syncLegData) {
routeRequestDomainService.cancelRouteRequest(syncLegData); routeRequestDomainService.cancelRouteRequest(syncLegData);
return Result.Success(SUCCESS); return Result.Success(SUCCESS);
} }
} }

View File

@ -17,5 +17,6 @@ public interface OrderDetailFactory {
TrainOrderDetail buildTrainWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional<OrderDetail> orderDetail); TrainOrderDetail buildTrainWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional<OrderDetail> orderDetail);
HotelOrderDetail buildHotelWithRouteOrderAndOrderDetail(RouteOrder routeOrder, OrderDetail orderDetail); HotelOrderDetail buildHotelWithRouteOrderAndOrderDetail(RouteOrder routeOrder, OrderDetail orderDetail);
CarOrderDetail buildCarWithRouteOrderAndOrderDetail(RouteOrder routeOrder, OrderDetail orderDetail); CarOrderDetail buildCarWithRouteOrderAndOrderDetail(RouteOrder routeOrder, OrderDetail orderDetail);
} }

View File

@ -11,6 +11,7 @@ import com.chint.domain.repository.LocationRepository;
import com.chint.domain.repository.RouteRepository; import com.chint.domain.repository.RouteRepository;
import com.chint.domain.repository.UserRepository; import com.chint.domain.repository.UserRepository;
import com.chint.domain.service.OrderDetailDomainService; import com.chint.domain.service.OrderDetailDomainService;
import com.chint.domain.service.RouteRequestDomainService;
import com.chint.infrastructure.repository.jdbc.JdbcCtripHotelOrderDetailRepository; import com.chint.infrastructure.repository.jdbc.JdbcCtripHotelOrderDetailRepository;
import com.chint.infrastructure.util.DateTimeUtil; import com.chint.infrastructure.util.DateTimeUtil;
import com.chint.interfaces.rest.user.UserHttpRequest; import com.chint.interfaces.rest.user.UserHttpRequest;
@ -42,6 +43,9 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
@Autowired @Autowired
private UserHttpRequest userHttpRequest; private UserHttpRequest userHttpRequest;
@Autowired
private RouteRequestDomainService routeRequestDomainService;
private String getBeLongSysType(String sysCode) { private String getBeLongSysType(String sysCode) {
String res = null; String res = null;
if (sysCode != null) { if (sysCode != null) {
@ -85,7 +89,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) { public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) {
CTripCarRecord cTripCarRecord = (CTripCarRecord) orderCarRecordData; CTripCarRecord cTripCarRecord = (CTripCarRecord) orderCarRecordData;
String routeOrderNo = cTripCarRecord.getRouteOrderNo(); String routeOrderNo = cTripCarRecord.getRouteOrderNo();
Optional<RouteOrder> byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo)); Optional<RouteOrder> byOrderNo = Optional.ofNullable(routeRequestDomainService.getRouteOrder(routeOrderNo));
OrderCarRecord orderCarRecord = buildWithRecord(cTripCarRecord) OrderCarRecord orderCarRecord = buildWithRecord(cTripCarRecord)
.carRecord(); .carRecord();
CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase(); CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase();
@ -241,7 +245,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo(); CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo();
CTripFlightTripInfo cTripFlightTripInfo = cTripFlightRecord.getCTripFlightTripInfo(); CTripFlightTripInfo cTripFlightTripInfo = cTripFlightRecord.getCTripFlightTripInfo();
String routeOrderNo = cTripFlightRecord.getRouteOrderNo(); String routeOrderNo = cTripFlightRecord.getRouteOrderNo();
Optional<RouteOrder> byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo)); Optional<RouteOrder> byOrderNo = Optional.ofNullable(routeRequestDomainService.getRouteOrder(routeOrderNo));
OrderFlightRecord orderFlightRecord = buildWithRecord(cTripFlightRecord) OrderFlightRecord orderFlightRecord = buildWithRecord(cTripFlightRecord)
.flightRecord(); .flightRecord();
@ -413,7 +417,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
CTripHotelRecord cTripHotelRecord = (CTripHotelRecord) orderHotelRecordData; CTripHotelRecord cTripHotelRecord = (CTripHotelRecord) orderHotelRecordData;
CTripHotelOrderDetail cTripHotelOrderDetail = cTripHotelRecord.getCTripHotelOrderDetail(); CTripHotelOrderDetail cTripHotelOrderDetail = cTripHotelRecord.getCTripHotelOrderDetail();
String routeOrderNo = cTripHotelRecord.getRouteOrderNo(); String routeOrderNo = cTripHotelRecord.getRouteOrderNo();
Optional<RouteOrder> byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo)); Optional<RouteOrder> byOrderNo = Optional.ofNullable(routeRequestDomainService.getRouteOrder(routeOrderNo));
OrderHotelRecord orderHotelRecord = buildWithRecord(cTripHotelRecord) OrderHotelRecord orderHotelRecord = buildWithRecord(cTripHotelRecord)
.hotelRecord(); .hotelRecord();