同步代码
This commit is contained in:
parent
5e119950e1
commit
627ff7317c
|
@ -4,12 +4,14 @@ package com.chint.application.dtos.response;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.chint.domain.aggregates.order.Leg;
|
||||
import com.chint.domain.aggregates.order.LegExtensionField;
|
||||
import com.chint.domain.aggregates.order.Location;
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import com.chint.domain.value_object.enums.CurrencyType;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -37,6 +39,8 @@ public class LegRes {
|
|||
|
||||
private CurrencyType currencyType;
|
||||
|
||||
private List<LocationRes> otherLocationList;
|
||||
|
||||
private List<OrderDetail> orderDetails; //这个属性不做持久化保存 ,根据下单事件进行获取
|
||||
|
||||
public static LegRes copyFrom(Leg leg) {
|
||||
|
@ -50,9 +54,19 @@ public class LegRes {
|
|||
legRes.setAmountType(legExtensionField.getAmountType());
|
||||
legRes.setAmountTypeName(legExtensionField.getAmountTypeName());
|
||||
legRes.setAmountTypeEnName(legExtensionField.getAmountTypeEnName());
|
||||
|
||||
if (legExtensionField.getLocationIds() != null) {
|
||||
List<LocationRes> locationResList = new ArrayList<>();
|
||||
List<Location> locationList = legExtensionField.getLocationList();
|
||||
for (Location location : locationList) {
|
||||
locationResList.add(LocationRes.copyFrom(location));
|
||||
}
|
||||
legRes.setOtherLocationList(locationResList);
|
||||
}
|
||||
}
|
||||
legRes.setOriginLocation(LocationRes.copyFrom(leg.getOriginLocation()));
|
||||
legRes.setDestinationLocation(LocationRes.copyFrom(leg.getDestinationLocation()));
|
||||
|
||||
return legRes;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class RouteOrderPageRes {
|
|||
private String amount;
|
||||
private String estimateAmount;
|
||||
private Integer orderStatus;
|
||||
private String approvalStatusCode;
|
||||
private Integer approvalStatusCode;
|
||||
private String approvalStatus;
|
||||
private String orderStatusName;
|
||||
private String startTime;
|
||||
|
|
|
@ -6,6 +6,8 @@ import org.springframework.data.annotation.Id;
|
|||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -28,6 +30,26 @@ public class LegExtensionField {
|
|||
private String estimatedAmount;
|
||||
|
||||
|
||||
public LegExtensionField addLocationIdsAsString(List<Long> locationIds) {
|
||||
this.locationIds = Arrays.toString(locationIds.toArray());
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<Long> getLocationIdsAsLong() {
|
||||
// 去除字符串开头和结尾的方括号
|
||||
this.locationIds = this.locationIds.substring(1, this.locationIds.length() - 1);
|
||||
// 根据逗号分割字符串
|
||||
String[] items = this.locationIds.split(",");
|
||||
// 创建一个Long类型的列表
|
||||
List<Long> result = new ArrayList<>();
|
||||
// 将每个分割后的字符串转换为Long并添加到列表中
|
||||
for (String item : items) {
|
||||
result.add(Long.parseLong(item.trim()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public LegExtensionField reloadStatus() {
|
||||
this.amountTypeName = translateLegOtherAmountTypeToChineseName(this.amountType);
|
||||
this.amountTypeEnName = translateLegOtherAmountTypeToEnglishName(this.amountType);
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.chint.domain.aggregates.standards;
|
|||
import java.util.HashMap;
|
||||
|
||||
public class CityTag {
|
||||
|
||||
public static final HashMap<String, String> cityMap;
|
||||
|
||||
static {
|
||||
|
|
|
@ -126,6 +126,10 @@ public class RouteLegFactory implements LegFactory {
|
|||
|
||||
private static LegExtensionField getLegExtensionField(LegData data) {
|
||||
LegExtensionFieldData legExtensionFieldData = data.getLegExtensionFieldData();
|
||||
return BeanUtil.copyProperties(legExtensionFieldData, LegExtensionField.class);
|
||||
LegExtensionField legExtensionField = BeanUtil.copyProperties(legExtensionFieldData, LegExtensionField.class);
|
||||
if (legExtensionFieldData.getLocationIds() != null && !legExtensionFieldData.getLocationIds().isEmpty()) {
|
||||
legExtensionField.addLocationIdsAsString(legExtensionFieldData.getLocationIds());
|
||||
}
|
||||
return legExtensionField;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,4 +22,6 @@ public interface LocationRepository {
|
|||
List<Location> findByName(String localName);
|
||||
|
||||
String locationPathByName(String localName);
|
||||
|
||||
List<Location> findByNameList(List<Long> locationIds);
|
||||
}
|
|
@ -68,6 +68,12 @@ public class OrderDomainService {
|
|||
|
||||
public List<Leg> queryLocation(List<Leg> list) {
|
||||
list.forEach(leg -> {
|
||||
LegExtensionField legExtensionField = leg.getLegExtensionField();
|
||||
if (legExtensionField != null && legExtensionField.getLocationIds() != null) {
|
||||
List<Long> locationIdsAsLong = legExtensionField.getLocationIdsAsLong();
|
||||
List<Location> byNameList = locationRepository.findByNameList(locationIdsAsLong);
|
||||
legExtensionField.setLocationList(byNameList);
|
||||
}
|
||||
leg.setOriginLocation(locationRepository.findByLocationId(leg.getOriginId()));
|
||||
leg.setDestinationLocation(locationRepository.findByLocationId(leg.getDestinationId()));
|
||||
});
|
||||
|
@ -122,7 +128,8 @@ public class OrderDomainService {
|
|||
.productType(orderDetail.getProductType())
|
||||
.extensionData(orderDetail.getExtensionDataByProductType())
|
||||
.sendToQueue();
|
||||
};
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
@ListenTo(command = "BPMAuditCommand", order = 0)
|
||||
|
|
|
@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class LegExtensionFieldData {
|
||||
@ApiModelProperty("其他费用类型")
|
||||
|
@ -16,4 +18,6 @@ public class LegExtensionFieldData {
|
|||
private String destinationDescription;
|
||||
@ApiModelProperty("预估金额")
|
||||
private String estimatedAmount;
|
||||
@ApiModelProperty("地理位置id列表")
|
||||
private List<Long> locationIds;
|
||||
}
|
||||
|
|
|
@ -76,4 +76,9 @@ public class LocationRepositoryImpl implements LocationRepository {
|
|||
Location byLocationName = jdbcLocationRepository.findByLocationName(localName);
|
||||
return byLocationName.getLocationPathName().replace("_", "、");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Location> findByNameList(List<Long> locationIds) {
|
||||
return jdbcLocationRepository.findByLocationIdIn(locationIds);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,4 +25,7 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
|
|||
|
||||
Location findByLocationName(String locationName);
|
||||
|
||||
List<Location> findByLocationNameIn(Collection<String> locationName);
|
||||
|
||||
List<Location> findByLocationIdIn(Collection<Long> locationId);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
|
@ -124,4 +125,11 @@ class RouteApplicationTests {
|
|||
String login = pailaLoginStrategy.login("OC-5909-zRqrWjZGNThNXJiAV1kA7dPXTojGzVxK3nE");
|
||||
System.out.println(login);
|
||||
}
|
||||
|
||||
@Test
|
||||
void arrayToStr(){
|
||||
List<Long> ids = List.of(1L,2L,3L,4L);
|
||||
System.out.println(Arrays.toString(ids.toArray()));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue