update
This commit is contained in:
@@ -63,6 +63,60 @@
|
||||
"attrName": "marketCodeName",
|
||||
"dataType": "String",
|
||||
"columnWidth":20
|
||||
},
|
||||
{
|
||||
"columnHeader":"Approver",
|
||||
"attrName": "approver",
|
||||
"dataType": "String",
|
||||
"columnWidth":30
|
||||
},
|
||||
{
|
||||
"columnHeader":"Room Category",
|
||||
"attrName": "compRuleCategory",
|
||||
"dataType": "String",
|
||||
"columnWidth":30
|
||||
},
|
||||
{
|
||||
"columnHeader":"Complimentary Type",
|
||||
"attrName": "compTypeContent",
|
||||
"dataType": "String",
|
||||
"columnWidth":30
|
||||
},
|
||||
{
|
||||
"columnHeader":"Complimentary Type Id",
|
||||
"attrName": "dlCompTypeId",
|
||||
"dataType": "String",
|
||||
"columnWidth":30
|
||||
},
|
||||
{
|
||||
"columnHeader":"Payment Method Code",
|
||||
"attrName": "paymentMethodCodeContent",
|
||||
"dataType": "String",
|
||||
"columnWidth":30
|
||||
},
|
||||
{
|
||||
"columnHeader":"Payment Method Code Id",
|
||||
"attrName": "dlPaymentMethodCodeId",
|
||||
"dataType": "String",
|
||||
"columnWidth":30
|
||||
},
|
||||
{
|
||||
"columnHeader":"Complimentary Preset",
|
||||
"attrName": "compPresetContent",
|
||||
"dataType": "String",
|
||||
"columnWidth":40
|
||||
},
|
||||
{
|
||||
"columnHeader":"Complimentary Preset Id",
|
||||
"attrName": "compPresetId",
|
||||
"dataType": "String",
|
||||
"columnWidth":40
|
||||
},
|
||||
{
|
||||
"columnHeader":"Soft Limit",
|
||||
"attrName": "softLimit",
|
||||
"dataType": "String",
|
||||
"columnWidth":30
|
||||
}
|
||||
]
|
||||
}]
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"headerTextColor":"#000000",
|
||||
"textAlign":"left",
|
||||
"textColor":"#000000",
|
||||
"objClassName": "com.mgm.mcrm.reservation.models.BookingsView",
|
||||
"objClassName": "com.mgm.mcrm.reservation.dtos.BookingsViewDto",
|
||||
"columnDefs": [
|
||||
{
|
||||
"columnHeader":"Waitlist Status",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"headerTextColor":"#000000",
|
||||
"textAlign":"left",
|
||||
"textColor":"#000000",
|
||||
"objClassName": "com.mgm.mcrm.reservation.models.BookingsView",
|
||||
"objClassName": "com.mgm.mcrm.reservation.dtos.BookingsViewDto",
|
||||
"columnDefs": [
|
||||
{
|
||||
"columnHeader":"Waitlist Status",
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
{
|
||||
"importName": "IMPORT_EXCEPTION_DAYLIGHT",
|
||||
"importPages": [
|
||||
{
|
||||
"sheetIndx": 0,
|
||||
"dataElements": [
|
||||
{
|
||||
"offsetRow": 1,
|
||||
"offsetCol": 0,
|
||||
"objClassName": "com.mgm.mcrm.common.dtos.dataimport.appsetting.ExceptionDaylightImportRow",
|
||||
"columnDefs": [
|
||||
{
|
||||
"columnHeader": "User ID",
|
||||
"checkHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "userId",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Booking Type",
|
||||
"checkHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "bookingTypeName",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Hotel Property",
|
||||
"checkHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "propertyName",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Block Code",
|
||||
"checkHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "blockCodeName",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Rate Code",
|
||||
"checkHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "rateCodeName",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Room Type",
|
||||
"checkHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "roomTypeNames",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Source Code",
|
||||
"checkHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "sourceCodeName",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Market Code",
|
||||
"checkHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "marketCodeName",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Approver",
|
||||
"checkHeader": true,
|
||||
"optionalHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "approver",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Room Category",
|
||||
"checkHeader": true,
|
||||
"optionalHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "compRuleCategory",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Complimentary Type",
|
||||
"checkHeader": true,
|
||||
"optionalHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "compTypeContent",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Complimentary Type Id",
|
||||
"checkHeader": true,
|
||||
"optionalHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "dlCompTypeId",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Payment Method Code",
|
||||
"checkHeader": true,
|
||||
"optionalHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "paymentMethodCodeContent",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Payment Method Code Id",
|
||||
"checkHeader": true,
|
||||
"optionalHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "dlPaymentMethodCodeId",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Complimentary Preset",
|
||||
"checkHeader": true,
|
||||
"optionalHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "compPresetContent",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Complimentary Preset Id",
|
||||
"checkHeader": true,
|
||||
"optionalHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "compPresetId",
|
||||
"dataType": "String"
|
||||
},
|
||||
{
|
||||
"columnHeader": "Soft Limit",
|
||||
"checkHeader": true,
|
||||
"optionalHeader": true,
|
||||
"headerRowIdx": 0,
|
||||
"attrName": "softLimit",
|
||||
"dataType": "String"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -47,6 +47,7 @@
|
||||
},
|
||||
{
|
||||
"columnHeader": "Category",
|
||||
"optionalHeader": true,
|
||||
"attrName": "category",
|
||||
"dataType": "String",
|
||||
"columnWidth": 50
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"dataElements": [{
|
||||
"offsetRow": 2,
|
||||
"offsetCol": 0,
|
||||
"objClassName": "com.mgm.mcrm.common.dtos.dataimport.appsetting.RoomCriteriaImportRow",
|
||||
"objClassName": "com.mgm.mcrm.allotment.dtos.request.RoomCriteriaImportRowRequest",
|
||||
"columnDefs": [{
|
||||
"columnHeader":"Property",
|
||||
"attrName": "propertyName",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"dataElements": [{
|
||||
"offsetRow": 2,
|
||||
"offsetCol": 0,
|
||||
"objClassName": "com.mgm.mcrm.common.dtos.dataimport.appsetting.RoomCriteriaImportRow",
|
||||
"objClassName": "com.mgm.mcrm.allotment.dtos.request.RoomCriteriaImportRowRequest",
|
||||
"columnDefs": [{
|
||||
"columnHeader":"Property",
|
||||
"attrName": "propertyName",
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>21</java.version>
|
||||
<tomcat.version>11.0.25</tomcat.version>
|
||||
<netty.version>4.2.18.Final</netty.version>
|
||||
<httpclient5.version>5.6.4</httpclient5.version>
|
||||
<httpclient5-win.version>5.2.3</httpclient5-win.version>
|
||||
|
||||
@@ -9,5 +9,5 @@ import lombok.Setter;
|
||||
@NoArgsConstructor
|
||||
public class SysGroupDeleteByIdRequest {
|
||||
|
||||
private Long Id;
|
||||
private Long id;
|
||||
}
|
||||
|
||||
@@ -200,22 +200,6 @@ public class PlayerService {
|
||||
String content = httpResult.getResponseContent();
|
||||
JSONObject obj = new JSONObject();
|
||||
obj = (JSONObject) JSONObject.parseObject(content);
|
||||
if(SysCommon.mgmApiMockup){
|
||||
CheckTpdDto checkTpdDto = new CheckTpdDto();
|
||||
CheckTpdRecordDto checkTpdRecordDto = new CheckTpdRecordDto();
|
||||
checkTpdRecordDto.setPlayerId(playerId);
|
||||
checkTpdRecordDto.setBookingDate("2024/06/01");
|
||||
checkTpdRecordDto.setRoomCategory("GR");
|
||||
checkTpdRecordDto.setBookingDateQualificationFlag(1);
|
||||
List<CheckTpdRecordDto> list = new ArrayList<>();
|
||||
list.add(checkTpdRecordDto);
|
||||
checkTpdDto.setRecord(list);
|
||||
checkTpdDto.setStatus(0);
|
||||
checkTpdDto.setStatusDescription("SUCCESS");
|
||||
|
||||
result.setSuccess(true);
|
||||
result.setReturnData(checkTpdDto);
|
||||
}else{
|
||||
if(obj.getBooleanValue("success")) {
|
||||
result.setSuccess(true);
|
||||
Object getData = obj.get("data");
|
||||
@@ -228,7 +212,7 @@ public class PlayerService {
|
||||
result.setErrorMessage("System Error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.google.gson.Gson;
|
||||
|
||||
import com.mgm.mcrm.common.utils.DaoUtil;
|
||||
import com.mgm.mcrm.common.utils.LogUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SysGroupService {
|
||||
@@ -257,6 +258,20 @@ public class SysGroupService {
|
||||
return validGroupNames;
|
||||
}
|
||||
|
||||
public String getFullGroupNames() {
|
||||
String validGroupNames ="";
|
||||
List<SysGroup> groups = sysGroupDao.findAll();
|
||||
if(!groups.isEmpty()) {
|
||||
for(SysGroup gItem:groups) {
|
||||
if(StringUtils.isNotBlank(validGroupNames)) {
|
||||
validGroupNames+=";";
|
||||
}
|
||||
validGroupNames+=gItem.getDisplayName();
|
||||
}
|
||||
}
|
||||
return validGroupNames;
|
||||
}
|
||||
|
||||
public AssignGroupDataAccess queryGroupAccessSetting(Long groupId) {
|
||||
AssignGroupDataAccess accessInfo = null;
|
||||
if(groupId !=null) {
|
||||
@@ -347,6 +362,7 @@ public class SysGroupService {
|
||||
return isFind;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public String assignGroupDataAccess(SysGroupSaveAccessSettingRequest sysGroupSaveAccessSettingRequest) {
|
||||
String resMessage="";
|
||||
Long groupId = sysGroupSaveAccessSettingRequest.getGroupId();
|
||||
|
||||
@@ -347,7 +347,7 @@ public class SysUserService {
|
||||
String token = request.getHeader("Authorization");
|
||||
token = token.substring(7);
|
||||
String loginId = JWT.decode(token).getSubject();
|
||||
String groupName = JWT.decode(token).getClaim("user_group").asString();
|
||||
String groupName = JWT.decode(token).getClaim("group_name").asString();
|
||||
if(loginId!=null && Strings.CS.equals(SysConstants.SUPER_ADMIN_ID,loginId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,4 +27,11 @@ public class CfgAppChannelDaylight implements Serializable {
|
||||
private Integer pickedUp;
|
||||
@Column(name="available")
|
||||
private Integer available;
|
||||
|
||||
@PostLoad
|
||||
public void postLoad() {
|
||||
if (channelTotal == null) channelTotal = 0;
|
||||
if (pickedUp == null) pickedUp = 0;
|
||||
if (available == null) available = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public interface DaylightRoomTypeAllotmentDao extends JpaRepository<CfgDlRoomTyp
|
||||
public Integer getAvailable();
|
||||
}
|
||||
|
||||
@Query(value = "select ?1 as calendarDate, sum(total_rooms) as channelTotal, sum(all_deduct) as pickedUp, sum(all_non_deduct) as available " +
|
||||
@Query(value = "select ?1 as calendarDate, sum(isnull(total_rooms,0)) as channelTotal, sum(isnull(all_deduct,0)) as pickedUp, sum(isnull(all_non_deduct,0)) as available " +
|
||||
" from cfg_daylight_roomtype_allotment " +
|
||||
" where allotment_date=?1 and property_id =?2 and block_code_id =?4 and room_type_id in " +
|
||||
" (select room_type_id from cfg_rooms_room_types where room_id =?3 )", nativeQuery = true)
|
||||
|
||||
@@ -285,7 +285,7 @@ public class OtherAllotmentService {
|
||||
if(dow!=null) {
|
||||
for(int i=0;i<dow.size();i++) {
|
||||
int num = Integer.valueOf(String.valueOf(dow.get(i)));
|
||||
dow.set(i, num-1);
|
||||
dow.set(i, num);
|
||||
}
|
||||
}
|
||||
for(int i=0;i<getCriterias.size();i++) {
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.mgm.mcrm.allotment.dtos.request.*;
|
||||
import com.mgm.mcrm.basesetting.agebucket.models.SysAgebucket;
|
||||
import com.mgm.mcrm.basesetting.agebucket.services.AgebucketService;
|
||||
import com.mgm.mcrm.basesetting.room.models.CfgRoomsRoomTypes;
|
||||
import com.mgm.mcrm.common.constants.SettingConstants;
|
||||
import com.mgm.mcrm.common.dtos.AjaxResult;
|
||||
import com.mgm.mcrm.common.dtos.CheckCalendarDaylightRequest;
|
||||
import com.mgm.mcrm.common.dtos.dataimport.appsetting.AppChannelDaylightImportRow;
|
||||
@@ -53,8 +52,6 @@ import com.mgm.mcrm.reservation.models.BookingsView;
|
||||
import com.mgm.mcrm.reservation.repositories.BookingViewDao;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.extern.log4j.Log4j;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.hc.core5.http.Header;
|
||||
@@ -339,7 +336,7 @@ public class RoomCriteriaDaylightService {
|
||||
if (dow != null) {
|
||||
for (int i = 0; i < dow.size(); i++) {
|
||||
int num = Integer.parseInt(String.valueOf(dow.get(i)));
|
||||
dow.set(i, num - 1);
|
||||
dow.set(i, num);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < getCriterias.size(); i++) {
|
||||
@@ -1258,9 +1255,9 @@ public class RoomCriteriaDaylightService {
|
||||
return cacheData;
|
||||
}
|
||||
|
||||
private Map<String,Long> cacheDlBlockCodeMapping(){
|
||||
private Map<String,Long> cacheDlBlockCodeMapping(Long propertyId){
|
||||
Map<String,Long> cacheData = new HashMap<String,Long>();
|
||||
List<CfgBlockCodes> dlBlockCodes = blockCodeDao.findAllByDlBlockIdIsNotNull();
|
||||
List<CfgBlockCodes> dlBlockCodes = blockCodeDao.findAllByPropertyIdAndDlBlockIdIsNotNull(propertyId);
|
||||
for(CfgBlockCodes blockCode: dlBlockCodes){
|
||||
cacheData.put(blockCode.getDlBlockId(),blockCode.getId());
|
||||
}
|
||||
@@ -1350,7 +1347,7 @@ public class RoomCriteriaDaylightService {
|
||||
MappingDataCache cacheMapping = new MappingDataCache();
|
||||
cacheMapping.setCacheRoomTypeIds(this.cacheDlRoomTypeMapping());
|
||||
cacheMapping.setCachePropertyRoomCate(this.cachePropertyRoomCategory(propertyId));
|
||||
cacheMapping.setCacheBlockCodes(this.cacheDlBlockCodeMapping());
|
||||
cacheMapping.setCacheBlockCodes(this.cacheDlBlockCodeMapping(propertyId));
|
||||
|
||||
String url = "/api-gateway/data-api/v1/blocks/availability";
|
||||
Header[] headers = HttpHeaderBuilder.create()
|
||||
@@ -1359,7 +1356,7 @@ public class RoomCriteriaDaylightService {
|
||||
.build();
|
||||
|
||||
Map<String, Object> queryParams = new HashMap<>();
|
||||
queryParams.put("blockIds", String.join(",", syncRequest.getDlBlockCodeIds()));
|
||||
queryParams.put("blockIds", String.join(",", cacheMapping.getCacheBlockCodes().keySet()));
|
||||
queryParams.put("startDate", syncRequest.getFromDate());
|
||||
queryParams.put("endDate", syncRequest.getToDate());
|
||||
|
||||
|
||||
@@ -3,14 +3,8 @@ package com.mgm.mcrm.allotment.services;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.mgm.mcrm.allotment.dtos.CfgOtherAllotmentViewDto;
|
||||
import com.mgm.mcrm.allotment.dtos.CfgOtherAppChannelDto;
|
||||
@@ -329,7 +323,7 @@ public class RoomCriteriaService {
|
||||
if(dow!=null) {
|
||||
for(int i=0;i<dow.size();i++) {
|
||||
int num = Integer.parseInt(String.valueOf(dow.get(i)));
|
||||
dow.set(i, num-1);
|
||||
dow.set(i, num);
|
||||
}
|
||||
}
|
||||
for(int i=0;i<getCriterias.size();i++) {
|
||||
@@ -349,7 +343,7 @@ public class RoomCriteriaService {
|
||||
CfgAppChannel getChannel = new CfgAppChannel();
|
||||
Integer channel = ch.getInteger("appChannel")!=null?ch.getInteger("appChannel"):0;
|
||||
for(CfgAppChannel c:appChannels) {
|
||||
if(c.getBlockId()==ch.getLong("id")) {
|
||||
if(Objects.equals(c.getBlockId(), ch.getLong("id"))) {
|
||||
BeanUtils.copyProperties(c, getChannel);
|
||||
getChannel.setAppChannel(channel);
|
||||
if(getChannel.getPickedUp()==null) {
|
||||
@@ -562,9 +556,9 @@ public class RoomCriteriaService {
|
||||
Long segmentId = checkCalendarRequest.getSegmentId();
|
||||
long propertyId = checkCalendarRequest.getPropertyId();
|
||||
long roomId =checkCalendarRequest.getRoomId();
|
||||
String userId =checkCalendarRequest.getTeamId()!=null?checkCalendarRequest.getUserId():null;
|
||||
String userName = checkCalendarRequest.getTeamId()!=null?checkCalendarRequest.getUserName():null;
|
||||
String playerId =checkCalendarRequest.getTeamId()!=null?checkCalendarRequest.getPlayerId():null;
|
||||
String userId =checkCalendarRequest.getUserId()!=null?checkCalendarRequest.getUserId():null;
|
||||
String userName = checkCalendarRequest.getUserName()!=null?checkCalendarRequest.getUserName():null;
|
||||
String playerId =checkCalendarRequest.getPlayerId()!=null?checkCalendarRequest.getPlayerId():null;
|
||||
Long teamId = checkCalendarRequest.getTeamId()!=null?checkCalendarRequest.getTeamId():null;
|
||||
Long bookId = checkCalendarRequest.getBookId();
|
||||
|
||||
|
||||
@@ -125,6 +125,9 @@ public class LoginController {
|
||||
loginInfo.setListUserSetting(usrSettings);
|
||||
// build object for response body
|
||||
LoginUserInfo returnUser = loginEntryMapper.toLoginUserDto(sysUser);
|
||||
if(SysConstants.SUPER_ADMIN_ID.equals(sysUser.getId().toString())) {
|
||||
returnUser.setGroupName(sysGroupService.getFullGroupNames());
|
||||
}
|
||||
loginInfo.setLoginUser(returnUser);
|
||||
//-- Generate Access Token & Refresh Token
|
||||
Token accessToken = JwtTokenUtil.generateTokenByLoginUser(request.getRequestURI(), returnUser, SysConstants.CMS_TOKEN_TYPE,false);
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
import com.mgm.mcrm.authorization.dtos.LoginUserInfo;
|
||||
import com.mgm.mcrm.authorization.models.Token;
|
||||
import com.mgm.mcrm.common.constants.SysCommon;
|
||||
import com.mgm.mcrm.common.dtos.BaseApiResponse;
|
||||
import com.mgm.mcrm.common.utils.LogUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.Getter;
|
||||
@@ -58,7 +59,7 @@ public class JwtTokenUtil {
|
||||
.withIssuer(issueSource)
|
||||
.withIssuedAt(now).withNotBefore(now).withExpiresAt(expDate).withJWTId(uuid)
|
||||
.withClaim("login_id", user.getLoginId())
|
||||
.withClaim("user_group", user.getGroupName())
|
||||
.withClaim("group_name", user.getGroupName())
|
||||
.withClaim("last_post_time", now)
|
||||
.withSubject(String.valueOf(user.getId()))
|
||||
.sign(Algorithm.HMAC256(secretKey));
|
||||
@@ -103,7 +104,7 @@ public class JwtTokenUtil {
|
||||
loginUser.setId(-1L);
|
||||
}
|
||||
loginUser.setLoginId(decodeData.getClaim("login_id").asString());
|
||||
loginUser.setGroupName(decodeData.getClaim("user_group").asString());
|
||||
loginUser.setGroupName(decodeData.getClaim("group_name").asString());
|
||||
loginUser.setTokenUuid(decodeData.getId());
|
||||
}catch(Exception err) {
|
||||
LogUtil.error(SysCommon.class, "Parse Token failed:"+err.getMessage());
|
||||
|
||||
+95
-19
@@ -1,6 +1,7 @@
|
||||
package com.mgm.mcrm.basesetting.daylight.controllers;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -12,17 +13,23 @@ import com.mgm.mcrm.basesetting.daylight.dtos.request.CreateUpdateExceptionDayli
|
||||
import com.mgm.mcrm.basesetting.daylight.dtos.request.DeleteExceptionDaylightRequest;
|
||||
import com.mgm.mcrm.basesetting.daylight.dtos.request.ExceptionDaylightPageRequest;
|
||||
import com.mgm.mcrm.basesetting.daylight.dtos.request.GetExceptionDaylightRequest;
|
||||
import com.mgm.mcrm.basesetting.daylight.dtos.request.PropertyIdRequest;
|
||||
import com.mgm.mcrm.basesetting.daylight.dtos.response.CfgExceptionDaylightResponse;
|
||||
import com.mgm.mcrm.basesetting.daylight.dtos.response.DaylightComplimentaryPresetResponse;
|
||||
import com.mgm.mcrm.basesetting.daylight.dtos.response.DaylightComplimentaryTypeResponse;
|
||||
import com.mgm.mcrm.basesetting.daylight.dtos.response.DaylightPaymenMethodCodeResponse;
|
||||
import com.mgm.mcrm.basesetting.daylight.dtos.response.ExceptionDaylightResponseFactory;
|
||||
import com.mgm.mcrm.basesetting.daylight.mappers.CfgExceptionDaylightMapper;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgExceptionDaylight;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgExceptionDaylightView;
|
||||
import com.mgm.mcrm.basesetting.daylight.services.DaylightService;
|
||||
import com.mgm.mcrm.basesetting.daylight.services.ExceptionDlMappingService;
|
||||
import com.mgm.mcrm.basesetting.daylight.utils.ExceptionDaylightExcelSupport;
|
||||
import com.mgm.mcrm.basesetting.room.models.CfgRoomTypes;
|
||||
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.dataimport.appsetting.ExceptionOperaImportRow;
|
||||
import com.mgm.mcrm.common.dtos.dataimport.appsetting.ExceptionDaylightImportRow;
|
||||
import com.mgm.mcrm.common.dtos.excelmodel.ExportDefine;
|
||||
import com.mgm.mcrm.logging.services.SysLogOperationService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -61,6 +68,8 @@ public class ExceptionDaylightController {
|
||||
@Resource
|
||||
private ExceptionDlMappingService exceptionDlMappingService;
|
||||
@Resource
|
||||
private DaylightService daylightService;
|
||||
@Resource
|
||||
private SysLogOperationService sysAuditLogService;
|
||||
@Resource
|
||||
private ExceptionDaylightResponseFactory exceptionDaylightResponseFactory;
|
||||
@@ -71,7 +80,7 @@ public class ExceptionDaylightController {
|
||||
@OperationLog(actionName="Create Exception Opera", eventCode = "exception_opera_create")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST, produces = "application/json;charset=UTF-8",consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public AjaxResult createOpera(HttpServletRequest request, @RequestBody CreateUpdateExceptionDaylightRequest cfgExceptionOperaRequest) {
|
||||
AjaxResult validateResult = validateData(cfgExceptionOperaRequest, "CREATE");
|
||||
AjaxResult validateResult = validateData(cfgExceptionOperaRequest);
|
||||
if (!validateResult.isSuccess()) {
|
||||
return validateResult;
|
||||
}
|
||||
@@ -91,7 +100,7 @@ public class ExceptionDaylightController {
|
||||
@OperationLog(eventCode="exception_opera_update",actionName="Update Exception Opera")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST, produces = "application/json;charset=UTF-8",consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public AjaxResult updateOpera(HttpServletRequest request, @RequestBody CreateUpdateExceptionDaylightRequest opera) {
|
||||
AjaxResult validateResult = validateData(opera, "UPDATE");
|
||||
AjaxResult validateResult = validateData(opera);
|
||||
if (!validateResult.isSuccess()) {
|
||||
return validateResult;
|
||||
}
|
||||
@@ -171,6 +180,7 @@ public class ExceptionDaylightController {
|
||||
if (operaView.getMarketCode() != null) {
|
||||
operaView.setMarketCodeName(operaView.getMarketCode().getCode());
|
||||
}
|
||||
ExceptionDaylightExcelSupport.preparePresetExport(operaView);
|
||||
}
|
||||
String reportFileName = "ExceptionDaylightMapping.xlsx";
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -182,7 +192,7 @@ public class ExceptionDaylightController {
|
||||
ExcelUtils.errorResponse(err.getMessage(), request, response);
|
||||
}
|
||||
} else {
|
||||
ExcelUtils.errorResponse("EXPORT_DAYLIGHT_MAPPING not found", request, response);
|
||||
ExcelUtils.errorResponse("EXPORT_EXCEPTION_DAYLIGHT not found", request, response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +229,7 @@ public class ExceptionDaylightController {
|
||||
@OperationLog(eventCode = "exception_opera_import")
|
||||
@RequestMapping(value = "/import_batch", method = RequestMethod.POST)
|
||||
public AjaxResult batchImportRows(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestBody(required = false) List<ExceptionOperaImportRow> importRows) throws Exception {
|
||||
@RequestBody(required = false) List<ExceptionDaylightImportRow> importRows) throws Exception {
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
if (importRows == null || importRows.size() <= 0) {
|
||||
processResult.setSuccess(false);
|
||||
@@ -234,27 +244,93 @@ public class ExceptionDaylightController {
|
||||
return processResult;
|
||||
}
|
||||
|
||||
private AjaxResult validateData(Object operaObj, String operateType) {
|
||||
@PostMapping(value = "/daylight_complimentary_type_list", produces = "application/json;charset=UTF-8", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public AjaxResult daylightComplimentaryTypeList(@RequestBody PropertyIdRequest propertyIdRequest) {
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
|
||||
try {
|
||||
List<DaylightComplimentaryTypeResponse> dayLightResult =
|
||||
daylightService.daylightGetComplimentaryTypeList(propertyIdRequest.getDlPropertyId());
|
||||
|
||||
processResult.setSuccess(true);
|
||||
processResult.setMessage("Success");
|
||||
processResult.setData(dayLightResult);
|
||||
} catch (Exception e) {
|
||||
processResult.setSuccess(false);
|
||||
processResult.setMessage("Failed to get DayLightComplimentaryTypeList");
|
||||
}
|
||||
|
||||
processResult.setLogMessage(LogUtil.getAjaxFormatLog(processResult, "daylight_complimentary_type_list", null, null));
|
||||
return processResult;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/daylight_payment_method_code_list", produces = "application/json;charset=UTF-8", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public AjaxResult daylightPaymentMethodCodeList(@RequestBody PropertyIdRequest propertyIdRequest) {
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
|
||||
try {
|
||||
List<DaylightPaymenMethodCodeResponse> dayLightResult =
|
||||
daylightService.daylightPaymenMethodCodeListResponseList(propertyIdRequest.getDlPropertyId());
|
||||
|
||||
processResult.setSuccess(true);
|
||||
processResult.setMessage("Success");
|
||||
processResult.setData(dayLightResult);
|
||||
} catch (Exception e) {
|
||||
processResult.setSuccess(false);
|
||||
processResult.setMessage("Failed to get DayLightPaymentMethodCodeList");
|
||||
}
|
||||
|
||||
processResult.setLogMessage(LogUtil.getAjaxFormatLog(processResult, "daylight_payment_method_code_list", null, null));
|
||||
return processResult;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/daylight_complimentary_preset_list", produces = "application/json;charset=UTF-8", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public AjaxResult daylightComplimentaryPresetList(@RequestBody PropertyIdRequest propertyIdRequest) {
|
||||
AjaxResult processResult = new AjaxResult();
|
||||
|
||||
try {
|
||||
List<DaylightComplimentaryPresetResponse> list =
|
||||
daylightService.daylightGetComplimentaryPresetList(propertyIdRequest.getDlPropertyId());
|
||||
|
||||
processResult.setSuccess(true);
|
||||
processResult.setMessage("Success");
|
||||
processResult.setData(list);
|
||||
} catch (Exception e) {
|
||||
processResult.setSuccess(false);
|
||||
processResult.setMessage("Failed to get DaylightComplimentaryPresetList");
|
||||
}
|
||||
|
||||
processResult.setLogMessage(LogUtil.getAjaxFormatLog(processResult, "daylight_complimentary_preset_list", null, null));
|
||||
return processResult;
|
||||
}
|
||||
|
||||
private AjaxResult validateData(CreateUpdateExceptionDaylightRequest request) {
|
||||
AjaxResult validateResult = new AjaxResult();
|
||||
boolean success = true;
|
||||
String errorMessage = "";
|
||||
String errorCode = "";
|
||||
//--
|
||||
if (!"CREATE".equals(operateType)) {
|
||||
String userId = null;
|
||||
if (operaObj instanceof CfgExceptionDaylight) {
|
||||
userId = ((CfgExceptionDaylight) operaObj).getUserId();
|
||||
} else if (operaObj instanceof CreateUpdateExceptionDaylightRequest) {
|
||||
userId = ((CreateUpdateExceptionDaylightRequest) operaObj).getUserId();
|
||||
if (request.getSoftLimit() != null) {
|
||||
request.setSoftLimit(request.getSoftLimit().trim());
|
||||
}
|
||||
if (StringUtils.isBlank(userId)) {
|
||||
success = false;
|
||||
errorCode = ExceptionDaylightResponseFactory.CODE_ERR_ILLEGAL_DATA;
|
||||
|
||||
if (StringUtils.isBlank(request.getUserId())) {
|
||||
errorMessage = "User ID can't be empty";
|
||||
} else if (request.getCompRuleCategory() != null
|
||||
&& request.getCompRuleCategory() != 1 && request.getCompRuleCategory() != 2) {
|
||||
errorMessage = "Category must be 1 or 2";
|
||||
} else if (StringUtils.isNotBlank(request.getSoftLimit())) {
|
||||
String softLimit = request.getSoftLimit().trim();
|
||||
if (softLimit.length() > 50 || !softLimit.matches("[0-9]+(?:\\.[0-9]*)?")) {
|
||||
errorMessage = "Soft Limit must be a number between 1 and 100";
|
||||
} else {
|
||||
BigDecimal value = new BigDecimal(softLimit);
|
||||
if (value.compareTo(BigDecimal.ONE) < 0 || value.compareTo(BigDecimal.valueOf(100)) > 0) {
|
||||
errorMessage = "Soft Limit must be a number between 1 and 100";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean success = errorMessage.isEmpty();
|
||||
validateResult.setSuccess(success);
|
||||
validateResult.setErrorCode(errorCode);
|
||||
validateResult.setErrorCode(success ? "" : ExceptionDaylightResponseFactory.CODE_ERR_ILLEGAL_DATA);
|
||||
validateResult.setMessage(errorMessage);
|
||||
return validateResult;
|
||||
}
|
||||
|
||||
+1
-2
@@ -323,13 +323,12 @@ public class ItemInventoryController {
|
||||
}
|
||||
ServiceResult importResult;
|
||||
Gson gson = new Gson();
|
||||
if ("DAYLIGHT".equalsIgnoreCase(category)) {
|
||||
String json = gson.toJson(importRows);
|
||||
if ("DAYLIGHT".equalsIgnoreCase(category)) {
|
||||
List<ItemInventoryDaylightImportRow> daylightRows = gson.fromJson(json,
|
||||
new TypeToken<List<ItemInventoryDaylightImportRow>>(){}.getType());
|
||||
importResult = itemInventoryService.importDaylightBatch(daylightRows);
|
||||
} else {
|
||||
String json = gson.toJson(importRows);
|
||||
List<ItemInventoryImportRow> operaRows = gson.fromJson(json,
|
||||
new TypeToken<List<ItemInventoryImportRow>>(){}.getType());
|
||||
importResult = itemInventoryService.importBatch(operaRows);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mgm.mcrm.basesetting.daylight.dtos;
|
||||
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgBookingTypes;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgExceptionCompPreset;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgMarketCodes;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgRateCodes;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgSourceCodes;
|
||||
@@ -10,6 +11,7 @@ import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
@@ -22,6 +24,14 @@ public class CfgExceptionDaylightViewDto implements Serializable {
|
||||
private Long sourceCodeId;
|
||||
private Long marketCodeId;
|
||||
private Long blockCodeId;
|
||||
private String approver;
|
||||
private Integer compRuleCategory;
|
||||
private String dlCompTypeId;
|
||||
private String compTypeContent;
|
||||
private String dlPaymentMethodCodeId;
|
||||
private String paymentMethodCodeContent;
|
||||
private String softLimit;
|
||||
private List<CfgExceptionCompPreset> cfgCompPresetList;
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
+9
@@ -15,6 +15,15 @@ public class CreateUpdateExceptionDaylightRequest {
|
||||
private Long sourceCodeId;
|
||||
private Long marketCodeId;
|
||||
private Long blockCodeId;
|
||||
private String approver;
|
||||
private Integer compRuleCategory;
|
||||
private String dlCompTypeId;
|
||||
private String compTypeContent;
|
||||
private String dlPaymentMethodCodeId;
|
||||
private String paymentMethodCodeContent;
|
||||
private String softLimit;
|
||||
private List<String> dlCompPresetIds;
|
||||
private List<String> compPresetContents;
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
+12
@@ -1,6 +1,7 @@
|
||||
package com.mgm.mcrm.basesetting.daylight.dtos.response;
|
||||
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgBookingTypes;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgExceptionCompPreset;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgMarketCodes;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgRateCodes;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgSourceCodes;
|
||||
@@ -9,6 +10,7 @@ import com.mgm.mcrm.basesetting.room.models.CfgRoomTypes;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
@@ -22,6 +24,14 @@ public class CfgExceptionDaylightResponse {
|
||||
private Long sourceCodeId;
|
||||
private Long marketCodeId;
|
||||
private Long blockCodeId;
|
||||
private String approver;
|
||||
private Integer compRuleCategory;
|
||||
private String dlCompTypeId;
|
||||
private String compTypeContent;
|
||||
private String dlPaymentMethodCodeId;
|
||||
private String paymentMethodCodeContent;
|
||||
private String softLimit;
|
||||
private List<CfgExceptionCompPreset> cfgCompPresetList;
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
@@ -45,6 +55,8 @@ public class CfgExceptionDaylightResponse {
|
||||
private Set<CfgRoomTypes> daylightRoomType;
|
||||
|
||||
//-- For export
|
||||
private String compPresetContent;
|
||||
private String compPresetId;
|
||||
private String propertyName;
|
||||
private String bookingTypeName;
|
||||
private String rateCodeName;
|
||||
|
||||
+3
@@ -4,6 +4,7 @@ import com.mgm.mcrm.basesetting.daylight.dtos.CfgExceptionDaylightViewDto;
|
||||
import com.mgm.mcrm.basesetting.daylight.dtos.response.CfgExceptionDaylightResponse;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgExceptionDaylightView;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,6 +21,8 @@ public interface CfgExceptionDaylightMapper {
|
||||
* @param source 源視圖實體對象
|
||||
* @return 轉換後的Response DTO
|
||||
*/
|
||||
@Mapping(target = "compPresetContent", ignore = true)
|
||||
@Mapping(target = "compPresetId", ignore = true)
|
||||
CfgExceptionDaylightResponse toResponse(CfgExceptionDaylightView source);
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mgm.mcrm.basesetting.daylight.models;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "cfg_exception_comp_preset")
|
||||
public class CfgExceptionCompPreset {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private Long id;
|
||||
|
||||
@Column(name = "exception_daylight_mapping_id", nullable = false)
|
||||
private Long exceptionDaylightMappingId;
|
||||
|
||||
@Column(name = "dl_comp_preset_id", nullable = false, length = 100)
|
||||
private String dlCompPresetId;
|
||||
|
||||
@Column(name = "comp_preset_content", length = 1000)
|
||||
private String compPresetContent;
|
||||
}
|
||||
@@ -9,6 +9,10 @@ import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.OrderBy;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.persistence.Transient;
|
||||
|
||||
@@ -36,6 +40,24 @@ public class CfgExceptionDaylight implements Serializable {
|
||||
private Long marketCodeId;
|
||||
@Column(name = "block_code_id")
|
||||
private Long blockCodeId;
|
||||
@Column(name = "approver", length = 255)
|
||||
private String approver;
|
||||
@Column(name = "comp_rule_category")
|
||||
private Integer compRuleCategory;
|
||||
@Column(name = "dl_comp_type_id", length = 100)
|
||||
private String dlCompTypeId;
|
||||
@Column(name = "comp_type_content", length = 1000)
|
||||
private String compTypeContent;
|
||||
@Column(name = "dl_payment_method_code_id", length = 100)
|
||||
private String dlPaymentMethodCodeId;
|
||||
@Column(name = "payment_method_code_content", length = 1000)
|
||||
private String paymentMethodCodeContent;
|
||||
@Column(name = "soft_limit", length = 50)
|
||||
private String softLimit;
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "exception_daylight_mapping_id", insertable = false, updatable = false)
|
||||
@OrderBy("id ASC")
|
||||
private List<CfgExceptionCompPreset> cfgCompPresetList;
|
||||
@Column(name = "created_at")
|
||||
private LocalDateTime createdAt;
|
||||
@Column(name = "created_by")
|
||||
@@ -48,4 +70,8 @@ public class CfgExceptionDaylight implements Serializable {
|
||||
private List<String> roomTypeIds;
|
||||
@Transient
|
||||
private List<String> blockCodeIds;
|
||||
@Transient
|
||||
private List<String> dlCompPresetIds;
|
||||
@Transient
|
||||
private List<String> compPresetContents;
|
||||
}
|
||||
|
||||
+23
-1
@@ -2,6 +2,7 @@ package com.mgm.mcrm.basesetting.daylight.models;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.mgm.mcrm.basesetting.property.models.CfgProperties;
|
||||
@@ -22,7 +23,8 @@ import org.hibernate.annotations.NotFoundAction;
|
||||
@NamedAttributeNode("rateCode"),
|
||||
@NamedAttributeNode("sourceCode"),
|
||||
@NamedAttributeNode("marketCode"),
|
||||
@NamedAttributeNode("daylightRoomType")
|
||||
@NamedAttributeNode("daylightRoomType"),
|
||||
@NamedAttributeNode("cfgCompPresetList")
|
||||
}
|
||||
)
|
||||
@Data
|
||||
@@ -62,6 +64,26 @@ public class CfgExceptionDaylightView implements Serializable {
|
||||
@Column(name = "block_id")
|
||||
private Long blockId;
|
||||
|
||||
@Column(name = "approver", length = 255)
|
||||
private String approver;
|
||||
@Column(name = "comp_rule_category")
|
||||
private Integer compRuleCategory;
|
||||
@Column(name = "dl_comp_type_id", length = 100)
|
||||
private String dlCompTypeId;
|
||||
@Column(name = "comp_type_content", length = 1000)
|
||||
private String compTypeContent;
|
||||
@Column(name = "dl_payment_method_code_id", length = 100)
|
||||
private String dlPaymentMethodCodeId;
|
||||
@Column(name = "payment_method_code_content", length = 1000)
|
||||
private String paymentMethodCodeContent;
|
||||
@Column(name = "soft_limit", length = 50)
|
||||
private String softLimit;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "exception_daylight_mapping_id", insertable = false, updatable = false)
|
||||
@OrderBy("id ASC")
|
||||
private List<CfgExceptionCompPreset> cfgCompPresetList;
|
||||
|
||||
|
||||
@NotFound(action = NotFoundAction.IGNORE)
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
|
||||
@@ -11,6 +11,7 @@ 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.data.repository.query.Param;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public interface BlockCodeDao extends JpaRepository<CfgBlockCodes, Long> {
|
||||
@@ -34,5 +35,11 @@ public interface BlockCodeDao extends JpaRepository<CfgBlockCodes, Long> {
|
||||
|
||||
CfgBlockCodes findByCode(String code);
|
||||
|
||||
List<CfgBlockCodes> findAllByDlBlockIdIsNotNull();
|
||||
@Query("""
|
||||
SELECT c
|
||||
FROM CfgBlockCodes c
|
||||
WHERE c.propertyId = :propertyId
|
||||
AND c.dlBlockId IS NOT NULL
|
||||
""")
|
||||
List<CfgBlockCodes> findAllByPropertyIdAndDlBlockIdIsNotNull(@Param("propertyId") Long propertyId);
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.mgm.mcrm.basesetting.daylight.repositories;
|
||||
|
||||
import com.mgm.mcrm.basesetting.daylight.models.CfgExceptionCompPreset;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
public interface ExceptionCompPresetDao extends JpaRepository<CfgExceptionCompPreset, Long> {
|
||||
|
||||
@Modifying
|
||||
@Query("delete from CfgExceptionCompPreset preset where preset.exceptionDaylightMappingId = ?1")
|
||||
int deleteByExceptionDaylightMappingId(Long exceptionDaylightMappingId);
|
||||
}
|
||||
@@ -460,7 +460,10 @@ public class DaylightService {
|
||||
|
||||
for (int i = 0; i < objects.size(); i++) {
|
||||
|
||||
PropertyResultResponse javaObject = objects.getJSONObject(i).toJavaObject(PropertyResultResponse.class);
|
||||
JSONObject jsonObject = objects.getJSONObject(i);
|
||||
|
||||
PropertyResultResponse javaObject = jsonObject.toJavaObject(PropertyResultResponse.class);
|
||||
javaObject.setId(jsonObject.getString("unitId"));
|
||||
|
||||
result.add(javaObject);
|
||||
}
|
||||
|
||||
+96
-28
@@ -7,6 +7,7 @@ import com.mgm.mcrm.basesetting.daylight.dtos.request.DeleteExceptionDaylightReq
|
||||
import com.mgm.mcrm.basesetting.daylight.dtos.request.ExceptionDaylightPageRequest;
|
||||
import com.mgm.mcrm.basesetting.daylight.dtos.response.CfgExceptionDaylightResponse;
|
||||
import com.mgm.mcrm.basesetting.daylight.mappers.CfgExceptionDaylightMapper;
|
||||
import com.mgm.mcrm.basesetting.daylight.utils.ExceptionDaylightExcelSupport;
|
||||
import com.mgm.mcrm.basesetting.daylight.models.*;
|
||||
import com.mgm.mcrm.basesetting.daylight.repositories.*;
|
||||
import com.mgm.mcrm.basesetting.property.models.CfgProperties;
|
||||
@@ -17,7 +18,7 @@ import com.mgm.mcrm.basesetting.team.repositories.SectionDao;
|
||||
import com.mgm.mcrm.common.dtos.DataTableResult;
|
||||
import com.mgm.mcrm.common.dtos.ServiceResult;
|
||||
import com.mgm.mcrm.common.dtos.dataimport.ValidateResult;
|
||||
import com.mgm.mcrm.common.dtos.dataimport.appsetting.ExceptionOperaImportRow;
|
||||
import com.mgm.mcrm.common.dtos.dataimport.appsetting.ExceptionDaylightImportRow;
|
||||
import com.mgm.mcrm.common.dtos.excelmodel.ImportDefine;
|
||||
import com.mgm.mcrm.common.utils.DaoUtil;
|
||||
import com.mgm.mcrm.common.utils.DateTimeUtil;
|
||||
@@ -34,6 +35,7 @@ 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 org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
@@ -51,6 +53,8 @@ public class ExceptionDlMappingService {
|
||||
@Resource
|
||||
private ExceptDlMappingRoomTypeDao exceptDlMappingRoomTypeDao;
|
||||
@Resource
|
||||
private ExceptionCompPresetDao exceptionCompPresetDao;
|
||||
@Resource
|
||||
private SectionDao sectionDao;
|
||||
@Resource
|
||||
private PropertyDao propertyDao;
|
||||
@@ -73,6 +77,7 @@ public class ExceptionDlMappingService {
|
||||
private SysUserDao sysUserDao;
|
||||
|
||||
|
||||
@Transactional
|
||||
public ServiceResult createExceptionDaylight(CfgExceptionDaylight createRequest) {
|
||||
ServiceResult processResult = new ServiceResult();
|
||||
LocalDateTime createDate = LocalDateTime.now();
|
||||
@@ -98,6 +103,8 @@ public class ExceptionDlMappingService {
|
||||
exceptDlMappingRoomTypeDao.save(romType);
|
||||
}
|
||||
}
|
||||
newExceptionOpera.setCfgCompPresetList(saveCompPresets(newExceptionOpera.getId(),
|
||||
createRequest.getDlCompPresetIds(), createRequest.getCompPresetContents()));
|
||||
}
|
||||
}
|
||||
processResult.setSuccess(true);
|
||||
@@ -105,6 +112,7 @@ public class ExceptionDlMappingService {
|
||||
return processResult;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public ServiceResult updateExceptionDaylight(CreateUpdateExceptionDaylightRequest updateRequest) {
|
||||
ServiceResult processResult = new ServiceResult();
|
||||
CfgExceptionDaylight existsType = exceptionDlMappingDao.findById(updateRequest.getId()).orElse(null);
|
||||
@@ -128,12 +136,35 @@ public class ExceptionDlMappingService {
|
||||
exceptDlMappingRoomTypeDao.save(roomType);
|
||||
}
|
||||
}
|
||||
exceptionCompPresetDao.deleteByExceptionDaylightMappingId(existsType.getId());
|
||||
existsType.setCfgCompPresetList(saveCompPresets(existsType.getId(),
|
||||
updateRequest.getDlCompPresetIds(), updateRequest.getCompPresetContents()));
|
||||
processResult.setReturnData(existsType);
|
||||
processResult.setSuccess(true);
|
||||
}
|
||||
return processResult;
|
||||
}
|
||||
|
||||
private List<CfgExceptionCompPreset> saveCompPresets(Long mappingId, List<String> presetIds,
|
||||
List<String> presetContents) {
|
||||
List<CfgExceptionCompPreset> presets = new ArrayList<>();
|
||||
if (presetIds != null) {
|
||||
for (int i = 0; i < presetIds.size(); i++) {
|
||||
if (StringUtils.isBlank(presetIds.get(i))) {
|
||||
continue;
|
||||
}
|
||||
CfgExceptionCompPreset preset = new CfgExceptionCompPreset();
|
||||
preset.setExceptionDaylightMappingId(mappingId);
|
||||
preset.setDlCompPresetId(presetIds.get(i));
|
||||
if (presetContents != null && presetContents.size() > i) {
|
||||
preset.setCompPresetContent(presetContents.get(i));
|
||||
}
|
||||
presets.add(preset);
|
||||
}
|
||||
}
|
||||
return presets.isEmpty() ? presets : exceptionCompPresetDao.saveAll(presets);
|
||||
}
|
||||
|
||||
public CfgExceptionDaylightView getExceptionDaylightViewById(long id) {
|
||||
return exceptionDaylightViewDao.findById(id);
|
||||
}
|
||||
@@ -266,7 +297,7 @@ public class ExceptionDlMappingService {
|
||||
private long getMatchPropertyId(List<CfgProperties> properties, String name) {
|
||||
long matchId = 0;
|
||||
for (CfgProperties item : properties) {
|
||||
if (Strings.CI.equals(item.getName(), name)) {
|
||||
if ("DAYLIGHT".equalsIgnoreCase(item.getCategory()) && Strings.CI.equals(item.getName(), name)) {
|
||||
matchId = item.getId();
|
||||
break;
|
||||
}
|
||||
@@ -285,10 +316,11 @@ public class ExceptionDlMappingService {
|
||||
return matchId;
|
||||
}
|
||||
|
||||
private long getMatchRateCodeId(List<CfgRateCodes> rateCodes, String name) {
|
||||
private long getMatchRateCodeId(List<CfgRateCodes> rateCodes, String name, Long propertyId) {
|
||||
long matchId = 0;
|
||||
for (CfgRateCodes item : rateCodes) {
|
||||
if (Strings.CI.equals(item.getCode(), name)) {
|
||||
if ("DAYLIGHT".equalsIgnoreCase(item.getCategory()) && Strings.CI.equals(item.getCode(), name)
|
||||
&& matchesProperty(item.getPropertyId(), propertyId)) {
|
||||
matchId = item.getId();
|
||||
break;
|
||||
}
|
||||
@@ -299,7 +331,7 @@ public class ExceptionDlMappingService {
|
||||
private long getMatchSourceCodeId(List<CfgSourceCodes> sourceCodes, String name) {
|
||||
long matchId = 0;
|
||||
for (CfgSourceCodes item : sourceCodes) {
|
||||
if (Strings.CI.equals(item.getCode(), name)) {
|
||||
if ("DAYLIGHT".equalsIgnoreCase(item.getCategory()) && Strings.CI.equals(item.getCode(), name)) {
|
||||
matchId = item.getId();
|
||||
break;
|
||||
}
|
||||
@@ -310,7 +342,7 @@ public class ExceptionDlMappingService {
|
||||
private long getMatchMarketCodeId(List<CfgMarketCodes> marketCodes, String name) {
|
||||
long matchId = 0;
|
||||
for (CfgMarketCodes item : marketCodes) {
|
||||
if (Strings.CI.equals(item.getCode(), name)) {
|
||||
if ("DAYLIGHT".equalsIgnoreCase(item.getCategory()) && Strings.CI.equals(item.getCode(), name)) {
|
||||
matchId = item.getId();
|
||||
break;
|
||||
}
|
||||
@@ -318,10 +350,11 @@ public class ExceptionDlMappingService {
|
||||
return matchId;
|
||||
}
|
||||
|
||||
private long getMatchBlockCodeId(List<CfgBlockCodes> blockCodes, String code) {
|
||||
private long getMatchBlockCodeId(List<CfgBlockCodes> blockCodes, String code, Long propertyId) {
|
||||
long matchId = 0;
|
||||
for (CfgBlockCodes item : blockCodes) {
|
||||
if (Strings.CI.equals(item.getCode(), code)) {
|
||||
if ("DAYLIGHT".equalsIgnoreCase(item.getCategory()) && Strings.CI.equals(item.getCode(), code)
|
||||
&& matchesProperty(item.getPropertyId(), propertyId)) {
|
||||
matchId = item.getId();
|
||||
break;
|
||||
}
|
||||
@@ -329,10 +362,11 @@ public class ExceptionDlMappingService {
|
||||
return matchId;
|
||||
}
|
||||
|
||||
private long getMatchRoomTypeId(List<CfgRoomTypes> roomTypes, String name) {
|
||||
private long getMatchRoomTypeId(List<CfgRoomTypes> roomTypes, String name, Long propertyId) {
|
||||
long matchId = 0;
|
||||
for (CfgRoomTypes item : roomTypes) {
|
||||
if (Strings.CI.equals(item.getCode(), name)) {
|
||||
if ("DAYLIGHT".equalsIgnoreCase(item.getCategory()) && Strings.CI.equals(item.getCode(), name)
|
||||
&& matchesProperty(item.getPropertyId(), propertyId)) {
|
||||
matchId = item.getId();
|
||||
break;
|
||||
}
|
||||
@@ -340,24 +374,33 @@ public class ExceptionDlMappingService {
|
||||
return matchId;
|
||||
}
|
||||
|
||||
private ValidateResult validateImportData(List<ExceptionOperaImportRow> exceptionOperaList) {
|
||||
private boolean matchesProperty(Integer candidatePropertyId, Long mappingPropertyId) {
|
||||
return candidatePropertyId != null && mappingPropertyId != null
|
||||
&& candidatePropertyId.longValue() == mappingPropertyId.longValue();
|
||||
}
|
||||
|
||||
private <T> Specification<T> daylightCategorySpec() {
|
||||
return (root, query, cb) -> cb.equal(cb.upper(root.get("category")), "DAYLIGHT");
|
||||
}
|
||||
|
||||
private ValidateResult validateImportData(List<ExceptionDaylightImportRow> exceptionOperaList) {
|
||||
ValidateResult result = new ValidateResult();
|
||||
int totalRows = 0;
|
||||
int failedRows = 0;
|
||||
int successRows = 0;
|
||||
if (!exceptionOperaList.isEmpty()) {
|
||||
totalRows = exceptionOperaList.size();
|
||||
List<CfgRoomTypes> roomTypeList = roomTypeDao.findAll();
|
||||
List<CfgProperties> propertyList = propertyDao.findAll();
|
||||
List<CfgRoomTypes> roomTypeList = roomTypeDao.findAll(daylightCategorySpec());
|
||||
List<CfgProperties> propertyList = propertyDao.findAll(daylightCategorySpec());
|
||||
List<CfgBookingTypes> bookingTypeList = bookingTypeDao.findAll();
|
||||
List<CfgRateCodes> rateCodeList = rateCodeDao.findAll();
|
||||
List<CfgSourceCodes> sourceCodeList = sourceCodeDao.findAll();
|
||||
List<CfgMarketCodes> marketCodeList = marketCodeDao.findAll();
|
||||
List<CfgBlockCodes> blockCodeList = blockCodeDao.findAll();
|
||||
List<CfgRateCodes> rateCodeList = rateCodeDao.findAll(daylightCategorySpec());
|
||||
List<CfgSourceCodes> sourceCodeList = sourceCodeDao.findAll(daylightCategorySpec());
|
||||
List<CfgMarketCodes> marketCodeList = marketCodeDao.findAll(daylightCategorySpec());
|
||||
List<CfgBlockCodes> blockCodeList = blockCodeDao.findAll(daylightCategorySpec());
|
||||
for (int i = 0; i < exceptionOperaList.size(); i++) {
|
||||
String errMsg = "";
|
||||
boolean isPassed = true;
|
||||
ExceptionOperaImportRow pItem = exceptionOperaList.get(i);
|
||||
ExceptionDaylightImportRow pItem = exceptionOperaList.get(i);
|
||||
if (StringUtils.isBlank(pItem.getUserId())) {
|
||||
errMsg += "User ID is blank;";
|
||||
isPassed = false;
|
||||
@@ -395,11 +438,12 @@ public class ExceptionDlMappingService {
|
||||
errMsg += "Block Code is blank;";
|
||||
isPassed = false;
|
||||
} else {
|
||||
long blockCodeId = this.getMatchBlockCodeId(blockCodeList, pItem.getBlockCodeName());
|
||||
long blockCodeId = this.getMatchBlockCodeId(blockCodeList, pItem.getBlockCodeName(), pItem.getPropertyId());
|
||||
if (blockCodeId > 0) {
|
||||
pItem.setBlockCodeId(blockCodeId);
|
||||
} else {
|
||||
errMsg += "No match Block Code of [" + pItem.getBlockCodeName() + "];";
|
||||
errMsg += "No match DAYLIGHT Block Code of [" + pItem.getBlockCodeName()
|
||||
+ "] in Property [" + pItem.getPropertyName() + "];";
|
||||
isPassed = false;
|
||||
}
|
||||
}
|
||||
@@ -407,11 +451,12 @@ public class ExceptionDlMappingService {
|
||||
errMsg += "Rate Code is blank;";
|
||||
isPassed = false;
|
||||
} else {
|
||||
long rateCodeId = this.getMatchRateCodeId(rateCodeList, pItem.getRateCodeName());
|
||||
long rateCodeId = this.getMatchRateCodeId(rateCodeList, pItem.getRateCodeName(), pItem.getPropertyId());
|
||||
if (rateCodeId > 0) {
|
||||
pItem.setRateCodeId(rateCodeId);
|
||||
} else {
|
||||
errMsg += "No match Rate Code of [" + pItem.getRateCodeName() + "];";
|
||||
errMsg += "No match DAYLIGHT Rate Code of [" + pItem.getRateCodeName()
|
||||
+ "] in Property [" + pItem.getPropertyName() + "];";
|
||||
isPassed = false;
|
||||
}
|
||||
}
|
||||
@@ -445,10 +490,11 @@ public class ExceptionDlMappingService {
|
||||
for (String roomTypeVal : roomTypeVals) {
|
||||
roomTypeVal = roomTypeVal.trim();
|
||||
if (StringUtils.isNotBlank(roomTypeVal)) {
|
||||
long matchTypeId = this.getMatchRoomTypeId(roomTypeList, roomTypeVal);
|
||||
long matchTypeId = this.getMatchRoomTypeId(roomTypeList, roomTypeVal, pItem.getPropertyId());
|
||||
if (matchTypeId <= 0) {
|
||||
isPassed = false;
|
||||
errMsg += "Room Type [" + roomTypeVal + "] not found;";
|
||||
errMsg += "DAYLIGHT Room Type [" + roomTypeVal + "] not found in Property ["
|
||||
+ pItem.getPropertyName() + "];";
|
||||
} else {
|
||||
Long typeId = Long.valueOf(matchTypeId);
|
||||
if (!roomTypeIds.contains(typeId))
|
||||
@@ -468,6 +514,11 @@ public class ExceptionDlMappingService {
|
||||
}
|
||||
|
||||
}
|
||||
String compRuleErrors = ExceptionDaylightExcelSupport.validateCompRuleImport(pItem);
|
||||
if (!compRuleErrors.isEmpty()) {
|
||||
errMsg += compRuleErrors;
|
||||
isPassed = false;
|
||||
}
|
||||
pItem.setValidatePassed(isPassed);
|
||||
pItem.setErrorMessage(errMsg);
|
||||
if (isPassed)
|
||||
@@ -486,9 +537,16 @@ public class ExceptionDlMappingService {
|
||||
|
||||
public ServiceResult parseImportExcel(String importFilePath) {
|
||||
ServiceResult result = new ServiceResult();
|
||||
String importName = "IMPORT_EXCEPTION_OPERA";
|
||||
String importName = "IMPORT_EXCEPTION_DAYLIGHT";
|
||||
ImportDefine importDef = ExcelUtils.getImportDefineByName(importName);
|
||||
if (importDef != null) {
|
||||
String headerError = ExceptionDaylightExcelSupport.validateOptionalImportHeaders(importDef, importFilePath);
|
||||
if (!headerError.isEmpty()) {
|
||||
result.setSuccess(false);
|
||||
result.setErrorCode("INVALID_TEMPLATE");
|
||||
result.setErrorMessage(headerError);
|
||||
return result;
|
||||
}
|
||||
ServiceResult importResult = ExcelUtils.importDataBlock(importDef, importFilePath, null);
|
||||
if (!importResult.isSuccess()) {
|
||||
result.setSuccess(false);
|
||||
@@ -497,7 +555,7 @@ public class ExceptionDlMappingService {
|
||||
if (importResult.getReturnData() != null) {
|
||||
List<Object> dataList = (List<Object>) importResult.getReturnData();
|
||||
if (dataList.size() > 0) {
|
||||
List<ExceptionOperaImportRow> exceptionOperaList = (List<ExceptionOperaImportRow>) dataList.getFirst();
|
||||
List<ExceptionDaylightImportRow> exceptionOperaList = (List<ExceptionDaylightImportRow>) dataList.getFirst();
|
||||
ValidateResult validateRes = validateImportData(exceptionOperaList);
|
||||
if (validateRes.getResultCount() > 0) {
|
||||
result.setSuccess(true);
|
||||
@@ -522,7 +580,8 @@ public class ExceptionDlMappingService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public ServiceResult importBatch(List<ExceptionOperaImportRow> importRows) {
|
||||
@Transactional
|
||||
public ServiceResult importBatch(List<ExceptionDaylightImportRow> importRows) {
|
||||
ServiceResult result = new ServiceResult();
|
||||
if (importRows != null && importRows.size() > 0) {
|
||||
ValidateResult validateRes = validateImportData(importRows);
|
||||
@@ -530,7 +589,7 @@ public class ExceptionDlMappingService {
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
List<CfgExceptDaylightRoomTypes> newExceptionOperaRoomTypeList = new ArrayList<CfgExceptDaylightRoomTypes>();
|
||||
for (int i = 0; i < importRows.size(); i++) {
|
||||
ExceptionOperaImportRow pItem = importRows.get(i);
|
||||
ExceptionDaylightImportRow pItem = importRows.get(i);
|
||||
CfgExceptionDaylight newExceptionOpera = new CfgExceptionDaylight();
|
||||
newExceptionOpera.setPropertyId(pItem.getPropertyId());
|
||||
newExceptionOpera.setUserId(pItem.getUserId());
|
||||
@@ -541,9 +600,18 @@ public class ExceptionDlMappingService {
|
||||
newExceptionOpera.setSourceCodeId(pItem.getSourceCodeId());
|
||||
newExceptionOpera.setMarketCodeId(pItem.getMarketCodeId());
|
||||
newExceptionOpera.setCreatedAt(currentTime);
|
||||
newExceptionOpera.setApprover(pItem.getApprover());
|
||||
newExceptionOpera.setCompRuleCategory(pItem.getCompRuleCategoryVal());
|
||||
newExceptionOpera.setDlCompTypeId(pItem.getDlCompTypeId());
|
||||
newExceptionOpera.setCompTypeContent(pItem.getCompTypeContent());
|
||||
newExceptionOpera.setDlPaymentMethodCodeId(pItem.getDlPaymentMethodCodeId());
|
||||
newExceptionOpera.setPaymentMethodCodeContent(pItem.getPaymentMethodCodeContent());
|
||||
newExceptionOpera.setSoftLimit(pItem.getSoftLimit());
|
||||
newExceptionOpera.setUpdatedAt(currentTime);
|
||||
exceptionDlMappingDao.save(newExceptionOpera);
|
||||
Long newExceptionOperaId = newExceptionOpera.getId();
|
||||
newExceptionOpera.setCfgCompPresetList(saveCompPresets(newExceptionOperaId,
|
||||
pItem.getDlCompPresetIds(), pItem.getCompPresetContents()));
|
||||
if (pItem.getRoomTypeIds() != null && pItem.getRoomTypeIds().size() > 0) {
|
||||
List<Long> operaRoomTypeIds = pItem.getRoomTypeIds();
|
||||
for (Long roomTypeId : operaRoomTypeIds) {
|
||||
|
||||
@@ -395,6 +395,9 @@ public class ItemInventoryService {
|
||||
String errMsg = "";
|
||||
boolean isPassed = true;
|
||||
ItemInventoryImportRow pItem = itemInventoryList.get(i);
|
||||
if (StringUtils.isBlank(pItem.getCategory())) {
|
||||
pItem.setCategory("OPERA");
|
||||
}
|
||||
if (StringUtils.isBlank(pItem.getIgtTierId())) {
|
||||
errMsg += "IGT Tier ID is blank";
|
||||
isPassed = false;
|
||||
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
package com.mgm.mcrm.basesetting.daylight.utils;
|
||||
|
||||
import com.mgm.mcrm.basesetting.daylight.dtos.response.CfgExceptionDaylightResponse;
|
||||
import com.mgm.mcrm.common.dtos.dataimport.appsetting.ExceptionDaylightImportRow;
|
||||
import com.mgm.mcrm.common.dtos.excelmodel.ImportDefine;
|
||||
import org.apache.poi.ss.usermodel.DataFormatter;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class ExceptionDaylightExcelSupport {
|
||||
private ExceptionDaylightExcelSupport() {
|
||||
}
|
||||
|
||||
public static String validateOptionalImportHeaders(ImportDefine define, String filePath) {
|
||||
var block = define.getImportPages().getFirst().getDataElements().getFirst();
|
||||
var columns = block.getColumnDefs();
|
||||
int firstOptional = 0;
|
||||
while (firstOptional < columns.size() && !columns.get(firstOptional).isOptionalHeader()) firstOptional++;
|
||||
// Optional headers permit legacy files, but a typo must not silently drop settings.
|
||||
try (var input = Files.newInputStream(Path.of(filePath)); var workbook = new XSSFWorkbook(input)) {
|
||||
var header = workbook.getSheetAt(0).getRow(0);
|
||||
if (header == null) return "";
|
||||
DataFormatter formatter = new DataFormatter();
|
||||
int lastHeader = header.getLastCellNum() - 1;
|
||||
while (lastHeader >= firstOptional
|
||||
&& formatter.formatCellValue(header.getCell(lastHeader)).isBlank()) lastHeader--;
|
||||
int expected = firstOptional;
|
||||
for (int index = firstOptional; index <= lastHeader; index++) {
|
||||
String actual = formatter.formatCellValue(header.getCell(index)).trim();
|
||||
while (expected < columns.size()
|
||||
&& !StringUtils.equalsIgnoreCase(columns.get(expected).getColumnHeader(), actual)) expected++;
|
||||
if (actual.isEmpty() || expected == columns.size()) {
|
||||
return "Invalid Comp Rule column header or order at column " + (index + 1);
|
||||
}
|
||||
expected++;
|
||||
}
|
||||
return "";
|
||||
} catch (Exception e) {
|
||||
return "Unable to read import file: " + e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public static void preparePresetExport(CfgExceptionDaylightResponse row) {
|
||||
row.setCompPresetId("");
|
||||
row.setCompPresetContent("");
|
||||
if (row.getCfgCompPresetList() == null) return;
|
||||
var presets = row.getCfgCompPresetList().stream().filter(Objects::nonNull).toList();
|
||||
row.setCompPresetId(presets.stream()
|
||||
.map(preset -> StringEscapeUtils.escapeCsv(StringUtils.defaultString(preset.getDlCompPresetId())))
|
||||
.collect(Collectors.joining(",")));
|
||||
row.setCompPresetContent(presets.stream()
|
||||
.map(preset -> StringEscapeUtils.escapeCsv(StringUtils.defaultString(preset.getCompPresetContent())))
|
||||
.collect(Collectors.joining(",")));
|
||||
}
|
||||
|
||||
public static String validateCompRuleImport(ExceptionDaylightImportRow row) {
|
||||
StringBuilder errors = new StringBuilder();
|
||||
row.setCompRuleCategoryVal(null);
|
||||
if (StringUtils.isNotBlank(row.getCompRuleCategory())) {
|
||||
String category = row.getCompRuleCategory().trim();
|
||||
if ("1".equals(category) || "2".equals(category)) {
|
||||
row.setCompRuleCategoryVal(Integer.valueOf(category));
|
||||
} else {
|
||||
errors.append("Room Category must be 1 or 2;");
|
||||
}
|
||||
}
|
||||
if (row.getSoftLimit() != null) row.setSoftLimit(row.getSoftLimit().trim());
|
||||
if (StringUtils.isNotBlank(row.getSoftLimit())) {
|
||||
String limit = row.getSoftLimit();
|
||||
if (limit.length() > 50 || !limit.matches("[0-9]+(?:\\.[0-9]*)?")) {
|
||||
errors.append("Soft Limit must be a number between 1 and 100;");
|
||||
} else {
|
||||
BigDecimal value = new BigDecimal(limit);
|
||||
if (value.compareTo(BigDecimal.ONE) < 0 || value.compareTo(BigDecimal.valueOf(100)) > 0) {
|
||||
errors.append("Soft Limit must be a number between 1 and 100;");
|
||||
}
|
||||
}
|
||||
}
|
||||
checkLength(errors, "Approver", row.getApprover(), 255);
|
||||
checkLength(errors, "Complimentary Type Id", row.getDlCompTypeId(), 100);
|
||||
checkLength(errors, "Complimentary Type", row.getCompTypeContent(), 1000);
|
||||
checkLength(errors, "Payment Method Code Id", row.getDlPaymentMethodCodeId(), 100);
|
||||
checkLength(errors, "Payment Method Code", row.getPaymentMethodCodeContent(), 1000);
|
||||
row.setDlCompPresetIds(new ArrayList<>());
|
||||
row.setCompPresetContents(new ArrayList<>());
|
||||
try {
|
||||
List<String> ids = parseCsvCell(row.getCompPresetId());
|
||||
List<String> contents = parseCsvCell(row.getCompPresetContent());
|
||||
if (contents.size() > ids.size() && contents.stream().anyMatch(StringUtils::isNotBlank)) {
|
||||
errors.append("Complimentary Preset has more descriptions than IDs;");
|
||||
}
|
||||
for (int i = 0; i < ids.size(); i++) {
|
||||
if (StringUtils.isBlank(ids.get(i))) continue;
|
||||
String content = contents.size() > i ? contents.get(i) : null;
|
||||
checkLength(errors, "Complimentary Preset Id", ids.get(i), 100);
|
||||
checkLength(errors, "Complimentary Preset", content, 1000);
|
||||
row.getDlCompPresetIds().add(ids.get(i));
|
||||
row.getCompPresetContents().add(content);
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
errors.append("Complimentary Preset contains invalid CSV quoting;");
|
||||
}
|
||||
return errors.toString();
|
||||
}
|
||||
|
||||
private static void checkLength(StringBuilder errors, String field, String value, int maximum) {
|
||||
if (value != null && value.length() > maximum) {
|
||||
errors.append(field).append(" exceeds ").append(maximum).append(" characters;");
|
||||
}
|
||||
}
|
||||
|
||||
// CSV inside a single Excel cell preserves commas and quotes in preset names.
|
||||
private static List<String> parseCsvCell(String value) {
|
||||
List<String> values = new ArrayList<>();
|
||||
if (StringUtils.isBlank(value)) return values;
|
||||
StringBuilder token = new StringBuilder();
|
||||
boolean quoted = false;
|
||||
boolean closedQuote = false;
|
||||
for (int i = 0; i < value.length(); i++) {
|
||||
char character = value.charAt(i);
|
||||
if (quoted) {
|
||||
if (character == '"') {
|
||||
if (i + 1 < value.length() && value.charAt(i + 1) == '"') {
|
||||
token.append('"');
|
||||
i++;
|
||||
} else {
|
||||
quoted = false;
|
||||
closedQuote = true;
|
||||
}
|
||||
} else {
|
||||
token.append(character);
|
||||
}
|
||||
} else if (character == ',') {
|
||||
values.add(token.toString().trim());
|
||||
token.setLength(0);
|
||||
closedQuote = false;
|
||||
} else if (character == '"' && !closedQuote && token.toString().isBlank()) {
|
||||
token.setLength(0);
|
||||
quoted = true;
|
||||
} else if (character == '"' || (closedQuote && !Character.isWhitespace(character))) {
|
||||
throw new IllegalArgumentException("Invalid CSV quoting");
|
||||
} else if (!closedQuote) {
|
||||
token.append(character);
|
||||
}
|
||||
}
|
||||
if (quoted) throw new IllegalArgumentException("Unclosed CSV quoting");
|
||||
values.add(token.toString().trim());
|
||||
return values;
|
||||
}
|
||||
}
|
||||
@@ -23,4 +23,5 @@ public class CfgPropertiesDto {
|
||||
private Integer showCalendar;
|
||||
private String calendarName;
|
||||
private Integer calendarOrder;
|
||||
private int displayType;
|
||||
}
|
||||
|
||||
+2
@@ -23,6 +23,8 @@ public class CreateUpdatePropertyRequest {
|
||||
|
||||
private int status = 1;
|
||||
|
||||
private int displayType = 1;
|
||||
|
||||
private String calendarName;
|
||||
|
||||
private Integer calendarOrder;
|
||||
|
||||
@@ -59,4 +59,7 @@ public class CfgProperties implements Serializable {
|
||||
private String calendarName;
|
||||
@Column(name="calendar_order")
|
||||
private Integer calendarOrder;
|
||||
|
||||
@Column(name = "display_type")
|
||||
private int displayType;
|
||||
}
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.mgm.mcrm.common.dtos.dataimport.appsetting;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ExceptionDaylightImportRow {
|
||||
private boolean validatePassed;
|
||||
private String errorMessage;
|
||||
private String userId;
|
||||
private Long propertyId;
|
||||
private Long bookingTypeId;
|
||||
private Long rateCodeId;
|
||||
private Long sourceCodeId;
|
||||
private Long marketCodeId;
|
||||
private Long blockCodeId;
|
||||
private String propertyName;
|
||||
private String bookingTypeName;
|
||||
private String blockCodeName;
|
||||
private String rateCodeName;
|
||||
private String roomTypeNames;
|
||||
private String sourceCodeName;
|
||||
private String marketCodeName;
|
||||
private List<Long> roomTypeIds;
|
||||
private String approver;
|
||||
private String compRuleCategory;
|
||||
private Integer compRuleCategoryVal;
|
||||
private String dlCompTypeId;
|
||||
private String compTypeContent;
|
||||
private String dlPaymentMethodCodeId;
|
||||
private String paymentMethodCodeContent;
|
||||
private String compPresetId;
|
||||
private String compPresetContent;
|
||||
private List<String> dlCompPresetIds;
|
||||
private List<String> compPresetContents;
|
||||
private String softLimit;
|
||||
}
|
||||
@@ -12,6 +12,7 @@ public class ColumnDefine {
|
||||
private String formatVal;
|
||||
private String groupKeyAttrName;
|
||||
private boolean checkHeader=false;
|
||||
private boolean optionalHeader=false;
|
||||
private int columnWidth=0;
|
||||
private int columnIndex=0;
|
||||
private int headerRowIdx=0;
|
||||
@@ -71,6 +72,12 @@ public class ColumnDefine {
|
||||
public void setCheckHeader(boolean checkHeader) {
|
||||
this.checkHeader = checkHeader;
|
||||
}
|
||||
public boolean isOptionalHeader() {
|
||||
return optionalHeader;
|
||||
}
|
||||
public void setOptionalHeader(boolean optionalHeader) {
|
||||
this.optionalHeader = optionalHeader;
|
||||
}
|
||||
public int getHeaderRowIdx() {
|
||||
return headerRowIdx;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import org.apache.hc.core5.http.Header;
|
||||
import org.apache.hc.core5.http.HttpEntity;
|
||||
import org.apache.hc.core5.http.NameValuePair;
|
||||
import org.apache.hc.core5.http.io.entity.EntityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
@@ -59,6 +61,8 @@ import com.mgm.mcrm.common.httpclient.HttpEntityBuilder;
|
||||
*/
|
||||
public class HttpClientExecutor {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(HttpClientExecutor.class);
|
||||
|
||||
private HttpClientExecutor() {
|
||||
// 工具类,禁止实例化
|
||||
}
|
||||
@@ -181,7 +185,7 @@ public class HttpClientExecutor {
|
||||
url = url + "?" + query;
|
||||
}
|
||||
}
|
||||
System.out.println(url);
|
||||
log.info("Final GET request URL: {}", url);
|
||||
HttpGet httpGet = new HttpGet(url);
|
||||
setHeaders(httpGet, headers);
|
||||
setRequestConfig(httpGet, config);
|
||||
@@ -284,7 +288,7 @@ public class HttpClientExecutor {
|
||||
url = url + "?" + query;
|
||||
}
|
||||
}
|
||||
System.out.println(url);
|
||||
log.info("Final GET request URL: {}", url);
|
||||
HttpGet httpGet = new HttpGet(url);
|
||||
setHeaders(httpGet, headers);
|
||||
setRequestConfig(httpGet, options);
|
||||
|
||||
@@ -90,19 +90,19 @@ public class HttpRequestOptions {
|
||||
private RequestConfig requestConfig;
|
||||
|
||||
/**
|
||||
* 解决多线程下载时,strean被close的问题
|
||||
* 当前请求的输出流
|
||||
*/
|
||||
private static final ThreadLocal<OutputStream> outs = new ThreadLocal<OutputStream>();
|
||||
private OutputStream out;
|
||||
|
||||
/**
|
||||
* 解决多线程处理时,url被覆盖问题
|
||||
* 当前请求的 URL
|
||||
*/
|
||||
private static final ThreadLocal<String> urls = new ThreadLocal<String>();
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 解决多线程处理时,url被覆盖问题
|
||||
* 当前请求的参数,随实例保存,避免线程复用时混入上一次请求的数据
|
||||
*/
|
||||
private static final ThreadLocal<Map<String,Object>> maps = new ThreadLocal<Map<String,Object>>();
|
||||
private Map<String, Object> parameters;
|
||||
|
||||
/**
|
||||
* @param client HttpClient对象
|
||||
@@ -118,7 +118,7 @@ public class HttpRequestOptions {
|
||||
* @return 返回当前对象
|
||||
*/
|
||||
public HttpRequestOptions url(String url) {
|
||||
urls.set(url);
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -176,13 +176,13 @@ public class HttpRequestOptions {
|
||||
* @return 返回当前对象
|
||||
*/
|
||||
public HttpRequestOptions map(Map<String, Object> map) {
|
||||
Map<String, Object> m = maps.get();
|
||||
if(m == null || map.isEmpty()){
|
||||
m = map;
|
||||
if (map == null) {
|
||||
parameters = null;
|
||||
} else if (parameters == null || map.isEmpty()) {
|
||||
parameters = new HashMap<>(map);
|
||||
} else {
|
||||
m.putAll(map);
|
||||
parameters.putAll(map);
|
||||
}
|
||||
maps.set(m);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -192,9 +192,8 @@ public class HttpRequestOptions {
|
||||
*/
|
||||
public HttpRequestOptions json(String json) {
|
||||
this.json = json;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(HttpEntityBuilder.ENTITY_JSON, json);
|
||||
maps.set(map);
|
||||
parameters = new HashMap<>();
|
||||
parameters.put(HttpEntityBuilder.ENTITY_JSON, json);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -222,14 +221,12 @@ public class HttpRequestOptions {
|
||||
* @return 返回当前对象
|
||||
*/
|
||||
public HttpRequestOptions files(String[] filePaths, String inputName, boolean forceRemoveContentTypeChraset) {
|
||||
Map<String, Object> m = maps.get();
|
||||
if(m == null || m.isEmpty()){
|
||||
m = new HashMap<String, Object>();
|
||||
if (parameters == null) {
|
||||
parameters = new HashMap<>();
|
||||
}
|
||||
m.put(HttpEntityBuilder.ENTITY_MULTIPART, filePaths);
|
||||
m.put(HttpEntityBuilder.ENTITY_MULTIPART+".name", inputName);
|
||||
m.put(HttpEntityBuilder.ENTITY_MULTIPART+".rmCharset", forceRemoveContentTypeChraset);
|
||||
maps.set(m);
|
||||
parameters.put(HttpEntityBuilder.ENTITY_MULTIPART, filePaths);
|
||||
parameters.put(HttpEntityBuilder.ENTITY_MULTIPART+".name", inputName);
|
||||
parameters.put(HttpEntityBuilder.ENTITY_MULTIPART+".rmCharset", forceRemoveContentTypeChraset);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -264,7 +261,7 @@ public class HttpRequestOptions {
|
||||
* @return 返回当前对象
|
||||
*/
|
||||
public HttpRequestOptions out(OutputStream out) {
|
||||
outs.set(out);
|
||||
this.out = out;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -320,7 +317,7 @@ public class HttpRequestOptions {
|
||||
}
|
||||
|
||||
public String url() {
|
||||
return urls.get();
|
||||
return url;
|
||||
}
|
||||
|
||||
public HttpMethods method() {
|
||||
@@ -336,7 +333,7 @@ public class HttpRequestOptions {
|
||||
}
|
||||
|
||||
public Map<String, Object> map() {
|
||||
return maps.get();
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public String json() {
|
||||
@@ -356,7 +353,7 @@ public class HttpRequestOptions {
|
||||
}
|
||||
|
||||
public OutputStream out() {
|
||||
return outs.get();
|
||||
return out;
|
||||
}
|
||||
|
||||
public RequestConfig requestConfig() {
|
||||
|
||||
@@ -65,7 +65,7 @@ public class HttpService {
|
||||
.client(httpClient);
|
||||
|
||||
String result = HttpClientExecutor.get(options, supplementDaylightProxySecurity(headers));
|
||||
log.info("====== GET request result:{}", result);
|
||||
log.info("====== GET request result length={}", result.length());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -170,6 +170,15 @@ public class ExcelUtils {
|
||||
for(int k=0; k<colDefs.size();k++) {
|
||||
ColumnDefine colDef = colDefs.get(k);
|
||||
if(StringUtils.isBlank(colDef.getGroupName())) {
|
||||
if (colDef.isOptionalHeader()) {
|
||||
int headerCol = dataBlock.getOffsetCol() >= 0
|
||||
? dataBlock.getOffsetCol() : lastCol - dataBlock.getOffsetCol();
|
||||
Row headerRow = sheet.getRow(lastRow + colDef.getHeaderRowIdx());
|
||||
String header = getCellTextValueInRow(headerRow, headerCol + colIdx, true).trim();
|
||||
if (!Strings.CI.equals(colDef.getColumnHeader(), header)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
RowFieldInfo colInfo= getImportFieldInfoFromDefine(colDef,objClass);
|
||||
colInfo.setColIndex(colIdx);
|
||||
masterFields.add(colInfo);
|
||||
|
||||
@@ -26,10 +26,8 @@ import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
|
||||
import org.apache.hc.client5.http.impl.classic.HttpClients;
|
||||
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
|
||||
import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
|
||||
import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
|
||||
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
|
||||
|
||||
import org.apache.hc.client5.http.ssl.TrustAllStrategy;
|
||||
import org.apache.hc.core5.http.ContentType;
|
||||
import org.apache.hc.core5.http.HttpEntity;
|
||||
import org.apache.hc.core5.http.Header;
|
||||
@@ -37,7 +35,6 @@ import org.apache.hc.core5.http.config.Registry;
|
||||
import org.apache.hc.core5.http.config.RegistryBuilder;
|
||||
import org.apache.hc.core5.http.io.entity.EntityUtils;
|
||||
import org.apache.hc.core5.http.message.BasicHeader;
|
||||
import org.apache.hc.core5.ssl.SSLContextBuilder;
|
||||
import org.apache.hc.core5.util.Timeout;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -121,7 +118,7 @@ public class HttpUtil {
|
||||
return httpResult;
|
||||
}
|
||||
|
||||
public static HttpResponseResult invokeGatewayAPI(JSONObject requestContent, String requestMethod,
|
||||
public static HttpResponseResult invokeGatewayEmailAPI(JSONObject requestContent, String requestMethod,
|
||||
HttpServletRequest request, MultipartFile[] files, ApiGatewaySetting apiGatewaySetting) throws Exception {
|
||||
String serverUrl = apiGatewaySetting.getBaseUrl();
|
||||
int timeoutTime = apiGatewaySetting.getRequestTimeout();
|
||||
@@ -308,12 +305,13 @@ public class HttpUtil {
|
||||
if(Strings.CI.startsWith(requestUrl, "https://")) {
|
||||
SSLContext sslContext = null;
|
||||
try {
|
||||
sslContext = SSLContextBuilder.create().loadTrustMaterial(TrustAllStrategy.INSTANCE).build();
|
||||
//sslContext = SSLContextBuilder.create().loadTrustMaterial(TrustAllStrategy.INSTANCE).build();
|
||||
sslContext = getSSLContext();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("https", new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE ))
|
||||
.register("https", new SSLConnectionSocketFactory(sslContext, getTrustHandler()))
|
||||
.build();
|
||||
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(registry);
|
||||
HttpClientBuilder httpClientBuilder = HttpClients.custom().setConnectionManager(connectionManager)
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@ import lombok.Setter;
|
||||
@NoArgsConstructor
|
||||
public class CfgEmailTemplateDeleteByIdRequest {
|
||||
|
||||
private Long Id;
|
||||
private Long id;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
package com.mgm.mcrm.notification.services;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.mgm.mcrm.common.dtos.HttpResponseResult;
|
||||
import com.mgm.mcrm.common.dtos.ServiceResult;
|
||||
import com.mgm.mcrm.common.dtos.config.ApiGatewaySetting;
|
||||
import com.mgm.mcrm.common.utils.DateTimeUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.Strings;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.mgm.mcrm.common.utils.HttpUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
@Service
|
||||
@@ -23,14 +27,35 @@ public class SendEmailService {
|
||||
JSONObject requestObj = temp;
|
||||
HttpResponseResult httpResult = HttpUtil.invokeWebAPI(requestObj, "POST", request,null);
|
||||
String content = httpResult.getResponseContent();
|
||||
JSONObject obj = (JSONObject) JSONObject.parseObject(content);
|
||||
JSONObject obj = JSONObject.parseObject(content);
|
||||
if(obj.getBooleanValue("success")) {
|
||||
JSONArray data = obj.getJSONArray("data");
|
||||
|
||||
if (data != null) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
|
||||
JSONObject dataObj = data.getJSONObject(i);
|
||||
|
||||
String subject = dataObj.getString("subject");
|
||||
|
||||
if (subject != null) {
|
||||
dataObj.put(
|
||||
"subject",
|
||||
Strings.CI.replace(
|
||||
subject,
|
||||
"[TODAY]",
|
||||
DateTimeUtil.getCurrentDate("dd MMM")
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.setSuccess(true);
|
||||
Object getData = obj.get("data");
|
||||
result.setReturnData(getData);
|
||||
result.setReturnData(data);
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
if(obj.getString("message")!=null&&obj.getString("message")!="") {
|
||||
if(obj.getString("message")!=null&& !Objects.equals(obj.getString("message"), "")) {
|
||||
result.setErrorMessage(obj.getString("message"));
|
||||
}else {
|
||||
result.setErrorMessage("System Error");
|
||||
@@ -44,7 +69,7 @@ public class SendEmailService {
|
||||
public ServiceResult sendEmailTemplates(HttpServletRequest request,JSONObject temp) throws Exception {
|
||||
ServiceResult result = new ServiceResult();
|
||||
JSONObject requestObj = temp;
|
||||
HttpResponseResult httpResult = HttpUtil.invokeGatewayAPI(requestObj, "POST", request, null, apiGatewaySetting);
|
||||
HttpResponseResult httpResult = HttpUtil.invokeGatewayEmailAPI(requestObj, "POST", request, null, apiGatewaySetting);
|
||||
String content = httpResult.getResponseContent();
|
||||
JSONObject obj = JSONObject.parseObject(content);
|
||||
if(obj.getBooleanValue("success")) {
|
||||
@@ -53,7 +78,7 @@ public class SendEmailService {
|
||||
result.setReturnData(getData);
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
if(obj.getString("message")!=null&&obj.getString("message")!="") {
|
||||
if(obj.getString("message")!=null&& !Objects.equals(obj.getString("message"), "")) {
|
||||
result.setErrorMessage(obj.getString("message"));
|
||||
}else {
|
||||
result.setErrorMessage("System Error");
|
||||
|
||||
@@ -245,6 +245,8 @@ public class BookingsView implements Serializable {
|
||||
private String approverName;
|
||||
@Column(name = "approval_reason")
|
||||
private String approvalReason;
|
||||
@Column(name = "booking_approval_reason")
|
||||
private String bookingApprovalReason;
|
||||
|
||||
@Transient
|
||||
private String status;
|
||||
|
||||
@@ -701,7 +701,7 @@ public class BookingService {
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getSearchFirstName())) {
|
||||
list.add(cb.like(cb.upper(root.get("memberLastName")),
|
||||
"%" + ", " + otherPropertyPageRequest.getSearchFirstName().toUpperCase() + "%"));
|
||||
"%" + otherPropertyPageRequest.getSearchFirstName().toUpperCase() + "%"));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getSearchConfirmationNo())) {
|
||||
@@ -817,11 +817,11 @@ public class BookingService {
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getSearchSourceCode())) {
|
||||
list.add(cb.equal(cb.upper(root.get("dlSourceId")),
|
||||
list.add(cb.equal(cb.upper(root.get("sourceCode")),
|
||||
otherPropertyPageRequest.getSearchSourceCode().toUpperCase()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getPropertyName())) {
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getPropertyName()) && !"ALL".equalsIgnoreCase(otherPropertyPageRequest.getPropertyName())) {
|
||||
list.add(cb.like(cb.upper(root.get("propertyName")),
|
||||
"%" + otherPropertyPageRequest.getPropertyName().toUpperCase() + "%"));
|
||||
}
|
||||
@@ -832,7 +832,7 @@ public class BookingService {
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(otherPropertyPageRequest.getRoomTypeName())) {
|
||||
list.add(cb.like(cb.upper(root.get("roomTypeName")),
|
||||
list.add(cb.like(cb.upper(root.get("room")),
|
||||
"%" + otherPropertyPageRequest.getRoomTypeName().toUpperCase() + "%"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user