merge limo to daylight

This commit is contained in:
Mauve
2026-09-22 16:32:31 +08:00
parent c017b597b6
commit 5ad104bdd7
99 changed files with 9022 additions and 356 deletions
@@ -157,6 +157,8 @@ public class MobileLoginController {
if(SysConstants.PERMISSION_APP_DASHBOARD.equals(per.getId())) userInfo.setCanViewDashboard(true);
if(SysConstants.PERMISSION_APP_APPROVAL.equals(per.getId())) userInfo.setCanViewApproval(true);
if(SysConstants.PERMISSION_APP_CALENDAR.equals(per.getId())) userInfo.setCanViewCalendar(true);
if(SysConstants.PERMISSION_APP_VIEW_LIMO.equals(per.getId())) userInfo.setCanViewLimo(true);
if(SysConstants.PERMISSION_APP_VIEW_NOTIFICATION.equals(per.getId())) userInfo.setCanViewNotification(true);
}
}
Token accessToken = JwtTokenUtil.generateTokenByLoginUser(request.getRequestURI(),loginUser, SysConstants.MOBILE_TOKEN_TYPE,false);
@@ -240,6 +240,8 @@ public class MgmUserService {
if(SysConstants.PERMISSION_APP_DASHBOARD.equals(per.getPermissionId())) info.setCanViewDashboard(true);
if(SysConstants.PERMISSION_APP_APPROVAL.equals(per.getPermissionId())) info.setCanViewApproval(true);
if(SysConstants.PERMISSION_APP_CALENDAR.equals(per.getPermissionId())) info.setCanViewCalendar(true);
if(SysConstants.PERMISSION_APP_VIEW_LIMO.equals(per.getPermissionId())) info.setCanViewLimo(true);
if(SysConstants.PERMISSION_APP_VIEW_NOTIFICATION.equals(per.getPermissionId())) info.setCanViewNotification(true);
}
}
}
@@ -1,5 +1,6 @@
package com.mgm.mcrm.authorization.services;
import com.auth0.jwt.JWT;
import com.google.gson.Gson;
import com.mgm.mcrm.authorization.models.SysGroupPermission;
import com.mgm.mcrm.authorization.models.SysRouterPermission;
@@ -8,7 +9,9 @@ import com.mgm.mcrm.authorization.repositories.SysGroupPermissionDao;
import com.mgm.mcrm.authorization.repositories.SysRouterPermissionDao;
import com.mgm.mcrm.booking.services.BookingService;
import com.mgm.mcrm.common.utils.LogUtil;
import com.mgm.mcrm.limo.models.LimoBookings;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import org.springframework.stereotype.Service;
@@ -87,4 +90,22 @@ public class SysGroupPermissionService {
private List<SysRouterPermission> getRouterPermissionsByGroupNameList(List<String> groupNameList) {
return routerPermissionDao.queryPermssionByGroupNameList(groupNameList);
}
public boolean checkAppPermission(HttpServletRequest request, String permissionId){
boolean havePermission = false;
List<SysRouterPermission> userPermissions = new ArrayList<SysRouterPermission>();
LimoBookings response = new LimoBookings();
String token = request.getHeader("Authorization");
String groupName = JWT.decode(token).getClaim("group_name").asString();
userPermissions = this.getRouterPermissionsByGroupName(groupName);
if(userPermissions.size()>0) {
for(SysRouterPermission per:userPermissions) {
if(Strings.CS.equals(per.getId(), permissionId) ) havePermission = true;
}
}
return havePermission;
}
}
@@ -0,0 +1,62 @@
package com.mgm.mcrm.basesetting.daylight.dtos.response;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
public class CompRuleResponse {
private String id;
private Integer version;
private String accountId;
private String profileId;
private String folioWindowId;
private String complimentaryTypeId;
private List<String> complimentaryAccountingPresetsIds;
private String requestorId;
private String approverId;
private String paymentMethodTransactionCodeId;
private String justification;
private ComplimentaryRuleLimits complimentaryRuleLimits;
private List<String> settledFolioWindowIds;
private Boolean isExecutive;
private Boolean doNotIssueInvoice;
private Boolean isActive;
private Boolean canBeDeleted;
private Integer issuedVouchersCount;
@Data
public static class ComplimentaryRuleLimits {
private Amount totalAmountLimit;
private SoftTotalLimit softTotalLimit;
private List<String> limitExcludedPresetIds;
private List<String> limitExcludedTransactionCodeIds;
private TotalLimit totalLimit;
@Data
public static class SoftTotalLimit {
private Amount amountLimit;
private Amount remainingLimit;
private Boolean isExceeded;
}
@Data
public static class TotalLimit {
private Amount amountLimit;
private Amount remainingLimit;
}
@Data
public static class Amount {
private BigDecimal amount;
private String currency;
}
}
}
File diff suppressed because it is too large Load Diff
@@ -92,4 +92,6 @@ public interface BookingDao extends JpaRepository<Bookings, Long> {
@Query(value = "select Top(1) * from bookings where dl_external_no is not null and ltrim(rtrim(dl_external_no)) = ltrim(rtrim(?1)) order by id asc", nativeQuery = true)
Bookings getByDlExternalNo(String dlExternalNo);
@Query(value = "select Top(1) * from bookings where property_id is not null and confirmation_no = ?1 order by id asc", nativeQuery = true)
Bookings findFirstByConfirmationNoAndPropertyIdIsNotNull(String confirmationNo);
}
@@ -1220,8 +1220,8 @@ public class BookingService {
reservationDTO.setSourceId(sourceCode.getDlSourceId());
booking.setDlSourceId(sourceCode.getDlSourceId());
if ("IM".equalsIgnoreCase(bookingTypeName) && isPostIM == 0) {
reservationDTO.setNoPost(true);
if ("IM".equalsIgnoreCase(bookingTypeName)) {
reservationDTO.setNoPost(Objects.equals(isPostIM, 0));
} else {
reservationDTO.setNoPost(StringUtils.isBlank(booking.getMiscCharge()));
}
@@ -1259,18 +1259,6 @@ public class BookingService {
breakdownDTO.setRatePricingDetails(ratePricingDetailsDTO);
reservationDTO.setBreakdown(List.of(breakdownDTO));
Map<String, Object> customFields = new HashMap<>();
customFields.put("Booker", userId);
if ("IM".equalsIgnoreCase(bookingTypeName) && depositTypeIM == 0) {
customFields.put("WAIVEDEPOSIT", true);
}
if (booking.getWaitlistId() != null) {
customFields.put("App_Rea", "APP");
customFields.put("Approver", booking.getApprovedBy());
}
String sharerString = booking.getSharer();
JSONArray sharers = JSONArray.parseArray(sharerString);
@@ -1307,17 +1295,24 @@ public class BookingService {
IndividualDTO individualDTO;
if (StringUtils.isEmpty(sharerId)) {
log.info("Sharer={} does not exist playerId", sharerName);
individualDTO = IndividualDTO.buildNewProfileWithoutPlayerId(
sharerName,
"sha_" + i
);
} else {
log.info("Sharer={} exists the playerId={}, tierName={}", sharerName, sharerId, sharer.getString("tierName"));
BaseApiResponse<PlayerProfileEntry> sharerDetail =
playerService.findPlayerProfileByPlayerIdAndUserId(sharerId, userId);
individualDTO = IndividualDTO.buildNewProfileWithPlayerId(
sharerId,
sharerName,
"shamem_" + i,
"sha_" + i,
sharer.getString("tierName")
sharerDetail.getData().getTierName()
);
}
@@ -1352,6 +1347,18 @@ public class BookingService {
ReservationDTO.CustomFieldDTO customFieldDTO =
new ReservationDTO.CustomFieldDTO();
Map<String, Object> customFields = new HashMap<>();
customFields.put("Booker", userId);
if ("IM".equalsIgnoreCase(bookingTypeName) && Objects.equals(depositTypeIM, 0)) {
customFields.put("WAIVEDEPOSIT", true);
}
if (booking.getWaitlistId() != null) {
customFields.put("App_Rea", "APP");
customFields.put("Approver", booking.getApprovedBy());
}
customFieldDTO.setLocation("ReservationHeader");
customFieldDTO.setValue(JSON.toJSONString(customFields));
reservationDTO.setCustomFields(List.of(customFieldDTO));
@@ -1444,7 +1451,7 @@ public class BookingService {
dlService.getDaylightReservationByDlId(reservationId, property.getDlPropertyId());
booking.setDlAccountId(daylightReservationByDlId.getAccountId());
// booking.setDlReservationId(reservationId);
booking.setDlReservationId(reservationId);
// booking.setConfirmationNo(confirmationNumber);
// booking.setLastOperaStatus("RESERVED");
// booking.setApproveStatus("N");
@@ -1481,14 +1488,18 @@ public class BookingService {
//2.循环Comp rule ids 插入每一条comp rule
for (String compRuleId :compRuleIds){
Date now = new Date();
CfgCompRule cfgCompRule = new CfgCompRule();
cfgCompRule.setCompRuleId(compRuleId);
cfgCompRule.setDlReservationId(reservationId);
cfgCompRule.setAccountId(daylightReservationByDlId.getAccountId());
cfgCompRule.setCreatedAt(now);
try {
Date now = new Date();
CfgCompRule cfgCompRule = new CfgCompRule();
cfgCompRule.setCompRuleId(compRuleId);
cfgCompRule.setDlReservationId(reservationId);
cfgCompRule.setAccountId(daylightReservationByDlId.getAccountId());
cfgCompRule.setCreatedAt(now);
cfgCompRuleDao.save(cfgCompRule);
cfgCompRuleDao.save(cfgCompRule);
} catch (Exception e) {
log.warn("Insert duplicated compRuleId: {}", compRuleId);
}
}
//Create Reservation 后处理WaitListBooking
@@ -3514,6 +3525,13 @@ public class BookingService {
view.setDlSharerIds(daylightResultBooking.getAccompanyingGuestProfileIds());
view.setDlVersion(daylightResultBooking.getVersion());
boolean hasSharer = StringUtils.isNotBlank(view.getSharer())
&& !"[]".equals(view.getSharer());
if (hasSharer) {
JSONArray sharerList = JSONArray.parseArray(view.getSharer());
view.setSharerList(sharerList);
}
BaseApiResponse<List<ProfileDetailResponse>> profileResult =
dlService.dayLightGetProfileByPlayerId(view.getPlayerId());
@@ -3528,8 +3546,8 @@ public class BookingService {
} else {
JSONObject json = JSONObject.parseObject(profile.getCustomFieldContainerJson());
String mainExpDate = json.getString("CanStayUntil");
if (mainExpDate == null) {
// 主 guest 的 CanStayUntil 为 null,expDate 直接置空
if (StringUtils.isBlank(mainExpDate)) {
// 主 guest 的 CanStayUntil 为空,expDate 直接置空
expDate = null;
} else {
expDate = mainExpDate;
@@ -3537,10 +3555,9 @@ public class BookingService {
}
}
if (StringUtils.isNotBlank(view.getSharer()) && !"[]".equals(view.getSharer())) {
JSONArray sharerList = JSONArray.parseArray(view.getSharer());
view.setSharerList(sharerList);
if (StringUtils.isNotBlank(expDate)
&& hasSharer
&& CollectionUtils.isNotEmpty(view.getDlSharerIds())) {
for (String dlSharerId : view.getDlSharerIds()) {
ProfileDetailResponse profileDetailResponse
= dlService.dayLightGetProfileByProfileId(dlSharerId);
@@ -3553,20 +3570,16 @@ public class BookingService {
JSONObject json = JSONObject.parseObject(profileDetailResponse.getCustomFieldContainerJson());
String shareExpDate = json.getString("CanStayUntil");
if (shareExpDate == null) {
// CanStayUntil 为 null,expDate 直接置空并跳出
if (StringUtils.isBlank(shareExpDate)) {
// CanStayUntil 为空,expDate 直接置空并跳出
expDate = null;
break;
}
if (StringUtils.isBlank(expDate)) {
Date current = DateTimeUtil.getDateFromString(expDate, "yyyy-MM-dd");
Date share = DateTimeUtil.getDateFromString(shareExpDate, "yyyy-MM-dd");
if (share.before(current)) {
expDate = shareExpDate;
} else {
Date current = DateTimeUtil.getDateFromString(expDate, "yyyy-MM-dd");
Date share = DateTimeUtil.getDateFromString(shareExpDate, "yyyy-MM-dd");
if (share.before(current)) {
expDate = shareExpDate;
}
}
}
}
@@ -4866,7 +4879,7 @@ public class BookingService {
|| "CHECKED_IN".equalsIgnoreCase(mergedDaylightStatus)
|| "DUE_IN".equalsIgnoreCase(mergedDaylightStatus)
)
&& "PN".equalsIgnoreCase(daylightBooking.getApproveStatus())
&& "PN".equalsIgnoreCase(dbBooking.getApproveStatus())
&& dbBooking.getRevisionOf() == null) {
daylightBooking.setApproveStatus("N");
}
@@ -6222,7 +6235,7 @@ public class BookingService {
if (data != null) {
String comment = data.getContent();
if (comment != null) {
if (StringUtils.isNotBlank(comment)) {
Matcher miscChargeMatcher = Pattern
.compile("(?:\\$|&#x24;)\\s*([0-9]+(?:\\.[0-9]+)?)", Pattern.CASE_INSENSITIVE)
.matcher(comment);
@@ -42,6 +42,7 @@ public class SysCommon {
public static String defaultRouter = "welcome";
public static String runtimeName="crm_mobile_runtime";
public static int postTimeOut = 20;
//for stress test
public static int tokenExpMin = 5;
public static int refreshTokenExpDay = 30;
@@ -24,6 +24,8 @@ public class SysConstants {
public static final String PERMISSION_APP_TODO_LIST="10001_03";
public static final String PERMISSION_APP_DASHBOARD="10001_04";
public static final String PERMISSION_APP_APPROVAL="10001_05";
public static final String PERMISSION_APP_VIEW_NOTIFICATION="10001_06";
public static final String PERMISSION_APP_CALENDAR="10001_07";
public static final String PERMISSION_APP_VIEW_LIMO="10001_08";
}
@@ -1,5 +1,8 @@
package com.mgm.mcrm.common.dtos.config;
import lombok.Data;
@Data
public class APIConfig {
private boolean isLoaded = false;
@@ -9,6 +12,11 @@ public class APIConfig {
private String apiSecret_ESB="";
private int timeout_ESB=0;
private String limoService_ESB="";
private String limoApp_id="";
private String limoApp_key="";
private String serverUrl_ESB_Daylight="";
private String apiKey_ESB_Daylight="";
private String apiSecret_ESB_Daylight="";
@@ -52,225 +60,4 @@ public class APIConfig {
private String password_SMTP= "";
private String send_to_SMTP= "";
public boolean isLoaded() {
return isLoaded;
}
public void setLoaded(boolean isLoaded) {
this.isLoaded = isLoaded;
}
public String getServerUrl_ESB() {
return serverUrl_ESB;
}
public void setServerUrl_ESB(String serverUrl_ESB) {
this.serverUrl_ESB = serverUrl_ESB;
}
public String getApiKey_ESB() {
return apiKey_ESB;
}
public void setApiKey_ESB(String apiKey_ESB) {
this.apiKey_ESB = apiKey_ESB;
}
public String getApiSecret_ESB() {
return apiSecret_ESB;
}
public void setApiSecret_ESB(String apiSecret_ESB) {
this.apiSecret_ESB = apiSecret_ESB;
}
public int getTimeout_ESB() {
return timeout_ESB;
}
public void setTimeout_ESB(int timeout_ESB) {
this.timeout_ESB = timeout_ESB;
}
public String getServerLoginUrl_RPA() {
return serverLoginUrl_RPA;
}
public void setServerLoginUrl_RPA(String serverLoginUrl_RPA) {
this.serverLoginUrl_RPA = serverLoginUrl_RPA;
}
public String getApiAccessName_RPA() {
return apiAccessName_RPA;
}
public void setApiAccessName_RPA(String apiAccessName_RPA) {
this.apiAccessName_RPA = apiAccessName_RPA;
}
public String getApiAccessPassword_RPA() {
return apiAccessPassword_RPA;
}
public void setApiAccessPassword_RPA(String apiAccessPassword_RPA) {
this.apiAccessPassword_RPA = apiAccessPassword_RPA;
}
public String getApiAccessKey_RPA() {
return apiAccessKey_RPA;
}
public void setApiAccessKey_RPA(String apiAccessKey_RPA) {
this.apiAccessKey_RPA = apiAccessKey_RPA;
}
public String getServerAddUrl_RPA() {
return serverAddUrl_RPA;
}
public void setServerAddUrl_RPA(String serverAddUrl_RPA) {
this.serverAddUrl_RPA = serverAddUrl_RPA;
}
public String getServerExtensionUrl_RPA() {
return serverExtensionUrl_RPA;
}
public void setServerExtensionUrl_RPA(String serverExtensionUrl_RPA) {
this.serverExtensionUrl_RPA = serverExtensionUrl_RPA;
}
public int getTimeout_RPA() {
return timeout_RPA;
}
public void setTimeout_RPA(int timeout_RPA) {
this.timeout_RPA = timeout_RPA;
}
public String getServerUrl_SSO() {
return serverUrl_SSO;
}
public void setServerUrl_SSO(String serverUrl_SSO) {
this.serverUrl_SSO = serverUrl_SSO;
}
public String getClientId_SSO() {
return clientId_SSO;
}
public void setClientId_SSO(String clientId_SSO) {
this.clientId_SSO = clientId_SSO;
}
public String getClientSecret_SSO() {
return clientSecret_SSO;
}
public void setClientSecret_SSO(String clientSecret_SSO) {
this.clientSecret_SSO = clientSecret_SSO;
}
public int getTimeout_SSO() {
return timeout_SSO;
}
public void setTimeout_SSO(int timeout_SSO) {
this.timeout_SSO = timeout_SSO;
}
public String getServerUrl_CallCenter() {
return serverUrl_CallCenter;
}
public void setServerUrl_CallCenter(String serverUrl_CallCenter) {
this.serverUrl_CallCenter = serverUrl_CallCenter;
}
public int getTimeout_CallCenter() {
return timeout_CallCenter;
}
public void setTimeout_CallCenter(int timeout_CallCenter) {
this.timeout_CallCenter = timeout_CallCenter;
}
public String getTokenUrl_SMS() {
return tokenUrl_SMS;
}
public void setTokenUrl_SMS(String tokenUrl_SMS) {
this.tokenUrl_SMS = tokenUrl_SMS;
}
public String getSendUrl_SMS() {
return sendUrl_SMS;
}
public void setSendUrl_SMS(String sendUrl_SMS) {
this.sendUrl_SMS = sendUrl_SMS;
}
public String getUsername_SMS() {
return username_SMS;
}
public void setUsername_SMS(String username_SMS) {
this.username_SMS = username_SMS;
}
public String getPassword_SMS() {
return password_SMS;
}
public void setPassword_SMS(String password_SMS) {
this.password_SMS = password_SMS;
}
public String getAccount_SMS() {
return account_SMS;
}
public void setAccount_SMS(String account_SMS) {
this.account_SMS = account_SMS;
}
public String getPriority_SMS() {
return priority_SMS;
}
public void setPriority_SMS(String priority_SMS) {
this.priority_SMS = priority_SMS;
}
public String getServerUrl_OWS() {
return serverUrl_OWS;
}
public void setServerUrl_OWS(String serverUrl_OWS) {
this.serverUrl_OWS = serverUrl_OWS;
}
public int getTimeout_OWS() {
return timeout_OWS;
}
public void setTimeout_OWS(int timeout_OWS) {
this.timeout_OWS = timeout_OWS;
}
public String getPort_SMTP() {
return port_SMTP;
}
public void setPort_SMTP(String port_SMTP) {
this.port_SMTP = port_SMTP;
}
public String getHost_SMTP() {
return host_SMTP;
}
public void setHost_SMTP(String host_SMTP) {
this.host_SMTP = host_SMTP;
}
public String getUsername_SMTP() {
return username_SMTP;
}
public void setUsername_SMTP(String username_SMTP) {
this.username_SMTP = username_SMTP;
}
public String getPassword_SMTP() {
return password_SMTP;
}
public void setPassword_SMTP(String password_SMTP) {
this.password_SMTP = password_SMTP;
}
public String getSend_to_SMTP() {
return send_to_SMTP;
}
public void setSend_to_SMTP(String send_to_SMTP) {
this.send_to_SMTP = send_to_SMTP;
}
public String getServerUrl_ESB_Daylight() {
return serverUrl_ESB_Daylight;
}
public void setServerUrl_ESB_Daylight(String serverUrl_ESB_Daylight) {
this.serverUrl_ESB_Daylight = serverUrl_ESB_Daylight;
}
public String getApiKey_ESB_Daylight() {
return apiKey_ESB_Daylight;
}
public void setApiKey_ESB_Daylight(String apiKey_ESB_Daylight) {
this.apiKey_ESB_Daylight = apiKey_ESB_Daylight;
}
public String getApiSecret_ESB_Daylight() {
return apiSecret_ESB_Daylight;
}
public void setApiSecret_ESB_Daylight(String apiSecret_ESB_Daylight) {
this.apiSecret_ESB_Daylight = apiSecret_ESB_Daylight;
}
public int getTimeout_ESB_Daylight() {
return timeout_ESB_Daylight;
}
public void setTimeout_ESB_Daylight(int timeout_ESB_Daylight) {
this.timeout_ESB_Daylight = timeout_ESB_Daylight;
}
}
@@ -0,0 +1,12 @@
package com.mgm.mcrm.common.dtos.mgm_api;
import lombok.Data;
@Data
public class GetLimoAccessTokenRequest {
private String LoginId;
private String password;
}
@@ -0,0 +1,11 @@
package com.mgm.mcrm.common.dtos.mgm_api;
import lombok.Data;
@Data
public class GetLimoFlightDetailsRequest {
private String flightNo;
private String pickupDateTime;
private String pickupAirportCode;
private String dropOffAirportCode;
}
@@ -0,0 +1,10 @@
package com.mgm.mcrm.common.dtos.mgm_api;
import lombok.Data;
@Data
public class GetLimoOverriderRequest {
private String OverriderIdOrName;
}
@@ -0,0 +1,10 @@
package com.mgm.mcrm.common.dtos.mgm_api;
import lombok.Data;
@Data
public class GetLimoTotalAmountRequest {
private String pickupPOIId;
private String dropoffPOIIds;
private String singleTripPrices;
}
@@ -0,0 +1,10 @@
package com.mgm.mcrm.common.dtos.mgm_api;
import lombok.Data;
@Data
public class GetPlayerInfoRequest {
private String playerId;
}
@@ -0,0 +1,15 @@
package com.mgm.mcrm.common.dtos.mgm_api;
import lombok.Data;
@Data
public class GetSimpleLimoBookingQualificationStatusRequest {
private String playerId;
private String bookingType;
private String bookingDate;
}
@@ -0,0 +1,150 @@
package com.mgm.mcrm.common.dtos.mgm_api;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class InternalCreateLimoBookingRequest {
private int createNotConfirmBooking;
private String bookingType;
private String greetType;
private String otherGreetType;
private String guestType;
private String tripType;
private String playerId;
private String ranking;
private String overrideBy;
private String complexOverrider;
private String roomNo;
private String employeeId;
private String lastName;
private String salution;
private String chineseLastName;
private String bookerContact;
private String tripContact;
private int adHoc;
private LocalDateTime pickupDatetime;
private Long carTypeId;
private Integer passengerNo;
private Long pickupPOIID;
private String pickup;
private Long pickupTripPriceId;
private String pickupRegion;
private Long dropoffPOIID;
private String dropoff;
private Long dropoffTripPriceId;
private String dropoffRegion;
private Long extraDropoffPOIID1;
private String extraDropoff1;
private Long extraDropoffTripPriceID1;
private String extraDropoffRegion1;
private Long extraDropoffPOIID2;
private String extraDropoff2;
private Long extraDropoffTripPriceID2;
private String extraDropoffRegion2;
private Long extraDropoffPOIID3;
private String extraDropoff3;
private Long extraDropoffTripPriceID3;
private String extraDropoffRegion3;
private Long extraDropoffPOIID4;
private String extraDropoff4;
private Long extraDropoffTripPriceID4;
private String extraDropoffRegion4;
private Long extraDropoffPOIID5;
private String extraDropoff5;
private Long extraDropoffTripPriceID5;
private String extraDropoffRegion5;
private Long extraDropoffPOIID6;
private String extraDropoff6;
private Long extraDropoffTripPriceID6;
private String extraDropoffRegion6;
private Long extraDropoffPOIID7;
private String extraDropoff7;
private Long extraDropoffTripPriceID7;
private String extraDropoffRegion7;
private Long extraDropoffPOIID8;
private String extraDropoff8;
private Long extraDropoffTripPriceID8;
private String extraDropoffRegion8;
private Long extraDropoffPOIID9;
private String extraDropoff9;
private Long extraDropoffTripPriceID9;
private String extraDropoffRegion9;
private Long extraDropoffPOIID10;
private String extraDropoff10;
private Long extraDropoffTripPriceID10;
private String extraDropoffRegion10;
private BigDecimal singleTripPrice;
private BigDecimal defaultTripPrice;
private BigDecimal defaultPublishTripPrice;
private BigDecimal hourlyRate;
private BigDecimal hourlyWaitingFee;
private Integer hour;
private Integer hourlyWaiting;
private BigDecimal extraDropoffPrice1;
private BigDecimal extraDropoffPrice2;
private BigDecimal extraDropoffPrice3;
private BigDecimal extraDropoffPrice4;
private BigDecimal extraDropoffPrice5;
private BigDecimal extraDropoffPrice6;
private BigDecimal extraDropoffPrice7;
private BigDecimal extraDropoffPrice8;
private BigDecimal extraDropoffPrice9;
private BigDecimal extraDropoffPrice10;
private String otherPriceRemark;
private BigDecimal otherPrice;
private String paymentMethod;
private BigDecimal totalAmount;
private Boolean highImportance;
private Boolean tenOut;
private Boolean butlerGreet;
private String bookedBy;
private String approvedBy;
private String bookingRemark;
private String driverRemark;
private String limoInternalRemark;
private String systemRemark;
private Boolean limoGreet;
private Boolean hostGreet;
private Boolean vipMeetNGreet;
private String otherGreet;
private String flightDetails;
private String signage;
public int getCreateNotConfirmBooking() {
return createNotConfirmBooking;
}
}
@@ -0,0 +1,148 @@
package com.mgm.mcrm.common.dtos.mgm_api;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class InternalUpdateLimoBookingRequest {
private Long id;
private Boolean createNotConfirmBooking;
private String bookingType;
private String greetType;
private String otherGreetType;
private String guestType;
private String tripType;
private String playerId;
private String ranking;
private String overrideBy;
private String complexOverrider;
private String roomNo;
private String employeeId;
private String lastName;
private String salution;
private String chineseLastName;
private String bookerContact;
private String tripContact;
private String adHoc;
private LocalDateTime pickupDatetime;
private Long carTypeId;
private Integer passengerNo;
private Long pickupPOIID;
private String pickup;
private Long pickupTripPriceID;
private String pickupRegion;
private Long dropoffPOIID;
private String dropoff;
private Long dropoffTripPriceID;
private String dropoffRegion;
private Long extraDropoffPOIID1;
private String extraDropoff1;
private Long extraDropoffTripPriceID1;
private String extraDropoffRegion1;
private Long extraDropoffPOIID2;
private String extraDropoff2;
private Long extraDropoffTripPriceID2;
private String extraDropoffRegion2;
private Long extraDropoffPOIID3;
private String extraDropoff3;
private Long extraDropoffTripPriceID3;
private String extraDropoffRegion3;
private Long extraDropoffPOIID4;
private String extraDropoff4;
private Long extraDropoffTripPriceID4;
private String extraDropoffRegion4;
private Long extraDropoffPOIID5;
private String extraDropoff5;
private Long extraDropoffTripPriceID5;
private String extraDropoffRegion5;
private Long extraDropoffPOIID6;
private String extraDropoff6;
private Long extraDropoffTripPriceID6;
private String extraDropoffRegion6;
private Long extraDropoffPOIID7;
private String extraDropoff7;
private Long extraDropoffTripPriceID7;
private String extraDropoffRegion7;
private Long extraDropoffPOIID8;
private String extraDropoff8;
private Long extraDropoffTripPriceID8;
private String extraDropoffRegion8;
private Long extraDropoffPOIID9;
private String extraDropoff9;
private Long extraDropoffTripPriceID9;
private String extraDropoffRegion9;
private Long extraDropoffPOIID10;
private String extraDropoff10;
private Long extraDropoffTripPriceID10;
private String extraDropoffRegion10;
private BigDecimal singleTripPrice;
private BigDecimal defaultTripPrice;
private BigDecimal defaultPublishTripPrice;
private BigDecimal hourlyRate;
private BigDecimal hourlyWaitingFee;
private Integer hour;
private Integer hourlyWaiting;
private BigDecimal extraDropoffPrice1;
private BigDecimal extraDropoffPrice2;
private BigDecimal extraDropoffPrice3;
private BigDecimal extraDropoffPrice4;
private BigDecimal extraDropoffPrice5;
private BigDecimal extraDropoffPrice6;
private BigDecimal extraDropoffPrice7;
private BigDecimal extraDropoffPrice8;
private BigDecimal extraDropoffPrice9;
private BigDecimal extraDropoffPrice10;
private String otherPriceRemark;
private BigDecimal otherPrice;
private String paymentMethod;
private BigDecimal totalAmount;
private Boolean highImportance;
private Boolean tenOut;
private Boolean butlerGreet;
private String bookedBy;
private String approvedBy;
private String bookingRemark;
private String driverRemark;
private String limoInternalRemark;
private String systemRemark;
private Boolean limoGreet;
private Boolean hostGreet;
private Boolean vipMeetNGreet;
private String otherGreet;
private String flightDetails;
private String signage;
}
@@ -0,0 +1,188 @@
package com.mgm.mcrm.common.dtos.mgm_api;
import java.util.ArrayList;
import java.util.List;
public class PlayerProfileApiResult {
private String statusCode = null;
private String statusDescription="";
private String playerId;
private String userId;
private String tierName;
private String tierId;
private String chineseName;
private String englishName;
private String salutation;
private Integer codedFlag;
private String name;
private String playerPhone;
private String phoneType;
private String birthday;
private String country;
private String state;
private String passport;
private String language;
private List<Integer> nameIds=new ArrayList<Integer>();
public PlayerProfileApiResult() {
}
public String getStatusCode() {
return statusCode;
}
public void setStatusCode(String statusCode) {
this.statusCode = statusCode;
}
public String getStatusDescription() {
return statusDescription;
}
public void setStatusDescription(String statusDescription) {
this.statusDescription = statusDescription;
}
public String getPlayerId() {
return playerId;
}
public void setPlayerId(String playerId) {
this.playerId = playerId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getTierName() {
return tierName;
}
public void setTierName(String tierName) {
this.tierName = tierName;
}
public String getTierId() {
return tierId;
}
public void setTierId(String tierId) {
this.tierId = tierId;
}
public String getChineseName() {
return chineseName;
}
public void setChineseName(String chineseName) {
this.chineseName = chineseName;
}
public String getEnglishName() {
return englishName;
}
public void setEnglishName(String englishName) {
this.englishName = englishName;
}
public String getSalutation() {
return salutation;
}
public void setSalutation(String salutation) {
this.salutation = salutation;
}
public List<Integer> getNameIds() {
return nameIds;
}
public void setNameIds(List<Integer> nameIds) {
this.nameIds = nameIds;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getCodedFlag() {
return codedFlag;
}
public void setCodedFlag(Integer codedFlag) {
this.codedFlag = codedFlag;
}
public String getPlayerPhone() {
return playerPhone;
}
public void setPlayerPhone(String playerPhone) {
this.playerPhone = playerPhone;
}
public String getPhoneType() {
return phoneType;
}
public void setPhoneType(String phoneType) {
this.phoneType = phoneType;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getPassport() {
return passport;
}
public void setPassport(String passport) {
this.passport = passport;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
}
@@ -0,0 +1,9 @@
package com.mgm.mcrm.common.dtos.mgm_api;
import lombok.Data;
@Data
public class RequestPlayerLimoBookerRequest {
private String playerId;
private String userId;
}
@@ -21,12 +21,15 @@ public class UserInfoApiRecord {
private Long sectionId;
private Long blockId;
private Long teamStructureId;
private String paymentMethod;
private boolean canViewBooking=false;
private boolean canNewBooking=false;
private boolean canViewTodoList=false;
private boolean canViewDashboard=false;
private boolean canViewApproval=false;
private boolean canViewCalendar=false;
private boolean canViewNotification=false;
private boolean canViewLimo=false;
private String groupName;
private String phone;
private boolean loginTag;
@@ -56,7 +56,7 @@ public class HttpService {
.client(httpClient);
String result = HttpClientExecutor.get(getConfig, headers);
log.info("GET request result size={}", result);
log.info("GET request result size={}", result.length());
return result;
}
@@ -144,7 +144,7 @@ public class HttpService {
.client(httpClient);
HttpResult result = HttpClientExecutor.sendAndPostResp(postConfig, headers);
// System.out.println("POST 请求结果:\n" + result);
log.info("POST request result={}", result);
log.info("POST request result size={}", result.getResult().length());
return result;
}
@@ -43,6 +43,7 @@ public class MGMApiService {
private static final String API_GET_APPROVER="/RequestRoomBookingApprovalRouting";
private static final String API_GET_TODO_LIST = "/GetTodolist";
private static final String API_REQUEST_ROOM_CALENDAR = "/RequestRoomCalendar";
private static final String API_GET_LIMO_BOOKING_FROM_LEGACY = "/GetLimoBookingFromLegacy";
public HttpResponseResult invokeRequestRoomCalendar(
@@ -339,6 +340,26 @@ public class MGMApiService {
return result;
}
public HttpResponseResult invokeGetLimoBookingFromLegacy(
String playerId
) throws Exception {
HttpResponseResult result = null;
String apiLink = API_GET_LIMO_BOOKING_FROM_LEGACY;
JSONObject requestObj = new JSONObject();
Map<String, String> requestHeader = new HashMap<>();
String token = getAccessToken();
requestHeader.put("Authorization", token);
requestObj.put("PlayerId", playerId);
result = this.invokeESBAPI(ESB_Server, apiLink, requestObj, "POST", requestHeader);
return result;
}
public HttpResponseResult invokeGetTodoList(
String userId,
String category,
@@ -0,0 +1,245 @@
package com.mgm.mcrm.common.services;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.mgm.mcrm.common.constants.SysCommon;
import com.mgm.mcrm.common.dtos.http_util.HttpRequestDefine;
import com.mgm.mcrm.common.dtos.http_util.HttpResponseResult;
import com.mgm.mcrm.common.utils.DateTimeUtil;
import com.mgm.mcrm.common.utils.HttpUtil;
import com.mgm.mcrm.common.utils.LogUtil;
import com.mgm.mcrm.common.utils.mockup.HttpUtilMockup;
import com.mgm.mcrm.limo.dtos.request.RequestPlayerEsbBookerRequest;
import org.apache.commons.lang3.Strings;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Service
public class MGMEsbApiService {
public static String LIMO_ESB_APP_ID = "";
public static String LIMO_ESB_APP_SECRET = "";
public static String LIMO_ESB_SERVER = "";
public static String LIMO_ESB_ACCESS_TOKEN = "";
public static Date LIMO_ESB_EXPIRED_TIME = new Date();
private static final String API_GET_ACCESS_TOKEN = "/RequestAccessToken";
private static final String API_GET_LIMO_OVERRIDER = "/RequestLimoOverrider";
private static final String API_CHECK_SIMPLE_LIMO_BOOKING_QUALIFICATION_STATUS = "/RequestSimpleLimoBookingQualificationStatus";
private static final String API_CHECK_COMPLEX_LIMO_BOOKING_QUALIFICATION_STATUS = "/RequestComplexLimoBookingQualificationStatus";
private static final String API_REQUEST_EMPLOYEE_INFO = "/RequestEmployeeInfo";
private static final String API_REQUEST_PLAYER_LIMO_BOOKER = "/RequestPlayerLimoBooker";
private static final String API_REQUEST_PLAYER_INFO = "/RequestPlayerInfo";
public HttpResponseResult invokeRequestPlayerLimoBooker(RequestPlayerEsbBookerRequest request) throws Exception {
String apiLink = API_REQUEST_PLAYER_LIMO_BOOKER;
JSONObject requestObj = new JSONObject();
Map<String, String> requestHeader = new HashMap<>();
String token = getLimoAccessToken();
requestHeader.put("Authorization", token);
requestObj.put("EmployeeIdOrName", request.getUserId());
requestObj.put("PlayerId", request.getPlayerId());
return this.invokeESBAPI(LIMO_ESB_SERVER, apiLink, requestObj, "POST", requestHeader);
}
public String getLimoAccessToken() throws Exception {
String token = LIMO_ESB_ACCESS_TOKEN;
if (SysCommon.mgmApiMockup)
return token;
LIMO_ESB_APP_ID = SysCommon.apiConfig.getLimoApp_id();
LIMO_ESB_APP_SECRET = SysCommon.apiConfig.getLimoApp_key();
LIMO_ESB_SERVER = SysCommon.apiConfig.getLimoService_ESB();
if (token == null || LIMO_ESB_EXPIRED_TIME.getTime() < new Date().getTime()) {
String apiLink = API_GET_ACCESS_TOKEN;
JSONObject requestObj = new JSONObject();
Map<String, String> requestHeader = new HashMap<>();
requestObj.put("AppId", LIMO_ESB_APP_ID);
requestObj.put("AppSecret", LIMO_ESB_APP_SECRET);
HttpResponseResult result =
this.invokeESBAPI(LIMO_ESB_SERVER, apiLink, requestObj, "POST", requestHeader);
if (result.getStatusCode() == 200) {
JSONObject resultObj = JSONObject.parseObject(result.getResponseContent());
String status = resultObj.getString("StatusCode");
if (Strings.CI.equals("OK", status)) {
token = resultObj.getString("Token");
LIMO_ESB_EXPIRED_TIME =
DateTimeUtil.getDateFromString(resultObj.getString("ExpireTime"), "yyyy-MM-dd HH:mm:ss");
LIMO_ESB_ACCESS_TOKEN = token;
} else {
token = null;
LIMO_ESB_ACCESS_TOKEN = null;
LIMO_ESB_EXPIRED_TIME = new Date();
}
}
}
return token;
}
public HttpResponseResult invokeLimoOverrider(
String overriderIdOrName
) throws Exception {
String apiLink = API_GET_LIMO_OVERRIDER;
JSONObject requestObj = new JSONObject();
Map<String, String> requestHeader = new HashMap<>();
String token = getLimoAccessToken();
requestHeader.put("Authorization", token);
requestObj.put("OverriderIdOrName", "%");
return this.invokeESBAPI(LIMO_ESB_SERVER, apiLink, requestObj, "POST", requestHeader);
}
public HttpResponseResult invokeLimoPlayerInfo(
Integer playerId
) throws Exception {
String apiLink = API_REQUEST_PLAYER_INFO;
JSONObject requestObj = new JSONObject();
Map<String, String> requestHeader = new HashMap<>();
String token = getLimoAccessToken();
requestHeader.put("Authorization", token);
requestObj.put("PlayerId", playerId);
return this.invokeESBAPI(LIMO_ESB_SERVER, apiLink, requestObj, "POST", requestHeader);
}
public HttpResponseResult invokeSimpleLimoBookingQualificationStatus(
Integer playerId,
String bookingType,
String bookingDate
) throws Exception {
String apiLink = API_CHECK_SIMPLE_LIMO_BOOKING_QUALIFICATION_STATUS;
JSONObject requestObj = new JSONObject();
Map<String, String> requestHeader = new HashMap<>();
String token = getLimoAccessToken();
requestHeader.put("Authorization", token);
requestObj.put("PlayerId", playerId);
requestObj.put("BookingType", bookingType);
requestObj.put("BookingDate", bookingDate);
return this.invokeESBAPI(LIMO_ESB_SERVER, apiLink, requestObj, "POST", requestHeader);
}
public HttpResponseResult invokeRequestEmployeeInfo(String employeeId) throws Exception {
String apiLink = API_REQUEST_EMPLOYEE_INFO;
JSONObject requestObj = new JSONObject();
Map<String, String> requestHeader = new HashMap<>();
String token = getLimoAccessToken();
requestHeader.put("Authorization", token);
requestObj.put("EmployeeId", employeeId);
return this.invokeESBAPI(LIMO_ESB_SERVER, apiLink, requestObj, "POST", requestHeader);
}
public HttpResponseResult invokeESBAPI(
String serverType,
String requestLink,
JSONObject requestContent,
String requestMethod,
Map<String, String> requestHeader) throws Exception {
String serverUrl;
int timeoutTime;
//Get Spend Time
Gson gson = new Gson();
HttpRequestDefine requestDef = new HttpRequestDefine();
LogUtil.info(MGMEsbApiService.class,"Request Url = "+gson.toJson(requestDef.getRequestUrl())+"serverType: " + serverType+"LIMO_ESB_SERVER"+LIMO_ESB_SERVER);
if (Strings.CS.equals(serverType, LIMO_ESB_SERVER)) {
serverUrl = SysCommon.apiConfig.getLimoService_ESB();
timeoutTime = SysCommon.apiConfig.getTimeout_ESB();
} else {
throw new Exception("Invalid server type");
}
String requestUrl = serverUrl + requestLink;
requestDef.setRequestUrl(requestUrl);
requestDef.setRequestMethod(requestMethod);
requestDef.setTimeout(timeoutTime);
requestHeader.put("Content-type", "application/json;charset=utf-8");
requestDef.setHeaders(requestHeader);
if (requestContent != null)
requestDef.setEntityContent(requestContent.toString());
else
requestDef.setEntityContent("");
//Get Start,EndTime
long spanTime;
Date startTime = new Date();
LogUtil.info(MGMEsbApiService.class, "[invokeESBAPI] start request:");
HttpResponseResult httpResult = (SysCommon.mgmApiMockup ?
HttpUtilMockup.processHttpRequest(requestDef)
: HttpUtil.processHttpRequest(requestDef));
httpResult.setRequestContent(requestDef.getEntityContent());
//RefreshEndTime
Date endTime = new Date();
spanTime = DateTimeUtil.getTimeSpanSSS(startTime, endTime);
LogUtil.info(MGMEsbApiService.class, "[invokeLimoESBAPI]getRequestUrl:" + gson.toJson(requestDef.getRequestUrl()));
LogUtil.info(MGMEsbApiService.class, "[invokeLimoESBAPI]getHeaders:" + gson.toJson(requestDef.getHeaders()));
LogUtil.info(MGMEsbApiService.class, "[invokeLimoESBAPI]getRequestMethod:" + gson.toJson(requestDef.getRequestMethod()));
LogUtil.info(MGMEsbApiService.class, "[invokeLimoESBAPI]getEntityContent:" + gson.toJson(requestContent));
LogUtil.info(MGMEsbApiService.class, "[invokeLimoESBAPI]getStatusCode:" + gson.toJson(httpResult.getStatusCode()));
LogUtil.info(MGMEsbApiService.class, "[invokeLimoESBAPI]getErrorMessage:" + gson.toJson(httpResult.getErrorMessage()));
LogUtil.info(MGMEsbApiService.class, "[invokeLimoESBAPI]getResponseContent:" + gson.toJson(httpResult.getResponseContent()));
//Log Spend Time
LogUtil.info(MGMEsbApiService.class, "[invokeLimoESBAPI]SpendTime:" + spanTime + "ms");
return httpResult;
}
}
@@ -0,0 +1,643 @@
package com.mgm.mcrm.common.services;
import com.alibaba.fastjson.JSONObject;
import com.mgm.mcrm.common.constants.SysCommon;
import com.mgm.mcrm.common.dtos.http_util.HttpRequestDefine;
import com.mgm.mcrm.common.dtos.http_util.HttpResponseResult;
import com.mgm.mcrm.common.utils.HttpUtil;
import com.mgm.mcrm.common.utils.LogUtil;
import com.mgm.mcrm.common.utils.mockup.HttpUtilMockup;
import com.mgm.mcrm.limo.dtos.request.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class MGMLimoApiService {
public static String ESB_LIMO_SERVER = "";
public static String ESB_LIMO_ACCESS_TOKEN = null;
public static String ESB_LIMO_APP_ID;
public static String ESB_LIMO_APP_SECRET;
public static Date ESB_LIMO_EXPIRED_TIME = new Date();
private static final String API_GET_ACCESS_TOKEN = "GetAccessToken";
private static final String API_GET_TRIP_PRICE = "GetTripPrice";
private static final String API_GET_LOCATION = "GetLocation";
private static final String API_GET_CAR_TYPE = "GetCarType";
private static final String API_GET_GREET_TYPE = "GetGreetType";
private static final String API_GET_BOOKING = "GetBooking";
private static final String API_CREATE_BOOKING = "CreateBooking";
private static final String API_UPDATE_BOOKING = "UpdateBooking";
private static final String API_UPDATE_BOOKING_STATUS = "UpdateBookingStatus";
private static final String API_GET_FLIGHT_DETAILS= "GetFlightDetails";
private static final String API_GET_TOTAL_AMOUNT = "GetTotalAmount";
// private static final String API_MAIN_HANDLER_HANDLER = "http://mmlimodevapp01/MCRMAPI/API/MainHandler.ashx ";
@Value("${limo_address}")
private String API_MAIN_HANDLER;
@Value("${limo_getAccessToken_Id}")
private String apiGetAccessTokenId;
@Value("${limo_getAccessToken_pwd}")
private String apiGetAccessTokenPwd;
public HttpResponseResult invokeGetTripPrice() throws Exception {
Map<String, String> requestObj = new HashMap<>();
String token = getLimoAccessToken();
requestObj.put("action", API_GET_TRIP_PRICE);
requestObj.put("token", token);
return this.invokeESBFormUrlEncodedAPI(ESB_LIMO_SERVER, API_MAIN_HANDLER, requestObj, "POST", null);
}
public HttpResponseResult invokeGetLocation(String location) throws Exception {
Map<String, String> requestObj = new HashMap<>();
String token = getLimoAccessToken();
requestObj.put("action", API_GET_LOCATION);
requestObj.put("token", token);
requestObj.put("Location", "%");
return this.invokeESBFormUrlEncodedAPI(ESB_LIMO_SERVER, API_MAIN_HANDLER, requestObj, "POST", null);
}
public HttpResponseResult invokeGetCarType() throws Exception {
Map<String, String> requestObj = new HashMap<>();
String token = getLimoAccessToken();
requestObj.put("action", API_GET_CAR_TYPE);
requestObj.put("token", token);
return this.invokeESBFormUrlEncodedAPI(ESB_LIMO_SERVER, API_MAIN_HANDLER, requestObj, "POST", null);
}
public HttpResponseResult invokeGetGreetType() throws Exception {
Map<String, String> requestObj = new HashMap<>();
String token = getLimoAccessToken();
requestObj.put("action", API_GET_GREET_TYPE);
requestObj.put("token", token);
return this.invokeESBFormUrlEncodedAPI(ESB_LIMO_SERVER, API_MAIN_HANDLER, requestObj, "POST", null);
}
public HttpResponseResult invokeGetBooking(String bookingId) throws Exception {
Map<String, String> requestObj = new HashMap<>();
String token = getLimoAccessToken();
if(bookingId != null) requestObj.put("Id",bookingId);
requestObj.put("action", API_GET_BOOKING);
requestObj.put("token", token);
return this.invokeESBFormUrlEncodedAPI(ESB_LIMO_SERVER, API_MAIN_HANDLER, requestObj, "POST", null);
}
public HttpResponseResult getFlightDetails(GetLimoFlightDetailsRequest request) throws Exception {
Map<String, String> requestObj = new HashMap<>();
String token = getLimoAccessToken();
JSONObject itemObject = new JSONObject();
itemObject.put("FlightNo", request.getFlightNo());
itemObject.put("PickupDatetime", request.getPickupDateTime());
itemObject.put("PickupAirportCode", request.getPickupAirportCode());
itemObject.put("DropoffAirportCode", request.getDropOffAirportCode() != null ? request.getDropOffAirportCode() : "");
requestObj.put("action", API_GET_FLIGHT_DETAILS);
requestObj.put("token", token);
requestObj.put("itemObject", itemObject.toJSONString());
return this.invokeESBFormUrlEncodedAPI(ESB_LIMO_SERVER, API_MAIN_HANDLER, requestObj, "POST", null);
}
public HttpResponseResult getTotalAmount(GetLimoTotalAmountRequest request) throws Exception {
Map<String, String> requestObj = new HashMap<>();
String token = getLimoAccessToken();
JSONObject itemObject = new JSONObject();
itemObject.put("PickupPOIID", blankToZero(request.getPickupPOIId()));
List<String> dropoffPoiIds = splitSemicolonValues(request.getDropoffPOIIds());
itemObject.put("DropoffPOIID", valueAtOrZero(dropoffPoiIds, 0));
for (int i = 1; i <= 10; i++) {
itemObject.put("ExtraDropoffPOIID" + i, valueAtOrZero(dropoffPoiIds, i));
}
List<String> tripPrices = splitSemicolonValues(request.getSingleTripPrices());
itemObject.put("SingleTripPrice", valueAtOrZero(tripPrices, 0));
for (int i = 1; i <= 10; i++) {
itemObject.put("ExtraDropoffPrice" + i, valueAtOrZero(tripPrices, i));
}
requestObj.put("action", API_GET_TOTAL_AMOUNT);
requestObj.put("token", token);
requestObj.put("itemObject", itemObject.toJSONString());
return this.invokeESBFormUrlEncodedAPI(ESB_LIMO_SERVER, API_MAIN_HANDLER, requestObj, "POST", null);
}
/** 按 {@code ;} 拆分,去掉空白段;例如 {@code 1;2;3} → [1,2,3] */
private static List<String> splitSemicolonValues(String value) {
if (!StringUtils.isNotBlank(value)) {
return List.of();
}
return Arrays.stream(value.split(";"))
.map(String::trim)
.filter(StringUtils::isNotBlank)
.collect(Collectors.toList());
}
private static String valueAtOrZero(List<String> values, int index) {
if (values == null || index >= values.size()) {
return "0";
}
return values.get(index);
}
private static String blankToZero(String value) {
return StringUtils.isNotBlank(value) ? value.trim() : "0";
}
public HttpResponseResult invokeCreateBooking(InternalCreateLimoBookingRequest r) throws Exception {
Map<String, String> requestObj = new HashMap<>();
String token = getLimoAccessToken();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
StringBuilder sb = new StringBuilder();
sb.append("{'CreateNotConfirmBooking':'").append(r.getCreateNotConfirmBooking()).append("'");
sb.append(",'BookingType':'").append(s(r.getBookingType())).append("'");
sb.append(",'GreetType':'").append(s(r.getGreetType())).append("'");
sb.append(",'OtherGreetType':'").append(s(r.getOtherGreetType())).append("'");
sb.append(",'GuestType':'").append(s(r.getGuestType())).append("'");
sb.append(",'TripType':'").append(s(r.getTripType())).append("'");
sb.append(",'PlayerID':'").append(s(r.getPlayerId())).append("'");
sb.append(",'Ranking':'").append(s(r.getRanking())).append("'");
sb.append(",'MaskedTier':'").append(s(r.getMaskedTier())).append("'");
sb.append(",'OverrideBy':'").append(s(r.getOverrideBy())).append("'");
sb.append(",'ComplexOverrider':'").append(s(r.getComplexOverrider())).append("'");
sb.append(",'RoomNo':'").append(s(r.getRoomNo())).append("'");
sb.append(",'EmployeeID':'").append(s(r.getEmployeeId())).append("'");
sb.append(",'CreateBy':'").append(s(r.getCreateBy())).append("'");
sb.append(",'LastName':'").append(s(r.getLastName())).append("'");
sb.append(",'FirstName':'").append(s(r.getFirstName())).append("'");
sb.append(",'Salution':'").append(s(r.getSalution())).append("'");
sb.append(",'ChineseLastName':'").append(s(r.getChineseLastName())).append("'");
sb.append(",'ChineseFirstName':'").append(s(r.getChineseFirstName())).append("'");;
sb.append(",'BookerContact':'").append(s(r.getBookerContact())).append("'");
sb.append(",'BookingContact':'").append(s(r.getBookingContact())).append("'");;
sb.append(",'TenOutContact':'").append(s(r.getTenOutContact())).append("'");;
sb.append(",'GuestContact':'").append(s(r.getGuestContact())).append("'");;
sb.append(",'MAContact':'").append(s(r.getBookerContact())).append("'");
sb.append(",'TripContact':'").append(s(r.getTripContact())).append("'");
sb.append(",'AdHoc':'").append(r.getAdHoc()).append("'");
sb.append(",'PickupDatetime':'")
.append(r.getPickupDatetime() != null ? r.getPickupDatetime().format(dtf) : "")
.append("'");
sb.append(",'CarTypeID':").append(n(r.getCarTypeId()));
sb.append(",'PassengerNo':").append(n(r.getPassengerNo()));
sb.append(",'PickupPOIID':").append(n(r.getPickupPOIID()));
sb.append(",'Pickup':'").append(s(r.getPickup())).append("'");
sb.append(",'PickupTripPriceId':").append(n(r.getPickupTripPriceId()));
sb.append(",'PickupRegion':'").append(s(r.getPickupRegion())).append("'");
sb.append(",'DropoffPOIID':").append(n(r.getDropoffPOIID()));
sb.append(",'Dropoff':'").append(s(r.getDropoff())).append("'");
sb.append(",'DropoffTripPriceID':").append(n(r.getDropoffTripPriceId()));
sb.append(",'DropoffRegion':'").append(s(r.getDropoffRegion())).append("'");
for (int i = 1; i <= 10; i++) {
sb.append(",'ExtraDropoffPOIID").append(i).append("':").append(n(extraDropoffPOIID(r, i)));
sb.append(",'ExtraDropoff").append(i).append("':'").append(s(extraDropoff(r, i))).append("'");
sb.append(",'ExtraDropoffTripPriceID").append(i).append("':").append(n(extraDropoffTripPriceID(r, i)));
sb.append(",'ExtraDropoffRegion").append(i).append("':'").append(s(extraDropoffRegion(r, i))).append("'");
}
sb.append(",'SingleTripPrice':'").append(bd(r.getSingleTripPrice())).append("'");
sb.append(",'DefaultTripPrice':'").append(bd(r.getDefaultTripPrice())).append("'");
sb.append(",'DefaultPublishTripPrice':'").append(bd(r.getDefaultPublishTripPrice())).append("'");
sb.append(",'HourlyRate':'").append(bd(r.getHourlyRate())).append("'");
sb.append(",'HourlyWaitingFee':'").append(bd(r.getHourlyWaitingFee())).append("'");
sb.append(",'Hour':").append(n(r.getHour()));
sb.append(",'HourlyWaiting':").append(n(r.getHourlyWaiting()));
for (int i = 1; i <= 10; i++) {
sb.append(",'ExtraDropoffPrice").append(i).append("':'").append(bd(extraDropoffPrice(r, i))).append("'");
}
sb.append(",'HotelLimoPrice':'0.00'");
sb.append(",'OtherPriceRemark':'").append(s(r.getOtherPriceRemark())).append("'");
sb.append(",'OtherPrice':'").append(bd(r.getOtherPrice())).append("'");
sb.append(",'PaymentMethod':'").append(s(r.getPaymentMethod())).append("'");
sb.append(",'TotalAmount':'").append(bd(r.getTotalAmount())).append("'");
sb.append(",'HighImportance':").append(b(r.getHighImportance()));
sb.append(",'TenOut':").append(b(r.getTenOut()));
sb.append(",'ButlerGreet':").append(b(r.getButlerGreet()));
sb.append(",'BookedBy':'").append(s(r.getBookedBy())).append("'");
sb.append(",'ApprovedBy':'").append(s(r.getApprovedBy())).append("'");
sb.append(",'BookingRemark':'").append(s(r.getBookingRemark())).append("'");
sb.append(",'DriverRemark':'").append(s(r.getDriverRemark())).append("'");
sb.append(",'LimoInternalRemark':'").append(s(r.getLimoInternalRemark())).append("'");
sb.append(",'SystemRemark':'").append(s(r.getSystemRemark())).append("'");
sb.append(",'LimoGreet':").append(b(r.getLimoGreet()));
sb.append(",'HostGreet':").append(b(r.getHostGreet()));
sb.append(",'VIPMeetNGreet':").append(b(r.getVipMeetNGreet()));
sb.append(",'OtherGreet':'").append(s(r.getOtherGreet())).append("'");
sb.append(",'FlightDetails':'").append(s(r.getFlightDetails())).append("'");
sb.append(",'ETA':'").append(r.getPickupDatetime() != null ? r.getPickupDatetime().format(dtf) : "2000-01-01 00:00:00").append("'");
sb.append(",'Signage':'").append(s(r.getSignage())).append("'");
sb.append(",'FlightStatus':''");
sb.append(",'CancelReason':''}");
requestObj.put("action", API_CREATE_BOOKING);
requestObj.put("itemObject", sb.toString());
requestObj.put("token", token);
return this.invokeESBFormUrlEncodedAPI(ESB_LIMO_SERVER, API_MAIN_HANDLER, requestObj, "POST", null);
}
// ---- Limo format helpers: single-quote + PascalCase + 1/0 for booleans ----
private static String s(String v) { return v != null ? v : ""; }
private static String n(Integer v) { return v != null ? String.valueOf(v) : "0"; }
private static String n(Long v) { return v != null ? String.valueOf(v) : "0"; }
private static String b(Boolean v) { return v != null && v ? "1" : "0"; }
private static String bd(java.math.BigDecimal v) {
return v != null ? v.toPlainString() : "0.00";
}
private static Long extraDropoffPOIID(InternalCreateLimoBookingRequest r, int i) {
return switch (i) {
case 1 -> r.getExtraDropoffPOIID1();
case 2 -> r.getExtraDropoffPOIID2();
case 3 -> r.getExtraDropoffPOIID3();
case 4 -> r.getExtraDropoffPOIID4();
case 5 -> r.getExtraDropoffPOIID5();
case 6 -> r.getExtraDropoffPOIID6();
case 7 -> r.getExtraDropoffPOIID7();
case 8 -> r.getExtraDropoffPOIID8();
case 9 -> r.getExtraDropoffPOIID9();
case 10 -> r.getExtraDropoffPOIID10();
default -> 0L;
};
}
private static String extraDropoff(InternalCreateLimoBookingRequest r, int i) {
return switch (i) {
case 1 -> r.getExtraDropoff1();
case 2 -> r.getExtraDropoff2();
case 3 -> r.getExtraDropoff3();
case 4 -> r.getExtraDropoff4();
case 5 -> r.getExtraDropoff5();
case 6 -> r.getExtraDropoff6();
case 7 -> r.getExtraDropoff7();
case 8 -> r.getExtraDropoff8();
case 9 -> r.getExtraDropoff9();
case 10 -> r.getExtraDropoff10();
default -> "";
};
}
private static Long extraDropoffTripPriceID(InternalCreateLimoBookingRequest r, int i) {
return switch (i) {
case 1 -> r.getExtraDropoffTripPriceID1();
case 2 -> r.getExtraDropoffTripPriceID2();
case 3 -> r.getExtraDropoffTripPriceID3();
case 4 -> r.getExtraDropoffTripPriceID4();
case 5 -> r.getExtraDropoffTripPriceID5();
case 6 -> r.getExtraDropoffTripPriceID6();
case 7 -> r.getExtraDropoffTripPriceID7();
case 8 -> r.getExtraDropoffTripPriceID8();
case 9 -> r.getExtraDropoffTripPriceID9();
case 10 -> r.getExtraDropoffTripPriceID10();
default -> 0L;
};
}
private static String extraDropoffRegion(InternalCreateLimoBookingRequest r, int i) {
return switch (i) {
case 1 -> r.getExtraDropoffRegion1();
case 2 -> r.getExtraDropoffRegion2();
case 3 -> r.getExtraDropoffRegion3();
case 4 -> r.getExtraDropoffRegion4();
case 5 -> r.getExtraDropoffRegion5();
case 6 -> r.getExtraDropoffRegion6();
case 7 -> r.getExtraDropoffRegion7();
case 8 -> r.getExtraDropoffRegion8();
case 9 -> r.getExtraDropoffRegion9();
case 10 -> r.getExtraDropoffRegion10();
default -> "";
};
}
private static java.math.BigDecimal extraDropoffPrice(InternalCreateLimoBookingRequest r, int i) {
return switch (i) {
case 1 -> r.getExtraDropoffPrice1();
case 2 -> r.getExtraDropoffPrice2();
case 3 -> r.getExtraDropoffPrice3();
case 4 -> r.getExtraDropoffPrice4();
case 5 -> r.getExtraDropoffPrice5();
case 6 -> r.getExtraDropoffPrice6();
case 7 -> r.getExtraDropoffPrice7();
case 8 -> r.getExtraDropoffPrice8();
case 9 -> r.getExtraDropoffPrice9();
case 10 -> r.getExtraDropoffPrice10();
default -> java.math.BigDecimal.ZERO;
};
}
public HttpResponseResult invokeUpdateBooking(InternalUpdateLimoBookingRequest request) throws Exception {
Map<String, String> requestObj = new HashMap<>();
String token = getLimoAccessToken();
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
StringBuilder sb = new StringBuilder();
sb.append("{'ID':'").append(s(request.getId())).append("'");
appendBooleanUpdate(sb, "CreateNotConfirmBooking", request.getCreateNotConfirmBooking());
if (request.getPickupDatetime() != null) {
appendStringUpdate(sb, "PickupDatetime", request.getPickupDatetime().format(dateFormat));
}
appendNumberUpdate(sb, "PickupPOIID", request.getPickupPOIID());
appendStringUpdate(sb, "Pickup", request.getPickup());
appendStringUpdate(sb, "BookingType", request.getBookingType());
appendStringUpdate(sb, "PickupRegion", request.getPickupRegion());
appendStringUpdate(sb, "EditBy", request.getEditBy());
appendNumberUpdate(sb, "DropoffPOIID", request.getDropoffPOIID());
appendStringUpdate(sb, "Dropoff", request.getDropoff());
appendStringUpdate(sb, "DropoffRegion", request.getDropoffRegion());
appendExtraDropoffLocationUpdate(sb, 1, request.getExtraDropoffPOIID1(), request.getExtraDropoff1());
appendExtraDropoffLocationUpdate(sb, 2, request.getExtraDropoffPOIID2(), request.getExtraDropoff2());
appendExtraDropoffLocationUpdate(sb, 3, request.getExtraDropoffPOIID3(), request.getExtraDropoff3());
appendExtraDropoffLocationUpdate(sb, 4, request.getExtraDropoffPOIID4(), request.getExtraDropoff4());
appendExtraDropoffLocationUpdate(sb, 5, request.getExtraDropoffPOIID5(), request.getExtraDropoff5());
appendExtraDropoffLocationUpdate(sb, 6, request.getExtraDropoffPOIID6(), request.getExtraDropoff6());
appendExtraDropoffLocationUpdate(sb, 7, request.getExtraDropoffPOIID7(), request.getExtraDropoff7());
appendExtraDropoffLocationUpdate(sb, 8, request.getExtraDropoffPOIID8(), request.getExtraDropoff8());
appendExtraDropoffLocationUpdate(sb, 9, request.getExtraDropoffPOIID9(), request.getExtraDropoff9());
appendExtraDropoffLocationUpdate(sb, 10, request.getExtraDropoffPOIID10(), request.getExtraDropoff10());
appendDecimalUpdate(sb, "SingleTripPrice", request.getSingleTripPrice());
appendDecimalUpdate(sb, "DefaultTripPrice", request.getDefaultTripPrice());
appendDecimalUpdate(sb, "DefaultPublishTripPrice", request.getDefaultPublishTripPrice());
appendDecimalUpdate(sb, "HourlyRate", request.getHourlyRate());
appendDecimalUpdate(sb, "HourlyWaitingFee", request.getHourlyWaitingFee());
appendIntegerUpdate(sb, "Hour", request.getHour());
appendIntegerUpdate(sb, "HourlyWaiting", request.getHourlyWaiting());
appendDecimalUpdate(sb, "ExtraDropoffPrice1", request.getExtraDropoffPrice1());
appendDecimalUpdate(sb, "ExtraDropoffPrice2", request.getExtraDropoffPrice2());
appendDecimalUpdate(sb, "ExtraDropoffPrice3", request.getExtraDropoffPrice3());
appendDecimalUpdate(sb, "ExtraDropoffPrice4", request.getExtraDropoffPrice4());
appendDecimalUpdate(sb, "ExtraDropoffPrice5", request.getExtraDropoffPrice5());
appendDecimalUpdate(sb, "ExtraDropoffPrice6", request.getExtraDropoffPrice6());
appendDecimalUpdate(sb, "ExtraDropoffPrice7", request.getExtraDropoffPrice7());
appendDecimalUpdate(sb, "ExtraDropoffPrice8", request.getExtraDropoffPrice8());
appendDecimalUpdate(sb, "ExtraDropoffPrice9", request.getExtraDropoffPrice9());
appendDecimalUpdate(sb, "ExtraDropoffPrice10", request.getExtraDropoffPrice10());
appendDecimalUpdate(sb, "TotalAmount", request.getTotalAmount());
appendStringUpdate(sb, "BookingRemark", request.getBookingRemark());
sb.append("}");
requestObj.put("action", API_UPDATE_BOOKING);
requestObj.put("itemObject", sb.toString());
requestObj.put("token", token);
return this.invokeESBFormUrlEncodedAPI(ESB_LIMO_SERVER, API_MAIN_HANDLER, requestObj, "POST", null);
}
private static void appendStringUpdate(StringBuilder sb, String fieldName, String value) {
if (value != null) {
sb.append(",'").append(fieldName).append("':'").append(s(value)).append("'");
}
}
private static void appendNumberUpdate(StringBuilder sb, String fieldName, Long value) {
if (value != null) {
sb.append(",'").append(fieldName).append("':").append(value);
}
}
private static void appendIntegerUpdate(StringBuilder sb, String fieldName, Integer value) {
if (value != null) {
sb.append(",'").append(fieldName).append("':").append(value);
}
}
private static void appendDecimalUpdate(
StringBuilder sb, String fieldName, java.math.BigDecimal value) {
if (value != null) {
sb.append(",'").append(fieldName).append("':'").append(value.toPlainString()).append("'");
}
}
private static void appendBooleanUpdate(StringBuilder sb, String fieldName, Boolean value) {
if (value != null) {
sb.append(",'").append(fieldName).append("':'").append(value ? "1" : "0").append("'");
}
}
private static void appendExtraDropoffLocationUpdate(StringBuilder sb, int i, Long poiId, String name) {
appendNumberUpdate(sb, "ExtraDropoffPOIID" + i, poiId);
appendStringUpdate(sb, "ExtraDropoff" + i, name);
}
public HttpResponseResult invokeCancelLimoBooking(InternalCancelLimoBookingRequest request) throws Exception{
Map<String, String> requestObj = new HashMap<>();
String token = getLimoAccessToken();
JSONObject itemObject = new JSONObject();
itemObject.put("ID", request.getBookingId());
itemObject.put("EditBy", request.getEditBy());
itemObject.put("BookingStatus", "Cancel");
requestObj.put("token", token);
requestObj.put("itemObject", itemObject.toJSONString());
requestObj.put("action", API_UPDATE_BOOKING_STATUS);
return this.invokeESBFormUrlEncodedAPI(ESB_LIMO_SERVER, API_MAIN_HANDLER, requestObj, "POST", null);
}
private String getLimoAccessToken() throws Exception {
String token = ESB_LIMO_ACCESS_TOKEN;
if (SysCommon.mgmApiMockup)
return token;
ESB_LIMO_APP_ID = SysCommon.apiConfig.getApiKey_ESB();
ESB_LIMO_APP_SECRET = SysCommon.apiConfig.getApiSecret_ESB();
ESB_LIMO_SERVER = SysCommon.apiConfig.getServerUrl_ESB();
if (token == null || ESB_LIMO_EXPIRED_TIME.getTime() < new Date().getTime()) {
String itemObject = String.format(
"{'LoginID':'%s','Password':'%s'}",
apiGetAccessTokenId,
apiGetAccessTokenPwd);
Map<String, String> formData = new HashMap<>();
formData.put("action", API_GET_ACCESS_TOKEN);
formData.put("itemObject", itemObject);
HttpResponseResult result = this.invokeESBFormUrlEncodedAPI(
ESB_LIMO_SERVER,
API_MAIN_HANDLER,
formData,
"POST",
null);
if (result.getStatusCode() == 200) {
JSONObject resultObj = JSONObject.parseObject(result.getResponseContent());
String status = resultObj.getString("result");
if (Strings.CI.equals("200", status)) {
token = resultObj.getString("token");
ESB_LIMO_ACCESS_TOKEN = token;
} else {
token = null;
ESB_LIMO_ACCESS_TOKEN = null;
}
}
}
return token;
}
public HttpResponseResult invokeESBFormUrlEncodedAPI(
String serverUrl,
String requestLink,
Map<String, String> formData,
String requestMethod,
Map<String, String> requestHeader) throws Exception {
HttpRequestDefine requestDef = new HttpRequestDefine();
String requestUrl = requestLink;
Map<String, String> headers = (requestHeader == null ? new HashMap<>() : new HashMap<>(requestHeader));
String requestBody = buildFormUrlEncodedBody(formData);
requestDef.setRequestUrl(requestUrl);
requestDef.setRequestMethod(requestMethod);
requestDef.setHeaders(headers);
requestDef.setEntityContent(requestBody);
headers.put("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
LogUtil.info(MGMLimoApiService.class, "[invokeFormUrlEncodedAPI] Limo RequestUrl:" + requestUrl);
LogUtil.info(MGMLimoApiService.class, "[invokeFormUrlEncodedAPI] Limo RequestBody:" + requestBody);
HttpResponseResult httpResult = (SysCommon.mgmApiMockup ? HttpUtilMockup.processHttpRequest(requestDef)
: HttpUtil.processHttpRequest(requestDef));
JSONObject resultObj = JSONObject.parseObject(httpResult.getResponseContent());
String status = (resultObj == null ? null : resultObj.getString("result"));
if (Strings.CS.equals("201", status)) {
formData.put("token", this.getLimoAccessToken());
requestDef.setEntityContent(buildFormUrlEncodedBody(formData));
LogUtil.info(MGMLimoApiService.class, "[invokeFormUrlEncodedAPI] Token expired Retry Limo RequestUrl:" + requestUrl);
LogUtil.info(MGMLimoApiService.class, "[invokeFormUrlEncodedAPI] Token expired Retry Limo RequestBody:" + requestBody);
httpResult = (SysCommon.mgmApiMockup ? HttpUtilMockup.processHttpRequest(requestDef)
: HttpUtil.processHttpRequest(requestDef));
}
String responseContent = httpResult.getResponseContent();
int responseLength = (responseContent == null ? 0 : responseContent.length());
LogUtil.info(MGMLimoApiService.class, "[invokeFormUrlEncodedAPI] Limo action:" + (formData == null ? null : formData.get("action"))
+ " Limo ResponseLength:" + responseLength
+ " Status=" + httpResult.getStatusCode());
httpResult.setRequestContent(requestBody);
return httpResult;
}
private String buildFormUrlEncodedBody(Map<String, String> formData) {
if (formData == null || formData.isEmpty())
return "";
StringBuilder body = new StringBuilder();
for (Map.Entry<String, String> entry : formData.entrySet()) {
if (!body.isEmpty())
body.append("&");
body.append(URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8));
body.append("=");
body.append(encodeFormValue(entry.getValue()));
}
return body.toString();
}
/**
* 对 form value 做最小化编码,只转义会破坏 form-urlencoded 结构的字符,
* 保留 JSON 结构符号 ({ } " : , [ ]) 原样,与 Postman 行为一致。
*/
private String encodeFormValue(String value) {
if (value == null)
return "";
StringBuilder sb = new StringBuilder(value.length());
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
switch (c) {
case '&': sb.append("%26"); break;
case '=': sb.append("%3D"); break;
// case ' ': sb.append("+"); break;
case '%': sb.append("%25"); break;
case '\n': sb.append("%0A"); break;
case '\r': sb.append("%0D"); break;
default: sb.append(c); break;
}
}
return sb.toString();
}
}
@@ -8,6 +8,8 @@ import com.mgm.mcrm.common.dtos.http_util.HttpRequestDefine;
import com.mgm.mcrm.common.dtos.http_util.HttpResponseResult;
import com.mgm.mcrm.common.utils.LogUtil;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -29,6 +31,67 @@ public class HttpUtilMockup {
return mockupConfig;
}
private static boolean isApiLinkMatch(String requestLink, String requestContent, String apiLink) {
if (apiLink == null || apiLink.isEmpty()) {
return false;
}
if (requestLink != null && requestLink.contains(apiLink)) {
return true;
}
JSONObject formObj = parseFormUrlEncoded(requestContent);
return formObj != null && apiLink.equals(formObj.getString("action"));
}
private static JSONObject parseRequestObject(String requestContent) {
if (requestContent == null || requestContent.isEmpty()) {
return null;
}
try {
JSONObject requestObj = JSONObject.parseObject(requestContent);
if (requestObj != null) {
return requestObj;
}
} catch (Exception err) {
}
return parseFormUrlEncoded(requestContent);
}
private static JSONObject parseFormUrlEncoded(String requestContent) {
if (requestContent == null || requestContent.isEmpty() || requestContent.indexOf('=') < 0) {
return null;
}
String trimmed = requestContent.trim();
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
return null;
}
JSONObject formObj = new JSONObject();
String[] pairs = requestContent.split("&");
for (int i = 0; i < pairs.length; i++) {
String pair = pairs[i];
int eqIndex = pair.indexOf('=');
if (eqIndex <= 0) {
continue;
}
String key = urlDecode(pair.substring(0, eqIndex));
String value = urlDecode(pair.substring(eqIndex + 1));
if (!key.isEmpty()) {
formObj.put(key, value);
}
}
return formObj.isEmpty() ? null : formObj;
}
private static String urlDecode(String value) {
if (value == null || value.isEmpty()) {
return "";
}
try {
return URLDecoder.decode(value, StandardCharsets.UTF_8);
} catch (Exception err) {
return value;
}
}
private static String findMockResultByLink(String requestLink,String requestContent) {
String result ="";
JSONArray configData = getMockupConfig();
@@ -36,13 +99,8 @@ public class HttpUtilMockup {
JSONObject checkItem = configData.getJSONObject(i);
if(checkItem.containsKey("apiLink") && checkItem.containsKey("resultFiles")) {
String apiLink = checkItem.getString("apiLink");
if(requestLink.contains(apiLink)) {
JSONObject requestObj = null;
try {
requestObj = JSONObject.parseObject(requestContent);
}catch(Exception err) {
}
if(isApiLinkMatch(requestLink, requestContent, apiLink)) {
JSONObject requestObj = parseRequestObject(requestContent);
int resultIndex =0;
if(checkItem.containsKey("resultIndex")) {
resultIndex=checkItem.getIntValue("resultIndex");
@@ -0,0 +1,312 @@
package com.mgm.mcrm.limo.controller;
import com.auth0.jwt.JWT;
import com.mgm.mcrm.authorization.models.SysRouterPermission;
import com.mgm.mcrm.authorization.services.MgmUserService;
import com.mgm.mcrm.authorization.services.SysGroupPermissionService;
import com.mgm.mcrm.common.constants.SysCommon;
import com.mgm.mcrm.common.dtos.BaseApiResponse;
import com.mgm.mcrm.common.dtos.mgm_api.PlayerProfileEntry;
import com.mgm.mcrm.common.dtos.mgm_api.UserInfoApiRecord;
import com.mgm.mcrm.limo.dtos.request.GetLimoFlightDetailsRequest;
import com.mgm.mcrm.limo.dtos.request.GetLimoTotalAmountRequest;
import com.mgm.mcrm.limo.dtos.request.RequestPlayerEsbBookerRequest;
import com.mgm.mcrm.limo.dtos.request.*;
import com.mgm.mcrm.limo.dtos.response.*;
import com.mgm.mcrm.limo.models.LimoBookings;
import com.mgm.mcrm.player.services.PlayerService;
import jakarta.annotation.Resource;
import com.mgm.mcrm.limo.services.LimoService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/api/limo")
public class LimoController {
@Resource
private LimoService limoService;
@Resource
private SysGroupPermissionService sysGroupPermissionService;
@Resource
private PlayerService playerService;
@Resource
private MgmUserService userService;
@RequestMapping(value = "/search_limo", method = RequestMethod.POST, produces = "application/json;charset=UTF-8",consumes = MediaType.APPLICATION_JSON_VALUE)
public List limoRecordSearch(HttpServletRequest request, @RequestBody Map<String, Object> params) throws Exception {
HashMap member = (HashMap)params.get("member");
String playerId = String.valueOf(member.get("playerId"));
List<LimoBookings> response = new ArrayList<>();
boolean havePermission = sysGroupPermissionService.checkAppPermission(request,"10001_08");
if (havePermission) {
if(!SysCommon.mgmApiMockup)
limoService.getTodayBooking(playerId);
response = limoService.getBookingsByPlayerId(playerId, request);
}
return response;
}
@GetMapping("/getTripPriceList")
public BaseApiResponse<List<LimoTripPriceItem>> getTripPriceList() throws Exception {
return limoService.getTripPriceList();
}
@GetMapping("/getLocation")
public BaseApiResponse<List<LimoPointOfInterestItem>> getLocation(@RequestParam String location)
throws Exception {
return limoService.getLocation(location);
}
@GetMapping("/getCarType")
public BaseApiResponse<List<LimoCarTypeItem>> getCarType() throws Exception {
return limoService.getCarType();
}
@GetMapping("/getGreetType")
public BaseApiResponse<List<LimoGreetTypeItem>> getGreetType() throws Exception {
return limoService.getGreetType();
}
@GetMapping("/getFlightDetails")
public BaseApiResponse<List<LimoFlightDetailsItem>> getFlightDetails(GetLimoFlightDetailsRequest request)
throws Exception {
return limoService.getFlightDetails(request);
}
@GetMapping("/getTotalAmount")
public BaseApiResponse<List<LimoTotalAmountItem>> getTotalAmount(GetLimoTotalAmountRequest request)
throws Exception {
return limoService.getTotalAmount(request);
}
@PostMapping(value = "/prepareBooking", produces = "application/json;charset=UTF-8",
consumes = MediaType.APPLICATION_JSON_VALUE)
public BaseApiResponse<PrepareLimoBookingData> prepareBooking(
HttpServletRequest requestHeader,
@Valid @RequestBody PrepareLimoBookingRequest request) {
String token = requestHeader.getHeader("Authorization");
String userId = JWT.decode(token).getClaim("login_id").asString();
String groupName = JWT.decode(token).getClaim("group_name").asString();
boolean canCreateBooking = sysGroupPermissionService
.getRouterPermissionsByGroupName(groupName)
.stream()
.anyMatch(permission -> Strings.CS.equals(permission.getId(), "10001_08"));
if (!canCreateBooking) {
return BaseApiResponse.error("NO_PERMISSION", "Have not Permission");
}
BaseApiResponse<PlayerProfileEntry> playerProfileByPlayerIdAndUserId = playerService.findPlayerProfileByPlayerIdAndUserId(
String.valueOf(request.getPlayerId()), userId);
if (!playerProfileByPlayerIdAndUserId.isSuccess()) {
return BaseApiResponse.error("API_CALL_FAILED", "Call Api failed");
}
PlayerProfileEntry profile = playerProfileByPlayerIdAndUserId.getData();
if (profile == null || !Integer.valueOf(1).equals(profile.getCodedFlag())) {
return BaseApiResponse.error("NO_PERMISSION", "Have not Permission");
}
return limoService.prepareBooking(request, userId);
}
@RequestMapping(value = "/createBooking" , method = RequestMethod.POST, produces = "application/json;charset=UTF-8",consumes = MediaType.APPLICATION_JSON_VALUE)
public CreateLimoBookingResponse createBooking(HttpServletRequest requestHeader, @RequestBody CreateLimoBookingRequest request) throws Exception {
CreateLimoBookingResponse response = new CreateLimoBookingResponse();
List<SysRouterPermission> userPermissions = new ArrayList<SysRouterPermission>();
String token = requestHeader.getHeader("Authorization");
String groupName = JWT.decode(token).getClaim("group_name").asString();
userPermissions = sysGroupPermissionService.getRouterPermissionsByGroupName(groupName);
boolean createBooking = false;
String playerId = String.valueOf(request.getPlayerId());
String userId = JWT.decode(token).getClaim("login_id").asString();
BaseApiResponse<UserInfoApiRecord> userInfoByUserId = userService.findUserInfoByUserId(userId);
UserInfoApiRecord userInfo = userInfoByUserId.getData();
BaseApiResponse<PlayerProfileEntry> playerProfileByPlayerIdAndUserId = playerService.findPlayerProfileByPlayerIdAndUserId(playerId, userId);
if(playerProfileByPlayerIdAndUserId.isSuccess()) {
PlayerProfileEntry profile = playerProfileByPlayerIdAndUserId.getData();
Integer code = profile.getCodedFlag();
if(!userPermissions.isEmpty()) {
for(SysRouterPermission per:userPermissions) {
if(Strings.CS.equals(per.getId(), "10001_08")) createBooking = true;
}
}
if(code==1&&createBooking) {
response = limoService.createBooking(request,requestHeader,userInfo);
}else {
response.setSuccess(Boolean.FALSE);
response.setMessage("Have not Permission");
response.setCode("NO_PERMISSION");
}
}else{
response.setSuccess(Boolean.FALSE);
response.setMessage("Call Api failed");
response.setCode("API_CALL_FAILED");
}
return response;
}
@RequestMapping(value = "/updateBooking", method = RequestMethod.POST, produces = "application/json;charset=UTF-8",consumes = MediaType.APPLICATION_JSON_VALUE)
public UpdateLimoBookingResponse updateBooking(HttpServletRequest requestHeader, @RequestBody UpdateLimoBookingRequest request) throws Exception {
UpdateLimoBookingResponse response = new UpdateLimoBookingResponse();
List<SysRouterPermission> userPermissions = new ArrayList<SysRouterPermission>();
String token = requestHeader.getHeader("Authorization");
// String userId = JWT.decode(token).getClaim("login_id").asString();
String groupName = JWT.decode(token).getClaim("group_name").asString();
userPermissions = sysGroupPermissionService.getRouterPermissionsByGroupName(groupName);
boolean createBooking = false;
String playerId = String.valueOf(request.getPlayerId());
String userId = JWT.decode(token).getClaim("login_id").asString();
if(!StringUtils.isEmpty(userId)) {
userId = Strings.CS.replace(userId, "@mgm.mo", "");
}
BaseApiResponse<PlayerProfileEntry> playerProfileByPlayerIdAndUserId = playerService.findPlayerProfileByPlayerIdAndUserId(playerId, userId);
if(playerProfileByPlayerIdAndUserId.isSuccess()) {
PlayerProfileEntry profile = playerProfileByPlayerIdAndUserId.getData();
Integer code = profile.getCodedFlag();
if (!userPermissions.isEmpty()) {
for (SysRouterPermission per : userPermissions) {
if (Strings.CS.equals(per.getId(), "10001_08")) createBooking = true;
}
}
if (code == 1 && createBooking) {
response = limoService.updateBooking(request, userId);
}else{
response.setSuccess(Boolean.FALSE);
response.setMessage("Have not Permission");
response.setCode("NO_PERMISSION");
}
}else{
response.setSuccess(Boolean.FALSE);
response.setMessage("Call Api failed");
response.setCode("API_CALL_FAILED");
}
return response;
}
@RequestMapping( value = "/cancelBooking", method = RequestMethod.POST, produces = "application/json;charset=UTF-8",consumes = MediaType.APPLICATION_JSON_VALUE)
public CancelLimoBookingResponse cancelBooking(HttpServletRequest requestHeader, @RequestBody CancelLimoBookingRequest request) throws Exception {
CancelLimoBookingResponse response = new CancelLimoBookingResponse();
List<SysRouterPermission> userPermissions = new ArrayList<>();
String token = requestHeader.getHeader("Authorization");
String userId = JWT.decode(token).getClaim("login_id").asString();
String groupName = JWT.decode(token).getClaim("group_name").asString();
userPermissions = sysGroupPermissionService.getRouterPermissionsByGroupName(groupName);
boolean createBooking = false;
if(!StringUtils.isEmpty(userId)) {
userId = Strings.CS.replace(userId, "@mgm.mo", "");
}
if(!userPermissions.isEmpty()) {
for(SysRouterPermission per:userPermissions) {
if(Strings.CS.equals(per.getId(), "10001_08") ) createBooking = true;
}
}
if (createBooking) {
response = limoService.cancelBooking(request,userId);
}else{
response.setSuccess(Boolean.FALSE);
response.setMessage("Have not Permission");
response.setCode("NO_PERMISSION");
}
return response;
}
@GetMapping("/checkQualification")
public GetLimoBookingQualificationResponse getLimoBookingQualification(
GetLimoBookingQualificationRequest request) throws Exception {
return limoService.checkBookingQualification(request);
}
@GetMapping("/getOverrider")
public GetOverriderInfoResponse getLimoOverriderInfo(
GetLimoBookingGetOverriderRequest request) throws Exception {
return limoService.getLimoOverriderData(request);
}
@GetMapping("/getEmployeeInfo")
public GetLimoEmployeeInfoResponse getLimoEmployeeInfo(
GetLimoEmployeeInfoRequest request)throws Exception {
return limoService.getLimoEmployeeData(request);
}
@GetMapping("/playerLimoBooker")
public BaseApiResponse<List<PlayerEsbBookerItem>> getLimoPlayerLimoBooker(
RequestPlayerEsbBookerRequest request)throws Exception {
return limoService.getPlayerEsbBooker(request);
}
@RequestMapping(value = "/get_limo_booking_by_id", method = RequestMethod.POST, produces = "application/json;charset=UTF-8",consumes = MediaType.APPLICATION_JSON_VALUE)
public BaseApiResponse<LimoBookings> getLimoBookingById(HttpServletRequest request, @RequestBody Map<String, String> params) throws Exception {
BaseApiResponse<LimoBookings> response = new BaseApiResponse<>();
String token = request.getHeader("Authorization");
String userId = JWT.decode(token).getClaim("login_id").asString();
boolean havePermission = sysGroupPermissionService.checkAppPermission(request,"10001_08");
Long id = Long.valueOf(params.get("id"));
boolean viewPlayer = limoService.checkViewPlayer(id,null,userId);
if (havePermission && viewPlayer) {
response.setData(limoService.getBookingById(id));
response.setSuccess(Boolean.TRUE);
}else{
response.setSuccess(Boolean.FALSE);
response.setMessage("Have not permission");
response.setCode("NO_PERMISSION");
}
return response;
}
@RequestMapping(value = "/get_limo_booking_by_conf", method = RequestMethod.POST, produces = "application/json;charset=UTF-8",consumes = MediaType.APPLICATION_JSON_VALUE)
public BaseApiResponse<LimoBookings> getLimoBookingByConf(HttpServletRequest request, @RequestBody Map<String, String> params) throws Exception {
BaseApiResponse<LimoBookings> response = new BaseApiResponse<>();
boolean havePermission = sysGroupPermissionService.checkAppPermission(request,"10001_08");
String token = request.getHeader("Authorization");
String userId = JWT.decode(token).getClaim("login_id").asString();
String confirmationNo = params.get("conf");
LimoBookings bookingById = limoService.getBookingByConf(confirmationNo);
boolean viewPlayer = limoService.checkViewPlayer(null,confirmationNo,userId);
if (havePermission && viewPlayer) {
response.setData(limoService.getBookingById(bookingById.getId()));
response.setSuccess(Boolean.TRUE);
}else{
response.setSuccess(false);
response.setMessage("Have not permission");
response.setCode("NO_PERMISSION");
}
return response;
}
}
@@ -0,0 +1,54 @@
package com.mgm.mcrm.limo.dao;
import com.mgm.mcrm.limo.models.LimoBookingDraft;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.Optional;
import java.util.UUID;
@Repository
public interface LimoBookingDraftRepository extends JpaRepository<LimoBookingDraft, Long> {
Optional<LimoBookingDraft> findByDraftId(UUID draftId);
@Modifying(clearAutomatically = true, flushAutomatically = true)
@Transactional(transactionManager = "transactionManager")
@Query("""
update LimoBookingDraft d
set d.status = 'PROCESSING', d.updatedAt = :now, d.version = d.version + 1
where d.draftId = :draftId
and d.userId = :userId
and d.playerId = :playerId
and d.status = 'PENDING'
and d.expiresAt > :now
""")
int claimPendingDraft(
@Param("draftId") UUID draftId,
@Param("userId") String userId,
@Param("playerId") Long playerId,
@Param("now") LocalDateTime now);
@Modifying(clearAutomatically = true, flushAutomatically = true)
@Transactional(transactionManager = "transactionManager")
@Query("""
update LimoBookingDraft d
set d.status = :status,
d.limoBookingId = :limoBookingId,
d.usedAt = :usedAt,
d.updatedAt = :now,
d.version = d.version + 1
where d.draftId = :draftId and d.status = 'PROCESSING'
""")
int completeDraft(
@Param("draftId") UUID draftId,
@Param("status") String status,
@Param("limoBookingId") String limoBookingId,
@Param("usedAt") LocalDateTime usedAt,
@Param("now") LocalDateTime now);
}
@@ -0,0 +1,32 @@
package com.mgm.mcrm.limo.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import com.mgm.mcrm.limo.models.LimoBookings;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
@Repository
public interface LimoBookingsRepository extends JpaRepository<LimoBookings, Long> {
List<LimoBookings> findByPlayerIdAndBookingStatusNot(String playerId, String bookingStatus);
List<LimoBookings> findByPlayerIdAndBookingStatusNotAndPickUpDatetimeGreaterThanEqual(
String playerId, String bookingStatus, Date minPickUpDatetime);
List<LimoBookings> findByPlayerIdAndBookingStatusNotInAndPickUpDatetimeGreaterThanEqual(
String playerId, List<String> bookingStatuses, Date minPickUpDatetime);
LimoBookings findByConfirmationNo(String confirmationNo);
/** PENDING 且创建时间早于 threshold(用于超时自动确认) */
List<LimoBookings> findByBookingStatusAndCreatedAtBeforeAndCreatedAtIsNotNull(String bookingStatus, Date createdAtBefore);
LimoBookings getById(Long id);
List<LimoBookings> findByLimoBookingId(String limoBookingId);
LimoBookings getByLimoBookingId(String limoBookingId);
}
@@ -0,0 +1,11 @@
package com.mgm.mcrm.limo.dtos.request;
import lombok.Data;
@Data
public class CancelLimoBookingRequest {
private Long id;
private String updatedBy;
}
@@ -0,0 +1,69 @@
package com.mgm.mcrm.limo.dtos.request;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
@Data
public class CreateLimoBookingRequest {
private String draftId;
private Integer playerId;
private String player;
private String confirmationNo;
private String bookingType;
private String pickUpPoint;
private String pickUpPointId;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "GMT+8")
private Date pickUpDatetime;
private String dropOffPoint;
private String dropOffPointId;
private String serviceType;
private String carType;
private Integer noOfPax;
private String greetType;
private String signage;
private String approver;
private String approverId;
private String paymentMethod;
private String tripContact;
private Integer isHourlyRate;
private String hourlyRate;
private String remarks;
private String flightDetail;
private String flightEta;
private String flightStatus;
private String createdBy;
private String overriderName;
private String overriderId;
private String bookerId;
private String otherPickUpPoint;
private String otherDropOffPoint;
private String hour;
// --- 前端新增字段,从 Limo API 获取的真实 ID ---
private Long carTypeId;
private String greetTypeId;
private String guestType;
private String tripType;
private String pickupRegion;
private String dropoffRegion;
private String ranking;
private String salution;
private String lastName;
private String bookerContact;
private String employeeId;
private String extraOffPoint;
private String extraOffPointId;
private Integer isHighImportance;
private Integer isContactGuestDirectly;
private String guestContact;
private Integer isTenOut;
private String tenOutContact;
private String bookingContact;
private Integer tripPriceId;
}
@@ -0,0 +1,12 @@
package com.mgm.mcrm.limo.dtos.request;
import lombok.Data;
@Data
public class GetLimoAccessTokenRequest {
private String LoginId;
private String password;
}
@@ -0,0 +1,8 @@
package com.mgm.mcrm.limo.dtos.request;
import lombok.Data;
@Data
public class GetLimoBookingGetOverriderRequest {
private String OverriderInfo;
}
@@ -0,0 +1,10 @@
package com.mgm.mcrm.limo.dtos.request;
import lombok.Data;
@Data
public class GetLimoBookingQualificationRequest {
private Integer PlayerId;
private String BookingType;
private String BookingDate;
}
@@ -0,0 +1,8 @@
package com.mgm.mcrm.limo.dtos.request;
import lombok.Data;
@Data
public class GetLimoEmployeeInfoRequest {
private String EmployeeId;
}
@@ -0,0 +1,11 @@
package com.mgm.mcrm.limo.dtos.request;
import lombok.Data;
@Data
public class GetLimoFlightDetailsRequest {
private String flightNo;
private String pickupDateTime;
private String pickupAirportCode;
private String dropOffAirportCode;
}
@@ -0,0 +1,10 @@
package com.mgm.mcrm.limo.dtos.request;
import lombok.Data;
@Data
public class GetLimoOverriderRequest {
private String OverriderIdOrName;
}
@@ -0,0 +1,10 @@
package com.mgm.mcrm.limo.dtos.request;
import lombok.Data;
@Data
public class GetLimoTotalAmountRequest {
private String pickupPOIId;
private String dropoffPOIIds;
private String singleTripPrices;
}
@@ -0,0 +1,10 @@
package com.mgm.mcrm.limo.dtos.request;
import lombok.Data;
@Data
public class GetPlayerInfoRequest {
private String playerId;
}
@@ -0,0 +1,15 @@
package com.mgm.mcrm.limo.dtos.request;
import lombok.Data;
@Data
public class GetSimpleLimoBookingQualificationStatusRequest {
private String playerId;
private String bookingType;
private String bookingDate;
}
@@ -0,0 +1,9 @@
package com.mgm.mcrm.limo.dtos.request;
import lombok.Data;
@Data
public class InternalCancelLimoBookingRequest {
private String bookingId;
private String editBy;
}
@@ -0,0 +1,158 @@
package com.mgm.mcrm.limo.dtos.request;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class InternalCreateLimoBookingRequest {
private int createNotConfirmBooking;
private String bookingType;
private String greetType;
private String otherGreetType;
private String guestType;
private String tripType;
private String playerId;
private String ranking;
private String overrideBy;
private String complexOverrider;
private String roomNo;
private String employeeId;
private String lastName;
private String firstName;
private String salution;
private String chineseLastName;
private String chineseFirstName;
private String bookerContact;
private String tripContact;
private String MaskedTier;
private int adHoc;
private LocalDateTime pickupDatetime;
private Long carTypeId;
private Integer passengerNo;
private Long pickupPOIID;
private String pickup;
private Long pickupTripPriceId;
private String pickupRegion;
private Long dropoffPOIID;
private String dropoff;
private Long dropoffTripPriceId;
private String dropoffRegion;
private Long extraDropoffPOIID1;
private String extraDropoff1;
private Long extraDropoffTripPriceID1;
private String extraDropoffRegion1;
private Long extraDropoffPOIID2;
private String extraDropoff2;
private Long extraDropoffTripPriceID2;
private String extraDropoffRegion2;
private Long extraDropoffPOIID3;
private String extraDropoff3;
private Long extraDropoffTripPriceID3;
private String extraDropoffRegion3;
private Long extraDropoffPOIID4;
private String extraDropoff4;
private Long extraDropoffTripPriceID4;
private String extraDropoffRegion4;
private Long extraDropoffPOIID5;
private String extraDropoff5;
private Long extraDropoffTripPriceID5;
private String extraDropoffRegion5;
private Long extraDropoffPOIID6;
private String extraDropoff6;
private Long extraDropoffTripPriceID6;
private String extraDropoffRegion6;
private Long extraDropoffPOIID7;
private String extraDropoff7;
private Long extraDropoffTripPriceID7;
private String extraDropoffRegion7;
private Long extraDropoffPOIID8;
private String extraDropoff8;
private Long extraDropoffTripPriceID8;
private String extraDropoffRegion8;
private Long extraDropoffPOIID9;
private String extraDropoff9;
private Long extraDropoffTripPriceID9;
private String extraDropoffRegion9;
private Long extraDropoffPOIID10;
private String extraDropoff10;
private Long extraDropoffTripPriceID10;
private String extraDropoffRegion10;
private BigDecimal singleTripPrice;
private BigDecimal defaultTripPrice;
private BigDecimal defaultPublishTripPrice;
private BigDecimal hourlyRate;
private BigDecimal hourlyWaitingFee;
private Integer hour;
private Integer hourlyWaiting;
private BigDecimal extraDropoffPrice1;
private BigDecimal extraDropoffPrice2;
private BigDecimal extraDropoffPrice3;
private BigDecimal extraDropoffPrice4;
private BigDecimal extraDropoffPrice5;
private BigDecimal extraDropoffPrice6;
private BigDecimal extraDropoffPrice7;
private BigDecimal extraDropoffPrice8;
private BigDecimal extraDropoffPrice9;
private BigDecimal extraDropoffPrice10;
private String otherPriceRemark;
private BigDecimal otherPrice;
private String paymentMethod;
private BigDecimal totalAmount;
private Boolean highImportance;
private Boolean tenOut;
private Boolean butlerGreet;
private String bookedBy;
private String approvedBy;
private String bookingRemark;
private String driverRemark;
private String limoInternalRemark;
private String systemRemark;
private Boolean limoGreet;
private Boolean hostGreet;
private Boolean vipMeetNGreet;
private String otherGreet;
private String flightDetails;
private String signage;
private String guestContact;
private String tenOutContact;
private String bookingContact;
private String createBy;
public int getCreateNotConfirmBooking() {
return createNotConfirmBooking;
}
}
@@ -0,0 +1,153 @@
package com.mgm.mcrm.limo.dtos.request;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class InternalUpdateLimoBookingRequest {
private String id;
private Boolean createNotConfirmBooking;
private String bookingType;
private String greetType;
private String otherGreetType;
private String guestType;
private String tripType;
private String playerId;
private String ranking;
private String MaskedTier;
private String overrideBy;
private String complexOverrider;
private String roomNo;
private String employeeId;
private String firstName;
private String lastName;
private String salution;
private String chineseLastName;
private String chineseFirstName;
private String bookerContact;
private String tripContact;
private String adHoc;
private LocalDateTime pickupDatetime;
private Long carTypeId;
private Integer passengerNo;
private Long pickupPOIID;
private String pickup;
private Long pickupTripPriceID;
private String pickupRegion;
private Long dropoffPOIID;
private String dropoff;
private Long dropoffTripPriceID;
private String dropoffRegion;
private Long extraDropoffPOIID1;
private String extraDropoff1;
private Long extraDropoffTripPriceID1;
private String extraDropoffRegion1;
private Long extraDropoffPOIID2;
private String extraDropoff2;
private Long extraDropoffTripPriceID2;
private String extraDropoffRegion2;
private Long extraDropoffPOIID3;
private String extraDropoff3;
private Long extraDropoffTripPriceID3;
private String extraDropoffRegion3;
private Long extraDropoffPOIID4;
private String extraDropoff4;
private Long extraDropoffTripPriceID4;
private String extraDropoffRegion4;
private Long extraDropoffPOIID5;
private String extraDropoff5;
private Long extraDropoffTripPriceID5;
private String extraDropoffRegion5;
private Long extraDropoffPOIID6;
private String extraDropoff6;
private Long extraDropoffTripPriceID6;
private String extraDropoffRegion6;
private Long extraDropoffPOIID7;
private String extraDropoff7;
private Long extraDropoffTripPriceID7;
private String extraDropoffRegion7;
private Long extraDropoffPOIID8;
private String extraDropoff8;
private Long extraDropoffTripPriceID8;
private String extraDropoffRegion8;
private Long extraDropoffPOIID9;
private String extraDropoff9;
private Long extraDropoffTripPriceID9;
private String extraDropoffRegion9;
private Long extraDropoffPOIID10;
private String extraDropoff10;
private Long extraDropoffTripPriceID10;
private String extraDropoffRegion10;
private BigDecimal singleTripPrice;
private BigDecimal defaultTripPrice;
private BigDecimal defaultPublishTripPrice;
private BigDecimal hourlyRate;
private BigDecimal hourlyWaitingFee;
private Integer hour;
private Integer hourlyWaiting;
private BigDecimal extraDropoffPrice1;
private BigDecimal extraDropoffPrice2;
private BigDecimal extraDropoffPrice3;
private BigDecimal extraDropoffPrice4;
private BigDecimal extraDropoffPrice5;
private BigDecimal extraDropoffPrice6;
private BigDecimal extraDropoffPrice7;
private BigDecimal extraDropoffPrice8;
private BigDecimal extraDropoffPrice9;
private BigDecimal extraDropoffPrice10;
private String otherPriceRemark;
private BigDecimal otherPrice;
private String paymentMethod;
private BigDecimal totalAmount;
private Boolean highImportance;
private Boolean tenOut;
private Boolean butlerGreet;
private String bookedBy;
private String approvedBy;
private String bookingRemark;
private String driverRemark;
private String limoInternalRemark;
private String systemRemark;
private Boolean limoGreet;
private Boolean hostGreet;
private Boolean vipMeetNGreet;
private String otherGreet;
private String flightDetails;
private String signage;
private String editBy;
}
@@ -0,0 +1,15 @@
package com.mgm.mcrm.limo.dtos.request;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Data
public class PrepareLimoBookingRequest {
@NotNull(message = "playerId is required")
private Integer playerId;
@NotBlank(message = "approverId is required")
private String approverId;
}
@@ -0,0 +1,9 @@
package com.mgm.mcrm.limo.dtos.request;
import lombok.Data;
@Data
public class RequestPlayerEsbBookerRequest {
private Integer playerId;
private String userId;
}
@@ -0,0 +1,92 @@
package com.mgm.mcrm.limo.dtos.request;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonAlias;
import lombok.Data;
@Data
public class UpdateLimoBookingRequest {
private Long id;
private String confirmationNo;
private String bookingStatus;
private String playerId;
private String player;
private String playerName;
private String tierName;
private String bookingType;
private String bookingTypeName;
private String serviceType;
private String serviceTypeName;
private String pickUpDate;
private String pickUpTime;
@JsonAlias({ "pickupDatetime" })
private String pickUpDatetime;
private String carTypeCode;
private String carType;
private Long carTypeId;
private Integer noOfPax;
@JsonAlias({ "pickupPointCode" })
private String pickUpPointCode;
private String pickUpPoint;
private String pickupPointId;
private String otherPickUpPoint;
@JsonAlias({ "dropoffPointCode" })
private String dropOffPointCode;
private String dropOffPoint;
@JsonAlias({ "dropOffPointId" })
private String dropOffPointIds;
private String otherDropOffPoint;
@JsonAlias({ "extraOffPoint" })
private String extraDropOffPoint;
@JsonAlias({ "extraOffPointId" })
private String extraDropOffPointId;
private List<DropOffPoint> dropOffPoints;
private String flightDetail;
private String flightEta;
private String flightStatus;
private String greetType;
private String greetTypeId;
private String signage;
private String approverId;
private String approver;
private String paymentMethodCode;
private String paymentMethod;
private Integer isHourlyRate;
private String hourlyRate;
private String tripPrice;
private String totalAmount;
private String tripContact;
private String remarks;
private String createdAt;
private String createdBy;
private String bookerId;
private String tripType;
private String guestType;
private String pickupRegion;
private String dropoffRegion;
private String ranking;
private String salution;
private String lastName;
private String firstName;
private String chineseLastName;
private String chinestFirstName;
private String bookerContact;
private String employeeId;
private Integer hour;
private String overriderName;
private String overrideBy;
private String updatedBy;
private String updatedByName;
private Integer tripPriceId;
@Data
public static class DropOffPoint {
private Integer sequence;
private String pointCode;
private String pointName;
}
}
@@ -0,0 +1,29 @@
package com.mgm.mcrm.limo.dtos.response;
import com.mgm.mcrm.common.dtos.BaseApiResponse;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class CancelLimoBookingResponse extends BaseApiResponse<Void> {
/** 新建记录在 limo_bookings 表中的主键 */
private Long id;
public static CancelLimoBookingResponse success(Long id) {
CancelLimoBookingResponse cancelLimoBookingResponse = new CancelLimoBookingResponse();
cancelLimoBookingResponse.setSuccess(true);
cancelLimoBookingResponse.setCode("200");
cancelLimoBookingResponse.setId(id);
return cancelLimoBookingResponse;
}
public static CancelLimoBookingResponse failure(String code, String message) {
CancelLimoBookingResponse cancelLimoBookingResponse = new CancelLimoBookingResponse();
cancelLimoBookingResponse.setSuccess(false);
cancelLimoBookingResponse.setCode(code);
cancelLimoBookingResponse.setMessage(message);
return cancelLimoBookingResponse;
}
}
@@ -0,0 +1,32 @@
package com.mgm.mcrm.limo.dtos.response;
import com.mgm.mcrm.common.dtos.BaseApiResponse;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class CreateLimoBookingResponse extends BaseApiResponse<Void> {
/** 新建记录在 limo_bookings 表中的主键 */
private Long id;
private Integer autoConfirm;
public static CreateLimoBookingResponse success(Long id, Integer autoConfirm) {
CreateLimoBookingResponse createLimoBookingResponse = new CreateLimoBookingResponse();
createLimoBookingResponse.setSuccess(true);
createLimoBookingResponse.setCode("200");
createLimoBookingResponse.setId(id);
createLimoBookingResponse.setAutoConfirm(autoConfirm);
return createLimoBookingResponse;
}
public static CreateLimoBookingResponse failure(String code, String message) {
CreateLimoBookingResponse createLimoBookingResponse = new CreateLimoBookingResponse();
createLimoBookingResponse.setSuccess(false);
createLimoBookingResponse.setCode(code);
createLimoBookingResponse.setMessage(message);
return createLimoBookingResponse;
}
}
@@ -0,0 +1,14 @@
package com.mgm.mcrm.limo.dtos.response;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class GetLimoBookingFromLegacyResult {
private String StatusCode = null;
private String statusDescription=null;
private List<LimoBookingFromLegacyItem> Records = new ArrayList<>();
}
@@ -0,0 +1,38 @@
package com.mgm.mcrm.limo.dtos.response;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* Limo 预约资格校验接口返回体(与 ESB 字段名一致,PascalCase)。
*/
@Data
@Schema(description = "Limo booking qualification check result")
public class GetLimoBookingQualificationResponse {
@JSONField(name = "StatusCode")
@Schema(description = "状态码,如 OK")
private String statusCode;
@JSONField(name = "StatusDescription")
@Schema(description = "状态说明")
private String statusDescription;
@JSONField(name = "PlayerId")
@Schema(description = "玩家编号")
private Long playerId;
@JSONField(name = "BookingType")
@Schema(description = "预约类型")
private String bookingType;
@JSONField(name = "BookingDate")
@Schema(description = "预约日期时间")
private String bookingDate;
@JSONField(name = "QualificationFlag")
@Schema(description = "资格标记,数值含义以业务文档为准")
private Integer qualificationFlag;
}
@@ -0,0 +1,46 @@
package com.mgm.mcrm.limo.dtos.response;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* ESB 员工信息接口返回体(RequestEmployeeInfo)。
*/
@Data
@Schema(description = "Limo employee info response from ESB")
public class GetLimoEmployeeInfoResponse {
@JSONField(name = "StatusCode")
@Schema(description = "状态码,如 OK")
private String statusCode;
@JSONField(name = "StatusDescription")
@Schema(description = "状态说明")
private String statusDescription;
@JSONField(name = "EmployeeId")
@Schema(description = "员工编号")
private Integer employeeId;
@JSONField(name = "LastName")
@Schema(description = "英文姓氏")
private String lastName;
@JSONField(name = "ChineseLastName")
@Schema(description = "中文姓氏")
private String chineseLastName;
@JSONField(name = "Salutation")
@Schema(description = "称谓")
private String salutation;
@JSONField(name = "Phone")
@Schema(description = "电话")
private String phone;
@JSONField(name = "PaymentMethod")
@Schema(description = "支付方式")
private String paymentMethod;
}
@@ -0,0 +1,42 @@
package com.mgm.mcrm.limo.dtos.response;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* ESB RequestLimoOverrider(查询 overrider)返回体。
*/
@Data
@Schema(description = "Limo overrider search response from ESB")
public class GetOverriderInfoResponse {
@JSONField(name = "StatusCode")
@Schema(description = "状态码,如 OK")
private String statusCode;
@JSONField(name = "StatusDescription")
@Schema(description = "状态说明")
private String statusDescription;
@JSONField(name = "Records")
@Schema(description = "匹配的审批人列表")
private List<OverriderEmployeeRecord> records;
@Data
@Schema(description = "Overrider 员工一条记录")
public static class OverriderEmployeeRecord {
@JSONField(name = "EmployeeId")
private Integer employeeId;
@JSONField(name = "EmployeeName")
private String employeeName;
@JSONField(name = "EmployeeIdAndName")
private String employeeIdAndName;
}
}
@@ -0,0 +1,86 @@
package com.mgm.mcrm.limo.dtos.response;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* ESB RequestLimoOverrider(查询 overrider)返回体。
*/
@Data
@Schema(description = "Limo overrider search response from ESB")
public class GetPlayerInfoResponse {
@JSONField(name = "StatusCode")
@Schema(description = "状态码,如 OK")
private String statusCode;
@JSONField(name = "StatusDescription")
@Schema(description = "状态说明")
private String statusDescription;
@JSONField(name = "PlayerId")
@Schema(description = "玩家 ID")
private Long playerId;
@JSONField(name = "Tier")
@Schema(description = "真实玩家等级")
private String tier;
@JSONField(name = "MaskedTier")
@Schema(description = "脱敏玩家等级")
private String maskedTier;
@JSONField(name = "FirstName")
@Schema(description = "玩家名字")
private String firstName;
@JSONField(name = "LastName")
@Schema(description = "玩家姓氏")
private String lastName;
@JSONField(name = "ChineseFirstName")
@Schema(description = "玩家中文名字")
private String chineseFirstName;
@JSONField(name = "ChineseLastName")
@Schema(description = "玩家中文姓氏")
private String chineseLastName;
@JSONField(name = "Salutation")
@Schema(description = "玩家称谓")
private String salutation;
@JSONField(name = "PrimaryMAID")
@Schema(description = "一级 MA ID")
private String primaryMAID;
@JSONField(name = "PrimaryMAName")
@Schema(description = "一级 MA 名称")
private String primaryMAName;
@JSONField(name = "PrimaryMAPhone")
@Schema(description = "一级 MA 电话")
private String primaryMAPhone;
@JSONField(name = "PrimaryMAPaymentMethod")
@Schema(description = "一级 MA 支付方式")
private String primaryMAPaymentMethod;
@JSONField(name = "SecondaryMAID")
@Schema(description = "二级 MA ID")
private String secondaryMAID;
@JSONField(name = "SecondaryMAName")
@Schema(description = "二级 MA 名称")
private String secondaryMAName;
@JSONField(name = "SecondaryMAPhone")
@Schema(description = "二级 MA 电话")
private String secondaryMAPhone;
@JSONField(name = "SecondaryMAPaymentMethod")
@Schema(description = "二级 MA 支付方式")
private String secondaryMAPaymentMethod;
}
@@ -0,0 +1,137 @@
package com.mgm.mcrm.limo.dtos.response;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "Limo booking row")
public class LimoBookingFromLegacyItem {
@JSONField(name = "BookingId")
private String bookingId;
@JSONField(name = "BookingNo")
private String bookingNo;
@JSONField(name = "OverrideBy")
private String overrideBy;
@JSONField(name = "PickupDatetime")
private String pickupDatetime;
@JSONField(name = "PassengerNo")
private Integer passengerNo;
@JSONField(name = "PickupPOIID")
private Long pickupPoiid;
@JSONField(name = "Pickup")
private String pickup;
@JSONField(name = "PickupRegion")
private String pickupRegion;
@JSONField(name = "DropoffPOIID")
private Long dropoffPoiid;
@JSONField(name = "Dropoff")
private String dropoff;
@JSONField(name = "ExtraDropoffPOIID1")
private Long extraDropoffPoiid1;
@JSONField(name = "ExtraDropoff1")
private String extraDropoff1;
@JSONField(name = "ExtraDropoffPOIID2")
private Long extraDropoffPoiid2;
@JSONField(name = "ExtraDropoff2")
private String extraDropoff2;
@JSONField(name = "ExtraDropoffPOIID3")
private Long extraDropoffPoiid3;
@JSONField(name = "ExtraDropoff3")
private String extraDropoff3;
@JSONField(name = "ExtraDropoffPOIID4")
private Long extraDropoffPoiid4;
@JSONField(name = "ExtraDropoff4")
private String extraDropoff4;
@JSONField(name = "ExtraDropoffPOIID5")
private Long extraDropoffPoiid5;
@JSONField(name = "ExtraDropoff5")
private String extraDropoff5;
@JSONField(name = "ExtraDropoffPOIID6")
private Long extraDropoffPoiid6;
@JSONField(name = "ExtraDropoff6")
private String extraDropoff6;
@JSONField(name = "ExtraDropoffPOIID7")
private Long extraDropoffPoiid7;
@JSONField(name = "ExtraDropoff7")
private String extraDropoff7;
@JSONField(name = "ExtraDropoffPOIID8")
private Long extraDropoffPoiid8;
@JSONField(name = "ExtraDropoff8")
private String extraDropoff8;
@JSONField(name = "ExtraDropoffPOIID9")
private Long extraDropoffPoiid9;
@JSONField(name = "ExtraDropoff9")
private String extraDropoff9;
@JSONField(name = "ExtraDropoffPOIID10")
private Long extraDropoffPoiid10;
@JSONField(name = "ExtraDropoff10")
private String extraDropoff10;
@JSONField(name = "SingleTripPrice")
private String singleTripPrice;
@JSONField(name = "BookedBy")
private String bookedBy;
@JSONField(name = "ApprovedBy")
private String approvedBy;
@JSONField(name = "BookingRemark")
private String bookingRemark;
@JSONField(name = "BookingStatus")
private String bookingStatus;
@JSONField(name = "DriverEmployeeID")
private String driverEmployeeId;
@JSONField(name = "Driver")
private String driver;
@JSONField(name = "CarPlate")
private String carPlate;
@JSONField(name = "CarType")
private String carType;
@JSONField(name = "DriverContact")
private String driverContact;
@JSONField(name = "TotalAmount")
private String totalAmount;
@JSONField(name = "DriverSource")
private String driverSource;
}
@@ -0,0 +1,261 @@
package com.mgm.mcrm.limo.dtos.response;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* Limo GetBooking 返回的 itemObject 数组元素。
*/
@Data
@Schema(description = "Limo booking row")
public class LimoBookingItem {
@JSONField(name = "ID")
private Long id;
@JSONField(name = "BookingNo")
private String bookingNo;
@JSONField(name = "SubBookingID")
private Long subBookingId;
@JSONField(name = "SubBookingNo")
private String subBookingNo;
@JSONField(name = "BookingType")
private String bookingType;
@JSONField(name = "GreetType")
private String greetType;
@JSONField(name = "OtherGreetType")
private String otherGreetType;
@JSONField(name = "GuestType")
private String guestType;
@JSONField(name = "TripType")
private String tripType;
@JSONField(name = "PlayerID")
private String playerId;
@JSONField(name = "Ranking")
private String ranking;
@JSONField(name = "OverrideBy")
private String overrideBy;
@JSONField(name = "ComplexOverrider")
private String complexOverrider;
@JSONField(name = "RoomNo")
private String roomNo;
@JSONField(name = "EmployeeID")
private String employeeId;
@JSONField(name = "LastName")
private String lastName;
@JSONField(name = "Salution")
private String salution;
@JSONField(name = "ChineseLastName")
private String chineseLastName;
@JSONField(name = "BookerContact")
private String bookerContact;
@JSONField(name = "TripContact")
private String tripContact;
@JSONField(name = "AdHoc")
private String adHoc;
@JSONField(name = "PickupDatetime")
private String pickupDatetime;
@JSONField(name = "CarTypeID")
private Integer carTypeId;
@JSONField(name = "PassengerNo")
private Integer passengerNo;
@JSONField(name = "PickupPOIID")
private Long pickupPoiid;
@JSONField(name = "Pickup")
private String pickup;
@JSONField(name = "PickupTripPriceID")
private Long pickupTripPriceId;
@JSONField(name = "PickupRegion")
private String pickupRegion;
@JSONField(name = "DropoffPOIID")
private Long dropoffPoiid;
@JSONField(name = "Dropoff")
private String dropoff;
@JSONField(name = "DropoffTripPriceID")
private Long dropoffTripPriceId;
@JSONField(name = "DropoffRegion")
private String dropoffRegion;
@JSONField(name = "ExtraDropoffPOIID1")
private Long extraDropoffPoiid1;
@JSONField(name = "ExtraDropoff1")
private String extraDropoff1;
@JSONField(name = "ExtraDropoffTripPriceID1")
private Long extraDropoffTripPriceId1;
@JSONField(name = "ExtraDropoffRegion1")
private String extraDropoffRegion1;
@JSONField(name = "ExtraDropoffPOIID2")
private Long extraDropoffPoiid2;
@JSONField(name = "ExtraDropoff2")
private String extraDropoff2;
@JSONField(name = "ExtraDropoffTripPriceID2")
private Long extraDropoffTripPriceId2;
@JSONField(name = "ExtraDropoffRegion2")
private String extraDropoffRegion2;
@JSONField(name = "ExtraDropoffPOIID3")
private Long extraDropoffPoiid3;
@JSONField(name = "ExtraDropoff3")
private String extraDropoff3;
@JSONField(name = "ExtraDropoffTripPriceID3")
private Long extraDropoffTripPriceId3;
@JSONField(name = "ExtraDropoffRegion3")
private String extraDropoffRegion3;
@JSONField(name = "ExtraDropoffPOIID4")
private Long extraDropoffPoiid4;
@JSONField(name = "ExtraDropoff4")
private String extraDropoff4;
@JSONField(name = "ExtraDropoffTripPriceID4")
private Long extraDropoffTripPriceId4;
@JSONField(name = "ExtraDropoffRegion4")
private String extraDropoffRegion4;
@JSONField(name = "ExtraDropoffPOIID5")
private Long extraDropoffPoiid5;
@JSONField(name = "ExtraDropoff5")
private String extraDropoff5;
@JSONField(name = "ExtraDropoffTripPriceID5")
private Long extraDropoffTripPriceId5;
@JSONField(name = "ExtraDropoffRegion5")
private String extraDropoffRegion5;
@JSONField(name = "ExtraDropoffPOIID6")
private Long extraDropoffPoiid6;
@JSONField(name = "ExtraDropoff6")
private String extraDropoff6;
@JSONField(name = "ExtraDropoffTripPriceID6")
private Long extraDropoffTripPriceId6;
@JSONField(name = "ExtraDropoffRegion6")
private String extraDropoffRegion6;
@JSONField(name = "ExtraDropoffPOIID7")
private Long extraDropoffPoiid7;
@JSONField(name = "ExtraDropoff7")
private String extraDropoff7;
@JSONField(name = "ExtraDropoffTripPriceID7")
private Long extraDropoffTripPriceId7;
@JSONField(name = "ExtraDropoffRegion7")
private String extraDropoffRegion7;
@JSONField(name = "ExtraDropoffPOIID8")
private Long extraDropoffPoiid8;
@JSONField(name = "ExtraDropoff8")
private String extraDropoff8;
@JSONField(name = "ExtraDropoffTripPriceID8")
private Long extraDropoffTripPriceId8;
@JSONField(name = "ExtraDropoffRegion8")
private String extraDropoffRegion8;
@JSONField(name = "ExtraDropoffPOIID9")
private Long extraDropoffPoiid9;
@JSONField(name = "ExtraDropoff9")
private String extraDropoff9;
@JSONField(name = "ExtraDropoffTripPriceID9")
private Long extraDropoffTripPriceId9;
@JSONField(name = "ExtraDropoffRegion9")
private String extraDropoffRegion9;
@JSONField(name = "ExtraDropoffPOIID10")
private Long extraDropoffPoiid10;
@JSONField(name = "ExtraDropoff10")
private String extraDropoff10;
@JSONField(name = "ExtraDropoffTripPriceID10")
private Long extraDropoffTripPriceId10;
@JSONField(name = "ExtraDropoffRegion10")
private String extraDropoffRegion10;
@JSONField(name = "SingleTripPrice")
private String singleTripPrice;
@JSONField(name = "DefaultTripPrice")
private String defaultTripPrice;
@JSONField(name = "DefaultPublishTripPrice")
private String defaultPublishTripPrice;
@JSONField(name = "HourlyRate")
private String hourlyRate;
@JSONField(name = "HourlyWaitingFee")
private String hourlyWaitingFee;
@JSONField(name = "Hour")
private Integer hour;
@JSONField(name = "HourlyWaiting")
private Integer hourlyWaiting;
@JSONField(name = "ExtraDropoffPrice1")
private String extraDropoffPrice1;
@JSONField(name = "ExtraDropoffPrice2")
private String extraDropoffPrice2;
@JSONField(name = "ExtraDropoffPrice3")
private String extraDropoffPrice3;
@JSONField(name = "ExtraDropoffPrice4")
private String extraDropoffPrice4;
@JSONField(name = "ExtraDropoffPrice5")
private String extraDropoffPrice5;
@JSONField(name = "ExtraDropoffPrice6")
private String extraDropoffPrice6;
@JSONField(name = "ExtraDropoffPrice7")
private String extraDropoffPrice7;
@JSONField(name = "ExtraDropoffPrice8")
private String extraDropoffPrice8;
@JSONField(name = "ExtraDropoffPrice9")
private String extraDropoffPrice9;
@JSONField(name = "ExtraDropoffPrice10")
private String extraDropoffPrice10;
@JSONField(name = "OtherPriceRemark")
private String otherPriceRemark;
@JSONField(name = "OtherPrice")
private String otherPrice;
@JSONField(name = "PaymentMethod")
private String paymentMethod;
@JSONField(name = "TotalAmount")
private String totalAmount;
@JSONField(name = "BookingContact")
private String bookingContact;
@JSONField(name = "HighImportance")
private Integer highImportance;
@JSONField(name = "TenOut")
private Integer tenOut;
@JSONField(name = "TenOutContact")
private String tenOutContact;
@JSONField(name = "GuestContact")
private String guestContact;
@JSONField(name = "ButlerGreet")
private Integer butlerGreet;
@JSONField(name = "BookedBy")
private String bookedBy;
@JSONField(name = "ApprovedBy")
private String approvedBy;
@JSONField(name = "BookingRemark")
private String bookingRemark;
@JSONField(name = "DriverRemark")
private String driverRemark;
@JSONField(name = "LimoInternalRemark")
private String limoInternalRemark;
@JSONField(name = "SystemRemark")
private String systemRemark;
@JSONField(name = "LimoGreet")
private Integer limoGreet;
@JSONField(name = "HostGreet")
private Integer hostGreet;
@JSONField(name = "VIPMeetNGreet")
private Integer vipMeetNGreet;
@JSONField(name = "FlightDetails")
private String flightDetails;
@JSONField(name = "ETA")
private String eta;
@JSONField(name = "Signage")
private String signage;
@JSONField(name = "FlightStatus")
private String flightStatus;
@JSONField(name = "BookingStatus")
private String bookingStatus;
@JSONField(name = "ConfirmStatus")
private String confirmStatus;
@JSONField(name = "CrossBorderEditAlert")
private Integer crossBorderEditAlert;
@JSONField(name = "FlightEditAlert")
private Integer flightEditAlert;
@JSONField(name = "DriverEmployeeID")
private String driverEmployeeId;
@JSONField(name = "Driver")
private String driver;
@JSONField(name = "DriverContact")
private String driverContact;
@JSONField(name = "CarPlate")
private String carPlate;
@JSONField(name = "CarType")
private String carType;
@JSONField(name = "DriverSource")
private String driverSource;
}
@@ -0,0 +1,32 @@
package com.mgm.mcrm.limo.dtos.response;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* Limo GetCarType 返回的 itemObject 数组元素(字段名按 ESB 约定,若对接实网有出入可再对齐)。
*/
@Data
@Schema(description = "Limo car type option")
public class LimoCarTypeItem {
@JSONField(name = "ID")
@Schema(description = "Car type id")
private Long id;
@JSONField(name = "CarType")
private String carType;
@JSONField(name = "EnglishName")
private String englishName;
@JSONField(name = "ChineseTradName")
private String chineseTradName;
@JSONField(name = "ChineseSimpName")
private String chineseSimpName;
@JSONField(name = "BookingType")
private String bookingType;
}
@@ -0,0 +1,37 @@
package com.mgm.mcrm.limo.dtos.response;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* Limo GetFlightDetails 返回的 itemObject 数组元素。
*/
@Data
@Schema(description = "Limo flight details")
public class LimoFlightDetailsItem {
@JSONField(name = "FlightNo")
@Schema(description = "Flight number")
private String flightNo;
@JSONField(name = "PickUpAirportCode")
@Schema(description = "Pickup airport code")
private String pickUpAirportCode;
@JSONField(name = "DropOffAirportCode")
@Schema(description = "Drop-off airport code")
private String dropOffAirportCode;
@JSONField(name = "PickupDatetime")
@Schema(description = "Pickup datetime, e.g. 2026-04-23 16:00:00")
private String pickupDatetime;
@JSONField(name = "ETA")
@Schema(description = "Estimated time of arrival")
private String eta;
@JSONField(name = "FlightStatus")
@Schema(description = "Flight status, e.g. departure")
private String flightStatus;
}
@@ -0,0 +1,32 @@
package com.mgm.mcrm.limo.dtos.response;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* Limo GetGreetType 返回的 itemObject 数组元素。
*/
@Data
@Schema(description = "Limo greet type option")
public class LimoGreetTypeItem {
@JSONField(name = "ID")
@Schema(description = "Greet type id")
private Long id;
@JSONField(name = "BookingType")
private String bookingType;
@JSONField(name = "GreetType")
private String greetType;
@JSONField(name = "LimoGreet")
private Integer limoGreet;
@JSONField(name = "HostGreet")
private Integer hostGreet;
@JSONField(name = "VIPMeetNGreet")
private Integer vipMeetNGreet;
}
@@ -0,0 +1,44 @@
package com.mgm.mcrm.limo.dtos.response;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* Limo GetPointOfInterest 返回的 itemObject 数组元素。
*/
@Data
@Schema(description = "Limo point of interest / location")
public class LimoPointOfInterestItem {
@JSONField(name = "ID")
@Schema(description = "POI id")
private Long id;
@JSONField(name = "EnglishName")
private String englishName;
@JSONField(name = "ChineseTradName")
private String chineseTradName;
@JSONField(name = "ChineseSimpName")
private String chineseSimpName;
@JSONField(name = "AirportCode")
private String airportCode;
@JSONField(name = "Region")
private String region;
@JSONField(name = "Area")
private String area;
@JSONField(name = "TripPriceID")
private Long tripPriceId;
@JSONField(name = "FreeOfCharge")
private Integer freeOfCharge;
@JSONField(name = "GreetLocation")
private String greetLocation;
}
@@ -0,0 +1,51 @@
package com.mgm.mcrm.limo.dtos.response;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* Limo GetTotalAmount 返回的 itemObject 数组元素。
*/
@Data
@Schema(description = "Limo trip total amount breakdown")
public class LimoTotalAmountItem {
@JSONField(name = "SingleTripPrice")
@Schema(description = "Single trip price")
private String singleTripPrice;
@JSONField(name = "ExtraDropoffPrice1")
private String extraDropoffPrice1;
@JSONField(name = "ExtraDropoffPrice2")
private String extraDropoffPrice2;
@JSONField(name = "ExtraDropoffPrice3")
private String extraDropoffPrice3;
@JSONField(name = "ExtraDropoffPrice4")
private String extraDropoffPrice4;
@JSONField(name = "ExtraDropoffPrice5")
private String extraDropoffPrice5;
@JSONField(name = "ExtraDropoffPrice6")
private String extraDropoffPrice6;
@JSONField(name = "ExtraDropoffPrice7")
private String extraDropoffPrice7;
@JSONField(name = "ExtraDropoffPrice8")
private String extraDropoffPrice8;
@JSONField(name = "ExtraDropoffPrice9")
private String extraDropoffPrice9;
@JSONField(name = "ExtraDropoffPrice10")
private String extraDropoffPrice10;
@JSONField(name = "TotalAmount")
@Schema(description = "Total amount")
private String totalAmount;
}
@@ -0,0 +1,49 @@
package com.mgm.mcrm.limo.dtos.response;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
/**
* Limo GetTripPrice 返回的 itemObject 数组元素。
*/
@Data
@Schema(description = "Limo trip price category")
public class LimoTripPriceItem {
@JSONField(name = "ID")
@Schema(description = "Trip price row id")
private Long id;
@JSONField(name = "TripPrice")
private String tripPrice;
@JSONField(name = "Region")
private String region;
@JSONField(name = "DefaultTripPrice")
private BigDecimal defaultTripPrice;
@JSONField(name = "DefaultPHTripPrice")
private BigDecimal defaultPHTripPrice;
@JSONField(name = "HourlyRate")
private BigDecimal hourlyRate;
@JSONField(name = "HourlyWaitingFee")
private BigDecimal hourlyWaitingFee;
@JSONField(name = "ExtraDropoff")
private BigDecimal extraDropoff;
@JSONField(name = "HourlyPHRate")
private BigDecimal hourlyPHRate;
@JSONField(name = "HourlyPHWaitingFee")
private BigDecimal hourlyPHWaitingFee;
@JSONField(name = "ExtraPHDropoff")
private BigDecimal extraPHDropoff;
}
@@ -0,0 +1,29 @@
package com.mgm.mcrm.limo.dtos.response;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* RequestPlayerEsbBooker 返回的 Records 数组元素。
*/
@Data
@Schema(description = "Player limo booker employee record")
public class PlayerEsbBookerItem {
@JSONField(name = "EmployeeId")
@Schema(description = "Employee id")
private Long employeeId;
@JSONField(name = "EmployeeName")
@Schema(description = "Employee display name")
private String employeeName;
@JSONField(name = "Phone")
@Schema(description = "Contact phone; may be null")
private String phone;
@JSONField(name = "EmployeeIdAndName")
@Schema(description = "Combined id and name for display, e.g. Leng Chan(132727)")
private String employeeIdAndName;
}
@@ -0,0 +1,27 @@
package com.mgm.mcrm.limo.dtos.response;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* ESB RequestPlayerLimoBooker 接口原始返回体。
*/
@Data
@Schema(description = "Player limo booker ESB response")
public class PlayerEsbBookerResponse {
@JSONField(name = "StatusCode")
@Schema(description = "Status code, e.g. OK")
private String statusCode;
@JSONField(name = "StatusDescription")
@Schema(description = "Status description, e.g. Success")
private String statusDescription;
@JSONField(name = "Records")
@Schema(description = "Booker employee list")
private List<PlayerEsbBookerItem> records;
}
@@ -0,0 +1,14 @@
package com.mgm.mcrm.limo.dtos.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.UUID;
@Data
@AllArgsConstructor
public class PrepareLimoBookingData {
private UUID draftId;
private LocalDateTime expiresAt;
}
@@ -0,0 +1,25 @@
package com.mgm.mcrm.limo.dtos.response;
import com.mgm.mcrm.common.dtos.BaseApiResponse;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class UpdateLimoBookingResponse extends BaseApiResponse<Void> {
public static UpdateLimoBookingResponse success() {
UpdateLimoBookingResponse response = new UpdateLimoBookingResponse();
response.setSuccess(true);
response.setCode("200");
return response;
}
public static UpdateLimoBookingResponse failure(String code, String message) {
UpdateLimoBookingResponse response = new UpdateLimoBookingResponse();
response.setSuccess(false);
response.setCode(code);
response.setMessage(message);
return response;
}
}
@@ -0,0 +1,61 @@
package com.mgm.mcrm.limo.models;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Version;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.UUID;
@Data
@Entity
@Table(name = "limo_booking_draft")
public class LimoBookingDraft {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@Column(name = "draft_id", nullable = false, unique = true)
private UUID draftId;
@Column(name = "user_id", length = 64, nullable = false)
private String userId;
@Column(name = "player_id", nullable = false)
private Long playerId;
@Column(name = "approver_id", length = 64, nullable = false)
private String approverId;
@Column(name = "approver_name", length = 255, nullable = false)
private String approverName;
@Column(name = "status", length = 20, nullable = false)
private String status;
@Column(name = "expires_at", nullable = false)
private LocalDateTime expiresAt;
@Column(name = "used_at")
private LocalDateTime usedAt;
@Column(name = "created_at", nullable = false)
private LocalDateTime createdAt;
@Column(name = "updated_at")
private LocalDateTime updatedAt;
@Column(name = "limo_booking_id", length = 128)
private String limoBookingId;
@Version
@Column(name = "version", nullable = false)
private Long version = 0L;
}
@@ -0,0 +1,149 @@
package com.mgm.mcrm.limo.models;
import java.util.Date;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Version;
import lombok.Data;
@Data
@Entity
@Table(name = "limo_bookings")
public class LimoBookings {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@Column(name = "player_id", length = 128, nullable = false)
private String playerId;
@Column(name = "player", length = 512)
private String player;
@Column(name = "confirmation_no", length = 256)
private String confirmationNo;
@Column(name = "booking_type", length = 255)
private String bookingType;
@Column(name = "trip_type", length = 32)
private String tripType;
@Column(name = "pick_up_point", length = 255, nullable = false)
private String pickUpPoint;
@Column(name = "pick_up_point_id", length = 32)
private String pickUpPointId;
@Column(name = "pick_up_datetime", nullable = false)
private Date pickUpDatetime;
@Column(name = "drop_off_point", length = 255, nullable = false)
private String dropOffPoint;
@Column(name = "drop_off_point_ids", length = 255)
private String dropOffPointIds;
@Column(name = "booking_status", length = 255, nullable = false)
private String bookingStatus;
@Column(name = "service_type", length = 255)
private String serviceType;
@Column(name = "car_type", length = 255)
private String carType;
@Column(name = "car_type_id")
private Long carTypeId;
@Column(name = "no_of_pax")
private Integer noOfPax;
@Column(name = "greet_type", length = 255)
private String greetType;
@Column(name = "greet_type_id", length = 64)
private String greetTypeId;
@Column(name = "signage", length = 255)
private String signage;
@Column(name = "approver", length = 255)
private String approver;
@Column(name = "approver_id", length = 255)
private String approverId;
@Column(name = "payment_method", length = 255)
private String paymentMethod;
@Column(name = "trip_price", length = 255)
private String tripPrice;
@Column(name = "total_amount", length = 255)
private String totalAmount;
@Column(name = "trip_contact", length = 255)
private String tripContact;
@Column(name = "is_hourly_rate")
private Integer isHourlyRate;
@Column(name = "hourly_rate", length = 255)
private String hourlyRate;
@Column(name = "remarks", columnDefinition = "NVARCHAR(MAX)")
private String remarks;
@Column(name = "flight_detail", length = 255)
private String flightDetail;
@Column(name = "flight_eta", length = 255)
private String flightEta;
@Column(name = "flight_status", length = 255)
private String flightStatus;
@Version
@Column(name = "version", nullable = false)
private Long version = 0L;
@Column(name = "created_at")
private Date createdAt;
@Column(name = "created_by")
private String createdBy;
@Column(name = "updated_at")
private Date updatedAt;
@Column(name = "updated_by")
private String updatedBy;
@Column(name = "override_by")
private String overrideBy;
@Column(name = "booker_id")
private String bookerId;
@Column(name = "limo_booking_id")
private String limoBookingId;
@Column(name = "other_pick_up_point")
private String otherPickUpPoint;
@Column(name = "other_drop_off_point")
private String otherDropOffPoint;
@Column(name = "car_no")
private String carNo;
@Column(name = "extra_drop_off_id")
private String extraDropOffId;
@Column(name = "extra_drop_off_point")
private String extraDropOffPoint;
@Column(name = "driver_contact")
private String driverContact;
@Column(name = "booking_contact")
private String bookingContact;
@Column(name = "is_high_importance", nullable = false)
private Integer isHighImportance = 0;
@Column(name = "is_ten_out", nullable = false)
private Integer isTenOut = 0;
@Column(name = "ten_out_contact")
private String tenOutContact;
@Column(name = "is_connect_guest_directly", nullable = false)
private Integer isConnectGuestDirectly = 0;
@Column(name = "guest_contact")
private String guestContact;
@Column(name = "driver_source")
private String driverSource;
@Column(name = "limo_platform")
private Integer limoPlatform;
}
File diff suppressed because it is too large Load Diff
@@ -22,6 +22,7 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@@ -77,6 +78,14 @@ public class NotificationController {
return notificationService.changeStatus(id);
}
@RequestMapping(value = "/read_all", method = RequestMethod.POST, produces = "application/json;charset=UTF-8",consumes = MediaType.APPLICATION_JSON_VALUE)
public BaseApiResponse<Integer> readAll(HttpServletRequest request) {
String token = request.getHeader("Authorization");
String userId = JWT.decode(token).getClaim("login_id").asString();
return notificationService.readAllNotifications(userId);
}
@OperationLog(actionName = "Send Notification", eventCode = "send_notification")
@Operation(
summary = "Send Notification",
@@ -2,7 +2,12 @@ package com.mgm.mcrm.notification.repositories;
import com.mgm.mcrm.notification.models.SysLogNotification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
public interface SysLogNotificationRepository extends JpaRepository<SysLogNotification, Long> {
@@ -11,4 +16,9 @@ public interface SysLogNotificationRepository extends JpaRepository<SysLogNotifi
List<SysLogNotification> findAllByDeviceTokenAndTransactionId(String deviceToken, String transactionId);
long countByUserIdAndStatus(String userId, Integer status);
@Transactional
@Modifying
@Query("UPDATE SysLogNotification n SET n.status = 1, n.updatedAt = :now WHERE n.userId = :userId AND n.status = 0")
int markAllAsReadByUserId(@Param("userId") String userId, @Param("now") LocalDateTime now);
}
@@ -115,4 +115,13 @@ public class NotificationService {
return response;
}
public BaseApiResponse<Integer> readAllNotifications(String userId) {
BaseApiResponse<Integer> response = new BaseApiResponse<>();
int updated = sysLogNotificationRepository.markAllAsReadByUserId(userId, LocalDateTime.now());
response.setSuccess(true);
response.setCode("200");
response.setData(updated);
return response;
}
}
@@ -183,9 +183,11 @@ public class TodoService {
if (StringUtils.isNotBlank(confNum)) {
if ("Inhouse".equalsIgnoreCase(todoCategory) || "Arrival".equalsIgnoreCase(todoCategory)) {
List<CfgProperties> daylightProperties = propertyDao.findByCategory("DAYLIGHT");
if (CollectionUtils.isNotEmpty(daylightProperties)) {
CfgProperties property = daylightProperties.get(0);
Bookings bookings = bookingDao.findFirstByConfirmationNoAndPropertyIdIsNotNull(confNum);
CfgProperties property = propertyDao.findById(bookings.getPropertyId()).orElse(null);
if (Objects.nonNull(property)) {
if ("Inhouse".equalsIgnoreCase(todoCategory)) {
// Parse checkinDate from recordDesc (e.g., "Jun 25 – Jul 1 ...")
@@ -504,81 +506,81 @@ public class TodoService {
List<TodoDateListRecord> dateList = new ArrayList<>(dateMap.values());
// TODO daylight专用,后面要改 by Mauve
if (1 == 1) {
for (TodoDateListRecord todoDateListRecord : dateList) {
List<TodoListRecord> dateRecords = todoDateListRecord.getDateRecords();
for (TodoDateListRecord todoDateListRecord : dateList) {
for (TodoListRecord record : dateRecords) {
List<String> descriptions = record.getDescriptions();
if (CollectionUtils.isEmpty(descriptions)) {
continue;
}
List<TodoListRecord> dateRecords = todoDateListRecord.getDateRecords();
try {
for (String description : descriptions) {
if (StringUtils.isBlank(description)) {
continue;
}
for (TodoListRecord record : dateRecords) {
List<String> descriptions = record.getDescriptions();
if (CollectionUtils.isEmpty(descriptions)) {
continue;
}
int confIndex = description.indexOf("Conf#");
if (confIndex == -1) {
continue;
}
try {
for (String description : descriptions) {
if (StringUtils.isBlank(description)) {
continue;
}
String confPart = description.substring(confIndex + 5);
int pipeIndex = confPart.indexOf("|");
String confNum = (pipeIndex == -1 ? confPart : confPart.substring(0, pipeIndex)).trim();
int confIndex = description.indexOf("Conf#");
if (confIndex == -1) {
continue;
}
if (StringUtils.isNotBlank(confNum)) {
if ("Inhouse".equalsIgnoreCase(category) || "Arrival".equalsIgnoreCase(category)) {
List<CfgProperties> daylightProperties = propertyDao.findByCategory("DAYLIGHT");
if (CollectionUtils.isNotEmpty(daylightProperties)) {
CfgProperties property = daylightProperties.get(0);
if ("Inhouse".equalsIgnoreCase(category)) {
BaseApiResponse<ReservationDoorKeyResponse> doorKeyResult =
dlService.getReservationDoorKeyByConfirmationNumber(property.getDlPropertyId(), confNum);
ReservationDoorKeyResponse doorKeyData = doorKeyResult.getData();
boolean isRoomReady = doorKeyResult.isSuccess()
&& doorKeyData != null
&& StringUtils.isNotBlank(doorKeyData.getId())
&& !doorKeyData.isHasKey();
if (isRoomReady) {
record.setRoomReady(true);
updateTodoRecordDescription(record, confNum, "[Rm Ready]");
}
} else {
BaseApiResponse<ReservationQueueResponse> queueResult =
dlService.getReservationQueueByConfirmationNumber(property.getDlPropertyId(), confNum);
ReservationQueueResponse queueData = queueResult.getData();
boolean isQueue = queueResult.isSuccess()
&& queueData != null
&& queueData.isQueue();
if (isQueue) {
record.setIsQueue(true);
updateTodoRecordDescription(record, confNum, "[In Queue]");
}
String confPart = description.substring(confIndex + 5);
int pipeIndex = confPart.indexOf("|");
String confNum = (pipeIndex == -1 ? confPart : confPart.substring(0, pipeIndex)).trim();
if (StringUtils.isNotBlank(confNum)) {
if ("Inhouse".equalsIgnoreCase(category) || "Arrival".equalsIgnoreCase(category)) {
List<CfgProperties> daylightProperties = propertyDao.findByCategory("DAYLIGHT");
if (CollectionUtils.isNotEmpty(daylightProperties)) {
CfgProperties property = daylightProperties.get(0);
if ("Inhouse".equalsIgnoreCase(category)) {
BaseApiResponse<ReservationDoorKeyResponse> doorKeyResult =
dlService.getReservationDoorKeyByConfirmationNumber(property.getDlPropertyId(), confNum);
ReservationDoorKeyResponse doorKeyData = doorKeyResult.getData();
boolean isRoomReady = doorKeyResult.isSuccess()
&& doorKeyData != null
&& StringUtils.isNotBlank(doorKeyData.getId())
&& !doorKeyData.isHasKey();
if (isRoomReady) {
record.setRoomReady(true);
updateTodoRecordDescription(record, confNum, "[Rm Ready]");
}
} else {
BaseApiResponse<ReservationQueueResponse> queueResult =
dlService.getReservationQueueByConfirmationNumber(property.getDlPropertyId(), confNum);
ReservationQueueResponse queueData = queueResult.getData();
boolean isQueue = queueResult.isSuccess()
&& queueData != null
&& queueData.isQueue();
if (isQueue) {
record.setIsQueue(true);
updateTodoRecordDescription(record, confNum, "[In Queue]");
}
}
}
}
}
List<BookingsView> bookingByConfirmationNo = bookingService.getBookingByDaylightConf(confNum);
List<BookingsView> bookingByConfirmationNo = bookingService.getBookingByDaylightConf(confNum);
for (BookingsView bookingsView : bookingByConfirmationNo) {
if (StringUtils.isNotBlank(bookingsView.getEta())) {
String[] split2 = bookingsView.getEta().split(":");
record.setETA(split2[0] + ":" + split2[1]);
}
for (BookingsView bookingsView : bookingByConfirmationNo) {
if (StringUtils.isNotBlank(bookingsView.getEta())) {
String[] split2 = bookingsView.getEta().split(":");
record.setETA(split2[0] + ":" + split2[1]);
}
}
} catch (Exception e) {
log.warn("Failed to process todo descriptions={}", descriptions, e);
}
} catch (Exception e) {
log.warn("Failed to process todo descriptions={}", descriptions, e);
}
}
dateResult.setRecords(dateList);
}
dateResult.setRecords(dateList);
result.setSuccess(true);
result.setData(dateResult);