update
This commit is contained in:
@@ -123,7 +123,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springdoc</groupId>
|
<groupId>org.springdoc</groupId>
|
||||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
<version>2.8.17</version>
|
<version>3.1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.microsoft.sqlserver</groupId>
|
<groupId>com.microsoft.sqlserver</groupId>
|
||||||
|
|||||||
@@ -392,6 +392,7 @@ public class SSORestProcessController {
|
|||||||
form.add(new BasicNameValuePair("Kmsi", "True"));
|
form.add(new BasicNameValuePair("Kmsi", "True"));
|
||||||
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(form, StandardCharsets.UTF_8);
|
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(form, StandardCharsets.UTF_8);
|
||||||
StreamUtils.copy(entity.getContent(), request.getBody());
|
StreamUtils.copy(entity.getContent(), request.getBody());
|
||||||
|
request.getHeaders().add("Content-Length", String.valueOf(entity.getContentLength()));
|
||||||
clientResponse = request.execute();
|
clientResponse = request.execute();
|
||||||
}catch(Exception err) {
|
}catch(Exception err) {
|
||||||
errorCode="RequestFailed";
|
errorCode="RequestFailed";
|
||||||
@@ -423,6 +424,7 @@ public class SSORestProcessController {
|
|||||||
form.add(new BasicNameValuePair("AuthMethod", "AzureMfaAuthentication"));
|
form.add(new BasicNameValuePair("AuthMethod", "AzureMfaAuthentication"));
|
||||||
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(form, StandardCharsets.UTF_8);
|
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(form, StandardCharsets.UTF_8);
|
||||||
StreamUtils.copy(entity.getContent(), request.getBody());
|
StreamUtils.copy(entity.getContent(), request.getBody());
|
||||||
|
request.getHeaders().add("Content-Length", String.valueOf(entity.getContentLength()));
|
||||||
clientResponse = request.execute();
|
clientResponse = request.execute();
|
||||||
}catch(Exception err) {
|
}catch(Exception err) {
|
||||||
errorCode="RequestFailed";
|
errorCode="RequestFailed";
|
||||||
@@ -456,6 +458,7 @@ public class SSORestProcessController {
|
|||||||
form.add(new BasicNameValuePair("__EVENTTARGET", eventTarget));
|
form.add(new BasicNameValuePair("__EVENTTARGET", eventTarget));
|
||||||
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(form, StandardCharsets.UTF_8);
|
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(form, StandardCharsets.UTF_8);
|
||||||
StreamUtils.copy(entity.getContent(), request.getBody());
|
StreamUtils.copy(entity.getContent(), request.getBody());
|
||||||
|
request.getHeaders().add("Content-Length", String.valueOf(entity.getContentLength()));
|
||||||
clientResponse = request.execute();
|
clientResponse = request.execute();
|
||||||
}catch(Exception err) {
|
}catch(Exception err) {
|
||||||
errorCode="RequestFailed";
|
errorCode="RequestFailed";
|
||||||
|
|||||||
@@ -58,13 +58,12 @@ import com.mgm.mcrm.common.jms.BookingControlMsgSender;
|
|||||||
import com.mgm.mcrm.common.services.MGMEsbApiService;
|
import com.mgm.mcrm.common.services.MGMEsbApiService;
|
||||||
import com.mgm.mcrm.common.utils.DateTimeUtil;
|
import com.mgm.mcrm.common.utils.DateTimeUtil;
|
||||||
import com.mgm.mcrm.common.utils.LogUtil;
|
import com.mgm.mcrm.common.utils.LogUtil;
|
||||||
import com.mgm.mcrm.common.utils.SendEmail;
|
|
||||||
import com.mgm.mcrm.logging.models.SysLogBooking;
|
import com.mgm.mcrm.logging.models.SysLogBooking;
|
||||||
import com.mgm.mcrm.logging.repositories.SysLogBookingDao;
|
import com.mgm.mcrm.logging.repositories.SysLogBookingDao;
|
||||||
import com.mgm.mcrm.logging.services.SysLogBookingService;
|
import com.mgm.mcrm.logging.services.SysLogBookingService;
|
||||||
import com.mgm.mcrm.notification.models.Email;
|
import com.mgm.mcrm.notification.models.Email;
|
||||||
import com.mgm.mcrm.notification.repositories.EmailDao;
|
import com.mgm.mcrm.notification.repositories.EmailDao;
|
||||||
import com.mgm.mcrm.player.dtos.request.TodoChangeDateRequest;
|
import com.mgm.mcrm.notification.services.SendEmailService;
|
||||||
import com.mgm.mcrm.player.services.PlayerService;
|
import com.mgm.mcrm.player.services.PlayerService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
@@ -149,6 +148,8 @@ public class ApprovalService {
|
|||||||
private NonMGMBookingService nonMGMBookingService;
|
private NonMGMBookingService nonMGMBookingService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TeamStructureDao teamStructureDao;
|
private TeamStructureDao teamStructureDao;
|
||||||
|
@Resource
|
||||||
|
private SendEmailService sendEmailService;
|
||||||
|
|
||||||
public BaseApiResponse<List<CfgRequestReason>> getRequestReason() throws Exception {
|
public BaseApiResponse<List<CfgRequestReason>> getRequestReason() throws Exception {
|
||||||
// 新建對象
|
// 新建對象
|
||||||
@@ -930,7 +931,7 @@ public class ApprovalService {
|
|||||||
email.setCreatedAt(creatdDate);
|
email.setCreatedAt(creatdDate);
|
||||||
email.setCreatedBy(originBooking.getCreatedBy());
|
email.setCreatedBy(originBooking.getCreatedBy());
|
||||||
emailBook.setCategory("OTHER");
|
emailBook.setCategory("OTHER");
|
||||||
email = SendEmail.sendApprovalNewEmail(emailBook, originBookingView,email,userId,userName,true,false,emailAddress.getKeyValues());
|
email = sendEmailService.sendApprovalNewEmail(emailBook, originBookingView,email,userId,userName,true,false,emailAddress.getKeyValues());
|
||||||
if(email.getStatus()==1) {
|
if(email.getStatus()==1) {
|
||||||
originBooking.setApproveStatus("AA");
|
originBooking.setApproveStatus("AA");
|
||||||
bookingDao.save(originBooking);
|
bookingDao.save(originBooking);
|
||||||
@@ -968,7 +969,7 @@ public class ApprovalService {
|
|||||||
email.setCreatedAt(creatdDate);
|
email.setCreatedAt(creatdDate);
|
||||||
email.setCreatedBy(originBooking.getCreatedBy());
|
email.setCreatedBy(originBooking.getCreatedBy());
|
||||||
|
|
||||||
email = SendEmail.sendApprovalNewEmail(emailBook, originBookingView,email,userId,userName,false,true,emailAddress.getKeyValues());
|
email = sendEmailService.sendApprovalNewEmail(emailBook, originBookingView,email,userId,userName,false,true,emailAddress.getKeyValues());
|
||||||
emailDao.save(email);
|
emailDao.save(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -988,7 +989,7 @@ public class ApprovalService {
|
|||||||
email.setCreatedAt(creatdDate);
|
email.setCreatedAt(creatdDate);
|
||||||
email.setCreatedBy(originBooking.getCreatedBy());
|
email.setCreatedBy(originBooking.getCreatedBy());
|
||||||
|
|
||||||
email = SendEmail.sendApprovalExtendEmail(emailBook, originBookingView,email,userId,userName,originBookingView,false,emailAddress.getKeyValues());
|
email = sendEmailService.sendApprovalExtendEmail(emailBook, originBookingView,email,userId,userName,originBookingView,false,emailAddress.getKeyValues());
|
||||||
LogUtil.info(ApprovalService.class,"Send Email Approved Id = "+originBooking.getId());
|
LogUtil.info(ApprovalService.class,"Send Email Approved Id = "+originBooking.getId());
|
||||||
if(email.getStatus()==1) {
|
if(email.getStatus()==1) {
|
||||||
originBooking.setApproveStatus("AA");
|
originBooking.setApproveStatus("AA");
|
||||||
@@ -1003,33 +1004,24 @@ public class ApprovalService {
|
|||||||
response.setMessage("Send Email Failed");
|
response.setMessage("Send Email Failed");
|
||||||
}
|
}
|
||||||
}else if (Strings.CS.equals(properties.getCategory(),"DAYLIGHT")) {
|
}else if (Strings.CS.equals(properties.getCategory(),"DAYLIGHT")) {
|
||||||
//调用daylight接口去Extend Booking
|
BaseApiResponse<PlayerProfileEntry> findPlayerResult = playerService
|
||||||
BaseApiResponse<PlayerProfileEntry> findPlayerResult = playerService.findPlayerProfileByPlayerIdAndUserId(originBooking.getPlayerId(), userId);
|
.findPlayerProfileByPlayerIdAndUserId(originBooking.getPlayerId(), userId);
|
||||||
if(findPlayerResult.isSuccess()) {
|
if (!findPlayerResult.isSuccess() || findPlayerResult.getData() == null) {
|
||||||
originBooking.setApproveStatus("AA");
|
|
||||||
bookingDao.save(originBooking);
|
|
||||||
}else{
|
|
||||||
response.setSuccess(false);
|
response.setSuccess(false);
|
||||||
response.setCode("Player Profile Not Found");
|
response.setCode("Player Profile Not Found");
|
||||||
}
|
} else {
|
||||||
//Directly send email when submit Approval Routing for daylight
|
BaseApiResponse<List<Bookings>> extendResult = bookingService.extendDaylightApprovalBooking(
|
||||||
BookingsView originBookingView = bookingViewDao.findById(Long.parseLong(originBooking.getApprovalBookingId()));
|
originBooking, findPlayerResult.getData(), userId, userName);
|
||||||
originBookingView = this.getEmailInfo(originBookingView,originBookingView.getCreatedBy()).getData();
|
if (extendResult.isSuccess()) {
|
||||||
Email email = new Email();
|
originBooking.setApproveStatus("AA");
|
||||||
|
bookingDao.save(originBooking);
|
||||||
email.setBookId(originBooking.getId());
|
|
||||||
email.setCreatedAt(creatdDate);
|
|
||||||
email.setCreatedBy(originBooking.getCreatedBy());
|
|
||||||
|
|
||||||
email = SendEmail.sendApprovalExtendEmail(originBooking, originBookingView,email,userId,userName,bookingView,isOtherOverBook,emailAddress.getKeyValues());
|
|
||||||
if(email.getStatus()==1) {
|
|
||||||
emailDao.save(email);
|
|
||||||
response.setSuccess(true);
|
response.setSuccess(true);
|
||||||
response.setData(approvalMapper.toSubmitApprovalResponse(originBooking));
|
response.setData(approvalMapper.toSubmitApprovalResponse(originBooking));
|
||||||
}else{
|
} else {
|
||||||
response.setSuccess(false);
|
response.setSuccess(false);
|
||||||
response.setMessage("Send Email Failed");
|
response.setMessage(extendResult.getMessage());
|
||||||
response.setLogMessage("Send Email Failed");
|
response.setLogMessage(extendResult.getLogMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
//send email instead of sync other booking
|
//send email instead of sync other booking
|
||||||
@@ -1041,7 +1033,7 @@ public class ApprovalService {
|
|||||||
email.setCreatedAt(creatdDate);
|
email.setCreatedAt(creatdDate);
|
||||||
email.setCreatedBy(originBooking.getCreatedBy());
|
email.setCreatedBy(originBooking.getCreatedBy());
|
||||||
|
|
||||||
email = SendEmail.sendApprovalExtendEmail(originBooking, originBookingView,email,userId,userName,bookingView,isOtherOverBook,emailAddress.getKeyValues());
|
email = sendEmailService.sendApprovalExtendEmail(originBooking, originBookingView,email,userId,userName,bookingView,isOtherOverBook,emailAddress.getKeyValues());
|
||||||
if(email.getStatus()==1) {
|
if(email.getStatus()==1) {
|
||||||
originBooking.setApproveStatus("AA");
|
originBooking.setApproveStatus("AA");
|
||||||
bookingDao.save(originBooking);
|
bookingDao.save(originBooking);
|
||||||
@@ -1480,5 +1472,4 @@ public class ApprovalService {
|
|||||||
booking.setUpdatedAt(now);
|
booking.setUpdatedAt(now);
|
||||||
bookingDao.save(booking);
|
bookingDao.save(booking);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1554,13 +1554,13 @@ public class DaylightApiService {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
String approver = daylightViewRoomOnly.getApprover();
|
String approver = daylightViewRoomOnly.getApprover();
|
||||||
boolean isMansion = StringUtils.containsIgnoreCase(roomName, "mansion");
|
boolean isVillaOrMansion = isVillaOrMansionRoom(roomName);
|
||||||
String requestorUserId = StringUtils.isNotEmpty(approver) && isMansion ? userId
|
String requestorUserId = StringUtils.isNotEmpty(approver) && isVillaOrMansion ? userId
|
||||||
: StringUtils.isNotEmpty(approver) ? approver : userId;
|
: StringUtils.isNotEmpty(approver) ? approver : userId;
|
||||||
BaseApiResponse<RequestorApproverResponse> requestorResponse =
|
BaseApiResponse<RequestorApproverResponse> requestorResponse =
|
||||||
getDaylightRequestorApproverByUserId(dlPropertyId, requestorUserId);
|
getDaylightRequestorApproverByUserId(dlPropertyId, requestorUserId);
|
||||||
BaseApiResponse<RequestorApproverResponse> approverResponse =
|
BaseApiResponse<RequestorApproverResponse> approverResponse =
|
||||||
StringUtils.isNotEmpty(approver) && !isMansion
|
StringUtils.isNotEmpty(approver) && !isVillaOrMansion
|
||||||
? requestorResponse
|
? requestorResponse
|
||||||
: StringUtils.isNotEmpty(approver)
|
: StringUtils.isNotEmpty(approver)
|
||||||
? getDaylightRequestorApproverByUserId(dlPropertyId, approver)
|
? getDaylightRequestorApproverByUserId(dlPropertyId, approver)
|
||||||
@@ -1616,6 +1616,11 @@ public class DaylightApiService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean isVillaOrMansionRoom(String roomName) {
|
||||||
|
return StringUtils.equalsAnyIgnoreCase(StringUtils.substringBefore(roomName, "-"),
|
||||||
|
"V1", "V2", "V2M", "V3", "S3", "M1", "M2", "M3");
|
||||||
|
}
|
||||||
|
|
||||||
public BaseApiResponse<String> createDaylightNewRoomOnlyCompRule(
|
public BaseApiResponse<String> createDaylightNewRoomOnlyCompRule(
|
||||||
String dlAccountId,
|
String dlAccountId,
|
||||||
String profileId,
|
String profileId,
|
||||||
@@ -1774,11 +1779,22 @@ public class DaylightApiService {
|
|||||||
crr.setExecutive(false);
|
crr.setExecutive(false);
|
||||||
crr.setDoNotIssueInvoice(false);
|
crr.setDoNotIssueInvoice(false);
|
||||||
crr.setProfileId(profileId);
|
crr.setProfileId(profileId);
|
||||||
crr.setComplimentaryRuleLimits(getMiscChargeComplimentaryRuleLimits(startDate, endDate, miscCharge, daylightView.getSoftLimit()));
|
crr.setComplimentaryRuleLimits(
|
||||||
|
getMiscChargeComplimentaryRuleLimits(startDate, endDate, miscCharge, daylightView.getSoftLimit())
|
||||||
|
);
|
||||||
crr.setComplimentaryAccountingPresetsIds(distinctCapIds);
|
crr.setComplimentaryAccountingPresetsIds(distinctCapIds);
|
||||||
crr.setJustification("");
|
crr.setJustification("");
|
||||||
crr.setRequestorId(requestor.getId());
|
crr.setRequestorId(requestor.getId());
|
||||||
|
|
||||||
|
String paymentMethodCodeContent = daylightView.getPaymentMethodCodeContent();
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(paymentMethodCodeContent) &&
|
||||||
|
"Comp Settlement - Comp Room Incidentals Settlement".equalsIgnoreCase(paymentMethodCodeContent)
|
||||||
|
) {
|
||||||
|
crr.setApproverId(requestor.getId());
|
||||||
|
} else {
|
||||||
crr.setApproverId(approver.getId());
|
crr.setApproverId(approver.getId());
|
||||||
|
}
|
||||||
|
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setData(crr);
|
result.setData(crr);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.mgm.mcrm.booking.dtos.opera.schema.*;
|
|||||||
import com.mgm.mcrm.common.utils.SOAPUtil;
|
import com.mgm.mcrm.common.utils.SOAPUtil;
|
||||||
import jakarta.xml.soap.SOAPMessage;
|
import jakarta.xml.soap.SOAPMessage;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.apache.commons.lang3.Strings;
|
||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -44,13 +45,21 @@ public class GuestRequestsRequest {
|
|||||||
this.requestString.append(" <HotelReference chainCode=\""+this.getProperty().getCode()+"\" hotelCode=\""+this.getProperty().getHotelCode()+"\"/>");
|
this.requestString.append(" <HotelReference chainCode=\""+this.getProperty().getCode()+"\" hotelCode=\""+this.getProperty().getHotelCode()+"\"/>");
|
||||||
this.requestString.append(" <ConfirmationNumber type=\"INTERNAL\">"+this.confirmationNo+"</ConfirmationNumber>");
|
this.requestString.append(" <ConfirmationNumber type=\"INTERNAL\">"+this.confirmationNo+"</ConfirmationNumber>");
|
||||||
if(this.comment!=null) {
|
if(this.comment!=null) {
|
||||||
|
if (this.actionType!=null) {
|
||||||
|
this.requestString.append(" <ActionType>"+this.actionType+"</ActionType>");
|
||||||
|
}else{
|
||||||
this.requestString.append(" <ActionType>ADD</ActionType>");
|
this.requestString.append(" <ActionType>ADD</ActionType>");
|
||||||
|
}
|
||||||
this.requestString.append(" <RequestType>COMMENTS</RequestType>");
|
this.requestString.append(" <RequestType>COMMENTS</RequestType>");
|
||||||
this.requestString.append(" <FullOverlay>"+this.fullOverlay+"</FullOverlay>");
|
this.requestString.append(" <FullOverlay>"+this.fullOverlay+"</FullOverlay>");
|
||||||
this.requestString.append(" <GuestRequests>");
|
this.requestString.append(" <GuestRequests>");
|
||||||
this.requestString.append(" <hc:Comments>");
|
this.requestString.append(" <hc:Comments>");
|
||||||
this.requestString.append(" <hc:Comment guestViewable=\"true\">");
|
this.requestString.append(" <hc:Comment guestViewable=\"true\">");
|
||||||
this.requestString.append(" <hc:Text>"+this.comment+"</hc:Text>");
|
this.requestString.append(" <hc:Text>"+this.comment+"</hc:Text>");
|
||||||
|
if(this.commentId!=null){
|
||||||
|
this.requestString.append(" <hc:CommentId>"+this.commentId+"</hc:CommentId>");
|
||||||
|
this.requestString.append(" <hc:InternalYn>false</hc:InternalYn>");
|
||||||
|
}
|
||||||
if(this.commentType!=null) {
|
if(this.commentType!=null) {
|
||||||
this.requestString.append(" <hc:CommentType>"+this.commentType+"</hc:CommentType>");
|
this.requestString.append(" <hc:CommentType>"+this.commentType+"</hc:CommentType>");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -248,6 +248,8 @@ public class BookingsView implements Serializable {
|
|||||||
private String failPlatform;
|
private String failPlatform;
|
||||||
@Column(name="booking_approval_reason")
|
@Column(name="booking_approval_reason")
|
||||||
private String bookingApprovalReason;
|
private String bookingApprovalReason;
|
||||||
|
@Column(name="source_code")
|
||||||
|
private String sourceCode;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private String status;
|
private String status;
|
||||||
|
|||||||
@@ -60,10 +60,10 @@ import com.mgm.mcrm.common.jms.BookingControlMsgSender;
|
|||||||
import com.mgm.mcrm.common.utils.DaoUtil;
|
import com.mgm.mcrm.common.utils.DaoUtil;
|
||||||
import com.mgm.mcrm.common.utils.DateTimeUtil;
|
import com.mgm.mcrm.common.utils.DateTimeUtil;
|
||||||
import com.mgm.mcrm.common.utils.LogUtil;
|
import com.mgm.mcrm.common.utils.LogUtil;
|
||||||
import com.mgm.mcrm.common.utils.SendEmail;
|
|
||||||
import com.mgm.mcrm.logging.services.SysLogBookingService;
|
import com.mgm.mcrm.logging.services.SysLogBookingService;
|
||||||
import com.mgm.mcrm.notification.models.Email;
|
import com.mgm.mcrm.notification.models.Email;
|
||||||
import com.mgm.mcrm.notification.repositories.EmailDao;
|
import com.mgm.mcrm.notification.repositories.EmailDao;
|
||||||
|
import com.mgm.mcrm.notification.services.SendEmailService;
|
||||||
import com.mgm.mcrm.player.dtos.request.TodoChangeDateRequest;
|
import com.mgm.mcrm.player.dtos.request.TodoChangeDateRequest;
|
||||||
import com.mgm.mcrm.player.dtos.response.DaylightReservationResponse;
|
import com.mgm.mcrm.player.dtos.response.DaylightReservationResponse;
|
||||||
import com.mgm.mcrm.player.services.PlayerService;
|
import com.mgm.mcrm.player.services.PlayerService;
|
||||||
@@ -174,6 +174,8 @@ public class BookingService {
|
|||||||
private BookingTypeDao bookingTypeDao;
|
private BookingTypeDao bookingTypeDao;
|
||||||
@Resource
|
@Resource
|
||||||
private CfgCompRuleDao cfgCompRuleDao;
|
private CfgCompRuleDao cfgCompRuleDao;
|
||||||
|
@Resource
|
||||||
|
private SendEmailService sendEmailService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BookingMapper bookingMapper;
|
private BookingMapper bookingMapper;
|
||||||
@@ -514,14 +516,16 @@ public class BookingService {
|
|||||||
String operaComment = "";
|
String operaComment = "";
|
||||||
String stayDateForOpera = DateTimeUtil.formatOperaCommentStayDateRange(
|
String stayDateForOpera = DateTimeUtil.formatOperaCommentStayDateRange(
|
||||||
checkinDate, checkoutDate, Integer.valueOf(numOfNight));
|
checkinDate, checkoutDate, Integer.valueOf(numOfNight));
|
||||||
// 生成给 OPERA 的 comment:根据 misCharge 是否为空决定是否包含 INC.CHRG$ 相关信息
|
// IM 使用 GOA/TBA 和 deposit/post 模板,其他类型根据 miscCharge 生成 RM 模板。
|
||||||
if (param.getMiscCharge() == null || param.getMiscCharge().trim().isEmpty()) {
|
if ("IM".equalsIgnoreCase(cfgBookingType.getName())) {
|
||||||
|
operaComment = buildIMComment(booking);
|
||||||
|
} else if (param.getMiscCharge() == null || param.getMiscCharge().trim().isEmpty()) {
|
||||||
operaComment = "(RM)COMP ..APP\n\n" + stayDateForOpera + ",OD," + userId;
|
operaComment = "(RM)COMP ..APP\n\n" + stayDateForOpera + ",OD," + userId;
|
||||||
} else {
|
} else {
|
||||||
// 这里 *** 替换为 mischarge 的实际值
|
// 这里 *** 替换为 mischarge 的实际值
|
||||||
operaComment = "(RM+INC$" + param.getMiscCharge() + ")COMP ..APP\n\n"
|
operaComment = "(RM+INC$" + param.getMiscCharge() + ")COMP ..APP\n\n"
|
||||||
+ "INC.CHRG$" + param.getMiscCharge() + "COMP BY " + booking.getBooker() + " ..APP\n"
|
+ "INC.CHRG$" + param.getMiscCharge() + "COMP BY " + booking.getBooker() + " ..APP\n"
|
||||||
+ stayDateForOpera + ",OD," + userId;
|
+ stayDateForOpera + ","+booking.getSourceCode()+"," + userId;
|
||||||
}
|
}
|
||||||
booking.setOperaComment(operaComment);
|
booking.setOperaComment(operaComment);
|
||||||
|
|
||||||
@@ -1471,7 +1475,7 @@ public class BookingService {
|
|||||||
email.setBookId(booking.getId());
|
email.setBookId(booking.getId());
|
||||||
email.setCreatedAt(new Date());
|
email.setCreatedAt(new Date());
|
||||||
email.setCreatedBy(booking.getCreatedBy());
|
email.setCreatedBy(booking.getCreatedBy());
|
||||||
email = SendEmail.sendCreateR2Y2NewEmail(booking, originBookingView,email,userId,booking.getCreatedByName(), false, true, emailAddress.getKeyValues());
|
email = sendEmailService.sendCreateR2Y2NewEmail(booking, originBookingView,email,userId,booking.getCreatedByName(), false, true, emailAddress.getKeyValues());
|
||||||
|
|
||||||
if (email.getStatus() == 1) {
|
if (email.getStatus() == 1) {
|
||||||
emailDao.save(email);
|
emailDao.save(email);
|
||||||
@@ -2242,7 +2246,7 @@ public class BookingService {
|
|||||||
|
|
||||||
CfgSettings emailAddress = settingService.getSettingByKey(SysConstants.MGM_EMAIL_ADDRESS);
|
CfgSettings emailAddress = settingService.getSettingByKey(SysConstants.MGM_EMAIL_ADDRESS);
|
||||||
|
|
||||||
email = SendEmail.sendExtendEmail(emailBook, originBook, email, userId, userName, emailAddress.getKeyValues());
|
email = sendEmailService.sendExtendEmail(emailBook, originBook, email, userId, userName, emailAddress.getKeyValues());
|
||||||
|
|
||||||
if (email.getStatus() == 1) {
|
if (email.getStatus() == 1) {
|
||||||
processResult.setSuccess(true);
|
processResult.setSuccess(true);
|
||||||
@@ -2406,7 +2410,7 @@ public class BookingService {
|
|||||||
//判断SourceCode 如果为OD 或 VMTK 且没有Sharer 直接extend
|
//判断SourceCode 如果为OD 或 VMTK 且没有Sharer 直接extend
|
||||||
TodoChangeDateRequest changeRequest = bookingMapper.bookingDtoToChangeRequest(param);
|
TodoChangeDateRequest changeRequest = bookingMapper.bookingDtoToChangeRequest(param);
|
||||||
|
|
||||||
BaseApiResponse<List<Bookings>> result = this.daylightReservationChangeDate(changeRequest, player, true);
|
BaseApiResponse<List<Bookings>> result = this.daylightReservationChangeDate(changeRequest, player, true, false);
|
||||||
|
|
||||||
if (result.isSuccess()) {
|
if (result.isSuccess()) {
|
||||||
processResult.setSuccess(true);
|
processResult.setSuccess(true);
|
||||||
@@ -2415,36 +2419,6 @@ public class BookingService {
|
|||||||
processResult.setSuccess(false);
|
processResult.setSuccess(false);
|
||||||
processResult.setMessage(result.getMessage());
|
processResult.setMessage(result.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.isSuccess()) {
|
|
||||||
if ((!booking.getSourceCode().isEmpty() && !Strings.CS.containsAny(booking.getSourceCode(),"OD","VMKT"))
|
|
||||||
||
|
|
||||||
(booking.getSharer() != null && !Strings.CS.equals(booking.getSharer(),"[]"))) {
|
|
||||||
//send email instead of sync other booking
|
|
||||||
Date now = new Date();
|
|
||||||
CfgSettings emailAddress = settingService.getSettingByKey(SysConstants.MGM_EMAIL_ADDRESS);
|
|
||||||
BookingsView originBookingView = bookingViewDao.findById(bookId).orElse(null);
|
|
||||||
originBookingView = this.getEmailInfo(originBookingView,originBookingView.getCreatedBy()).getData();
|
|
||||||
booking.setCheckoutDate(
|
|
||||||
DateTimeUtil.getDateFromString(param.getChangeCheckoutDate(), "yyyy-MM-dd"));
|
|
||||||
|
|
||||||
Email email = new Email();
|
|
||||||
email.setBookId(booking.getId());
|
|
||||||
email.setCreatedAt(now);
|
|
||||||
email.setCreatedBy(booking.getCreatedBy());
|
|
||||||
email = SendEmail.sendExtendEmail(booking, originBookingView,email,userId,userName,emailAddress.getKeyValues());
|
|
||||||
|
|
||||||
if(email.getStatus()==1) {
|
|
||||||
emailDao.save(email);
|
|
||||||
processResult.setSuccess(true);
|
|
||||||
processResult.setData(resultBookings);
|
|
||||||
}else{
|
|
||||||
processResult.setSuccess(false);
|
|
||||||
processResult.setMessage("Send Email Failed");
|
|
||||||
processResult.setLogMessage("Send Email Failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else if (isApproval){
|
}else if (isApproval){
|
||||||
booking.setCheckinDate(
|
booking.setCheckinDate(
|
||||||
originBook.getCheckoutDate()
|
originBook.getCheckoutDate()
|
||||||
@@ -2486,7 +2460,8 @@ public class BookingService {
|
|||||||
return processResult;
|
return processResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseApiResponse<List<Bookings>> daylightReservationChangeDate(TodoChangeDateRequest param, PlayerProfileEntry player, boolean isExtend) throws Exception {
|
public BaseApiResponse<List<Bookings>> daylightReservationChangeDate(TodoChangeDateRequest param,
|
||||||
|
PlayerProfileEntry player, boolean isExtend, boolean isApprovalExtend) throws Exception {
|
||||||
BaseApiResponse<List<Bookings>> processResult = new BaseApiResponse<>();
|
BaseApiResponse<List<Bookings>> processResult = new BaseApiResponse<>();
|
||||||
Date createDate = DateTimeUtil.getCurrentDateTime("yyyy-MM-dd HH:mm:ss");
|
Date createDate = DateTimeUtil.getCurrentDateTime("yyyy-MM-dd HH:mm:ss");
|
||||||
Long bookId = param.getId();
|
Long bookId = param.getId();
|
||||||
@@ -2500,6 +2475,7 @@ public class BookingService {
|
|||||||
Date checkinDate;
|
Date checkinDate;
|
||||||
Date checkoutDate;
|
Date checkoutDate;
|
||||||
String userId = param.getUser()!=null? param.getUser().getUserId():null;
|
String userId = param.getUser()!=null? param.getUser().getUserId():null;
|
||||||
|
String userName = param.getUserName();
|
||||||
|
|
||||||
Bookings booking = bookingDao.findById(bookId).orElse(null);
|
Bookings booking = bookingDao.findById(bookId).orElse(null);
|
||||||
|
|
||||||
@@ -2643,6 +2619,38 @@ public class BookingService {
|
|||||||
bookId, checkinDateStr, checkoutDateStr, property.getDlPropertyId());
|
bookId, checkinDateStr, checkoutDateStr, property.getDlPropertyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isExtend && result.isSuccess()) {
|
||||||
|
if (isApprovalExtend
|
||||||
|
||
|
||||||
|
(StringUtils.isNotEmpty(booking.getSourceCode()) && !Strings.CS.containsAny(booking.getSourceCode(),"OD","VMKT"))
|
||||||
|
||
|
||||||
|
(booking.getSharer() != null && !Strings.CS.equals(booking.getSharer(),"[]"))) {
|
||||||
|
//send email instead of sync other booking
|
||||||
|
Date now = new Date();
|
||||||
|
CfgSettings emailAddress = settingService.getSettingByKey(SysConstants.MGM_EMAIL_ADDRESS);
|
||||||
|
BookingsView originBookingView = bookingViewDao.findById(bookId).orElse(null);
|
||||||
|
originBookingView = this.getEmailInfo(originBookingView,originBookingView.getCreatedBy()).getData();
|
||||||
|
booking.setCheckoutDate(
|
||||||
|
DateTimeUtil.getDateFromString(checkoutDateStr, "yyyy-MM-dd"));
|
||||||
|
|
||||||
|
Email email = new Email();
|
||||||
|
email.setBookId(booking.getId());
|
||||||
|
email.setCreatedAt(now);
|
||||||
|
email.setCreatedBy(booking.getCreatedBy());
|
||||||
|
email = sendEmailService.sendExtendEmail(booking, originBookingView,email,userId,userName,emailAddress.getKeyValues());
|
||||||
|
|
||||||
|
if(email.getStatus()==1) {
|
||||||
|
emailDao.save(email);
|
||||||
|
processResult.setSuccess(true);
|
||||||
|
processResult.setData(resultBookings);
|
||||||
|
}else{
|
||||||
|
processResult.setSuccess(false);
|
||||||
|
processResult.setMessage("Send Email Failed");
|
||||||
|
processResult.setLogMessage("Send Email Failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Thread.sleep(2000L);
|
// Thread.sleep(2000L);
|
||||||
// if (booking.getDlBlockId() != null)
|
// if (booking.getDlBlockId() != null)
|
||||||
// dlService.daylightReservationSetBlock(booking.getDlReservationId(), property.getDlPropertyId(), booking.getDlBlockId());
|
// dlService.daylightReservationSetBlock(booking.getDlReservationId(), property.getDlPropertyId(), booking.getDlBlockId());
|
||||||
@@ -2745,6 +2753,50 @@ public class BookingService {
|
|||||||
* extension record. The waitlist row contains the requested checkout date,
|
* extension record. The waitlist row contains the requested checkout date,
|
||||||
* while waitlistId identifies the booking that must be sent to Daylight.
|
* while waitlistId identifies the booking that must be sent to Daylight.
|
||||||
*/
|
*/
|
||||||
|
public BaseApiResponse<List<Bookings>> extendDaylightApprovalBooking(Bookings approvalBooking,
|
||||||
|
PlayerProfileEntry player, String userId, String userName) throws Exception {
|
||||||
|
BaseApiResponse<List<Bookings>> result = new BaseApiResponse<>();
|
||||||
|
if (approvalBooking == null || StringUtils.isBlank(approvalBooking.getApprovalBookingId())) {
|
||||||
|
result.setSuccess(false);
|
||||||
|
result.setMessage("Approval booking does not reference an original booking");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Long originalBookingId;
|
||||||
|
try {
|
||||||
|
originalBookingId = Long.valueOf(approvalBooking.getApprovalBookingId());
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
result.setSuccess(false);
|
||||||
|
result.setMessage("Invalid original booking id: " + approvalBooking.getApprovalBookingId());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bookings originalBooking = bookingDao.findById(originalBookingId).orElse(null);
|
||||||
|
if (originalBooking == null) {
|
||||||
|
result.setSuccess(false);
|
||||||
|
result.setMessage("Original booking not found: " + originalBookingId);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (originalBooking.getCheckinDate() == null || originalBooking.getCheckoutDate() == null
|
||||||
|
|| approvalBooking.getCheckoutDate() == null) {
|
||||||
|
result.setSuccess(false);
|
||||||
|
result.setMessage("Booking dates are incomplete");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
TodoChangeDateRequest changeRequest = bookingMapper.bookingToChangeRequest(originalBooking);
|
||||||
|
if (changeRequest.getDateList() == null || changeRequest.getDateList().isEmpty()) {
|
||||||
|
changeRequest.setDateList(buildDefaultDateList(
|
||||||
|
originalBooking.getCheckinDate(), originalBooking.getCheckoutDate()));
|
||||||
|
}
|
||||||
|
changeRequest.setExtendDate(buildDefaultDateList(
|
||||||
|
originalBooking.getCheckinDate(), approvalBooking.getCheckoutDate()));
|
||||||
|
changeRequest.setUserId(userId);
|
||||||
|
changeRequest.setUserName(userName);
|
||||||
|
|
||||||
|
return daylightReservationChangeDate(changeRequest, player, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
public BaseApiResponse<List<Bookings>> extendDaylightWaitlistBooking(Bookings waitlistBooking,
|
public BaseApiResponse<List<Bookings>> extendDaylightWaitlistBooking(Bookings waitlistBooking,
|
||||||
PlayerProfileEntry player, String userId, String userName) throws Exception {
|
PlayerProfileEntry player, String userId, String userName) throws Exception {
|
||||||
BaseApiResponse<List<Bookings>> result = new BaseApiResponse<>();
|
BaseApiResponse<List<Bookings>> result = new BaseApiResponse<>();
|
||||||
@@ -2779,7 +2831,7 @@ public class BookingService {
|
|||||||
changeRequest.setUserId(userId);
|
changeRequest.setUserId(userId);
|
||||||
changeRequest.setUserName(userName);
|
changeRequest.setUserName(userName);
|
||||||
|
|
||||||
return daylightReservationChangeDate(changeRequest, player, true);
|
return daylightReservationChangeDate(changeRequest, player, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseApiResponse<Bookings> cancelWaitlistBooking(BookingDto param,HttpServletRequest request) {
|
public BaseApiResponse<Bookings> cancelWaitlistBooking(BookingDto param,HttpServletRequest request) {
|
||||||
@@ -3473,9 +3525,10 @@ public class BookingService {
|
|||||||
booking.setRatePlanCode(b.getRatePlanCode());
|
booking.setRatePlanCode(b.getRatePlanCode());
|
||||||
booking.setHotelCode(b.getHotelCode());
|
booking.setHotelCode(b.getHotelCode());
|
||||||
booking.setMarketCode(b.getMarketCode());
|
booking.setMarketCode(b.getMarketCode());
|
||||||
// booking.setSourceCode(b.getSourceCode());
|
booking.setSourceCode(b.getSourceCode());
|
||||||
booking.setBookingTypeName(b.getBookingTypeName());
|
booking.setBookingTypeName(b.getBookingTypeName());
|
||||||
booking.setMiscCharge(b.getMiscCharge());
|
booking.setMiscCharge(b.getMiscCharge());
|
||||||
|
|
||||||
LogUtil.info(BookingService.class,"ConfirmNo:"+booking.getConfirmationNo()+"MisCharge"+b.getMiscCharge());
|
LogUtil.info(BookingService.class,"ConfirmNo:"+booking.getConfirmationNo()+"MisCharge"+b.getMiscCharge());
|
||||||
if (!b.getRoomTypeCode().equals(booking.getRoomTypeCode())) {
|
if (!b.getRoomTypeCode().equals(booking.getRoomTypeCode())) {
|
||||||
CfgRoomTypes operRoomType = roomTypeDao.findByCodeAndCategory(b.getRoomTypeCode(), "OPERA");
|
CfgRoomTypes operRoomType = roomTypeDao.findByCodeAndCategory(b.getRoomTypeCode(), "OPERA");
|
||||||
@@ -3818,6 +3871,9 @@ public class BookingService {
|
|||||||
BookingsView viewBook = bookingViewDao.findById(booking.getId()).orElse(null);
|
BookingsView viewBook = bookingViewDao.findById(booking.getId()).orElse(null);
|
||||||
|
|
||||||
String bookComment = operaService.makeCashierComment(viewBook);
|
String bookComment = operaService.makeCashierComment(viewBook);
|
||||||
|
if ("IM".equalsIgnoreCase(viewBook.getBookingTypeName())) {
|
||||||
|
booking.setOperaComment(bookComment);
|
||||||
|
}
|
||||||
bookingDao.save(booking);
|
bookingDao.save(booking);
|
||||||
|
|
||||||
//update waitlist booking
|
//update waitlist booking
|
||||||
@@ -3949,6 +4005,9 @@ public class BookingService {
|
|||||||
}
|
}
|
||||||
BookingsView viewBook = bookingViewDao.findById(booking.getId()).orElse(null);
|
BookingsView viewBook = bookingViewDao.findById(booking.getId()).orElse(null);
|
||||||
String bookComment = operaService.makeCashierComment(viewBook);
|
String bookComment = operaService.makeCashierComment(viewBook);
|
||||||
|
if ("IM".equalsIgnoreCase(viewBook.getBookingTypeName())) {
|
||||||
|
booking.setOperaComment(bookComment);
|
||||||
|
}
|
||||||
|
|
||||||
Bookings successBook = bookingDao.save(booking);
|
Bookings successBook = bookingDao.save(booking);
|
||||||
|
|
||||||
@@ -3961,7 +4020,7 @@ public class BookingService {
|
|||||||
JSONObject cashCommentResponse = new JSONObject();
|
JSONObject cashCommentResponse = new JSONObject();
|
||||||
cashCommentRequest.setActionType("ADD");
|
cashCommentRequest.setActionType("ADD");
|
||||||
cashCommentRequest.setProperty(property);
|
cashCommentRequest.setProperty(property);
|
||||||
cashCommentRequest.setComment(bookComment);
|
cashCommentRequest.setComment(booking.getOperaComment());
|
||||||
cashCommentRequest.setConfirmationNo(booking.getConfirmationNo());
|
cashCommentRequest.setConfirmationNo(booking.getConfirmationNo());
|
||||||
cashCommentRequest.setCommentType("CASHIER");
|
cashCommentRequest.setCommentType("CASHIER");
|
||||||
cashCommentResponse = operaService.guestRequests(cashCommentRequest);
|
cashCommentResponse = operaService.guestRequests(cashCommentRequest);
|
||||||
@@ -4533,7 +4592,7 @@ public class BookingService {
|
|||||||
LogUtil.info(BookingService.class,
|
LogUtil.info(BookingService.class,
|
||||||
"[synvBookingSharer] profileIdList " + gson.toJson(profileIdList));
|
"[synvBookingSharer] profileIdList " + gson.toJson(profileIdList));
|
||||||
if (profileIdList.size()>0) {
|
if (profileIdList.size()>0) {
|
||||||
shareBook.setOperaProfileId(Long.valueOf(profileIdList.get(0)));
|
shareBook.setOperaProfileId(Long.valueOf(profileIdList.getFirst()));
|
||||||
}else {
|
}else {
|
||||||
shareBook.setOperaProfileId(null);
|
shareBook.setOperaProfileId(null);
|
||||||
}
|
}
|
||||||
@@ -4550,7 +4609,7 @@ public class BookingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}else if(!StringUtils.isEmpty(shareName)) {
|
}else if(!StringUtils.isEmpty(shareName)) {
|
||||||
// shareBook.setOperaProfileId(null);
|
shareBook.setOperaProfileId(null);
|
||||||
shareBook.setPlayerId(null);
|
shareBook.setPlayerId(null);
|
||||||
String[] shareNameArr = StringUtils.split(shareName, ", ",2);
|
String[] shareNameArr = StringUtils.split(shareName, ", ",2);
|
||||||
if(shareNameArr.length>1) {
|
if(shareNameArr.length>1) {
|
||||||
@@ -5514,7 +5573,7 @@ public class BookingService {
|
|||||||
}
|
}
|
||||||
operaBooking.setApproveStatus(dbBooking.getApproveStatus());
|
operaBooking.setApproveStatus(dbBooking.getApproveStatus());
|
||||||
operaBooking.setResvId(dbBooking.getResvId());
|
operaBooking.setResvId(dbBooking.getResvId());
|
||||||
operaBooking.setMiscCharge(dbBooking.getMiscCharge());
|
// operaBooking.setMiscCharge(dbBooking.getMiscCharge());
|
||||||
String nights = DateTimeUtil.getDiffDate(operaBooking.getCheckinDate(), operaBooking.getCheckoutDate(), "day");
|
String nights = DateTimeUtil.getDiffDate(operaBooking.getCheckinDate(), operaBooking.getCheckoutDate(), "day");
|
||||||
operaBooking.setNumOfNight(Integer.valueOf(nights));
|
operaBooking.setNumOfNight(Integer.valueOf(nights));
|
||||||
operaBooking.setPropertyName(dbBookingView.getPropertyName());
|
operaBooking.setPropertyName(dbBookingView.getPropertyName());
|
||||||
@@ -6212,14 +6271,7 @@ public class BookingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String amendLine = "AMEND INC.CHRG$" + newMisCharge.trim() + " AS " + userId + "..APP";
|
String amendLine = "AMEND INC.CHRG$" + newMisCharge.trim() + " AS " + userId + "..APP";
|
||||||
Matcher amendMatcher = Pattern.compile("(?m)^AMEND INC\\.CHRG\\s*\\$").matcher(comment);
|
return insertIMChangeLine(comment, amendLine);
|
||||||
if (amendMatcher.find()) {
|
|
||||||
// 保留 GOA 原始说明,将最新金额记录插入已有修改记录之前。
|
|
||||||
int insertPos = amendMatcher.start();
|
|
||||||
return comment.substring(0, insertPos).stripTrailing() + "\n\n"
|
|
||||||
+ amendLine + "\n" + comment.substring(insertPos);
|
|
||||||
}
|
|
||||||
return comment.stripTrailing() + "\n\n" + amendLine;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!newMisCharge.isEmpty() && !comment.isEmpty()) {
|
if (!newMisCharge.isEmpty() && !comment.isEmpty()) {
|
||||||
@@ -6261,6 +6313,18 @@ public class BookingService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Matcher mscHeaderMatcher = Pattern.compile(
|
||||||
|
"(?m)^[ \\t]*\\(RM(?:\\+INC\\$[^)]*)?\\)COMP[ \\t]+\\.\\.MSC(?: |[ \\t])*$")
|
||||||
|
.matcher(comment);
|
||||||
|
if (mscHeaderMatcher.find()) {
|
||||||
|
int insertPos = mscHeaderMatcher.end();
|
||||||
|
String remainingComment = comment.substring(insertPos).trim()
|
||||||
|
.replaceAll("\\n(?:[ \\t]*\\n)+", "\n");
|
||||||
|
comment = comment.substring(0, insertPos)
|
||||||
|
+ "\n\n"
|
||||||
|
+ amendLine
|
||||||
|
+ (remainingComment.isEmpty() ? "" : "\n" + remainingComment);
|
||||||
|
} else {
|
||||||
int headerEnd = comment.indexOf("..APP");
|
int headerEnd = comment.indexOf("..APP");
|
||||||
|
|
||||||
if (headerEnd >= 0) {
|
if (headerEnd >= 0) {
|
||||||
@@ -6275,6 +6339,7 @@ public class BookingService {
|
|||||||
comment = comment + "\n" + amendLine;
|
comment = comment + "\n" + amendLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// 全新构造
|
// 全新构造
|
||||||
comment = "(RM+INC$" + newMisCharge + ")COMP ..APP\n\n"
|
comment = "(RM+INC$" + newMisCharge + ")COMP ..APP\n\n"
|
||||||
@@ -6317,23 +6382,48 @@ public class BookingService {
|
|||||||
return extLine;
|
return extLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return insertIMChangeLine(existingComment, extLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将 IM 的最新变更记录插入固定头部之后、历史变更记录之前。
|
||||||
|
* 固定头部为 GOA/TBA 及紧随其后的 deposit/post 行。
|
||||||
|
*/
|
||||||
|
private String insertIMChangeLine(String existingComment, String newLine) {
|
||||||
|
if (StringUtils.isBlank(existingComment)) {
|
||||||
|
return newLine;
|
||||||
|
}
|
||||||
|
|
||||||
String comment = existingComment
|
String comment = existingComment
|
||||||
.replace("\r\n", "\n")
|
.replace("\r\n", "\n")
|
||||||
.replace("\r", "\n")
|
.replace("\r", "\n")
|
||||||
.replace("
", "\n")
|
.replace("
", "\n")
|
||||||
.replace("$", "$");
|
.replace("$", "$")
|
||||||
|
.trim();
|
||||||
String goaHeader = "GOA/TBA..APP";
|
String goaHeader = "GOA/TBA..APP";
|
||||||
int goaEndIndex = comment.indexOf(goaHeader);
|
int goaIndex = comment.indexOf(goaHeader);
|
||||||
|
if (goaIndex < 0) {
|
||||||
if (goaEndIndex < 0) {
|
return newLine + "\n" + comment;
|
||||||
return extLine + "\n\n" + comment.trim();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
goaEndIndex += goaHeader.length();
|
int baseEnd = goaIndex + goaHeader.length();
|
||||||
return comment.substring(0, goaEndIndex)
|
Matcher depositMatcher = Pattern.compile(
|
||||||
+ "\n"
|
"(?m)^[ \\t]*\\[(?:WAIVE|COLLECT) DEPOSIT AND (?:YES|NO) POST\\]\\.\\.APP[ \\t]*$")
|
||||||
+ extLine
|
.matcher(comment);
|
||||||
+ comment.substring(goaEndIndex);
|
while (depositMatcher.find()) {
|
||||||
|
if (depositMatcher.start() >= baseEnd) {
|
||||||
|
baseEnd = depositMatcher.end();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String baseComment = comment.substring(0, baseEnd).stripTrailing();
|
||||||
|
String changeHistory = comment.substring(baseEnd).strip();
|
||||||
|
if (changeHistory.isEmpty()) {
|
||||||
|
return baseComment + "\n\n" + newLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseComment + "\n\n" + newLine + "\n" + changeHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildOperaExtendComment(Bookings booking, Date originCheckoutDate, String booker) {
|
private String buildOperaExtendComment(Bookings booking, Date originCheckoutDate, String booker) {
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ public class NonMGMBookingService {
|
|||||||
booking.setSharer(JSONArray.toJSONString(sharer));
|
booking.setSharer(JSONArray.toJSONString(sharer));
|
||||||
booking.setBookingTypeId(bookingTypeId);
|
booking.setBookingTypeId(bookingTypeId);
|
||||||
booking.setMember(JSONObject.toJSONString(member));
|
booking.setMember(JSONObject.toJSONString(member));
|
||||||
|
booking.setCategory("OTHER");
|
||||||
|
|
||||||
booking.setFeatureCode(specialCode);
|
booking.setFeatureCode(specialCode);
|
||||||
booking.setSegmentId(segmentId);
|
booking.setSegmentId(segmentId);
|
||||||
@@ -210,7 +211,7 @@ public class NonMGMBookingService {
|
|||||||
Date checkoutDate = DateTimeUtil.getDateFromString(String.valueOf(dateArr.getLast()), "yyyy-MM-dd");
|
Date checkoutDate = DateTimeUtil.getDateFromString(String.valueOf(dateArr.getLast()), "yyyy-MM-dd");
|
||||||
String numOfNight = String.valueOf(dateItem.getNumOfNight());
|
String numOfNight = String.valueOf(dateItem.getNumOfNight());
|
||||||
String bookRemark = String.valueOf(dateItem.getRemark());
|
String bookRemark = String.valueOf(dateItem.getRemark());
|
||||||
if(StringUtils.isNotEmpty(bookRemark)) booking.setRemark(bookRemark);
|
if(StringUtils.isNotEmpty(bookRemark) && !"null".equalsIgnoreCase(bookRemark)) booking.setRemark(bookRemark);
|
||||||
|
|
||||||
String bookingStatus = dateItem.getBookingStatus();
|
String bookingStatus = dateItem.getBookingStatus();
|
||||||
|
|
||||||
|
|||||||
@@ -1101,7 +1101,7 @@ public class OperaService {
|
|||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
comment = String.format("(RM) COMP..APP

%s,%s,%s", dateRange,
|
comment = String.format("(RM) COMP..APP

%s,%s,%s", dateRange,
|
||||||
book.getDlSourceId(), book.getCreatedBy());
|
book.getSourceCode(), book.getCreatedBy());
|
||||||
}
|
}
|
||||||
|
|
||||||
return comment;
|
return comment;
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ import com.mgm.mcrm.common.jms.BookingControlMsgSender;
|
|||||||
import com.mgm.mcrm.common.services.MGMEsbApiService;
|
import com.mgm.mcrm.common.services.MGMEsbApiService;
|
||||||
import com.mgm.mcrm.common.utils.DateTimeUtil;
|
import com.mgm.mcrm.common.utils.DateTimeUtil;
|
||||||
import com.mgm.mcrm.common.utils.LogUtil;
|
import com.mgm.mcrm.common.utils.LogUtil;
|
||||||
import com.mgm.mcrm.common.utils.SendEmail;
|
|
||||||
import com.mgm.mcrm.logging.services.SysLogBookingService;
|
import com.mgm.mcrm.logging.services.SysLogBookingService;
|
||||||
import com.mgm.mcrm.notification.models.Email;
|
import com.mgm.mcrm.notification.models.Email;
|
||||||
import com.mgm.mcrm.notification.repositories.EmailDao;
|
import com.mgm.mcrm.notification.repositories.EmailDao;
|
||||||
|
import com.mgm.mcrm.notification.services.SendEmailService;
|
||||||
import com.mgm.mcrm.player.services.PlayerService;
|
import com.mgm.mcrm.player.services.PlayerService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
@@ -90,6 +90,8 @@ public class WaitlistBookingService {
|
|||||||
private PropertyDao propertyDao;
|
private PropertyDao propertyDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private BookingMapper bookingMapper;
|
private BookingMapper bookingMapper;
|
||||||
|
@Resource
|
||||||
|
private SendEmailService sendEmailService;
|
||||||
|
|
||||||
public List<BookingsView> getBookingsByPlayer(String playerId) throws Exception {
|
public List<BookingsView> getBookingsByPlayer(String playerId) throws Exception {
|
||||||
List<BookingsView> bookingList = new ArrayList<BookingsView>();
|
List<BookingsView> bookingList = new ArrayList<BookingsView>();
|
||||||
@@ -398,7 +400,7 @@ public class WaitlistBookingService {
|
|||||||
email.setCreatedAt(creatdDate);
|
email.setCreatedAt(creatdDate);
|
||||||
email.setCreatedBy(originBooking.getCreatedBy());
|
email.setCreatedBy(originBooking.getCreatedBy());
|
||||||
|
|
||||||
email = SendEmail.sendApprovalExtendEmail(emailBook, originBookingView, email, userId, userName, bookingView, isOtherOverBook, emailAddress.getKeyValues());
|
email = sendEmailService.sendApprovalExtendEmail(emailBook, originBookingView, email, userId, userName, bookingView, isOtherOverBook, emailAddress.getKeyValues());
|
||||||
if (email.getStatus() == 1) {
|
if (email.getStatus() == 1) {
|
||||||
originBooking.setApproveStatus("WA");
|
originBooking.setApproveStatus("WA");
|
||||||
bookingDao.save(originBooking);
|
bookingDao.save(originBooking);
|
||||||
@@ -439,7 +441,7 @@ public class WaitlistBookingService {
|
|||||||
email.setCreatedAt(creatdDate);
|
email.setCreatedAt(creatdDate);
|
||||||
email.setCreatedBy(originBooking.getCreatedBy());
|
email.setCreatedBy(originBooking.getCreatedBy());
|
||||||
|
|
||||||
email = SendEmail.sendApprovalExtendEmail(originBooking, originBookingView,email,userId,userName,bookingView,isOtherOverBook,emailAddress.getKeyValues());
|
email = sendEmailService.sendApprovalExtendEmail(originBooking, originBookingView,email,userId,userName,bookingView,isOtherOverBook,emailAddress.getKeyValues());
|
||||||
if(email.getStatus()==1) {
|
if(email.getStatus()==1) {
|
||||||
emailDao.save(email);
|
emailDao.save(email);
|
||||||
}
|
}
|
||||||
@@ -455,7 +457,7 @@ public class WaitlistBookingService {
|
|||||||
email.setCreatedAt(creatdDate);
|
email.setCreatedAt(creatdDate);
|
||||||
email.setCreatedBy(originBooking.getCreatedBy());
|
email.setCreatedBy(originBooking.getCreatedBy());
|
||||||
|
|
||||||
email = SendEmail.sendApprovalExtendEmail(emailBook, originBookingView, email, userId, userName, bookingView, false, emailAddress.getKeyValues());
|
email = sendEmailService.sendApprovalExtendEmail(emailBook, originBookingView, email, userId, userName, bookingView, false, emailAddress.getKeyValues());
|
||||||
if (email.getStatus() == 1) {
|
if (email.getStatus() == 1) {
|
||||||
originBooking.setApproveStatus("WA");
|
originBooking.setApproveStatus("WA");
|
||||||
bookingDao.save(originBooking);
|
bookingDao.save(originBooking);
|
||||||
@@ -475,7 +477,7 @@ public class WaitlistBookingService {
|
|||||||
email.setCreatedAt(creatdDate);
|
email.setCreatedAt(creatdDate);
|
||||||
email.setCreatedBy(originBooking.getCreatedBy());
|
email.setCreatedBy(originBooking.getCreatedBy());
|
||||||
|
|
||||||
email = SendEmail.sendApprovalNewEmail(emailBook, bookingView, email, userId, userName, true, false, emailAddress.getKeyValues());
|
email = sendEmailService.sendApprovalNewEmail(emailBook, bookingView, email, userId, userName, true, false, emailAddress.getKeyValues());
|
||||||
if (email.getStatus() == 1) {
|
if (email.getStatus() == 1) {
|
||||||
originBooking.setApproveStatus("WA");
|
originBooking.setApproveStatus("WA");
|
||||||
bookingDao.save(originBooking);
|
bookingDao.save(originBooking);
|
||||||
@@ -532,7 +534,7 @@ public class WaitlistBookingService {
|
|||||||
email.setCreatedAt(creatdDate);
|
email.setCreatedAt(creatdDate);
|
||||||
email.setCreatedBy(originBooking.getCreatedBy());
|
email.setCreatedBy(originBooking.getCreatedBy());
|
||||||
|
|
||||||
email = SendEmail.sendApprovalNewEmail(emailBook, bookingView, email, userId, userName, false, true, emailAddress.getKeyValues());
|
email = sendEmailService.sendApprovalNewEmail(emailBook, bookingView, email, userId, userName, false, true, emailAddress.getKeyValues());
|
||||||
emailDao.save(email);
|
emailDao.save(email);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.mgm.mcrm.common.utils.NetworkUtil;
|
|||||||
import com.mgm.mcrm.logging.models.SysLogLogin;
|
import com.mgm.mcrm.logging.models.SysLogLogin;
|
||||||
import com.mgm.mcrm.logging.models.SysLogOperation;
|
import com.mgm.mcrm.logging.models.SysLogOperation;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import lombok.Getter;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.Strings;
|
import org.apache.commons.lang3.Strings;
|
||||||
import org.springframework.boot.system.ApplicationHome;
|
import org.springframework.boot.system.ApplicationHome;
|
||||||
@@ -24,8 +25,12 @@ import org.springframework.core.io.ClassPathResource;
|
|||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.web.servlet.support.RequestContextUtils;
|
import org.springframework.web.servlet.support.RequestContextUtils;
|
||||||
|
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.TrustManagerFactory;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.security.KeyStore;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -50,7 +55,9 @@ public class SysCommon {
|
|||||||
private static Map<String,String> notifyTemplateMap = new HashMap<String,String>();
|
private static Map<String,String> notifyTemplateMap = new HashMap<String,String>();
|
||||||
private static final Map<String,AppServerState> appServerStates = new HashMap<String,AppServerState>();
|
private static final Map<String,AppServerState> appServerStates = new HashMap<String,AppServerState>();
|
||||||
private static final List<String> allowOriginSource = new ArrayList<String>();
|
private static final List<String> allowOriginSource = new ArrayList<String>();
|
||||||
|
@Getter
|
||||||
private static final List<String> soapServers = new ArrayList<String>();
|
private static final List<String> soapServers = new ArrayList<String>();
|
||||||
|
@Getter
|
||||||
private static final List<String> httpApiServers = new ArrayList<String>();
|
private static final List<String> httpApiServers = new ArrayList<String>();
|
||||||
private static final List<String> allowIPSource = new ArrayList<String>();
|
private static final List<String> allowIPSource = new ArrayList<String>();
|
||||||
// @Autowired
|
// @Autowired
|
||||||
@@ -635,4 +642,20 @@ public class SysCommon {
|
|||||||
}
|
}
|
||||||
return isAllow;
|
return isAllow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static X509TrustManager getDefaultTrustManager() {
|
||||||
|
try {
|
||||||
|
// 获取 JVM 默认的 TrustManager 作为核心校验逻辑
|
||||||
|
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
||||||
|
tmf.init((KeyStore) null); // 使用系统的默认信任库
|
||||||
|
for (TrustManager tm : tmf.getTrustManagers()) {
|
||||||
|
if (tm instanceof X509TrustManager) {
|
||||||
|
return (X509TrustManager) tm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(Exception err){
|
||||||
|
LogUtil.error(SysCommon.class,"Default X509TrustManager not found["+err.getMessage()+"]");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package com.mgm.mcrm.common.httpclient;
|
package com.mgm.mcrm.common.httpclient;
|
||||||
|
|
||||||
|
import com.mgm.mcrm.common.constants.SysCommon;
|
||||||
|
import com.mgm.mcrm.common.services.ConfigurableTrustHandler;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
|
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
|
||||||
import org.apache.hc.core5.ssl.SSLContexts;
|
import org.apache.hc.core5.ssl.SSLContexts;
|
||||||
|
|
||||||
@@ -26,7 +30,11 @@ import java.security.cert.CertificateException;
|
|||||||
* @version 2.0 (client5)
|
* @version 2.0 (client5)
|
||||||
*/
|
*/
|
||||||
public class HttpSslSupport {
|
public class HttpSslSupport {
|
||||||
private static final SSLHandler SIMPLE_VERIFIER = new SSLHandler();
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private static boolean skipValidation=true;
|
||||||
|
|
||||||
|
private static ConfigurableTrustHandler trustHandler=null;
|
||||||
|
|
||||||
private static SSLSocketFactory sslFactory;
|
private static SSLSocketFactory sslFactory;
|
||||||
// 注意:SSLConnectionSocketFactory 在 HttpClient 5 中被标记为 deprecated,
|
// 注意:SSLConnectionSocketFactory 在 HttpClient 5 中被标记为 deprecated,
|
||||||
@@ -46,42 +54,13 @@ public class HttpSslSupport {
|
|||||||
return new HttpSslSupport();
|
return new HttpSslSupport();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static ConfigurableTrustHandler getTrustHandler(){
|
||||||
* 重写 X509TrustManager 和 HostnameVerifier,信任所有证书与主机名。
|
if(trustHandler==null){
|
||||||
* 仅推荐在内部环境或调试场景使用。
|
trustHandler =new ConfigurableTrustHandler(skipValidation, SysCommon.getDefaultTrustManager(), SysCommon.getHttpApiServers());
|
||||||
*/
|
}
|
||||||
private static class SSLHandler implements X509TrustManager, HostnameVerifier {
|
return trustHandler;
|
||||||
|
|
||||||
@Override
|
|
||||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
|
||||||
return new java.security.cert.X509Certificate[]{};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void checkServerTrusted(java.security.cert.X509Certificate[] chain,
|
|
||||||
String authType) throws CertificateException {
|
|
||||||
// 信任所有服务器证书
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void checkClientTrusted(java.security.cert.X509Certificate[] chain,
|
|
||||||
String authType) throws CertificateException {
|
|
||||||
// 信任所有客户端证书
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean verify(String paramString, SSLSession paramSSLSession) {
|
|
||||||
// 信任所有主机名
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取默认 HostnameVerifier(信任所有主机名)
|
|
||||||
*/
|
|
||||||
public static HostnameVerifier getVerifier() {
|
|
||||||
return SIMPLE_VERIFIER;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取信任所有证书的 {@link SSLSocketFactory}
|
* 获取信任所有证书的 {@link SSLSocketFactory}
|
||||||
@@ -92,7 +71,9 @@ public class HttpSslSupport {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
SSLContext context = getSSLContext(sslpv);
|
SSLContext context = getSSLContext(sslpv);
|
||||||
context.init(null, new TrustManager[]{SIMPLE_VERIFIER}, null);
|
context.init(null, new TrustManager[]{
|
||||||
|
getTrustHandler()
|
||||||
|
}, null);
|
||||||
sslFactory = context.getSocketFactory();
|
sslFactory = context.getSocketFactory();
|
||||||
return sslFactory;
|
return sslFactory;
|
||||||
} catch (KeyManagementException e) {
|
} catch (KeyManagementException e) {
|
||||||
@@ -113,8 +94,11 @@ public class HttpSslSupport {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
SSLContext context = getSSLContext(sslpv);
|
SSLContext context = getSSLContext(sslpv);
|
||||||
context.init(null, new TrustManager[]{SIMPLE_VERIFIER}, new java.security.SecureRandom());
|
ConfigurableTrustHandler trustHandler = getTrustHandler();
|
||||||
sslConnFactory = new SSLConnectionSocketFactory(context, SIMPLE_VERIFIER);
|
context.init(null, new TrustManager[]{
|
||||||
|
trustHandler
|
||||||
|
}, new java.security.SecureRandom());
|
||||||
|
sslConnFactory = new SSLConnectionSocketFactory(context, trustHandler);
|
||||||
return sslConnFactory;
|
return sslConnFactory;
|
||||||
} catch (KeyManagementException e) {
|
} catch (KeyManagementException e) {
|
||||||
throw new RuntimeException("初始化 SSLConnectionSocketFactory 失败", e);
|
throw new RuntimeException("初始化 SSLConnectionSocketFactory 失败", e);
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ import com.mgm.mcrm.appsetting.models.SysSetting;
|
|||||||
import com.mgm.mcrm.appsetting.services.SysSettingService;
|
import com.mgm.mcrm.appsetting.services.SysSettingService;
|
||||||
import com.mgm.mcrm.common.constants.SysCommon;
|
import com.mgm.mcrm.common.constants.SysCommon;
|
||||||
import com.mgm.mcrm.common.dtos.system.AppServerState;
|
import com.mgm.mcrm.common.dtos.system.AppServerState;
|
||||||
|
import com.mgm.mcrm.common.httpclient.HttpSslSupport;
|
||||||
import com.mgm.mcrm.common.jms.AppControlMsgSender;
|
import com.mgm.mcrm.common.jms.AppControlMsgSender;
|
||||||
import com.mgm.mcrm.common.utils.ExcelUtils;
|
import com.mgm.mcrm.common.utils.ExcelUtils;
|
||||||
|
import com.mgm.mcrm.common.utils.HttpUtil;
|
||||||
import com.mgm.mcrm.common.utils.NetworkUtil;
|
import com.mgm.mcrm.common.utils.NetworkUtil;
|
||||||
|
import com.mgm.mcrm.common.utils.SOAPUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -29,6 +32,14 @@ public class ConfigListener implements ApplicationListener<ApplicationStartedEve
|
|||||||
private String httpApiServers;
|
private String httpApiServers;
|
||||||
@Value("${allow_ip}")
|
@Value("${allow_ip}")
|
||||||
private String allowIP;
|
private String allowIP;
|
||||||
|
|
||||||
|
@Value("${trust-store.http-support.skip-validation}")
|
||||||
|
private boolean skipHttpSupportValidation;
|
||||||
|
@Value("${trust-store.http-util.skip-validation}")
|
||||||
|
private boolean skipHttpUtilValidation;
|
||||||
|
@Value("${trust-store.soap-util.skip-validation}")
|
||||||
|
private boolean skipSoapUtilValidation;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SysSettingService sysSettingService;
|
private SysSettingService sysSettingService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -49,6 +60,12 @@ public class ConfigListener implements ApplicationListener<ApplicationStartedEve
|
|||||||
SysCommon.loadApiServerConfig(httpApiServers);
|
SysCommon.loadApiServerConfig(httpApiServers);
|
||||||
SysCommon.loadAllowIPConfig(allowIP);
|
SysCommon.loadAllowIPConfig(allowIP);
|
||||||
ExcelUtils.loadExcelDefines();
|
ExcelUtils.loadExcelDefines();
|
||||||
|
|
||||||
|
//-- Set Trust Manager validation
|
||||||
|
HttpSslSupport.setSkipValidation(skipHttpSupportValidation);
|
||||||
|
HttpUtil.setSkipValidation(skipHttpUtilValidation);
|
||||||
|
SOAPUtil.setSkipValidation(skipSoapUtilValidation);
|
||||||
|
|
||||||
if(ctrlMsgSender!=null) {
|
if(ctrlMsgSender!=null) {
|
||||||
AppServerState serverState = SysCommon.refreshAppServerState();
|
AppServerState serverState = SysCommon.refreshAppServerState();
|
||||||
SysCommon.jmsRunning = ctrlMsgSender.sendMessage("REQ_SYNC_SERVER_STATE",serverState);
|
SysCommon.jmsRunning = ctrlMsgSender.sendMessage("REQ_SYNC_SERVER_STATE",serverState);
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.mgm.mcrm.common.services;
|
||||||
|
|
||||||
|
import com.mgm.mcrm.common.utils.LogUtil;
|
||||||
|
import org.apache.commons.lang3.Strings;
|
||||||
|
|
||||||
|
import javax.net.ssl.HostnameVerifier;
|
||||||
|
import javax.net.ssl.SSLSession;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ConfigurableTrustHandler implements X509TrustManager, HostnameVerifier {
|
||||||
|
private final boolean skipValidation;
|
||||||
|
private final X509TrustManager defaultTrustManager;
|
||||||
|
private final List<String> allowedServers;
|
||||||
|
|
||||||
|
public ConfigurableTrustHandler(boolean skipValidation, X509TrustManager defaultTrustManager, List<String> allowedServers ) {
|
||||||
|
this.skipValidation = skipValidation;
|
||||||
|
this.defaultTrustManager = defaultTrustManager;
|
||||||
|
this.allowedServers = allowedServers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||||
|
if (skipValidation) {
|
||||||
|
return new java.security.cert.X509Certificate[0];
|
||||||
|
}else{
|
||||||
|
return defaultTrustManager != null ? defaultTrustManager.getAcceptedIssuers() : new java.security.cert.X509Certificate[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkServerTrusted(java.security.cert.X509Certificate[] chain,
|
||||||
|
String authType) throws java.security.cert.CertificateException {
|
||||||
|
if (!skipValidation && defaultTrustManager != null) {
|
||||||
|
defaultTrustManager.checkServerTrusted(chain, authType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkClientTrusted(java.security.cert.X509Certificate[] chain,
|
||||||
|
String authType) throws java.security.cert.CertificateException {
|
||||||
|
if (!skipValidation && defaultTrustManager != null) {
|
||||||
|
defaultTrustManager.checkClientTrusted(chain, authType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession paramSSLSession) {
|
||||||
|
boolean isAllow = skipValidation;
|
||||||
|
if(!skipValidation && allowedServers!=null && !allowedServers.isEmpty()){
|
||||||
|
for(String allowItem:allowedServers) {
|
||||||
|
if(Strings.CI.startsWith(hostname, allowItem)) {
|
||||||
|
isAllow=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!skipValidation && !isAllow) {
|
||||||
|
LogUtil.warn(ConfigurableTrustHandler.class, "API Server of ["+hostname+"] is not allowed");
|
||||||
|
}
|
||||||
|
return isAllow;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,13 +38,15 @@ public class MGMEsbLimoApiService {
|
|||||||
|
|
||||||
|
|
||||||
public HttpResponseResult invokeLimoOverrider(
|
public HttpResponseResult invokeLimoOverrider(
|
||||||
String overriderIdOrName
|
String overriderIdOrName,
|
||||||
|
String employeeId
|
||||||
) throws Exception {
|
) throws Exception {
|
||||||
|
|
||||||
JSONObject requestObj = new JSONObject();
|
JSONObject requestObj = new JSONObject();
|
||||||
Map<String, String> requestHeader = new HashMap<>();
|
Map<String, String> requestHeader = new HashMap<>();
|
||||||
|
|
||||||
requestObj.put("OverriderIdOrName", "%");
|
requestObj.put("OverriderIdOrName", "%");
|
||||||
|
// requestObj.put("EmployeeId", employeeId);
|
||||||
|
|
||||||
return mgmEsbApiService.invokeESBAPI(ESB_LIMO_API_TYPE, API_GET_LIMO_OVERRIDER, requestObj, "POST", requestHeader);
|
return mgmEsbApiService.invokeESBAPI(ESB_LIMO_API_TYPE, API_GET_LIMO_OVERRIDER, requestObj, "POST", requestHeader);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
package com.mgm.mcrm.common.utils;
|
package com.mgm.mcrm.common.utils;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.mgm.mcrm.common.constants.SysCommon;
|
import com.mgm.mcrm.common.constants.SysCommon;
|
||||||
|
import com.mgm.mcrm.common.dtos.config.ApiGatewaySetting;
|
||||||
import com.mgm.mcrm.common.dtos.http_util.HttpRequestDefine;
|
import com.mgm.mcrm.common.dtos.http_util.HttpRequestDefine;
|
||||||
import com.mgm.mcrm.common.dtos.http_util.HttpResponseResult;
|
import com.mgm.mcrm.common.dtos.http_util.HttpResponseResult;
|
||||||
|
import com.mgm.mcrm.common.services.ConfigurableTrustHandler;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.Strings;
|
import org.apache.commons.lang3.Strings;
|
||||||
import org.apache.hc.client5.http.classic.methods.HttpDelete;
|
import org.apache.hc.client5.http.classic.methods.HttpDelete;
|
||||||
import org.apache.hc.client5.http.classic.methods.HttpGet;
|
import org.apache.hc.client5.http.classic.methods.HttpGet;
|
||||||
@@ -35,19 +42,30 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
|
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import javax.net.ssl.TrustManager;
|
import javax.net.ssl.TrustManager;
|
||||||
import javax.net.ssl.X509TrustManager;
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.cert.CertificateException;
|
import java.util.HashMap;
|
||||||
import java.security.cert.X509Certificate;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class HttpUtil {
|
public class HttpUtil {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private static boolean skipValidation=true;
|
||||||
|
|
||||||
|
private static ConfigurableTrustHandler trustHandler=null;
|
||||||
|
|
||||||
|
public static ConfigurableTrustHandler getTrustHandler(){
|
||||||
|
if(trustHandler==null){
|
||||||
|
trustHandler =new ConfigurableTrustHandler(skipValidation, SysCommon.getDefaultTrustManager(), SysCommon.getHttpApiServers());
|
||||||
|
}
|
||||||
|
return trustHandler;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------
|
//-----------
|
||||||
public static HttpResponseResult processHttpRequest(HttpRequestDefine request) {
|
public static HttpResponseResult processHttpRequest(HttpRequestDefine request) {
|
||||||
HttpResponseResult responseResult = new HttpResponseResult();
|
HttpResponseResult responseResult = new HttpResponseResult();
|
||||||
@@ -200,33 +218,7 @@ public class HttpUtil {
|
|||||||
// 这里可以填两种值 TLS和LLS , 具体差别可以自行搜索
|
// 这里可以填两种值 TLS和LLS , 具体差别可以自行搜索
|
||||||
SSLContext sc = SSLContext.getInstance("TLS");
|
SSLContext sc = SSLContext.getInstance("TLS");
|
||||||
// 构建新对象
|
// 构建新对象
|
||||||
X509TrustManager manager = new X509TrustManager() {
|
ConfigurableTrustHandler manager = getTrustHandler();
|
||||||
@Override
|
|
||||||
public void checkServerTrusted(X509Certificate[] chain, String arg1) throws CertificateException {
|
|
||||||
if (chain == null || chain.length == 0) {
|
|
||||||
throw new IllegalArgumentException("No server certificates provided");
|
|
||||||
}
|
|
||||||
for (X509Certificate cert : chain) {
|
|
||||||
cert.checkValidity();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void checkClientTrusted(X509Certificate[] chain, String arg1) throws CertificateException {
|
|
||||||
if (chain == null || chain.length == 0) {
|
|
||||||
throw new CertificateException("No client certificates provided");
|
|
||||||
}
|
|
||||||
for (X509Certificate cert : chain) {
|
|
||||||
cert.checkValidity(); // 检查证书是否在有效期内
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public X509Certificate[] getAcceptedIssuers() {
|
|
||||||
return new java.security.cert.X509Certificate[] {};
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
sc.init(null, new TrustManager[]{manager}, null);
|
sc.init(null, new TrustManager[]{manager}, null);
|
||||||
return sc;
|
return sc;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -259,4 +251,48 @@ public class HttpUtil {
|
|||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HttpResponseResult invokeGatewayEmailAPI(JSONObject requestContent, String requestMethod,
|
||||||
|
MultipartFile[] files, ApiGatewaySetting apiGatewaySetting) throws Exception {
|
||||||
|
String serverUrl = apiGatewaySetting.getNotificationProxyUrl();
|
||||||
|
int timeoutTime = apiGatewaySetting.getRequestTimeout();
|
||||||
|
|
||||||
|
HttpRequestDefine requestDef = new HttpRequestDefine();
|
||||||
|
String apiLink="/send_email";
|
||||||
|
String requestUrl = serverUrl + apiLink;
|
||||||
|
Map<String, String> requestHeader = new HashMap<String,String>();
|
||||||
|
requestHeader.put("Origin", "MGM_CRM_CMS");
|
||||||
|
requestHeader.put("application-id", apiGatewaySetting.getNotificationAppId());
|
||||||
|
requestHeader.put("authorization", apiGatewaySetting.getNotificationAppSecret());
|
||||||
|
requestHeader.put("Content-type", "application/json;charset=utf-8");
|
||||||
|
|
||||||
|
requestDef.setRequestUrl(requestUrl);
|
||||||
|
requestDef.setRequestMethod(requestMethod);
|
||||||
|
requestDef.setTimeout(timeoutTime);
|
||||||
|
requestDef.setHeaders(requestHeader);
|
||||||
|
if(files!=null) {
|
||||||
|
requestDef.setUpload(true);
|
||||||
|
requestDef.setUploadFile(files[0]);
|
||||||
|
requestDef.setFileParaName(files[0].getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(requestContent!=null) {
|
||||||
|
requestDef.setEntityContent(requestContent.toString());
|
||||||
|
}else {
|
||||||
|
requestDef.setEntityContent("");
|
||||||
|
}
|
||||||
|
// --
|
||||||
|
LogUtil.info(HttpUtil.class, "[invoke Proxy Email API] start request:" + requestDef.getRequestUrl());
|
||||||
|
HttpResponseResult httpResult =HttpUtil.processHttpRequest(requestDef);
|
||||||
|
httpResult.setRequestContent(requestDef.getEntityContent());
|
||||||
|
Gson gson = new Gson();
|
||||||
|
LogUtil.info(HttpUtil.class, "[invoke Proxy Email API]getRequestUrl:"+gson.toJson(requestDef.getRequestUrl()));
|
||||||
|
LogUtil.info(HttpUtil.class, "[invoke Proxy Email API]getHeaders:"+gson.toJson(requestDef.getHeaders()));
|
||||||
|
LogUtil.info(HttpUtil.class, "[invoke Proxy Email API]getRequestMethod:"+gson.toJson(requestDef.getRequestMethod()));
|
||||||
|
LogUtil.info(HttpUtil.class, "[invoke Proxy Email API]getEntityContent:"+gson.toJson(requestContent));
|
||||||
|
LogUtil.info(HttpUtil.class, "[invoke Proxy Email API]getStatusCode:"+gson.toJson(httpResult.getStatusCode()));
|
||||||
|
LogUtil.info(HttpUtil.class, "[invoke Proxy Email API]getErrorMessage:"+gson.toJson(httpResult.getErrorMessage()));
|
||||||
|
LogUtil.info(HttpUtil.class, "[invoke Proxy Email API]getResponseContent:"+gson.toJson(httpResult.getResponseContent()));
|
||||||
|
return httpResult;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ package com.mgm.mcrm.common.utils;
|
|||||||
|
|
||||||
import com.mgm.mcrm.common.constants.SysCommon;
|
import com.mgm.mcrm.common.constants.SysCommon;
|
||||||
import com.mgm.mcrm.common.dtos.config.ApiGatewaySetting;
|
import com.mgm.mcrm.common.dtos.config.ApiGatewaySetting;
|
||||||
|
import com.mgm.mcrm.common.services.ConfigurableTrustHandler;
|
||||||
import jakarta.xml.bind.JAXBContext;
|
import jakarta.xml.bind.JAXBContext;
|
||||||
import jakarta.xml.bind.JAXBException;
|
import jakarta.xml.bind.JAXBException;
|
||||||
import jakarta.xml.bind.Marshaller;
|
import jakarta.xml.bind.Marshaller;
|
||||||
import jakarta.xml.bind.Unmarshaller;
|
import jakarta.xml.bind.Unmarshaller;
|
||||||
import jakarta.xml.soap.*;
|
import jakarta.xml.soap.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.hc.core5.http.message.BasicHeader;
|
|
||||||
import org.w3c.dom.NamedNodeMap;
|
import org.w3c.dom.NamedNodeMap;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
@@ -17,9 +19,6 @@ import javax.xml.namespace.QName;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.security.KeyStore;
|
|
||||||
import java.security.cert.CertificateException;
|
|
||||||
import java.security.cert.X509Certificate;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -40,6 +39,19 @@ public class SOAPUtil {
|
|||||||
* 参考---》http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?op=getWeatherbyCityName
|
* 参考---》http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?op=getWeatherbyCityName
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private static boolean skipValidation=true;
|
||||||
|
|
||||||
|
private static ConfigurableTrustHandler trustHandler=null;
|
||||||
|
|
||||||
|
public static ConfigurableTrustHandler getTrustHandler(){
|
||||||
|
if(trustHandler==null){
|
||||||
|
trustHandler =new ConfigurableTrustHandler(skipValidation, SysCommon.getDefaultTrustManager(), SysCommon.getSoapServers());
|
||||||
|
}
|
||||||
|
return trustHandler;
|
||||||
|
}
|
||||||
|
|
||||||
public static String getWebServiceSOAP(String url, String action, StringBuffer sendSoapString, ApiGatewaySetting apiGatewaySetting){
|
public static String getWebServiceSOAP(String url, String action, StringBuffer sendSoapString, ApiGatewaySetting apiGatewaySetting){
|
||||||
String soap = sendSoapString.toString();
|
String soap = sendSoapString.toString();
|
||||||
if (soap == null) {
|
if (soap == null) {
|
||||||
@@ -52,8 +64,9 @@ public class SOAPUtil {
|
|||||||
HttpURLConnection conn = (HttpURLConnection) soapUrl.openConnection();
|
HttpURLConnection conn = (HttpURLConnection) soapUrl.openConnection();
|
||||||
if(isHttps) {
|
if(isHttps) {
|
||||||
HttpsURLConnection https = (HttpsURLConnection) conn;
|
HttpsURLConnection https = (HttpsURLConnection) conn;
|
||||||
trustAllHosts(https);
|
ConfigurableTrustHandler manager = getTrustHandler();
|
||||||
https.setHostnameVerifier(checkSoapServer);
|
trustAllHosts(https,manager);
|
||||||
|
https.setHostnameVerifier(manager);
|
||||||
}
|
}
|
||||||
conn.setUseCaches(false);
|
conn.setUseCaches(false);
|
||||||
conn.setDoInput(true);
|
conn.setDoInput(true);
|
||||||
@@ -107,8 +120,9 @@ public class SOAPUtil {
|
|||||||
HttpURLConnection conn = (HttpURLConnection) soapUrl.openConnection();
|
HttpURLConnection conn = (HttpURLConnection) soapUrl.openConnection();
|
||||||
if(isHttps) {
|
if(isHttps) {
|
||||||
HttpsURLConnection https = (HttpsURLConnection) conn;
|
HttpsURLConnection https = (HttpsURLConnection) conn;
|
||||||
trustAllHosts(https);
|
ConfigurableTrustHandler manager = getTrustHandler();
|
||||||
https.setHostnameVerifier(checkSoapServer);
|
trustAllHosts(https,manager);
|
||||||
|
https.setHostnameVerifier(manager);
|
||||||
}
|
}
|
||||||
conn.setUseCaches(false);
|
conn.setUseCaches(false);
|
||||||
conn.setDoInput(true);
|
conn.setDoInput(true);
|
||||||
@@ -163,62 +177,13 @@ public class SOAPUtil {
|
|||||||
return soapMessage;
|
return soapMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
|
|
||||||
private X509TrustManager defaultTrustManager=null;
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
// 获取 JVM 默认的 TrustManager 作为核心校验逻辑
|
|
||||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
|
||||||
tmf.init((KeyStore) null); // 使用系统的默认信任库
|
|
||||||
for (TrustManager tm : tmf.getTrustManagers()) {
|
|
||||||
if (tm instanceof X509TrustManager) {
|
|
||||||
defaultTrustManager = (X509TrustManager) tm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}catch(Exception err){
|
|
||||||
LogUtil.error(SOAPUtil.class,"Default X509TrustManager not found["+err.getMessage()+"]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public X509Certificate[] getAcceptedIssuers() {
|
|
||||||
return defaultTrustManager.getAcceptedIssuers();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
|
||||||
defaultTrustManager.checkServerTrusted(chain,authType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
|
||||||
defaultTrustManager.checkClientTrusted(chain,authType);
|
|
||||||
}
|
|
||||||
}};
|
|
||||||
|
|
||||||
|
|
||||||
|
private static SSLSocketFactory trustAllHosts(HttpsURLConnection conn,ConfigurableTrustHandler manager) {
|
||||||
private static final HostnameVerifier checkSoapServer = new HostnameVerifier() {
|
|
||||||
public boolean verify(String hostname, SSLSession session) {
|
|
||||||
boolean isServerAllow = SysCommon.isAllowSoapServer(hostname);
|
|
||||||
if(isServerAllow==false) {
|
|
||||||
LogUtil.warn(SOAPUtil.class, "SOAP Server of ["+hostname+"] is not allowed");
|
|
||||||
}
|
|
||||||
return SysCommon.isAllowSoapServer(hostname);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信任所有
|
|
||||||
* @param connection
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static SSLSocketFactory trustAllHosts(HttpsURLConnection conn) {
|
|
||||||
SSLSocketFactory oldFactory = conn.getSSLSocketFactory();
|
SSLSocketFactory oldFactory = conn.getSSLSocketFactory();
|
||||||
try {
|
try {
|
||||||
SSLContext sc = SSLContext.getInstance("TLS");
|
SSLContext sc = SSLContext.getInstance("TLS");
|
||||||
sc.init(null, trustAllCerts, new java.security.SecureRandom());
|
sc.init(null, new TrustManager[]{manager}, new java.security.SecureRandom());
|
||||||
SSLSocketFactory newFactory = sc.getSocketFactory();
|
SSLSocketFactory newFactory = sc.getSocketFactory();
|
||||||
conn.setSSLSocketFactory(newFactory);
|
conn.setSSLSocketFactory(newFactory);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -486,7 +486,7 @@ public class SendEmail {
|
|||||||
+format.format(bookView.getCheckoutDate())+
|
+format.format(bookView.getCheckoutDate())+
|
||||||
"</td> " +
|
"</td> " +
|
||||||
"<td>"
|
"<td>"
|
||||||
+(bookView.getBookerTeam()!=null?bookView.getBookerTeam():"")+
|
+(bookView.getSectionName()!=null?bookView.getSectionName():"")+
|
||||||
"</td> " +
|
"</td> " +
|
||||||
"<td>"
|
"<td>"
|
||||||
+bookView.getCreatedBy()+
|
+bookView.getCreatedBy()+
|
||||||
@@ -651,7 +651,7 @@ public class SendEmail {
|
|||||||
+format.format(bookView.getCheckoutDate())+
|
+format.format(bookView.getCheckoutDate())+
|
||||||
"</td> " +
|
"</td> " +
|
||||||
"<td>"
|
"<td>"
|
||||||
+(bookView.getBookerTeam()!=null?bookView.getBookerTeam():"")+
|
+(bookView.getSectionName()!=null?bookView.getSectionName():"")+
|
||||||
"</td> " +
|
"</td> " +
|
||||||
"<td>"
|
"<td>"
|
||||||
+bookView.getCreatedBy()+
|
+bookView.getCreatedBy()+
|
||||||
@@ -835,7 +835,7 @@ public class SendEmail {
|
|||||||
+format.format(book.getCheckoutDate())+
|
+format.format(book.getCheckoutDate())+
|
||||||
"</td> " +
|
"</td> " +
|
||||||
"<td>"
|
"<td>"
|
||||||
+(viewBook.getBookerTeam()!=null?viewBook.getBookerTeam():"")+
|
+(viewBook.getSectionName()!=null?viewBook.getSectionName():"")+
|
||||||
"</td> " +
|
"</td> " +
|
||||||
"<td>"
|
"<td>"
|
||||||
+originBook.getCreatedBy()+
|
+originBook.getCreatedBy()+
|
||||||
@@ -916,7 +916,6 @@ public class SendEmail {
|
|||||||
|
|
||||||
public static Email sendCancelEmail(Bookings book,BookingsView bookingsView,Email emailObj,String userId,String userName,String emailTo) {
|
public static Email sendCancelEmail(Bookings book,BookingsView bookingsView,Email emailObj,String userId,String userName,String emailTo) {
|
||||||
String content1 = cancelEmailTemp;
|
String content1 = cancelEmailTemp;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
JavaMailSenderImpl sender = new JavaMailSenderImpl();
|
JavaMailSenderImpl sender = new JavaMailSenderImpl();
|
||||||
if(StringUtils.isEmpty(mail_smtp_host)) {
|
if(StringUtils.isEmpty(mail_smtp_host)) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.mgm.mcrm.limo.controller;
|
package com.mgm.mcrm.limo.controller;
|
||||||
|
|
||||||
import com.auth0.jwt.JWT;
|
import com.auth0.jwt.JWT;
|
||||||
|
import com.mgm.mcrm.authorization.dtos.LoginUserInfo;
|
||||||
import com.mgm.mcrm.authorization.models.SysRouterPermission;
|
import com.mgm.mcrm.authorization.models.SysRouterPermission;
|
||||||
import com.mgm.mcrm.authorization.services.MgmUserService;
|
import com.mgm.mcrm.authorization.services.MgmUserService;
|
||||||
import com.mgm.mcrm.authorization.services.SysGroupPermissionService;
|
import com.mgm.mcrm.authorization.services.SysGroupPermissionService;
|
||||||
@@ -25,13 +26,10 @@ import org.apache.commons.lang3.Strings;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/limo")
|
@RequestMapping("/api/app/limo")
|
||||||
public class LimoController {
|
public class LimoController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -70,12 +68,21 @@ public class LimoController {
|
|||||||
return limoService.getLocation(location);
|
return limoService.getLocation(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getCarType")
|
@PostMapping(value = "/getLocation", produces = "application/json;charset=UTF-8",
|
||||||
|
consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public BaseApiResponse<List<LimoPointOfInterestItem>> getLocationPost(
|
||||||
|
@RequestBody(required = false) GetLimoLocationRequest request) throws Exception {
|
||||||
|
return limoService.getLocation(request == null ? null : request.getLocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/getCarType", method = {RequestMethod.GET, RequestMethod.POST},
|
||||||
|
produces = "application/json;charset=UTF-8")
|
||||||
public BaseApiResponse<List<LimoCarTypeItem>> getCarType() throws Exception {
|
public BaseApiResponse<List<LimoCarTypeItem>> getCarType() throws Exception {
|
||||||
return limoService.getCarType();
|
return limoService.getCarType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getGreetType")
|
@RequestMapping(value = "/getGreetType", method = {RequestMethod.GET, RequestMethod.POST},
|
||||||
|
produces = "application/json;charset=UTF-8")
|
||||||
public BaseApiResponse<List<LimoGreetTypeItem>> getGreetType() throws Exception {
|
public BaseApiResponse<List<LimoGreetTypeItem>> getGreetType() throws Exception {
|
||||||
return limoService.getGreetType();
|
return limoService.getGreetType();
|
||||||
}
|
}
|
||||||
@@ -244,7 +251,17 @@ public class LimoController {
|
|||||||
|
|
||||||
@GetMapping("/getOverrider")
|
@GetMapping("/getOverrider")
|
||||||
public GetOverriderInfoResponse getLimoOverriderInfo(
|
public GetOverriderInfoResponse getLimoOverriderInfo(
|
||||||
GetLimoBookingGetOverriderRequest request) throws Exception {
|
GetLimoBookingGetOverriderRequest request, HttpServletRequest req) throws Exception {
|
||||||
|
String token = req.getHeader("Authorization");
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(token)) {
|
||||||
|
if (token.startsWith("Bearer ")) {
|
||||||
|
token = token.substring(7);
|
||||||
|
}
|
||||||
|
String userId = JWT.decode(token).getClaim("login_id").asString();
|
||||||
|
request.setEmployeeId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
return limoService.getLimoOverriderData(request);
|
return limoService.getLimoOverriderData(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,4 +5,5 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class GetLimoBookingGetOverriderRequest {
|
public class GetLimoBookingGetOverriderRequest {
|
||||||
private String OverriderInfo;
|
private String OverriderInfo;
|
||||||
|
private String EmployeeId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.mgm.mcrm.limo.dtos.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GetLimoLocationRequest {
|
||||||
|
private String location;
|
||||||
|
}
|
||||||
@@ -181,6 +181,7 @@ public class LimoService {
|
|||||||
try {
|
try {
|
||||||
GetLimoBookingGetOverriderRequest overriderRequest = new GetLimoBookingGetOverriderRequest();
|
GetLimoBookingGetOverriderRequest overriderRequest = new GetLimoBookingGetOverriderRequest();
|
||||||
overriderRequest.setOverriderInfo(overRiderId);
|
overriderRequest.setOverriderInfo(overRiderId);
|
||||||
|
overriderRequest.setEmployeeId(userId);
|
||||||
GetOverriderInfoResponse overriderResponse = getLimoOverriderData(overriderRequest);
|
GetOverriderInfoResponse overriderResponse = getLimoOverriderData(overriderRequest);
|
||||||
if (Strings.CI.equals("OK", overriderResponse.getStatusCode())
|
if (Strings.CI.equals("OK", overriderResponse.getStatusCode())
|
||||||
&& CollectionUtils.isNotEmpty(overriderResponse.getRecords())) {
|
&& CollectionUtils.isNotEmpty(overriderResponse.getRecords())) {
|
||||||
@@ -849,7 +850,7 @@ public class LimoService {
|
|||||||
//通过ESB接口 获取到Overriver,当Booking不够分的时候填入Overrider
|
//通过ESB接口 获取到Overriver,当Booking不够分的时候填入Overrider
|
||||||
public GetOverriderInfoResponse getLimoOverriderData(GetLimoBookingGetOverriderRequest request)
|
public GetOverriderInfoResponse getLimoOverriderData(GetLimoBookingGetOverriderRequest request)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
HttpResponseResult httpResponseResult = mgmEsbLimoApiService.invokeLimoOverrider(request.getOverriderInfo());
|
HttpResponseResult httpResponseResult = mgmEsbLimoApiService.invokeLimoOverrider(request.getOverriderInfo(), request.getEmployeeId());
|
||||||
|
|
||||||
if (httpResponseResult.getStatusCode() != 200) {
|
if (httpResponseResult.getStatusCode() != 200) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/deviceToken")
|
@RequestMapping("/api/app/deviceToken")
|
||||||
public class SysLogDeviceTokenController {
|
public class SysLogDeviceTokenController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.mgm.mcrm.common.annotation.logging.OperationLog;
|
|||||||
import com.mgm.mcrm.common.constants.SysCommon;
|
import com.mgm.mcrm.common.constants.SysCommon;
|
||||||
import com.mgm.mcrm.common.dtos.BaseApiResponse;
|
import com.mgm.mcrm.common.dtos.BaseApiResponse;
|
||||||
import com.mgm.mcrm.notification.dtos.request.ChangeNotificationStatusRequest;
|
import com.mgm.mcrm.notification.dtos.request.ChangeNotificationStatusRequest;
|
||||||
|
import com.mgm.mcrm.notification.dtos.request.CountNotificationByUserIdRequest;
|
||||||
import com.mgm.mcrm.notification.dtos.request.SendNotificationRequest;
|
import com.mgm.mcrm.notification.dtos.request.SendNotificationRequest;
|
||||||
import com.mgm.mcrm.notification.dtos.response.ChangeNotificationStatusResponse;
|
import com.mgm.mcrm.notification.dtos.response.ChangeNotificationStatusResponse;
|
||||||
import com.mgm.mcrm.notification.dtos.response.CountNotificationByUserIdResponse;
|
import com.mgm.mcrm.notification.dtos.response.CountNotificationByUserIdResponse;
|
||||||
@@ -31,7 +32,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/notification")
|
@RequestMapping("/api/app/notification")
|
||||||
public class NotificationController {
|
public class NotificationController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -67,10 +68,26 @@ public class NotificationController {
|
|||||||
|
|
||||||
@GetMapping("/count_notification_by_user_id")
|
@GetMapping("/count_notification_by_user_id")
|
||||||
public CountNotificationByUserIdResponse countNotificationByUserId(HttpServletRequest request) {
|
public CountNotificationByUserIdResponse countNotificationByUserId(HttpServletRequest request) {
|
||||||
|
return countNotificationByUserIdCore(request, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/count_notification_by_user_id",
|
||||||
|
produces = "application/json;charset=UTF-8",
|
||||||
|
consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public CountNotificationByUserIdResponse countNotificationByUserIdPost(
|
||||||
|
HttpServletRequest request,
|
||||||
|
@RequestBody(required = false) CountNotificationByUserIdRequest body) {
|
||||||
|
return countNotificationByUserIdCore(request, body == null ? null : body.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
private CountNotificationByUserIdResponse countNotificationByUserIdCore(
|
||||||
|
HttpServletRequest request, String requestUserId) {
|
||||||
String token = request.getHeader("Authorization");
|
String token = request.getHeader("Authorization");
|
||||||
String userId = JWT.decode(token).getClaim("login_id").asString();
|
String userId = StringUtils.isNotBlank(requestUserId)
|
||||||
|
? requestUserId
|
||||||
|
: JWT.decode(token).getClaim("login_id").asString();
|
||||||
String groupName = JWT.decode(token).getClaim("group_name").asString();
|
String groupName = JWT.decode(token).getClaim("group_name").asString();
|
||||||
return notificationService.countNotificationByUserId(userId,groupName);
|
return notificationService.countNotificationByUserId(userId, groupName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value="/change_status", produces = "application/json;charset=UTF-8",consumes = MediaType.APPLICATION_JSON_VALUE)
|
@PostMapping(value="/change_status", produces = "application/json;charset=UTF-8",consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
|||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
package com.mgm.mcrm.notification.dtos.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CountNotificationByUserIdRequest {
|
||||||
|
private String userId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.mgm.mcrm.notification.dtos.request;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后端A转发过来的发送邮件参数。
|
||||||
|
* showTemp 为 HTML 正文,content 为纯文本备用正文。
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class EmailProxyRequest {
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
private int type;
|
||||||
|
private String field;
|
||||||
|
private String bookIds;
|
||||||
|
private int propertyId;
|
||||||
|
private String subject;
|
||||||
|
private String content;
|
||||||
|
private String showTemp;
|
||||||
|
private String sender;
|
||||||
|
private String to;
|
||||||
|
private String cc;
|
||||||
|
private String createdBy;
|
||||||
|
private String updatedBy;
|
||||||
|
private String createdAt;
|
||||||
|
private String updatedAt;
|
||||||
|
}
|
||||||
@@ -11,7 +11,6 @@ import com.mgm.mcrm.booking.repositories.BookingViewDao;
|
|||||||
import com.mgm.mcrm.common.dtos.BaseApiResponse;
|
import com.mgm.mcrm.common.dtos.BaseApiResponse;
|
||||||
import com.mgm.mcrm.common.dtos.mgm_api.UserInfoApiRecord;
|
import com.mgm.mcrm.common.dtos.mgm_api.UserInfoApiRecord;
|
||||||
import com.mgm.mcrm.common.utils.DateTimeUtil;
|
import com.mgm.mcrm.common.utils.DateTimeUtil;
|
||||||
import com.mgm.mcrm.common.utils.SendEmail;
|
|
||||||
import com.mgm.mcrm.logging.services.SysLogBookingService;
|
import com.mgm.mcrm.logging.services.SysLogBookingService;
|
||||||
import com.mgm.mcrm.notification.models.CfgEmailTemplate;
|
import com.mgm.mcrm.notification.models.CfgEmailTemplate;
|
||||||
import com.mgm.mcrm.notification.models.Email;
|
import com.mgm.mcrm.notification.models.Email;
|
||||||
@@ -45,6 +44,8 @@ public class EmailTemplateService {
|
|||||||
private BookingDao bookingDao;
|
private BookingDao bookingDao;
|
||||||
@Resource
|
@Resource
|
||||||
private OtherRoomStatusDao roomStatusDao;
|
private OtherRoomStatusDao roomStatusDao;
|
||||||
|
@Resource
|
||||||
|
private SendEmailService sendEmailService;
|
||||||
|
|
||||||
private static String emailTemp =
|
private static String emailTemp =
|
||||||
"<div>{{title}}</div>"+
|
"<div>{{title}}</div>"+
|
||||||
@@ -71,7 +72,7 @@ public class EmailTemplateService {
|
|||||||
List<CfgEmailTemplate> getEmailList = generateEmailTemplate(idString);
|
List<CfgEmailTemplate> getEmailList = generateEmailTemplate(idString);
|
||||||
boolean res = false;
|
boolean res = false;
|
||||||
if(!getEmailList.isEmpty()) {
|
if(!getEmailList.isEmpty()) {
|
||||||
res = SendEmail.sendOtherBookingEmail(getEmailList.getFirst());
|
res = sendEmailService.sendOtherBookingEmail(getEmailList.getFirst());
|
||||||
String[] ids = emailTemplate.getBookIds().split(";");
|
String[] ids = emailTemplate.getBookIds().split(";");
|
||||||
ArrayList<Long> idList = new ArrayList<>();
|
ArrayList<Long> idList = new ArrayList<>();
|
||||||
List<Email> emailList = new ArrayList<>();
|
List<Email> emailList = new ArrayList<>();
|
||||||
|
|||||||
@@ -0,0 +1,907 @@
|
|||||||
|
package com.mgm.mcrm.notification.services;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.mgm.mcrm.booking.models.Bookings;
|
||||||
|
import com.mgm.mcrm.booking.models.BookingsView;
|
||||||
|
import com.mgm.mcrm.common.dtos.EumnApprovalStatus;
|
||||||
|
import com.mgm.mcrm.common.dtos.config.ApiGatewaySetting;
|
||||||
|
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.notification.dtos.request.EmailProxyRequest;
|
||||||
|
import com.mgm.mcrm.notification.models.CfgEmailTemplate;
|
||||||
|
import com.mgm.mcrm.notification.models.Email;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
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.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SendEmailService {
|
||||||
|
|
||||||
|
@Value("${notification.default-email-sender}")
|
||||||
|
private String defaultEmailSender;
|
||||||
|
|
||||||
|
@Value("${notification.default-email-receiver}")
|
||||||
|
private String defaultEmailReceiver;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ApiGatewaySetting apiGatewaySetting;
|
||||||
|
|
||||||
|
private static final String emailTemp = "<div>Submission Date & Time:{{ttime}}</div>"+
|
||||||
|
"<div>Submitted User:{{tuser}}</div>"+
|
||||||
|
"<br><br>" +
|
||||||
|
"<table border=\"1\" align=\"left\" cellspacing=\"0\" cellpadding=\"5\" width=\"auto\" style=\"font-family: Avenir, Helvetica, sans-serif;font-weight:500;background-color:#ffffff;color:#000000;border: 0;white-space: nowrap;width:auto;\">\r\n" +
|
||||||
|
" <thead style=\"color:#000000;font-size:14px;padding:10px 40px 0 40px;line-height:32px;background-color: #c8e2b6;white-space: nowrap;margin: 20px 0;\">\r\n" +
|
||||||
|
" <tr>\r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Conf#\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Booking Status\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Member ID\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Member Name\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Tier\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Property\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Room Type\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Sharer\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Original C/I\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Original C/O\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th style=\"background-color:#FFFF00;\">\r\n" +
|
||||||
|
" Extending C/O\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" </tr> \r\n" +
|
||||||
|
" </thead>\r\n" +
|
||||||
|
" <tbody style=\"color:#000000;font-size:14px;padding:10px 40px 0 40px;line-height:32px;white-space: nowrap;\">\r\n" +
|
||||||
|
" {{tbody}}"+
|
||||||
|
" </tbody>\r\n" +
|
||||||
|
"</table>";
|
||||||
|
|
||||||
|
private static final String emailApprovalTemp = "<div>Submission Date & Time:{{ttime}}</div>"+
|
||||||
|
"<div>Submitted and Approver:{{tuser}}</div>"+
|
||||||
|
"<br><br>" +
|
||||||
|
"<table border=\"1\" align=\"left\" cellspacing=\"0\" cellpadding=\"5\" width=\"auto\" style=\"font-family: Avenir, Helvetica, sans-serif;font-weight:500;background-color:#ffffff;color:#000000;border: 0;white-space: nowrap;width:auto;\">\r\n" +
|
||||||
|
" <thead style=\"color:#000000;font-size:14px;padding:10px 40px 0 40px;line-height:32px;background-color: #c8e2b6;white-space: nowrap;margin: 20px 0;\">\r\n" +
|
||||||
|
" <tr>\r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Booking Status\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Conf#\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Member ID\r\n" +
|
||||||
|
" </th>\r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Member Name\r\n" +
|
||||||
|
" </th>\r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Tier\r\n" +
|
||||||
|
" </th>\r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Property\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Room Type\r\n" +
|
||||||
|
" </th>\r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Sharer\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Type\r\n" +
|
||||||
|
" </th>\r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Requested C/I\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Requested C/O\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th style=\"background-color:#FFFF00;\">\r\n" +
|
||||||
|
" Approved Property\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th style=\"background-color:#FFFF00;\">\r\n" +
|
||||||
|
" Approved Room Type\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th style=\"background-color:#FFFF00;\">\r\n" +
|
||||||
|
" Approved C/I\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th style=\"background-color:#FFFF00;\">\r\n" +
|
||||||
|
" Approved C/O\r\n" +
|
||||||
|
" </th> \r\n" +" <th>\r\n" +
|
||||||
|
" Booker Team\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Booker ID\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Booker Name\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Approval Remark\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Remark\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" </tr> \r\n" +
|
||||||
|
" </thead>\r\n" +
|
||||||
|
" <tbody style=\"color:#000000;font-size:14px;padding:10px 40px 0 40px;line-height:32px;white-space: nowrap;\">\r\n" +
|
||||||
|
" {{tbody}}"+
|
||||||
|
" </tbody>\r\n" +
|
||||||
|
"</table>";
|
||||||
|
|
||||||
|
private static final String emailNewApprovalTemp = "<div>Submission Date & Time:{{ttime}}</div>"+
|
||||||
|
"<div>Submitted and Approver:{{tuser}}</div>"+
|
||||||
|
"<br><br>" +
|
||||||
|
"{{content}}"+
|
||||||
|
"<table border=\"1\" align=\"left\" cellspacing=\"0\" cellpadding=\"5\" width=\"auto\" style=\"font-family: Avenir, Helvetica, sans-serif;font-weight:500;background-color:#ffffff;color:#000000;border: 0;white-space: nowrap;width:auto;\">\r\n" +
|
||||||
|
" <thead style=\"color:#000000;font-size:14px;padding:10px 40px 0 40px;line-height:32px;background-color: #c8e2b6;white-space: nowrap;margin: 20px 0;\">\r\n" +
|
||||||
|
" <tr>\r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Booking Status\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Member ID\r\n" +
|
||||||
|
" </th>\r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Member Name\r\n" +
|
||||||
|
" </th>\r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Tier\r\n" +
|
||||||
|
" </th>\r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Property\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Room Type\r\n" +
|
||||||
|
" </th>\r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Sharer\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Type\r\n" +
|
||||||
|
" </th>\r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Requested C/I\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Requested C/O\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Booker Team\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Booker ID\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Booker Name\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Approval Remark\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Remark\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" </tr> \r\n" +
|
||||||
|
" </thead>\r\n" +
|
||||||
|
" <tbody style=\"color:#000000;font-size:14px;padding:10px 40px 0 40px;line-height:32px;white-space: nowrap;\">\r\n" +
|
||||||
|
" {{tbody}}"+
|
||||||
|
" </tbody>\r\n" +
|
||||||
|
"</table>";
|
||||||
|
|
||||||
|
private static final String cancelEmailTemp = "<div>Submission Date & Time:{{ttime}}</div>"+
|
||||||
|
"<div>Submitted User:{{tuser}}</div>"+
|
||||||
|
"<br><br>" +
|
||||||
|
"{{content}}"+
|
||||||
|
"<table border=\"1\" align=\"left\" cellspacing=\"0\" cellpadding=\"5\" width=\"auto\" style=\"font-family: Avenir, Helvetica, sans-serif;font-weight:500;background-color:#ffffff;color:#000000;border: 0;white-space: nowrap;width:auto;\">\r\n" +
|
||||||
|
" <thead style=\"color:#000000;font-size:14px;padding:10px 40px 0 40px;line-height:32px;background-color: #c8e2b6;white-space: nowrap;margin: 20px 0;\">\r\n" +
|
||||||
|
" <tr>\r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Conf#\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Booking Status\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Member ID\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Member Name\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Tier\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th >\r\n" +
|
||||||
|
" Property\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Room Type\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Sharer\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Type\r\n" +
|
||||||
|
" </th>\r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Original C/I\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th>\r\n" +
|
||||||
|
" Original C/O\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th style=\"background-color:#FFFF00;\">\r\n" +
|
||||||
|
" Change C/I\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" <th style=\"background-color:#FFFF00;\">\r\n" +
|
||||||
|
" Change C/O\r\n" +
|
||||||
|
" </th> \r\n" +
|
||||||
|
" </tr> \r\n" +
|
||||||
|
" </thead>\r\n" +
|
||||||
|
" <tbody style=\"color:#000000;font-size:14px;padding:10px 40px 0 40px;line-height:32px;white-space: nowrap;\">\r\n" +
|
||||||
|
" {{tbody}}"+
|
||||||
|
" </tbody>\r\n" +
|
||||||
|
"</table>";
|
||||||
|
|
||||||
|
public Email sendExtendEmail(Bookings book, BookingsView originBook, Email emailObj, String userId, String userName, String emailTo) {
|
||||||
|
String content1 = emailTemp;
|
||||||
|
try {
|
||||||
|
EmailProxyRequest emailRequest = new EmailProxyRequest();
|
||||||
|
emailRequest.setTo(StringUtils.isNotBlank(emailTo)?emailTo: defaultEmailReceiver);
|
||||||
|
emailRequest.setSender(defaultEmailSender);
|
||||||
|
|
||||||
|
String subTitle = "";
|
||||||
|
emailRequest.setSubject("[Urgent] Extension Request from Mobile CRM APP"+subTitle);
|
||||||
|
|
||||||
|
SimpleDateFormat sf = new SimpleDateFormat("dd-MMM-yyyy HH:mm");
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
|
||||||
|
String RequestDate = sf.format(new Date());
|
||||||
|
|
||||||
|
String content2 = "";
|
||||||
|
String tTime = RequestDate;
|
||||||
|
userId = !StringUtils.isEmpty(userId)?userId:"";
|
||||||
|
userName = !StringUtils.isEmpty(userName)?userName:"";
|
||||||
|
String tUser = userId+" "+userName;
|
||||||
|
String operaStatus = Strings.CS.replace(book.getLastOperaStatus(), "_", " ");
|
||||||
|
|
||||||
|
content2 += "<tr>"+
|
||||||
|
"<td>"
|
||||||
|
+book.getConfirmationNo()+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+operaStatus+
|
||||||
|
"</td> " +
|
||||||
|
"<td >"
|
||||||
|
+book.getPlayerId()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+book.getMemberLastName()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(originBook.getMemberTier()!=null?originBook.getMemberTier():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(originBook.getPropertyName()!=null?originBook.getPropertyName():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(originBook.getRoom()!=null?originBook.getRoom():"")+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+(originBook.getSharerName()!=null?originBook.getSharerName():"")+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+format.format(originBook.getCheckinDate())+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+format.format(originBook.getCheckoutDate())+
|
||||||
|
"</td> " +
|
||||||
|
"<td style=\"background-color:#FFFF00;\">"
|
||||||
|
+format.format(book.getCheckoutDate())+
|
||||||
|
"</td> " +
|
||||||
|
"</tr> ";
|
||||||
|
|
||||||
|
content1 = content1.replace("{{tbody}}", content2);
|
||||||
|
content1 = content1.replace("{{ttime}}", tTime);
|
||||||
|
content1 = content1.replace("{{tuser}}", tUser);
|
||||||
|
emailRequest.setShowTemp(content1);
|
||||||
|
emailRequest.setContent(content1);
|
||||||
|
JSONObject emailJson = new JSONObject();
|
||||||
|
emailJson.put("conf", book.getConfirmationNo());
|
||||||
|
emailJson.put("memberId", book.getPlayerId());
|
||||||
|
emailJson.put("memberName", book.getMemberLastName());
|
||||||
|
emailJson.put("tier", originBook.getMemberTier());
|
||||||
|
emailJson.put("property", originBook.getPropertyName());
|
||||||
|
emailJson.put("roomType", originBook.getRoom());
|
||||||
|
emailJson.put("checkin", format.format(originBook.getCheckinDate()));
|
||||||
|
emailJson.put("checkout", format.format(originBook.getCheckoutDate()));
|
||||||
|
emailJson.put("extCheckout", format.format(book.getCheckoutDate()));
|
||||||
|
|
||||||
|
emailObj.setSendObject(emailJson.toJSONString());
|
||||||
|
emailObj.setContent(content1);
|
||||||
|
emailObj.setSendTo(emailRequest.getTo());
|
||||||
|
HttpResponseResult httpResult = HttpUtil.invokeGatewayEmailAPI((JSONObject) JSON.toJSON(emailRequest), "POST", null, apiGatewaySetting);
|
||||||
|
String resultMsg = this.extractResultFromResponse(httpResult);
|
||||||
|
if(StringUtils.isBlank(resultMsg)){
|
||||||
|
emailObj.setStatus(1);
|
||||||
|
LogUtil.info(SendEmailService.class, "---mgmEmail.sendExtendEmail--OK!");
|
||||||
|
}else{
|
||||||
|
emailObj.setStatus(0);
|
||||||
|
emailObj.setMessage("Send Email to ["+emailRequest.getTo()+"] Failed:"+resultMsg);
|
||||||
|
LogUtil.error(SendEmailService.class, "---mgmEmail.sendExtendEmail--Failed!"+resultMsg);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(SendEmailService.class,"---mgmEmail.sendExtenEmail--Exception-->>"+e.getMessage());
|
||||||
|
emailObj.setMessage(e.getMessage());
|
||||||
|
emailObj.setStatus(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Email sendApprovalNewEmail(Bookings book,BookingsView bookView,Email emailObj,String userId,String userName,boolean isOverBook,boolean isConnectRoom,String emailTo) {
|
||||||
|
String content1 = emailNewApprovalTemp;
|
||||||
|
try {
|
||||||
|
EmailProxyRequest emailRequest = new EmailProxyRequest();
|
||||||
|
emailRequest.setTo(StringUtils.isNotBlank(emailTo)?emailTo: defaultEmailReceiver);
|
||||||
|
emailRequest.setSender(defaultEmailSender);
|
||||||
|
|
||||||
|
String mainTitle;
|
||||||
|
if(isConnectRoom) {
|
||||||
|
mainTitle = "[R2/Y2]";
|
||||||
|
}else if(isOverBook) {
|
||||||
|
mainTitle = "[Overbook]";
|
||||||
|
}else {
|
||||||
|
mainTitle = "[Urgent]";
|
||||||
|
}
|
||||||
|
emailRequest.setSubject(mainTitle+"Waitlist Approval from Mobile CRM APP"); // 标题
|
||||||
|
|
||||||
|
SimpleDateFormat sf = new SimpleDateFormat("dd-MMM-yyyy HH:mm");
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
|
||||||
|
String RequestDate = sf.format(new Date());
|
||||||
|
|
||||||
|
String content2 = "";
|
||||||
|
String tTime = RequestDate;
|
||||||
|
userId = !StringUtils.isEmpty(userId)?userId:"";
|
||||||
|
userName = !StringUtils.isEmpty(userName)?userName:"";
|
||||||
|
String tUser = userId+" "+userName;
|
||||||
|
String approvalStatus = EumnApprovalStatus.getApprovalStatusByDBValue(book.getApproveStatus());
|
||||||
|
|
||||||
|
content2 += "<tr>"+
|
||||||
|
"<td>"
|
||||||
|
+approvalStatus+
|
||||||
|
"</td> "+
|
||||||
|
"<td >"
|
||||||
|
+bookView.getPlayerId()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+bookView.getMemberLastName()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookView.getMemberTier()!=null?bookView.getMemberTier():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookView.getPropertyName()!=null?bookView.getPropertyName():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookView.getRoom()!=null?bookView.getRoom():"")+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+(bookView.getSharerName()!=null?bookView.getSharerName():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+"New"+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+format.format(bookView.getCheckinDate())+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+format.format(bookView.getCheckoutDate())+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookView.getSectionName()!=null?bookView.getSectionName():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+bookView.getCreatedBy()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+bookView.getCreatedByName()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookView.getApprovalRemark()!=null?bookView.getApprovalRemark():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookView.getRemark()!=null?bookView.getRemark():"")+
|
||||||
|
"</td> " +
|
||||||
|
"</tr> ";
|
||||||
|
|
||||||
|
String mailContent = isConnectRoom?"Please create TT/YY booking for below approved booking<br><br>":"";
|
||||||
|
content1 = content1.replace("{{tbody}}", content2);
|
||||||
|
content1 = content1.replace("{{ttime}}", tTime);
|
||||||
|
content1 = content1.replace("{{tuser}}", tUser);
|
||||||
|
content1 = content1.replace("{{content}}", mailContent);
|
||||||
|
emailRequest.setShowTemp(content1);
|
||||||
|
emailRequest.setContent(content1);
|
||||||
|
JSONObject emailJson = new JSONObject();
|
||||||
|
emailJson.put("approvalStatus", approvalStatus);
|
||||||
|
emailJson.put("memberId", bookView.getPlayerId());
|
||||||
|
emailJson.put("memberName", bookView.getMemberLastName());
|
||||||
|
emailJson.put("tier", bookView.getMemberTier());
|
||||||
|
emailJson.put("property", bookView.getPropertyName());
|
||||||
|
emailJson.put("roomType", bookView.getRoom());
|
||||||
|
emailJson.put("type", "New");
|
||||||
|
emailJson.put("checkin", format.format(bookView.getCheckinDate()));
|
||||||
|
emailJson.put("checkout", format.format(bookView.getCheckoutDate()));
|
||||||
|
emailJson.put("bookerTeam", bookView.getBookerTeam());
|
||||||
|
emailJson.put("bookerId", bookView.getCreatedBy());
|
||||||
|
emailJson.put("bookerName", bookView.getCreatedByName());
|
||||||
|
emailJson.put("approvalRemark", bookView.getApprovalRemark());
|
||||||
|
emailJson.put("remark", bookView.getRemark());
|
||||||
|
|
||||||
|
emailObj.setSendObject(emailJson.toJSONString());
|
||||||
|
emailObj.setContent(content1);
|
||||||
|
emailObj.setSendTo(emailRequest.getTo());
|
||||||
|
|
||||||
|
HttpResponseResult httpResult = HttpUtil.invokeGatewayEmailAPI((JSONObject) JSON.toJSON(emailRequest), "POST", null, apiGatewaySetting);
|
||||||
|
String resultMsg = this.extractResultFromResponse(httpResult);
|
||||||
|
if(StringUtils.isBlank(resultMsg)){
|
||||||
|
emailObj.setStatus(1);
|
||||||
|
LogUtil.info(SendEmailService.class, "---mgmEmail.sendApprovalNewEmail--OK!");
|
||||||
|
}else{
|
||||||
|
emailObj.setStatus(0);
|
||||||
|
emailObj.setMessage("Send Email to ["+emailRequest.getTo()+"] Failed:"+resultMsg);
|
||||||
|
LogUtil.error(SendEmailService.class, "---mgmEmail.sendApprovalNewEmail--Failed!"+resultMsg);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(SendEmailService.class,"---mgmEmail.sendApprovalNewEmail--Exception-->>"+e.getMessage());
|
||||||
|
emailObj.setMessage(e.getMessage());
|
||||||
|
emailObj.setStatus(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Email sendCreateR2Y2NewEmail(Bookings book,BookingsView bookView,Email emailObj,String userId,String userName,boolean isOverBook,boolean isConnectRoom,String emailTo) {
|
||||||
|
String content1 = emailNewApprovalTemp;
|
||||||
|
try {
|
||||||
|
|
||||||
|
EmailProxyRequest emailRequest = new EmailProxyRequest();
|
||||||
|
emailRequest.setTo(StringUtils.isNotBlank(emailTo)?emailTo: defaultEmailReceiver);
|
||||||
|
emailRequest.setSender(defaultEmailSender);
|
||||||
|
|
||||||
|
String mainTitle;
|
||||||
|
if(isConnectRoom) {
|
||||||
|
mainTitle = "[R2/Y2]";
|
||||||
|
}else if(isOverBook) {
|
||||||
|
mainTitle = "[Overbook]";
|
||||||
|
}else {
|
||||||
|
mainTitle = "[Urgent]";
|
||||||
|
}
|
||||||
|
emailRequest.setSubject(mainTitle+"Booking Creation from Mobile CRM APP"); // 标题
|
||||||
|
|
||||||
|
SimpleDateFormat sf = new SimpleDateFormat("dd-MMM-yyyy HH:mm");
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
|
||||||
|
String RequestDate = sf.format(new Date());
|
||||||
|
|
||||||
|
String content2 = "";
|
||||||
|
String tTime = RequestDate;
|
||||||
|
userId = !StringUtils.isEmpty(userId)?userId:"";
|
||||||
|
userName = !StringUtils.isEmpty(userName)?userName:"";
|
||||||
|
String tUser = userId+" "+userName;
|
||||||
|
String approvalStatus = EumnApprovalStatus.getApprovalStatusByDBValue(book.getApproveStatus());
|
||||||
|
|
||||||
|
|
||||||
|
content2 += "<tr>"+
|
||||||
|
"<td>"
|
||||||
|
+approvalStatus+
|
||||||
|
"</td> "+
|
||||||
|
"<td >"
|
||||||
|
+bookView.getPlayerId()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+bookView.getMemberLastName()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookView.getMemberTier()!=null?bookView.getMemberTier():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookView.getPropertyName()!=null?bookView.getPropertyName():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookView.getRoom()!=null?bookView.getRoom():"")+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+(bookView.getSharerName()!=null?bookView.getSharerName():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+"New"+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+format.format(bookView.getCheckinDate())+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+format.format(bookView.getCheckoutDate())+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookView.getSectionName()!=null?bookView.getSectionName():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+bookView.getCreatedBy()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+bookView.getCreatedByName()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookView.getApprovalRemark()!=null?bookView.getApprovalRemark():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookView.getRemark()!=null?bookView.getRemark():"")+
|
||||||
|
"</td> " +
|
||||||
|
"</tr> ";
|
||||||
|
|
||||||
|
String mailContent = isConnectRoom?"Please create TT/YY booking for below approved booking<br><br>":"";
|
||||||
|
content1 = content1.replace("{{tbody}}", content2);
|
||||||
|
content1 = content1.replace("{{ttime}}", tTime);
|
||||||
|
content1 = content1.replace("{{tuser}}", tUser);
|
||||||
|
content1 = content1.replace("{{content}}", mailContent);
|
||||||
|
emailRequest.setShowTemp(content1);
|
||||||
|
emailRequest.setContent(content1);
|
||||||
|
JSONObject emailJson = new JSONObject();
|
||||||
|
emailJson.put("approvalStatus", approvalStatus);
|
||||||
|
emailJson.put("memberId", bookView.getPlayerId());
|
||||||
|
emailJson.put("memberName", bookView.getMemberLastName());
|
||||||
|
emailJson.put("tier", bookView.getMemberTier());
|
||||||
|
emailJson.put("property", bookView.getPropertyName());
|
||||||
|
emailJson.put("roomType", bookView.getRoom());
|
||||||
|
emailJson.put("type", "New");
|
||||||
|
emailJson.put("checkin", format.format(bookView.getCheckinDate()));
|
||||||
|
emailJson.put("checkout", format.format(bookView.getCheckoutDate()));
|
||||||
|
emailJson.put("bookerTeam", bookView.getBookerTeam());
|
||||||
|
emailJson.put("bookerId", bookView.getCreatedBy());
|
||||||
|
emailJson.put("bookerName", bookView.getCreatedByName());
|
||||||
|
emailJson.put("approvalRemark", bookView.getApprovalRemark());
|
||||||
|
emailJson.put("remark", bookView.getRemark());
|
||||||
|
|
||||||
|
emailObj.setSendObject(emailJson.toJSONString());
|
||||||
|
emailObj.setContent(content1);
|
||||||
|
emailObj.setSendTo(emailRequest.getTo());
|
||||||
|
|
||||||
|
HttpResponseResult httpResult = HttpUtil.invokeGatewayEmailAPI((JSONObject) JSON.toJSON(emailRequest), "POST", null, apiGatewaySetting);
|
||||||
|
String resultMsg = this.extractResultFromResponse(httpResult);
|
||||||
|
if(StringUtils.isBlank(resultMsg)){
|
||||||
|
emailObj.setStatus(1);
|
||||||
|
LogUtil.info(SendEmailService.class, "---mgmEmail.sendApprovalNewEmail--OK!");
|
||||||
|
}else{
|
||||||
|
emailObj.setStatus(0);
|
||||||
|
emailObj.setMessage("Send Email to ["+emailRequest.getTo()+"] Failed:"+resultMsg);
|
||||||
|
LogUtil.error(SendEmailService.class, "---mgmEmail.sendApprovalNewEmail--Failed!"+resultMsg);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(SendEmailService.class,"---mgmEmail.sendApprovalNewEmail--Exception-->>"+e.getMessage());
|
||||||
|
emailObj.setMessage(e.getMessage());
|
||||||
|
emailObj.setStatus(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Email sendApprovalExtendEmail(Bookings book, BookingsView originBook, Email emailObj, String userId, String userName, BookingsView viewBook, boolean isOverBook, String emailTo) {
|
||||||
|
String content1 = emailApprovalTemp;
|
||||||
|
try {
|
||||||
|
EmailProxyRequest emailRequest = new EmailProxyRequest();
|
||||||
|
emailRequest.setTo(StringUtils.isNotBlank(emailTo)?emailTo: defaultEmailReceiver);
|
||||||
|
emailRequest.setSender(defaultEmailSender);
|
||||||
|
|
||||||
|
String subTitle = "";
|
||||||
|
String mainTitle = isOverBook?"[Overbook]":"[Urgent]";
|
||||||
|
emailRequest.setSubject(mainTitle+"Waitlist Approval from Mobile CRM APP"+subTitle); // 标题
|
||||||
|
|
||||||
|
SimpleDateFormat sf = new SimpleDateFormat("dd-MMM-yyyy HH:mm");
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
|
||||||
|
String RequestDate = sf.format(new Date());
|
||||||
|
|
||||||
|
String content2 = "";
|
||||||
|
String tTime = RequestDate;
|
||||||
|
userId = !StringUtils.isEmpty(userId)?userId:"";
|
||||||
|
userName = !StringUtils.isEmpty(userName)?userName:"";
|
||||||
|
String tUser = userId+" "+userName;
|
||||||
|
String approvalStatus = EumnApprovalStatus.getApprovalStatusByDBValue(book.getApproveStatus());
|
||||||
|
String changeProperty = "";
|
||||||
|
String changeRoom = "";
|
||||||
|
String changeCheckInDate = "";
|
||||||
|
if(!Strings.CS.equals(viewBook.getPropertyName(), originBook.getPropertyName()) ||
|
||||||
|
!Strings.CS.equals(viewBook.getRoom(), originBook.getRoom()) ||
|
||||||
|
viewBook.getCheckinDate().getTime()!=originBook.getCheckoutDate().getTime()) {
|
||||||
|
changeProperty = viewBook.getPropertyName()!=null?viewBook.getPropertyName():"";
|
||||||
|
changeRoom = viewBook.getRoom()!=null?viewBook.getRoom():"";
|
||||||
|
changeCheckInDate = viewBook.getCheckinDate()!=null?format.format(viewBook.getCheckinDate()):"";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
content2 += "<tr>"+
|
||||||
|
"<td>"
|
||||||
|
+approvalStatus+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+originBook.getConfirmationNo()+
|
||||||
|
"</td> "+
|
||||||
|
"<td >"
|
||||||
|
+originBook.getPlayerId()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+originBook.getMemberLastName()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(originBook.getMemberTier()!=null?originBook.getMemberTier():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(originBook.getPropertyName()!=null?originBook.getPropertyName():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(originBook.getRoom()!=null?originBook.getRoom():"")+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+(originBook.getSharerName()!=null?originBook.getSharerName():"")+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+"Extend"+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+format.format(originBook.getCheckinDate())+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+format.format(originBook.getCheckoutDate())+
|
||||||
|
"</td> " +
|
||||||
|
"<td style=\"background-color:#FFFF00;\">"
|
||||||
|
+changeProperty+
|
||||||
|
"</td> " +
|
||||||
|
"<td style=\"background-color:#FFFF00;\">"
|
||||||
|
+changeRoom+
|
||||||
|
"</td> " +
|
||||||
|
"<td style=\"background-color:#FFFF00;\">"
|
||||||
|
+changeCheckInDate+
|
||||||
|
"</td> " +
|
||||||
|
"<td style=\"background-color:#FFFF00;\">"
|
||||||
|
+format.format(book.getCheckoutDate())+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(viewBook.getSectionName()!=null?viewBook.getSectionName():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+originBook.getCreatedBy()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+originBook.getCreatedByName()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(book.getApprovalRemark()!=null?book.getApprovalRemark():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(book.getRemark()!=null?book.getRemark():"")+
|
||||||
|
"</td> " +
|
||||||
|
"</tr> ";
|
||||||
|
|
||||||
|
content1 = content1.replace("{{tbody}}", content2);
|
||||||
|
content1 = content1.replace("{{ttime}}", tTime);
|
||||||
|
content1 = content1.replace("{{tuser}}", tUser);
|
||||||
|
emailRequest.setShowTemp(content1);
|
||||||
|
emailRequest.setContent(content1);
|
||||||
|
JSONObject emailJson = new JSONObject();
|
||||||
|
emailJson.put("approvalStatus", approvalStatus);
|
||||||
|
emailJson.put("conf", book.getConfirmationNo());
|
||||||
|
emailJson.put("memberId", book.getPlayerId());
|
||||||
|
emailJson.put("memberName", book.getMemberLastName());
|
||||||
|
emailJson.put("tier", originBook.getMemberTier());
|
||||||
|
emailJson.put("property", originBook.getPropertyName());
|
||||||
|
emailJson.put("roomType", originBook.getRoom());
|
||||||
|
emailJson.put("type", "Extend");
|
||||||
|
emailJson.put("checkin", format.format(originBook.getCheckinDate()));
|
||||||
|
emailJson.put("checkout", format.format(originBook.getCheckoutDate()));
|
||||||
|
emailJson.put("changeProperty", changeProperty);
|
||||||
|
emailJson.put("changeRoom", changeRoom);
|
||||||
|
emailJson.put("changeCheckin", changeCheckInDate);
|
||||||
|
emailJson.put("changeCheckout", format.format(book.getCheckoutDate()));
|
||||||
|
emailJson.put("bookerTeam", viewBook.getBookerTeam());
|
||||||
|
emailJson.put("bookerId", originBook.getCreatedBy());
|
||||||
|
emailJson.put("bookerName", originBook.getCreatedByName());
|
||||||
|
emailJson.put("approvalRemark", book.getApprovalRemark());
|
||||||
|
emailJson.put("remark", book.getRemark());
|
||||||
|
|
||||||
|
emailObj.setSendObject(emailJson.toJSONString());
|
||||||
|
emailObj.setContent(content1);
|
||||||
|
emailObj.setSendTo(emailRequest.getTo());
|
||||||
|
|
||||||
|
HttpResponseResult httpResult = HttpUtil.invokeGatewayEmailAPI((JSONObject) JSON.toJSON(emailRequest), "POST", null, apiGatewaySetting);
|
||||||
|
String resultMsg = this.extractResultFromResponse(httpResult);
|
||||||
|
if(StringUtils.isBlank(resultMsg)){
|
||||||
|
emailObj.setStatus(1);
|
||||||
|
LogUtil.info(SendEmailService.class, "---mgmEmail.sendApprovalExtendEmail--OK!");
|
||||||
|
}else{
|
||||||
|
emailObj.setStatus(0);
|
||||||
|
emailObj.setMessage("Send Email to ["+emailRequest.getTo()+"] Failed:"+resultMsg);
|
||||||
|
LogUtil.error(SendEmailService.class, "---mgmEmail.sendApprovalExtendEmail--Failed!"+resultMsg);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(SendEmailService.class,"---mgmEmail.sendApprovalExtendEmail--Exception-->>"+e.getMessage());
|
||||||
|
emailObj.setMessage(e.getMessage());
|
||||||
|
emailObj.setStatus(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Email sendCancelEmail(Bookings book,BookingsView bookingsView,Email emailObj,String userId,String userName,String emailTo) {
|
||||||
|
String content1 = cancelEmailTemp;
|
||||||
|
|
||||||
|
try {
|
||||||
|
EmailProxyRequest emailRequest = new EmailProxyRequest();
|
||||||
|
emailRequest.setTo(StringUtils.isNotBlank(emailTo)?emailTo: defaultEmailReceiver);
|
||||||
|
emailRequest.setSender(defaultEmailSender);
|
||||||
|
|
||||||
|
String subTitle = "";
|
||||||
|
emailRequest.setSubject("[Urgent] Modify Request from Mobile CRM APP"+subTitle); // 标题
|
||||||
|
|
||||||
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String RequestDate = sf.format(new Date());
|
||||||
|
|
||||||
|
String tTime = RequestDate;
|
||||||
|
userId = !StringUtils.isEmpty(userId)?userId:"";
|
||||||
|
userName = !StringUtils.isEmpty(userName)?userName:"";
|
||||||
|
String tUser = userId+" "+userName;
|
||||||
|
String content2 = "";
|
||||||
|
userId = !StringUtils.isEmpty(userId)?userId:"";
|
||||||
|
userName = !StringUtils.isEmpty(userName)?userName:"";
|
||||||
|
String approvalStatus = EumnApprovalStatus.getApprovalStatusByDBValue(book.getApproveStatus());
|
||||||
|
|
||||||
|
content2 += "<tr>"+
|
||||||
|
"<td>"
|
||||||
|
+bookingsView.getConfirmationNo()+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+approvalStatus+
|
||||||
|
"</td> "+
|
||||||
|
"<td >"
|
||||||
|
+bookingsView.getPlayerId()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+bookingsView.getMemberLastName()+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookingsView.getTier()!=null?bookingsView.getTier():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookingsView.getPropertyName()!=null?bookingsView.getPropertyName():"")+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+(bookingsView.getRoom()!=null?bookingsView.getRoom():"")+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+(bookingsView.getSharerName()!=null?bookingsView.getSharerName():"")+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+"Cancel"+
|
||||||
|
"</td> "+
|
||||||
|
"<td>"
|
||||||
|
+format.format(bookingsView.getCheckinDate())+
|
||||||
|
"</td> " +
|
||||||
|
"<td>"
|
||||||
|
+format.format(bookingsView.getCheckoutDate())+
|
||||||
|
"</td> " +
|
||||||
|
"<td style=\"background-color:#FFFF00;\">"
|
||||||
|
+book.getChangeCheckinDate()+
|
||||||
|
"</td> " +
|
||||||
|
"<td style=\"background-color:#FFFF00;\">"
|
||||||
|
+book.getChangeCheckoutDate()+
|
||||||
|
"</td> ";
|
||||||
|
|
||||||
|
|
||||||
|
String content = "Please cancel Conf#"+book.getConfirmationNo()+" under "+book.getMemberLastName();
|
||||||
|
|
||||||
|
content1 = content1.replace("{{tbody}}", content2);
|
||||||
|
content1 = content1.replace("{{ttime}}", tTime);
|
||||||
|
content1 = content1.replace("{{tuser}}", tUser);
|
||||||
|
content1 = content1.replace("{{content}}", content);
|
||||||
|
emailRequest.setShowTemp(content1);
|
||||||
|
emailRequest.setContent(content1);
|
||||||
|
JSONObject emailJson = new JSONObject();
|
||||||
|
emailJson.put("conf", book.getConfirmationNo());
|
||||||
|
emailJson.put("memberId", book.getPlayerId());
|
||||||
|
emailJson.put("memberName", book.getMemberLastName());
|
||||||
|
|
||||||
|
emailObj.setSendObject(emailJson.toJSONString());
|
||||||
|
emailObj.setContent(content1);
|
||||||
|
emailObj.setSendTo(emailRequest.getTo());
|
||||||
|
|
||||||
|
HttpResponseResult httpResult = HttpUtil.invokeGatewayEmailAPI((JSONObject) JSON.toJSON(emailRequest), "POST", null, apiGatewaySetting);
|
||||||
|
String resultMsg = this.extractResultFromResponse(httpResult);
|
||||||
|
if(StringUtils.isBlank(resultMsg)){
|
||||||
|
emailObj.setStatus(1);
|
||||||
|
LogUtil.info(SendEmailService.class, "---mgmEmail.sendCancelEmail--OK!");
|
||||||
|
}else{
|
||||||
|
emailObj.setStatus(0);
|
||||||
|
emailObj.setMessage("Send Email to ["+emailRequest.getTo()+"] Failed:"+resultMsg);
|
||||||
|
LogUtil.error(SendEmailService.class, "---mgmEmail.sendCancelEmail--Failed!"+resultMsg);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(SendEmailService.class,"---mgmEmail.sendCancelEmail--Exception-->>"+e.getMessage());
|
||||||
|
emailObj.setMessage(e.getMessage());
|
||||||
|
emailObj.setStatus(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean sendOtherBookingEmail(CfgEmailTemplate emailTemplate) {
|
||||||
|
boolean status = false;
|
||||||
|
try {
|
||||||
|
EmailProxyRequest emailRequest = new EmailProxyRequest();
|
||||||
|
emailRequest.setTo(defaultEmailReceiver);
|
||||||
|
emailRequest.setSender(emailTemplate.getSender());
|
||||||
|
|
||||||
|
String subject = emailTemplate.getSubject();
|
||||||
|
subject = Strings.CI.replace(subject, "[TODAY]", DateTimeUtil.getCurrentDate("dd MMM"));
|
||||||
|
emailRequest.setSubject(subject); // 标题
|
||||||
|
emailRequest.setCc(emailTemplate.getCc());
|
||||||
|
emailRequest.setShowTemp(emailTemplate.getShowTemp());
|
||||||
|
emailRequest.setContent(emailTemplate.getShowTemp());
|
||||||
|
|
||||||
|
HttpResponseResult httpResult = HttpUtil.invokeGatewayEmailAPI((JSONObject) JSON.toJSON(emailRequest), "POST", null, apiGatewaySetting);
|
||||||
|
String resultMsg = this.extractResultFromResponse(httpResult);
|
||||||
|
if(StringUtils.isBlank(resultMsg)){
|
||||||
|
status=true;
|
||||||
|
LogUtil.info(SendEmailService.class, "---mgmEmail.sendOtherBookingEmail--OK!");
|
||||||
|
}else{
|
||||||
|
status=false;
|
||||||
|
LogUtil.error(SendEmailService.class, "send email failed:" + resultMsg);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(SendEmailService.class,"---mgmEmail.sendOtherBookingEmail--Exception-->>"+e.getMessage());
|
||||||
|
status=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String extractResultFromResponse(HttpResponseResult httpResult){
|
||||||
|
String result ="";
|
||||||
|
try{
|
||||||
|
JSONObject obj = JSONObject.parseObject(httpResult.getResponseContent());
|
||||||
|
if(obj.getBooleanValue("success")) {
|
||||||
|
result="";
|
||||||
|
}else {
|
||||||
|
if(obj.getString("message")!=null&&obj.getString("message")!="") {
|
||||||
|
result = obj.getString("message");
|
||||||
|
}else {
|
||||||
|
result = "System Error";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(Exception err){
|
||||||
|
result = err.getMessage();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -37,11 +37,11 @@ import com.mgm.mcrm.common.services.HttpService;
|
|||||||
import com.mgm.mcrm.common.services.MGMEsbApiService;
|
import com.mgm.mcrm.common.services.MGMEsbApiService;
|
||||||
import com.mgm.mcrm.common.utils.DateTimeUtil;
|
import com.mgm.mcrm.common.utils.DateTimeUtil;
|
||||||
import com.mgm.mcrm.common.utils.LogUtil;
|
import com.mgm.mcrm.common.utils.LogUtil;
|
||||||
import com.mgm.mcrm.common.utils.SendEmail;
|
|
||||||
import com.mgm.mcrm.logging.models.SysLogBooking;
|
import com.mgm.mcrm.logging.models.SysLogBooking;
|
||||||
import com.mgm.mcrm.logging.services.SysLogBookingService;
|
import com.mgm.mcrm.logging.services.SysLogBookingService;
|
||||||
import com.mgm.mcrm.notification.models.Email;
|
import com.mgm.mcrm.notification.models.Email;
|
||||||
import com.mgm.mcrm.notification.repositories.EmailDao;
|
import com.mgm.mcrm.notification.repositories.EmailDao;
|
||||||
|
import com.mgm.mcrm.notification.services.SendEmailService;
|
||||||
import com.mgm.mcrm.player.dtos.request.EtaRecordInfo;
|
import com.mgm.mcrm.player.dtos.request.EtaRecordInfo;
|
||||||
import com.mgm.mcrm.player.dtos.request.TodoCancelBookingRequest;
|
import com.mgm.mcrm.player.dtos.request.TodoCancelBookingRequest;
|
||||||
import com.mgm.mcrm.player.dtos.request.TodoChangeDateRequest;
|
import com.mgm.mcrm.player.dtos.request.TodoChangeDateRequest;
|
||||||
@@ -125,6 +125,9 @@ public class TodoService {
|
|||||||
@Resource
|
@Resource
|
||||||
private BookingMapper bookingMapper;
|
private BookingMapper bookingMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SendEmailService sendEmailService;
|
||||||
|
|
||||||
public GetDashboardResponse getTodoDashboard(String userId) throws Exception {
|
public GetDashboardResponse getTodoDashboard(String userId) throws Exception {
|
||||||
GetDashboardResponse result = new GetDashboardResponse();
|
GetDashboardResponse result = new GetDashboardResponse();
|
||||||
|
|
||||||
@@ -830,7 +833,7 @@ public class TodoService {
|
|||||||
bookingDao.save(booking);
|
bookingDao.save(booking);
|
||||||
processResult.setSuccess(true);
|
processResult.setSuccess(true);
|
||||||
processResult.setData(bookingMapper.entityToDto(booking));
|
processResult.setData(bookingMapper.entityToDto(booking));
|
||||||
bookingService.daylightReservationChangeDate(param, profile, false);
|
bookingService.daylightReservationChangeDate(param, profile, false, false);
|
||||||
|
|
||||||
LogUtil.info(TodoService.class, "[ChangeBookingDate] ID:"+bookingView.getDlReservationId());
|
LogUtil.info(TodoService.class, "[ChangeBookingDate] ID:"+bookingView.getDlReservationId());
|
||||||
|
|
||||||
@@ -855,7 +858,7 @@ public class TodoService {
|
|||||||
booking.setChangeCheckoutDate(coDate);
|
booking.setChangeCheckoutDate(coDate);
|
||||||
bookingView = this.getEmailInfo(bookingView, userId);
|
bookingView = this.getEmailInfo(bookingView, userId);
|
||||||
CfgSettings emailAddress = settingService.getSettingByKey(SysConstants.MGM_EMAIL_ADDRESS);
|
CfgSettings emailAddress = settingService.getSettingByKey(SysConstants.MGM_EMAIL_ADDRESS);
|
||||||
email = SendEmail.sendCancelEmail(booking, bookingView, email, userId, userName, emailAddress.getKeyValues());
|
email = sendEmailService.sendCancelEmail(booking, bookingView, email, userId, userName, emailAddress.getKeyValues());
|
||||||
if (email.getStatus() == 1) {
|
if (email.getStatus() == 1) {
|
||||||
processResult.setSuccess(true);
|
processResult.setSuccess(true);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -141,6 +141,15 @@ api-gateway:
|
|||||||
app-id: MCRM_APP
|
app-id: MCRM_APP
|
||||||
auth-code: securItykeyOfCrmapp87895312
|
auth-code: securItykeyOfCrmapp87895312
|
||||||
|
|
||||||
|
#============== Truststore Manager Setting ==============
|
||||||
|
trust-store:
|
||||||
|
http-support:
|
||||||
|
skip-validation: true
|
||||||
|
http-util:
|
||||||
|
skip-validation: true
|
||||||
|
soap-util:
|
||||||
|
skip-validation: true
|
||||||
|
|
||||||
sso:
|
sso:
|
||||||
callback:
|
callback:
|
||||||
login:
|
login:
|
||||||
@@ -157,7 +166,7 @@ host_name: mcrm
|
|||||||
adfs_request_timeout: 10000
|
adfs_request_timeout: 10000
|
||||||
adfs_login_timeout: 60000
|
adfs_login_timeout: 60000
|
||||||
|
|
||||||
allow_origin: "http://localhost:5173,http://127.0.0.1:5173,http://localhost:8080,MGM_CRM_APP,MGM_CRM_CMS,https://localhost:9085,http://localhost:8081,http://127.0.0.1:8081,https://localhost:9087/api/esb/proxy"
|
allow_origin: "http://localhost:5173,http://127.0.0.1:5173,http://localhost:8080,MGM_CRM_APP,MGM_CRM_CMS,https://localhost:9085,http://localhost:8081,http://127.0.0.1:8081,https://localhost:9087,https://localhost:9086,https://127.0.0.1:9086"
|
||||||
soap_servers: "http://localhost:5173,http://127.0.0.1:5173"
|
soap_servers: "http://localhost:5173,http://127.0.0.1:5173"
|
||||||
http_api_servers: "http://localhost:5173,http://127.0.0.1:5173,http://localhost:9087"
|
http_api_servers: "http://localhost:5173,http://127.0.0.1:5173,http://localhost:9087"
|
||||||
allow_ip: "0:0:0:0:0:0:0:1,127.0.0.1"
|
allow_ip: "0:0:0:0:0:0:0:1,127.0.0.1"
|
||||||
@@ -197,6 +206,8 @@ calendar:
|
|||||||
#==================APP Config===================
|
#==================APP Config===================
|
||||||
notification:
|
notification:
|
||||||
recent-hours: 6
|
recent-hours: 6
|
||||||
|
default-email-sender: test@test.com
|
||||||
|
default-email-receiver: missing@test.com
|
||||||
|
|
||||||
limo:
|
limo:
|
||||||
booking-draft:
|
booking-draft:
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user