문자발송시 이벤트 누락 및 오류 개선
This commit is contained in:
parent
a2ba4a9865
commit
726a803e3e
@ -110,9 +110,9 @@ public class MjonMsgSendVO{
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description : event 여부 / group tb에 넣는 용도
|
* @description : event 여부 / group tb에 넣는 용도 / 기본값 N
|
||||||
*/
|
*/
|
||||||
private String eventYn;
|
private String eventYn="N";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -759,8 +759,10 @@ public final class MsgSendUtils {
|
|||||||
// 최적의 메시지 리스트에 추가
|
// 최적의 메시지 리스트에 추가
|
||||||
if (sum + floatEachPrice <= targetCash) {
|
if (sum + floatEachPrice <= targetCash) {
|
||||||
sum += floatEachPrice;
|
sum += floatEachPrice;
|
||||||
|
|
||||||
msg.setEachPrice(eachPrice);
|
msg.setEachPrice(eachPrice);
|
||||||
msg.setEventYn("Y");
|
msg.setEventYn("Y");
|
||||||
|
|
||||||
optimalList.add(msg);
|
optimalList.add(msg);
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
} else {
|
} else {
|
||||||
@ -768,22 +770,19 @@ public final class MsgSendUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 잔액 부족 시 이벤트 종료 처리하는 VO 생성
|
// 이벤트 잔액 처리하는 매소드 terminateEvent
|
||||||
double remainAmt = targetCash - sum;
|
double remainAmt = targetCash - sum;
|
||||||
log.info("remainAmt :: [{}]", remainAmt);
|
MjonEventVO returnEventMberInfo = terminateEvent(eventMberInfo, remainAmt);
|
||||||
if (remainAmt < MIN_EVENT_REMAIN_CASH) {
|
|
||||||
MjonEventVO returnEventMberInfo = terminateEvent(eventMberInfo, remainAmt);
|
|
||||||
return OptimalMsgResultDTO.builder()
|
|
||||||
.optimalMsgList(optimalList)
|
|
||||||
.eventInfo(returnEventMberInfo)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 결과 반환
|
|
||||||
return OptimalMsgResultDTO.builder()
|
return OptimalMsgResultDTO.builder()
|
||||||
.optimalMsgList(optimalList)
|
.optimalMsgList(optimalList)
|
||||||
.eventInfo(null)
|
.eventInfo(returnEventMberInfo)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// 결과 반환
|
||||||
|
// return OptimalMsgResultDTO.builder()
|
||||||
|
// .optimalMsgList(optimalList)
|
||||||
|
// .eventInfo(null)
|
||||||
|
// .build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -836,9 +835,14 @@ public final class MsgSendUtils {
|
|||||||
// 이벤트 상태를 종료로 변경
|
// 이벤트 상태를 종료로 변경
|
||||||
MjonEventVO returnEventMberInfo = new MjonEventVO();
|
MjonEventVO returnEventMberInfo = new MjonEventVO();
|
||||||
returnEventMberInfo.setEventInfoId(eventMberInfo.getEventInfoId());
|
returnEventMberInfo.setEventInfoId(eventMberInfo.getEventInfoId());
|
||||||
returnEventMberInfo.setEventStatus("E");
|
returnEventMberInfo.setMberId(eventMberInfo.getMberId());
|
||||||
returnEventMberInfo.setEventRemainCash(targetCash);
|
returnEventMberInfo.setEventRemainCash(targetCash);
|
||||||
returnEventMberInfo.setEventMemo("발송 최소 금액("+ MIN_EVENT_REMAIN_CASH +") 부족 혹은 이벤트 종료일 초과되어 이벤트 종료 시킴");
|
returnEventMberInfo.setEventStatus("Y");
|
||||||
|
|
||||||
|
if (targetCash < MIN_EVENT_REMAIN_CASH) {
|
||||||
|
returnEventMberInfo.setEventStatus("E");
|
||||||
|
returnEventMberInfo.setEventMemo("발송 최소 금액("+ MIN_EVENT_REMAIN_CASH +") 부족 혹은 이벤트 종료일 초과되어 이벤트 종료 시킴");
|
||||||
|
}
|
||||||
return returnEventMberInfo;
|
return returnEventMberInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -629,6 +629,7 @@ private int parseIntOrDefault(String value, int defaultValue) {
|
|||||||
return statusResponse; // 이벤트 상태가 종료이거나 endDate가 없는 경우 처리하지 않음
|
return statusResponse; // 이벤트 상태가 종료이거나 endDate가 없는 경우 처리하지 않음
|
||||||
}
|
}
|
||||||
log.info(" + 이벤트 진행 대상자 :: [{}]", userId);
|
log.info(" + 이벤트 진행 대상자 :: [{}]", userId);
|
||||||
|
log.info(" + 이벤트 진행 대상자 eventMberInfo.getMberId() :: [{}]", eventMberInfo.getMberId());
|
||||||
|
|
||||||
// 최적화된 메시지 리스트 및 이벤트 정보 가져오기
|
// 최적화된 메시지 리스트 및 이벤트 정보 가져오기
|
||||||
OptimalMsgResultDTO result = MsgSendUtils.getOptimalMsgList(eventMberInfo, mjonMsgSendVOList);
|
OptimalMsgResultDTO result = MsgSendUtils.getOptimalMsgList(eventMberInfo, mjonMsgSendVOList);
|
||||||
@ -642,8 +643,7 @@ private int parseIntOrDefault(String value, int defaultValue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 이벤트 상태 종료 시 업데이트
|
// 이벤트 상태 종료 시 업데이트
|
||||||
if (returnEventMberInfo != null && "E".equals(returnEventMberInfo.getEventStatus())) {
|
if (returnEventMberInfo != null) {
|
||||||
returnEventMberInfo.setMberId(userId);
|
|
||||||
mjonEventService.updateEventEndStatus(returnEventMberInfo);
|
mjonEventService.updateEventEndStatus(returnEventMberInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4125,6 +4125,7 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
|||||||
Map<String, List<MjonMsgSendVO>> priceGroupedMessages = mjonMsgSendVOList.stream()
|
Map<String, List<MjonMsgSendVO>> priceGroupedMessages = mjonMsgSendVOList.stream()
|
||||||
.collect(Collectors.groupingBy(MjonMsgSendVO::getEachPrice));
|
.collect(Collectors.groupingBy(MjonMsgSendVO::getEachPrice));
|
||||||
|
|
||||||
|
// instTotalCnt : 화면에서 보여줄 총 발송건수
|
||||||
int instTotalCnt = 0;
|
int instTotalCnt = 0;
|
||||||
// Step 2: 그룹화 된 데이터를 그룹별로 insert 처리
|
// Step 2: 그룹화 된 데이터를 그룹별로 insert 처리
|
||||||
for (Map.Entry<String, List<MjonMsgSendVO>> entry : priceGroupedMessages.entrySet()) {
|
for (Map.Entry<String, List<MjonMsgSendVO>> entry : priceGroupedMessages.entrySet()) {
|
||||||
@ -4139,12 +4140,17 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
|||||||
int instCnt = this.insertMsgData_advc(groupedMsgList);
|
int instCnt = this.insertMsgData_advc(groupedMsgList);
|
||||||
|
|
||||||
if (instCnt > 0) {
|
if (instCnt > 0) {
|
||||||
|
|
||||||
instTotalCnt += instCnt;
|
instTotalCnt += instCnt;
|
||||||
this.insertMsgGroupDataTb_advc(instCnt, mjonMsgVO, groupedMsgList);
|
this.insertMsgGroupDataTb_advc(instCnt, mjonMsgVO, groupedMsgList);
|
||||||
|
|
||||||
// 금액 및 포인트 insert
|
// 금액 및 포인트 insert
|
||||||
priceAndPoint.insertCashAndPoint(userId, -Float.parseFloat(mjonMsgVO.getTotPrice()),
|
priceAndPoint.insertCashAndPoint(
|
||||||
"SMS 문자 총 " + groupedMsgList.size() + "건 중 " + instCnt + "건 발송", mjonMsgVO.getMsgGroupId());
|
userId
|
||||||
|
, -Float.parseFloat(mjonMsgVO.getTotPrice()),
|
||||||
|
"SMS 문자 총 " + groupedMsgList.size() + "건 중 " + instCnt + "건 발송"
|
||||||
|
, mjonMsgVO.getMsgGroupId()
|
||||||
|
);
|
||||||
// spam 문자 저장
|
// spam 문자 저장
|
||||||
handleSpamMsg_advc(mjonMsgVO, groupedMsgList.get(0));
|
handleSpamMsg_advc(mjonMsgVO, groupedMsgList.get(0));
|
||||||
}
|
}
|
||||||
@ -4167,7 +4173,6 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
|||||||
|
|
||||||
// TEST발송 시 발송 후 캐시가 있어야함.
|
// TEST발송 시 발송 후 캐시가 있어야함.
|
||||||
returnMap.put("afterCash", priceAndPoint.getBefCash(userId));
|
returnMap.put("afterCash", priceAndPoint.getBefCash(userId));
|
||||||
log.debug("총 단가 합계: [{}]", mjonMsgVO.getTotPrice());
|
|
||||||
//
|
//
|
||||||
|
|
||||||
boolean isNotified = mjonCommon.processUserAndCheckSms(mjonMsgVO, userId);
|
boolean isNotified = mjonCommon.processUserAndCheckSms(mjonMsgVO, userId);
|
||||||
@ -4203,46 +4208,11 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
|||||||
// 개별단가
|
// 개별단가
|
||||||
mjonMsgVO.setEachPrice(mjonMsgSendVO.getEachPrice());
|
mjonMsgVO.setEachPrice(mjonMsgSendVO.getEachPrice());
|
||||||
|
|
||||||
//이벤트 회원인 경우 이벤트 캐시도 함께 차감.
|
mjonMsgVO.setEventYn(mjonMsgSendVO.getEventYn());
|
||||||
MjonEventVO mjonEventVO = new MjonEventVO();
|
|
||||||
mjonEventVO.setMberId(mjonMsgSendVO.getUserId());
|
|
||||||
MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo(mjonEventVO);
|
|
||||||
|
|
||||||
String str = String.valueOf(mjonMsgSendVO.getEachPrice());
|
// event Chk
|
||||||
// 소수점 제거
|
// String eventYn = getEventYn(mjonMsgSendVO.getUserId(), mjonMsgSendVO.getEachPrice());
|
||||||
String EachPrice = str.split("\\.")[0];
|
// mjonMsgVO.setEventYn(eventYn);
|
||||||
|
|
||||||
|
|
||||||
if(eventMberInfo != null) {
|
|
||||||
String eventShortPrice = String.valueOf(eventMberInfo.getEventShortPrice());
|
|
||||||
eventShortPrice = eventShortPrice.split("\\.")[0];
|
|
||||||
|
|
||||||
String eventLongPrice = String.valueOf(eventMberInfo.getEventLongPrice());
|
|
||||||
eventLongPrice = eventLongPrice.split("\\.")[0];
|
|
||||||
|
|
||||||
String eventPicturePrice = String.valueOf(eventMberInfo.getEventPicturePrice());
|
|
||||||
eventPicturePrice = eventPicturePrice.split("\\.")[0];
|
|
||||||
|
|
||||||
String eventPicture2Price = String.valueOf(eventMberInfo.getEventPicture2Price());
|
|
||||||
eventPicture2Price = eventPicture2Price.split("\\.")[0];
|
|
||||||
|
|
||||||
String eventPicture3Price = String.valueOf(eventMberInfo.getEventPicture3Price());
|
|
||||||
eventPicture3Price = eventPicture3Price.split("\\.")[0];
|
|
||||||
|
|
||||||
if(EachPrice.equals(eventShortPrice)) {
|
|
||||||
mjonMsgVO.setEventYn("Y");
|
|
||||||
}else if(EachPrice.equals(eventLongPrice)) {
|
|
||||||
mjonMsgVO.setEventYn("Y");
|
|
||||||
}else if(EachPrice.equals(eventPicturePrice)) {
|
|
||||||
mjonMsgVO.setEventYn("Y");
|
|
||||||
}else if(EachPrice.equals(eventPicture2Price)) {
|
|
||||||
mjonMsgVO.setEventYn("Y");
|
|
||||||
}else if(EachPrice.equals(eventPicture3Price)) {
|
|
||||||
mjonMsgVO.setEventYn("Y");
|
|
||||||
}else {
|
|
||||||
mjonMsgVO.setEventYn("N");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 전송사 코드 번호를 셋팅해 준다.
|
// 전송사 코드 번호를 셋팅해 준다.
|
||||||
@ -4264,6 +4234,52 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getEventYn(String p_userId, String p_eachPrice) throws Exception {
|
||||||
|
|
||||||
|
String returnValue="N";
|
||||||
|
|
||||||
|
//이벤트 회원인 경우 이벤트 캐시도 함께 차감.
|
||||||
|
MjonEventVO mjonEventVO = new MjonEventVO();
|
||||||
|
mjonEventVO.setMberId(p_userId);
|
||||||
|
|
||||||
|
// 이벤트 멤버 정보를 조회
|
||||||
|
MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo(mjonEventVO);
|
||||||
|
|
||||||
|
// mjonMsgSendVO에서 EachPrice 값을 가져와 BigDecimal로 변환하고, 불필요한 소수점 0 제거
|
||||||
|
BigDecimal eachPrice = new BigDecimal(p_eachPrice).stripTrailingZeros();
|
||||||
|
|
||||||
|
if(eventMberInfo != null) {
|
||||||
|
|
||||||
|
// eventMberInfo에서 각 가격 값을 가져와 BigDecimal로 변환하고, 불필요한 소수점 0 제거
|
||||||
|
BigDecimal eventShortPrice = new BigDecimal(eventMberInfo.getEventShortPrice()).stripTrailingZeros();
|
||||||
|
BigDecimal eventLongPrice = new BigDecimal(eventMberInfo.getEventLongPrice()).stripTrailingZeros();
|
||||||
|
BigDecimal eventPicturePrice = new BigDecimal(eventMberInfo.getEventPicturePrice()).stripTrailingZeros();
|
||||||
|
BigDecimal eventPicture2Price = new BigDecimal(eventMberInfo.getEventPicture2Price()).stripTrailingZeros();
|
||||||
|
BigDecimal eventPicture3Price = new BigDecimal(eventMberInfo.getEventPicture3Price()).stripTrailingZeros();
|
||||||
|
|
||||||
|
// log.info(" + eventShortPrice :: [{}]", eventShortPrice);
|
||||||
|
// log.info(" + eventLongPrice :: [{}]", eventLongPrice);
|
||||||
|
// log.info(" + eventPicturePrice :: [{}]", eventPicturePrice);
|
||||||
|
// log.info(" + eventPicture2Price :: [{}]", eventPicture2Price);
|
||||||
|
// log.info(" + eventPicture3Price :: [{}]", eventPicture3Price);
|
||||||
|
|
||||||
|
// log.info(" + eachPrice :: [{}]", eachPrice);
|
||||||
|
|
||||||
|
// 각 가격과 비교 (stripTrailingZeros() 적용으로 7.50과 7.5를 같은 값으로 인식)
|
||||||
|
if (eachPrice.compareTo(eventShortPrice) == 0 ||
|
||||||
|
eachPrice.compareTo(eventLongPrice) == 0 ||
|
||||||
|
eachPrice.compareTo(eventPicturePrice) == 0 ||
|
||||||
|
eachPrice.compareTo(eventPicture2Price) == 0 ||
|
||||||
|
eachPrice.compareTo(eventPicture3Price) == 0) {
|
||||||
|
|
||||||
|
returnValue = "Y"; // 매칭되는 가격이 있으면 이벤트 여부를 'Y'로 설정
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// log.info(" + getEventYn returnValue :: [{}]", returnValue);
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
private int insertMsgData_advc(List<MjonMsgSendVO> mjonMsgSendVOList) {
|
private int insertMsgData_advc(List<MjonMsgSendVO> mjonMsgSendVOList) {
|
||||||
|
|
||||||
// 시작 시간 측정
|
// 시작 시간 측정
|
||||||
|
|||||||
@ -125,36 +125,6 @@ public class PriceAndPoint {
|
|||||||
mjonPayDAO.insertCash(mjonPayVO); //캐시
|
mjonPayDAO.insertCash(mjonPayVO); //캐시
|
||||||
mjonPayDAO.updateMemberCash(mjonPayVO); //회원정보 업데이트
|
mjonPayDAO.updateMemberCash(mjonPayVO); //회원정보 업데이트
|
||||||
|
|
||||||
//이벤트 회원인 경우 이벤트 캐시도 함께 차감.
|
|
||||||
MjonEventVO mjonEventVO = new MjonEventVO();
|
|
||||||
mjonEventVO.setMberId(mjonPayVO.getUserId());
|
|
||||||
mjonEventVO.setEventStatus("Y");
|
|
||||||
MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo(mjonEventVO);
|
|
||||||
|
|
||||||
if(eventMberInfo != null) {
|
|
||||||
|
|
||||||
float evntRemainCash = (float) eventMberInfo.getEventRemainCash();
|
|
||||||
totPrice = (float) Math.abs(mjonPayVO.getCash());
|
|
||||||
|
|
||||||
float totRemainCash = evntRemainCash - totPrice;
|
|
||||||
mjonEventVO.setEventInfoId(eventMberInfo.getEventInfoId());
|
|
||||||
|
|
||||||
if(totRemainCash <= 0.0) {//차감액이 남아있지 않으면 이벤트를 종료
|
|
||||||
|
|
||||||
//이벤트 상태값을 종료로 변경한다.
|
|
||||||
mjonEventVO.setEventStatus("E");
|
|
||||||
mjonEventVO.setEventRemainCash(0.0);
|
|
||||||
mjonEventService.updateEventEndStatus(mjonEventVO);
|
|
||||||
|
|
||||||
}else {//이벤트 회원 캐시 차감시킴
|
|
||||||
|
|
||||||
mjonEventVO.setEventRemainCash(totRemainCash);
|
|
||||||
mjonEventService.updateEventRemainCash(mjonEventVO);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -180,7 +180,9 @@
|
|||||||
<isNotEmpty property="eventEndDate">
|
<isNotEmpty property="eventEndDate">
|
||||||
,EVENT_END_DATE = #eventEndDate#
|
,EVENT_END_DATE = #eventEndDate#
|
||||||
</isNotEmpty>
|
</isNotEmpty>
|
||||||
|
<isNotEmpty property="eventStatus">
|
||||||
, EVENT_STATUS = #eventStatus#
|
, EVENT_STATUS = #eventStatus#
|
||||||
|
</isNotEmpty>
|
||||||
, LAST_UPDT_PNTTM = NOW()
|
, LAST_UPDT_PNTTM = NOW()
|
||||||
WHERE MBER_ID = #mberId#
|
WHERE MBER_ID = #mberId#
|
||||||
AND EVENT_INFO_ID = #eventInfoId#
|
AND EVENT_INFO_ID = #eventInfoId#
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user