first commit
This commit is contained in:
@@ -0,0 +1,327 @@
|
||||
package com.mgm.mcrm.reservation.controllers;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.mgm.mcrm.admin.models.SysUserView;
|
||||
import com.mgm.mcrm.authorization.dtos.LoginUserInfo;
|
||||
import com.mgm.mcrm.authorization.utils.JwtTokenUtil;
|
||||
import com.mgm.mcrm.common.dtos.DataTableResult;
|
||||
import com.mgm.mcrm.common.dtos.QueryFilter;
|
||||
import com.mgm.mcrm.common.dtos.ServiceResult;
|
||||
import com.mgm.mcrm.common.dtos.excelmodel.ExportDefine;
|
||||
import com.mgm.mcrm.logging.services.SysLogOperationService;
|
||||
import com.mgm.mcrm.reservation.dtos.BookingsDto;
|
||||
import com.mgm.mcrm.reservation.dtos.BookingsViewDto;
|
||||
import com.mgm.mcrm.reservation.dtos.request.BookingGetFollowUpNumRequest;
|
||||
import com.mgm.mcrm.reservation.dtos.request.OtherBookingGetByIdRequest;
|
||||
import com.mgm.mcrm.reservation.dtos.request.OtherPropertyPageRequest;
|
||||
import com.mgm.mcrm.reservation.dtos.response.BookingGetFollowUpNumResponse;
|
||||
import com.mgm.mcrm.reservation.dtos.response.BookingResponse;
|
||||
import com.mgm.mcrm.reservation.dtos.response.GetBookingResponse;
|
||||
import com.mgm.mcrm.reservation.mappers.BookingMapper;
|
||||
import com.mgm.mcrm.reservation.models.Bookings;
|
||||
import com.mgm.mcrm.reservation.models.BookingsView;
|
||||
import com.mgm.mcrm.reservation.services.BookingService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.mgm.mcrm.common.constants.SysCommon;
|
||||
import com.mgm.mcrm.common.constants.SysConstants;
|
||||
import com.mgm.mcrm.common.annotation.logging.OperationLog;
|
||||
import com.mgm.mcrm.common.annotation.security.CheckPermission;
|
||||
|
||||
|
||||
import com.mgm.mcrm.common.dtos.AjaxResult;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import com.mgm.mcrm.common.utils.ExcelUtils;
|
||||
import com.mgm.mcrm.common.utils.LogUtil;
|
||||
|
||||
@Tag(name = "Room Reservation", description = "APIs for Room Booking functions")
|
||||
@RestController
|
||||
@RequestMapping("/crm_api")
|
||||
public class BookingController {
|
||||
|
||||
@Resource
|
||||
private BookingService bookingService;
|
||||
@Resource
|
||||
private SysLogOperationService sysAuditLogService;
|
||||
@Resource
|
||||
private BookingMapper bookingMapper;
|
||||
|
||||
@CheckPermission(routerId="00403",permissionCode="ADD")
|
||||
@OperationLog(actionName="Create Booking", eventCode = "booking_create")
|
||||
@RequestMapping(value = "/app/booking/create", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public AjaxResult createBooking(HttpServletRequest request, @RequestBody Map<String,Object> booking) {
|
||||
boolean isSuccess = false;
|
||||
String processMessage="";
|
||||
String errorCode="";
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
//--
|
||||
//--
|
||||
processResult.setRequestData(booking);
|
||||
ServiceResult serviceResult = bookingService.createBooking(booking,request);
|
||||
isSuccess = serviceResult.isSuccess();
|
||||
if(isSuccess) {
|
||||
processMessage = "Create Successed";
|
||||
processResult.setData(serviceResult.getReturnData());
|
||||
}else {
|
||||
processMessage = "Create Failed with Error:"+serviceResult.getErrorMessage();
|
||||
errorCode = serviceResult.getErrorCode();
|
||||
}
|
||||
//--
|
||||
processResult.setSuccess(isSuccess);
|
||||
processResult.setErrorCode(errorCode);
|
||||
processResult.setMessage(processMessage);
|
||||
processResult.setLogMessage(LogUtil.getAjaxFormatLog(processResult, "Create Booking Record", new String[] {"name"}, new String[] {"id","name"}));
|
||||
return processResult;
|
||||
}
|
||||
|
||||
// @CheckPermission(routerId="00403",permissionCode="MODIFY")
|
||||
// @OperationLog(eventCode="booking_update",actionName="Update Booking")
|
||||
// @RequestMapping(value = "/app/booking/update", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
// public AjaxResult updateBooking(HttpServletRequest request, @RequestBody Bookings booking) {
|
||||
// boolean isSuccess = false;
|
||||
// String processMessage="";
|
||||
// String errorCode="";
|
||||
// AjaxResult processResult = new AjaxResult();
|
||||
// //--
|
||||
// AjaxResult validateResult = validateData(booking,new String[] {"lastLoginTime"}, new String[] {"lastLoginTime"});
|
||||
// if(validateResult.isSuccess()==false) {
|
||||
// return validateResult;
|
||||
// }else {
|
||||
// //SysUser sysUser = (SysUser)validateResult.getData();
|
||||
// //--
|
||||
// if(booking.getId()==null) {
|
||||
// errorCode = "ERR_ILLEGAL_DATA";
|
||||
// processMessage="Id can't be empty";
|
||||
// }else {
|
||||
// //--
|
||||
// processResult.setRequestData(booking);
|
||||
// SysUserView userInfo =SysCommon.parseUserFromToken(request);
|
||||
// if (userInfo != null) {
|
||||
// booking.setUpdatedBy(userInfo.getLoginId());
|
||||
// }
|
||||
//
|
||||
// ServiceResult serviceResult = bookingService.updateBooking(booking);
|
||||
// isSuccess = serviceResult.isSuccess();
|
||||
// if(isSuccess==true) {
|
||||
// processMessage = "Update Successed";
|
||||
// processResult.setData(serviceResult.getReturnData());
|
||||
// }else {
|
||||
// processMessage = "Update Failed with Error:"+serviceResult.getErrorMessage();
|
||||
// errorCode = serviceResult.getErrorCode();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //--
|
||||
// processResult.setSuccess(isSuccess);
|
||||
// processResult.setErrorCode(errorCode);
|
||||
// processResult.setMessage(processMessage);
|
||||
// processResult.setLogMessage(LogUtil.getAjaxFormatLog(processResult, "Update Booking Record", new String[] {"id","name"}, new String[] {"name"}));
|
||||
// return processResult;
|
||||
// }
|
||||
|
||||
@CheckPermission(routerId="00403",permissionCode="MODIFY")
|
||||
@OperationLog(eventCode="booking_update",actionName="Update Booking")
|
||||
@RequestMapping(value = "/app/booking/update_failed", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public ResponseEntity<GetBookingResponse> updateBooking(HttpServletRequest request, @RequestBody Bookings booking) {
|
||||
boolean isSuccess = false;
|
||||
String processMessage="";
|
||||
String errorCode="";
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
GetBookingResponse result = new GetBookingResponse();
|
||||
//--
|
||||
if(booking.getId()==null) {
|
||||
errorCode = "ERR_ILLEGAL_DATA";
|
||||
processMessage="Id can't be empty";
|
||||
}else {
|
||||
//--
|
||||
processResult.setRequestData(booking);
|
||||
LoginUserInfo userInfo = JwtTokenUtil.parseUserFromRequest(request);
|
||||
if (userInfo != null) {
|
||||
booking.setUpdatedBy(userInfo.getLoginId());
|
||||
}
|
||||
|
||||
ServiceResult serviceResult = bookingService.updateFailedBooking(booking);
|
||||
isSuccess = serviceResult.isSuccess();
|
||||
if(isSuccess) {
|
||||
processMessage = "Update Successed";
|
||||
result.setData(bookingMapper.toBookingDto(booking));
|
||||
}else {
|
||||
processMessage = "Update Failed with Error:"+serviceResult.getErrorMessage();
|
||||
errorCode = serviceResult.getErrorCode();
|
||||
}
|
||||
}
|
||||
//--
|
||||
result.setSuccess(isSuccess);
|
||||
result.setCode(errorCode);
|
||||
result.setMessage(processMessage);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/app/booking/get", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public ResponseEntity<GetBookingResponse> getBookingById(HttpServletRequest request, @RequestBody(required=false) OtherBookingGetByIdRequest otherBookingGetByIdRequest) {
|
||||
boolean isSuccess = false;
|
||||
String processMessage="";
|
||||
String errorCode="";
|
||||
GetBookingResponse result = new GetBookingResponse();
|
||||
//--
|
||||
BookingsDto booking = bookingService.getBookingById(otherBookingGetByIdRequest.getSearchId());
|
||||
if(booking!=null) {
|
||||
isSuccess = true;
|
||||
processMessage = "Query Successed";
|
||||
result.setData(booking);
|
||||
}else {
|
||||
processMessage = "Query Failed with Error.";
|
||||
errorCode = "ERR_DATA_NOT_FOUND";
|
||||
}
|
||||
//--
|
||||
result.setSuccess(isSuccess);
|
||||
result.setCode(errorCode);
|
||||
result.setMessage(processMessage);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/app/booking/get_follow_up_num", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public AjaxResult getFollowUpBookingNum(HttpServletRequest request, @RequestBody(required=false) BookingGetFollowUpNumRequest bookingGetFollowUpNumRequest) {
|
||||
boolean isSuccess = false;
|
||||
String processMessage="";
|
||||
String errorCode="";
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
//--
|
||||
BookingGetFollowUpNumResponse bookingNum = bookingService.getFollowUpBookingNum(bookingGetFollowUpNumRequest);
|
||||
if(bookingNum!=null) {
|
||||
isSuccess = true;
|
||||
processMessage = "Query Successed";
|
||||
processResult.setData(bookingNum);
|
||||
}else {
|
||||
isSuccess = false;
|
||||
processMessage = "Query Failed with Error.";
|
||||
errorCode = "ERR_DATA_NOT_FOUND";
|
||||
}
|
||||
//--
|
||||
processResult.setSuccess(isSuccess);
|
||||
processResult.setErrorCode(errorCode);
|
||||
processResult.setMessage(processMessage);
|
||||
return processResult;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/app/booking/get_page", produces = "application/json;charset=UTF-8")
|
||||
public ResponseEntity<BookingResponse> getBookingByPage(HttpServletRequest request,@RequestBody(required=false) OtherPropertyPageRequest otherPropertyPageRequest) throws Exception {
|
||||
//--
|
||||
if(StringUtils.isNotBlank(otherPropertyPageRequest.getPermissionId())) {
|
||||
String groupName = "NO_GROUP";
|
||||
LoginUserInfo loginUser = JwtTokenUtil.parseUserFromRequest(request);
|
||||
if(loginUser!=null) {
|
||||
if(loginUser.getId()!=null && SysConstants.SUPER_ADMIN_ID.equals(""+loginUser.getId())) {
|
||||
otherPropertyPageRequest.setPermissionId("");
|
||||
}else if(StringUtils.isNotBlank(loginUser.getGroupName())) {
|
||||
groupName = loginUser.getGroupName();
|
||||
}
|
||||
}
|
||||
otherPropertyPageRequest.setPermissionGroup(groupName);
|
||||
}
|
||||
BookingResponse result = processPageRequest(otherPropertyPageRequest);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/app/booking/export_excel")
|
||||
public void exportExcel(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
QueryFilter queryFilter =new QueryFilter(request);
|
||||
ExportDefine reportDef = null;
|
||||
String reportFileName = "WaitlistBooking.xlsx";
|
||||
List<String> columnData = new ArrayList<>();
|
||||
if(queryFilter.getString("export_type").contains( "waitlist")) {
|
||||
columnData = Arrays.asList((queryFilter.getString("columnData")).split(";"));
|
||||
}
|
||||
if(queryFilter.getString("export_type").equals( "waitlist")) {
|
||||
reportDef = ExcelUtils.getExportDefineByName("EXPORT_WAITLIST");
|
||||
reportFileName = "WaitlistBooking.xlsx";
|
||||
}else if(queryFilter.getString("export_type").equals("waitlist_gaming")) {
|
||||
reportDef = ExcelUtils.getExportDefineByName("EXPORT_WAITLIST_GAMING");
|
||||
reportFileName = "WaitlistBooking.xlsx";
|
||||
}else if(queryFilter.getString("export_type").equals( "failedlist")) {
|
||||
reportDef = ExcelUtils.getExportDefineByName("EXPORT_FAILED_LIST");
|
||||
reportFileName = "FailBooking.xlsx";
|
||||
}else {
|
||||
reportDef = ExcelUtils.getExportDefineByName("EXPORT_OTHER_BOOKING");
|
||||
reportFileName = "OtherBooking.xlsx";
|
||||
}
|
||||
if(reportDef!=null) {
|
||||
//--
|
||||
if(StringUtils.isNotBlank(queryFilter.getString("permissionId"))) {
|
||||
String groupName = "NO_GROUP";
|
||||
LoginUserInfo loginUser = JwtTokenUtil.parseUserFromRequest(request);
|
||||
if(loginUser!=null) {
|
||||
if(loginUser.getId()!=null && SysConstants.SUPER_ADMIN_ID.equals(""+loginUser.getId())) {
|
||||
queryFilter.setParaValue("permissionId", "");
|
||||
}else if(StringUtils.isNotBlank(loginUser.getGroupName())) {
|
||||
groupName = loginUser.getGroupName();
|
||||
}
|
||||
}
|
||||
queryFilter.setParaValue("permissionGroup", groupName);
|
||||
}
|
||||
//--
|
||||
String searchProperty = queryFilter.getString("searchPropertyCode");
|
||||
if(StringUtils.isNotBlank(searchProperty)) {
|
||||
String[] props = searchProperty.split(",");
|
||||
List<String> propsList = new ArrayList<String>();
|
||||
Collections.addAll(propsList, props);
|
||||
queryFilter.setParaValue("searchPropertyCode", propsList);
|
||||
}
|
||||
List<BookingsViewDto> listBooking = bookingService.listBookingViewToExport(queryFilter);
|
||||
|
||||
Map<String,List> exportData = new HashMap<>();
|
||||
exportData.put("masterData", listBooking);
|
||||
try {
|
||||
ExcelUtils.exportToResponse(reportDef, reportFileName, exportData ,null, response,request,columnData);
|
||||
}catch(Exception err) {
|
||||
ExcelUtils.errorResponse(err.getMessage(),request, response);
|
||||
}
|
||||
}else {
|
||||
ExcelUtils.errorResponse("No report defined",request, response);
|
||||
}
|
||||
}
|
||||
|
||||
private BookingResponse processPageRequest(OtherPropertyPageRequest otherPropertyPageRequest) throws Exception {
|
||||
boolean isSuccess = false;
|
||||
String processMessage="";
|
||||
String errorCode="";
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
BookingResponse result = new BookingResponse();
|
||||
DataTableResult<BookingsView> resultData = new DataTableResult<>();
|
||||
|
||||
resultData = bookingService.getBookingByPage(otherPropertyPageRequest);
|
||||
|
||||
isSuccess = true;
|
||||
if(isSuccess) {
|
||||
processMessage = "Query Successed";
|
||||
result.setData(resultData);
|
||||
}else {
|
||||
processMessage = "Query Failed with Error.";
|
||||
errorCode = "ERR_FAILED";
|
||||
}
|
||||
//--
|
||||
result.setSuccess(isSuccess);
|
||||
result.setCode(errorCode);
|
||||
result.setMessage(processMessage);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
package com.mgm.mcrm.reservation.controllers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.mgm.mcrm.admin.dtos.ResFileResult;
|
||||
import com.mgm.mcrm.common.dtos.QueryFilter;
|
||||
import com.mgm.mcrm.common.dtos.ServiceResult;
|
||||
import com.mgm.mcrm.common.dtos.dataimport.booking.OtherBookingImportRow;
|
||||
import com.mgm.mcrm.logging.services.SysLogOperationService;
|
||||
import com.mgm.mcrm.reservation.dtos.request.BookingUpdateFollowUpStatusRequest;
|
||||
import com.mgm.mcrm.reservation.dtos.request.BookingUpdateRoomStatusRequest;
|
||||
import com.mgm.mcrm.reservation.dtos.request.OtherPropertyCreateUpdateRequest;
|
||||
import com.mgm.mcrm.reservation.models.Bookings;
|
||||
import com.mgm.mcrm.reservation.services.OtherBookingService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.mgm.mcrm.common.annotation.logging.OperationLog;
|
||||
import com.mgm.mcrm.common.annotation.security.CheckPermission;
|
||||
|
||||
import com.mgm.mcrm.common.dtos.AjaxResult;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import com.mgm.mcrm.common.utils.ExcelUtils;
|
||||
import com.mgm.mcrm.common.utils.LogUtil;
|
||||
|
||||
@Tag(name = "Room Reservation", description = "APIs for Room Booking functions")
|
||||
@RestController
|
||||
@RequestMapping("/crm_api")
|
||||
public class OtherBookingController {
|
||||
|
||||
@Resource
|
||||
private OtherBookingService otherService;
|
||||
@Resource
|
||||
private SysLogOperationService sysAuditLogService;
|
||||
|
||||
@OperationLog(actionName="Update Batch Other Booking Room Status", eventCode = "other_booking_update")
|
||||
@RequestMapping(value = "/app/other_booking/update_batch_room_status", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public AjaxResult updateBatchRoomStatus(HttpServletRequest request, @RequestBody BookingUpdateRoomStatusRequest bookingUpdateRoomStatusRequest) throws Exception {
|
||||
boolean isSuccess = false;
|
||||
String processMessage="";
|
||||
String errorCode="";
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
String[] bookIds = bookingUpdateRoomStatusRequest.getBookId().split(";");
|
||||
String status = String.valueOf(bookingUpdateRoomStatusRequest.getStatus());
|
||||
processResult.setRequestData(bookIds);
|
||||
ServiceResult serviceResult = otherService.updateBatchRoomStatus(bookIds,status,request);
|
||||
isSuccess = serviceResult.isSuccess();
|
||||
if(isSuccess==true) {
|
||||
processMessage = "Update Successed";
|
||||
processResult.setData(serviceResult.getReturnData());
|
||||
}else {
|
||||
processMessage = "Update Failed with Error:"+serviceResult.getErrorMessage();
|
||||
errorCode = serviceResult.getErrorCode();
|
||||
}
|
||||
processResult.setSuccess(isSuccess);
|
||||
processResult.setErrorCode(errorCode);
|
||||
processResult.setMessage(processMessage);
|
||||
processResult.setLogMessage(LogUtil.getAjaxFormatLog(processResult, "Update Batch Other Booking Room Status", new String[] {"id","name"}, new String[] {"name"}));
|
||||
return processResult;
|
||||
}
|
||||
|
||||
@OperationLog(actionName="Update Batch Other Booking Follow Up Status", eventCode = "other_booking_update")
|
||||
@RequestMapping(value = "/app/other_booking/update_batch_follow_up_status", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public AjaxResult updateBatchFollowUpStatus(HttpServletRequest request, @RequestBody BookingUpdateFollowUpStatusRequest bookingUpdateFollowUpStatusRequest) throws Exception {
|
||||
boolean isSuccess = false;
|
||||
String processMessage="";
|
||||
String errorCode="";
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
String[] bookIds = bookingUpdateFollowUpStatusRequest.getBookId().split(";");
|
||||
String status = String.valueOf(bookingUpdateFollowUpStatusRequest.getStatus());
|
||||
processResult.setRequestData(bookIds);
|
||||
ServiceResult serviceResult = otherService.updateBatchFollowUpStatus(bookIds,status,request);
|
||||
isSuccess = serviceResult.isSuccess();
|
||||
if(isSuccess==true) {
|
||||
processMessage = "Update Successed";
|
||||
processResult.setData(serviceResult.getReturnData());
|
||||
}else {
|
||||
processMessage = "Update Failed with Error:"+serviceResult.getErrorMessage();
|
||||
errorCode = serviceResult.getErrorCode();
|
||||
}
|
||||
processResult.setSuccess(isSuccess);
|
||||
processResult.setErrorCode(errorCode);
|
||||
processResult.setMessage(processMessage);
|
||||
processResult.setLogMessage(LogUtil.getAjaxFormatLog(processResult, "Update Batch Other Booking Follow Up Status", new String[] {"id","name"}, new String[] {"name"}));
|
||||
return processResult;
|
||||
}
|
||||
|
||||
@CheckPermission(routerId="00404",permissionCode="ADD")
|
||||
@OperationLog(actionName="Create Other Property Booking", eventCode = "booking_other_create")
|
||||
@RequestMapping(value = "/app/other_booking/create", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public AjaxResult createBooking(HttpServletRequest request, @RequestBody OtherPropertyCreateUpdateRequest otherPropertyCreateUpdateRequest) throws Exception {
|
||||
boolean isSuccess = false;
|
||||
String processMessage="";
|
||||
String errorCode="";
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
//--
|
||||
//--
|
||||
processResult.setRequestData(otherPropertyCreateUpdateRequest);
|
||||
ServiceResult serviceResult = otherService.createOtherBooking(otherPropertyCreateUpdateRequest,request);
|
||||
isSuccess = serviceResult.isSuccess();
|
||||
if(isSuccess==true) {
|
||||
processMessage = "Create Successed";
|
||||
processResult.setData(serviceResult.getReturnData());
|
||||
}else {
|
||||
processMessage = "Create Failed with Error:"+serviceResult.getErrorMessage();
|
||||
errorCode = serviceResult.getErrorCode();
|
||||
}
|
||||
//--
|
||||
processResult.setSuccess(isSuccess);
|
||||
processResult.setErrorCode(errorCode);
|
||||
processResult.setMessage(processMessage);
|
||||
processResult.setLogMessage(LogUtil.getAjaxFormatLog(processResult, "Create Other Property Booking Record", new String[] {"name"}, new String[] {"id","name"}));
|
||||
return processResult;
|
||||
}
|
||||
|
||||
@CheckPermission(routerId="00402",permissionCode="MODIFY")
|
||||
@OperationLog(actionName="Update Other Property Booking", eventCode = "booking_other_update")
|
||||
@RequestMapping(value = "/app/other_booking/update", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public AjaxResult editBooking(HttpServletRequest request, @RequestBody OtherPropertyCreateUpdateRequest booking) throws Exception {
|
||||
boolean isSuccess = false;
|
||||
String processMessage="";
|
||||
String errorCode="";
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
//--
|
||||
//--
|
||||
processResult.setRequestData(booking);
|
||||
ServiceResult serviceResult = otherService.editOtherBooking(booking,request);
|
||||
isSuccess = serviceResult.isSuccess();
|
||||
if(isSuccess==true) {
|
||||
processMessage = "Update Successed";
|
||||
processResult.setData(serviceResult.getReturnData());
|
||||
}else {
|
||||
processMessage = "Update Failed with Error:"+serviceResult.getErrorMessage();
|
||||
errorCode = serviceResult.getErrorCode();
|
||||
}
|
||||
//--
|
||||
processResult.setSuccess(isSuccess);
|
||||
processResult.setErrorCode(errorCode);
|
||||
processResult.setMessage(processMessage);
|
||||
processResult.setLogMessage(LogUtil.getAjaxFormatLog(processResult, "Update Other Property Booking Record", new String[] {"name"}, new String[] {"id","name"}));
|
||||
return processResult;
|
||||
}
|
||||
|
||||
@CheckPermission(routerId="00402",permissionCode="IMPORT")
|
||||
@RequestMapping(value = "/app/other_booking/upload_excel", method = RequestMethod.POST)
|
||||
public AjaxResult uploadExcel(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestBody(required=false) MultipartFile[] files) throws Exception{
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
QueryFilter queryFilter = new QueryFilter(request);
|
||||
if(files==null || files.length<=0) {
|
||||
processResult.setSuccess(false);
|
||||
processResult.setMessage("Empty upload file");
|
||||
}else {
|
||||
MultipartFile uploadFile = files[0];
|
||||
ResFileResult tmpFileRes = ExcelUtils.transTempFile(uploadFile);
|
||||
if(tmpFileRes.isSuccess()) {
|
||||
ServiceResult parseResult = otherService.parseImportExcel(tmpFileRes.getFilePath());
|
||||
ExcelUtils.clearTempFile(tmpFileRes.getFilePath());
|
||||
if(parseResult.isSuccess()) {
|
||||
processResult.setSuccess(true);
|
||||
processResult.setMessage(parseResult.getErrorMessage());
|
||||
processResult.setData(parseResult.getReturnData());
|
||||
}else {
|
||||
processResult.setSuccess(false);
|
||||
processResult.setMessage(parseResult.getErrorMessage());
|
||||
}
|
||||
}else{
|
||||
processResult.setSuccess(false);
|
||||
processResult.setMessage("Write import temp file failed:"+tmpFileRes.getErrorMessage());
|
||||
}
|
||||
}
|
||||
return processResult;
|
||||
}
|
||||
|
||||
@OperationLog(eventCode = "booking_other_import")
|
||||
@RequestMapping(value = "/app/other_booking/import_batch", method = RequestMethod.POST)
|
||||
public AjaxResult batchImportRows(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestBody(required=false) List<OtherBookingImportRow> importRows) throws Exception{
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
QueryFilter queryFilter = new QueryFilter(request);
|
||||
if(importRows==null || importRows.size()<=0) {
|
||||
processResult.setSuccess(false);
|
||||
processResult.setMessage("Empty import data");
|
||||
}else {
|
||||
ServiceResult importResult = otherService.importBatch(importRows,request);
|
||||
processResult.setSuccess(importResult.isSuccess());
|
||||
processResult.setMessage(importResult.getErrorMessage());
|
||||
processResult.setData(importResult.getReturnData());
|
||||
}
|
||||
processResult.setLogMessage(LogUtil.getAjaxFormatLog(processResult, "Import Other Booking", null, null));
|
||||
return processResult;
|
||||
}
|
||||
|
||||
private AjaxResult validateData(Bookings booking, String[] excludeProperty, String[] dateTimeProperty) {
|
||||
AjaxResult validateResult = new AjaxResult();
|
||||
boolean success = true;
|
||||
String errorMessage ="";
|
||||
String errorCode ="";
|
||||
//--
|
||||
validateResult.setSuccess(success);
|
||||
validateResult.setErrorCode(errorCode);
|
||||
validateResult.setMessage(errorMessage);
|
||||
validateResult.setData(success==true?booking:null);
|
||||
return validateResult;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.mgm.mcrm.reservation.controllers;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.mgm.mcrm.admin.models.SysUserView;
|
||||
import com.mgm.mcrm.authorization.dtos.LoginUserInfo;
|
||||
import com.mgm.mcrm.authorization.utils.JwtTokenUtil;
|
||||
import com.mgm.mcrm.common.dtos.ServiceResult;
|
||||
import com.mgm.mcrm.logging.services.SysLogOperationService;
|
||||
import com.mgm.mcrm.reservation.dtos.BookingsDto;
|
||||
import com.mgm.mcrm.reservation.dtos.response.BookingResponse;
|
||||
import com.mgm.mcrm.reservation.dtos.response.WaitlistRemarkResponse;
|
||||
import com.mgm.mcrm.reservation.mappers.BookingMapper;
|
||||
import com.mgm.mcrm.reservation.models.Bookings;
|
||||
import com.mgm.mcrm.reservation.services.WaitlistService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.mgm.mcrm.common.constants.SysCommon;
|
||||
import com.mgm.mcrm.common.annotation.logging.OperationLog;
|
||||
import com.mgm.mcrm.common.annotation.security.CheckPermission;
|
||||
|
||||
import com.mgm.mcrm.common.dtos.AjaxResult;
|
||||
|
||||
|
||||
|
||||
|
||||
import com.mgm.mcrm.common.utils.LogUtil;
|
||||
|
||||
@Tag(name = "Room Reservation", description = "APIs for Room Booking functions")
|
||||
@RestController
|
||||
@RequestMapping("/crm_api")
|
||||
public class WaitlistController {
|
||||
|
||||
@Resource
|
||||
private WaitlistService waitlistService;
|
||||
@Resource
|
||||
private SysLogOperationService sysAuditLogService;
|
||||
private BookingMapper bookingMapper;
|
||||
|
||||
|
||||
@CheckPermission(routerId="00401",permissionCode="MODIFY")
|
||||
@OperationLog(eventCode="booking_update",actionName="Update Waitlist Booking Reamrk")
|
||||
@RequestMapping(value = "/app/waitlist/update_waitlist_remark", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public ResponseEntity<WaitlistRemarkResponse> updateWaitlistRemark(HttpServletRequest request, @RequestBody BookingsDto booking) {
|
||||
boolean isSuccess = false;
|
||||
String processMessage="";
|
||||
String errorCode="";
|
||||
WaitlistRemarkResponse result = new WaitlistRemarkResponse();
|
||||
//--
|
||||
if(booking.getId()==null) {
|
||||
errorCode = "ERR_ILLEGAL_DATA";
|
||||
processMessage="Id can't be empty";
|
||||
}else {
|
||||
//--
|
||||
result.setRequestData(booking);
|
||||
LoginUserInfo userInfo = JwtTokenUtil.parseUserFromRequest(request);
|
||||
if (userInfo != null) {
|
||||
booking.setUpdatedBy(userInfo.getLoginId());
|
||||
}
|
||||
|
||||
ServiceResult serviceResult = waitlistService.updateWaitlistBookingRemark(booking,request);
|
||||
isSuccess = serviceResult.isSuccess();
|
||||
if(isSuccess) {
|
||||
processMessage = "Update Successed";
|
||||
result.setData(serviceResult.getReturnData());
|
||||
}else {
|
||||
processMessage = "Update Failed with Error:"+serviceResult.getErrorMessage();
|
||||
errorCode = serviceResult.getErrorCode();
|
||||
}
|
||||
}
|
||||
//--
|
||||
result.setSuccess(isSuccess);
|
||||
result.setCode(errorCode);
|
||||
result.setMessage(processMessage);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(result);
|
||||
}
|
||||
|
||||
@CheckPermission(routerId="00401",permissionCode="ADD")
|
||||
@OperationLog(actionName="Create Waitlist Booking", eventCode = "booking_waitlist_create")
|
||||
@RequestMapping(value = "/app/waitlist/create", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public ResponseEntity<BookingResponse> createBooking(HttpServletRequest request, @RequestBody Map<String,Object> booking) throws Exception {
|
||||
boolean isSuccess = false;
|
||||
String processMessage="";
|
||||
String errorCode="";
|
||||
BookingResponse result = new BookingResponse();
|
||||
//--
|
||||
//--
|
||||
ServiceResult serviceResult = waitlistService.createWaitlistBooking(booking,request);
|
||||
isSuccess = serviceResult.isSuccess();
|
||||
if(isSuccess) {
|
||||
processMessage = "Create Successed";
|
||||
result.setData(serviceResult.getReturnData());
|
||||
}else {
|
||||
processMessage = "Create Failed with Error:"+serviceResult.getErrorMessage();
|
||||
errorCode = serviceResult.getErrorCode();
|
||||
}
|
||||
//--
|
||||
result.setSuccess(isSuccess);
|
||||
result.setCode(errorCode);
|
||||
result.setMessage(processMessage);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(result);
|
||||
}
|
||||
|
||||
@CheckPermission(routerId="00401",permissionCode="MODIFY")
|
||||
@OperationLog(actionName="Update Waitlist Booking", eventCode = "booking_waitlist_update")
|
||||
@RequestMapping(value = "/app/waitlist/update", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public ResponseEntity<BookingResponse> editBooking(HttpServletRequest request, @RequestBody Map<String,Object> booking) throws Exception {
|
||||
boolean isSuccess = false;
|
||||
String processMessage="";
|
||||
String errorCode="";
|
||||
BookingResponse result = new BookingResponse();
|
||||
//--
|
||||
ServiceResult serviceResult = waitlistService.editWaitlistBooking(booking,request);
|
||||
isSuccess = serviceResult.isSuccess();
|
||||
if(isSuccess==true) {
|
||||
processMessage = "Update Successed";
|
||||
result.setData(serviceResult.getReturnData());
|
||||
}else {
|
||||
processMessage = "Update Failed with Error:"+serviceResult.getErrorMessage();
|
||||
errorCode = serviceResult.getErrorCode();
|
||||
}
|
||||
//--
|
||||
result.setSuccess(isSuccess);
|
||||
result.setCode(errorCode);
|
||||
result.setMessage(processMessage);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.mgm.mcrm.reservation.controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.mgm.mcrm.admin.dtos.UserDto;
|
||||
import com.mgm.mcrm.common.constants.SysCommon;
|
||||
import com.mgm.mcrm.common.dtos.AjaxResult;
|
||||
import com.mgm.mcrm.common.dtos.ServiceResult;
|
||||
import com.mgm.mcrm.reservation.dtos.response.BookingResponse;
|
||||
import com.mgm.mcrm.reservation.mappers.BookingMapper;
|
||||
import com.mgm.mcrm.reservation.models.Bookings;
|
||||
import com.mgm.mcrm.reservation.services.WebBookingService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "Room Reservation", description = "APIs for Room Booking functions")
|
||||
@RestController
|
||||
@RequestMapping("/crm_api")
|
||||
public class WebBookingController {
|
||||
|
||||
@Resource
|
||||
private BookingMapper bookingMapper;
|
||||
|
||||
@Resource
|
||||
private WebBookingService webBookingService;
|
||||
|
||||
@RequestMapping(value = "/web/bookings/search", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public ResponseEntity<BookingResponse> webRecordSearch(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestBody JSONObject params) throws Exception {
|
||||
BookingResponse result = new BookingResponse();
|
||||
ServiceResult serviceResult = webBookingService.webRecordSearch(request,params);
|
||||
if(serviceResult.isSuccess()) {
|
||||
result.setSuccess(true);
|
||||
result.setData(serviceResult.getReturnData());
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage(serviceResult.getErrorMessage());
|
||||
}
|
||||
//--
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/web/booking/get_gaming_data", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
|
||||
public ResponseEntity<BookingResponse> getGamingData(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestBody JSONObject params) throws Exception {
|
||||
BookingResponse result = new BookingResponse();
|
||||
ServiceResult serviceResult = webBookingService.getGamingData(request,params);
|
||||
if(serviceResult.isSuccess()) {
|
||||
result.setSuccess(true);
|
||||
// result.setData(bookingMapper.toBookingDtoList(serviceResult.getReturnData()));
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage(serviceResult.getErrorMessage());
|
||||
}
|
||||
//--
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/web/waitlist/update_batch_waitlist_status", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public ResponseEntity<BookingResponse> updateBatchWaitlistStatus(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestBody JSONObject params) throws Exception {
|
||||
BookingResponse result = new BookingResponse();
|
||||
|
||||
ServiceResult serviceResult = webBookingService.updateBatchWaitlistStatus(request,params);
|
||||
|
||||
if(serviceResult.isSuccess()) {
|
||||
result.setSuccess(true);
|
||||
result.setData(serviceResult.getReturnData());
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage(serviceResult.getErrorMessage());
|
||||
}
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/web/booking/get_page", produces = "application/json;charset=UTF-8")
|
||||
public ResponseEntity<BookingResponse> getBookingByPage(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestBody JSONObject params) throws Exception {
|
||||
ServiceResult serviceResult = webBookingService.getBookingByPage(request,params);
|
||||
|
||||
BookingResponse result = new BookingResponse();
|
||||
if(serviceResult.isSuccess()) {
|
||||
result.setSuccess(true);
|
||||
result.setData(serviceResult.getReturnData());
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage(serviceResult.getErrorMessage());
|
||||
}
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/web/other_booking/import_batch", method = RequestMethod.POST)
|
||||
public ResponseEntity<BookingResponse> batchImportRows(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestBody JSONArray params) throws Exception {
|
||||
BookingResponse result = new BookingResponse();
|
||||
ServiceResult serviceResult = webBookingService.batchImportRows(request,params);
|
||||
if(serviceResult.isSuccess()) {
|
||||
result.setSuccess(true);
|
||||
// result.setData(bookingMapper.toBookingDtoList(serviceResult.getReturnData()));
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage(serviceResult.getErrorMessage());
|
||||
}
|
||||
//--
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/app/approval/batch_cancel_approval", method = RequestMethod.POST, produces = "application/json;charset=UTF-8",consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public AjaxResult approvalCancel(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestBody JSONObject params) throws Exception {
|
||||
boolean isSuccess = false;
|
||||
String processMessage="";
|
||||
String errorCode="";
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
|
||||
ServiceResult serviceResult = webBookingService.cancelApproval(request,params);
|
||||
if(serviceResult.isSuccess()) {
|
||||
processResult.setSuccess(true);
|
||||
processResult.setData(serviceResult.getReturnData());
|
||||
}else {
|
||||
processResult.setSuccess(false);
|
||||
processResult.setMessage(serviceResult.getErrorMessage());
|
||||
}
|
||||
//--
|
||||
|
||||
return processResult;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/web/other_booking/upload_excel", method = RequestMethod.POST)
|
||||
public ResponseEntity<BookingResponse> uploadExcel(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestBody(required=false) MultipartFile[] files) throws Exception {
|
||||
BookingResponse result = new BookingResponse();
|
||||
|
||||
ServiceResult serviceResult = webBookingService.uploadExcel(request,files);
|
||||
if(serviceResult.isSuccess()) {
|
||||
result.setSuccess(true);
|
||||
result.setData(serviceResult.getReturnData());
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage(serviceResult.getErrorMessage());
|
||||
}
|
||||
//--
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
package com.mgm.mcrm.reservation.dtos;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mgm.mcrm.admin.dtos.PlayerProfile;
|
||||
import com.mgm.mcrm.admin.dtos.PlayerProfileDto;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgOtherFollowUpStatus;
|
||||
import com.mgm.mcrm.basesetting.property.models.CfgOtherSegment;
|
||||
import com.mgm.mcrm.basesetting.room.models.CfgOtherRoomStatus;
|
||||
import com.mgm.mcrm.basesetting.team.dtos.CfgTeamStructureViewDto;
|
||||
import com.mgm.mcrm.basesetting.team.models.CfgTeamStructureView;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.NotFound;
|
||||
import org.hibernate.annotations.NotFoundAction;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BookingsDto implements Serializable {
|
||||
private Long id;
|
||||
|
||||
private Long revisionOf;
|
||||
|
||||
private String confirmationNo;
|
||||
|
||||
private String resvId;
|
||||
|
||||
private String lastOperaStatus;
|
||||
|
||||
private String playerId;
|
||||
|
||||
private String memberTitle;
|
||||
|
||||
private String memberFirstName;
|
||||
|
||||
private String memberLastName;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private LocalDateTime checkinDate;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private LocalDateTime checkoutDate;
|
||||
|
||||
private Long propertyId;
|
||||
|
||||
private Long roomTypeId;
|
||||
|
||||
private Long operaProfileId;
|
||||
|
||||
private String notifyLanguage;
|
||||
|
||||
private Double paymentAmount;
|
||||
|
||||
private Double operaTotal;
|
||||
|
||||
private String comment;
|
||||
|
||||
private String blockCode;
|
||||
|
||||
private String ratePlanCode;
|
||||
|
||||
private String chainCode;
|
||||
|
||||
private String hotelCode;
|
||||
|
||||
private String roomTypeCode;
|
||||
|
||||
private String promotionCode;
|
||||
|
||||
private String guaranteeType;
|
||||
|
||||
private String paymentType;
|
||||
|
||||
private String marketCode;
|
||||
|
||||
private String sourceCode;
|
||||
|
||||
private String cancelledBy;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private LocalDateTime cancelledAt;
|
||||
|
||||
private Long sectionId;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
private String createdBy;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
private String updatedBy;
|
||||
|
||||
private String approveStatus;
|
||||
|
||||
private String remark;
|
||||
|
||||
private String bookType;
|
||||
|
||||
private String block;
|
||||
|
||||
private Integer numOfNight;
|
||||
|
||||
private String sectionName;
|
||||
|
||||
private String booker;
|
||||
|
||||
private String mscRemark;
|
||||
|
||||
private String approvalRemark;
|
||||
|
||||
private String room;
|
||||
|
||||
private String sharer;
|
||||
|
||||
private String featureCode;
|
||||
|
||||
private String itemCode;
|
||||
|
||||
private String groupId;
|
||||
|
||||
private String propertyName;
|
||||
|
||||
private Long blockId;
|
||||
|
||||
private Long roomId;
|
||||
|
||||
private String propertyCategory;
|
||||
|
||||
private Integer bedTypeMasterGroupId;
|
||||
|
||||
private String bedTypeName;
|
||||
|
||||
private String createdByName;
|
||||
|
||||
private Integer tryTime;
|
||||
|
||||
private String errorMessage;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private LocalDateTime failedAt;
|
||||
|
||||
private String approvedBy;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private LocalDateTime approvedAt;
|
||||
|
||||
private String bookingTypeName;
|
||||
|
||||
private String roomCategory;
|
||||
|
||||
private Integer roomForBooking;
|
||||
|
||||
private Integer roomForWaitlist;
|
||||
|
||||
private String dateLists;
|
||||
|
||||
private String tier;
|
||||
|
||||
private Long segmentId;
|
||||
|
||||
private Long otherRoomStatusId;
|
||||
|
||||
private Long otherFollowUpStatusId;
|
||||
|
||||
private Long approvedId;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private LocalDateTime requestedCoDate;
|
||||
|
||||
private String overlapBooking;
|
||||
|
||||
private String maBooking;
|
||||
|
||||
private String r3TheoWin;
|
||||
|
||||
private String r3Tpd;
|
||||
|
||||
private String r3ActualWin;
|
||||
|
||||
private String r6TheoWin;
|
||||
|
||||
private String r6Tpd;
|
||||
|
||||
private String r6ActualWin;
|
||||
|
||||
private String r12TheoWin;
|
||||
|
||||
private String r12Tpd;
|
||||
|
||||
private String r12ActualWin;
|
||||
|
||||
private String finalSegment;
|
||||
|
||||
private String tripTheoProfit;
|
||||
|
||||
private String dailyTheoProfit;
|
||||
|
||||
private String playerType;
|
||||
|
||||
private String rankingByPlayer;
|
||||
|
||||
private String bookerTeam;
|
||||
|
||||
private String currentTripTheoWinAmount;
|
||||
|
||||
private String last2dayTheoWinAmount;
|
||||
|
||||
private String eta;
|
||||
|
||||
private String changeCheckinDate;
|
||||
|
||||
private String changeCheckoutDate;
|
||||
|
||||
private Integer bookingTypeId;
|
||||
|
||||
private String status;
|
||||
|
||||
private Long pendingRevisionId;
|
||||
|
||||
private String specialName;
|
||||
|
||||
private String dateList;
|
||||
|
||||
private JSONArray sharerList;
|
||||
|
||||
private String memberTier;
|
||||
|
||||
private String sharerName;
|
||||
|
||||
private String expDate;
|
||||
|
||||
private String profieExpDate;
|
||||
|
||||
private String roomNo;
|
||||
|
||||
private Boolean isShare;
|
||||
|
||||
private String followUpStatusName;
|
||||
|
||||
private String roomStatusName;
|
||||
|
||||
private String segmentName;
|
||||
|
||||
private String category;
|
||||
|
||||
//-- For export
|
||||
|
||||
private String approveStatusName;
|
||||
|
||||
private String bookTypeName;
|
||||
|
||||
private int numOfRooms=1;
|
||||
|
||||
private String memberFullName;
|
||||
|
||||
private CfgTeamStructureViewDto teamObj;
|
||||
|
||||
private CfgOtherSegment segment;
|
||||
|
||||
private CfgOtherRoomStatus otherRoomStatus;
|
||||
|
||||
private CfgOtherFollowUpStatus otherFollowUpStatus;
|
||||
|
||||
private String member;
|
||||
|
||||
private String dlSourceId;
|
||||
|
||||
private Long waitlistId;
|
||||
|
||||
private String otherFollowUpStatusName;
|
||||
|
||||
private String otherRoomStatusName;
|
||||
|
||||
private String dlProfileId;
|
||||
|
||||
private String dlBlockId;
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.mgm.mcrm.reservation.dtos;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgOtherFollowUpStatus;
|
||||
import com.mgm.mcrm.basesetting.property.models.CfgOtherSegment;
|
||||
import com.mgm.mcrm.basesetting.room.models.CfgOtherRoomStatus;
|
||||
import com.mgm.mcrm.basesetting.team.models.CfgTeamStructureView;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BookingsViewDto implements Serializable {
|
||||
private Long id;
|
||||
private Long revisionOf;
|
||||
private String confirmationNo;
|
||||
private String resvId;
|
||||
private String lastOperaStatus;
|
||||
private String playerId;
|
||||
private String memberTitle;
|
||||
private String memberFirstName;
|
||||
private String memberLastName;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private LocalDateTime checkinDate;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private LocalDateTime checkoutDate;
|
||||
private Long propertyId;
|
||||
private Long roomTypeId;
|
||||
// @Column(name="opera_profile_id")
|
||||
// private Long operaProfileId;
|
||||
private String notifyLanguage;
|
||||
private Double paymentAmount;
|
||||
private Double operaTotal;
|
||||
private String comment;
|
||||
// @Column(name="block_code")
|
||||
// private String blockCode;
|
||||
private String ratePlanCode;
|
||||
private String chainCode;
|
||||
private String hotelCode;
|
||||
private String roomTypeCode;
|
||||
private String promotionCode;
|
||||
// @Column(name="guarantee_type")
|
||||
// private String guaranteeType;
|
||||
private String paymentType;
|
||||
private String marketCode;
|
||||
// @Column(name="source_code")
|
||||
private String sourceCode;
|
||||
private String cancelledBy;
|
||||
private LocalDateTime cancelledAt;
|
||||
private Long sectionId;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
private String approveStatus;
|
||||
private String remark;
|
||||
private String bookType;
|
||||
private String block;
|
||||
private Integer numOfNight;
|
||||
private String sectionName;
|
||||
private String booker;
|
||||
private String mscRemark;
|
||||
private String approvalRemark;
|
||||
private String room;
|
||||
private String sharer;
|
||||
private String featureCode;
|
||||
private String itemCode;
|
||||
private String groupId;
|
||||
private String propertyName;
|
||||
private Long blockId;
|
||||
private Long roomId;
|
||||
private String propertyCategory;
|
||||
private Integer bedTypeMasterGroupId;
|
||||
private String bedTypeName;
|
||||
private String createdByName;
|
||||
private Integer tryTime;
|
||||
private String errorMessage;
|
||||
private LocalDateTime failedAt;
|
||||
private String approvedBy;
|
||||
private LocalDateTime approvedAt;
|
||||
private String bookingTypeName;
|
||||
private String roomCategory;
|
||||
private Integer roomForBooking;
|
||||
private Integer roomForWaitlist;
|
||||
private String dateLists;
|
||||
private String tier;
|
||||
private Long segmentId;
|
||||
private Long otherRoomStatusId;
|
||||
private Long otherFollowUpStatusId;
|
||||
private Long approvedId;
|
||||
private LocalDateTime requestedCoDate;
|
||||
private String overlapBooking;
|
||||
private String maBooking;
|
||||
private String r3TheoWin;
|
||||
private String r3Tpd;
|
||||
private String r3ActualWin;
|
||||
private String r6TheoWin;
|
||||
private String r6Tpd;
|
||||
private String r6ActualWin;
|
||||
private String r12TheoWin;
|
||||
private String r12Tpd;
|
||||
private String r12ActualWin;
|
||||
private String finalSegment;
|
||||
private String tripTheoProfit;
|
||||
private String dailyTheoProfit;
|
||||
private String playerType;
|
||||
private String rankingByPlayer;
|
||||
private String bookerTeam;
|
||||
private String currentTripTheoWinAmount;
|
||||
private String last2dayTheoWinAmount;
|
||||
private String eta;
|
||||
private String changeCheckinDate;
|
||||
private String changeCheckoutDate;
|
||||
|
||||
private String status;
|
||||
private Long pendingRevisionId;
|
||||
private String specialName;
|
||||
private List<JSONObject> dateList;
|
||||
private JSONArray sharerList;
|
||||
private String memberTier;
|
||||
private String sharerName;
|
||||
private String expDate;
|
||||
private String profieExpDate;
|
||||
private String roomNo;
|
||||
private Boolean isShare;
|
||||
private String followUpStatusName;
|
||||
private String roomStatusName;
|
||||
private String segmentName;
|
||||
|
||||
//-- For export
|
||||
private String approveStatusName;
|
||||
private String bookTypeName;
|
||||
private int numOfRooms=1;
|
||||
private String memberFullName;
|
||||
|
||||
|
||||
private CfgTeamStructureView teamObj;
|
||||
private CfgOtherSegment segment;
|
||||
private CfgOtherRoomStatus otherRoomStatus;
|
||||
private CfgOtherFollowUpStatus otherFollowUpStatus;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mgm.mcrm.reservation.dtos.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class BookingGetFollowUpNumRequest {
|
||||
|
||||
private String searchMarketCode;
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.mgm.mcrm.reservation.dtos.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class BookingUpdateFollowUpStatusRequest {
|
||||
|
||||
private String bookId;
|
||||
|
||||
private Long status;
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.mgm.mcrm.reservation.dtos.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class BookingUpdateRoomStatusRequest {
|
||||
|
||||
private String bookId;
|
||||
|
||||
private Long status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.mgm.mcrm.reservation.dtos.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "Get Booking Page Request")
|
||||
public class GetBookingRequest{
|
||||
@Schema(description = "Casino code of pit")
|
||||
private String searchStatus;
|
||||
|
||||
@Schema(description = "Pit code")
|
||||
private String searchPlayerId;
|
||||
|
||||
@Schema(description = "Gaming date to query")
|
||||
private String searchBookerId;
|
||||
|
||||
@Schema(description = "Gaming date to query")
|
||||
private String searchBookDate;
|
||||
|
||||
@Schema(description = "Gaming date to query")
|
||||
private String searchPropertyId;
|
||||
|
||||
@Schema(description = "Gaming date to query")
|
||||
private String searchBookerName;
|
||||
|
||||
@Schema(description = "Gaming date to query")
|
||||
private String searchBookerTeam;
|
||||
|
||||
@Schema(description = "Gaming date to query")
|
||||
private List<String> searchCheckInDate;
|
||||
|
||||
@Schema(description = "Gaming date to query")
|
||||
private List<String> searchRoomId;
|
||||
|
||||
@Schema(description = "Gaming date to query")
|
||||
private String propertyName;
|
||||
|
||||
@Schema(description = "Gaming date to query")
|
||||
private String searchApproverName;
|
||||
|
||||
@Schema(description = "Gaming date to query")
|
||||
private String roomTypeName;
|
||||
|
||||
@Schema(description = "Gaming date to query")
|
||||
private String permissionId;
|
||||
|
||||
@Schema(description = "Gaming date to query")
|
||||
private String searchType;
|
||||
|
||||
@Schema(description = "Gaming date to query")
|
||||
private String searchApproverDate;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mgm.mcrm.reservation.dtos.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class OtherBookingGetByIdRequest {
|
||||
|
||||
private Long searchId;
|
||||
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package com.mgm.mcrm.reservation.dtos.request;
|
||||
|
||||
import com.mgm.mcrm.admin.dtos.PlayerProfileDto;
|
||||
import com.mgm.mcrm.admin.dtos.UserDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "Get Booking Page Request")
|
||||
public class OtherPropertyCreateUpdateRequest {
|
||||
private Long id;
|
||||
private String eta;
|
||||
private String bookerId;
|
||||
private String bookerName;
|
||||
private Integer bookingTypeId;
|
||||
private Boolean isWaitlist;
|
||||
private String marketCode;
|
||||
private PlayerProfileDto member;
|
||||
private Long otherFollowUpStatusId;
|
||||
private Long otherRoomStatusId;
|
||||
private String playerId;
|
||||
private Long propertyId;
|
||||
private String requestedCoDate;
|
||||
private Long roomId;
|
||||
private Long segmentId;
|
||||
private List<String> selectDate;
|
||||
private Object sharer;
|
||||
private String sourceCode;
|
||||
private UserDto user;
|
||||
private String confirmationNo;
|
||||
private String approvedId;
|
||||
private String approverName;
|
||||
private String remark;
|
||||
private String specialCode;
|
||||
private String approvalRemark;
|
||||
private String approvedBy;
|
||||
private Long sectionId;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.mgm.mcrm.reservation.dtos.request;
|
||||
|
||||
import com.mgm.mcrm.admin.dtos.PlayerProfileDto;
|
||||
import com.mgm.mcrm.admin.dtos.SysUserDto;
|
||||
import com.mgm.mcrm.common.dtos.BasePageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Schema(description = "Get Booking Page Request")
|
||||
public class OtherPropertyPageRequest extends BasePageRequest {
|
||||
private String propertyName;
|
||||
private String roomStatusName;
|
||||
private String roomTypeName;
|
||||
private List<String> searchBookDate;
|
||||
private String searchBookerId;
|
||||
private List<String> searchCheckInDate;
|
||||
private String searchConfirmationNo;
|
||||
private String searchFirstName;
|
||||
private Long searchFollowUpStatusId;
|
||||
private String searchLastName;
|
||||
private String searchMarketCode;
|
||||
private List<Long> searchOtherRoomStatusId;
|
||||
private String searchPlayerId;
|
||||
private String searchPropertyCategory;
|
||||
private List<Long> searchPropertyId;
|
||||
private List<Long> searchRoomId;
|
||||
private String searchSourceCode;
|
||||
private String searchStatus;
|
||||
private String permissionId;
|
||||
private String permissionGroup;
|
||||
private Long searchId;
|
||||
private String searchName;
|
||||
private String searchBookerName;
|
||||
private String searchBookerTeam;
|
||||
private String searchTryTime;
|
||||
private String searchWaitlistCheckInDate;
|
||||
private String searchRoomTypeId;
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.mgm.mcrm.reservation.dtos.response;
|
||||
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class BookingGetFollowUpNumResponse {
|
||||
|
||||
private Integer newBooking;
|
||||
private Integer extendBooking;
|
||||
private Integer pendingBooking;
|
||||
private Integer doneBooking;
|
||||
private Integer cancelBooking;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.mgm.mcrm.reservation.dtos.response;
|
||||
|
||||
import com.mgm.mcrm.common.dtos.BaseApiResponse;
|
||||
import com.mgm.mcrm.reservation.dtos.BookingsDto;
|
||||
import com.mgm.mcrm.reservation.models.BookingsView;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "Response info of Booking")
|
||||
public class BookingResponse extends BaseApiResponse {
|
||||
|
||||
@Schema(description = "Match Booking Data")
|
||||
private Object data;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mgm.mcrm.reservation.dtos.response;
|
||||
|
||||
import com.mgm.mcrm.common.dtos.BaseApiResponse;
|
||||
import com.mgm.mcrm.reservation.dtos.BookingsDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "Response info of Get Booking")
|
||||
public class GetBookingResponse extends BaseApiResponse {
|
||||
|
||||
@Schema(description = "Match Booking Data")
|
||||
private BookingsDto data;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mgm.mcrm.reservation.dtos.response;
|
||||
|
||||
import com.mgm.mcrm.common.dtos.BaseApiResponse;
|
||||
import com.mgm.mcrm.reservation.dtos.BookingsDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "Response info of update waitlist remark")
|
||||
public class WaitlistRemarkResponse extends BaseApiResponse {
|
||||
|
||||
@Schema(description = "request Booking Item")
|
||||
private Object requestData;
|
||||
|
||||
@Schema(description = "Match Booking Item")
|
||||
private Object data;
|
||||
|
||||
@Schema(description = "Match Booking Item")
|
||||
private String logMessage;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mgm.mcrm.reservation.mappers;
|
||||
|
||||
import com.mgm.mcrm.reservation.dtos.BookingsDto;
|
||||
import com.mgm.mcrm.reservation.dtos.BookingsViewDto;
|
||||
import com.mgm.mcrm.reservation.models.Bookings;
|
||||
import com.mgm.mcrm.reservation.models.BookingsView;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface BookingMapper {
|
||||
|
||||
List<BookingsDto> toBookingDtoList(List<Bookings> list);
|
||||
|
||||
BookingsDto toBookingDto(Bookings book);
|
||||
|
||||
// BookingsDto toBookingDto(Object book);
|
||||
|
||||
Bookings toBooking(BookingsDto book);
|
||||
|
||||
List<Bookings> toBookingList(List<BookingsDto> list);
|
||||
|
||||
List<BookingsViewDto> toBookingViewDtoList(List<BookingsView> list);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package com.mgm.mcrm.reservation.models;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.persistence.Transient;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="bookings")
|
||||
public class Bookings implements Serializable {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@Column(name="revision_of")
|
||||
private Long revisionOf;
|
||||
@Column(name="confirmation_no")
|
||||
private String confirmationNo;
|
||||
@Column(name="resv_id")
|
||||
private String resvId;
|
||||
@Column(name="last_opera_status")
|
||||
private String lastOperaStatus;
|
||||
@Column(name="player_id")
|
||||
private String playerId;
|
||||
@Column(name="member_title")
|
||||
private String memberTitle;
|
||||
@Column(name="member_first_name")
|
||||
private String memberFirstName;
|
||||
@Column(name="member_last_name")
|
||||
private String memberLastName;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
@Column(name="checkin_date")
|
||||
private LocalDateTime checkinDate;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
@Column(name="checkout_date")
|
||||
private LocalDateTime checkoutDate;
|
||||
@Column(name="property_id")
|
||||
private Long propertyId;
|
||||
@Column(name="room_type_id")
|
||||
private Long roomTypeId;
|
||||
@Column(name="dl_profile_id")
|
||||
private String dlProfileId;
|
||||
@Column(name="notify_language")
|
||||
private String notifyLanguage;
|
||||
@Column(name="payment_amount")
|
||||
private Double paymentAmount;
|
||||
@Column(name="opera_total")
|
||||
private Double operaTotal;
|
||||
@Column(name="comment")
|
||||
private String comment;
|
||||
@Column(name="dl_block_id")
|
||||
private String dlBlockId;
|
||||
@Column(name="rate_plan_code")
|
||||
private String ratePlanCode;
|
||||
@Column(name="chain_code")
|
||||
private String chainCode;
|
||||
@Column(name="hotel_code")
|
||||
private String hotelCode;
|
||||
@Column(name="room_type_code")
|
||||
private String roomTypeCode;
|
||||
@Column(name="promotion_code")
|
||||
private String promotionCode;
|
||||
@Column(name="dl_guarantee_type_id")
|
||||
private String dlGuaranteeTypeId;
|
||||
@Column(name="payment_type")
|
||||
private String paymentType;
|
||||
@Column(name="market_code")
|
||||
private String marketCode;
|
||||
@Column(name="dl_source_id")
|
||||
private String dlSourceId;
|
||||
@Column(name="cancelled_by")
|
||||
private String cancelledBy;
|
||||
@Column(name="cancelled_at")
|
||||
private LocalDateTime cancelledAt;
|
||||
@Column(name="section_id")
|
||||
private Long sectionId;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
@Column(name="created_at")
|
||||
private LocalDateTime createdAt;
|
||||
@Column(name="created_by")
|
||||
private String createdBy;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
@Column(name="updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
@Column(name="updated_by")
|
||||
private String updatedBy;
|
||||
@Column(name="approve_status")
|
||||
private String approveStatus;
|
||||
@Column(name="remark")
|
||||
private String remark;
|
||||
@Column(name="book_type")
|
||||
private String bookType;
|
||||
@Column(name="block")
|
||||
private String block;
|
||||
@Column(name="num_of_night")
|
||||
private Integer numOfNight;
|
||||
@Column(name="section_name")
|
||||
private String sectionName;
|
||||
@Column(name="booker")
|
||||
private String booker;
|
||||
@Column(name="msc_remark")
|
||||
private String mscRemark;
|
||||
@Column(name="approval_remark")
|
||||
private String approvalRemark;
|
||||
@Column(name="room")
|
||||
private String room;
|
||||
@Column(name="sharer")
|
||||
private String sharer;
|
||||
@Column(name="feature_code")
|
||||
private String featureCode;
|
||||
@Column(name="item_code")
|
||||
private String itemCode;
|
||||
@Column(name="bed_type_master_group_id")
|
||||
private Integer bedTypeMasterGroupId;
|
||||
@Column(name="bed_type_name")
|
||||
private String bedTypeName;
|
||||
@Column(name="created_by_name")
|
||||
private String createdByName;
|
||||
@Column(name="room_id")
|
||||
private Integer roomId;
|
||||
@Column(name = "source_code")
|
||||
private String sourceCode;
|
||||
@Column(name="block_id")
|
||||
private Integer blockId;
|
||||
@Column(name="try_time")
|
||||
private Integer tryTime;
|
||||
@Column(name="error_message")
|
||||
private String errorMessage;
|
||||
@Column(name="failed_at")
|
||||
private LocalDateTime failedAt;
|
||||
@Column(name="approved_by")
|
||||
private String approvedBy;
|
||||
@Column(name="approved_at")
|
||||
private LocalDateTime approvedAt;
|
||||
@Column(name="member")
|
||||
private String member;
|
||||
@Column(name="booking_type_id")
|
||||
private Integer bookingTypeId;
|
||||
@Column(name="group_id")
|
||||
private String groupId;
|
||||
@Column(name="date_list")
|
||||
private String dateList;
|
||||
@Column(name="failed_room_type")
|
||||
private String failedRoomType;
|
||||
@Column(name="process_status")
|
||||
private Integer processStatus;
|
||||
@Column(name="waitlist_id")
|
||||
private Long waitlistId;
|
||||
@Column(name="segment_id")
|
||||
private Long segmentId;
|
||||
@Column(name="other_room_status_id")
|
||||
private Long otherRoomStatusId;
|
||||
@Column(name="other_follow_up_status_id")
|
||||
private Long otherFollowUpStatusId;
|
||||
@Column(name="approved_id")
|
||||
private Long approvedId;
|
||||
@Column(name="requested_co_date")
|
||||
private LocalDateTime requestedCoDate;
|
||||
@Column(name="eta")
|
||||
private String eta;
|
||||
@Column(name="change_checkin_date")
|
||||
private String changeCheckinDate;
|
||||
@Column(name="change_checkout_date")
|
||||
private String changeCheckoutDate;
|
||||
@Column(name="dl_channel_id")
|
||||
private String dlChannelId;
|
||||
@Column(name="dl_account_id")
|
||||
private String dlAccountId;
|
||||
@Column(name = "category")
|
||||
private String category;
|
||||
@Column(name = "dl_purchase_element_id")
|
||||
private String dlPurchaseElementId;
|
||||
@Column(name = "block_code")
|
||||
private String blockCode;
|
||||
|
||||
//-- For export
|
||||
@Transient
|
||||
private String approveStatusName;
|
||||
@Transient
|
||||
private String bookTypeName;
|
||||
@Transient
|
||||
private int numOfRooms=1;
|
||||
@Transient
|
||||
private String otherRoomStatusName;
|
||||
@Transient
|
||||
private String otherFollowUpStatusName;
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
package com.mgm.mcrm.reservation.models;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgOtherFollowUpStatus;
|
||||
import com.mgm.mcrm.basesetting.property.models.CfgOtherSegment;
|
||||
import com.mgm.mcrm.basesetting.room.models.CfgOtherRoomStatus;
|
||||
import com.mgm.mcrm.basesetting.team.models.CfgTeamStructureView;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.NamedAttributeNode;
|
||||
import jakarta.persistence.NamedEntityGraph;
|
||||
import jakarta.persistence.NamedEntityGraphs;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.persistence.Transient;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.NotFound;
|
||||
import org.hibernate.annotations.NotFoundAction;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="view_booking")
|
||||
@NamedEntityGraphs({
|
||||
@NamedEntityGraph(
|
||||
name = "graph.BookingsView.fulldetails",
|
||||
attributeNodes = {
|
||||
@NamedAttributeNode("teamObj"),
|
||||
@NamedAttributeNode("segment"),
|
||||
@NamedAttributeNode("otherRoomStatus"),
|
||||
@NamedAttributeNode("otherFollowUpStatus"),
|
||||
}
|
||||
)
|
||||
})
|
||||
public class BookingsView implements Serializable {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@Column(name="revision_of")
|
||||
private Long revisionOf;
|
||||
@Column(name="confirmation_no")
|
||||
private String confirmationNo;
|
||||
@Column(name="resv_id")
|
||||
private String resvId;
|
||||
@Column(name="last_opera_status")
|
||||
private String lastOperaStatus;
|
||||
@Column(name="player_id")
|
||||
private String playerId;
|
||||
@Column(name="member_title")
|
||||
private String memberTitle;
|
||||
@Column(name="member_first_name")
|
||||
private String memberFirstName;
|
||||
@Column(name="member_last_name")
|
||||
private String memberLastName;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
@Column(name="checkin_date")
|
||||
private LocalDateTime checkinDate;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
@Column(name="checkout_date")
|
||||
private LocalDateTime checkoutDate;
|
||||
@Column(name="property_id")
|
||||
private Long propertyId;
|
||||
@Column(name="room_type_id")
|
||||
private Long roomTypeId;
|
||||
// @Column(name="opera_profile_id")
|
||||
// private Long operaProfileId;
|
||||
@Column(name="notify_language")
|
||||
private String notifyLanguage;
|
||||
@Column(name="payment_amount")
|
||||
private Double paymentAmount;
|
||||
@Column(name="opera_total")
|
||||
private Double operaTotal;
|
||||
@Column(name="comment")
|
||||
private String comment;
|
||||
// @Column(name="block_code")
|
||||
// private String blockCode;
|
||||
@Column(name="rate_plan_code")
|
||||
private String ratePlanCode;
|
||||
@Column(name="chain_code")
|
||||
private String chainCode;
|
||||
@Column(name="hotel_code")
|
||||
private String hotelCode;
|
||||
@Column(name="room_type_code")
|
||||
private String roomTypeCode;
|
||||
@Column(name="promotion_code")
|
||||
private String promotionCode;
|
||||
// @Column(name="guarantee_type")
|
||||
// private String guaranteeType;
|
||||
@Column(name="payment_type")
|
||||
private String paymentType;
|
||||
@Column(name="market_code")
|
||||
private String marketCode;
|
||||
@Column(name="source_code")
|
||||
private String sourceCode;
|
||||
@Column(name="cancelled_by")
|
||||
private String cancelledBy;
|
||||
@Column(name="cancelled_at")
|
||||
private LocalDateTime cancelledAt;
|
||||
@Column(name="section_id")
|
||||
private Long sectionId;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
@Column(name="created_at")
|
||||
private LocalDateTime createdAt;
|
||||
@Column(name="created_by")
|
||||
private String createdBy;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
@Column(name="updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
@Column(name="updated_by")
|
||||
private String updatedBy;
|
||||
@Column(name="approve_status")
|
||||
private String approveStatus;
|
||||
@Column(name="remark")
|
||||
private String remark;
|
||||
@Column(name="book_type")
|
||||
private String bookType;
|
||||
@Column(name="block")
|
||||
private String block;
|
||||
@Column(name="num_of_night")
|
||||
private Integer numOfNight;
|
||||
@Column(name="section_name")
|
||||
private String sectionName;
|
||||
@Column(name="booker")
|
||||
private String booker;
|
||||
@Column(name="msc_remark")
|
||||
private String mscRemark;
|
||||
@Column(name="approval_remark")
|
||||
private String approvalRemark;
|
||||
@Column(name="room")
|
||||
private String room;
|
||||
@Column(name="sharer")
|
||||
private String sharer;
|
||||
@Column(name="feature_code")
|
||||
private String featureCode;
|
||||
@Column(name="item_code")
|
||||
private String itemCode;
|
||||
@Column(name="group_id")
|
||||
private String groupId;
|
||||
@Column(name="property_name")
|
||||
private String propertyName;
|
||||
@Column(name="block_id")
|
||||
private Long blockId;
|
||||
@Column(name="room_id")
|
||||
private Long roomId;
|
||||
@Column(name="property_category")
|
||||
private String propertyCategory;
|
||||
@Column(name="bed_type_master_group_id")
|
||||
private Integer bedTypeMasterGroupId;
|
||||
@Column(name="bed_type_name")
|
||||
private String bedTypeName;
|
||||
@Column(name="created_by_name")
|
||||
private String createdByName;
|
||||
@Column(name="try_time")
|
||||
private Integer tryTime;
|
||||
@Column(name="error_message")
|
||||
private String errorMessage;
|
||||
@Column(name="failed_at")
|
||||
private LocalDateTime failedAt;
|
||||
@Column(name="approved_by")
|
||||
private String approvedBy;
|
||||
@Column(name="approved_at")
|
||||
private LocalDateTime approvedAt;
|
||||
@Column(name="booking_type_name")
|
||||
private String bookingTypeName;
|
||||
@Column(name="room_category")
|
||||
private String roomCategory;
|
||||
@Column(name="for_booking")
|
||||
private Integer roomForBooking;
|
||||
@Column(name="for_waitlist")
|
||||
private Integer roomForWaitlist;
|
||||
@Column(name="date_list")
|
||||
private String dateLists;
|
||||
@Column(name="tier")
|
||||
private String tier;
|
||||
@Column(name="segment_id")
|
||||
private Long segmentId;
|
||||
@Column(name="other_room_status_id")
|
||||
private Long otherRoomStatusId;
|
||||
@Column(name="other_follow_up_status_id")
|
||||
private Long otherFollowUpStatusId;
|
||||
@Column(name="approved_id")
|
||||
private Long approvedId;
|
||||
@Column(name="requested_co_date")
|
||||
private LocalDateTime requestedCoDate;
|
||||
@Column(name="overlap_booking")
|
||||
private String overlapBooking;
|
||||
@Column(name="ma_booking")
|
||||
private String maBooking;
|
||||
@Column(name="r3_theo_win")
|
||||
private String r3TheoWin;
|
||||
@Column(name="r3_tpd")
|
||||
private String r3Tpd;
|
||||
@Column(name="r3_actual_win")
|
||||
private String r3ActualWin;
|
||||
@Column(name="r6_theo_win")
|
||||
private String r6TheoWin;
|
||||
@Column(name="r6_tpd")
|
||||
private String r6Tpd;
|
||||
@Column(name="r6_actual_win")
|
||||
private String r6ActualWin;
|
||||
@Column(name="r12_theo_win")
|
||||
private String r12TheoWin;
|
||||
@Column(name="r12_tpd")
|
||||
private String r12Tpd;
|
||||
@Column(name="r12_actual_win")
|
||||
private String r12ActualWin;
|
||||
@Column(name="final_segment")
|
||||
private String finalSegment;
|
||||
@Column(name="trip_theo_profit")
|
||||
private String tripTheoProfit;
|
||||
@Column(name="daily_theo_profit")
|
||||
private String dailyTheoProfit;
|
||||
@Column(name="player_type")
|
||||
private String playerType;
|
||||
@Column(name="ranking_by_player")
|
||||
private String rankingByPlayer;
|
||||
@Column(name="booker_team")
|
||||
private String bookerTeam;
|
||||
@Column(name="current_trip_theo_win_amount")
|
||||
private String currentTripTheoWinAmount;
|
||||
@Column(name="last_2day_theo_win_amount")
|
||||
private String last2dayTheoWinAmount;
|
||||
@Column(name="eta")
|
||||
private String eta;
|
||||
@Column(name="change_checkin_date")
|
||||
private String changeCheckinDate;
|
||||
@Column(name="change_checkout_date")
|
||||
private String changeCheckoutDate;
|
||||
|
||||
@Transient
|
||||
private String status;
|
||||
@Transient
|
||||
private Long pendingRevisionId;
|
||||
@Transient
|
||||
private String specialName;
|
||||
@Transient
|
||||
private List<JSONObject> dateList;
|
||||
@Transient
|
||||
private JSONArray sharerList;
|
||||
@Transient
|
||||
private String memberTier;
|
||||
@Transient
|
||||
private String sharerName;
|
||||
@Transient
|
||||
private String expDate;
|
||||
@Transient
|
||||
private String profieExpDate;
|
||||
@Transient
|
||||
private String roomNo;
|
||||
@Transient
|
||||
private Boolean isShare;
|
||||
@Transient
|
||||
private String followUpStatusName;
|
||||
@Transient
|
||||
private String roomStatusName;
|
||||
@Transient
|
||||
private String segmentName;
|
||||
|
||||
//-- For export
|
||||
@Transient
|
||||
private String approveStatusName;
|
||||
@Transient
|
||||
private String bookTypeName;
|
||||
@Transient
|
||||
private int numOfRooms=1;
|
||||
@Transient
|
||||
private String memberFullName;
|
||||
|
||||
@NotFound(action = NotFoundAction.IGNORE)
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name="section_id",insertable=false ,updatable=false,nullable=true)
|
||||
private CfgTeamStructureView teamObj;
|
||||
|
||||
@NotFound(action = NotFoundAction.IGNORE)
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name="segment_id",insertable=false ,updatable=false)
|
||||
private CfgOtherSegment segment;
|
||||
|
||||
@NotFound(action = NotFoundAction.IGNORE)
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name="other_room_status_id",insertable=false ,updatable=false)
|
||||
private CfgOtherRoomStatus otherRoomStatus;
|
||||
|
||||
@NotFound(action = NotFoundAction.IGNORE)
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name="other_follow_up_status_id",insertable=false ,updatable=false)
|
||||
private CfgOtherFollowUpStatus otherFollowUpStatus;
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.mgm.mcrm.reservation.models;
|
||||
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@NamedStoredProcedureQueries({
|
||||
@NamedStoredProcedureQuery(
|
||||
name = "getBookingsByConfirmationNo",
|
||||
procedureName = "GetBookingsByConfirmationNo",
|
||||
resultClasses = OperaDBBooking.class,
|
||||
parameters = {
|
||||
@StoredProcedureParameter(mode = ParameterMode.IN,name = "confirmation_no",type = String.class)
|
||||
}
|
||||
),
|
||||
@NamedStoredProcedureQuery(
|
||||
name = "getBookingsByNameID",
|
||||
procedureName = "GetBookingsByNameID",
|
||||
resultClasses = OperaDBBooking.class,
|
||||
parameters = {
|
||||
@StoredProcedureParameter(mode = ParameterMode.IN,name = "name_id",type = String.class),
|
||||
@StoredProcedureParameter(mode = ParameterMode.IN,name = "block_code",type = String.class),
|
||||
@StoredProcedureParameter(mode = ParameterMode.IN,name = "enddate",type = Date.class)
|
||||
}
|
||||
),
|
||||
@NamedStoredProcedureQuery(
|
||||
name = "getOperaNameIDByPlayerID",
|
||||
procedureName = "GetOperaNameIDByPlayerID",
|
||||
parameters = {
|
||||
@StoredProcedureParameter(mode = ParameterMode.IN,name = "player_id",type = String.class),
|
||||
}
|
||||
),
|
||||
@NamedStoredProcedureQuery(
|
||||
name = "getBookingsByRoomNo",
|
||||
procedureName = "GetBookingsByRoomNo",
|
||||
resultClasses = OperaDBBooking.class,
|
||||
parameters = {
|
||||
@StoredProcedureParameter(mode = ParameterMode.IN,name = "room_no",type = String.class)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
public class OperaDBBooking {
|
||||
|
||||
@Id
|
||||
@Column(name="Confirmation_No")
|
||||
private String confirmationNo;
|
||||
@Column(name="RESORT")
|
||||
private String resort;
|
||||
@Column(name="Room_Type")
|
||||
private String roomType;
|
||||
@Column(name="Room_Type_Desc")
|
||||
private String roomTypeDesc;
|
||||
@Column(name="Arrival_date")
|
||||
private String arrivalDate;
|
||||
@Column(name="Arrival_Time")
|
||||
private String arrivalTime;
|
||||
@Column(name="Departture_Date")
|
||||
private String departureDate;
|
||||
@Column(name="Departure_Time")
|
||||
private String departureTime;
|
||||
@Column(name="Resv_Status")
|
||||
private String resvStatus;
|
||||
@Column(name="Block_Code")
|
||||
private String blockCode;
|
||||
@Column(name="Current_Balance")
|
||||
private String currentBalance;
|
||||
@Column(name="Opera_Profile_ID")
|
||||
private String operaProfileId;
|
||||
@Column(name="Resv_Name_ID")
|
||||
private String resvNameId;
|
||||
@Column(name="Rate_Code")
|
||||
private String rateCode;
|
||||
@Column(name="Adults")
|
||||
private String adults;
|
||||
@Column(name="Children")
|
||||
private String children;
|
||||
@Column(name="Market_Segment")
|
||||
private String marketSegment;
|
||||
@Column(name="Source_Code")
|
||||
private String sourceCode;
|
||||
@Column(name="Source_Name")
|
||||
private String sourceName;
|
||||
@Column(name="Booker")
|
||||
private String booker;
|
||||
@Column(name="EXP_Date")
|
||||
private String expDate;
|
||||
@Column(name="Profile_EXP_Date")
|
||||
private String profileExpDate;
|
||||
@Column(name="Room_No")
|
||||
private String roomNo;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.mgm.mcrm.reservation.repositories;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.mgm.mcrm.reservation.models.Bookings;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
public interface BookingDao extends JpaRepository<Bookings, Long> {
|
||||
|
||||
List<Bookings> findByConfirmationNo(String confirmationNo);
|
||||
List<Bookings> findAll(Specification<Bookings> spec,Sort sort);
|
||||
List<Bookings> findAll(Specification<Bookings> spec);
|
||||
Page<Bookings> findAll(Specification<Bookings> spec, Pageable pageable);
|
||||
|
||||
@Query(value="select * from bookings where other_room_status_id =?1",nativeQuery=true)
|
||||
List<Bookings> getByOtherRoomStatusId(long id);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query(value = " update bookings set approve_status=?1 where id in (?2)",nativeQuery=true)
|
||||
int updateBatchStatus(String status,String[] ids);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query(value = " update bookings set approved_by=?1,approved_at=?2 where id in (?3)",nativeQuery=true)
|
||||
int updateBatchApprover(String status,LocalDateTime date,String[] ids);
|
||||
|
||||
@Query(value="select count(*) from bookings where checkin_date=?1 and checkout_date=?2 and failed_room_type like %?3% and error_message like '%No available room%' ",nativeQuery=true)
|
||||
Integer checkRoomTypeFailedBooking(LocalDateTime checkinDate,LocalDateTime checkoutDate,String roomTypeCode);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query(value = " delete from bookings where id>?1 and confirmation_no=?2 ",nativeQuery=true)
|
||||
int deleteDuplicateBooking(long id,String confirmation_no);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query(value = " update bookings set process_status=?2 where id=?1",nativeQuery=true)
|
||||
int updateProcessStatus(long id,Integer processStatus);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query(value = " update bookings set other_room_status_id=?1,approve_status=?3,last_opera_status=?4 where id in (?2)",nativeQuery=true)
|
||||
int updateBatchOtherRoomStatus(String status,String[] ids,String approveStatus,String lastOperaStatus);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query(value = "update bookings set approve_status=?2,last_opera_status=?3 where other_room_status_id=?1",nativeQuery=true)
|
||||
int updateCMSOtherRoomStatus(long statusId,String approveStatus,String lastOperaStatus);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query(value = " update bookings set other_follow_up_status_id=?1 where id in (?2)",nativeQuery=true)
|
||||
int updateBatchOtherFollowUpStatus(String status,String[] ids);
|
||||
|
||||
@Query(value="select count(*) from bookings where other_follow_up_status_id=?1 and approve_status in('N','PN','C') and segment_id is not null",nativeQuery=true)
|
||||
Integer getFollowUpNewBooking(long otherFollowUpStatusId);
|
||||
|
||||
@Query(value="select count(*) from bookings where other_follow_up_status_id=?1 and market_code=?2 and approve_status in('N','PN') and segment_id is not null",nativeQuery=true)
|
||||
Integer getFollowUpNewBookingByMarketCode(long otherFollowUpStatusId,String marketCode);
|
||||
|
||||
@Query(value="select Top(1) * from bookings where confirmation_no =?1 and approve_status in ('N')",nativeQuery=true)
|
||||
Bookings getActiveBookingByConfirmation(String confirmationNo);
|
||||
|
||||
@Query(value="select count(*) from bookings where property_id=?1 and room_id=?2 and segment_id=?3 "
|
||||
+ "and((checkin_date<=?4 and checkout_date>?4) or (checkout_date<=?4 and requested_co_date>?4)) and other_room_status_id in (?5) and approve_status in('N','PN','C')",nativeQuery=true)
|
||||
int getOtherPickupBooking(Long propertyId,int roomId,Long segmentId,LocalDateTime date,Long[] roomStatusId);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.mgm.mcrm.reservation.repositories;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.mgm.mcrm.reservation.models.BookingsView;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.data.jpa.repository.EntityGraph;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
public interface BookingViewDao extends JpaRepository<BookingsView, String> {
|
||||
BookingsView findById(long id);
|
||||
|
||||
@EntityGraph(value = "graph.BookingsView.fulldetails",type = EntityGraph.EntityGraphType.LOAD)
|
||||
Page<BookingsView> findAll(Specification<BookingsView> spec, Pageable pageable);
|
||||
|
||||
@EntityGraph(value = "graph.BookingsView.fulldetails",type = EntityGraph.EntityGraphType.LOAD)
|
||||
List<BookingsView> findAll(Specification<BookingsView> spec, Sort sort);
|
||||
|
||||
@Query(value="select * from view_booking where player_id=:player_id and"
|
||||
+ " checkin_date >=:checkin_date and checkout_date<=:checkout_date and created_at >=:date and"
|
||||
+ " approve_status in('PN','W')",nativeQuery=true)
|
||||
List<BookingsView> findRecordSearchPending(@Param("player_id") String payerId,@Param("checkin_date")
|
||||
String checkinDate,@Param("checkout_date") String checkoutDate,@Param("date") String date);
|
||||
|
||||
@Query(value="select * from view_booking where player_id=:player_id and"
|
||||
+ " checkin_date >=:checkin_date and checkout_date<=:checkout_date and"
|
||||
+ " approve_status in('N') and confirmation_no is not null and last_opera_status!='CHECKED_OUT'",nativeQuery=true)
|
||||
List<BookingsView> findRecordSearchMock(@Param("player_id") String payerId,@Param("checkin_date")
|
||||
String checkinDate,@Param("checkout_date") String checkoutDate);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query(value="update bookings set last_opera_status='CHECKED_IN' where cast(checkin_date as date)<cast(getdate() as date) "
|
||||
+ " and cast(checkout_date as date)>cast(getdate() as date) "
|
||||
+ " and (last_opera_status is null or last_opera_status='DUE_IN') and approve_status='N'",nativeQuery=true)
|
||||
void changeCheckedIn();
|
||||
@Query(value="select * from view_booking where confirmation_no=?1",nativeQuery=true)
|
||||
List<BookingsView> findBookingByConfirmationNo(String conf);
|
||||
|
||||
@Query(value="select * from view_booking where id=?1",nativeQuery=true)
|
||||
List<BookingsView> findBookingById(int id);
|
||||
|
||||
@Query(value="select * from view_booking where group_id=?1 and approve_status not in('WC','WF','WE')",nativeQuery=true)
|
||||
List<BookingsView> findBookingsByGroupId(String groupId);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query(value="update bookings set last_opera_status='DUE_OUT' where cast(checkout_date as date)=cast(getdate() as date)"
|
||||
+ " and (last_opera_status is null or last_opera_status='CHECKED_IN') and approve_status='N'",nativeQuery=true)
|
||||
void changeDueOut();
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query(value="update bookings set last_opera_status='CHECKED_OUT' where cast(checkout_date as date)<cast(getdate() as date)"
|
||||
+ " and (last_opera_status is null or last_opera_status='DUE_OUT') and approve_status='N'",nativeQuery=true)
|
||||
void changeCheckedOut();
|
||||
|
||||
@Query(value="select * from view_booking where property_category='OPERA' and approve_status='W'",nativeQuery=true)
|
||||
List<BookingsView> findWaitlistBooking();
|
||||
|
||||
@Query(value="select * from view_booking where approve_status like '%W%' ",nativeQuery=true)
|
||||
List<BookingsView> findMockupWaitlistBooking();
|
||||
|
||||
@Query(value="select * from view_booking where approve_status not like '%W%' and approve_status not like '%C%' and property_category = 'OTHER'",nativeQuery=true)
|
||||
List<BookingsView> findMockupOtherPropertyBooking();
|
||||
|
||||
@Query(value="select * from view_booking where checkout_date<=?1 and player_id=?2 and approve_status in('N','PN') ",nativeQuery=true)
|
||||
List<BookingsView> getCalendarBooking(LocalDateTime checkoutDate,String playerId);
|
||||
|
||||
@Query(value="select * from view_booking where id in (?1)",nativeQuery=true)
|
||||
List<BookingsView> findBookingByIds(String[] ids);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,750 @@
|
||||
package com.mgm.mcrm.reservation.services;
|
||||
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.mgm.mcrm.admin.repositories.SysUserDao;
|
||||
import com.mgm.mcrm.admin.services.SysGroupService;
|
||||
import com.mgm.mcrm.admin.services.SysSettingService;
|
||||
import com.mgm.mcrm.allotment.repositories.AppChannelDao;
|
||||
import com.mgm.mcrm.allotment.repositories.RoomCriteriaDao;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgBlocks;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgItemInventory;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgDaylightView;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgTiers;
|
||||
import com.mgm.mcrm.basesetting.daylight.repositories.BlockDao;
|
||||
import com.mgm.mcrm.basesetting.daylight.repositories.DaylightViewDao;
|
||||
import com.mgm.mcrm.basesetting.daylight.repositories.ItemInventoryDao;
|
||||
import com.mgm.mcrm.basesetting.daylight.repositories.TierDao;
|
||||
import com.mgm.mcrm.basesetting.property.models.CfgProperties;
|
||||
import com.mgm.mcrm.basesetting.property.repositories.PropertyDao;
|
||||
import com.mgm.mcrm.basesetting.property.services.PropertyService;
|
||||
import com.mgm.mcrm.basesetting.room.models.CfgRoomFeatures;
|
||||
import com.mgm.mcrm.basesetting.room.models.CfgRoomTypes;
|
||||
import com.mgm.mcrm.basesetting.room.models.CfgRooms;
|
||||
import com.mgm.mcrm.basesetting.room.repositories.*;
|
||||
import com.mgm.mcrm.basesetting.team.repositories.AppUserDao;
|
||||
import com.mgm.mcrm.common.dtos.DataTableResult;
|
||||
import com.mgm.mcrm.common.dtos.QueryFilter;
|
||||
import com.mgm.mcrm.common.dtos.ServiceResult;
|
||||
import com.mgm.mcrm.common.utils.LogUtil;
|
||||
import com.mgm.mcrm.logging.services.SysLogBookingService;
|
||||
import com.mgm.mcrm.reservation.dtos.BookingsDto;
|
||||
import com.mgm.mcrm.reservation.dtos.BookingsViewDto;
|
||||
import com.mgm.mcrm.reservation.dtos.request.BookingGetFollowUpNumRequest;
|
||||
import com.mgm.mcrm.reservation.dtos.request.OtherPropertyPageRequest;
|
||||
import com.mgm.mcrm.reservation.dtos.response.BookingGetFollowUpNumResponse;
|
||||
import com.mgm.mcrm.reservation.mappers.BookingMapper;
|
||||
import com.mgm.mcrm.reservation.models.Bookings;
|
||||
import com.mgm.mcrm.reservation.models.BookingsView;
|
||||
import com.mgm.mcrm.reservation.repositories.BookingDao;
|
||||
import com.mgm.mcrm.reservation.repositories.BookingViewDao;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import jakarta.persistence.criteria.CriteriaQuery;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.auth0.jwt.JWT;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import com.mgm.mcrm.common.utils.DaoUtil;
|
||||
import com.mgm.mcrm.common.utils.DateTimeUtil;
|
||||
|
||||
|
||||
|
||||
@Service
|
||||
public class BookingService {
|
||||
|
||||
@Resource
|
||||
private BookingDao bookingDao;
|
||||
@Resource
|
||||
private BookingViewDao bookingViewDao;
|
||||
@Resource
|
||||
private BlockDao blockDao;
|
||||
@Resource
|
||||
private RoomDao roomDao;
|
||||
@Resource
|
||||
private RoomTypeDao roomTypeDao;
|
||||
@Resource
|
||||
private AppUserDao appUserDao;
|
||||
@Resource
|
||||
private DaylightViewDao daylightViewDao;
|
||||
@Resource
|
||||
private SysUserDao userDao;
|
||||
@Resource
|
||||
private TierDao tierDao;
|
||||
@Resource
|
||||
private ItemInventoryDao itemDao;
|
||||
@Resource
|
||||
private PropertyDao propertyDao;
|
||||
@Resource
|
||||
private SysSettingService sysSettingService;
|
||||
@Resource
|
||||
private AppChannelDao appChannelDao;
|
||||
@Resource
|
||||
private RoomCriteriaDao criteriaDao;
|
||||
@Resource
|
||||
private RoomRoomTypeDao roomRoomTypeDao;
|
||||
@Resource
|
||||
private RoomFeatureDao roomFeatureDao;
|
||||
@Resource
|
||||
private BedTypeMappingDao bedTypeMappingDao;
|
||||
@Resource
|
||||
private PropertyService propertyService;
|
||||
@Resource
|
||||
private SysLogBookingService sysLogBookingService;
|
||||
@Resource
|
||||
private SysGroupService sysGroupService;
|
||||
@Resource
|
||||
private BookingMapper bookingMapper;
|
||||
|
||||
public ServiceResult createBooking(Map<String,Object> param, HttpServletRequest request) {
|
||||
ServiceResult processResult= new ServiceResult();
|
||||
LocalDateTime createDate = LocalDateTime.now();
|
||||
Bookings booking = new Bookings();
|
||||
String playerId = String.valueOf(param.get("playerId"));
|
||||
Long blockId = Long.valueOf(String.valueOf(param.get("blockId")));
|
||||
Long propertyId = Long.valueOf(String.valueOf(param.get("propertyId")));
|
||||
Long roomId = Long.valueOf(String.valueOf(param.get("roomId")));
|
||||
Long roomTypeId = Long.valueOf(String.valueOf(param.get("roomTypeId")));
|
||||
String special = param.get("specialIds")!=null?String.valueOf(param.get("specialIds")):null;
|
||||
String sharer = param.get("sharer")!=null?String.valueOf(param.get("sharer")):null;
|
||||
String remark = param.get("remark")!=null?String.valueOf(param.get("remark")):null;
|
||||
Boolean isWaitlist = Boolean.valueOf(String.valueOf(param.get("isWaitlist")));
|
||||
HashMap member = (HashMap)param.get("member");
|
||||
List operaId = (List)member.get("nameId");
|
||||
List selectDate = (List)param.get("selectDate");
|
||||
LocalDateTime checkinDate = DateTimeUtil.getDateFromString(String.valueOf(selectDate.get(0)), "yyyy-MM-dd");
|
||||
LocalDateTime checkoutDate = DateTimeUtil.getDateFromString(String.valueOf(selectDate.get(1)), "yyyy-MM-dd");
|
||||
String numOfNight = DateTimeUtil.getDiffDate(checkinDate, checkoutDate, "day");
|
||||
CfgProperties property = propertyDao.findById(propertyId).orElse(null);
|
||||
CfgBlocks block = blockDao.getById(blockId);
|
||||
CfgRooms room = roomDao.getById(roomId);
|
||||
CfgRoomTypes roomType = roomTypeDao.getById(roomTypeId);
|
||||
CfgTiers tier = tierDao.findByTierName(String.valueOf(member.get("tier")));
|
||||
CfgItemInventory item = new CfgItemInventory();
|
||||
if(tier!=null&&blockId!=null&&roomTypeId!=null) {
|
||||
item = itemDao.findByTierIdAndRoomId(Long.valueOf(tier.getId()),roomId);
|
||||
}
|
||||
String oldToken = request.getHeader("Authorization");
|
||||
// oldToken = oldToken.substring(6);
|
||||
String userId = JWT.decode(oldToken).getClaim("login_id").asString();
|
||||
Long sectionId = 2L;
|
||||
|
||||
List<CfgDaylightView> operas = daylightViewDao.findByPropertyIdAndBookingTypeId(propertyId,blockId);
|
||||
List<CfgDaylightView> teamOpera = new ArrayList();
|
||||
CfgDaylightView opera = new CfgDaylightView();
|
||||
for(CfgDaylightView o :operas) {
|
||||
for(CfgRoomTypes r :o.getDaylightRoomType()) {
|
||||
if(Objects.equals(r.getId(), roomTypeId)) {
|
||||
teamOpera.add(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String blockCode = null;
|
||||
for(CfgDaylightView o :teamOpera) {
|
||||
LocalDateTime startTime = o.getStartDate();
|
||||
LocalDateTime endTime = o.getEndDate();
|
||||
if((startTime.isBefore(checkinDate) || startTime.isEqual(checkinDate))
|
||||
&& (endTime.isAfter(checkoutDate) || endTime.isEqual(checkoutDate))) {
|
||||
blockCode = o.getBlockCodeName();
|
||||
opera = o;
|
||||
}
|
||||
}
|
||||
|
||||
booking.setId(null);
|
||||
booking.setPlayerId(playerId);
|
||||
booking.setMemberTitle(String.valueOf(member.get("salutation")));
|
||||
// booking.setMemberFirstName(memberFirstName);
|
||||
booking.setMemberLastName(String.valueOf(member.get("name")));
|
||||
booking.setCheckinDate(checkinDate);
|
||||
booking.setCheckoutDate(checkoutDate);
|
||||
booking.setPropertyId(propertyId);
|
||||
booking.setHotelCode(property.getCode());
|
||||
booking.setRoomTypeId(roomTypeId);
|
||||
// booking.setOperaProfileId(Long.valueOf(String.valueOf(operaId.get(0))));
|
||||
booking.setDlBlockId(blockCode);
|
||||
booking.setRatePlanCode(opera.getRateCode().getCode());
|
||||
booking.setRoomTypeCode(roomType.getCode());
|
||||
booking.setMarketCode(opera.getMarketCode().getCode());
|
||||
booking.setDlSourceId(opera.getSourceCode().getDlSourceId());
|
||||
booking.setSourceCode(opera.getSourceCode().getCode());
|
||||
booking.setCreatedAt(createDate);
|
||||
booking.setCreatedBy(JWT.decode(oldToken).getSubject());
|
||||
booking.setSectionId(sectionId);
|
||||
booking.setApproveStatus(isWaitlist?"W":"PN");
|
||||
booking.setRemark(remark);
|
||||
booking.setBookType("0");
|
||||
booking.setBlock(block.getName());
|
||||
booking.setNumOfNight(Integer.valueOf(numOfNight));
|
||||
// booking.setTeamName(team.getCode());
|
||||
booking.setBooker(userId);
|
||||
booking.setSharer(sharer);
|
||||
booking.setItemCode(item.getId()!=null?item.getDlCode():null);
|
||||
booking.setFeatureCode(special);
|
||||
booking.setRoom(room.getName());
|
||||
|
||||
booking.setCategory(property.getCategory());
|
||||
|
||||
Bookings newBooking= bookingDao.save(booking);
|
||||
|
||||
processResult.setSuccess(true);
|
||||
processResult.setReturnData(booking);
|
||||
return processResult;
|
||||
}
|
||||
|
||||
public ServiceResult updateBooking(Bookings booking) {
|
||||
ServiceResult processResult= new ServiceResult();
|
||||
Bookings existsType = bookingDao.findById(booking.getId()).orElse(null);
|
||||
if(existsType==null) {
|
||||
processResult.setErrorCode("ERR_OBJECT_NOT_FOUND");
|
||||
processResult.setErrorMessage("Can't find Booking by Id");
|
||||
}else {
|
||||
String[] ignoreProperties = new String[] {"id","createdAt",
|
||||
"createdBy","updatedAt","updatedBy"};
|
||||
BeanUtils.copyProperties(booking, existsType, ignoreProperties);
|
||||
booking.setCreatedAt(existsType.getCreatedAt());
|
||||
booking.setUpdatedAt( DateTimeUtil.getCurrentDateTime("yyyy-MM-dd HH:mm:ss"));
|
||||
bookingDao.save(booking);
|
||||
processResult.setReturnData(existsType);
|
||||
processResult.setSuccess(true);
|
||||
}
|
||||
return processResult;
|
||||
}
|
||||
|
||||
public ServiceResult updateFailedBooking(Bookings booking) {
|
||||
ServiceResult processResult= new ServiceResult();
|
||||
Bookings existsType = bookingDao.findById(booking.getId()).orElse(null);
|
||||
if(existsType==null) {
|
||||
processResult.setErrorCode("ERR_OBJECT_NOT_FOUND");
|
||||
processResult.setErrorMessage("Can't find Booking by Id");
|
||||
}else {
|
||||
existsType.setApproveStatus(booking.getApproveStatus());
|
||||
existsType.setMscRemark(booking.getMscRemark());
|
||||
existsType.setUpdatedAt( DateTimeUtil.getCurrentDateTime("yyyy-MM-dd HH:mm:ss"));
|
||||
existsType.setUpdatedBy(booking.getUpdatedBy());
|
||||
bookingDao.save(existsType);
|
||||
processResult.setReturnData(existsType);
|
||||
processResult.setSuccess(true);
|
||||
}
|
||||
return processResult;
|
||||
}
|
||||
|
||||
public ServiceResult updateWaitlistBookingStatus(Bookings booking) {
|
||||
ServiceResult processResult= new ServiceResult();
|
||||
Bookings existsType = bookingDao.findById(booking.getId()).orElse(null);
|
||||
if(existsType==null) {
|
||||
processResult.setErrorCode("ERR_OBJECT_NOT_FOUND");
|
||||
processResult.setErrorMessage("Can't find Booking by Id");
|
||||
}else {
|
||||
if("W".equals(booking.getApproveStatus())) {
|
||||
existsType.setApproveStatus("WA");
|
||||
existsType.setApprovedBy(booking.getUpdatedBy());
|
||||
existsType.setApprovedAt( DateTimeUtil.getCurrentDateTime("yyyy-MM-dd HH:mm:ss"));
|
||||
}else if("WA".equals(booking.getApproveStatus())) {
|
||||
existsType.setApproveStatus("WR");
|
||||
existsType.setApprovedBy(booking.getUpdatedBy());
|
||||
existsType.setApprovedAt( DateTimeUtil.getCurrentDateTime("yyyy-MM-dd HH:mm:ss"));
|
||||
}else if("WR".equals(booking.getApproveStatus())) {
|
||||
existsType.setApproveStatus("W");
|
||||
existsType.setApprovedBy(null);
|
||||
existsType.setApprovedAt(null);
|
||||
}
|
||||
|
||||
existsType.setUpdatedAt( DateTimeUtil.getCurrentDateTime("yyyy-MM-dd HH:mm:ss"));
|
||||
existsType.setUpdatedBy(booking.getUpdatedBy());
|
||||
|
||||
bookingDao.save(existsType);
|
||||
processResult.setReturnData(existsType);
|
||||
processResult.setSuccess(true);
|
||||
}
|
||||
return processResult;
|
||||
}
|
||||
|
||||
public ServiceResult updateWaitlistBookingRemark(Bookings booking) {
|
||||
ServiceResult processResult= new ServiceResult();
|
||||
Bookings existsType = bookingDao.findById(booking.getId()).orElse(null);
|
||||
if(existsType==null) {
|
||||
processResult.setErrorCode("ERR_OBJECT_NOT_FOUND");
|
||||
processResult.setErrorMessage("Can't find Booking by Id");
|
||||
}else {
|
||||
existsType.setMscRemark(booking.getMscRemark());
|
||||
existsType.setUpdatedAt( DateTimeUtil.getCurrentDateTime("yyyy-MM-dd HH:mm:ss"));
|
||||
existsType.setUpdatedBy(booking.getUpdatedBy());
|
||||
|
||||
bookingDao.save(existsType);
|
||||
processResult.setReturnData(existsType);
|
||||
processResult.setSuccess(true);
|
||||
}
|
||||
return processResult;
|
||||
}
|
||||
|
||||
public ServiceResult updateBatchWaitlistBookingStatus(String[]bookIds,String status,String approver) {
|
||||
ServiceResult processResult= new ServiceResult();
|
||||
String approvedBy = null;
|
||||
LocalDateTime approvedAt = null;
|
||||
|
||||
bookingDao.updateBatchStatus(status,bookIds);
|
||||
if("W".equals(status)) {
|
||||
bookingDao.updateBatchApprover(approvedBy,approvedAt,bookIds);
|
||||
}else if("WA".equals(status)) {
|
||||
approvedBy = approver;
|
||||
approvedAt = DateTimeUtil.getCurrentDateTime("yyyy-MM-dd HH:mm:ss");
|
||||
bookingDao.updateBatchApprover(approvedBy,approvedAt,bookIds);
|
||||
}else if("WR".equals(status)) {
|
||||
approvedBy = approver;
|
||||
approvedAt = DateTimeUtil.getCurrentDateTime("yyyy-MM-dd HH:mm:ss");
|
||||
bookingDao.updateBatchApprover(approvedBy,approvedAt,bookIds);
|
||||
}
|
||||
processResult.setReturnData(bookIds);
|
||||
processResult.setSuccess(true);
|
||||
return processResult;
|
||||
}
|
||||
|
||||
public BookingsDto getBookingById(long id) {
|
||||
BookingsDto booking = bookingMapper.toBookingDto(bookingDao.findById(id).orElse(null));
|
||||
return booking;
|
||||
}
|
||||
|
||||
public BookingGetFollowUpNumResponse getFollowUpBookingNum(BookingGetFollowUpNumRequest bookingGetFollowUpNumRequest) {
|
||||
|
||||
BookingGetFollowUpNumResponse response = new BookingGetFollowUpNumResponse();
|
||||
|
||||
String marketCode = bookingGetFollowUpNumRequest.getSearchMarketCode();
|
||||
|
||||
if (StringUtils.isNotBlank(marketCode)) {
|
||||
response.setNewBooking(bookingDao.getFollowUpNewBookingByMarketCode(1,marketCode));
|
||||
response.setExtendBooking(bookingDao.getFollowUpNewBookingByMarketCode(2,marketCode));
|
||||
response.setPendingBooking(bookingDao.getFollowUpNewBookingByMarketCode(3,marketCode));
|
||||
response.setDoneBooking(bookingDao.getFollowUpNewBookingByMarketCode(4,marketCode));
|
||||
response.setCancelBooking(bookingDao.getFollowUpNewBookingByMarketCode(5,marketCode));
|
||||
}else {
|
||||
response.setNewBooking(bookingDao.getFollowUpNewBooking(1));
|
||||
response.setExtendBooking(bookingDao.getFollowUpNewBooking(2));
|
||||
response.setPendingBooking(bookingDao.getFollowUpNewBooking(3));
|
||||
response.setDoneBooking(bookingDao.getFollowUpNewBooking(4));
|
||||
response.setCancelBooking(bookingDao.getFollowUpNewBooking(5));
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public Bookings save(Bookings booking) {
|
||||
return bookingDao.save(booking);
|
||||
}
|
||||
|
||||
public DataTableResult<BookingsView> getBookingByPage(OtherPropertyPageRequest otherPropertyPageRequest) {
|
||||
|
||||
LogUtil.info(BookingService.class, "otherPropertyPageRequest body: " + JSON.toJSONString(otherPropertyPageRequest));
|
||||
|
||||
// 先验证分页参数
|
||||
otherPropertyPageRequest.validatePageInfo();
|
||||
Specification<BookingsView> listSpec = buildSpecificationViewByQueryFilter(otherPropertyPageRequest);
|
||||
int pageSize = otherPropertyPageRequest.getPageSize();
|
||||
int pageStart = otherPropertyPageRequest.getStartRow()/pageSize;
|
||||
String sortProperties = otherPropertyPageRequest.getSortOrder()!=null?otherPropertyPageRequest.getSortOrder():"";
|
||||
sortProperties = sortProperties.replace("1-asc", "-asc");
|
||||
sortProperties = sortProperties.replace("1-desc", "-desc");
|
||||
otherPropertyPageRequest.setSortOrder(sortProperties);
|
||||
Sort sort = DaoUtil.buildSortByString(otherPropertyPageRequest.getSortOrder(), "id");
|
||||
Pageable pageable = PageRequest.of(pageStart, pageSize, sort);
|
||||
Page<BookingsView> resultPage = bookingViewDao.findAll(listSpec, pageable);
|
||||
|
||||
// LogUtil.info(BookingService.class, "resultPage:"+resultPage.getContent());
|
||||
|
||||
DataTableResult<BookingsView> dataResult = new DataTableResult<BookingsView>();
|
||||
dataResult.setTotalRecords(resultPage.getTotalElements());
|
||||
dataResult.setPageSize(pageSize);
|
||||
List<BookingsView> resultList = resultPage.getContent();
|
||||
dataResult.setRowData(resultList);
|
||||
return dataResult;
|
||||
}
|
||||
public List<BookingsView> listBookingView(QueryFilter queryFilter) {
|
||||
OtherPropertyPageRequest otherPropertyPageRequest = new OtherPropertyPageRequest();
|
||||
Specification<BookingsView> listSpec = buildSpecificationViewByQueryFilter(otherPropertyPageRequest);
|
||||
Sort sort = DaoUtil.buildSortByFilter(queryFilter, "id");
|
||||
return bookingViewDao.findAll(listSpec,sort);
|
||||
}
|
||||
public List<Bookings> listBooking(QueryFilter queryFilter) {
|
||||
Specification<Bookings> listSpec = buildSpecificationByQueryFilter(queryFilter);
|
||||
Sort sort = DaoUtil.buildSortByFilter(queryFilter, "id");
|
||||
return bookingDao.findAll(listSpec,sort);
|
||||
}
|
||||
public List<BookingsViewDto> listBookingViewToExport(QueryFilter queryFilter) {
|
||||
OtherPropertyPageRequest otherPropertyPageRequest = queryFilter.convertToRequest(OtherPropertyPageRequest.class);
|
||||
if(otherPropertyPageRequest == null) {
|
||||
otherPropertyPageRequest = new OtherPropertyPageRequest();
|
||||
}
|
||||
Specification<BookingsView> listSpec = buildSpecificationViewByQueryFilter(otherPropertyPageRequest);
|
||||
Sort sort = DaoUtil.buildSortByFilter(queryFilter, "id");
|
||||
String sortProperties = queryFilter.getString("sortOrder");
|
||||
List<BookingsViewDto> resultList = bookingMapper.toBookingViewDtoList(bookingViewDao.findAll(listSpec,sort));
|
||||
if(resultList!=null) {
|
||||
List<CfgRoomFeatures> features = roomFeatureDao.findAll();
|
||||
int key = 1;
|
||||
for(BookingsViewDto booking:resultList) {
|
||||
String statusName="";
|
||||
if("W".equals(booking.getApproveStatus())) {
|
||||
statusName="Pending";
|
||||
}else if("WC".equals(booking.getApproveStatus())) {
|
||||
statusName="Cancelled";
|
||||
}else if("WF".equals(booking.getApproveStatus())) {
|
||||
statusName="Reserved";
|
||||
}else if("WE".equals(booking.getApproveStatus())) {
|
||||
statusName="Expired";
|
||||
}else if("F".equals(booking.getApproveStatus())) {
|
||||
statusName="Failed";
|
||||
}else if("FC".equals( booking.getApproveStatus())) {
|
||||
statusName="Completed";
|
||||
}else if("WA".equals(booking.getApproveStatus())) {
|
||||
statusName="Approved";
|
||||
}else if("WR".equals(booking.getApproveStatus())) {
|
||||
statusName="Reject";
|
||||
}
|
||||
|
||||
booking.setApproveStatusName(statusName);
|
||||
booking.setBookTypeName("1".equals(booking.getBookType())?"Extension":"New");
|
||||
if(booking.getSegment()!=null) {
|
||||
booking.setSegmentName(booking.getSegment().getSegmentName());
|
||||
}
|
||||
if(booking.getOtherRoomStatus()!=null) {
|
||||
booking.setRoomStatusName(booking.getOtherRoomStatus().getStatusName());
|
||||
}
|
||||
if(booking.getOtherFollowUpStatus()!=null) {
|
||||
booking.setFollowUpStatusName(booking.getOtherFollowUpStatus().getName());
|
||||
}
|
||||
|
||||
booking.setMemberFullName(booking.getMemberLastName());
|
||||
String nameStr = Strings.CS.replace(booking.getMemberLastName(), ", ", ";");
|
||||
String[] nameArr = StringUtils.split(nameStr, ";");
|
||||
if(nameArr!=null&&nameArr.length>1) {
|
||||
booking.setMemberFirstName(nameArr[1]);
|
||||
booking.setMemberLastName(nameArr[0]);
|
||||
}else {
|
||||
booking.setMemberFirstName(booking.getMemberLastName());
|
||||
}
|
||||
|
||||
if(booking.getFeatureCode()!=null && !booking.getFeatureCode().isEmpty()) {
|
||||
String[] arrSpecialCode = booking.getFeatureCode().split(",");
|
||||
String specialStr = "";
|
||||
if(arrSpecialCode.length>0)
|
||||
{
|
||||
for (String s : arrSpecialCode) {
|
||||
if (!s.isEmpty()) {
|
||||
for (CfgRoomFeatures feature : features) {
|
||||
if (feature.getDlAttributeId() != null && feature.getDlAttributeId().equals(s)) {
|
||||
if ("".equals(specialStr)) {
|
||||
specialStr = feature.getDescription();
|
||||
} else {
|
||||
specialStr = specialStr + ", " + feature.getDescription();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isEmpty(specialStr)) {
|
||||
booking.setSpecialName(booking.getFeatureCode());
|
||||
}else {
|
||||
booking.setSpecialName(specialStr);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(booking.getSharer()!=null&&!"[]".equals(booking.getSharer())
|
||||
&&!StringUtils.isEmpty(booking.getSharer())) {
|
||||
JSONArray sharerArr = JSONArray.parseArray(booking.getSharer());
|
||||
List<String> sharerId = new ArrayList<String>();
|
||||
List<String> sharerName = new ArrayList<String>();
|
||||
for(Object sharer : sharerArr) {
|
||||
JSONObject sharerObj = (JSONObject) sharer;
|
||||
if(sharerObj.containsKey("playerId")) {
|
||||
sharerId.add(sharerObj.get("playerId").toString());
|
||||
}
|
||||
if(sharerObj.containsKey("name")) {
|
||||
sharerName.add(sharerObj.get("name").toString());
|
||||
}
|
||||
}
|
||||
booking.setSharer(String.join(";", sharerId));
|
||||
booking.setSharerName(String.join(";", sharerName));
|
||||
}else {
|
||||
booking.setSharer("");
|
||||
booking.setSharerName("");
|
||||
}
|
||||
|
||||
if(sortProperties!=null && sortProperties.contains("dailyTheoProfit-asc")) {
|
||||
booking.setRankingByPlayer(resultList.size()-key-1+"");
|
||||
}else {
|
||||
booking.setRankingByPlayer(key+"");
|
||||
}
|
||||
key++;
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
private Specification<Bookings> buildSpecificationByQueryFilter(QueryFilter queryfilter) {
|
||||
Specification<Bookings> Bookingpec = new Specification<Bookings>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<Bookings> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
List<Predicate> list = new ArrayList<>();
|
||||
Map query = queryfilter.getFilterParas();
|
||||
if (StringUtils.isNotBlank(queryfilter.getString("searchName"))) {
|
||||
list.add(cb.like(cb.upper(root.get("id")),
|
||||
"%" + queryfilter.getString("searchName").toUpperCase() + "%"));
|
||||
}
|
||||
if (StringUtils.isNotBlank(queryfilter.getString("searchPlayerId"))) {
|
||||
list.add(cb.like(cb.upper(root.get("playerId")),
|
||||
"%" + queryfilter.getString("searchPlayerId").toUpperCase() + "%"));
|
||||
}
|
||||
if (StringUtils.isNotBlank(queryfilter.getString("searchConfirmationNo"))) {
|
||||
list.add(cb.like(cb.upper(root.get("confirmationNo")),
|
||||
"%" + queryfilter.getString("searchConfirmationNo").toUpperCase() + "%"));
|
||||
}
|
||||
if (StringUtils.isNotBlank(queryfilter.getString("searchStatus"))) {
|
||||
list.add(cb.like(cb.upper(root.get("approveStatus")),
|
||||
"%" + queryfilter.getString("searchStatus").toUpperCase() + "%"));
|
||||
}
|
||||
if(StringUtils.isNotBlank(queryfilter.getString("permissionId"))) {
|
||||
String routerId=queryfilter.getString("permissionId");
|
||||
String paraGroup=queryfilter.getString("permissionGroup");
|
||||
String groupName = StringUtils.isNotBlank(paraGroup)?paraGroup:"NO_GROUP";
|
||||
List<Long> accessRoomIds = sysGroupService.getGroupAccessRoomIds(routerId, groupName);
|
||||
list.add(root.get("roomId").in(accessRoomIds));
|
||||
}
|
||||
if (query.get("searchPropertyCode")!=null&&((ArrayList) query.get("searchPropertyCode")).size()>0) {
|
||||
CriteriaBuilder.In<String> in = cb.in(root.get("hotelCode"));
|
||||
List<Long> qu = (ArrayList) query.get("searchPropertyCode");
|
||||
for(int i=0;i<qu.size();i++){
|
||||
in.value((String.valueOf(qu.get(i))));
|
||||
}
|
||||
list.add(cb.and(cb.and(in)));
|
||||
}
|
||||
Predicate[] predicates = new Predicate[list.size()];
|
||||
criteriaQuery.where(list.toArray(predicates));
|
||||
return cb.and(list.toArray(predicates));
|
||||
}
|
||||
};
|
||||
return Bookingpec;
|
||||
}
|
||||
|
||||
private Specification<BookingsView> buildSpecificationViewByQueryFilter(OtherPropertyPageRequest otherPropertyPageRequest) {
|
||||
Specification<BookingsView> Bookingpec = new Specification<BookingsView>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<BookingsView> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
List<Predicate> list = new ArrayList<>();
|
||||
if (otherPropertyPageRequest.getSearchId() != null) {
|
||||
list.add(cb.equal(root.get("id"), otherPropertyPageRequest.getSearchId()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getSearchName())) {
|
||||
list.add(cb.like(cb.upper(root.get("id")),
|
||||
"%" + otherPropertyPageRequest.getSearchName().toUpperCase() + "%"));
|
||||
}
|
||||
if(StringUtils.isNotBlank(otherPropertyPageRequest.getSearchBookerId())) {
|
||||
list.add(cb.like(cb.upper(root.get("createdBy")),
|
||||
"%" + otherPropertyPageRequest.getSearchBookerId().toUpperCase() + "%"));
|
||||
}
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getSearchBookerName())) {
|
||||
list.add(cb.like(cb.upper(root.get("booker")),
|
||||
"%" + otherPropertyPageRequest.getSearchBookerName().toUpperCase() + "%"));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getSearchBookerTeam())) {
|
||||
list.add(cb.like(cb.upper(root.get("bookerTeam")),
|
||||
"%" + otherPropertyPageRequest.getSearchBookerTeam().toUpperCase() + "%"));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getSearchPlayerId())) {
|
||||
list.add(cb.like(cb.upper(root.get("playerId")),
|
||||
"%" + otherPropertyPageRequest.getSearchPlayerId().toUpperCase() + "%"));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getSearchLastName())) {
|
||||
list.add(cb.like(cb.upper(root.get("memberLastName")),
|
||||
"%" + otherPropertyPageRequest.getSearchLastName().toUpperCase() + "%"));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getSearchFirstName())) {
|
||||
list.add(cb.like(cb.upper(root.get("memberLastName")),
|
||||
"%" + ", " + otherPropertyPageRequest.getSearchFirstName().toUpperCase() + "%"));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getSearchConfirmationNo())) {
|
||||
list.add(cb.like(cb.upper(root.get("confirmationNo")),
|
||||
"%" + otherPropertyPageRequest.getSearchConfirmationNo().toUpperCase() + "%"));
|
||||
}
|
||||
if(StringUtils.isNotBlank(otherPropertyPageRequest.getSearchStatus())) {
|
||||
List<String> searchStatus = DaoUtil.parseMultipleFilter(otherPropertyPageRequest.getSearchStatus());
|
||||
if(searchStatus.size() == 1) {
|
||||
list.add(cb.equal(root.get("approveStatus"), searchStatus.get(0)));
|
||||
} else if(searchStatus.size() > 1) {
|
||||
list.add(root.get("approveStatus").in(searchStatus));
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(otherPropertyPageRequest.getSearchTryTime())) {
|
||||
try {
|
||||
int tryTime = Integer.parseInt(otherPropertyPageRequest.getSearchTryTime());
|
||||
if(tryTime > 0) {
|
||||
list.add(cb.greaterThanOrEqualTo(root.get("tryTime"), tryTime));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
if(otherPropertyPageRequest.getSearchPropertyId() != null && !otherPropertyPageRequest.getSearchPropertyId().isEmpty()) {
|
||||
List<Long> propertyIds = otherPropertyPageRequest.getSearchPropertyId();
|
||||
if(!propertyIds.isEmpty()) {
|
||||
if(!propertyIds.contains(0L)) {
|
||||
list.add(root.get("propertyId").in(propertyIds));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(otherPropertyPageRequest.getSearchBookDate() != null && !otherPropertyPageRequest.getSearchBookDate().isEmpty()) {
|
||||
List<String> date = otherPropertyPageRequest.getSearchBookDate();
|
||||
if(date.size() >= 2) {
|
||||
list.add(cb.greaterThanOrEqualTo(root.get("createdAt"),
|
||||
DateTimeUtil.getDateFromString(date.get(0) + " 00:00:00", "yyyy-MM-dd HH:mm:ss")));
|
||||
list.add(cb.lessThanOrEqualTo(root.get("createdAt"),
|
||||
DateTimeUtil.getDateFromString(date.get(1) + " 23:59:59", "yyyy-MM-dd HH:mm:ss")));
|
||||
}
|
||||
}
|
||||
if(otherPropertyPageRequest.getSearchCheckInDate() != null && !otherPropertyPageRequest.getSearchCheckInDate().isEmpty()) {
|
||||
List<String> searchCheckInDate = otherPropertyPageRequest.getSearchCheckInDate();
|
||||
if(searchCheckInDate.size() >= 1) {
|
||||
list.add(cb.greaterThanOrEqualTo(root.get("checkoutDate"),
|
||||
DateTimeUtil.getDateFromString(searchCheckInDate.get(0), "yyyy-MM-dd")));
|
||||
if(searchCheckInDate.size() >= 2) {
|
||||
list.add(cb.lessThanOrEqualTo(root.get("checkinDate"),
|
||||
DateTimeUtil.getDateFromString(searchCheckInDate.get(1), "yyyy-MM-dd")));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getSearchWaitlistCheckInDate())) {
|
||||
String searchWaitlistCheckInDate = otherPropertyPageRequest.getSearchWaitlistCheckInDate();
|
||||
String[] date = searchWaitlistCheckInDate.split(",");
|
||||
if(date.length >= 1) {
|
||||
list.add(cb.greaterThanOrEqualTo(root.get("checkinDate"),
|
||||
DateTimeUtil.getDateFromString(date[0], "yyyy-MM-dd")));
|
||||
if(date.length >= 2) {
|
||||
list.add(cb.lessThanOrEqualTo(root.get("checkinDate"),
|
||||
DateTimeUtil.getDateFromString(date[1], "yyyy-MM-dd")));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(otherPropertyPageRequest.getPermissionId())) {
|
||||
String routerId = otherPropertyPageRequest.getPermissionId();
|
||||
String paraGroup = otherPropertyPageRequest.getPermissionGroup();
|
||||
String groupName = StringUtils.isNotBlank(paraGroup) ? paraGroup : "NO_GROUP";
|
||||
List<Long> accessRoomIds = sysGroupService.getGroupAccessRoomIds(routerId, groupName);
|
||||
list.add(root.get("roomId").in(accessRoomIds));
|
||||
}
|
||||
if(otherPropertyPageRequest.getSearchRoomId() != null && !otherPropertyPageRequest.getSearchRoomId().isEmpty()) {
|
||||
List<Long> roomIds = otherPropertyPageRequest.getSearchRoomId();
|
||||
if(!roomIds.isEmpty()) {
|
||||
list.add(root.get("roomId").in(roomIds));
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(otherPropertyPageRequest.getSearchRoomTypeId())) {
|
||||
try {
|
||||
String[] roomTypeIdArray = otherPropertyPageRequest.getSearchRoomTypeId().split(",");
|
||||
List<Long> roomTypeIds = new ArrayList<>();
|
||||
for (String id : roomTypeIdArray) {
|
||||
roomTypeIds.add(Long.parseLong(id.trim()));
|
||||
}
|
||||
if(!roomTypeIds.isEmpty()) {
|
||||
list.add(root.get("roomTypeId").in(roomTypeIds));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
if(otherPropertyPageRequest.getSearchOtherRoomStatusId() != null &&
|
||||
!otherPropertyPageRequest.getSearchOtherRoomStatusId().isEmpty()) {
|
||||
List<Long> otherRoomStatusIds = otherPropertyPageRequest.getSearchOtherRoomStatusId();
|
||||
if(!otherRoomStatusIds.isEmpty()) {
|
||||
if(!otherRoomStatusIds.contains(0L)) {
|
||||
list.add(root.get("otherRoomStatusId").in(otherRoomStatusIds));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getSearchPropertyCategory())) {
|
||||
list.add(cb.like(cb.upper(root.get("propertyCategory")),
|
||||
"%" + otherPropertyPageRequest.getSearchPropertyCategory().toUpperCase() + "%"));
|
||||
}
|
||||
|
||||
if (otherPropertyPageRequest.getSearchFollowUpStatusId() != null) {
|
||||
list.add(cb.equal(root.get("otherFollowUpStatusId"),
|
||||
otherPropertyPageRequest.getSearchFollowUpStatusId()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getSearchMarketCode())) {
|
||||
list.add(cb.equal(cb.upper(root.get("marketCode")),
|
||||
otherPropertyPageRequest.getSearchMarketCode().toUpperCase()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getSearchSourceCode())) {
|
||||
list.add(cb.equal(cb.upper(root.get("dlSourceId")),
|
||||
otherPropertyPageRequest.getSearchSourceCode().toUpperCase()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getPropertyName())) {
|
||||
list.add(cb.like(cb.upper(root.get("propertyName")),
|
||||
"%" + otherPropertyPageRequest.getPropertyName().toUpperCase() + "%"));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getRoomStatusName())) {
|
||||
list.add(cb.like(cb.upper(root.get("roomStatusName")),
|
||||
"%" + otherPropertyPageRequest.getRoomStatusName().toUpperCase() + "%"));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getRoomTypeName())) {
|
||||
list.add(cb.like(cb.upper(root.get("roomTypeName")),
|
||||
"%" + otherPropertyPageRequest.getRoomTypeName().toUpperCase() + "%"));
|
||||
}
|
||||
|
||||
Predicate[] predicates = new Predicate[list.size()];
|
||||
criteriaQuery.where(list.toArray(predicates));
|
||||
return cb.and(list.toArray(predicates));
|
||||
}
|
||||
};
|
||||
return Bookingpec;
|
||||
}
|
||||
public DataTableResult<BookingsView> getMockupBookingByPage() throws Exception {
|
||||
List<BookingsView> bookList = bookingViewDao.findMockupOtherPropertyBooking();
|
||||
DataTableResult<BookingsView> dataResult = new DataTableResult<>();
|
||||
dataResult.setTotalRecords(bookList.size());
|
||||
dataResult.setPageSize(0);
|
||||
dataResult.setRowData(bookList);
|
||||
return dataResult;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.mgm.mcrm.reservation.services;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.StoredProcedureQuery;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Service
|
||||
public class OperaDBBookingService {
|
||||
|
||||
@Autowired
|
||||
private EntityManager entityManager;
|
||||
|
||||
@Autowired
|
||||
private EntityManagerFactory factory;
|
||||
|
||||
|
||||
public List<String> getOperaNameIDByPlayerID(String playerId){
|
||||
EntityManager entity = this.factory.createEntityManager();
|
||||
List<String> lists = new ArrayList<>();
|
||||
try {
|
||||
StoredProcedureQuery store = entity.createNamedStoredProcedureQuery("getOperaNameIDByPlayerID");
|
||||
store.setParameter("player_id", playerId);
|
||||
lists = store.getResultList();
|
||||
entity.close();
|
||||
} catch (Exception e) {
|
||||
entity.close();
|
||||
e.printStackTrace();
|
||||
}
|
||||
return lists;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,207 @@
|
||||
package com.mgm.mcrm.reservation.services;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.mgm.mcrm.common.constants.SysCommon;
|
||||
import com.mgm.mcrm.common.dtos.DataTableResult;
|
||||
import com.mgm.mcrm.common.dtos.HttpResponseResult;
|
||||
import com.mgm.mcrm.common.dtos.ServiceResult;
|
||||
import com.mgm.mcrm.reservation.dtos.BookingsDto;
|
||||
import com.mgm.mcrm.reservation.models.BookingsView;
|
||||
import com.mgm.mcrm.reservation.repositories.BookingViewDao;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import com.mgm.mcrm.common.utils.HttpUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class WebBookingService {
|
||||
|
||||
@Resource
|
||||
BookingViewDao bookingsViewDao;
|
||||
|
||||
public ServiceResult webRecordSearch(HttpServletRequest request, JSONObject temp) throws Exception {
|
||||
ServiceResult result = new ServiceResult();
|
||||
|
||||
HttpResponseResult httpResult = HttpUtil.invokeWebAPI(temp, "POST", request,null);
|
||||
String content = httpResult.getResponseContent();
|
||||
JSONArray array = JSONObject.parseArray(content);
|
||||
|
||||
List<BookingsView> bookingsList = array.toJavaList(BookingsView.class);
|
||||
|
||||
if(!array.isEmpty()) {
|
||||
result.setSuccess(true);
|
||||
result.setReturnData(bookingsList);
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
result.setErrorMessage("System Error");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ServiceResult getGamingData(HttpServletRequest request,JSONObject temp) throws Exception {
|
||||
ServiceResult result = new ServiceResult();
|
||||
HttpResponseResult httpResult = HttpUtil.invokeWebAPI(temp, "POST", request,null);
|
||||
String content = httpResult.getResponseContent();
|
||||
JSONObject obj = JSONObject.parseObject(content);
|
||||
if(obj.getBooleanValue("success")) {
|
||||
result.setSuccess(true);
|
||||
Object getData = obj.get("data");
|
||||
result.setReturnData(getData);
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
if(obj.getString("message")!=null&&!obj.getString("message").isEmpty()) {
|
||||
result.setErrorMessage(obj.getString("message"));
|
||||
}else {
|
||||
result.setErrorMessage("System Error");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ServiceResult updateWaitlistStatus(HttpServletRequest request,JSONObject temp) throws Exception {
|
||||
ServiceResult result = new ServiceResult();
|
||||
JSONObject requestObj = temp;
|
||||
HttpResponseResult httpResult = HttpUtil.invokeWebAPI(requestObj, "POST", request,null);
|
||||
String content = httpResult.getResponseContent();
|
||||
JSONObject obj = JSONObject.parseObject(content);
|
||||
if(obj.getBooleanValue("success")) {
|
||||
result.setSuccess(true);
|
||||
Object getData = obj.get("data");
|
||||
result.setReturnData(getData);
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
if(obj.getString("message")!=null&&obj.getString("message")!="") {
|
||||
result.setErrorMessage(obj.getString("message"));
|
||||
}else {
|
||||
result.setErrorMessage("System Error");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ServiceResult updateBatchWaitlistStatus(HttpServletRequest request,JSONObject temp) throws Exception {
|
||||
ServiceResult result = new ServiceResult();
|
||||
JSONObject requestObj = temp;
|
||||
HttpResponseResult httpResult = HttpUtil.invokeWebAPI(requestObj, "POST", request, null);
|
||||
String content = httpResult.getResponseContent();
|
||||
JSONObject obj = JSONObject.parseObject(content);
|
||||
if(obj.getBooleanValue("success")) {
|
||||
result.setSuccess(true);
|
||||
Object getData = obj.get("data");
|
||||
result.setReturnData(getData);
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
if (obj.getString("message") != null&& !"".equals(obj.getString("message"))) {
|
||||
result.setErrorMessage(obj.getString("message"));
|
||||
} else {
|
||||
result.setErrorMessage("System Error");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ServiceResult getBookingByPage(HttpServletRequest request,JSONObject temp) throws Exception {
|
||||
ServiceResult result = new ServiceResult();
|
||||
JSONObject requestObj = temp;
|
||||
HttpResponseResult httpResult = HttpUtil.invokeWebAPI(requestObj, "POST", request, null);
|
||||
String content = httpResult.getResponseContent();
|
||||
JSONObject obj = JSONObject.parseObject(content);
|
||||
if(obj.getBooleanValue("success")) {
|
||||
result.setSuccess(true);
|
||||
Object getData = obj.get("data");
|
||||
result.setReturnData(getData);
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
if(obj.getString("message")!=null && "".equals(obj.getString("message"))) {
|
||||
result.setErrorMessage(obj.getString("message"));
|
||||
}else {
|
||||
result.setErrorMessage("System Error");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ServiceResult batchImportRows(HttpServletRequest request,JSONArray temp) throws Exception {
|
||||
ServiceResult result = new ServiceResult();
|
||||
JSONArray requestObj = temp;
|
||||
HttpResponseResult httpResult = HttpUtil.invokeWebAPIForArray(requestObj, "POST", request);
|
||||
String content = httpResult.getResponseContent();
|
||||
JSONObject obj = JSONObject.parseObject(content);
|
||||
if(obj.getBooleanValue("success")) {
|
||||
result.setSuccess(true);
|
||||
Object getData = obj.get("data");
|
||||
result.setReturnData(getData);
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
if(obj.getString("message")!=null && "".equals(obj.getString("message"))) {
|
||||
result.setErrorMessage(obj.getString("message"));
|
||||
}else {
|
||||
result.setErrorMessage("System Error");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ServiceResult uploadExcel(HttpServletRequest request,MultipartFile[] files) throws Exception {
|
||||
ServiceResult result = new ServiceResult();
|
||||
JSONObject requestObj = new JSONObject();
|
||||
HttpResponseResult httpResult = HttpUtil.invokeWebAPI(requestObj, "POST", request,files);
|
||||
String content = httpResult.getResponseContent();
|
||||
JSONObject obj = JSONObject.parseObject(content);
|
||||
obj.put("success", true);
|
||||
if(obj.getBooleanValue("success")) {
|
||||
result.setSuccess(true);
|
||||
Object getData = obj.get("data");
|
||||
result.setReturnData(getData);
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
if(obj.getString("message")!=null && "".equals(obj.getString("message"))) {
|
||||
result.setErrorMessage(obj.getString("message"));
|
||||
}else {
|
||||
result.setErrorMessage("System Error");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ServiceResult cancelApproval(HttpServletRequest request,JSONObject temp) throws Exception {
|
||||
ServiceResult result = new ServiceResult();
|
||||
JSONObject requestObj = temp;
|
||||
HttpResponseResult httpResult = HttpUtil.invokeWebAPI(requestObj, "POST", request, null);
|
||||
String content = httpResult.getResponseContent();
|
||||
JSONObject obj = (JSONObject) JSONObject.parseObject(content);
|
||||
if(obj.getBooleanValue("success")) {
|
||||
result.setSuccess(true);
|
||||
Object getData = obj.get("data");
|
||||
result.setReturnData(getData);
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
if(obj.getString("message")!=null&&obj.getString("message")!="") {
|
||||
result.setErrorMessage(obj.getString("message"));
|
||||
}else {
|
||||
result.setErrorMessage("System Error");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public DataTableResult<BookingsView> getMockupWaitlist() throws Exception {
|
||||
List<BookingsView> bookList = bookingsViewDao.findMockupWaitlistBooking();
|
||||
DataTableResult<BookingsView> dataResult = new DataTableResult<>();
|
||||
dataResult.setTotalRecords(bookList.size());
|
||||
dataResult.setPageSize(0);
|
||||
dataResult.setRowData(bookList);
|
||||
return dataResult;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user