From 2d48aeb8dfe630dab5a1fcd6bca11bc2bbb65ebb Mon Sep 17 00:00:00 2001 From: lulz1 Date: Sun, 18 Feb 2024 13:48:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 +++ .../chint/application/dtos/LocationParam.java | 2 + .../application/out/LocationController.java | 12 ++++ .../chint/domain/aggregates/order/Leg.java | 4 +- .../domain/aggregates/order/Location.java | 1 + .../domain/factoriy/user/UserFactory.java | 7 ++ .../domain/factoriy/user/UserFactoryImpl.java | 14 ++++ .../domain/repository/LocationRepository.java | 11 ++- .../domain/repository/UserRepository.java | 2 + .../domain/service/LocationDomainService.java | 36 ++++++++++ .../amount_estimate/CTripEstimate.java | 8 +++ .../service/auth/AuthenticateServiceImpl.java | 10 ++- .../infrastructure/constant/Constant.java | 5 ++ .../repository/LocationRepositoryImpl.java | 22 +++++- .../repository/UserRepositoryImpl.java | 5 ++ .../jdbc/JdbcLocationRepository.java | 6 +- .../rest/ctrip/CTripEstimateRequest.java | 4 +- .../response/BookingRelatedApiResponse.java | 2 +- .../response/EstimateResponseStatus.java | 10 +++ .../rest/user/UserHttpRequestImpl.java | 71 ++++++++++--------- src/main/resources/Dockerfile | 13 ++++ src/main/resources/application-dev.yml | 2 +- src/main/resources/gitea.yml | 26 ------- src/test/java/com/chint/CTripTest.java | 39 ++++++---- src/test/java/com/chint/LYTest.java | 18 ++--- .../java/com/chint/RouteApplicationTests.java | 36 ++++++++-- 26 files changed, 277 insertions(+), 97 deletions(-) create mode 100644 src/main/java/com/chint/domain/factoriy/user/UserFactory.java create mode 100644 src/main/java/com/chint/domain/factoriy/user/UserFactoryImpl.java create mode 100644 src/main/java/com/chint/domain/service/LocationDomainService.java create mode 100644 src/main/java/com/chint/interfaces/rest/ctrip/dto/estimate/response/EstimateResponseStatus.java create mode 100644 src/main/resources/Dockerfile delete mode 100644 src/main/resources/gitea.yml diff --git a/pom.xml b/pom.xml index dc8d08b0..d46bf80d 100644 --- a/pom.xml +++ b/pom.xml @@ -66,6 +66,11 @@ hutool-all 5.7.22 + + com.belerweb + pinyin4j + 2.5.1 + com.github.xiaoymin knife4j-spring-boot-starter @@ -78,6 +83,9 @@ + + app + org.springframework.boot diff --git a/src/main/java/com/chint/application/dtos/LocationParam.java b/src/main/java/com/chint/application/dtos/LocationParam.java index fcf99ad9..3e36eef2 100644 --- a/src/main/java/com/chint/application/dtos/LocationParam.java +++ b/src/main/java/com/chint/application/dtos/LocationParam.java @@ -8,4 +8,6 @@ public class LocationParam extends BaseQuery { private Long level; private Long parentLocationId; private String cityName; + private String firstLetter; + private Integer cityType; } diff --git a/src/main/java/com/chint/application/out/LocationController.java b/src/main/java/com/chint/application/out/LocationController.java index ef0ac836..58fead71 100644 --- a/src/main/java/com/chint/application/out/LocationController.java +++ b/src/main/java/com/chint/application/out/LocationController.java @@ -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> pageQuery(@RequestBody LocationParam locationParam) { return Result.Success(SUCCESS, locationRepository.pageQuery(locationParam)); } + + @ApiOperation("根据首字母查询地理信息") + @PostMapping("/query/firstLetter") + public Result> queryByFirstLetter(@RequestBody LocationParam locationParam) { + return Result.Success(SUCCESS, locationDomainService.queryByFirstLetter(locationParam)); + } } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/aggregates/order/Leg.java b/src/main/java/com/chint/domain/aggregates/order/Leg.java index d5002921..7787f31c 100644 --- a/src/main/java/com/chint/domain/aggregates/order/Leg.java +++ b/src/main/java/com/chint/domain/aggregates/order/Leg.java @@ -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; diff --git a/src/main/java/com/chint/domain/aggregates/order/Location.java b/src/main/java/com/chint/domain/aggregates/order/Location.java index 0c7b5196..9b21aa7c 100644 --- a/src/main/java/com/chint/domain/aggregates/order/Location.java +++ b/src/main/java/com/chint/domain/aggregates/order/Location.java @@ -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; diff --git a/src/main/java/com/chint/domain/factoriy/user/UserFactory.java b/src/main/java/com/chint/domain/factoriy/user/UserFactory.java new file mode 100644 index 00000000..a179a3c0 --- /dev/null +++ b/src/main/java/com/chint/domain/factoriy/user/UserFactory.java @@ -0,0 +1,7 @@ +package com.chint.domain.factoriy.user; + +import com.chint.domain.aggregates.user.User; + +public interface UserFactory { + User create(String employeeNo); +} diff --git a/src/main/java/com/chint/domain/factoriy/user/UserFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/user/UserFactoryImpl.java new file mode 100644 index 00000000..1277f7ab --- /dev/null +++ b/src/main/java/com/chint/domain/factoriy/user/UserFactoryImpl.java @@ -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; + } +} diff --git a/src/main/java/com/chint/domain/repository/LocationRepository.java b/src/main/java/com/chint/domain/repository/LocationRepository.java index 7a8b7566..0a51f776 100644 --- a/src/main/java/com/chint/domain/repository/LocationRepository.java +++ b/src/main/java/com/chint/domain/repository/LocationRepository.java @@ -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 findByHot(List locationHots); + // List findByHot(List locationHots); Location findByLocationId(Long locationId); + PageResult pageQuery(LocationParam locationParam); + + List findAll(); + + void saveAll(List locations); + + List findByFirstLetter(LocationParam locationParam); } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/repository/UserRepository.java b/src/main/java/com/chint/domain/repository/UserRepository.java index 4fb7fd80..54e194a6 100644 --- a/src/main/java/com/chint/domain/repository/UserRepository.java +++ b/src/main/java/com/chint/domain/repository/UserRepository.java @@ -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); } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/service/LocationDomainService.java b/src/main/java/com/chint/domain/service/LocationDomainService.java new file mode 100644 index 00000000..319a6db2 --- /dev/null +++ b/src/main/java/com/chint/domain/service/LocationDomainService.java @@ -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 queryByFirstLetter(LocationParam locationParam) { + List 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); + }; + + } + +} diff --git a/src/main/java/com/chint/domain/service/amount_estimate/CTripEstimate.java b/src/main/java/com/chint/domain/service/amount_estimate/CTripEstimate.java index 89e20371..75029767 100644 --- a/src/main/java/com/chint/domain/service/amount_estimate/CTripEstimate.java +++ b/src/main/java/com/chint/domain/service/amount_estimate/CTripEstimate.java @@ -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; } diff --git a/src/main/java/com/chint/domain/service/auth/AuthenticateServiceImpl.java b/src/main/java/com/chint/domain/service/auth/AuthenticateServiceImpl.java index a05fff5e..50eb2bd3 100644 --- a/src/main/java/com/chint/domain/service/auth/AuthenticateServiceImpl.java +++ b/src/main/java/com/chint/domain/service/auth/AuthenticateServiceImpl.java @@ -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); } } } \ No newline at end of file diff --git a/src/main/java/com/chint/infrastructure/constant/Constant.java b/src/main/java/com/chint/infrastructure/constant/Constant.java index e16b33ec..bf5aefb5 100644 --- a/src/main/java/com/chint/infrastructure/constant/Constant.java +++ b/src/main/java/com/chint/infrastructure/constant/Constant.java @@ -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;//国外 } diff --git a/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java index 00ef1f48..950e77a8 100644 --- a/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java @@ -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 @@ -26,7 +29,7 @@ public class LocationRepositoryImpl implements LocationRepository { locationParam.getPageNum() - 1, locationParam.getPageSize() ); - if(locationParam.getCityName() != null){ + if (locationParam.getCityName() != null) { Page res = jdbcLocationRepository.findAllByLocationPathContaining(locationParam.getCityName(), pageResult); return PageResult.totalPageNum(res.getTotalElements(), res.toList()); } @@ -40,4 +43,21 @@ public class LocationRepositoryImpl implements LocationRepository { } return PageResult.empty(); } + + @Override + public List findAll() { + List res = new ArrayList<>(); + jdbcLocationRepository.findAll().forEach(res::add); + return res; + } + + @Override + public void saveAll(List locations) { + jdbcLocationRepository.saveAll(locations); + } + + @Override + public List findByFirstLetter(LocationParam locationParam) { + return jdbcLocationRepository.findByFirstPinYin(locationParam.getFirstLetter()); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/UserRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/UserRepositoryImpl.java index e757abd3..8a9c57fb 100644 --- a/src/main/java/com/chint/infrastructure/repository/UserRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/UserRepositoryImpl.java @@ -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); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java index 2b9468c3..e235f9e2 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java @@ -6,8 +6,10 @@ 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 { +public interface JdbcLocationRepository extends CrudRepository { Location findByLocationId(Long locationId); Page findAllByLocationPathContaining(String locationPath, Pageable pageable); @@ -16,4 +18,6 @@ public interface JdbcLocationRepository extends CrudRepository { Page findAllByLevel(Long level, Pageable pageable); + List findByFirstPinYin(String firstPinYin); + } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripEstimateRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripEstimateRequest.java index cc62f048..5716995b 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/CTripEstimateRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripEstimateRequest.java @@ -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() diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/estimate/response/BookingRelatedApiResponse.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/estimate/response/BookingRelatedApiResponse.java index a1c907c8..5cce4f39 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/estimate/response/BookingRelatedApiResponse.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/estimate/response/BookingRelatedApiResponse.java @@ -9,7 +9,7 @@ import java.util.List; public class BookingRelatedApiResponse { // 请求相关API的响应 - private ResponseStatus status; + private EstimateResponseStatus status; // 数据内容 private ValuateBudgetResponseType data; diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/estimate/response/EstimateResponseStatus.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/estimate/response/EstimateResponseStatus.java new file mode 100644 index 00000000..126a9968 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/estimate/response/EstimateResponseStatus.java @@ -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; +} diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java index ebab87a4..9b9f524e 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -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 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 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 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(); -// 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>() { -// }.getType(); -// if (result.getData() != null) { -// List 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(); + 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>() { + }.getType(); + if (result.getData() != null) { + List 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) { diff --git a/src/main/resources/Dockerfile b/src/main/resources/Dockerfile new file mode 100644 index 00000000..84fb10a4 --- /dev/null +++ b/src/main/resources/Dockerfile @@ -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"] \ No newline at end of file diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 9d4aa49f..9d1e0bcc 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,5 +1,5 @@ server: - port: 8081 + port: 8080 chint: datasource: diff --git a/src/main/resources/gitea.yml b/src/main/resources/gitea.yml deleted file mode 100644 index a2ecf0fb..00000000 --- a/src/main/resources/gitea.yml +++ /dev/null @@ -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" \ No newline at end of file diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index 7435b3d3..68b4a2ff 100644 --- a/src/test/java/com/chint/CTripTest.java +++ b/src/test/java/com/chint/CTripTest.java @@ -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 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"); diff --git a/src/test/java/com/chint/LYTest.java b/src/test/java/com/chint/LYTest.java index 1e685cae..626aff02 100644 --- a/src/test/java/com/chint/LYTest.java +++ b/src/test/java/com/chint/LYTest.java @@ -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)); diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 4cfad0c4..299619c6 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -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 - void loginSign(){ - String sfno = "230615020"; + //@Test + void loginSign() { + 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 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); + } }