Merge branch '4942_문자발송금액누락오류' into 4891_발송결과_속도개선
@e9891f36246ce3ee5dda6ca56274b1311d4f9020
--- src/main/java/itn/com/cmm/MjonMsgSendVO.java
+++ src/main/java/itn/com/cmm/MjonMsgSendVO.java
... | ... | @@ -110,9 +110,9 @@ |
| 110 | 110 |
|
| 111 | 111 |
|
| 112 | 112 |
/** |
| 113 |
- * @description : event 여부 / group tb에 넣는 용도 |
|
| 113 |
+ * @description : event 여부 / group tb에 넣는 용도 / 기본값 N |
|
| 114 | 114 |
*/ |
| 115 |
- private String eventYn; |
|
| 115 |
+ private String eventYn="N"; |
|
| 116 | 116 |
|
| 117 | 117 |
|
| 118 | 118 |
|
--- src/main/java/itn/com/cmm/util/MsgSendUtils.java
+++ src/main/java/itn/com/cmm/util/MsgSendUtils.java
... | ... | @@ -726,11 +726,11 @@ |
| 726 | 726 |
} |
| 727 | 727 |
|
| 728 | 728 |
// 이벤트 잔액과 종료 조건 확인 |
| 729 |
- double targetCash = eventMberInfo.getEventRemainCash(); |
|
| 729 |
+ double remainCash = eventMberInfo.getEventRemainCash(); |
|
| 730 | 730 |
String eventEndDate = eventMberInfo.getEventEndDate(); |
| 731 | 731 |
|
| 732 |
- if (isEventExpired(targetCash, eventEndDate)) {
|
|
| 733 |
- MjonEventVO returnEventMberInfo = terminateEvent(eventMberInfo, targetCash); |
|
| 732 |
+ if (isEventExpired(remainCash, eventEndDate)) {
|
|
| 733 |
+ MjonEventVO returnEventMberInfo = terminateEvent(eventMberInfo, remainCash); |
|
| 734 | 734 |
return OptimalMsgResultDTO.builder() |
| 735 | 735 |
.optimalMsgList(optimalList) |
| 736 | 736 |
.eventInfo(returnEventMberInfo) |
... | ... | @@ -757,10 +757,12 @@ |
| 757 | 757 |
float floatEachPrice = Float.parseFloat(eachPrice); |
| 758 | 758 |
|
| 759 | 759 |
// 최적의 메시지 리스트에 추가 |
| 760 |
- if (sum + floatEachPrice <= targetCash) {
|
|
| 760 |
+ if (sum + floatEachPrice <= remainCash) {
|
|
| 761 | 761 |
sum += floatEachPrice; |
| 762 |
+ |
|
| 762 | 763 |
msg.setEachPrice(eachPrice); |
| 763 | 764 |
msg.setEventYn("Y");
|
| 765 |
+ |
|
| 764 | 766 |
optimalList.add(msg); |
| 765 | 767 |
iterator.remove(); |
| 766 | 768 |
} else {
|
... | ... | @@ -768,22 +770,19 @@ |
| 768 | 770 |
} |
| 769 | 771 |
} |
| 770 | 772 |
|
| 771 |
- // 잔액 부족 시 이벤트 종료 처리하는 VO 생성 |
|
| 772 |
- double remainAmt = targetCash - sum; |
|
| 773 |
- log.info("remainAmt :: [{}]", remainAmt);
|
|
| 774 |
- if (remainAmt < MIN_EVENT_REMAIN_CASH) {
|
|
| 775 |
- MjonEventVO returnEventMberInfo = terminateEvent(eventMberInfo, remainAmt); |
|
| 776 |
- return OptimalMsgResultDTO.builder() |
|
| 777 |
- .optimalMsgList(optimalList) |
|
| 778 |
- .eventInfo(returnEventMberInfo) |
|
| 779 |
- .build(); |
|
| 780 |
- } |
|
| 781 |
- |
|
| 782 |
- // 결과 반환 |
|
| 773 |
+ // 이벤트 잔액 처리하는 매소드 terminateEvent |
|
| 774 |
+// double remainAmt = targetCash - sum; |
|
| 775 |
+// MjonEventVO returnEventMberInfo = terminateEvent(eventMberInfo, remainAmt); |
|
| 783 | 776 |
return OptimalMsgResultDTO.builder() |
| 784 | 777 |
.optimalMsgList(optimalList) |
| 785 |
- .eventInfo(null) |
|
| 778 |
+// .eventInfo(returnEventMberInfo) |
|
| 786 | 779 |
.build(); |
| 780 |
+ |
|
| 781 |
+ // 결과 반환 |
|
| 782 |
+// return OptimalMsgResultDTO.builder() |
|
| 783 |
+// .optimalMsgList(optimalList) |
|
| 784 |
+// .eventInfo(null) |
|
| 785 |
+// .build(); |
|
| 787 | 786 |
} |
| 788 | 787 |
|
| 789 | 788 |
/** |
... | ... | @@ -827,18 +826,23 @@ |
| 827 | 826 |
* @date : 2024.11.26 |
| 828 | 827 |
* @description : 이벤트 종료 VO 생성 |
| 829 | 828 |
* @param eventMberInfo |
| 830 |
- * @param targetCash |
|
| 829 |
+ * @param remainCash |
|
| 831 | 830 |
* @return |
| 832 | 831 |
*/ |
| 833 |
- private static MjonEventVO terminateEvent(MjonEventVO eventMberInfo, double targetCash) {
|
|
| 832 |
+ public static MjonEventVO terminateEvent(MjonEventVO eventMberInfo, double remainCash) {
|
|
| 834 | 833 |
// TODO Auto-generated method stub |
| 835 | 834 |
|
| 836 | 835 |
// 이벤트 상태를 종료로 변경 |
| 837 | 836 |
MjonEventVO returnEventMberInfo = new MjonEventVO(); |
| 838 | 837 |
returnEventMberInfo.setEventInfoId(eventMberInfo.getEventInfoId()); |
| 839 |
- returnEventMberInfo.setEventStatus("E");
|
|
| 840 |
- returnEventMberInfo.setEventRemainCash(targetCash); |
|
| 841 |
- returnEventMberInfo.setEventMemo("발송 최소 금액("+ MIN_EVENT_REMAIN_CASH +") 부족 혹은 이벤트 종료일 초과되어 이벤트 종료 시킴");
|
|
| 838 |
+ returnEventMberInfo.setMberId(eventMberInfo.getMberId()); |
|
| 839 |
+ returnEventMberInfo.setEventRemainCash(remainCash); |
|
| 840 |
+ returnEventMberInfo.setEventStatus("Y");
|
|
| 841 |
+ |
|
| 842 |
+ if (remainCash < MIN_EVENT_REMAIN_CASH) {
|
|
| 843 |
+ returnEventMberInfo.setEventStatus("E");
|
|
| 844 |
+ returnEventMberInfo.setEventMemo("발송 최소 금액("+ MIN_EVENT_REMAIN_CASH +") 부족 혹은 이벤트 종료일 초과되어 이벤트 종료 시킴");
|
|
| 845 |
+ } |
|
| 842 | 846 |
return returnEventMberInfo; |
| 843 | 847 |
} |
| 844 | 848 |
|
... | ... | @@ -961,13 +965,25 @@ |
| 961 | 965 |
return mmsTitleTemp; |
| 962 | 966 |
} |
| 963 | 967 |
|
| 968 |
+ /** |
|
| 969 |
+ * @methodName : eventYN |
|
| 970 |
+ * @author : 이호영 |
|
| 971 |
+ * @date : 2025.02.10 |
|
| 972 |
+ * @description : 이벤트 확인 |
|
| 973 |
+ * @param eventMberInfo |
|
| 974 |
+ * @return |
|
| 975 |
+ */ |
|
| 976 |
+ public static Boolean isNotEvent(MjonEventVO eventMberInfo) {
|
|
| 977 |
+ |
|
| 964 | 978 |
|
| 965 |
- |
|
| 966 |
- |
|
| 967 |
- |
|
| 968 |
- |
|
| 969 |
- |
|
| 970 |
- |
|
| 979 |
+ if (eventMberInfo == null |
|
| 980 |
+ || "E".equals(eventMberInfo.getEventStatus()) |
|
| 981 |
+ || org.apache.commons.lang3.StringUtils.isEmpty(eventMberInfo.getEventEndDate()) |
|
| 982 |
+ ) {
|
|
| 983 |
+ return true; |
|
| 984 |
+ } |
|
| 985 |
+ return false; |
|
| 986 |
+ } |
|
| 971 | 987 |
|
| 972 | 988 |
|
| 973 | 989 |
|
--- src/main/java/itn/let/mjo/mjocommon/MjonCommon.java
+++ src/main/java/itn/let/mjo/mjocommon/MjonCommon.java
... | ... | @@ -616,19 +616,17 @@ |
| 616 | 616 |
|
| 617 | 617 |
// 이벤트 메시지 처리 |
| 618 | 618 |
public StatusResponse processEventMessages(String userId, MjonMsgVO mjonMsgVO, |
| 619 |
- List<MjonMsgSendVO> mjonMsgSendVOList) throws Exception {
|
|
| 619 |
+ List<MjonMsgSendVO> mjonMsgSendVOList, MjonEventVO eventMberInfo) throws Exception {
|
|
| 620 |
+ |
|
| 620 | 621 |
StatusResponse statusResponse = new StatusResponse(); |
| 621 | 622 |
|
| 622 | 623 |
try {
|
| 623 |
- // 이벤트 정보 가져오기 |
|
| 624 |
- MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo_advc(userId); |
|
| 625 |
- if (eventMberInfo == null |
|
| 626 |
- || "E".equals(eventMberInfo.getEventStatus()) |
|
| 627 |
- || org.apache.commons.lang3.StringUtils.isEmpty(eventMberInfo.getEventEndDate()) |
|
| 628 |
- ) {
|
|
| 624 |
+ // 이벤트 여부 확인 |
|
| 625 |
+ if (MsgSendUtils.isNotEvent(eventMberInfo)) {
|
|
| 629 | 626 |
return statusResponse; // 이벤트 상태가 종료이거나 endDate가 없는 경우 처리하지 않음 |
| 630 | 627 |
} |
| 631 | 628 |
log.info(" + 이벤트 진행 대상자 :: [{}]", userId);
|
| 629 |
+ log.info(" + 이벤트 진행 대상자 eventMberInfo.getMberId() :: [{}]", eventMberInfo.getMberId());
|
|
| 632 | 630 |
|
| 633 | 631 |
// 최적화된 메시지 리스트 및 이벤트 정보 가져오기 |
| 634 | 632 |
OptimalMsgResultDTO result = MsgSendUtils.getOptimalMsgList(eventMberInfo, mjonMsgSendVOList); |
... | ... | @@ -641,11 +639,8 @@ |
| 641 | 639 |
mjonMsgSendVOList.addAll(optimalMsgList); // 기존 리스트와 병합 |
| 642 | 640 |
} |
| 643 | 641 |
|
| 644 |
- // 이벤트 상태 종료 시 업데이트 |
|
| 645 |
- if (returnEventMberInfo != null && "E".equals(returnEventMberInfo.getEventStatus())) {
|
|
| 646 |
- returnEventMberInfo.setMberId(userId); |
|
| 647 |
- mjonEventService.updateEventEndStatus(returnEventMberInfo); |
|
| 648 |
- } |
|
| 642 |
+ // 이벤트 관련 데이터가 있으면 updqte |
|
| 643 |
+ eventChkAndInsertAmount(returnEventMberInfo); |
|
| 649 | 644 |
|
| 650 | 645 |
} catch (IllegalArgumentException e) {
|
| 651 | 646 |
|
... | ... | @@ -656,5 +651,60 @@ |
| 656 | 651 |
|
| 657 | 652 |
return statusResponse; |
| 658 | 653 |
} |
| 654 |
+ |
|
| 655 |
+ |
|
| 656 |
+ /** |
|
| 657 |
+ * @methodName : checkEventAndDeductAmount |
|
| 658 |
+ * @author : 이호영 |
|
| 659 |
+ * @date : 2025.02.10 |
|
| 660 |
+ * @description : |
|
| 661 |
+ * @param eventMberInfo |
|
| 662 |
+ * @param eachPrice |
|
| 663 |
+ * @throws Exception |
|
| 664 |
+ */ |
|
| 665 |
+ public void checkEventAndDeductAmount(MjonEventVO eventMberInfo, List<MjonMsgSendVO> groupedMsgList) throws Exception {
|
|
| 666 |
+ |
|
| 667 |
+ // 이벤트 그룹인지 확인 |
|
| 668 |
+ if("Y".equals(groupedMsgList.get(0).getEventYn())) {
|
|
| 669 |
+ // 이벤트 남은 금액 |
|
| 670 |
+ double remainCash = eventMberInfo.getEventRemainCash(); |
|
| 671 |
+ // 현재 그룹에서 발송한 총 금액 |
|
| 672 |
+ float sendTotalPrice = MsgSendUtils.setPriceforVO(groupedMsgList); |
|
| 673 |
+ |
|
| 674 |
+ // 이벤트 남은 금액에서 현재 그룹에 총 발송금액 차감 |
|
| 675 |
+ remainCash -= sendTotalPrice; |
|
| 676 |
+ |
|
| 677 |
+ MjonEventVO returnEventMberInfo = returnEventMberInfo = MsgSendUtils.terminateEvent(eventMberInfo, remainCash); |
|
| 678 |
+ |
|
| 679 |
+ eventChkAndInsertAmount(returnEventMberInfo); |
|
| 680 |
+ } |
|
| 681 |
+ |
|
| 682 |
+ } |
|
| 683 |
+ |
|
| 684 |
+ |
|
| 685 |
+ /** |
|
| 686 |
+ * @methodName : eventChkAndInsertAmount |
|
| 687 |
+ * @author : 이호영 |
|
| 688 |
+ * @date : 2025.02.10 |
|
| 689 |
+ * @description : 이벤트 관련 데이터가 있으면 update |
|
| 690 |
+ * @param returnEventMberInfo |
|
| 691 |
+ * @throws Exception |
|
| 692 |
+ */ |
|
| 693 |
+ private void eventChkAndInsertAmount(MjonEventVO returnEventMberInfo) throws Exception {
|
|
| 694 |
+ // 이벤트 상태 종료 시 업데이트 |
|
| 695 |
+ if (returnEventMberInfo != null) {
|
|
| 696 |
+ mjonEventService.updateEventEndStatus(returnEventMberInfo); |
|
| 697 |
+ } |
|
| 698 |
+ } |
|
| 699 |
+ |
|
| 700 |
+ |
|
| 701 |
+ |
|
| 702 |
+ |
|
| 703 |
+ |
|
| 704 |
+ |
|
| 705 |
+ |
|
| 706 |
+ |
|
| 707 |
+ |
|
| 708 |
+ |
|
| 659 | 709 |
|
| 660 | 710 |
} |
--- src/main/java/itn/let/mjo/msgdata/service/impl/MjonMsgDataServiceImpl.java
+++ src/main/java/itn/let/mjo/msgdata/service/impl/MjonMsgDataServiceImpl.java
... | ... | @@ -4100,18 +4100,25 @@ |
| 4100 | 4100 |
mjonMsgSendVOList.get(i).setMsgId(idList.get(i)); |
| 4101 | 4101 |
} |
| 4102 | 4102 |
|
| 4103 |
+ |
|
| 4104 |
+ |
|
| 4105 |
+ // 이벤트 정보 가져오기 |
|
| 4106 |
+ MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo_advc(userId); |
|
| 4103 | 4107 |
/* |
| 4104 | 4108 |
* 이벤트 영역 이벤트 정보 가져오기 이벤트 상태가 "E"가 아닌 경우에만 호출 이벤트 금액이 있을 시 발송 LIST에서 => |
| 4105 | 4109 |
* optimalMsgList로 데이터 이동 이동하면서 이벤트 금액으로 설정 |
| 4106 | 4110 |
*/ |
| 4107 | 4111 |
// mjonCommon 호출 |
| 4108 |
- statusResponse = mjonCommon.processEventMessages(userId, mjonMsgVO, mjonMsgSendVOList); |
|
| 4112 |
+ statusResponse = mjonCommon.processEventMessages(userId, mjonMsgVO, mjonMsgSendVOList, eventMberInfo); |
|
| 4109 | 4113 |
if (statusResponse.getStatus() != null && !statusResponse.getStatus().equals(HttpStatus.OK)) {
|
| 4110 | 4114 |
log.error("이벤트 처리 중 오류 발생: {}", statusResponse.getMessage());
|
| 4111 | 4115 |
return statusResponse; |
| 4112 | 4116 |
} |
| 4113 | 4117 |
|
| 4114 |
- if (!isCashSufficient(mjonMsgVO)) {
|
|
| 4118 |
+ /* |
|
| 4119 |
+ * @ 금액체크 |
|
| 4120 |
+ * */ |
|
| 4121 |
+ if (!isCashSufficient(mjonMsgVO, mjonMsgSendVOList)) {
|
|
| 4115 | 4122 |
log.error("Insufficient balance for message sending.");
|
| 4116 | 4123 |
return new StatusResponse(HttpStatus.BAD_REQUEST, "문자 발송에 필요한 보유 잔액이 부족 합니다."); |
| 4117 | 4124 |
} |
... | ... | @@ -4125,12 +4132,13 @@ |
| 4125 | 4132 |
Map<String, List<MjonMsgSendVO>> priceGroupedMessages = mjonMsgSendVOList.stream() |
| 4126 | 4133 |
.collect(Collectors.groupingBy(MjonMsgSendVO::getEachPrice)); |
| 4127 | 4134 |
|
| 4135 |
+ // instTotalCnt : 화면에서 보여줄 총 발송건수 |
|
| 4128 | 4136 |
int instTotalCnt = 0; |
| 4129 | 4137 |
// Step 2: 그룹화 된 데이터를 그룹별로 insert 처리 |
| 4130 | 4138 |
for (Map.Entry<String, List<MjonMsgSendVO>> entry : priceGroupedMessages.entrySet()) {
|
| 4131 | 4139 |
String price = entry.getKey(); // 가격 (String) |
| 4132 | 4140 |
List<MjonMsgSendVO> groupedMsgList = entry.getValue(); // 해당 가격의 메시지 리스트 |
| 4133 |
- |
|
| 4141 |
+ |
|
| 4134 | 4142 |
// msgGroupId 생성 |
| 4135 | 4143 |
String nextMsgGroupId = idgenMjonMsgGroupId.getNextStringId(); |
| 4136 | 4144 |
groupedMsgList.forEach(t -> t.setMsgGroupId(nextMsgGroupId)); |
... | ... | @@ -4139,12 +4147,23 @@ |
| 4139 | 4147 |
int instCnt = this.insertMsgData_advc(groupedMsgList); |
| 4140 | 4148 |
|
| 4141 | 4149 |
if (instCnt > 0) {
|
| 4150 |
+ |
|
| 4142 | 4151 |
instTotalCnt += instCnt; |
| 4143 | 4152 |
this.insertMsgGroupDataTb_advc(instCnt, mjonMsgVO, groupedMsgList); |
| 4144 | 4153 |
|
| 4145 | 4154 |
// 금액 및 포인트 insert |
| 4146 |
- priceAndPoint.insertCashAndPoint(userId, -Float.parseFloat(mjonMsgVO.getTotPrice()), |
|
| 4147 |
- "SMS 문자 총 " + groupedMsgList.size() + "건 중 " + instCnt + "건 발송", mjonMsgVO.getMsgGroupId()); |
|
| 4155 |
+ priceAndPoint.insertCashAndPoint( |
|
| 4156 |
+ userId |
|
| 4157 |
+ , -Float.parseFloat(mjonMsgVO.getTotPrice()), |
|
| 4158 |
+ "SMS 문자 총 " + groupedMsgList.size() + "건 중 " + instCnt + "건 발송" |
|
| 4159 |
+ , mjonMsgVO.getMsgGroupId() |
|
| 4160 |
+ ); |
|
| 4161 |
+ |
|
| 4162 |
+ // event chk |
|
| 4163 |
+ if (!MsgSendUtils.isNotEvent(eventMberInfo)) {
|
|
| 4164 |
+ mjonCommon.checkEventAndDeductAmount(eventMberInfo, groupedMsgList); |
|
| 4165 |
+ } |
|
| 4166 |
+ |
|
| 4148 | 4167 |
// spam 문자 저장 |
| 4149 | 4168 |
handleSpamMsg_advc(mjonMsgVO, groupedMsgList.get(0)); |
| 4150 | 4169 |
} |
... | ... | @@ -4167,7 +4186,6 @@ |
| 4167 | 4186 |
|
| 4168 | 4187 |
// TEST발송 시 발송 후 캐시가 있어야함. |
| 4169 | 4188 |
returnMap.put("afterCash", priceAndPoint.getBefCash(userId));
|
| 4170 |
- log.debug("총 단가 합계: [{}]", mjonMsgVO.getTotPrice());
|
|
| 4171 | 4189 |
// |
| 4172 | 4190 |
|
| 4173 | 4191 |
boolean isNotified = mjonCommon.processUserAndCheckSms(mjonMsgVO, userId); |
... | ... | @@ -4203,46 +4221,11 @@ |
| 4203 | 4221 |
// 개별단가 |
| 4204 | 4222 |
mjonMsgVO.setEachPrice(mjonMsgSendVO.getEachPrice()); |
| 4205 | 4223 |
|
| 4206 |
- //이벤트 회원인 경우 이벤트 캐시도 함께 차감. |
|
| 4207 |
- MjonEventVO mjonEventVO = new MjonEventVO(); |
|
| 4208 |
- mjonEventVO.setMberId(mjonMsgSendVO.getUserId()); |
|
| 4209 |
- MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo(mjonEventVO); |
|
| 4210 |
- |
|
| 4211 |
- String str = String.valueOf(mjonMsgSendVO.getEachPrice()); |
|
| 4212 |
- // 소수점 제거 |
|
| 4213 |
- String EachPrice = str.split("\\.")[0];
|
|
| 4214 |
- |
|
| 4215 |
- |
|
| 4216 |
- if(eventMberInfo != null) {
|
|
| 4217 |
- String eventShortPrice = String.valueOf(eventMberInfo.getEventShortPrice()); |
|
| 4218 |
- eventShortPrice = eventShortPrice.split("\\.")[0];
|
|
| 4219 |
- |
|
| 4220 |
- String eventLongPrice = String.valueOf(eventMberInfo.getEventLongPrice()); |
|
| 4221 |
- eventLongPrice = eventLongPrice.split("\\.")[0];
|
|
| 4222 |
- |
|
| 4223 |
- String eventPicturePrice = String.valueOf(eventMberInfo.getEventPicturePrice()); |
|
| 4224 |
- eventPicturePrice = eventPicturePrice.split("\\.")[0];
|
|
| 4225 |
- |
|
| 4226 |
- String eventPicture2Price = String.valueOf(eventMberInfo.getEventPicture2Price()); |
|
| 4227 |
- eventPicture2Price = eventPicture2Price.split("\\.")[0];
|
|
| 4228 |
- |
|
| 4229 |
- String eventPicture3Price = String.valueOf(eventMberInfo.getEventPicture3Price()); |
|
| 4230 |
- eventPicture3Price = eventPicture3Price.split("\\.")[0];
|
|
| 4231 |
- |
|
| 4232 |
- if(EachPrice.equals(eventShortPrice)) {
|
|
| 4233 |
- mjonMsgVO.setEventYn("Y");
|
|
| 4234 |
- }else if(EachPrice.equals(eventLongPrice)) {
|
|
| 4235 |
- mjonMsgVO.setEventYn("Y");
|
|
| 4236 |
- }else if(EachPrice.equals(eventPicturePrice)) {
|
|
| 4237 |
- mjonMsgVO.setEventYn("Y");
|
|
| 4238 |
- }else if(EachPrice.equals(eventPicture2Price)) {
|
|
| 4239 |
- mjonMsgVO.setEventYn("Y");
|
|
| 4240 |
- }else if(EachPrice.equals(eventPicture3Price)) {
|
|
| 4241 |
- mjonMsgVO.setEventYn("Y");
|
|
| 4242 |
- }else {
|
|
| 4243 |
- mjonMsgVO.setEventYn("N");
|
|
| 4244 |
- } |
|
| 4245 |
- } |
|
| 4224 |
+ mjonMsgVO.setEventYn(mjonMsgSendVO.getEventYn()); |
|
| 4225 |
+ |
|
| 4226 |
+ // event Chk |
|
| 4227 |
+// String eventYn = getEventYn(mjonMsgSendVO.getUserId(), mjonMsgSendVO.getEachPrice()); |
|
| 4228 |
+// mjonMsgVO.setEventYn(eventYn); |
|
| 4246 | 4229 |
|
| 4247 | 4230 |
|
| 4248 | 4231 |
// 전송사 코드 번호를 셋팅해 준다. |
... | ... | @@ -4460,7 +4443,7 @@ |
| 4460 | 4443 |
* |
| 4461 | 4444 |
* return statusResponse; } |
| 4462 | 4445 |
*/ |
| 4463 |
- |
|
| 4446 |
+/* |
|
| 4464 | 4447 |
private Map<String, String> fncSendMsgRtnMap(MjonMsgVO mjonMsgVO) throws Exception {
|
| 4465 | 4448 |
Map<String, String> returnMap = new HashMap<String, String>(); |
| 4466 | 4449 |
|
... | ... | @@ -4509,7 +4492,7 @@ |
| 4509 | 4492 |
returnMap.put("resultBlockSts", Integer.toString(resultBlockSts));
|
| 4510 | 4493 |
|
| 4511 | 4494 |
return returnMap; |
| 4512 |
- } |
|
| 4495 |
+ }*/ |
|
| 4513 | 4496 |
|
| 4514 | 4497 |
private void handleSpamMsg(MjonMsgVO mjonMsgVO) {
|
| 4515 | 4498 |
try {
|
... | ... | @@ -4534,7 +4517,6 @@ |
| 4534 | 4517 |
mjonSpamMsgVO.setFilePath3(mjonMsgSendVO.getFilePath3()); |
| 4535 | 4518 |
|
| 4536 | 4519 |
int resultCnt = mjonSpamMsgService.insertSpamKeyWordMsgData(mjonMsgVO); |
| 4537 |
- System.out.println("스팸 문구 발송 내용 등록: " + resultCnt);
|
|
| 4538 | 4520 |
} |
| 4539 | 4521 |
} |
| 4540 | 4522 |
|
... | ... | @@ -4601,23 +4583,24 @@ |
| 4601 | 4583 |
} |
| 4602 | 4584 |
|
| 4603 | 4585 |
// 보유 금액이 충분한지 확인하는 메서드 |
| 4604 |
- private boolean isCashSufficient(MjonMsgVO mjonMsgVO) throws Exception {
|
|
| 4586 |
+ private boolean isCashSufficient(MjonMsgVO mjonMsgVO, List<MjonMsgSendVO> mjonMsgSendVOList) throws Exception {
|
|
| 4587 |
+ |
|
| 4588 |
+ |
|
| 4605 | 4589 |
String userMoney = priceAndPoint.getBefCash(mjonMsgVO.getUserId()); |
| 4606 | 4590 |
// 쉼표 제거 |
| 4607 | 4591 |
userMoney = userMoney.replace(",", "");
|
| 4608 | 4592 |
|
| 4609 |
- String totalPrice = mjonMsgVO.getTotPrice(); |
|
| 4610 |
- // 쉼표 제거 |
|
| 4611 |
- totalPrice = totalPrice.replace(",", "");
|
|
| 4612 |
- |
|
| 4593 |
+ // 사용자 보유 금액 BigDecimal 변환 (HALF_EVEN 적용) |
|
| 4613 | 4594 |
BigDecimal befCash = new BigDecimal(userMoney).setScale(2, RoundingMode.HALF_EVEN); |
| 4614 |
- BigDecimal totMsgPrice = new BigDecimal(totalPrice).setScale(2, RoundingMode.HALF_EVEN); |
|
| 4615 | 4595 |
|
| 4616 |
-// String userMoney = priceAndPoint.getBefCash(mjonMsgVO.getUserId()); |
|
| 4617 |
-// BigDecimal befCash = new BigDecimal(userMoney).setScale(2, RoundingMode.HALF_EVEN); |
|
| 4618 |
-// BigDecimal totMsgPrice = new BigDecimal(mjonMsgVO.getTotPrice()).setScale(2, RoundingMode.HALF_EVEN); |
|
| 4596 |
+ // 총 메시지 금액 계산 (HALF_EVEN 적용) |
|
| 4597 |
+ BigDecimal totalEachPrice = mjonMsgSendVOList.stream() |
|
| 4598 |
+ .map(msg -> new BigDecimal(String.valueOf(msg.getEachPrice()))) // 변환 오류 방지 |
|
| 4599 |
+ .reduce(BigDecimal.ZERO, BigDecimal::add) |
|
| 4600 |
+ .setScale(2, RoundingMode.HALF_EVEN); // 일관성 유지 |
|
| 4619 | 4601 |
|
| 4620 |
- return befCash.compareTo(totMsgPrice) >= 0; |
|
| 4602 |
+ // 비교 수행 |
|
| 4603 |
+ return befCash.compareTo(totalEachPrice) >= 0; |
|
| 4621 | 4604 |
} |
| 4622 | 4605 |
|
| 4623 | 4606 |
/** |
... | ... | @@ -4772,7 +4755,6 @@ |
| 4772 | 4755 |
* |
| 4773 | 4756 |
* @throws Exception |
| 4774 | 4757 |
* |
| 4775 |
- */ |
|
| 4776 | 4758 |
public StatusResponse fncSendMsg(MjonMsgVO mjonMsgVO) throws Exception {
|
| 4777 | 4759 |
log.info(" :: fncSendMsg :: ");
|
| 4778 | 4760 |
|
... | ... | @@ -4823,6 +4805,7 @@ |
| 4823 | 4805 |
log.info("Message sending process completed.");
|
| 4824 | 4806 |
return new StatusResponse(HttpStatus.OK, "문자 전송이 완료되었습니다.", getReturnMap(resultSts, resultBlockSts)); |
| 4825 | 4807 |
} |
| 4808 |
+ */ |
|
| 4826 | 4809 |
|
| 4827 | 4810 |
/** |
| 4828 | 4811 |
* @param mjonMsgVO |
--- src/main/java/itn/let/module/base/PriceAndPoint.java
+++ src/main/java/itn/let/module/base/PriceAndPoint.java
... | ... | @@ -124,36 +124,6 @@ |
| 124 | 124 |
|
| 125 | 125 |
mjonPayDAO.insertCash(mjonPayVO); //캐시 |
| 126 | 126 |
mjonPayDAO.updateMemberCash(mjonPayVO); //회원정보 업데이트 |
| 127 |
- |
|
| 128 |
- //이벤트 회원인 경우 이벤트 캐시도 함께 차감. |
|
| 129 |
- MjonEventVO mjonEventVO = new MjonEventVO(); |
|
| 130 |
- mjonEventVO.setMberId(mjonPayVO.getUserId()); |
|
| 131 |
- mjonEventVO.setEventStatus("Y");
|
|
| 132 |
- MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo(mjonEventVO); |
|
| 133 |
- |
|
| 134 |
- if(eventMberInfo != null) {
|
|
| 135 |
- |
|
| 136 |
- float evntRemainCash = (float) eventMberInfo.getEventRemainCash(); |
|
| 137 |
- totPrice = (float) Math.abs(mjonPayVO.getCash()); |
|
| 138 |
- |
|
| 139 |
- float totRemainCash = evntRemainCash - totPrice; |
|
| 140 |
- mjonEventVO.setEventInfoId(eventMberInfo.getEventInfoId()); |
|
| 141 |
- |
|
| 142 |
- if(totRemainCash <= 0.0) {//차감액이 남아있지 않으면 이벤트를 종료
|
|
| 143 |
- |
|
| 144 |
- //이벤트 상태값을 종료로 변경한다. |
|
| 145 |
- mjonEventVO.setEventStatus("E");
|
|
| 146 |
- mjonEventVO.setEventRemainCash(0.0); |
|
| 147 |
- mjonEventService.updateEventEndStatus(mjonEventVO); |
|
| 148 |
- |
|
| 149 |
- }else {//이벤트 회원 캐시 차감시킴
|
|
| 150 |
- |
|
| 151 |
- mjonEventVO.setEventRemainCash(totRemainCash); |
|
| 152 |
- mjonEventService.updateEventRemainCash(mjonEventVO); |
|
| 153 |
- |
|
| 154 |
- } |
|
| 155 |
- |
|
| 156 |
- } |
|
| 157 | 127 |
|
| 158 | 128 |
} |
| 159 | 129 |
|
--- src/main/resources/egovframework/sqlmap/let/mjo/event/Event_SQL_Mysql.xml
+++ src/main/resources/egovframework/sqlmap/let/mjo/event/Event_SQL_Mysql.xml
... | ... | @@ -180,7 +180,9 @@ |
| 180 | 180 |
<isNotEmpty property="eventEndDate"> |
| 181 | 181 |
,EVENT_END_DATE = #eventEndDate# |
| 182 | 182 |
</isNotEmpty> |
| 183 |
+ <isNotEmpty property="eventStatus"> |
|
| 183 | 184 |
, EVENT_STATUS = #eventStatus# |
| 185 |
+ </isNotEmpty> |
|
| 184 | 186 |
, LAST_UPDT_PNTTM = NOW() |
| 185 | 187 |
WHERE MBER_ID = #mberId# |
| 186 | 188 |
AND EVENT_INFO_ID = #eventInfoId# |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?