optimize codes
This commit is contained in:
@@ -187,7 +187,7 @@ public class ApprovalService {
|
||||
return response;
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
HttpResponseResult httpResult = mgmApiService.invokeGetApprover(playerId,bookingType,propertyName,roomCategory,checkInDate,checkOutDate,userId);
|
||||
try {
|
||||
ApproverResult resultObj = JSONObject.parseObject(httpResult.getResponseContent(), ApproverResult.class, Feature.SupportNonPublicField,Feature.IgnoreNotMatch);
|
||||
@@ -328,7 +328,7 @@ public class ApprovalService {
|
||||
// 已超过入住日(不含当天),且当前时间不在配置的 HH:mm 窗口内 → AE
|
||||
if (checkinDateOnly.isBefore(today)
|
||||
&& !isCurrentTimeWithinCutoffWindowGmt8(cutoffStartTimeValue, cutoffEndTimeValue)) {
|
||||
Bookings entity = bookingDao.getById(booking.getId());
|
||||
Bookings entity = bookingDao.findById(booking.getId()).orElse(null);
|
||||
if (entity != null) {
|
||||
entity.setApproveStatus("AE");
|
||||
entity.setUpdatedAt(now);
|
||||
@@ -374,8 +374,8 @@ public class ApprovalService {
|
||||
Date createDate = new Date();
|
||||
Bookings booking = new Bookings();
|
||||
Long bookId = Long.valueOf(String.valueOf(param.get("id")));
|
||||
ArrayList<Bookings> booksList = new ArrayList();
|
||||
booking = bookingDao.getById(bookId);
|
||||
ArrayList<Bookings> booksList = new ArrayList<>();
|
||||
booking = bookingDao.findById(bookId).orElse(null);
|
||||
String status = booking.getApproveStatus();
|
||||
|
||||
if (Strings.CS.equals(booking.getCreatedBy(),userId)){
|
||||
@@ -539,7 +539,7 @@ public class ApprovalService {
|
||||
cfgApprovalRouting.setUpdatedBy(userId);
|
||||
approvalRoutingDao.save(cfgApprovalRouting);
|
||||
|
||||
Bookings entity = bookingDao.getById(cfgApprovalRouting.getBookingId());
|
||||
Bookings entity = bookingDao.findById(cfgApprovalRouting.getBookingId()).orElse(null);
|
||||
if (entity != null) {
|
||||
entity.setApproveStatus("AE");
|
||||
entity.setUpdatedAt(now);
|
||||
@@ -642,7 +642,7 @@ public class ApprovalService {
|
||||
return response;
|
||||
}
|
||||
|
||||
Bookings booking = bookingDao.getById(approvalRouting.getBookingId());
|
||||
Bookings booking = bookingDao.findById(approvalRouting.getBookingId()).orElse(null);
|
||||
booking.setApprovedId(Long.valueOf(userId));
|
||||
booking.setApprovedAt(now);
|
||||
booking.setApproveStatus("AR");
|
||||
@@ -708,8 +708,8 @@ public class ApprovalService {
|
||||
|
||||
public BaseApiResponse<SubmitApprovalResponse> submitApproval(String bookingId,String checkinDate,String checkoutDate,String userId,HttpServletRequest request) throws Exception {
|
||||
BaseApiResponse<SubmitApprovalResponse> response = new BaseApiResponse<>();
|
||||
SysLogBooking sysLogBooking = new SysLogBooking();
|
||||
ArrayList<SysLogBooking> addList = new ArrayList();
|
||||
|
||||
ArrayList<SysLogBooking> addList = new ArrayList<>();
|
||||
Gson gson = new Gson();
|
||||
CfgApprovalRouting approvalRouting = approvalRoutingDao.getByBookingId(Long.valueOf(bookingId));
|
||||
LogUtil.info(ApprovalService.class,"Submitting Approval.UserId:"+userId+"BookingId"+bookingId
|
||||
@@ -720,7 +720,6 @@ public class ApprovalService {
|
||||
if (approvalRouting != null && isCurrentUserInApproverList(approvalRouting.getApproverId(), userId)
|
||||
&& "AP".equals(approvalRouting.getBookingStatus())) {
|
||||
LogUtil.info(ApprovalService.class,"Submit Approval.UserId:"+userId);
|
||||
System.out.println("Version = "+approvalRouting.getVersion());
|
||||
//相同 处理approvalRouting记录 并调用 Call OWS createbooking
|
||||
approvalRouting.setBookingStatus("AA");
|
||||
CfgApprovalRouting changeRecord = approvalRoutingDao.save(approvalRouting);
|
||||
@@ -755,7 +754,7 @@ public class ApprovalService {
|
||||
}
|
||||
|
||||
Date creatdDate = DateTimeUtil.getCurrentDateTime("yyyy-MM-dd HH:mm:ss");
|
||||
Bookings originBooking = bookingDao.getById(approvalRouting.getBookingId());
|
||||
Bookings originBooking = bookingDao.findById(approvalRouting.getBookingId()).orElse(null);
|
||||
originBooking.setApproveStatus("AA");
|
||||
originBooking.setApprovedAt(now);
|
||||
originBooking.setApprovedBy(userName);
|
||||
@@ -763,7 +762,7 @@ public class ApprovalService {
|
||||
originBooking.setApprovedId(Long.valueOf(userId));
|
||||
}
|
||||
if (!Strings.CS.equals(originBooking.getCheckinDate().toString(),checkinDate)){
|
||||
SysLogBooking newLogBooking = gson.fromJson(gson.toJson(sysLogBooking), SysLogBooking.class);
|
||||
SysLogBooking newLogBooking = new SysLogBooking();
|
||||
newLogBooking.setOccurTime(now);
|
||||
newLogBooking.setBookId(Long.valueOf(bookingId));
|
||||
newLogBooking.setEventCode("Check In Date");
|
||||
@@ -776,7 +775,7 @@ public class ApprovalService {
|
||||
originBooking.setCheckinDate(checkin);
|
||||
}
|
||||
if(!Strings.CS.equals(originBooking.getCheckoutDate().toString(),checkoutDate)){
|
||||
SysLogBooking newLogBooking = gson.fromJson(gson.toJson(sysLogBooking), SysLogBooking.class);
|
||||
SysLogBooking newLogBooking = new SysLogBooking();
|
||||
newLogBooking.setOccurTime(now);
|
||||
newLogBooking.setBookId(Long.valueOf(bookingId));
|
||||
newLogBooking.setEventCode("Check Out Date");
|
||||
@@ -790,8 +789,7 @@ public class ApprovalService {
|
||||
}
|
||||
BookingsView bookingView = bookingViewDao.findById(Long.parseLong(bookingId));
|
||||
// 获取Property
|
||||
CfgProperties properties = propertyDao.getById(originBooking.getPropertyId());
|
||||
|
||||
CfgProperties properties = propertyDao.findById(originBooking.getPropertyId()).orElse(null);
|
||||
|
||||
Boolean isOverBook = this.checkIsOverbook(bookingView.getRoomId(), bookingView.getCheckinDate(),
|
||||
bookingView.getCheckoutDate(), bookingView.getPropertyId(), bookingView.getBlockId());
|
||||
|
||||
Reference in New Issue
Block a user