同步代码

This commit is contained in:
lulz1 2024-03-01 08:21:42 +08:00
parent b54129e9e0
commit 7500ba4854
12 changed files with 52 additions and 28 deletions

View File

@ -3,6 +3,7 @@ package com.chint.application.out;
import com.chint.application.commands.OrderCreateCommand;
import com.chint.application.services.login.strategy.PailaLoginStrategy;
import com.chint.application.services.login.strategy.PailaMobileLoginStrategy;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.exceptions.OrderException;
import com.chint.domain.service.SystemDomainService;
@ -48,6 +49,9 @@ public class LoginController {
@Autowired
private PailaLoginStrategy pailaLoginStrategy;
@Autowired
private PailaMobileLoginStrategy pailaMobileLoginStrategy;
@ApiOperation("财务共享登录")
@Transactional
@GetMapping("/login")
@ -136,7 +140,7 @@ public class LoginController {
@PostMapping("/login/sso/mobile")
public Result<UserLoginResult> loginSSOMobile(@RequestBody UserLoginParam userLoginParam){
String employeeNo = pailaLoginStrategy.login(userLoginParam.getCode());
String employeeNo = pailaMobileLoginStrategy.login(userLoginParam.getCode());
userLoginParam.setSfno(employeeNo);
UserLoginResult userLoginResult = authenticateService

View File

@ -1,7 +1,6 @@
package com.chint.application.queryies.estimate;
import com.chint.domain.aggregates.standards.CityTag;
import com.chint.domain.aggregates.standards.TrainStandards;
import com.chint.domain.aggregates.standards.TravelStandards;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.CityRepository;
@ -30,11 +29,11 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.chint.domain.aggregates.standards.TrainStandards.trainStandardsMap;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL;
import static com.chint.infrastructure.constant.RankConstant.STANDARD_LEVEL_ONE;
@Component
public class CTripEstimatePrice implements EstimatePrice {
@ -98,7 +97,16 @@ public class CTripEstimatePrice implements EstimatePrice {
@Override
public FlightPriceData queryFlightPrice(PriceQueryData priceQueryData) {
FlightProductInfo flightProductInfo = new FlightProductInfo();
flightProductInfo.setClassType("YCF");
User currentUser = BaseContext.getCurrentUser();
String standardLevel = currentUser.getStandardLevel();
//差标价值管控 差标等级不是一等只能选择经济舱
if (standardLevel.equals(STANDARD_LEVEL_ONE)) {
flightProductInfo.setClassType("YCF");
} else {
flightProductInfo.setClassType("Y");
}
RouteInfo routeInfo = new RouteInfo();
routeInfo.setArriveCityID(
cityRepository.findByCityName(priceQueryData.getArriveCity()).getCity());
@ -111,15 +119,19 @@ public class CTripEstimatePrice implements EstimatePrice {
BookingRelatedApiResponse estimate = cTripEstimateRequest.estimate(bookingRelatedApiRequest);
FlightPriceData flightPriceData = new FlightPriceData();
Optional.ofNullable(
estimate.getData().getFlightValuationResult().getTotalPrice()
).ifPresentOrElse(price -> {
flightPriceData.setSuccess(true);
flightPriceData.setMaxPrice(String.valueOf(price));
}, () -> {
flightPriceData.setSuccess(false);
flightPriceData.setMaxPrice("无估算价格");
});
if (estimate.getStatus().getSuccess()) {
Optional.ofNullable(
estimate.getData().getFlightValuationResult().getTotalPrice()
).ifPresentOrElse(price -> {
flightPriceData.setSuccess(true);
flightPriceData.setMaxPrice(String.valueOf(price));
}, () -> {
flightPriceData.setSuccess(false);
flightPriceData.setMaxPrice("无估算价格");
});
}
return flightPriceData;
}

View File

@ -22,6 +22,7 @@ public class Location {
private String locationShortName;
private String firstPinYin;
private Long parentLocationId;
private Integer isInternal;
@Column("level")
private Integer level;

View File

@ -11,6 +11,9 @@ import org.springframework.stereotype.Service;
import java.util.List;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_IS_INTERNAL;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_IS_NOT_INTERNAL;
@Service
public class LocationDomainService {
@ -33,12 +36,12 @@ public class LocationDomainService {
return switch (cityType) {
case LocationConstant.CITY_TYPE_DOMESTIC -> queryByCityName
.stream()
.filter(location -> location.getLocationPath().startsWith(LocationConstant.CITY_TYPE_DOMESTIC_PATH)
.filter(location -> location.getIsInternal().equals(LOCATION_IS_INTERNAL)
&& location.getLevel().equals(3)).toList();
case LocationConstant.CITY_TYPE_FOREIGN -> queryByCityName
.stream()
.filter(location -> !location.getLocationPath().startsWith(LocationConstant.CITY_TYPE_DOMESTIC_PATH)
.filter(location -> location.getIsInternal().equals(LOCATION_IS_NOT_INTERNAL)
&& location.getLevel().equals(3)).toList();
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
};

View File

@ -27,7 +27,7 @@ public class LegConstant {
public static final String LEG_TYPE_HOTEL_NAME = "酒店";
public static final String LEG_TYPE_HOTEL_EN_NAME = "Hotel";
public static final int LEG_TYPE_TAXI = 3;
public static final String LEG_TYPE_TAXI_NAME = "出租";
public static final String LEG_TYPE_TAXI_NAME = "";
public static final String LEG_TYPE_TAXI_EN_NAME = "Traffic";
public static final int LEG_TYPE_OTHER = 4;
public static final String LEG_TYPE_OTHER_NAME = "其他";

View File

@ -2,7 +2,10 @@ package com.chint.infrastructure.constant;
public class LocationConstant {
// 城市类型
public static final int CITY_TYPE_DOMESTIC = 0;//国内
public static final int CITY_TYPE_DOMESTIC = 1;//国内
public static final String CITY_TYPE_DOMESTIC_PATH = "3106_1_";//国内
public static final int CITY_TYPE_FOREIGN = 1;//国外
public static final int CITY_TYPE_FOREIGN = 0;//国外
public static final int LOCATION_IS_INTERNAL = 1;//是国内
public static final int LOCATION_IS_NOT_INTERNAL = 0;//是国外
}

View File

@ -63,12 +63,12 @@ public class LocationRepositoryImpl implements LocationRepository {
@Override
public List<Location> findByName(LocationParam locationParam) {
return jdbcLocationRepository.findByLocationNameContaining(locationParam.getQueryWord());
return jdbcLocationRepository.findByLocationPathNameContaining(locationParam.getQueryWord());
}
@Override
public List<Location> findByName(String localName) {
return jdbcLocationRepository.findByLocationNameContaining(localName);
return jdbcLocationRepository.findByLocationPathNameContaining(localName);
}
@Override

View File

@ -21,7 +21,7 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
List<Location> findByFirstPinYin(String firstPinYin);
List<Location> findByLocationNameContaining(String locationName);
List<Location> findByLocationPathNameContaining(String locationName);
Location findByLocationName(String locationName);

View File

@ -59,7 +59,7 @@ paila:
redirect-url: https://gxdev03.chint.com/businesstravelhome/#/
client-mobile-id: 9b24c91ead42ee4b6918
client-mobile-secret: e54494f1272ffd41b818980f1f8524fd68ef
redirect-mobile-url: https://gxdev03.chint.com/businesstravelmhome/#/
redirect-mobile-url: https://gxdev03.chint.com/businesstravelmhome/*.*
base-url: https://signin-test.chint.com
token-name: token

View File

@ -29,6 +29,6 @@ paila:
redirect-url: https://gxdev03.chint.com/businesstravelhome/#/
client-mobile-id: 9b24c91ead42ee4b6918
client-mobile-secret: e54494f1272ffd41b818980f1f8524fd68ef
redirect-mobile-url: https://gxdev03.chint.com/businesstravelmhome/#/
redirect-mobile-url: https://gxdev03.chint.com/businesstravelmhome/*.*
base-url: https://signin-test.chint.com
token-name: token

View File

@ -48,7 +48,7 @@ paila:
redirect-url: https://gxdev03.chint.com/businesstravelhome/#/
client-mobile-id: 9b24c91ead42ee4b6918
client-mobile-secret: e54494f1272ffd41b818980f1f8524fd68ef
redirect-mobile-url: https://gxdev03.chint.com/businesstravelmhome/#/
redirect-mobile-url: https://gxdev03.chint.com/businesstravelmhome/*.*
base-url: https://signin-test.chint.com
token-name: token

View File

@ -118,15 +118,16 @@ public class CTripTest {
System.out.println(loginRequest.h5Login(null));
}
// @Test
@Test
void estimateFlight() {
BaseContext.setCurrentUser(user);
user.setCompanyCode("A30000001");
FlightProductInfo flightProductInfo = new FlightProductInfo();
flightProductInfo.setClassType("YCF");
RouteInfo routeInfo = new RouteInfo();
routeInfo.setArriveCityID("1");
routeInfo.setDepartCityID("491");
routeInfo.setDepartDate("2024-04-01");
routeInfo.setArriveCityID("347");
routeInfo.setDepartCityID("633");
routeInfo.setDepartDate("2024-03-02");
flightProductInfo.setRoutes(List.of(routeInfo));
BookingRelatedApiRequest bookingRelatedApiRequest = estimateRequest
.generateBaseRequest(flightProductInfo, null);