fix:修复高度差旅申请单地点信息同步bug,订单详情深拷贝方法bug,以及其他问题

This commit is contained in:
lulz1 2024-06-01 15:47:13 +08:00
parent 833f0875c3
commit a25cb67e7b
6 changed files with 51 additions and 31 deletions

View File

@ -230,34 +230,48 @@ public class OrderDetail implements Serializable {
copyOrderDetail.setOtherOrderDetail(copiedOtherOrderDetail);
// 深拷贝 orderEventList
List<OrderEvent> copiedOrderEventList = this.orderEventList.stream()
.map(event -> BeanUtil.copyProperties(event, OrderEvent.class))
.collect(Collectors.toList());
copyOrderDetail.setOrderEventList(copiedOrderEventList);
if(this.orderEventList != null && !this.orderEventList.isEmpty()) {
List<OrderEvent> copiedOrderEventList = this.orderEventList.stream()
.map(event -> BeanUtil.copyProperties(event, OrderEvent.class))
.collect(Collectors.toList());
copyOrderDetail.setOrderEventList(copiedOrderEventList);
}
// 深拷贝 orderCarRecordList
List<OrderCarRecord> copiedOrderCarRecordList = this.orderCarRecordList.stream()
.map(record -> BeanUtil.copyProperties(record, OrderCarRecord.class))
.collect(Collectors.toList());
copyOrderDetail.setOrderCarRecordList(copiedOrderCarRecordList);
if (this.orderCarRecordList != null && !this.orderCarRecordList.isEmpty()) {
List<OrderCarRecord> copiedOrderCarRecordList = this.orderCarRecordList.stream()
.map(record -> BeanUtil.copyProperties(record, OrderCarRecord.class))
.collect(Collectors.toList());
copyOrderDetail.setOrderCarRecordList(copiedOrderCarRecordList);
}
// 深拷贝 orderFlightRecordList
List<OrderFlightRecord> copiedOrderFlightRecordList = this.orderFlightRecordList.stream()
.map(record -> BeanUtil.copyProperties(record, OrderFlightRecord.class))
.collect(Collectors.toList());
copyOrderDetail.setOrderFlightRecordList(copiedOrderFlightRecordList);
if (this.orderFlightRecordList != null && !this.orderFlightRecordList.isEmpty()) {
List<OrderFlightRecord> copiedOrderFlightRecordList = this.orderFlightRecordList.stream()
.map(record -> BeanUtil.copyProperties(record, OrderFlightRecord.class))
.collect(Collectors.toList());
copyOrderDetail.setOrderFlightRecordList(copiedOrderFlightRecordList);
}
// 深拷贝 orderHotelRecordList
List<OrderHotelRecord> copiedOrderHotelRecordList = this.orderHotelRecordList.stream()
.map(record -> BeanUtil.copyProperties(record, OrderHotelRecord.class))
.collect(Collectors.toList());
copyOrderDetail.setOrderHotelRecordList(copiedOrderHotelRecordList);
if (this.orderHotelRecordList != null && !this.orderHotelRecordList.isEmpty()) {
List<OrderHotelRecord> copiedOrderHotelRecordList = this.orderHotelRecordList.stream()
.map(record -> BeanUtil.copyProperties(record, OrderHotelRecord.class))
.collect(Collectors.toList());
copyOrderDetail.setOrderHotelRecordList(copiedOrderHotelRecordList);
}
// 深拷贝 orderTrainRecordList
List<OrderTrainRecord> copiedOrderTrainRecordList = this.orderTrainRecordList.stream()
.map(record -> BeanUtil.copyProperties(record, OrderTrainRecord.class))
.collect(Collectors.toList());
copyOrderDetail.setOrderTrainRecordList(copiedOrderTrainRecordList);
if (this.orderTrainRecordList != null && !this.orderTrainRecordList.isEmpty()) {
List<OrderTrainRecord> copiedOrderTrainRecordList = this.orderTrainRecordList.stream()
.map(record -> BeanUtil.copyProperties(record, OrderTrainRecord.class))
.collect(Collectors.toList());
copyOrderDetail.setOrderTrainRecordList(copiedOrderTrainRecordList);
}
return copyOrderDetail;
}
}

View File

@ -31,8 +31,7 @@ import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TAXI;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TRAIN;
import static com.chint.infrastructure.constant.LegConstant.*;
import static com.chint.infrastructure.constant.RouteConstant.*;
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL;
@ -541,7 +540,7 @@ public class RouteOrder implements Serializable {
List<Leg> potentialMatches = this.legItems.stream()
.filter(leg -> {
// Skip taxi legs already handled
if (leg.getLegType().equals(LEG_TYPE_TAXI)) {
if (leg.getLegType().equals(LEG_TYPE_TAXI) || leg.getLegType().equals(LEG_TYPE_OTHER)) {
return false;
}

View File

@ -22,7 +22,6 @@ public class RouteRequestEvent extends BaseEvent implements Serializable {
private Long routeRequestId;
private Long routeRequestKey;
@Override
protected Map<Integer, String> getStatusMappings() {

View File

@ -90,6 +90,9 @@ public class LegDomainService {
public void deleteByLegNo(String legNo) {
Leg byLegNo = legRepository.findByLegNo(legNo);
if(byLegNo == null){
return;
}
RouteOrder routeOrder = routeRepository.queryById(byLegNo.getRouteId()).reloadStatus();
if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
legRepository.deleteById(byLegNo);

View File

@ -7,10 +7,7 @@ import com.chint.domain.aggregates.supplier.SupplierProductStandardLevel;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.exceptions.AuthException;
import com.chint.domain.exceptions.CommandException;
import com.chint.domain.repository.AmapPolicyRepository;
import com.chint.domain.repository.AmapRouteRelationshipRepository;
import com.chint.domain.repository.SupplierRepository;
import com.chint.domain.repository.UserRepository;
import com.chint.domain.repository.*;
import com.chint.domain.service.LegDomainService;
import com.chint.infrastructure.util.DateTimeUtil;
import com.chint.interfaces.rest.amap.AmapLocationRequest;
@ -30,6 +27,7 @@ import java.util.List;
import java.util.Optional;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TAXI;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_CITY;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP;
@Slf4j
@ -57,6 +55,7 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync {
@Autowired
private SupplierRepository supplierRepository;
private Gson gson = new Gson();
@Override
@ -142,7 +141,13 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync {
}
List<String> areaCodes = new ArrayList<>();
for (Location location : locationList) {
areaCodes.add(amapLocationRequest.getACodeByLocationName(location.getLocationName()));
if(location.getLocationType() != LOCATION_TYPE_CITY){
//如果类型不是地级市那么就从地区路径获取地级市信息
String[] split = location.getLocationPathName().split("_");
areaCodes.add(amapLocationRequest.getACodeByLocationName(split[3]));
} else {
areaCodes.add(amapLocationRequest.getACodeByLocationName(location.getLocationName()));
}
}
processContent.setValidCityList(areaCodes);

View File

@ -302,7 +302,7 @@ class RouteApplicationTests {
@Test
void loginSign() {
String sfno = "230615020";
String sfno = "230207110";
String syscode = "FSSC";
String billcode = "CLSQ240225000099";
String companycode = "正泰集团股份有限公司";
@ -359,7 +359,7 @@ class RouteApplicationTests {
@Test
void deleteOrderDetail() {
orderDetailRepository.deleteById(3128L);
orderDetailRepository.deleteById(3157L);
}
// @Test