--- 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
... | ... | @@ -759,8 +759,10 @@ |
| 759 | 759 |
// 최적의 메시지 리스트에 추가 |
| 760 | 760 |
if (sum + floatEachPrice <= targetCash) {
|
| 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 생성 |
|
| 773 |
+ // 이벤트 잔액 처리하는 매소드 terminateEvent |
|
| 772 | 774 |
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 |
- // 결과 반환 |
|
| 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 |
/** |
... | ... | @@ -836,9 +835,14 @@ |
| 836 | 835 |
// 이벤트 상태를 종료로 변경 |
| 837 | 836 |
MjonEventVO returnEventMberInfo = new MjonEventVO(); |
| 838 | 837 |
returnEventMberInfo.setEventInfoId(eventMberInfo.getEventInfoId()); |
| 839 |
- returnEventMberInfo.setEventStatus("E");
|
|
| 838 |
+ returnEventMberInfo.setMberId(eventMberInfo.getMberId()); |
|
| 840 | 839 |
returnEventMberInfo.setEventRemainCash(targetCash); |
| 841 |
- returnEventMberInfo.setEventMemo("발송 최소 금액("+ MIN_EVENT_REMAIN_CASH +") 부족 혹은 이벤트 종료일 초과되어 이벤트 종료 시킴");
|
|
| 840 |
+ returnEventMberInfo.setEventStatus("Y");
|
|
| 841 |
+ |
|
| 842 |
+ if (targetCash < MIN_EVENT_REMAIN_CASH) {
|
|
| 843 |
+ returnEventMberInfo.setEventStatus("E");
|
|
| 844 |
+ returnEventMberInfo.setEventMemo("발송 최소 금액("+ MIN_EVENT_REMAIN_CASH +") 부족 혹은 이벤트 종료일 초과되어 이벤트 종료 시킴");
|
|
| 845 |
+ } |
|
| 842 | 846 |
return returnEventMberInfo; |
| 843 | 847 |
} |
| 844 | 848 |
|
--- src/main/java/itn/let/mjo/mjocommon/MjonCommon.java
+++ src/main/java/itn/let/mjo/mjocommon/MjonCommon.java
... | ... | @@ -629,6 +629,7 @@ |
| 629 | 629 |
return statusResponse; // 이벤트 상태가 종료이거나 endDate가 없는 경우 처리하지 않음 |
| 630 | 630 |
} |
| 631 | 631 |
log.info(" + 이벤트 진행 대상자 :: [{}]", userId);
|
| 632 |
+ log.info(" + 이벤트 진행 대상자 eventMberInfo.getMberId() :: [{}]", eventMberInfo.getMberId());
|
|
| 632 | 633 |
|
| 633 | 634 |
// 최적화된 메시지 리스트 및 이벤트 정보 가져오기 |
| 634 | 635 |
OptimalMsgResultDTO result = MsgSendUtils.getOptimalMsgList(eventMberInfo, mjonMsgSendVOList); |
... | ... | @@ -642,8 +643,7 @@ |
| 642 | 643 |
} |
| 643 | 644 |
|
| 644 | 645 |
// 이벤트 상태 종료 시 업데이트 |
| 645 |
- if (returnEventMberInfo != null && "E".equals(returnEventMberInfo.getEventStatus())) {
|
|
| 646 |
- returnEventMberInfo.setMberId(userId); |
|
| 646 |
+ if (returnEventMberInfo != null) {
|
|
| 647 | 647 |
mjonEventService.updateEventEndStatus(returnEventMberInfo); |
| 648 | 648 |
} |
| 649 | 649 |
|
--- src/main/java/itn/let/mjo/msgdata/service/impl/MjonMsgDataServiceImpl.java
+++ src/main/java/itn/let/mjo/msgdata/service/impl/MjonMsgDataServiceImpl.java
... | ... | @@ -4125,12 +4125,13 @@ |
| 4125 | 4125 |
Map<String, List<MjonMsgSendVO>> priceGroupedMessages = mjonMsgSendVOList.stream() |
| 4126 | 4126 |
.collect(Collectors.groupingBy(MjonMsgSendVO::getEachPrice)); |
| 4127 | 4127 |
|
| 4128 |
+ // instTotalCnt : 화면에서 보여줄 총 발송건수 |
|
| 4128 | 4129 |
int instTotalCnt = 0; |
| 4129 | 4130 |
// Step 2: 그룹화 된 데이터를 그룹별로 insert 처리 |
| 4130 | 4131 |
for (Map.Entry<String, List<MjonMsgSendVO>> entry : priceGroupedMessages.entrySet()) {
|
| 4131 | 4132 |
String price = entry.getKey(); // 가격 (String) |
| 4132 | 4133 |
List<MjonMsgSendVO> groupedMsgList = entry.getValue(); // 해당 가격의 메시지 리스트 |
| 4133 |
- |
|
| 4134 |
+ |
|
| 4134 | 4135 |
// msgGroupId 생성 |
| 4135 | 4136 |
String nextMsgGroupId = idgenMjonMsgGroupId.getNextStringId(); |
| 4136 | 4137 |
groupedMsgList.forEach(t -> t.setMsgGroupId(nextMsgGroupId)); |
... | ... | @@ -4139,12 +4140,17 @@ |
| 4139 | 4140 |
int instCnt = this.insertMsgData_advc(groupedMsgList); |
| 4140 | 4141 |
|
| 4141 | 4142 |
if (instCnt > 0) {
|
| 4143 |
+ |
|
| 4142 | 4144 |
instTotalCnt += instCnt; |
| 4143 | 4145 |
this.insertMsgGroupDataTb_advc(instCnt, mjonMsgVO, groupedMsgList); |
| 4144 | 4146 |
|
| 4145 | 4147 |
// 금액 및 포인트 insert |
| 4146 |
- priceAndPoint.insertCashAndPoint(userId, -Float.parseFloat(mjonMsgVO.getTotPrice()), |
|
| 4147 |
- "SMS 문자 총 " + groupedMsgList.size() + "건 중 " + instCnt + "건 발송", mjonMsgVO.getMsgGroupId()); |
|
| 4148 |
+ priceAndPoint.insertCashAndPoint( |
|
| 4149 |
+ userId |
|
| 4150 |
+ , -Float.parseFloat(mjonMsgVO.getTotPrice()), |
|
| 4151 |
+ "SMS 문자 총 " + groupedMsgList.size() + "건 중 " + instCnt + "건 발송" |
|
| 4152 |
+ , mjonMsgVO.getMsgGroupId() |
|
| 4153 |
+ ); |
|
| 4148 | 4154 |
// spam 문자 저장 |
| 4149 | 4155 |
handleSpamMsg_advc(mjonMsgVO, groupedMsgList.get(0)); |
| 4150 | 4156 |
} |
... | ... | @@ -4167,7 +4173,6 @@ |
| 4167 | 4173 |
|
| 4168 | 4174 |
// TEST발송 시 발송 후 캐시가 있어야함. |
| 4169 | 4175 |
returnMap.put("afterCash", priceAndPoint.getBefCash(userId));
|
| 4170 |
- log.debug("총 단가 합계: [{}]", mjonMsgVO.getTotPrice());
|
|
| 4171 | 4176 |
// |
| 4172 | 4177 |
|
| 4173 | 4178 |
boolean isNotified = mjonCommon.processUserAndCheckSms(mjonMsgVO, userId); |
... | ... | @@ -4203,46 +4208,11 @@ |
| 4203 | 4208 |
// 개별단가 |
| 4204 | 4209 |
mjonMsgVO.setEachPrice(mjonMsgSendVO.getEachPrice()); |
| 4205 | 4210 |
|
| 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 |
- } |
|
| 4211 |
+ mjonMsgVO.setEventYn(mjonMsgSendVO.getEventYn()); |
|
| 4212 |
+ |
|
| 4213 |
+ // event Chk |
|
| 4214 |
+// String eventYn = getEventYn(mjonMsgSendVO.getUserId(), mjonMsgSendVO.getEachPrice()); |
|
| 4215 |
+// mjonMsgVO.setEventYn(eventYn); |
|
| 4246 | 4216 |
|
| 4247 | 4217 |
|
| 4248 | 4218 |
// 전송사 코드 번호를 셋팅해 준다. |
... | ... | @@ -4264,6 +4234,52 @@ |
| 4264 | 4234 |
|
| 4265 | 4235 |
} |
| 4266 | 4236 |
|
| 4237 |
+ private String getEventYn(String p_userId, String p_eachPrice) throws Exception {
|
|
| 4238 |
+ |
|
| 4239 |
+ String returnValue="N"; |
|
| 4240 |
+ |
|
| 4241 |
+ //이벤트 회원인 경우 이벤트 캐시도 함께 차감. |
|
| 4242 |
+ MjonEventVO mjonEventVO = new MjonEventVO(); |
|
| 4243 |
+ mjonEventVO.setMberId(p_userId); |
|
| 4244 |
+ |
|
| 4245 |
+ // 이벤트 멤버 정보를 조회 |
|
| 4246 |
+ MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo(mjonEventVO); |
|
| 4247 |
+ |
|
| 4248 |
+ // mjonMsgSendVO에서 EachPrice 값을 가져와 BigDecimal로 변환하고, 불필요한 소수점 0 제거 |
|
| 4249 |
+ BigDecimal eachPrice = new BigDecimal(p_eachPrice).stripTrailingZeros(); |
|
| 4250 |
+ |
|
| 4251 |
+ if(eventMberInfo != null) {
|
|
| 4252 |
+ |
|
| 4253 |
+ // eventMberInfo에서 각 가격 값을 가져와 BigDecimal로 변환하고, 불필요한 소수점 0 제거 |
|
| 4254 |
+ BigDecimal eventShortPrice = new BigDecimal(eventMberInfo.getEventShortPrice()).stripTrailingZeros(); |
|
| 4255 |
+ BigDecimal eventLongPrice = new BigDecimal(eventMberInfo.getEventLongPrice()).stripTrailingZeros(); |
|
| 4256 |
+ BigDecimal eventPicturePrice = new BigDecimal(eventMberInfo.getEventPicturePrice()).stripTrailingZeros(); |
|
| 4257 |
+ BigDecimal eventPicture2Price = new BigDecimal(eventMberInfo.getEventPicture2Price()).stripTrailingZeros(); |
|
| 4258 |
+ BigDecimal eventPicture3Price = new BigDecimal(eventMberInfo.getEventPicture3Price()).stripTrailingZeros(); |
|
| 4259 |
+ |
|
| 4260 |
+// log.info(" + eventShortPrice :: [{}]", eventShortPrice);
|
|
| 4261 |
+// log.info(" + eventLongPrice :: [{}]", eventLongPrice);
|
|
| 4262 |
+// log.info(" + eventPicturePrice :: [{}]", eventPicturePrice);
|
|
| 4263 |
+// log.info(" + eventPicture2Price :: [{}]", eventPicture2Price);
|
|
| 4264 |
+// log.info(" + eventPicture3Price :: [{}]", eventPicture3Price);
|
|
| 4265 |
+ |
|
| 4266 |
+// log.info(" + eachPrice :: [{}]", eachPrice);
|
|
| 4267 |
+ |
|
| 4268 |
+ // 각 가격과 비교 (stripTrailingZeros() 적용으로 7.50과 7.5를 같은 값으로 인식) |
|
| 4269 |
+ if (eachPrice.compareTo(eventShortPrice) == 0 || |
|
| 4270 |
+ eachPrice.compareTo(eventLongPrice) == 0 || |
|
| 4271 |
+ eachPrice.compareTo(eventPicturePrice) == 0 || |
|
| 4272 |
+ eachPrice.compareTo(eventPicture2Price) == 0 || |
|
| 4273 |
+ eachPrice.compareTo(eventPicture3Price) == 0) {
|
|
| 4274 |
+ |
|
| 4275 |
+ returnValue = "Y"; // 매칭되는 가격이 있으면 이벤트 여부를 'Y'로 설정 |
|
| 4276 |
+ } |
|
| 4277 |
+ } |
|
| 4278 |
+ |
|
| 4279 |
+// log.info(" + getEventYn returnValue :: [{}]", returnValue);
|
|
| 4280 |
+ return returnValue; |
|
| 4281 |
+ } |
|
| 4282 |
+ |
|
| 4267 | 4283 |
private int insertMsgData_advc(List<MjonMsgSendVO> mjonMsgSendVOList) {
|
| 4268 | 4284 |
|
| 4269 | 4285 |
// 시작 시간 측정 |
--- 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?