Compare commits
3 Commits
0c7d51fdaa
...
3ec2668433
Author | SHA1 | Date |
---|---|---|
Superdandan | 3ec2668433 | |
Superdandan | fe6252d23f | |
Superdandan | ba6c824fd0 |
|
@ -42,8 +42,8 @@ public class LegRes {
|
||||||
private String originDescription;
|
private String originDescription;
|
||||||
@ApiModelProperty("目的地详细")
|
@ApiModelProperty("目的地详细")
|
||||||
private String destinationDescription;
|
private String destinationDescription;
|
||||||
private String supplier;
|
private List<String> supplierList;
|
||||||
private String supplierName;
|
private List<String> supplierNameList;
|
||||||
private Integer legStatus;
|
private Integer legStatus;
|
||||||
private String changeReason;
|
private String changeReason;
|
||||||
|
|
||||||
|
@ -85,6 +85,14 @@ public class LegRes {
|
||||||
}
|
}
|
||||||
legRes.setOriginLocation(LocationRes.copyFrom(leg.getOriginLocation()));
|
legRes.setOriginLocation(LocationRes.copyFrom(leg.getOriginLocation()));
|
||||||
legRes.setDestinationLocation(LocationRes.copyFrom(leg.getDestinationLocation()));
|
legRes.setDestinationLocation(LocationRes.copyFrom(leg.getDestinationLocation()));
|
||||||
|
|
||||||
|
if (legRes.getSupplierList() == null) {
|
||||||
|
legRes.setSupplierList(new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (legRes.getSupplierNameList() == null) {
|
||||||
|
legRes.setSupplierNameList(new ArrayList<>());
|
||||||
|
}
|
||||||
return legRes;
|
return legRes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@ package com.chint.domain.service;
|
||||||
|
|
||||||
import com.chint.application.dtos.response.LegRes;
|
import com.chint.application.dtos.response.LegRes;
|
||||||
import com.chint.domain.aggregates.order.*;
|
import com.chint.domain.aggregates.order.*;
|
||||||
import com.chint.domain.aggregates.supplier.Supplier;
|
|
||||||
import com.chint.domain.aggregates.supplier.SupplierProduct;
|
|
||||||
import com.chint.domain.exceptions.LegEventException;
|
import com.chint.domain.exceptions.LegEventException;
|
||||||
import com.chint.domain.factoriy.leg_event.LegEventFactory;
|
import com.chint.domain.factoriy.leg_event.LegEventFactory;
|
||||||
import com.chint.domain.repository.*;
|
import com.chint.domain.repository.*;
|
||||||
|
@ -12,7 +10,6 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.CommonMessageConstant.LEG_CHANGE_MAX_ERROR;
|
import static com.chint.infrastructure.constant.CommonMessageConstant.LEG_CHANGE_MAX_ERROR;
|
||||||
import static com.chint.infrastructure.constant.LegConstant.*;
|
import static com.chint.infrastructure.constant.LegConstant.*;
|
||||||
|
@ -171,6 +168,13 @@ public class LegDomainService {
|
||||||
//通过查看供应商的商品类型,来进行同步
|
//通过查看供应商的商品类型,来进行同步
|
||||||
legItems = supplierDomainService.ifCanSync(legItems, supplierName);
|
legItems = supplierDomainService.ifCanSync(legItems, supplierName);
|
||||||
|
|
||||||
|
legItems.forEach(Leg::reloadStatus);
|
||||||
|
queryLocation(legItems);
|
||||||
|
return legItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Leg> syncLegExclusive(RouteOrder routeOrder, List<Leg> legItems, String supplierName) {
|
||||||
List<Long> alreadySyncLegs = routeOrder.getRouteRequestList()
|
List<Long> alreadySyncLegs = routeOrder.getRouteRequestList()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(it -> it.reloadStatus().getStatus().equals(ROUTE_REQUEST_STATUS_SYNC))
|
.filter(it -> it.reloadStatus().getStatus().equals(ROUTE_REQUEST_STATUS_SYNC))
|
||||||
|
@ -196,7 +200,6 @@ public class LegDomainService {
|
||||||
List<Leg> res = new ArrayList<>(needSyncLegs);
|
List<Leg> res = new ArrayList<>(needSyncLegs);
|
||||||
res.addAll(belongLegsAndSync);
|
res.addAll(belongLegsAndSync);
|
||||||
res.forEach(Leg::reloadStatus);
|
res.forEach(Leg::reloadStatus);
|
||||||
queryLocation(res);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,8 +219,8 @@ public class LegDomainService {
|
||||||
.map(RouteRequestLeg::getLegId)
|
.map(RouteRequestLeg::getLegId)
|
||||||
.toList();
|
.toList();
|
||||||
if (legIds.contains(legRes.getLegId())) {
|
if (legIds.contains(legRes.getLegId())) {
|
||||||
legRes.setSupplier(routeRequest.getSupplier());
|
legRes.getSupplierList().add(routeRequest.getSupplier());
|
||||||
legRes.setSupplierName(routeRequest.getSupplierName());
|
legRes.getSupplierNameList().add(routeRequest.getSupplierName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.chint.domain.service;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.order.*;
|
import com.chint.domain.aggregates.order.*;
|
||||||
import com.chint.domain.aggregates.supplier.Supplier;
|
import com.chint.domain.aggregates.supplier.Supplier;
|
||||||
import com.chint.domain.aggregates.supplier.SupplierProduct;
|
|
||||||
import com.chint.domain.exceptions.CommandException;
|
import com.chint.domain.exceptions.CommandException;
|
||||||
import com.chint.domain.factoriy.leg_event.LegEventFactory;
|
import com.chint.domain.factoriy.leg_event.LegEventFactory;
|
||||||
import com.chint.domain.factoriy.order.RouteOrderFactory;
|
import com.chint.domain.factoriy.order.RouteOrderFactory;
|
||||||
|
@ -15,6 +14,7 @@ import com.chint.domain.value_object.SyncLegData;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -109,6 +109,7 @@ public class RouteRequestDomainService {
|
||||||
|
|
||||||
|
|
||||||
public void cancelRouteRequest(SyncLegData syncLegData) {
|
public void cancelRouteRequest(SyncLegData syncLegData) {
|
||||||
|
List<Long> legIds = syncLegData.getLegIds();
|
||||||
Long routeId = syncLegData.getRouteId();
|
Long routeId = syncLegData.getRouteId();
|
||||||
RouteOrder routeOrder = routeRepository.queryById(routeId);
|
RouteOrder routeOrder = routeRepository.queryById(routeId);
|
||||||
Optional<RouteRequest> optionalRouteRequest;
|
Optional<RouteRequest> optionalRouteRequest;
|
||||||
|
@ -138,7 +139,7 @@ public class RouteRequestDomainService {
|
||||||
if (supplierOptional.isPresent()) {
|
if (supplierOptional.isPresent()) {
|
||||||
collect = legs
|
collect = legs
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.partitioningBy(leg -> supplierDomainService.ifCanCancel(leg,it.getSupplier())));
|
.collect(Collectors.partitioningBy(leg -> supplierDomainService.ifCanCancel(leg, it.getSupplier()) || legIds.contains(leg.getLegId())));
|
||||||
List<Leg> orderedLegs = collect.get(false);
|
List<Leg> orderedLegs = collect.get(false);
|
||||||
if (!orderedLegs.isEmpty()) {
|
if (!orderedLegs.isEmpty()) {
|
||||||
it.reloadGenerateRequestLegs(orderedLegs);
|
it.reloadGenerateRequestLegs(orderedLegs);
|
||||||
|
@ -160,29 +161,6 @@ public class RouteRequestDomainService {
|
||||||
it.getRouteRequestLegList()
|
it.getRouteRequestLegList()
|
||||||
.forEach(requestLeg -> requestLeg.getLeg().addEvent(legEventFactory.creatLegEvent(LEG_EVENT_APPROVAL)));
|
.forEach(requestLeg -> requestLeg.getLeg().addEvent(legEventFactory.creatLegEvent(LEG_EVENT_APPROVAL)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map<Boolean, List<Leg>> collect = legs
|
|
||||||
// .stream()
|
|
||||||
// .collect(Collectors.partitioningBy(leg -> {
|
|
||||||
// Integer legStatus = leg.reloadStatus().getLegStatus();
|
|
||||||
// return (legStatus.equals(LEG_STATUS_ORDERED) || legStatus.equals(LEG_STATUS_PAYED) || legStatus.equals(LEG_STATUS_FINISH))
|
|
||||||
// && leg.getLegType().equals(LEG_TYPE_AIRPLANE);
|
|
||||||
// }));
|
|
||||||
|
|
||||||
// List<Leg> orderedLegs = collect.get(true);
|
|
||||||
// if (!orderedLegs.isEmpty()) {
|
|
||||||
// it.reloadGenerateRequestLegs(orderedLegs);
|
|
||||||
// syncAdapter.of(it.getSupplier()).syncRouteRequest(it);
|
|
||||||
// it.addEvent(RouteRequestEvent.sync(it.getSupplier()));
|
|
||||||
// List<Leg> notOrderLegs = collect.get(false);
|
|
||||||
// notOrderLegs.forEach(leg -> leg.addEvent(legEventFactory.creatLegEvent(LEG_EVENT_APPROVAL)));
|
|
||||||
// } else {
|
|
||||||
// it.addEvent(RouteRequestEvent.cancel(it.getSupplier()));
|
|
||||||
// getLegInfoFromRouteOrder(it, routeOrder);
|
|
||||||
// syncAdapter.of(it.getSupplier()).cancelRouteRequest(it);
|
|
||||||
// it.getRouteRequestLegList()
|
|
||||||
// .forEach(requestLeg -> requestLeg.getLeg().addEvent(legEventFactory.creatLegEvent(LEG_EVENT_APPROVAL)));
|
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
routeRepository.save(routeOrder);
|
routeRepository.save(routeOrder);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue