Compare commits
12 Commits
3594267e0b
...
2ccc93fdd9
Author | SHA1 | Date |
---|---|---|
lulz1 | 2ccc93fdd9 | |
lulz1 | 9de63a32c9 | |
lulz1 | 0d8b55f6d7 | |
lulz1 | b6207c278b | |
lulz1 | 5c4fa0b63a | |
lulz1 | 4e29974760 | |
lulz1 | f0f4b20315 | |
lulz1 | 09a5a39bfe | |
lulz1 | 5ec5842d4a | |
lulz1 | 2d48aeb8df | |
lulz1 | ec68c44112 | |
lulz1 | 94c04eccda |
32
pom.xml
32
pom.xml
|
@ -13,9 +13,8 @@
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<name>Route</name>
|
<name>Route</name>
|
||||||
<description>Route</description>
|
<description>Route</description>
|
||||||
<properties>
|
|
||||||
<java.version>17</java.version>
|
|
||||||
</properties>
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -66,33 +65,30 @@
|
||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
<version>5.7.22</version>
|
<version>5.7.22</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.belerweb</groupId>
|
||||||
|
<artifactId>pinyin4j</artifactId>
|
||||||
|
<version>2.5.1</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
<version>3.0.3</version>
|
<version>3.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<finalName>
|
||||||
|
app
|
||||||
|
</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<configuration>
|
</plugin>
|
||||||
<image>
|
<plugin>
|
||||||
<builder>paketobuildpacks/builder-jammy-base:latest</builder>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
</image>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<excludes>
|
|
||||||
<exclude>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
</exclude>
|
|
||||||
</excludes>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
|
@ -8,4 +8,6 @@ public class LocationParam extends BaseQuery {
|
||||||
private Long level;
|
private Long level;
|
||||||
private Long parentLocationId;
|
private Long parentLocationId;
|
||||||
private String cityName;
|
private String cityName;
|
||||||
|
private String firstLetter;
|
||||||
|
private Integer cityType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,5 +66,4 @@ public class OrderController {
|
||||||
orderApplicationService.reject(rejectLegData);
|
orderApplicationService.reject(rejectLegData);
|
||||||
return Result.Success(SUCCESS);
|
return Result.Success(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.chint.application.out;
|
||||||
import com.chint.application.dtos.LocationParam;
|
import com.chint.application.dtos.LocationParam;
|
||||||
import com.chint.domain.aggregates.order.Location;
|
import com.chint.domain.aggregates.order.Location;
|
||||||
import com.chint.domain.repository.LocationRepository;
|
import com.chint.domain.repository.LocationRepository;
|
||||||
|
import com.chint.domain.service.LocationDomainService;
|
||||||
import com.chint.infrastructure.util.PageResult;
|
import com.chint.infrastructure.util.PageResult;
|
||||||
import com.chint.infrastructure.util.Result;
|
import com.chint.infrastructure.util.Result;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
@ -12,6 +13,8 @@ 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 java.util.List;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.Constant.SUCCESS;
|
import static com.chint.infrastructure.constant.Constant.SUCCESS;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -21,9 +24,18 @@ public class LocationController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private LocationRepository locationRepository;
|
private LocationRepository locationRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LocationDomainService locationDomainService;
|
||||||
|
|
||||||
@ApiOperation("分页查询地理信息")
|
@ApiOperation("分页查询地理信息")
|
||||||
@PostMapping("/pageQuery")
|
@PostMapping("/pageQuery")
|
||||||
public Result<PageResult<Location>> pageQuery(@RequestBody LocationParam locationParam) {
|
public Result<PageResult<Location>> pageQuery(@RequestBody LocationParam locationParam) {
|
||||||
return Result.Success(SUCCESS, locationRepository.pageQuery(locationParam));
|
return Result.Success(SUCCESS, locationRepository.pageQuery(locationParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据首字母查询地理信息")
|
||||||
|
@PostMapping("/query/firstLetter")
|
||||||
|
public Result<List<Location>> queryByFirstLetter(@RequestBody LocationParam locationParam) {
|
||||||
|
return Result.Success(SUCCESS, locationDomainService.queryByFirstLetter(locationParam));
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,8 +3,9 @@ package com.chint.application.out;
|
||||||
|
|
||||||
import com.chint.application.queryies.OrderQuery;
|
import com.chint.application.queryies.OrderQuery;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import com.chint.domain.repository.RouteRepository;
|
|
||||||
import com.chint.domain.value_object.OrderQueryData;
|
import com.chint.domain.value_object.OrderQueryData;
|
||||||
|
import com.chint.domain.value_object.PriceQueryData;
|
||||||
|
import com.chint.domain.value_object.TrainPriceData;
|
||||||
import com.chint.infrastructure.util.PageResult;
|
import com.chint.infrastructure.util.PageResult;
|
||||||
import com.chint.infrastructure.util.Result;
|
import com.chint.infrastructure.util.Result;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
@ -24,6 +25,7 @@ public class OrderOutController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderQuery orderQuery;
|
private OrderQuery orderQuery;
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("根据临时单号查询订单")
|
@ApiOperation("根据临时单号查询订单")
|
||||||
@PostMapping("/query/billcode")
|
@PostMapping("/query/billcode")
|
||||||
public Result<RouteOrder> queryOrderByBillCode(@RequestBody OrderQueryData queryData) {
|
public Result<RouteOrder> queryOrderByBillCode(@RequestBody OrderQueryData queryData) {
|
||||||
|
@ -43,4 +45,10 @@ public class OrderOutController {
|
||||||
return Result.Success(SUCCESS, orderQuery.pageQuery(queryData));
|
return Result.Success(SUCCESS, orderQuery.pageQuery(queryData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询火车估算价格")
|
||||||
|
@PostMapping("/estimate/train")
|
||||||
|
public Result<TrainPriceData> estimateTrainPrice(@RequestBody PriceQueryData priceQueryData) {
|
||||||
|
return Result.Success(SUCCESS, orderQuery.queryTrainPrice(priceQueryData));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
package com.chint.application.queryies;
|
package com.chint.application.queryies;
|
||||||
|
|
||||||
|
import com.chint.application.queryies.estimate.EstimatePrice;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import com.chint.domain.repository.RouteRepository;
|
import com.chint.domain.repository.RouteRepository;
|
||||||
import com.chint.domain.service.OrderDomainService;
|
import com.chint.domain.service.OrderDomainService;
|
||||||
|
import com.chint.domain.value_object.FlightPriceData;
|
||||||
import com.chint.domain.value_object.OrderQueryData;
|
import com.chint.domain.value_object.OrderQueryData;
|
||||||
|
import com.chint.domain.value_object.PriceQueryData;
|
||||||
|
import com.chint.domain.value_object.TrainPriceData;
|
||||||
import com.chint.infrastructure.util.PageResult;
|
import com.chint.infrastructure.util.PageResult;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -17,6 +21,9 @@ public class OrderQuery {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderDomainService orderDomainService;
|
private OrderDomainService orderDomainService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EstimatePrice estimatePrice;
|
||||||
|
|
||||||
public RouteOrder queryByOrderId(OrderQueryData queryData) {
|
public RouteOrder queryByOrderId(OrderQueryData queryData) {
|
||||||
return routeRepository.queryById(queryData.getRouteId()).reloadStatus();
|
return routeRepository.queryById(queryData.getRouteId()).reloadStatus();
|
||||||
}
|
}
|
||||||
|
@ -38,4 +45,12 @@ public class OrderQuery {
|
||||||
public RouteOrder queryByBillCode(String billCode) {
|
public RouteOrder queryByBillCode(String billCode) {
|
||||||
return routeRepository.findByFakeOrderNo(billCode);
|
return routeRepository.findByFakeOrderNo(billCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TrainPriceData queryTrainPrice(PriceQueryData priceQueryData) {
|
||||||
|
return estimatePrice.queryTrainPrice(priceQueryData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FlightPriceData queryFlightPrice(PriceQueryData priceQueryData) {
|
||||||
|
return estimatePrice.queryFlightPrice(priceQueryData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.chint.application.queryies.estimate;
|
||||||
|
|
||||||
|
import com.chint.domain.repository.CityRepository;
|
||||||
|
import com.chint.domain.value_object.FlightPriceData;
|
||||||
|
import com.chint.domain.value_object.PriceQueryData;
|
||||||
|
import com.chint.domain.value_object.TrainPriceData;
|
||||||
|
import com.chint.interfaces.rest.ctrip.CTripEstimateRequest;
|
||||||
|
import com.chint.interfaces.rest.ctrip.dto.estimate.request.BookingRelatedApiRequest;
|
||||||
|
import com.chint.interfaces.rest.ctrip.dto.estimate.request.TrainProductInfo;
|
||||||
|
import com.chint.interfaces.rest.ctrip.dto.estimate.response.BookingRelatedApiResponse;
|
||||||
|
import com.chint.interfaces.rest.ctrip.dto.estimate.response.CTripSeatType;
|
||||||
|
import com.chint.interfaces.rest.ctrip.dto.estimate.response.TrainValuationResult;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class CTripEstimatePrice implements EstimatePrice {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CTripEstimateRequest cTripEstimateRequest;
|
||||||
|
@Autowired
|
||||||
|
private CityRepository cityRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TrainPriceData queryTrainPrice(PriceQueryData priceQueryData) {
|
||||||
|
TrainProductInfo trainProductInfo = new TrainProductInfo();
|
||||||
|
|
||||||
|
trainProductInfo.setArriveCityID(
|
||||||
|
cityRepository.findByCityName(priceQueryData.getArriveCity()).getCity()
|
||||||
|
);
|
||||||
|
trainProductInfo.setDepartCityID(
|
||||||
|
cityRepository.findByCityName(priceQueryData.getDepartCity()).getCity()
|
||||||
|
);
|
||||||
|
trainProductInfo.setDepartDate(priceQueryData.getDepartDate());
|
||||||
|
trainProductInfo.setReturnNoTicket(true);
|
||||||
|
|
||||||
|
BookingRelatedApiRequest bookingRelatedApiRequest = cTripEstimateRequest
|
||||||
|
.generateBaseRequest(null, trainProductInfo);
|
||||||
|
BookingRelatedApiResponse estimate = cTripEstimateRequest.estimate(bookingRelatedApiRequest);
|
||||||
|
TrainValuationResult trainValuationResult = estimate.getData().getTrainValuationResult();
|
||||||
|
|
||||||
|
TrainPriceData trainPriceData = new TrainPriceData();
|
||||||
|
trainPriceData.setMaxPrice(String.valueOf(trainValuationResult.getMaxPrice()));
|
||||||
|
trainValuationResult.getSeatMaxPriceInfoList().forEach(seatMaxPriceInfo -> {
|
||||||
|
String seatCode = seatMaxPriceInfo.getSeatCode();
|
||||||
|
trainPriceData.addSeatInfo(CTripSeatType.getDescriptionByCode(
|
||||||
|
Integer.parseInt(seatCode)),
|
||||||
|
String.valueOf(seatMaxPriceInfo.getMaxPrice()),
|
||||||
|
seatCode);
|
||||||
|
});
|
||||||
|
return trainPriceData;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FlightPriceData queryFlightPrice(PriceQueryData priceQueryData) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.chint.application.queryies.estimate;
|
||||||
|
|
||||||
|
import com.chint.domain.value_object.FlightPriceData;
|
||||||
|
import com.chint.domain.value_object.PriceQueryData;
|
||||||
|
import com.chint.domain.value_object.TrainPriceData;
|
||||||
|
|
||||||
|
|
||||||
|
public interface EstimatePrice {
|
||||||
|
TrainPriceData queryTrainPrice(PriceQueryData priceQueryData);
|
||||||
|
|
||||||
|
FlightPriceData queryFlightPrice(PriceQueryData priceQueryData);
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ package com.chint.domain.aggregates.order;
|
||||||
import com.chint.domain.exceptions.LegEventException;
|
import com.chint.domain.exceptions.LegEventException;
|
||||||
import com.chint.domain.service.amount_estimate.EstimateAdapter;
|
import com.chint.domain.service.amount_estimate.EstimateAdapter;
|
||||||
import com.chint.domain.value_object.LegData;
|
import com.chint.domain.value_object.LegData;
|
||||||
|
import com.chint.infrastructure.util.BigDecimalCalculator;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
|
@ -32,6 +33,8 @@ public class Leg {
|
||||||
|
|
||||||
private LocalDateTime endTime;
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
private String estimateAmount;
|
||||||
|
|
||||||
@Column("origin_id")
|
@Column("origin_id")
|
||||||
private Long originId;
|
private Long originId;
|
||||||
@Transient
|
@Transient
|
||||||
|
@ -45,15 +48,13 @@ public class Leg {
|
||||||
@Transient
|
@Transient
|
||||||
private String amount;
|
private String amount;
|
||||||
@Transient
|
@Transient
|
||||||
private String estimateAmount;
|
|
||||||
@Transient
|
|
||||||
private String legTypeName;
|
private String legTypeName;
|
||||||
@Transient
|
@Transient
|
||||||
private Integer legStatus;
|
private Integer legStatus;
|
||||||
@Transient
|
@Transient
|
||||||
private String legStatusName;
|
private String legStatusName;
|
||||||
@Transient
|
@Transient
|
||||||
private OrderDetail orderDetail; //这个属性不做持久化保存 ,根据下单事件进行获取
|
private List<OrderDetail> orderDetails; //这个属性不做持久化保存 ,根据下单事件进行获取
|
||||||
|
|
||||||
@MappedCollection(idColumn = "leg_id", keyColumn = "leg_key")
|
@MappedCollection(idColumn = "leg_id", keyColumn = "leg_key")
|
||||||
private List<LegEvent> eventList;
|
private List<LegEvent> eventList;
|
||||||
|
@ -89,14 +90,17 @@ public class Leg {
|
||||||
// If the latest event is an order event, update the amount
|
// If the latest event is an order event, update the amount
|
||||||
if (latestEvent.getEventType() >= LEG_EVENT_ORDERED) {
|
if (latestEvent.getEventType() >= LEG_EVENT_ORDERED) {
|
||||||
//获取最新的下单事件
|
//获取最新的下单事件
|
||||||
LegEvent latestOrderEvent = this.eventList
|
this.eventList
|
||||||
.stream()
|
.stream()
|
||||||
.filter(legEvent -> legEvent.getEventType().equals(LEG_EVENT_ORDERED))
|
.filter(legEvent -> legEvent.getEventType().equals(LEG_EVENT_ORDERED))
|
||||||
.max(Comparator.comparingLong(LegEvent::getLegEventId))
|
.max(Comparator.comparingLong(LegEvent::getLegEventId))
|
||||||
.orElse(null);
|
.flatMap(event -> Optional.ofNullable(event.getOrderDetails()))
|
||||||
Optional.ofNullable(latestOrderEvent.getOrderDetail()).ifPresent(detail -> {
|
.ifPresent(detail -> {
|
||||||
this.amount = detail.getPrice();
|
this.amount = detail.stream()
|
||||||
this.orderDetail = detail;
|
.map(OrderDetail::getPrice)
|
||||||
|
.reduce(BigDecimalCalculator::add)
|
||||||
|
.orElse(KEEP_TWO_DECIMAL_ZERO);
|
||||||
|
this.orderDetails = detail;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||||
import org.springframework.data.relational.core.mapping.Table;
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.Constant.*;
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
|
|
||||||
|
@ -25,8 +27,8 @@ public class LegEvent {
|
||||||
|
|
||||||
private LocalDateTime happenTime;
|
private LocalDateTime happenTime;
|
||||||
|
|
||||||
@MappedCollection(idColumn = "order_id")
|
@MappedCollection(idColumn = "leg_event_id",keyColumn = "leg_event_key")
|
||||||
private OrderDetail orderDetail;
|
private List<OrderDetail> orderDetails;
|
||||||
|
|
||||||
public String translateLegEvent(int event) {
|
public String translateLegEvent(int event) {
|
||||||
return switch (event) {
|
return switch (event) {
|
||||||
|
@ -46,8 +48,11 @@ public class LegEvent {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LegEvent orderDetail(OrderDetail orderDetail) {
|
public LegEvent addOrderDetail(OrderDetail orderDetail){
|
||||||
this.setOrderDetail(orderDetail);
|
if(this.orderDetails == null){
|
||||||
|
this.orderDetails = new ArrayList<>();
|
||||||
|
}
|
||||||
|
this.orderDetails.add(orderDetail);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ public class Location {
|
||||||
private String locationPathName;
|
private String locationPathName;
|
||||||
private String locationName;
|
private String locationName;
|
||||||
private String locationShortName;
|
private String locationShortName;
|
||||||
|
private String firstPinYin;
|
||||||
private Long parentLocationId;
|
private Long parentLocationId;
|
||||||
@Column("level")
|
@Column("level")
|
||||||
private Integer level;
|
private Integer level;
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.chint.domain.factoriy.user;
|
||||||
|
|
||||||
|
import com.chint.domain.aggregates.user.User;
|
||||||
|
|
||||||
|
public interface UserFactory {
|
||||||
|
User create(String employeeNo);
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.chint.domain.factoriy.user;
|
||||||
|
|
||||||
|
import com.chint.domain.aggregates.user.User;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class UserFactoryImpl implements UserFactory {
|
||||||
|
@Override
|
||||||
|
public User create(String employeeNo) {
|
||||||
|
User user = new User();
|
||||||
|
user.setEmployeeNo(Long.valueOf(employeeNo));
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,8 +4,17 @@ import com.chint.application.dtos.LocationParam;
|
||||||
import com.chint.domain.aggregates.order.Location;
|
import com.chint.domain.aggregates.order.Location;
|
||||||
import com.chint.infrastructure.util.PageResult;
|
import com.chint.infrastructure.util.PageResult;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface LocationRepository {
|
public interface LocationRepository {
|
||||||
// List<Location> findByHot(List<LocationHot> locationHots);
|
// List<Location> findByHot(List<LocationHot> locationHots);
|
||||||
Location findByLocationId(Long locationId);
|
Location findByLocationId(Long locationId);
|
||||||
|
|
||||||
PageResult<Location> pageQuery(LocationParam locationParam);
|
PageResult<Location> pageQuery(LocationParam locationParam);
|
||||||
|
|
||||||
|
List<Location> findAll();
|
||||||
|
|
||||||
|
void saveAll(List<Location> locations);
|
||||||
|
|
||||||
|
List<Location> findByFirstLetter(LocationParam locationParam);
|
||||||
}
|
}
|
|
@ -5,4 +5,6 @@ import com.chint.domain.aggregates.user.User;
|
||||||
public interface UserRepository {
|
public interface UserRepository {
|
||||||
User findById(Long id);
|
User findById(Long id);
|
||||||
User findByUserEmployeeNo(Long employeeNo);
|
User findByUserEmployeeNo(Long employeeNo);
|
||||||
|
|
||||||
|
User save(User user);
|
||||||
}
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.chint.domain.service;
|
||||||
|
|
||||||
|
import com.chint.application.dtos.LocationParam;
|
||||||
|
import com.chint.domain.aggregates.order.Location;
|
||||||
|
import com.chint.domain.exceptions.NotFoundException;
|
||||||
|
import com.chint.domain.repository.LocationRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class LocationDomainService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LocationRepository locationRepository;
|
||||||
|
|
||||||
|
public List<Location> queryByFirstLetter(LocationParam locationParam) {
|
||||||
|
List<Location> byFirstPinYin = locationRepository.findByFirstLetter(locationParam);
|
||||||
|
Integer cityType = locationParam.getCityType();
|
||||||
|
return switch (cityType) {
|
||||||
|
case CITY_TYPE_DOMESTIC -> byFirstPinYin
|
||||||
|
.stream()
|
||||||
|
.filter(location -> location.getLocationPath().startsWith(CITY_TYPE_DOMESTIC_PATH)).toList();
|
||||||
|
|
||||||
|
case CITY_TYPE_FOREIGN -> byFirstPinYin
|
||||||
|
.stream()
|
||||||
|
.filter(location -> !location.getLocationPath().startsWith(CITY_TYPE_DOMESTIC_PATH)).toList();
|
||||||
|
default -> throw new NotFoundException(NOT_FOUND);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,12 +2,20 @@ package com.chint.domain.service.amount_estimate;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.order.Leg;
|
import com.chint.domain.aggregates.order.Leg;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
|
import com.chint.interfaces.rest.ctrip.CTripEstimateRequest;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CTripEstimate implements AmountEstimate {
|
public class CTripEstimate implements AmountEstimate {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CTripEstimateRequest cTripEstimateRequest;
|
||||||
@Override
|
@Override
|
||||||
public String amountEstimate(Leg leg) {
|
public String amountEstimate(Leg leg) {
|
||||||
|
|
||||||
|
// cTripEstimateRequest.generateBaseRequest(null,)
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package com.chint.domain.service.auth;
|
package com.chint.domain.service.auth;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
|
import com.chint.domain.factoriy.user.UserFactory;
|
||||||
import com.chint.domain.repository.UserRepository;
|
import com.chint.domain.repository.UserRepository;
|
||||||
import com.chint.domain.value_object.UserLoginParam;
|
import com.chint.domain.value_object.UserLoginParam;
|
||||||
import com.chint.domain.value_object.UserLoginResult;
|
import com.chint.domain.value_object.UserLoginResult;
|
||||||
|
import com.chint.infrastructure.util.Digest;
|
||||||
import com.chint.infrastructure.util.JWTUtil;
|
import com.chint.infrastructure.util.JWTUtil;
|
||||||
import com.chint.infrastructure.util.Json;
|
import com.chint.infrastructure.util.Json;
|
||||||
import com.chint.infrastructure.util.Token;
|
import com.chint.infrastructure.util.Token;
|
||||||
|
@ -21,6 +23,9 @@ public class AuthenticateServiceImpl implements AuthenticateService {
|
||||||
private final UserRepository userRepository;
|
private final UserRepository userRepository;
|
||||||
private final UserHttpRequest httpRequest;
|
private final UserHttpRequest httpRequest;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserFactory userFactory;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private Json json;
|
private Json json;
|
||||||
|
|
||||||
|
@ -49,9 +54,14 @@ public class AuthenticateServiceImpl implements AuthenticateService {
|
||||||
claims.put(USER_LOGIN_PARAM, json.gson().toJson(userLoginParam));
|
claims.put(USER_LOGIN_PARAM, json.gson().toJson(userLoginParam));
|
||||||
String jwt = JWTUtil.createJWT(claims);
|
String jwt = JWTUtil.createJWT(claims);
|
||||||
|
|
||||||
return UserLoginResult.buildWithUser(user).loadToken(Token.of(jwt));
|
return UserLoginResult.buildWithUser(user).loadToken(Token.of(jwt)).redirectUrl(SYSTEM_HOME_URL +
|
||||||
|
"?token=" + Digest.aes(jwt));
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException(NOT_FOUND);
|
User newUser = userFactory.create(userLoginParam.getSfno());
|
||||||
|
//如果数据库不存在该用户,需要通过sf信息进行查询并保存到数据库
|
||||||
|
httpRequest.loadUserInfo(newUser);
|
||||||
|
userRepository.save(newUser);
|
||||||
|
return authenticateEmployeeNo(userLoginParam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -117,7 +117,7 @@ public class LegEventHandler implements LegEventService {
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.ifPresent(leg -> {
|
.ifPresent(leg -> {
|
||||||
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
|
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
|
||||||
legEvent.setOrderDetail(orderDetail);
|
legEvent.addOrderDetail(orderDetail);
|
||||||
leg.addEvent(legEvent);
|
leg.addEvent(legEvent);
|
||||||
});
|
});
|
||||||
routeRepository.save(routeOrder);
|
routeRepository.save(routeOrder);
|
||||||
|
@ -133,7 +133,7 @@ public class LegEventHandler implements LegEventService {
|
||||||
OrderDetail orderDetail = orderDetailRepository.findById(command.getOrderDetailId());
|
OrderDetail orderDetail = orderDetailRepository.findById(command.getOrderDetailId());
|
||||||
LegEvent legEvent = legEventFactory
|
LegEvent legEvent = legEventFactory
|
||||||
.creatLegEvent(command.getLegEventType())
|
.creatLegEvent(command.getLegEventType())
|
||||||
.orderDetail(orderDetail);
|
.addOrderDetail(orderDetail);
|
||||||
leg.addEvent(legEvent);
|
leg.addEvent(legEvent);
|
||||||
|
|
||||||
legRepository.save(leg);
|
legRepository.save(leg);
|
||||||
|
@ -146,7 +146,7 @@ public class LegEventHandler implements LegEventService {
|
||||||
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
|
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
|
||||||
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
|
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
|
||||||
OrderDetail orderDetail = new OrderDetail();
|
OrderDetail orderDetail = new OrderDetail();
|
||||||
legEvent.setOrderDetail(orderDetail);
|
legEvent.addOrderDetail(orderDetail);
|
||||||
leg.addEvent(legEvent);
|
leg.addEvent(legEvent);
|
||||||
legRepository.save(leg);
|
legRepository.save(leg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.chint.domain.value_object;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FlightPriceData {
|
||||||
|
private String maxPrice;
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.chint.domain.value_object;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PriceQueryData {
|
||||||
|
private String departCity;
|
||||||
|
private String arriveCity;
|
||||||
|
private String departDate;
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.chint.domain.value_object;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TrainPriceData {
|
||||||
|
private String maxPrice;
|
||||||
|
private List<SeatInfo> seatInfoList;
|
||||||
|
|
||||||
|
public void addSeatInfo(String seatName, String seatPrice, String seatCode) {
|
||||||
|
if (this.seatInfoList == null) {
|
||||||
|
this.seatInfoList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
SeatInfo seatInfo = new SeatInfo();
|
||||||
|
seatInfo.setSeatName(seatName);
|
||||||
|
seatInfo.setSeatPrice(seatPrice);
|
||||||
|
seatInfo.setSeatCode(seatCode);
|
||||||
|
this.seatInfoList.add(seatInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
private static class SeatInfo {
|
||||||
|
private String seatName;
|
||||||
|
private String seatPrice;
|
||||||
|
private String seatCode;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,10 +2,13 @@ package com.chint.domain.value_object;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.infrastructure.util.Token;
|
import com.chint.infrastructure.util.Token;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
public class UserLoginResult {
|
public class UserLoginResult {
|
||||||
private User user;
|
private User user;
|
||||||
private Token token;
|
private Token token;
|
||||||
|
private String redirectUrl;
|
||||||
|
|
||||||
public UserLoginResult(User user) {
|
public UserLoginResult(User user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
@ -36,4 +39,9 @@ public class UserLoginResult {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserLoginResult redirectUrl(String url) {
|
||||||
|
this.redirectUrl = url;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -197,4 +197,13 @@ public class Constant {
|
||||||
|
|
||||||
// status
|
// status
|
||||||
public static final int STATUS_DISABLED = 0;
|
public static final int STATUS_DISABLED = 0;
|
||||||
|
|
||||||
|
// 城市类型
|
||||||
|
public static final int CITY_TYPE_DOMESTIC = 0;//国内
|
||||||
|
public static final String CITY_TYPE_DOMESTIC_PATH = "3106_1_";//国内
|
||||||
|
public static final int CITY_TYPE_FOREIGN = 1;//国外
|
||||||
|
|
||||||
|
//system
|
||||||
|
public static final String SYSTEM_HOME_URL = "www.baidu.com";//国内
|
||||||
|
public static final String AES_SECRET = "chint";//国内
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@ import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class LocationRepositoryImpl implements LocationRepository {
|
public class LocationRepositoryImpl implements LocationRepository {
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -26,7 +29,7 @@ public class LocationRepositoryImpl implements LocationRepository {
|
||||||
locationParam.getPageNum() - 1,
|
locationParam.getPageNum() - 1,
|
||||||
locationParam.getPageSize()
|
locationParam.getPageSize()
|
||||||
);
|
);
|
||||||
if(locationParam.getCityName() != null){
|
if (locationParam.getCityName() != null) {
|
||||||
Page<Location> res = jdbcLocationRepository.findAllByLocationPathContaining(locationParam.getCityName(), pageResult);
|
Page<Location> res = jdbcLocationRepository.findAllByLocationPathContaining(locationParam.getCityName(), pageResult);
|
||||||
return PageResult.totalPageNum(res.getTotalElements(), res.toList());
|
return PageResult.totalPageNum(res.getTotalElements(), res.toList());
|
||||||
}
|
}
|
||||||
|
@ -40,4 +43,21 @@ public class LocationRepositoryImpl implements LocationRepository {
|
||||||
}
|
}
|
||||||
return PageResult.empty();
|
return PageResult.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Location> findAll() {
|
||||||
|
List<Location> res = new ArrayList<>();
|
||||||
|
jdbcLocationRepository.findAll().forEach(res::add);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveAll(List<Location> locations) {
|
||||||
|
jdbcLocationRepository.saveAll(locations);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Location> findByFirstLetter(LocationParam locationParam) {
|
||||||
|
return jdbcLocationRepository.findByFirstPinYin(locationParam.getFirstLetter());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,4 +21,9 @@ public class UserRepositoryImpl implements UserRepository {
|
||||||
public User findByUserEmployeeNo(Long employeeNo) {
|
public User findByUserEmployeeNo(Long employeeNo) {
|
||||||
return jdbcUserRepository.findByEmployeeNo(employeeNo);
|
return jdbcUserRepository.findByEmployeeNo(employeeNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public User save(User user) {
|
||||||
|
return jdbcUserRepository.save(user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,10 @@ import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface JdbcLocationRepository extends CrudRepository<Location,Long> {
|
public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
|
||||||
Location findByLocationId(Long locationId);
|
Location findByLocationId(Long locationId);
|
||||||
|
|
||||||
Page<Location> findAllByLocationPathContaining(String locationPath, Pageable pageable);
|
Page<Location> findAllByLocationPathContaining(String locationPath, Pageable pageable);
|
||||||
|
@ -16,4 +18,6 @@ public interface JdbcLocationRepository extends CrudRepository<Location,Long> {
|
||||||
|
|
||||||
Page<Location> findAllByLevel(Long level, Pageable pageable);
|
Page<Location> findAllByLevel(Long level, Pageable pageable);
|
||||||
|
|
||||||
|
List<Location> findByFirstPinYin(String firstPinYin);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,16 @@
|
||||||
package com.chint.infrastructure.util;
|
package com.chint.infrastructure.util;
|
||||||
|
|
||||||
|
import javax.crypto.*;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.Constant.AES_SECRET;
|
||||||
|
|
||||||
public class Digest {
|
public class Digest {
|
||||||
|
|
||||||
|
@ -22,4 +31,44 @@ public class Digest {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final SecretKey secretKey = generateKey(128); // 类级别的密钥
|
||||||
|
|
||||||
|
// 生成密钥
|
||||||
|
private static SecretKey generateKey(int n) {
|
||||||
|
try {
|
||||||
|
KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
|
||||||
|
keyGenerator.init(n); // 可以是 128, 192, 或 256
|
||||||
|
return keyGenerator.generateKey();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String aes(String input) {
|
||||||
|
try {
|
||||||
|
Cipher cipher = Cipher.getInstance("AES");
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
|
||||||
|
byte[] encryptedBytes = cipher.doFinal(input.getBytes());
|
||||||
|
|
||||||
|
String encodedEncryptedToken = Base64.getEncoder().encodeToString(encryptedBytes);
|
||||||
|
return URLEncoder.encode(encodedEncryptedToken, StandardCharsets.UTF_8);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String aesBack(String input) {
|
||||||
|
try {
|
||||||
|
String urlDecodedToken = URLDecoder.decode(input, StandardCharsets.UTF_8);
|
||||||
|
byte[] encryptedBytes = Base64.getDecoder().decode(urlDecodedToken);
|
||||||
|
|
||||||
|
Cipher cipher = Cipher.getInstance("AES");
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, secretKey);
|
||||||
|
byte[] decryptedBytes = cipher.doFinal(encryptedBytes);
|
||||||
|
return new String(decryptedBytes);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class SignUtils {
|
||||||
for (int i = 0; i < bytes.length; i++) {
|
for (int i = 0; i < bytes.length; i++) {
|
||||||
temp = Integer.toHexString(bytes[i] & 0xFF);
|
temp = Integer.toHexString(bytes[i] & 0xFF);
|
||||||
if (temp.length() == 1) {
|
if (temp.length() == 1) {
|
||||||
//1得到一位的进行补0操作
|
//1得到一位的进行补0操作
|
||||||
stringBuffer.append("0");
|
stringBuffer.append("0");
|
||||||
}
|
}
|
||||||
stringBuffer.append(temp);
|
stringBuffer.append(temp);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.chint.infrastructure.webconfig;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.infrastructure.util.BaseContext;
|
import com.chint.infrastructure.util.BaseContext;
|
||||||
|
import com.chint.infrastructure.util.Digest;
|
||||||
import com.chint.infrastructure.util.JWTUtil;
|
import com.chint.infrastructure.util.JWTUtil;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
@ -30,8 +31,9 @@ public class JwtTokenAdminInterceptor implements HandlerInterceptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
JWTUtil.verifyJWT(SECRET, token);
|
String str = Digest.aesBack(token);
|
||||||
var parseJWT = JWTUtil.parseJWT(SECRET, token);
|
JWTUtil.verifyJWT(SECRET, str);
|
||||||
|
var parseJWT = JWTUtil.parseJWT(SECRET, str);
|
||||||
var withJwt = User.withJwt(parseJWT);
|
var withJwt = User.withJwt(parseJWT);
|
||||||
BaseContext.setCurrentUser(withJwt);
|
BaseContext.setCurrentUser(withJwt);
|
||||||
return true; // If verification succeeds, continue processing the request
|
return true; // If verification succeeds, continue processing the request
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class CTripEstimateRequest {
|
||||||
.requestContent()
|
.requestContent()
|
||||||
.valuationBaseInfo()
|
.valuationBaseInfo()
|
||||||
.eID(user.getEmployeeNo().toString())
|
.eID(user.getEmployeeNo().toString())
|
||||||
.corpID("zhengtai")
|
.corpID(C_TRIP_CORP_ID)
|
||||||
// .rankName(user.getRankCode())
|
// .rankName(user.getRankCode())
|
||||||
.done()
|
.done()
|
||||||
.valuationProductInfo()
|
.valuationProductInfo()
|
||||||
|
@ -67,6 +67,4 @@ public class CTripEstimateRequest {
|
||||||
.done()
|
.done()
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
||||||
public class BookingRelatedApiResponse {
|
public class BookingRelatedApiResponse {
|
||||||
|
|
||||||
// 请求相关API的响应
|
// 请求相关API的响应
|
||||||
private ResponseStatus status;
|
private EstimateResponseStatus status;
|
||||||
// 数据内容
|
// 数据内容
|
||||||
private ValuateBudgetResponseType data;
|
private ValuateBudgetResponseType data;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.chint.interfaces.rest.ctrip.dto.estimate.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import static com.chint.interfaces.rest.ctrip.dto.approval.train.TrainSkipFields.SeatType;
|
||||||
|
|
||||||
|
|
||||||
|
public enum CTripSeatType {
|
||||||
|
HARD_SEAT_201("硬座", 201),
|
||||||
|
SOFT_SEAT_203("软座", 203),
|
||||||
|
PREMIUM_SEAT_205("特等座", 205),
|
||||||
|
FIRST_CLASS_SEAT_207("一等座", 207),
|
||||||
|
SECOND_CLASS_SEAT_209("二等座", 209),
|
||||||
|
HARD_SLEEPER_UPPER_211("硬卧上", 211),
|
||||||
|
HARD_SLEEPER_MIDDLE_212("硬卧中", 212),
|
||||||
|
HARD_SLEEPER_LOWER_213("硬卧下", 213),
|
||||||
|
SOFT_SLEEPER_UPPER_214("软卧上", 214),
|
||||||
|
SOFT_SLEEPER_LOWER_215("软卧下", 215),
|
||||||
|
BUSINESS_SEAT_221("商务座", 221),
|
||||||
|
NO_SEAT_227("无座", 227),
|
||||||
|
HARD_SLEEPER_224("硬卧", 224),
|
||||||
|
SOFT_SLEEPER_225("软卧", 225),
|
||||||
|
LUXURY_SOFT_SLEEPER_226("高级软卧", 226),
|
||||||
|
FIRST_CLASS_SOFT_SEAT_301("一等软座", 301),
|
||||||
|
SECOND_CLASS_SOFT_SEAT_302("二等软座", 302),
|
||||||
|
SOLO_SOFT_COMPARTMENT_303("一人软包", 303),
|
||||||
|
MOVING_BERTH_304("动卧", 304),
|
||||||
|
MOVING_BERTH_UPPER_305("动卧上", 305),
|
||||||
|
MOVING_BERTH_LOWER_306("动卧下", 306),
|
||||||
|
LUXURY_MOVING_BERTH_307("高级动卧", 307),
|
||||||
|
LUXURY_MOVING_BERTH_UPPER_308("高级动卧上", 308),
|
||||||
|
LUXURY_MOVING_BERTH_LOWER_309("高级动卧下", 309),
|
||||||
|
FIRST_CLASS_DOUBLE_SOFT_311("一等双软", 311),
|
||||||
|
FIRST_CLASS_DOUBLE_SOFT_UPPER_312("一等双软上", 312),
|
||||||
|
FIRST_CLASS_DOUBLE_SOFT_LOWER_313("一等双软下", 313),
|
||||||
|
SECOND_CLASS_DOUBLE_SOFT_314("二等双软", 314),
|
||||||
|
SECOND_CLASS_DOUBLE_SOFT_UPPER_315("二等双软上", 315),
|
||||||
|
SECOND_CLASS_DOUBLE_SOFT_MIDDLE_316("二等双软中", 316),
|
||||||
|
SECOND_CLASS_DOUBLE_SOFT_LOWER_317("二等双软下", 317);
|
||||||
|
|
||||||
|
private final String description;
|
||||||
|
private final int code;
|
||||||
|
|
||||||
|
CTripSeatType(String description, int code) {
|
||||||
|
this.description = description;
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据 int 类型的 code 获取对应的描述
|
||||||
|
public static String getDescriptionByCode(int code) {
|
||||||
|
for (CTripSeatType seatType : CTripSeatType.values()) {
|
||||||
|
if (seatType.getCode() == code) {
|
||||||
|
return seatType.getDescription();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null; // 或者你可以选择抛出一个异常,如果 code 无效
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.chint.interfaces.rest.ctrip.dto.estimate.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EstimateResponseStatus {
|
||||||
|
private Boolean success;
|
||||||
|
private int errorCode;
|
||||||
|
private String message;
|
||||||
|
}
|
|
@ -1,4 +0,0 @@
|
||||||
package com.chint.interfaces.rest.ctrip.dto.search;
|
|
||||||
|
|
||||||
public class CarOrderInfoEntity {
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
package com.chint.interfaces.rest.ctrip.dto.search;
|
|
||||||
|
|
||||||
public class FlightOrderInfoEntity {
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
package com.chint.interfaces.rest.ctrip.dto.search;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class HotelOrderInfoEntity {
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
package com.chint.interfaces.rest.ctrip.dto.search;
|
|
||||||
|
|
||||||
public class TrainOrderInfoEntity {
|
|
||||||
}
|
|
|
@ -5,6 +5,9 @@ package com.chint.interfaces.rest.user;
|
||||||
//import com.chint.dc.api.DataCenterResult;
|
//import com.chint.dc.api.DataCenterResult;
|
||||||
//import com.chint.dc.api.dto.DataCenterOption;
|
//import com.chint.dc.api.dto.DataCenterOption;
|
||||||
//import com.chint.dc.api.service.DataCenterService;
|
//import com.chint.dc.api.service.DataCenterService;
|
||||||
|
import com.chint.dc.api.DataCenterResult;
|
||||||
|
import com.chint.dc.api.dto.DataCenterOption;
|
||||||
|
import com.chint.dc.api.service.DataCenterService;
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.interfaces.rest.base.PostRequest;
|
import com.chint.interfaces.rest.base.PostRequest;
|
||||||
import com.chint.interfaces.rest.user.dto.*;
|
import com.chint.interfaces.rest.user.dto.*;
|
||||||
|
@ -40,14 +43,14 @@ public class UserHttpRequestImpl implements UserHttpRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private User loadSFAndRank(User user) {
|
private User loadSFAndRank(User user) {
|
||||||
// List<UserDataDTO> loadSFInfo = loadSFInfo(user);
|
List<UserDataDTO> loadSFInfo = loadSFInfo(user);
|
||||||
// String custManaLevel = loadSFInfo.get(0).getCust_manaLevel();
|
String custManaLevel = loadSFInfo.get(0).getCust_manaLevel();
|
||||||
// String level = custManaLevel != null ? custManaLevel : "M0";
|
String level = custManaLevel != null ? custManaLevel : "M0";
|
||||||
// if (level.contains("R")) {
|
if (level.contains("R")) {
|
||||||
// level = level.substring(0, level.length() - 3) + "M0";
|
level = level.substring(0, level.length() - 3) + "M0";
|
||||||
// }
|
}
|
||||||
// TravelRankDTO loadTravelRank = loadTravelRank(new TravelRankParam(level));
|
TravelRankDTO loadTravelRank = loadTravelRank(new TravelRankParam(level));
|
||||||
// user.setRankCode(loadTravelRank.getLEVEL_MAPPING_CODE());
|
user.setRankCode(loadTravelRank.getLEVEL_MAPPING_CODE());
|
||||||
user.setRankCode("测试职级");
|
user.setRankCode("测试职级");
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
@ -67,31 +70,33 @@ public class UserHttpRequestImpl implements UserHttpRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<UserDataDTO> loadSFInfo(User user) {
|
private List<UserDataDTO> loadSFInfo(User user) {
|
||||||
// Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
// AccessKeyDTO akSkLoad = akSkLoad();
|
AccessKeyDTO akSkLoad = akSkLoad();
|
||||||
// DataCenterOption option = new DataCenterOption();
|
DataCenterOption option = new DataCenterOption();
|
||||||
// option.setSk(akSkLoad.sk);
|
option.setSk(akSkLoad.sk);
|
||||||
// option.setAk(akSkLoad.ak);
|
option.setAk(akSkLoad.ak);
|
||||||
// option.setUrl(OPENAI_BASE_URL);
|
option.setUrl(OPENAI_BASE_URL);
|
||||||
// DataCenterService dataCenterService = new DataCenterService(option);
|
DataCenterService dataCenterService = new DataCenterService(option);
|
||||||
// LinkedHashMap map = new LinkedHashMap<String, Object>();
|
LinkedHashMap map = new LinkedHashMap<String, Object>();
|
||||||
// map.put("LoginUsername", user.getEmployeeNo().toString());
|
map.put("LoginUsername", user.getEmployeeNo().toString());
|
||||||
// map.put("start", 0);
|
map.put("start", 0);
|
||||||
// map.put("pageSize", 1);
|
map.put("pageSize", 1);
|
||||||
// DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
|
DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
|
||||||
// Type type = new TypeToken<List<UserDataDTO>>() {
|
Type type = new TypeToken<List<UserDataDTO>>() {
|
||||||
// }.getType();
|
}.getType();
|
||||||
// if (result.getData() != null) {
|
if (result.getData() != null) {
|
||||||
// List<UserDataDTO> fromJson = gson.fromJson(result.getData().toString(), type);
|
List<UserDataDTO> fromJson = gson.fromJson(result.getData().toString(), type);
|
||||||
// UserDataDTO userDataDTO = fromJson.get(0);
|
UserDataDTO userDataDTO = fromJson.get(0);
|
||||||
// user.setCompanyCode(userDataDTO.getCompany());
|
user.setCompanyCode(userDataDTO.getCompany());
|
||||||
// user.setWorkStatus(userDataDTO.getStatus());
|
user.setWorkStatus(userDataDTO.getStatus());
|
||||||
// user.setGender(userDataDTO.getGender());
|
user.setGender(userDataDTO.getGender());
|
||||||
// return fromJson;
|
user.setName(userDataDTO.getUname());
|
||||||
// } else {
|
user.setPhoneNumber(userDataDTO.getMobilePhone());
|
||||||
// throw new RuntimeException("用户数据不存在");
|
return fromJson;
|
||||||
// }
|
} else {
|
||||||
return null;
|
throw new RuntimeException("用户数据不存在");
|
||||||
|
}
|
||||||
|
// return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TravelRankDTO loadTravelRank(TravelRankParam travelRankParam) {
|
private TravelRankDTO loadTravelRank(TravelRankParam travelRankParam) {
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
FROM harbor.chint.com/wz-build-env-public/openjdk:17 AS base
|
||||||
|
WORKDIR /app
|
||||||
|
EXPOSE 8080
|
||||||
|
EXPOSE 443
|
||||||
|
ENV LANG en_US.UTF-8
|
||||||
|
RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
|
||||||
|
RUN sed -i 's/jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1/jdk.tls.disabledAlgorithms=SSLv3/g' /usr/lib/jvm/msopenjdk-17-amd64/conf/security/java.security
|
||||||
|
|
||||||
|
FROM base AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
RUN rm -f /app/Dockerfile
|
||||||
|
ENTRYPOINT ["java", "-jar", "app.jar"]
|
|
@ -1,5 +1,5 @@
|
||||||
server:
|
server:
|
||||||
port: 8081
|
port: 8080
|
||||||
|
|
||||||
chint:
|
chint:
|
||||||
datasource:
|
datasource:
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
version: "3"
|
|
||||||
|
|
||||||
networks:
|
|
||||||
gitea:
|
|
||||||
external: false
|
|
||||||
|
|
||||||
services:
|
|
||||||
server:
|
|
||||||
image: gitea/gitea:1.21.4
|
|
||||||
container_name: gitea
|
|
||||||
environment:
|
|
||||||
- USER_UID=1000
|
|
||||||
- USER_GID=1000
|
|
||||||
- GITEA__database__DB_TYPE=mysql
|
|
||||||
- GITEA__database__HOST=rm-cn-jeo3lfy9q0006gso.rwlb.rds.aliyuncs.com:3306
|
|
||||||
- GITEA__database__NAME=gitea
|
|
||||||
- GITEA__database__USER=gitea
|
|
||||||
- GITEA__database__PASSWD=gitea
|
|
||||||
restart: always
|
|
||||||
volumes:
|
|
||||||
- /app/gitea/data:/data
|
|
||||||
- /etc/timezone:/etc/timezone:ro
|
|
||||||
- /etc/localtime:/etc/localtime:ro
|
|
||||||
ports:
|
|
||||||
- "3000:3000"
|
|
||||||
- "222:22"
|
|
|
@ -7,12 +7,14 @@ import com.chint.interfaces.rest.ctrip.*;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.estimate.request.BookingRelatedApiRequest;
|
import com.chint.interfaces.rest.ctrip.dto.estimate.request.BookingRelatedApiRequest;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.estimate.request.FlightProductInfo;
|
import com.chint.interfaces.rest.ctrip.dto.estimate.request.FlightProductInfo;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.estimate.request.RouteInfo;
|
import com.chint.interfaces.rest.ctrip.dto.estimate.request.RouteInfo;
|
||||||
|
import com.chint.interfaces.rest.ctrip.dto.estimate.request.TrainProductInfo;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.estimate.response.BookingRelatedApiResponse;
|
import com.chint.interfaces.rest.ctrip.dto.estimate.response.BookingRelatedApiResponse;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.location.CTripCity;
|
import com.chint.interfaces.rest.ctrip.dto.location.CTripCity;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.location.CTripCountry;
|
import com.chint.interfaces.rest.ctrip.dto.location.CTripCountry;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.login.CTripLoginParam;
|
import com.chint.interfaces.rest.ctrip.dto.login.CTripLoginParam;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.login.PCResponse;
|
import com.chint.interfaces.rest.ctrip.dto.login.PCResponse;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
@ -43,17 +45,17 @@ public class CTripTest {
|
||||||
|
|
||||||
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
|
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
void locationCountry() {
|
void locationCountry() {
|
||||||
System.out.println(cTripLocationHttpRequest.syncCountry());
|
System.out.println(cTripLocationHttpRequest.syncCountry());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
void locationCity() {
|
void locationCity() {
|
||||||
System.out.println(cTripLocationHttpRequest.syncCity(2));
|
System.out.println(cTripLocationHttpRequest.syncCity(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
void syncAllCity() {
|
void syncAllCity() {
|
||||||
List<CTripCountry> countries = cTripLocationHttpRequest.syncCountry();
|
List<CTripCountry> countries = cTripLocationHttpRequest.syncCountry();
|
||||||
for (CTripCountry country : countries) {
|
for (CTripCountry country : countries) {
|
||||||
|
@ -62,18 +64,18 @@ public class CTripTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
void SaveCorpCustInfoList() {
|
void SaveCorpCustInfoList() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
cTripUserSaveRequest.saveUserToCTrip();
|
cTripUserSaveRequest.saveUserToCTrip();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
void approval() {
|
void approval() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
void login() {
|
void login() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
CTripLoginParam cTripLoginParam = new CTripLoginParam();
|
CTripLoginParam cTripLoginParam = new CTripLoginParam();
|
||||||
|
@ -81,7 +83,7 @@ public class CTripTest {
|
||||||
loginRequest.login(cTripLoginParam);
|
loginRequest.login(cTripLoginParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
void authLogin() {
|
void authLogin() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
PCResponse response = loginRequest.authLogin();
|
PCResponse response = loginRequest.authLogin();
|
||||||
|
@ -89,35 +91,51 @@ public class CTripTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
void hSingleLogin() {
|
void hSingleLogin() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
System.out.println(loginRequest.hSingleLogin().getRedirectUrl());
|
System.out.println(loginRequest.hSingleLogin().getRedirectUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
void h5LoginTest() {
|
void h5LoginTest() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
System.out.println(loginRequest.h5Login());
|
System.out.println(loginRequest.h5Login());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
void estimate() {
|
void estimateFlight() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
FlightProductInfo flightProductInfo = new FlightProductInfo();
|
FlightProductInfo flightProductInfo = new FlightProductInfo();
|
||||||
flightProductInfo.setClassType("YCF");
|
flightProductInfo.setClassType("YCF");
|
||||||
RouteInfo routeInfo = new RouteInfo();
|
RouteInfo routeInfo = new RouteInfo();
|
||||||
routeInfo.setArriveCityID("17");
|
routeInfo.setArriveCityID("1");
|
||||||
routeInfo.setDepartCityID("491");
|
routeInfo.setDepartCityID("491");
|
||||||
routeInfo.setDepartDate("2024-04-01");
|
routeInfo.setDepartDate("2024-03-01");
|
||||||
flightProductInfo.setRoutes(List.of(routeInfo));
|
flightProductInfo.setRoutes(List.of(routeInfo));
|
||||||
BookingRelatedApiRequest bookingRelatedApiRequest = estimateRequest
|
BookingRelatedApiRequest bookingRelatedApiRequest = estimateRequest
|
||||||
.generateBaseRequest(flightProductInfo, null);
|
.generateBaseRequest(flightProductInfo, null);
|
||||||
BookingRelatedApiResponse estimate = estimateRequest.estimate(bookingRelatedApiRequest);
|
BookingRelatedApiResponse estimate = estimateRequest.estimate(bookingRelatedApiRequest);
|
||||||
System.out.println(estimate);
|
Gson gson = new Gson();
|
||||||
|
System.out.println(gson.toJson(estimate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
|
void estimateTrain() {
|
||||||
|
BaseContext.setCurrentUser(user);
|
||||||
|
TrainProductInfo trainProductInfo = new TrainProductInfo();
|
||||||
|
trainProductInfo.setArriveCityID("17");
|
||||||
|
trainProductInfo.setDepartCityID("1");
|
||||||
|
trainProductInfo.setDepartDate("2024-03-01");
|
||||||
|
trainProductInfo.setReturnNoTicket(true);
|
||||||
|
BookingRelatedApiRequest bookingRelatedApiRequest = estimateRequest
|
||||||
|
.generateBaseRequest(null, trainProductInfo);
|
||||||
|
BookingRelatedApiResponse estimate = estimateRequest.estimate(bookingRelatedApiRequest);
|
||||||
|
Gson gson = new Gson();
|
||||||
|
System.out.println(gson.toJson(estimate));
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Test
|
||||||
void search() {
|
void search() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
SearchOrderResponse response = orderSearchRequest.searchOrder("actual12345622");
|
SearchOrderResponse response = orderSearchRequest.searchOrder("actual12345622");
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class LYTest {
|
||||||
|
|
||||||
|
|
||||||
//机票订单最新价格校验
|
//机票订单最新价格校验
|
||||||
@Test
|
// @Test
|
||||||
void ticketNewPrice() {
|
void ticketNewPrice() {
|
||||||
String flyPriceUrl = Constant.L_Y_BASE_URL + Constant.L_Y_FLY_PRICE;
|
String flyPriceUrl = Constant.L_Y_BASE_URL + Constant.L_Y_FLY_PRICE;
|
||||||
TicketNewPrice ticketNewPrice = new TicketNewPrice();
|
TicketNewPrice ticketNewPrice = new TicketNewPrice();
|
||||||
|
@ -79,7 +79,7 @@ public class LYTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
///查询酒店最小价格
|
///查询酒店最小价格
|
||||||
@Test
|
// @Test
|
||||||
void hotleMinPrice() {
|
void hotleMinPrice() {
|
||||||
String HotelListUrl = Constant.L_Y_BASE_URL + Constant.L_Y_HOTEL_List;
|
String HotelListUrl = Constant.L_Y_BASE_URL + Constant.L_Y_HOTEL_List;
|
||||||
HotelCityList hotelCityList = new HotelCityList();
|
HotelCityList hotelCityList = new HotelCityList();
|
||||||
|
@ -104,7 +104,7 @@ public class LYTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
//火车票最高价查询
|
//火车票最高价查询
|
||||||
@Test
|
// @Test
|
||||||
void maxPrice() {
|
void maxPrice() {
|
||||||
String maxPriceUrl = Constant.L_Y_BASE_URL + Constant.L_Y_TRAIN_MAX_PRICE;
|
String maxPriceUrl = Constant.L_Y_BASE_URL + Constant.L_Y_TRAIN_MAX_PRICE;
|
||||||
TrainMaxPrice trainMaxPrice = new TrainMaxPrice();
|
TrainMaxPrice trainMaxPrice = new TrainMaxPrice();
|
||||||
|
@ -126,7 +126,7 @@ public class LYTest {
|
||||||
System.out.println(max);
|
System.out.println(max);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
//外部差旅单同步
|
//外部差旅单同步
|
||||||
void ApplyOrderSync() {
|
void ApplyOrderSync() {
|
||||||
AOSParam aosParam = new AOSParam();
|
AOSParam aosParam = new AOSParam();
|
||||||
|
@ -207,7 +207,7 @@ public class LYTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
//同步同程订单
|
//同步同程订单
|
||||||
@Test
|
// @Test
|
||||||
void syncSupplierOrder() {
|
void syncSupplierOrder() {
|
||||||
String supplierOrderSyncUrl = Constant.L_Y_BASE_URL + Constant.L_Y_ORDER_PATH;
|
String supplierOrderSyncUrl = Constant.L_Y_BASE_URL + Constant.L_Y_ORDER_PATH;
|
||||||
SupplierOrderParam param = new SupplierOrderParam();
|
SupplierOrderParam param = new SupplierOrderParam();
|
||||||
|
@ -262,25 +262,25 @@ public class LYTest {
|
||||||
System.out.println(post);
|
System.out.println(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
void loadToken() {
|
void loadToken() {
|
||||||
System.out.println(lyTokenRequest.loadToken());
|
System.out.println(lyTokenRequest.loadToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
void saveCurrentUser2Ly() {
|
void saveCurrentUser2Ly() {
|
||||||
// BaseContext.setCurrentUser(user);
|
// BaseContext.setCurrentUser(user);
|
||||||
BaseContext.setCurrentUser(hxh);
|
BaseContext.setCurrentUser(hxh);
|
||||||
System.out.println(lyUserRequest.saveCurrentUser());
|
System.out.println(lyUserRequest.saveCurrentUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
void loginLY() {
|
void loginLY() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
System.out.println(loginRequest.login(L_Y_ENTRANCE_HOME));
|
System.out.println(loginRequest.login(L_Y_ENTRANCE_HOME));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
void loginLYPC() {
|
void loginLYPC() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
System.out.println(loginRequest.loginPC(L_Y_ENTRANCE_HOME));
|
System.out.println(loginRequest.loginPC(L_Y_ENTRANCE_HOME));
|
||||||
|
|
|
@ -1,37 +1,58 @@
|
||||||
package com.chint;
|
package com.chint;
|
||||||
|
|
||||||
|
import cn.hutool.extra.pinyin.PinyinUtil;
|
||||||
|
import com.chint.domain.aggregates.order.Location;
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.infrastructure.util.BaseContext;
|
import com.chint.domain.repository.LocationRepository;
|
||||||
import com.chint.infrastructure.util.Digest;
|
import com.chint.infrastructure.util.Digest;
|
||||||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
class RouteApplicationTests {
|
class RouteApplicationTests {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserHttpRequest userHttpRequest;
|
private UserHttpRequest userHttpRequest;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LocationRepository locationRepository;
|
||||||
|
|
||||||
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
|
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
|
||||||
|
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
void contextLoads() {
|
void contextLoads() {
|
||||||
|
|
||||||
userHttpRequest.loadUserInfo(user);
|
userHttpRequest.loadUserInfo(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void loginSign(){
|
void loginSign() {
|
||||||
String sfno = "230615020";
|
String sfno = "220322120";
|
||||||
String syscode = "abc";
|
String syscode = "abc";
|
||||||
String billcode = "12321412323";
|
String billcode = "12345622";
|
||||||
String sec = "Superdandan";
|
String sec = "Superdandan";
|
||||||
String timespan = "12312312312312";
|
String timespan = "12312312312312";
|
||||||
|
|
||||||
String s = Digest.md5(sfno + syscode + billcode + sec + timespan);
|
String s = Digest.md5(sfno + syscode + billcode + sec + timespan);
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
void handleLocation() {
|
||||||
|
List<Location> all = locationRepository.findAll();
|
||||||
|
|
||||||
|
all.forEach(
|
||||||
|
location ->{
|
||||||
|
char c = location.getLocationName().charAt(0);
|
||||||
|
char firstLetter = PinyinUtil.getFirstLetter(c);
|
||||||
|
String h3 = String.valueOf(firstLetter).toUpperCase();
|
||||||
|
location.setFirstPinYin(h3);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
locationRepository.saveAll(all);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue