--- src/main/java/itn/com/cmm/util/MsgSendUtils.java
+++ src/main/java/itn/com/cmm/util/MsgSendUtils.java
... | ... | @@ -186,12 +186,19 @@ |
| 186 | 186 |
* @author : 이호영 |
| 187 | 187 |
* @date : 2024.09.26 |
| 188 | 188 |
* @description : 배열에 데이터를 채우는 메서드 |
| 189 |
+ * 1. 치환 문자열 데이터 확인 및 문자 치환 |
|
| 190 |
+ * 2. 스팸 문자 체크 |
|
| 191 |
+ * 3. 메세지 타입 구하기 |
|
| 192 |
+ * 4. 제목 셋팅 : 타입에 따라 분기 |
|
| 193 |
+ * 5. 이미지 갯수 셋팅 |
|
| 194 |
+ * 6. 예약 및 분할에 따른 시간 설정 |
|
| 195 |
+ * 7. 전송사 코드 셋팅 |
|
| 189 | 196 |
* @param mjonMsgVO |
| 190 | 197 |
* @param lists |
| 191 | 198 |
* @param statusResponse |
| 192 | 199 |
* @param agentSendCounts |
| 193 | 200 |
* @param sendRateList |
| 194 |
- * @return |
|
| 201 |
+ * @return call by reference |
|
| 195 | 202 |
* @throws Exception |
| 196 | 203 |
*/ |
| 197 | 204 |
public static Boolean populateSendLists(MjonMsgVO mjonMsgVO, List<MjonMsgSendVO> mjonMsgSendListVO |
... | ... | @@ -208,6 +215,7 @@ |
| 208 | 215 |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
| 209 | 216 |
|
| 210 | 217 |
// ReqDate가 비어 있으면 현재 시간으로 설정, 그렇지 않으면 ReqDate로 설정 |
| 218 |
+ // 화면에서 예약문자면 예약시간을 regDate로 설정한다. |
|
| 211 | 219 |
Date baseDate; |
| 212 | 220 |
if (StringUtils.isEmpty(mjonMsgVO.getReqDate())) {
|
| 213 | 221 |
mjonMsgVO.setReqDate(sdf.format(now)); // ReqDate에 현재 시간 설정 |
... | ... | @@ -236,9 +244,11 @@ |
| 236 | 244 |
|
| 237 | 245 |
boolean hasPerformedSpamCheck = false; // 치환 문자가 없는 경우, 스팸 체크가 한 번만 수행되도록 제어 |
| 238 | 246 |
boolean hasPerformedMsgType = false; // 치환 문자가 없는 경우, 스팸 체크가 한 번만 수행되도록 제어 |
| 247 |
+ boolean hasSetSubject = false; // 치환 데이터가 아닐 때 제목 설정 플래그 |
|
| 239 | 248 |
|
| 240 | 249 |
String msgKind = mjonMsgVO.getMsgKind(); |
| 241 | 250 |
String smsTxtTemp = mjonMsgVO.getSmsTxt(); |
| 251 |
+ String mmsSubject = mjonMsgVO.getMmsSubject(); |
|
| 242 | 252 |
Boolean replaceYN = getReplaceYN(smsTxtTemp); |
| 243 | 253 |
|
| 244 | 254 |
String msgTypeResult = null; |
... | ... | @@ -307,8 +317,22 @@ |
| 307 | 317 |
sendVO.setMsgType(msgTypeResult); |
| 308 | 318 |
|
| 309 | 319 |
// 제목 셋팅 |
| 310 |
- |
|
| 311 |
- |
|
| 320 |
+ if (LONG_MSG_TYPE.equals(msgTypeResult) && (replaceYN || !hasSetSubject)) {
|
|
| 321 |
+ String mmsTitleTemp = ""; |
|
| 322 |
+ // 제목이 비어 있고 전송할 SMS 텍스트가 존재하는 경우에만 처리 |
|
| 323 |
+ if (StringUtils.isEmpty(mmsSubject) && StringUtils.isNotEmpty(smsTxt)) {
|
|
| 324 |
+ // SMS 텍스트를 줄 단위로 나누기 |
|
| 325 |
+ mmsTitleTemp = getMmsgSubject(smsTxt, msgKind); |
|
| 326 |
+ |
|
| 327 |
+ // 치환 데이터가 아닌 경우 제목 설정 완료 플래그를 true로 설정 |
|
| 328 |
+ if (!replaceYN) {
|
|
| 329 |
+ hasSetSubject = true; // 제목 설정 완료 |
|
| 330 |
+ } |
|
| 331 |
+ } |
|
| 332 |
+ |
|
| 333 |
+ // 설정된 제목을 현재 메시지 객체에 적용 |
|
| 334 |
+ sendVO.setSubject(mmsTitleTemp); |
|
| 335 |
+ } |
|
| 312 | 336 |
|
| 313 | 337 |
// 이미지 셋팅 |
| 314 | 338 |
setImagePathsForMsgSendVO(mjonMsgVO, sendVO); |
... | ... | @@ -336,16 +360,14 @@ |
| 336 | 360 |
String agentCode = "00".equals(mjonMsgVO.getAgentCode()) |
| 337 | 361 |
? MsgSendUtils.assignAgentBasedOnCount(agentSendCounts, sendRateList) |
| 338 | 362 |
: mjonMsgVO.getAgentCode(); |
| 339 |
- sendVO.setAgentCode(agentCode); |
|
| 363 |
+ sendVO.setAgentCode(agentCode); |
|
| 340 | 364 |
|
| 341 | 365 |
sendVO.setMsgGroupId(nextMsgGroupId); |
| 342 | 366 |
|
| 343 |
- |
|
| 344 |
- |
|
| 345 |
- |
|
| 346 |
- |
|
| 347 |
- |
|
| 348 | 367 |
} |
| 368 |
+ // Group TB에 넣어줄 제목 |
|
| 369 |
+ // 치환안된 sms 데이터로 넣어야함 |
|
| 370 |
+ mjonMsgVO.setMmsSubject(getMmsgSubject(smsTxtTemp, msgKind)); |
|
| 349 | 371 |
|
| 350 | 372 |
return true; |
| 351 | 373 |
|
... | ... | @@ -556,11 +578,35 @@ |
| 556 | 578 |
// 각 가격을 합산 |
| 557 | 579 |
totalPrice += Float.parseFloat(eachPrice); |
| 558 | 580 |
} |
| 559 |
- mjonMsgVO.setTotalPrice(totalPrice); |
|
| 581 |
+ mjonMsgVO.setTotPrice(String.valueOf(totalPrice)); |
|
| 560 | 582 |
|
| 561 |
-// log.debug("총 단가 합계: [{}]", totalPrice);
|
|
| 562 | 583 |
|
| 563 | 584 |
} |
| 585 |
+ |
|
| 586 |
+ |
|
| 587 |
+ /** |
|
| 588 |
+ * @methodName : setPriceforVO |
|
| 589 |
+ * @author : 이호영 |
|
| 590 |
+ * @date : 2024.12.02 |
|
| 591 |
+ * @description : total금액 구하기 |
|
| 592 |
+ * @param mjonMsgSendVOList |
|
| 593 |
+ * @return |
|
| 594 |
+ */ |
|
| 595 |
+ public static float setPriceforVO(List<MjonMsgSendVO> mjonMsgSendVOList) {
|
|
| 596 |
+ |
|
| 597 |
+ float totalPrice = 0.0f; |
|
| 598 |
+ for (MjonMsgSendVO sendVO : mjonMsgSendVOList) {
|
|
| 599 |
+ String priceStr = sendVO.getEachPrice(); |
|
| 600 |
+ if(StringUtils.isNotEmpty(priceStr)) {
|
|
| 601 |
+ totalPrice += Float.parseFloat(priceStr); |
|
| 602 |
+ } |
|
| 603 |
+ |
|
| 604 |
+ } |
|
| 605 |
+ |
|
| 606 |
+ return totalPrice; |
|
| 607 |
+ |
|
| 608 |
+ } |
|
| 609 |
+ |
|
| 564 | 610 |
|
| 565 | 611 |
/** |
| 566 | 612 |
* 이미지 파일 경로를 기준으로 적절한 가격을 반환하는 헬퍼 메소드. |
... | ... | @@ -622,11 +668,11 @@ |
| 622 | 668 |
} |
| 623 | 669 |
|
| 624 | 670 |
// 단가 설정 |
| 625 |
- float shortPrice = Float.parseFloat(eventMberInfo.getEventShortPrice()); |
|
| 626 |
- float longPrice = Float.parseFloat(eventMberInfo.getEventLongPrice()); |
|
| 627 |
- float picturePrice = Float.parseFloat(eventMberInfo.getEventPicturePrice()); |
|
| 628 |
- float picture2Price = Float.parseFloat(eventMberInfo.getEventPicture2Price()); |
|
| 629 |
- float picture3Price = Float.parseFloat(eventMberInfo.getEventPicture3Price()); |
|
| 671 |
+ float eventShortPrice = Float.parseFloat(eventMberInfo.getEventShortPrice()); |
|
| 672 |
+ float eventLongPrice = Float.parseFloat(eventMberInfo.getEventLongPrice()); |
|
| 673 |
+ float eventPicturePrice = Float.parseFloat(eventMberInfo.getEventPicturePrice()); |
|
| 674 |
+ float eventPicture2Price = Float.parseFloat(eventMberInfo.getEventPicture2Price()); |
|
| 675 |
+ float eventPicture3Price = Float.parseFloat(eventMberInfo.getEventPicture3Price()); |
|
| 630 | 676 |
|
| 631 | 677 |
// 최적의 메시지 리스트 생성 |
| 632 | 678 |
double sum = 0.0; |
... | ... | @@ -636,7 +682,7 @@ |
| 636 | 682 |
MjonMsgSendVO msg = iterator.next(); |
| 637 | 683 |
|
| 638 | 684 |
// 단가 계산 및 예외 처리 |
| 639 |
- String eachPrice = getEachPriceOrThrow(msg, shortPrice, longPrice, picturePrice, picture2Price, picture3Price); |
|
| 685 |
+ String eachPrice = getEachPriceOrThrow(msg, eventShortPrice, eventLongPrice, eventPicturePrice, eventPicture2Price, eventPicture3Price); |
|
| 640 | 686 |
|
| 641 | 687 |
float floatEachPrice = Float.parseFloat(eachPrice); |
| 642 | 688 |
|
... | ... | @@ -816,10 +862,30 @@ |
| 816 | 862 |
return sendRateList.get(0).getRepAgent(); |
| 817 | 863 |
} |
| 818 | 864 |
|
| 865 |
+ /** |
|
| 866 |
+ * @methodName : getMmsgSubject |
|
| 867 |
+ * @author : 이호영 |
|
| 868 |
+ * @date : 2024.12.02 |
|
| 869 |
+ * @description : 타이틀 생성 |
|
| 870 |
+ * @param smsTxt |
|
| 871 |
+ * @param msgKind |
|
| 872 |
+ * @return |
|
| 873 |
+ */ |
|
| 874 |
+ public static String getMmsgSubject(String smsTxt, String msgKind) {
|
|
| 875 |
+ String mmsTitleTemp = ""; |
|
| 876 |
+ // SMS 텍스트를 줄 단위로 나누기 |
|
| 877 |
+ String[] split = smsTxt.split("\n");
|
|
| 878 |
+ log.info(" : split.length :: [{}]", split.length);
|
|
| 819 | 879 |
|
| 880 |
+ if (split.length > 0) {
|
|
| 881 |
+ // "C" 메시지 종류인 경우 두 번째 줄, 그렇지 않으면 첫 번째 줄을 제목으로 설정 |
|
| 882 |
+ mmsTitleTemp = "C".equals(msgKind) && split.length > 1 ? split[1].trim() : split[0].trim(); |
|
| 820 | 883 |
|
| 821 |
- |
|
| 822 |
- |
|
| 884 |
+ // 제목 글자 수를 20자로 제한 (초과 시 잘라냄) |
|
| 885 |
+ mmsTitleTemp = mmsTitleTemp.length() > 20 ? mmsTitleTemp.substring(0, 20) : mmsTitleTemp; |
|
| 886 |
+ } |
|
| 887 |
+ return mmsTitleTemp; |
|
| 888 |
+ } |
|
| 823 | 889 |
|
| 824 | 890 |
|
| 825 | 891 |
|
--- src/main/java/itn/let/mjo/msgdata/service/impl/MjonMsgDataServiceImpl.java
+++ src/main/java/itn/let/mjo/msgdata/service/impl/MjonMsgDataServiceImpl.java
... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 |
import javax.annotation.Resource; |
| 17 | 17 |
import javax.servlet.http.HttpServletRequest; |
| 18 | 18 |
|
| 19 |
+import org.apache.commons.collections4.CollectionUtils; |
|
| 19 | 20 |
import org.apache.commons.lang3.StringUtils; |
| 20 | 21 |
import org.springframework.beans.factory.annotation.Autowired; |
| 21 | 22 |
import org.springframework.http.HttpStatus; |
... | ... | @@ -3984,16 +3985,13 @@ |
| 3984 | 3985 |
return mjonMsgDataDAO.selectPayUserSumFaxList(mjonMsgVO); |
| 3985 | 3986 |
} |
| 3986 | 3987 |
|
| 3987 |
- /* (non-Javadoc) |
|
| 3988 |
- * @see itn.let.mjo.msgdata.service.MjonMsgDataService#sendMsgData_advc(itn.let.mjo.msg.service.MjonMsgVO, javax.servlet.http.HttpServletRequest) |
|
| 3989 |
- */ |
|
| 3990 |
- /* (non-Javadoc) |
|
| 3991 |
- * @see itn.let.mjo.msgdata.service.MjonMsgDataService#sendMsgData_advc(itn.let.mjo.msg.service.MjonMsgVO, javax.servlet.http.HttpServletRequest) |
|
| 3992 |
- */ |
|
| 3993 | 3988 |
@Override |
| 3994 | 3989 |
public StatusResponse sendMsgData_advc(MjonMsgVO mjonMsgVO, HttpServletRequest request) throws Exception {
|
| 3995 | 3990 |
|
| 3996 | 3991 |
log.info(" :: sendMsgData_advc :: ");
|
| 3992 |
+ |
|
| 3993 |
+ Map<String, Object> returnMap = new HashMap<>(); |
|
| 3994 |
+ |
|
| 3997 | 3995 |
|
| 3998 | 3996 |
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null; |
| 3999 | 3997 |
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId()); |
... | ... | @@ -4044,19 +4042,19 @@ |
| 4044 | 4042 |
|
| 4045 | 4043 |
// 삭제 전 리스트 크기 저장 |
| 4046 | 4044 |
int initialSize = mjonMsgSendVOList.size(); |
| 4047 |
- |
|
| 4048 | 4045 |
// 수신목록 셋팅 |
| 4049 | 4046 |
List<String> userBlockList = mjonMsgDAO.selectUserBlockList(mjonMsgVO); |
| 4047 |
+ |
|
| 4048 |
+ |
|
| 4049 |
+ |
|
| 4050 |
+ // 리스트 초기 크기 |
|
| 4050 | 4051 |
mjonMsgSendVOList.removeIf(vo -> userBlockList.contains(vo.getPhone())); |
| 4051 |
-// log.info(" !! mjonMsgSendVOList.size() :: [{}]",mjonMsgSendVOList.size());
|
|
| 4052 | 4052 |
// 삭제 후 리스트 크기 저장 |
| 4053 | 4053 |
int finalSize = mjonMsgSendVOList.size(); |
| 4054 | 4054 |
// 삭제된 건 수 계산 |
| 4055 | 4055 |
int deletedCount = initialSize - finalSize; |
| 4056 |
- |
|
| 4057 |
- |
|
| 4058 |
- |
|
| 4059 |
- |
|
| 4056 |
+ // 수신거부 목록 |
|
| 4057 |
+ returnMap.put("resultBlockSts", deletedCount);
|
|
| 4060 | 4058 |
|
| 4061 | 4059 |
|
| 4062 | 4060 |
|
... | ... | @@ -4093,12 +4091,30 @@ |
| 4093 | 4091 |
List<String> resultSpamTxt = mjonMsgDataService.selectSpamKeywordList(); |
| 4094 | 4092 |
// msgGroupId 생성 |
| 4095 | 4093 |
String nextMsgGroupId = idgenMjonMsgGroupId.getNextStringId(); |
| 4094 |
+ |
|
| 4095 |
+ |
|
| 4096 |
+ /** |
|
| 4097 |
+ * @methodName : populateReplacementLists |
|
| 4098 |
+ * @author : 이호영 |
|
| 4099 |
+ * @date : 2024.09.26 |
|
| 4100 |
+ * @description : 배열에 데이터를 채우는 메서드 |
|
| 4101 |
+ * 1. 치환 문자열 데이터 확인 및 문자 치환 |
|
| 4102 |
+ * 2. 스팸 문자 체크 |
|
| 4103 |
+ * 3. 메세지 타입 구하기 |
|
| 4104 |
+ * 4. 제목 셋팅 : 타입에 따라 분기 |
|
| 4105 |
+ * 5. 이미지 갯수 셋팅 |
|
| 4106 |
+ * 6. 예약 및 분할에 따른 시간 설정 |
|
| 4107 |
+ * 7. 전송사 코드 셋팅 |
|
| 4108 |
+ */ |
|
| 4096 | 4109 |
if(!MsgSendUtils.populateSendLists(mjonMsgVO, mjonMsgSendVOList, statusResponse, resultSpamTxt |
| 4097 | 4110 |
, agentSendCounts, sendRateList, nextMsgGroupId)) {;
|
| 4098 | 4111 |
//문자 치환 후 전송 문자 길이를 초과하였습니다. |
| 4099 | 4112 |
//문자 치환 중 오류가 발생하였습니다. |
| 4100 | 4113 |
return statusResponse; |
| 4101 | 4114 |
} |
| 4115 |
+ |
|
| 4116 |
+ // group_data에 insert하기위해 추가 |
|
| 4117 |
+ mjonMsgVO.setReqDate(mjonMsgSendVOList.get(0).getReqDate()); |
|
| 4102 | 4118 |
|
| 4103 | 4119 |
|
| 4104 | 4120 |
//1.시스템 기본 단가 정보 불러오기 |
... | ... | @@ -4107,35 +4123,24 @@ |
| 4107 | 4123 |
MberManageVO mberManageVO = mjonMsgDataDAO.selectMberManageInfo(userId); |
| 4108 | 4124 |
MsgSendUtils.setPriceforVO(mjonMsgVO, mjonMsgSendVOList, sysJoinSetVO, mberManageVO); |
| 4109 | 4125 |
|
| 4110 |
- |
|
| 4126 |
+ |
|
| 4111 | 4127 |
|
| 4112 | 4128 |
|
| 4113 |
- |
|
| 4114 |
- /*mjonMsgSendVOList.parallelStream().forEach(t -> {
|
|
| 4115 |
- try {
|
|
| 4116 |
- t.setMsgId(idgenMsgId.getNextStringId()); |
|
| 4117 |
- } catch (FdlException e) {
|
|
| 4118 |
- log.error("MsgId 생성 중 오류 발생", e);
|
|
| 4119 |
- } |
|
| 4120 |
- });*/ |
|
| 4129 |
+ // msg_id 대량 생성 |
|
| 4121 | 4130 |
List<String> idList = idgenMsgCId.getNextStringId(mjonMsgSendVOList.size()); |
| 4122 |
-// System.out.println(" idList.size() : " + idList.size());
|
|
| 4123 |
-// System.out.println(" idList : " + idList);
|
|
| 4124 | 4131 |
for (int i = 0; i < mjonMsgSendVOList.size(); i++) {
|
| 4125 | 4132 |
mjonMsgSendVOList.get(i).setMsgId(idList.get(i)); |
| 4126 | 4133 |
} |
| 4127 | 4134 |
|
| 4128 |
-// mjonMsgSendVOList.stream().forEach(t-> System.out.print(t.toString()+"\n") ); |
|
| 4129 |
- |
|
| 4130 |
- |
|
| 4131 | 4135 |
|
| 4132 |
- // 이벤트 영역 |
|
| 4133 |
- // 이벤트 영역 |
|
| 4134 |
- |
|
| 4135 |
- // 이벤트 정보 가져오기 |
|
| 4136 |
- // 이벤트 상태가 "E"가 아닌 경우에만 호출 |
|
| 4137 |
- // 이벤트 금액이 있을 시 발송 LIST에서 => optimalMsgList로 데이터 이동 |
|
| 4138 |
- // 이동하면서 이벤트 금액으로 설정 |
|
| 4136 |
+ /* |
|
| 4137 |
+ * 이벤트 영역 |
|
| 4138 |
+ * 이벤트 정보 가져오기 |
|
| 4139 |
+ * 이벤트 상태가 "E"가 아닌 경우에만 호출 |
|
| 4140 |
+ * 이벤트 금액이 있을 시 발송 LIST에서 |
|
| 4141 |
+ * => optimalMsgList로 데이터 이동 |
|
| 4142 |
+ * 이동하면서 이벤트 금액으로 설정 |
|
| 4143 |
+ */ |
|
| 4139 | 4144 |
MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo_advc(userId); |
| 4140 | 4145 |
OptimalMsgResultDTO result = null; |
| 4141 | 4146 |
List<MjonMsgSendVO> optimalMsgList = new ArrayList<>(); |
... | ... | @@ -4145,7 +4150,18 @@ |
| 4145 | 4150 |
result = MsgSendUtils.getOptimalMsgList(eventMberInfo, mjonMsgSendVOList); |
| 4146 | 4151 |
optimalMsgList = result.getOptimalMsgList(); |
| 4147 | 4152 |
MjonEventVO returnEventMberInfo = result.getEventInfo(); |
| 4153 |
+ |
|
| 4154 |
+ // 이벤트 list에 내역에 있으면 |
|
| 4155 |
+ if(CollectionUtils.isNotEmpty(optimalMsgList)) |
|
| 4156 |
+ {
|
|
| 4157 |
+ // group tb에 이벤트 발송인지 Y 입력해야함 |
|
| 4158 |
+ mjonMsgVO.setEventYn("Y");
|
|
| 4159 |
+ // 기존 리스트로 병합 |
|
| 4160 |
+ // 따로 분기 후 병합 하는 이유는 유지보수 및 기능 분리르 위함 |
|
| 4161 |
+ mjonMsgSendVOList.addAll(optimalMsgList); |
|
| 4162 |
+ } |
|
| 4148 | 4163 |
|
| 4164 |
+ // 이벤트 금액이 끝났거나 종료상태로 전환되면 update해야함 |
|
| 4149 | 4165 |
if (returnEventMberInfo != null && "E".equals(returnEventMberInfo.getEventStatus())) {
|
| 4150 | 4166 |
returnEventMberInfo.setMberId(userId); |
| 4151 | 4167 |
mjonEventService.updateEventEndStatus(returnEventMberInfo); |
... | ... | @@ -4158,33 +4174,133 @@ |
| 4158 | 4174 |
return statusResponse; |
| 4159 | 4175 |
} |
| 4160 | 4176 |
} |
| 4161 |
- log.info(" + optimalMsgList :: [{}]", optimalMsgList.size());
|
|
| 4162 |
- |
|
| 4163 |
- |
|
| 4164 |
- |
|
| 4165 |
- |
|
| 4166 |
- |
|
| 4167 | 4177 |
|
| 4168 | 4178 |
|
| 4169 | 4179 |
System.out.println("==================== insert 시작 ====================");
|
| 4170 | 4180 |
|
| 4171 | 4181 |
|
| 4182 |
+// log.info("mj_msg_data insert start [{}]", mjonMsgSendVOList.size());
|
|
| 4183 |
+ float totalPrice = MsgSendUtils.setPriceforVO(mjonMsgSendVOList); |
|
| 4184 |
+ // 합산 금액을 String으로 변환하여 설정 |
|
| 4185 |
+ mjonMsgVO.setTotPrice(String.valueOf(totalPrice)); |
|
| 4172 | 4186 |
|
| 4173 |
- log.info("mj_msg_data insert start [{}]", mjonMsgSendVOList.size());
|
|
| 4174 | 4187 |
|
| 4175 | 4188 |
// 분할 최대건수가 되면 디비에 입력하기 |
| 4176 | 4189 |
// int instCnt = mjonMsgDataDAO.insertMsgDataInfo_advc(mjonMsgSendVOList); |
| 4177 | 4190 |
// int instCnt = mjonMsgDataDAO.insertMsgDataInfo_jdbc_advc(mjonMsgSendVOList); |
| 4178 | 4191 |
|
| 4192 |
+ // Batch 시작 시간 측정 |
|
| 4193 |
+ long insetStartTime = System.currentTimeMillis(); |
|
| 4194 |
+ // 총 발송 건수 = DB insert |
|
| 4195 |
+ int instCnt = this.insertMsgData_advc(mjonMsgSendVOList); |
|
| 4196 |
+ |
|
| 4197 |
+ // Batch 종료 시간 측정 및 실행 시간 계산 |
|
| 4198 |
+ long insetEndTime = System.currentTimeMillis(); |
|
| 4199 |
+ double insetExecutionTimeInSeconds = (insetEndTime - insetStartTime) / 1000.0; |
|
| 4200 |
+ |
|
| 4201 |
+ // 수신거부 목록 |
|
| 4202 |
+ returnMap.put("resultSts", instCnt);
|
|
| 4203 |
+ returnMap.put("msg insert seconds :: ", insetExecutionTimeInSeconds);
|
|
| 4204 |
+ |
|
| 4205 |
+ log.debug("총 단가 합계: [{}]", mjonMsgVO.getTotPrice());
|
|
| 4206 |
+ //TODO: group 테이블에 저장 |
|
| 4207 |
+ if(instCnt > 0) {
|
|
| 4208 |
+ |
|
| 4209 |
+ // Group TB insert |
|
| 4210 |
+ mjonMsgVO.setMsgGroupCnt(Integer.toString(instCnt)); |
|
| 4211 |
+ this.insertMsgGroupDataTb_advc(mjonMsgVO, mjonMsgSendVOList.get(0)); |
|
| 4212 |
+ |
|
| 4213 |
+ // 금액 및 포인트 insert |
|
| 4214 |
+// priceAndPoint.insertCashAndPoint( |
|
| 4215 |
+// userId |
|
| 4216 |
+// , -Float.parseFloat(mjonMsgVO.getTotPrice()) |
|
| 4217 |
+// , "SMS 문자 총 " + mjonMsgVO.getMjonMsgSendVOList().size() + "건 중 " + instCnt + "건 발송" |
|
| 4218 |
+// , mjonMsgVO.getMsgGroupId() |
|
| 4219 |
+// ); |
|
| 4220 |
+ } |
|
| 4221 |
+ |
|
| 4222 |
+ |
|
| 4223 |
+ |
|
| 4224 |
+ //TODO : group tb insert 후 처리 |
|
| 4225 |
+// handleSpamMsg_advc(mjonMsgVO, mjonMsgSendVOList.get(0)); |
|
| 4226 |
+ |
|
| 4227 |
+ |
|
| 4228 |
+ |
|
| 4229 |
+ /* |
|
| 4230 |
+ * // 1건 이상 발송이 있는 경우만 캐쉬를 차감 시킨다. |
|
| 4231 |
+ if (resultCnt > 0) {
|
|
| 4232 |
+ |
|
| 4233 |
+ int totSendCnt = mjonMsgVO.getTotalCallCnt(); |
|
| 4234 |
+ Float eachPrice = Float.parseFloat(mjonMsgVO.getEachPrice()); |
|
| 4235 |
+ Float totPrice = eachPrice * resultCnt; |
|
| 4236 |
+ String strTotPrice = String.format("%.1f", totPrice);
|
|
| 4237 |
+ |
|
| 4238 |
+ mjonMsgVO.setTotPrice(strTotPrice);// 현재 합산 금액 셋팅 |
|
| 4239 |
+ mjonPayVO.setCashId(idgenMjonCashId.getNextStringId()); |
|
| 4240 |
+ mjonPayVO.setUserId(mjonMsgVO.getUserId()); |
|
| 4241 |
+ mjonPayVO.setCash(-Float.parseFloat(strTotPrice)); |
|
| 4242 |
+ mjonPayVO.setFrstRegisterId(mjonMsgVO.getUserId()); |
|
| 4243 |
+ mjonPayVO.setMemo("SMS 문자 총 " + totSendCnt + "건 중 " + resultCnt + "건 발송");
|
|
| 4244 |
+ mjonPayVO.setMsgGroupId(mjonMsgVO.getMsgGroupId()); |
|
| 4245 |
+ |
|
| 4246 |
+ mjonPayService.insertCash(mjonPayVO); // 캐시차감 |
|
| 4247 |
+ mjonPayService.updateMemberCash(mjonPayVO); // 회원정보 업데이트 |
|
| 4248 |
+ } |
|
| 4249 |
+ */ |
|
| 4250 |
+ |
|
| 4251 |
+ |
|
| 4252 |
+ ////////////////////////////////// |
|
| 4253 |
+ ////////////////////////////////// |
|
| 4254 |
+ ////////////////////////////////// |
|
| 4255 |
+ |
|
| 4256 |
+ // 강제로 IllegalArgumentException 발생시키기 |
|
| 4257 |
+// if (true) {
|
|
| 4258 |
+// throw new IllegalArgumentException("강제로 발생한 오류입니다.");
|
|
| 4259 |
+// } |
|
| 4260 |
+ ////////////////////////////////// |
|
| 4261 |
+ ////////////////////////////////// |
|
| 4262 |
+ ////////////////////////////////// |
|
| 4263 |
+ |
|
| 4264 |
+ |
|
| 4265 |
+ // 발송 처리 |
|
| 4266 |
+// statusResponse = processMessageSending(mjonMsgVO, intiLists, statusResponse); |
|
| 4267 |
+// } else {
|
|
| 4268 |
+// // 일반 문자 발송 |
|
| 4269 |
+// statusResponse = fncSendMsg(mjonMsgVO); |
|
| 4270 |
+// } |
|
| 4271 |
+ statusResponse.setStatus(HttpStatus.OK); |
|
| 4272 |
+ statusResponse.setObject(returnMap); |
|
| 4273 |
+ return statusResponse; |
|
| 4274 |
+ |
|
| 4275 |
+ } |
|
| 4276 |
+ |
|
| 4277 |
+ private void insertMsgGroupDataTb_advc(MjonMsgVO mjonMsgVO, MjonMsgSendVO mjonMsgSendVO) throws Exception {
|
|
| 4278 |
+ |
|
| 4279 |
+ mjonMsgVO.setAgentCode(mjonMsgSendVO.getAgentCode());// 전송사 코드 번호를 셋팅해 준다. |
|
| 4280 |
+ // 지연 유무 코드가 Null 인경우 체크 |
|
| 4281 |
+ |
|
| 4282 |
+ mjonMsgVO.setBefCash(priceAndPoint.getBefCash(mjonMsgVO.getUserId())); |
|
| 4283 |
+ mjonMsgVO.setBefPoint(priceAndPoint.getBefPoint(mjonMsgVO.getUserId())); |
|
| 4284 |
+ |
|
| 4285 |
+ mjonMsgVO.setMsgGroupId(mjonMsgSendVO.getMsgGroupId()); |
|
| 4286 |
+ mjonMsgDAO.insertGroupMsgData(mjonMsgVO); |
|
| 4287 |
+ |
|
| 4288 |
+ } |
|
| 4289 |
+ |
|
| 4290 |
+ |
|
| 4291 |
+ private int insertMsgData_advc(List<MjonMsgSendVO> mjonMsgSendVOList) {
|
|
| 4292 |
+ |
|
| 4293 |
+ |
|
| 4179 | 4294 |
// 시작 시간 측정 |
| 4180 | 4295 |
long totalStartTime = System.currentTimeMillis(); |
| 4181 | 4296 |
|
| 4182 | 4297 |
int totalSize = mjonMsgSendVOList.size(); // 총 데이터 개수 |
| 4183 | 4298 |
int batchSize = 50000; // Batch 크기 설정 (고정값) |
| 4184 | 4299 |
|
| 4185 |
- System.out.println("총 데이터 개수 :: " + totalSize);
|
|
| 4186 |
- System.out.println("설정된 Batch 크기 :: " + batchSize);
|
|
| 4300 |
+ log.info("총 데이터 개수 :: [{}] ", totalSize);
|
|
| 4301 |
+ log.info("설정된 Batch 크기 :: [{}] ", batchSize);
|
|
| 4187 | 4302 |
|
| 4303 |
+ // 총 insert 카운트 |
|
| 4188 | 4304 |
int instCnt = 0; |
| 4189 | 4305 |
int batchCount = 0; |
| 4190 | 4306 |
|
... | ... | @@ -4197,7 +4313,7 @@ |
| 4197 | 4313 |
|
| 4198 | 4314 |
// Batch 리스트 생성 |
| 4199 | 4315 |
List<MjonMsgSendVO> batchList = mjonMsgSendVOList.subList( |
| 4200 |
- i, Math.min(i + batchSize, totalSize) |
|
| 4316 |
+ i, Math.min(i + batchSize, totalSize) |
|
| 4201 | 4317 |
); |
| 4202 | 4318 |
System.out.println("Batch 시작 인덱스: " + i);
|
| 4203 | 4319 |
|
... | ... | @@ -4221,10 +4337,10 @@ |
| 4221 | 4337 |
double totalExecutionTimeInSeconds = (totalEndTime - totalStartTime) / 1000.0; |
| 4222 | 4338 |
|
| 4223 | 4339 |
// 실행 시간 출력 |
| 4224 |
- System.out.println("총 배치 실행 횟수 :: " + batchCount);
|
|
| 4225 |
- System.out.println("batchSize :: " + batchSize);
|
|
| 4226 |
- System.out.println("총 실행 시간 :: " + totalExecutionTimeInSeconds + "초");
|
|
| 4227 |
- System.out.println("총 삽입 건수 :: " + instCnt);
|
|
| 4340 |
+ log.info("총 배치 실행 횟수 :: [{}] ", batchCount);
|
|
| 4341 |
+ log.info("batchSize :: [{}] ", batchSize);
|
|
| 4342 |
+ log.info("총 실행 시간 :: [{}] ", totalExecutionTimeInSeconds + "초");
|
|
| 4343 |
+ log.info("총 삽입 건수 :: [{}] ", instCnt);
|
|
| 4228 | 4344 |
|
| 4229 | 4345 |
// 각 배치별 실행 시간 출력 |
| 4230 | 4346 |
for (int k = 0; k < batchExecutionTimes.size(); k++) {
|
... | ... | @@ -4233,63 +4349,10 @@ |
| 4233 | 4349 |
|
| 4234 | 4350 |
|
| 4235 | 4351 |
|
| 4236 |
- // 강제로 IllegalArgumentException 발생시키기 |
|
| 4237 |
- if (true) {
|
|
| 4238 |
- throw new IllegalArgumentException("강제로 발생한 오류입니다.");
|
|
| 4239 |
- } |
|
| 4240 | 4352 |
|
| 4241 |
- |
|
| 4242 |
- |
|
| 4243 |
- |
|
| 4244 |
- |
|
| 4245 |
- |
|
| 4246 |
-// log.info(" + optimalMsgList :: [{}]", optimalMsgList.size());
|
|
| 4247 |
-// log.info(" + optimalMsgList :: [{}]", optimalMsgList.get(0).getEachPrice());
|
|
| 4248 |
-// log.info(" + mjonMsgSendVOList :: [{}]", mjonMsgSendVOList.size());
|
|
| 4249 |
-// log.info(" + mjonMsgSendVOList :: [{}]", mjonMsgSendVOList.get(0).getEachPrice());
|
|
| 4250 |
- |
|
| 4251 |
- |
|
| 4252 |
- |
|
| 4253 |
- |
|
| 4254 |
-// log.info("mjonMsgVO.getTotalPrice() :: [{}]", mjonMsgVO.getTotalPrice());
|
|
| 4255 |
- |
|
| 4256 |
-// log.info(" + userId :: [{}]", userId);
|
|
| 4257 |
-// log.info(" + priceAndPoint.getBefCash(userId) :: [{}]", priceAndPoint.getBefCash(userId));
|
|
| 4258 |
- |
|
| 4259 |
- |
|
| 4260 |
- |
|
| 4261 |
-// mjonMsgSendVOList.stream().forEach(t-> System.out.println(t.getEachPrice())); |
|
| 4262 |
-// mjonMsgSendVOList.stream().forEach(t-> System.out.println(t.toString())); |
|
| 4263 |
- |
|
| 4264 |
-// mjonMsgSendVOList.stream() |
|
| 4265 |
-// .map(MjonMsgSendVO::getSmsTxt) // 각 객체의 getSmsTxt() 호출 |
|
| 4266 |
-// .forEach(System.out::println); // 결과를 바로 출력 |
|
| 4267 |
- |
|
| 4268 |
- |
|
| 4269 |
- |
|
| 4270 |
- |
|
| 4271 |
- ////////////////////////////////// |
|
| 4272 |
- ////////////////////////////////// |
|
| 4273 |
- ////////////////////////////////// |
|
| 4274 |
-// if(true) {
|
|
| 4275 |
-// return new StatusResponse(HttpStatus.BAD_REQUEST, "문자 테스트 실패"); |
|
| 4276 |
-// } |
|
| 4277 |
- ////////////////////////////////// |
|
| 4278 |
- ////////////////////////////////// |
|
| 4279 |
- ////////////////////////////////// |
|
| 4280 |
- |
|
| 4281 |
- // 발송 처리 |
|
| 4282 |
-// statusResponse = processMessageSending(mjonMsgVO, intiLists, statusResponse); |
|
| 4283 |
-// } else {
|
|
| 4284 |
-// // 일반 문자 발송 |
|
| 4285 |
-// statusResponse = fncSendMsg(mjonMsgVO); |
|
| 4286 |
-// } |
|
| 4287 |
- |
|
| 4288 |
- return statusResponse; |
|
| 4289 |
- |
|
| 4353 |
+ return instCnt; |
|
| 4290 | 4354 |
} |
| 4291 |
- |
|
| 4292 |
- /** |
|
| 4355 |
+ /** |
|
| 4293 | 4356 |
* @methodName : handleHotlineAgent |
| 4294 | 4357 |
* @author : 이호영 |
| 4295 | 4358 |
* @date : 2024.11.26 |
... | ... | @@ -4519,6 +4582,30 @@ |
| 4519 | 4582 |
System.err.println("스팸 문구 처리 중 오류 발생: " + e.getMessage());
|
| 4520 | 4583 |
} |
| 4521 | 4584 |
} |
| 4585 |
+ |
|
| 4586 |
+ private void handleSpamMsg_advc(MjonMsgVO mjonMsgVO, MjonMsgSendVO mjonMsgSendVO) {
|
|
| 4587 |
+ try {
|
|
| 4588 |
+ if ("Y".equals(mjonMsgVO.getSpamStatus()))
|
|
| 4589 |
+ {
|
|
| 4590 |
+ MjonMsgVO mjonSpamMsgVO = mjonMsgVO; |
|
| 4591 |
+ mjonSpamMsgVO.setCallFrom(mjonMsgSendVO.getCallFrom()); |
|
| 4592 |
+ mjonSpamMsgVO.setMsgGroupCnt(mjonMsgSendVO.getMsgGroupId()); |
|
| 4593 |
+ |
|
| 4594 |
+ mjonSpamMsgVO.setSubject(null); |
|
| 4595 |
+ mjonSpamMsgVO.setReqDate(null); |
|
| 4596 |
+ mjonSpamMsgVO.setMsgType(null); |
|
| 4597 |
+ mjonSpamMsgVO.setMsgType(null); |
|
| 4598 |
+ mjonSpamMsgVO.setEachPrice(null); |
|
| 4599 |
+ |
|
| 4600 |
+ |
|
| 4601 |
+ |
|
| 4602 |
+ int resultCnt = mjonSpamMsgService.insertSpamKeyWordMsgData(mjonMsgVO); |
|
| 4603 |
+ System.out.println("스팸 문구 발송 내용 등록: " + resultCnt);
|
|
| 4604 |
+ } |
|
| 4605 |
+ } catch (Exception e) {
|
|
| 4606 |
+ System.err.println("스팸 문구 처리 중 오류 발생: " + e.getMessage());
|
|
| 4607 |
+ } |
|
| 4608 |
+ } |
|
| 4522 | 4609 |
|
| 4523 | 4610 |
// 예약 문자인 경우 처리하는 메서드 |
| 4524 | 4611 |
private MjonMsgVO handleReserveMsg(MjonMsgVO mjonMsgVO) throws ParseException {
|
--- src/main/webapp/WEB-INF/jsp/web/msgdata/MsgDataView.jsp
+++ src/main/webapp/WEB-INF/jsp/web/msgdata/MsgDataView.jsp
... | ... | @@ -1283,9 +1283,6 @@ |
| 1283 | 1283 |
var smsCnt = Number(data.object.resultSts); |
| 1284 | 1284 |
var blockCnt = Number(data.object.resultBlockSts); |
| 1285 | 1285 |
|
| 1286 |
- smsCnt = Number(smsCnt) + Number(paramSmsCnt); |
|
| 1287 |
- blockCnt = Number(blockCnt) + Number(paramBlockCnt); |
|
| 1288 |
- |
|
| 1289 | 1286 |
if((smsCnt + blockCnt) == 0){
|
| 1290 | 1287 |
|
| 1291 | 1288 |
$('.pop_msg_spam').css({'display':'block','opacity':'1','left':'50%','top':'50%','transform':'translate(-50%,-50%)'});
|
... | ... | @@ -1296,15 +1293,19 @@ |
| 1296 | 1293 |
|
| 1297 | 1294 |
$('.pop_msg_success').css({'display':'block','opacity':'1','left':'50%','top':'50%','transform':'translate(-50%,-50%)'});
|
| 1298 | 1295 |
//예약발송 건의 경우 결과 팝업 문구 변경 |
| 1296 |
+ |
|
| 1297 |
+ var reserYn = $("input[name=reserYn]:checked").val();
|
|
| 1299 | 1298 |
var resText = (reserYn === 'Y') ? '예약' : '발송'; |
| 1299 |
+ /* |
|
| 1300 | 1300 |
if(reserYn == 'Y') |
| 1301 |
- /* {
|
|
| 1301 |
+ {
|
|
| 1302 | 1302 |
resText = "예약"; |
| 1303 | 1303 |
} |
| 1304 | 1304 |
else |
| 1305 | 1305 |
{
|
| 1306 | 1306 |
resText = "발송"; |
| 1307 |
- } */ |
|
| 1307 |
+ } |
|
| 1308 |
+ */ |
|
| 1308 | 1309 |
$('.pop_msg_success .msg_text').html(resText+" 성공 : <strong>"+ smsCnt + "</strong>건,수신거부 : <span>" + blockCnt + "</span>건의<br>문자가 "+resText+" 되었습니다.");
|
| 1309 | 1310 |
|
| 1310 | 1311 |
$('.mask').addClass('on');
|
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?