同步代码
This commit is contained in:
parent
b54129e9e0
commit
7500ba4854
|
@ -3,6 +3,7 @@ package com.chint.application.out;
|
||||||
|
|
||||||
import com.chint.application.commands.OrderCreateCommand;
|
import com.chint.application.commands.OrderCreateCommand;
|
||||||
import com.chint.application.services.login.strategy.PailaLoginStrategy;
|
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.aggregates.user.User;
|
||||||
import com.chint.domain.exceptions.OrderException;
|
import com.chint.domain.exceptions.OrderException;
|
||||||
import com.chint.domain.service.SystemDomainService;
|
import com.chint.domain.service.SystemDomainService;
|
||||||
|
@ -48,6 +49,9 @@ public class LoginController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private PailaLoginStrategy pailaLoginStrategy;
|
private PailaLoginStrategy pailaLoginStrategy;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PailaMobileLoginStrategy pailaMobileLoginStrategy;
|
||||||
|
|
||||||
@ApiOperation("财务共享登录")
|
@ApiOperation("财务共享登录")
|
||||||
@Transactional
|
@Transactional
|
||||||
@GetMapping("/login")
|
@GetMapping("/login")
|
||||||
|
@ -136,7 +140,7 @@ public class LoginController {
|
||||||
@PostMapping("/login/sso/mobile")
|
@PostMapping("/login/sso/mobile")
|
||||||
public Result<UserLoginResult> loginSSOMobile(@RequestBody UserLoginParam userLoginParam){
|
public Result<UserLoginResult> loginSSOMobile(@RequestBody UserLoginParam userLoginParam){
|
||||||
|
|
||||||
String employeeNo = pailaLoginStrategy.login(userLoginParam.getCode());
|
String employeeNo = pailaMobileLoginStrategy.login(userLoginParam.getCode());
|
||||||
|
|
||||||
userLoginParam.setSfno(employeeNo);
|
userLoginParam.setSfno(employeeNo);
|
||||||
UserLoginResult userLoginResult = authenticateService
|
UserLoginResult userLoginResult = authenticateService
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.chint.application.queryies.estimate;
|
package com.chint.application.queryies.estimate;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.standards.CityTag;
|
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.standards.TravelStandards;
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.domain.repository.CityRepository;
|
import com.chint.domain.repository.CityRepository;
|
||||||
|
@ -30,11 +29,11 @@ import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static com.chint.domain.aggregates.standards.TrainStandards.trainStandardsMap;
|
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.LegConstant.LEG_TYPE_HOTEL;
|
||||||
|
import static com.chint.infrastructure.constant.RankConstant.STANDARD_LEVEL_ONE;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CTripEstimatePrice implements EstimatePrice {
|
public class CTripEstimatePrice implements EstimatePrice {
|
||||||
|
@ -98,7 +97,16 @@ public class CTripEstimatePrice implements EstimatePrice {
|
||||||
@Override
|
@Override
|
||||||
public FlightPriceData queryFlightPrice(PriceQueryData priceQueryData) {
|
public FlightPriceData queryFlightPrice(PriceQueryData priceQueryData) {
|
||||||
FlightProductInfo flightProductInfo = new FlightProductInfo();
|
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 routeInfo = new RouteInfo();
|
||||||
routeInfo.setArriveCityID(
|
routeInfo.setArriveCityID(
|
||||||
cityRepository.findByCityName(priceQueryData.getArriveCity()).getCity());
|
cityRepository.findByCityName(priceQueryData.getArriveCity()).getCity());
|
||||||
|
@ -111,15 +119,19 @@ public class CTripEstimatePrice implements EstimatePrice {
|
||||||
BookingRelatedApiResponse estimate = cTripEstimateRequest.estimate(bookingRelatedApiRequest);
|
BookingRelatedApiResponse estimate = cTripEstimateRequest.estimate(bookingRelatedApiRequest);
|
||||||
FlightPriceData flightPriceData = new FlightPriceData();
|
FlightPriceData flightPriceData = new FlightPriceData();
|
||||||
|
|
||||||
Optional.ofNullable(
|
if (estimate.getStatus().getSuccess()) {
|
||||||
estimate.getData().getFlightValuationResult().getTotalPrice()
|
Optional.ofNullable(
|
||||||
).ifPresentOrElse(price -> {
|
estimate.getData().getFlightValuationResult().getTotalPrice()
|
||||||
flightPriceData.setSuccess(true);
|
).ifPresentOrElse(price -> {
|
||||||
flightPriceData.setMaxPrice(String.valueOf(price));
|
flightPriceData.setSuccess(true);
|
||||||
}, () -> {
|
flightPriceData.setMaxPrice(String.valueOf(price));
|
||||||
flightPriceData.setSuccess(false);
|
}, () -> {
|
||||||
flightPriceData.setMaxPrice("无估算价格");
|
flightPriceData.setSuccess(false);
|
||||||
});
|
flightPriceData.setMaxPrice("无估算价格");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return flightPriceData;
|
return flightPriceData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ public class Location {
|
||||||
private String locationShortName;
|
private String locationShortName;
|
||||||
private String firstPinYin;
|
private String firstPinYin;
|
||||||
private Long parentLocationId;
|
private Long parentLocationId;
|
||||||
|
private Integer isInternal;
|
||||||
@Column("level")
|
@Column("level")
|
||||||
private Integer level;
|
private Integer level;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,9 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
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
|
@Service
|
||||||
public class LocationDomainService {
|
public class LocationDomainService {
|
||||||
|
|
||||||
|
@ -33,12 +36,12 @@ public class LocationDomainService {
|
||||||
return switch (cityType) {
|
return switch (cityType) {
|
||||||
case LocationConstant.CITY_TYPE_DOMESTIC -> queryByCityName
|
case LocationConstant.CITY_TYPE_DOMESTIC -> queryByCityName
|
||||||
.stream()
|
.stream()
|
||||||
.filter(location -> location.getLocationPath().startsWith(LocationConstant.CITY_TYPE_DOMESTIC_PATH)
|
.filter(location -> location.getIsInternal().equals(LOCATION_IS_INTERNAL)
|
||||||
&& location.getLevel().equals(3)).toList();
|
&& location.getLevel().equals(3)).toList();
|
||||||
|
|
||||||
case LocationConstant.CITY_TYPE_FOREIGN -> queryByCityName
|
case LocationConstant.CITY_TYPE_FOREIGN -> queryByCityName
|
||||||
.stream()
|
.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();
|
&& location.getLevel().equals(3)).toList();
|
||||||
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
|
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class LegConstant {
|
||||||
public static final String LEG_TYPE_HOTEL_NAME = "酒店";
|
public static final String LEG_TYPE_HOTEL_NAME = "酒店";
|
||||||
public static final String LEG_TYPE_HOTEL_EN_NAME = "Hotel";
|
public static final String LEG_TYPE_HOTEL_EN_NAME = "Hotel";
|
||||||
public static final int LEG_TYPE_TAXI = 3;
|
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 String LEG_TYPE_TAXI_EN_NAME = "Traffic";
|
||||||
public static final int LEG_TYPE_OTHER = 4;
|
public static final int LEG_TYPE_OTHER = 4;
|
||||||
public static final String LEG_TYPE_OTHER_NAME = "其他";
|
public static final String LEG_TYPE_OTHER_NAME = "其他";
|
||||||
|
|
|
@ -2,7 +2,10 @@ package com.chint.infrastructure.constant;
|
||||||
|
|
||||||
public class LocationConstant {
|
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 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;//是国外
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,12 +63,12 @@ public class LocationRepositoryImpl implements LocationRepository {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Location> findByName(LocationParam locationParam) {
|
public List<Location> findByName(LocationParam locationParam) {
|
||||||
return jdbcLocationRepository.findByLocationNameContaining(locationParam.getQueryWord());
|
return jdbcLocationRepository.findByLocationPathNameContaining(locationParam.getQueryWord());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Location> findByName(String localName) {
|
public List<Location> findByName(String localName) {
|
||||||
return jdbcLocationRepository.findByLocationNameContaining(localName);
|
return jdbcLocationRepository.findByLocationPathNameContaining(localName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -21,7 +21,7 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
|
||||||
|
|
||||||
List<Location> findByFirstPinYin(String firstPinYin);
|
List<Location> findByFirstPinYin(String firstPinYin);
|
||||||
|
|
||||||
List<Location> findByLocationNameContaining(String locationName);
|
List<Location> findByLocationPathNameContaining(String locationName);
|
||||||
|
|
||||||
Location findByLocationName(String locationName);
|
Location findByLocationName(String locationName);
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ paila:
|
||||||
redirect-url: https://gxdev03.chint.com/businesstravelhome/#/
|
redirect-url: https://gxdev03.chint.com/businesstravelhome/#/
|
||||||
client-mobile-id: 9b24c91ead42ee4b6918
|
client-mobile-id: 9b24c91ead42ee4b6918
|
||||||
client-mobile-secret: e54494f1272ffd41b818980f1f8524fd68ef
|
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
|
base-url: https://signin-test.chint.com
|
||||||
token-name: token
|
token-name: token
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,6 @@ paila:
|
||||||
redirect-url: https://gxdev03.chint.com/businesstravelhome/#/
|
redirect-url: https://gxdev03.chint.com/businesstravelhome/#/
|
||||||
client-mobile-id: 9b24c91ead42ee4b6918
|
client-mobile-id: 9b24c91ead42ee4b6918
|
||||||
client-mobile-secret: e54494f1272ffd41b818980f1f8524fd68ef
|
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
|
base-url: https://signin-test.chint.com
|
||||||
token-name: token
|
token-name: token
|
||||||
|
|
|
@ -48,7 +48,7 @@ paila:
|
||||||
redirect-url: https://gxdev03.chint.com/businesstravelhome/#/
|
redirect-url: https://gxdev03.chint.com/businesstravelhome/#/
|
||||||
client-mobile-id: 9b24c91ead42ee4b6918
|
client-mobile-id: 9b24c91ead42ee4b6918
|
||||||
client-mobile-secret: e54494f1272ffd41b818980f1f8524fd68ef
|
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
|
base-url: https://signin-test.chint.com
|
||||||
token-name: token
|
token-name: token
|
||||||
|
|
||||||
|
|
|
@ -118,15 +118,16 @@ public class CTripTest {
|
||||||
System.out.println(loginRequest.h5Login(null));
|
System.out.println(loginRequest.h5Login(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
void estimateFlight() {
|
void estimateFlight() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
|
user.setCompanyCode("A30000001");
|
||||||
FlightProductInfo flightProductInfo = new FlightProductInfo();
|
FlightProductInfo flightProductInfo = new FlightProductInfo();
|
||||||
flightProductInfo.setClassType("YCF");
|
flightProductInfo.setClassType("YCF");
|
||||||
RouteInfo routeInfo = new RouteInfo();
|
RouteInfo routeInfo = new RouteInfo();
|
||||||
routeInfo.setArriveCityID("1");
|
routeInfo.setArriveCityID("347");
|
||||||
routeInfo.setDepartCityID("491");
|
routeInfo.setDepartCityID("633");
|
||||||
routeInfo.setDepartDate("2024-04-01");
|
routeInfo.setDepartDate("2024-03-02");
|
||||||
flightProductInfo.setRoutes(List.of(routeInfo));
|
flightProductInfo.setRoutes(List.of(routeInfo));
|
||||||
BookingRelatedApiRequest bookingRelatedApiRequest = estimateRequest
|
BookingRelatedApiRequest bookingRelatedApiRequest = estimateRequest
|
||||||
.generateBaseRequest(flightProductInfo, null);
|
.generateBaseRequest(flightProductInfo, null);
|
||||||
|
|
Loading…
Reference in New Issue