添加dockerfile
This commit is contained in:
parent
ec68c44112
commit
2d48aeb8df
8
pom.xml
8
pom.xml
|
@ -66,6 +66,11 @@
|
|||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.7.22</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
<version>2.5.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
|
@ -78,6 +83,9 @@
|
|||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>
|
||||
app
|
||||
</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
|
@ -8,4 +8,6 @@ public class LocationParam extends BaseQuery {
|
|||
private Long level;
|
||||
private Long parentLocationId;
|
||||
private String cityName;
|
||||
private String firstLetter;
|
||||
private Integer cityType;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.chint.application.out;
|
|||
import com.chint.application.dtos.LocationParam;
|
||||
import com.chint.domain.aggregates.order.Location;
|
||||
import com.chint.domain.repository.LocationRepository;
|
||||
import com.chint.domain.service.LocationDomainService;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
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.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.Constant.SUCCESS;
|
||||
|
||||
@RestController
|
||||
|
@ -21,9 +24,18 @@ public class LocationController {
|
|||
@Autowired
|
||||
private LocationRepository locationRepository;
|
||||
|
||||
@Autowired
|
||||
private LocationDomainService locationDomainService;
|
||||
|
||||
@ApiOperation("分页查询地理信息")
|
||||
@PostMapping("/pageQuery")
|
||||
public Result<PageResult<Location>> pageQuery(@RequestBody LocationParam 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));
|
||||
}
|
||||
}
|
|
@ -32,6 +32,8 @@ public class Leg {
|
|||
|
||||
private LocalDateTime endTime;
|
||||
|
||||
private String estimateAmount;
|
||||
|
||||
@Column("origin_id")
|
||||
private Long originId;
|
||||
@Transient
|
||||
|
@ -45,8 +47,6 @@ public class Leg {
|
|||
@Transient
|
||||
private String amount;
|
||||
@Transient
|
||||
private String estimateAmount;
|
||||
@Transient
|
||||
private String legTypeName;
|
||||
@Transient
|
||||
private Integer legStatus;
|
||||
|
|
|
@ -20,6 +20,7 @@ public class Location {
|
|||
private String locationPathName;
|
||||
private String locationName;
|
||||
private String locationShortName;
|
||||
private String firstPinYin;
|
||||
private Long parentLocationId;
|
||||
@Column("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.infrastructure.util.PageResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface LocationRepository {
|
||||
// List<Location> findByHot(List<LocationHot> locationHots);
|
||||
Location findByLocationId(Long locationId);
|
||||
|
||||
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 {
|
||||
User findById(Long id);
|
||||
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.RouteOrder;
|
||||
import com.chint.interfaces.rest.ctrip.CTripEstimateRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class CTripEstimate implements AmountEstimate {
|
||||
|
||||
@Autowired
|
||||
private CTripEstimateRequest cTripEstimateRequest;
|
||||
@Override
|
||||
public String amountEstimate(Leg leg) {
|
||||
|
||||
// cTripEstimateRequest.generateBaseRequest(null,)
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.chint.domain.service.auth;
|
||||
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.factoriy.user.UserFactory;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.value_object.UserLoginParam;
|
||||
import com.chint.domain.value_object.UserLoginResult;
|
||||
|
@ -21,6 +22,9 @@ public class AuthenticateServiceImpl implements AuthenticateService {
|
|||
private final UserRepository userRepository;
|
||||
private final UserHttpRequest httpRequest;
|
||||
|
||||
@Autowired
|
||||
private UserFactory userFactory;
|
||||
|
||||
@Autowired
|
||||
private Json json;
|
||||
|
||||
|
@ -51,7 +55,11 @@ public class AuthenticateServiceImpl implements AuthenticateService {
|
|||
|
||||
return UserLoginResult.buildWithUser(user).loadToken(Token.of(jwt));
|
||||
} else {
|
||||
throw new RuntimeException(NOT_FOUND);
|
||||
User newUser = userFactory.create(userLoginParam.getSfno());
|
||||
//如果数据库不存在该用户,需要通过sf信息进行查询并保存到数据库
|
||||
httpRequest.loadUserInfo(newUser);
|
||||
userRepository.save(newUser);
|
||||
return authenticateEmployeeNo(userLoginParam);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -197,4 +197,9 @@ public class Constant {
|
|||
|
||||
// status
|
||||
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;//国外
|
||||
}
|
||||
|
|
|
@ -10,6 +10,9 @@ import org.springframework.data.domain.Page;
|
|||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public class LocationRepositoryImpl implements LocationRepository {
|
||||
@Autowired
|
||||
|
@ -40,4 +43,21 @@ public class LocationRepositoryImpl implements LocationRepository {
|
|||
}
|
||||
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) {
|
||||
return jdbcUserRepository.findByEmployeeNo(employeeNo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public User save(User user) {
|
||||
return jdbcUserRepository.save(user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import org.springframework.data.domain.Pageable;
|
|||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
|
||||
Location findByLocationId(Long locationId);
|
||||
|
@ -16,4 +18,6 @@ public interface JdbcLocationRepository extends CrudRepository<Location,Long> {
|
|||
|
||||
Page<Location> findAllByLevel(Long level, Pageable pageable);
|
||||
|
||||
List<Location> findByFirstPinYin(String firstPinYin);
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class CTripEstimateRequest {
|
|||
|
||||
public BookingRelatedApiRequest generateBaseRequest(FlightProductInfo flightProductInfo, TrainProductInfo trainProductInfo) {
|
||||
BookingRelatedApiRequest bookingRelatedApiRequest = new BookingRelatedApiRequest();
|
||||
String token = tokenRequest.getToken();
|
||||
String token = tokenRequest.getToken(1);
|
||||
bookingRelatedApiRequest.setApiName(apiName);
|
||||
bookingRelatedApiRequest.setLanguage(LANGUAGE_CN);
|
||||
bookingRelatedApiRequest.setAuthInfo(AuthInfo.of(C_TRIP_APP_KEY, token));
|
||||
|
@ -57,7 +57,7 @@ public class CTripEstimateRequest {
|
|||
.requestContent()
|
||||
.valuationBaseInfo()
|
||||
.eID(user.getEmployeeNo().toString())
|
||||
.corpID("zhengtai")
|
||||
.corpID(C_TRIP_CORP_ID)
|
||||
// .rankName(user.getRankCode())
|
||||
.done()
|
||||
.valuationProductInfo()
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||
public class BookingRelatedApiResponse {
|
||||
|
||||
// 请求相关API的响应
|
||||
private ResponseStatus status;
|
||||
private EstimateResponseStatus status;
|
||||
// 数据内容
|
||||
private ValuateBudgetResponseType data;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -5,6 +5,9 @@ package com.chint.interfaces.rest.user;
|
|||
//import com.chint.dc.api.DataCenterResult;
|
||||
//import com.chint.dc.api.dto.DataCenterOption;
|
||||
//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.interfaces.rest.base.PostRequest;
|
||||
import com.chint.interfaces.rest.user.dto.*;
|
||||
|
@ -40,14 +43,14 @@ public class UserHttpRequestImpl implements UserHttpRequest {
|
|||
}
|
||||
|
||||
private User loadSFAndRank(User user) {
|
||||
// List<UserDataDTO> loadSFInfo = loadSFInfo(user);
|
||||
// String custManaLevel = loadSFInfo.get(0).getCust_manaLevel();
|
||||
// String level = custManaLevel != null ? custManaLevel : "M0";
|
||||
// if (level.contains("R")) {
|
||||
// level = level.substring(0, level.length() - 3) + "M0";
|
||||
// }
|
||||
// TravelRankDTO loadTravelRank = loadTravelRank(new TravelRankParam(level));
|
||||
// user.setRankCode(loadTravelRank.getLEVEL_MAPPING_CODE());
|
||||
List<UserDataDTO> loadSFInfo = loadSFInfo(user);
|
||||
String custManaLevel = loadSFInfo.get(0).getCust_manaLevel();
|
||||
String level = custManaLevel != null ? custManaLevel : "M0";
|
||||
if (level.contains("R")) {
|
||||
level = level.substring(0, level.length() - 3) + "M0";
|
||||
}
|
||||
TravelRankDTO loadTravelRank = loadTravelRank(new TravelRankParam(level));
|
||||
user.setRankCode(loadTravelRank.getLEVEL_MAPPING_CODE());
|
||||
user.setRankCode("测试职级");
|
||||
return user;
|
||||
}
|
||||
|
@ -67,31 +70,33 @@ public class UserHttpRequestImpl implements UserHttpRequest {
|
|||
}
|
||||
|
||||
private List<UserDataDTO> loadSFInfo(User user) {
|
||||
// Gson gson = new Gson();
|
||||
// AccessKeyDTO akSkLoad = akSkLoad();
|
||||
// DataCenterOption option = new DataCenterOption();
|
||||
// option.setSk(akSkLoad.sk);
|
||||
// option.setAk(akSkLoad.ak);
|
||||
// option.setUrl(OPENAI_BASE_URL);
|
||||
// DataCenterService dataCenterService = new DataCenterService(option);
|
||||
// LinkedHashMap map = new LinkedHashMap<String, Object>();
|
||||
// map.put("LoginUsername", user.getEmployeeNo().toString());
|
||||
// map.put("start", 0);
|
||||
// map.put("pageSize", 1);
|
||||
// DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
|
||||
// Type type = new TypeToken<List<UserDataDTO>>() {
|
||||
// }.getType();
|
||||
// if (result.getData() != null) {
|
||||
// List<UserDataDTO> fromJson = gson.fromJson(result.getData().toString(), type);
|
||||
// UserDataDTO userDataDTO = fromJson.get(0);
|
||||
// user.setCompanyCode(userDataDTO.getCompany());
|
||||
// user.setWorkStatus(userDataDTO.getStatus());
|
||||
// user.setGender(userDataDTO.getGender());
|
||||
// return fromJson;
|
||||
// } else {
|
||||
// throw new RuntimeException("用户数据不存在");
|
||||
// }
|
||||
return null;
|
||||
Gson gson = new Gson();
|
||||
AccessKeyDTO akSkLoad = akSkLoad();
|
||||
DataCenterOption option = new DataCenterOption();
|
||||
option.setSk(akSkLoad.sk);
|
||||
option.setAk(akSkLoad.ak);
|
||||
option.setUrl(OPENAI_BASE_URL);
|
||||
DataCenterService dataCenterService = new DataCenterService(option);
|
||||
LinkedHashMap map = new LinkedHashMap<String, Object>();
|
||||
map.put("LoginUsername", user.getEmployeeNo().toString());
|
||||
map.put("start", 0);
|
||||
map.put("pageSize", 1);
|
||||
DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
|
||||
Type type = new TypeToken<List<UserDataDTO>>() {
|
||||
}.getType();
|
||||
if (result.getData() != null) {
|
||||
List<UserDataDTO> fromJson = gson.fromJson(result.getData().toString(), type);
|
||||
UserDataDTO userDataDTO = fromJson.get(0);
|
||||
user.setCompanyCode(userDataDTO.getCompany());
|
||||
user.setWorkStatus(userDataDTO.getStatus());
|
||||
user.setGender(userDataDTO.getGender());
|
||||
user.setName(userDataDTO.getUname());
|
||||
user.setPhoneNumber(userDataDTO.getMobilePhone());
|
||||
return fromJson;
|
||||
} else {
|
||||
throw new RuntimeException("用户数据不存在");
|
||||
}
|
||||
// return null;
|
||||
}
|
||||
|
||||
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:
|
||||
port: 8081
|
||||
port: 8080
|
||||
|
||||
chint:
|
||||
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,6 +7,7 @@ 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.FlightProductInfo;
|
||||
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.location.CTripCity;
|
||||
import com.chint.interfaces.rest.ctrip.dto.location.CTripCountry;
|
||||
|
@ -43,17 +44,17 @@ public class CTripTest {
|
|||
|
||||
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void locationCountry() {
|
||||
System.out.println(cTripLocationHttpRequest.syncCountry());
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void locationCity() {
|
||||
System.out.println(cTripLocationHttpRequest.syncCity(2));
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void syncAllCity() {
|
||||
List<CTripCountry> countries = cTripLocationHttpRequest.syncCountry();
|
||||
for (CTripCountry country : countries) {
|
||||
|
@ -62,18 +63,18 @@ public class CTripTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void SaveCorpCustInfoList() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
cTripUserSaveRequest.saveUserToCTrip();
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void approval() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void login() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
CTripLoginParam cTripLoginParam = new CTripLoginParam();
|
||||
|
@ -81,7 +82,7 @@ public class CTripTest {
|
|||
loginRequest.login(cTripLoginParam);
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void authLogin() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
PCResponse response = loginRequest.authLogin();
|
||||
|
@ -89,20 +90,20 @@ public class CTripTest {
|
|||
}
|
||||
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void hSingleLogin() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
System.out.println(loginRequest.hSingleLogin().getRedirectUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void h5LoginTest() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
System.out.println(loginRequest.h5Login());
|
||||
}
|
||||
|
||||
@Test
|
||||
void estimate() {
|
||||
// @Test
|
||||
void estimateFlight() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
FlightProductInfo flightProductInfo = new FlightProductInfo();
|
||||
flightProductInfo.setClassType("YCF");
|
||||
|
@ -117,7 +118,21 @@ public class CTripTest {
|
|||
System.out.println(estimate);
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void estimateTrain() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
TrainProductInfo trainProductInfo = new TrainProductInfo();
|
||||
trainProductInfo.setArriveCityID("17");
|
||||
trainProductInfo.setDepartCityID("491");
|
||||
trainProductInfo.setDepartDate("2024-03-01");
|
||||
trainProductInfo.setReturnNoTicket(true);
|
||||
BookingRelatedApiRequest bookingRelatedApiRequest = estimateRequest
|
||||
.generateBaseRequest(null, trainProductInfo);
|
||||
BookingRelatedApiResponse estimate = estimateRequest.estimate(bookingRelatedApiRequest);
|
||||
System.out.println(estimate);
|
||||
}
|
||||
|
||||
// @Test
|
||||
void search() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
SearchOrderResponse response = orderSearchRequest.searchOrder("actual12345622");
|
||||
|
|
|
@ -67,7 +67,7 @@ public class LYTest {
|
|||
|
||||
|
||||
//机票订单最新价格校验
|
||||
@Test
|
||||
// @Test
|
||||
void ticketNewPrice() {
|
||||
String flyPriceUrl = Constant.L_Y_BASE_URL + Constant.L_Y_FLY_PRICE;
|
||||
TicketNewPrice ticketNewPrice = new TicketNewPrice();
|
||||
|
@ -79,7 +79,7 @@ public class LYTest {
|
|||
}
|
||||
|
||||
///查询酒店最小价格
|
||||
@Test
|
||||
// @Test
|
||||
void hotleMinPrice() {
|
||||
String HotelListUrl = Constant.L_Y_BASE_URL + Constant.L_Y_HOTEL_List;
|
||||
HotelCityList hotelCityList = new HotelCityList();
|
||||
|
@ -104,7 +104,7 @@ public class LYTest {
|
|||
}
|
||||
|
||||
//火车票最高价查询
|
||||
@Test
|
||||
// @Test
|
||||
void maxPrice() {
|
||||
String maxPriceUrl = Constant.L_Y_BASE_URL + Constant.L_Y_TRAIN_MAX_PRICE;
|
||||
TrainMaxPrice trainMaxPrice = new TrainMaxPrice();
|
||||
|
@ -126,7 +126,7 @@ public class LYTest {
|
|||
System.out.println(max);
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
//外部差旅单同步
|
||||
void ApplyOrderSync() {
|
||||
AOSParam aosParam = new AOSParam();
|
||||
|
@ -207,7 +207,7 @@ public class LYTest {
|
|||
}
|
||||
|
||||
//同步同程订单
|
||||
@Test
|
||||
// @Test
|
||||
void syncSupplierOrder() {
|
||||
String supplierOrderSyncUrl = Constant.L_Y_BASE_URL + Constant.L_Y_ORDER_PATH;
|
||||
SupplierOrderParam param = new SupplierOrderParam();
|
||||
|
@ -262,25 +262,25 @@ public class LYTest {
|
|||
System.out.println(post);
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void loadToken() {
|
||||
System.out.println(lyTokenRequest.loadToken());
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void saveCurrentUser2Ly() {
|
||||
// BaseContext.setCurrentUser(user);
|
||||
BaseContext.setCurrentUser(hxh);
|
||||
System.out.println(lyUserRequest.saveCurrentUser());
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void loginLY() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
System.out.println(loginRequest.login(L_Y_ENTRANCE_HOME));
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void loginLYPC() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
System.out.println(loginRequest.loginPC(L_Y_ENTRANCE_HOME));
|
||||
|
|
|
@ -1,37 +1,59 @@
|
|||
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.infrastructure.util.BaseContext;
|
||||
import com.chint.domain.repository.LocationRepository;
|
||||
import com.chint.infrastructure.util.Digest;
|
||||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest
|
||||
class RouteApplicationTests {
|
||||
|
||||
@Autowired
|
||||
private UserHttpRequest userHttpRequest;
|
||||
|
||||
@Autowired
|
||||
private LocationRepository locationRepository;
|
||||
|
||||
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
|
||||
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void contextLoads() {
|
||||
|
||||
userHttpRequest.loadUserInfo(user);
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void loginSign() {
|
||||
String sfno = "230615020";
|
||||
String sfno = "220322120";
|
||||
String syscode = "abc";
|
||||
String billcode = "12321412323";
|
||||
String billcode = "12345622";
|
||||
String sec = "Superdandan";
|
||||
String timespan = "12312312312312";
|
||||
|
||||
String s = Digest.md5(sfno + syscode + billcode + sec + timespan);
|
||||
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