--- src/main/java/itn/let/kakao/kakaoComm/KakaoReturnVO.java
+++ src/main/java/itn/let/kakao/kakaoComm/KakaoReturnVO.java
... | ... | @@ -4,6 +4,9 @@ |
| 4 | 4 |
import java.util.List; |
| 5 | 5 |
|
| 6 | 6 |
import itn.com.cmm.ComDefaultVO; |
| 7 |
+import lombok.Getter; |
|
| 8 |
+import lombok.Setter; |
|
| 9 |
+import lombok.ToString; |
|
| 7 | 10 |
|
| 8 | 11 |
/** |
| 9 | 12 |
* @FileName : KakaoReturnVO.java |
... | ... | @@ -13,6 +16,9 @@ |
| 13 | 16 |
|
| 14 | 17 |
* @프로그램 설명 : 카카오톡 리턴 변수 목록 |
| 15 | 18 |
*/ |
| 19 |
+@Getter |
|
| 20 |
+@Setter |
|
| 21 |
+@ToString |
|
| 16 | 22 |
public class KakaoReturnVO extends ComDefaultVO{
|
| 17 | 23 |
|
| 18 | 24 |
private static final long serialVersionUID = 1L; |
... | ... | @@ -130,415 +136,4 @@ |
| 130 | 136 |
|
| 131 | 137 |
private String businessType = ""; //카카오톡 채널 비즈니스 인증 타입 |
| 132 | 138 |
|
| 133 |
- public static long getSerialversionuid() {
|
|
| 134 |
- return serialVersionUID; |
|
| 135 |
- } |
|
| 136 |
- |
|
| 137 |
- public String getBizReturnMsg() {
|
|
| 138 |
- return bizReturnMsg; |
|
| 139 |
- } |
|
| 140 |
- |
|
| 141 |
- public void setBizReturnMsg(String bizReturnMsg) {
|
|
| 142 |
- this.bizReturnMsg = bizReturnMsg; |
|
| 143 |
- } |
|
| 144 |
- |
|
| 145 |
- public String getBizReturnCode() {
|
|
| 146 |
- return bizReturnCode; |
|
| 147 |
- } |
|
| 148 |
- |
|
| 149 |
- public void setBizReturnCode(String bizReturnCode) {
|
|
| 150 |
- this.bizReturnCode = bizReturnCode; |
|
| 151 |
- } |
|
| 152 |
- |
|
| 153 |
- public String getProfileId() {
|
|
| 154 |
- return profileId; |
|
| 155 |
- } |
|
| 156 |
- |
|
| 157 |
- public void setProfileId(String profileId) {
|
|
| 158 |
- this.profileId = profileId; |
|
| 159 |
- } |
|
| 160 |
- |
|
| 161 |
- public String getTotalCount() {
|
|
| 162 |
- return totalCount; |
|
| 163 |
- } |
|
| 164 |
- |
|
| 165 |
- public void setTotalCount(String totalCount) {
|
|
| 166 |
- this.totalCount = totalCount; |
|
| 167 |
- } |
|
| 168 |
- |
|
| 169 |
- public String getTotalPage() {
|
|
| 170 |
- return totalPage; |
|
| 171 |
- } |
|
| 172 |
- |
|
| 173 |
- public void setTotalPage(String totalPage) {
|
|
| 174 |
- this.totalPage = totalPage; |
|
| 175 |
- } |
|
| 176 |
- |
|
| 177 |
- public String getCurrentPage() {
|
|
| 178 |
- return currentPage; |
|
| 179 |
- } |
|
| 180 |
- |
|
| 181 |
- public void setCurrentPage(String currentPage) {
|
|
| 182 |
- this.currentPage = currentPage; |
|
| 183 |
- } |
|
| 184 |
- |
|
| 185 |
- public String getSenderKey() {
|
|
| 186 |
- return senderKey; |
|
| 187 |
- } |
|
| 188 |
- |
|
| 189 |
- public void setSenderKey(String senderKey) {
|
|
| 190 |
- this.senderKey = senderKey; |
|
| 191 |
- } |
|
| 192 |
- |
|
| 193 |
- public String getSenderKeyType() {
|
|
| 194 |
- return senderKeyType; |
|
| 195 |
- } |
|
| 196 |
- |
|
| 197 |
- public void setSenderKeyType(String senderKeyType) {
|
|
| 198 |
- this.senderKeyType = senderKeyType; |
|
| 199 |
- } |
|
| 200 |
- |
|
| 201 |
- public String getTemplateCode() {
|
|
| 202 |
- return templateCode; |
|
| 203 |
- } |
|
| 204 |
- |
|
| 205 |
- public void setTemplateCode(String templateCode) {
|
|
| 206 |
- this.templateCode = templateCode; |
|
| 207 |
- } |
|
| 208 |
- |
|
| 209 |
- public String getTemplateName() {
|
|
| 210 |
- return templateName; |
|
| 211 |
- } |
|
| 212 |
- |
|
| 213 |
- public void setTemplateName(String templateName) {
|
|
| 214 |
- this.templateName = templateName; |
|
| 215 |
- } |
|
| 216 |
- |
|
| 217 |
- public String getCategoryCode() {
|
|
| 218 |
- return categoryCode; |
|
| 219 |
- } |
|
| 220 |
- |
|
| 221 |
- public void setCategoryCode(String categoryCode) {
|
|
| 222 |
- this.categoryCode = categoryCode; |
|
| 223 |
- } |
|
| 224 |
- |
|
| 225 |
- public String getCreatedAt() {
|
|
| 226 |
- return createdAt; |
|
| 227 |
- } |
|
| 228 |
- |
|
| 229 |
- public void setCreatedAt(String createdAt) {
|
|
| 230 |
- this.createdAt = createdAt; |
|
| 231 |
- } |
|
| 232 |
- |
|
| 233 |
- public String getModifiedAt() {
|
|
| 234 |
- return modifiedAt; |
|
| 235 |
- } |
|
| 236 |
- |
|
| 237 |
- public void setModifiedAt(String modifiedAt) {
|
|
| 238 |
- this.modifiedAt = modifiedAt; |
|
| 239 |
- } |
|
| 240 |
- |
|
| 241 |
- public String getServiceStatus() {
|
|
| 242 |
- return serviceStatus; |
|
| 243 |
- } |
|
| 244 |
- |
|
| 245 |
- public void setServiceStatus(String serviceStatus) {
|
|
| 246 |
- this.serviceStatus = serviceStatus; |
|
| 247 |
- } |
|
| 248 |
- |
|
| 249 |
- public List<KakaoReturnVO> getTemplatList() {
|
|
| 250 |
- return templatList; |
|
| 251 |
- } |
|
| 252 |
- |
|
| 253 |
- public void setTemplatList(List<KakaoReturnVO> templatList) {
|
|
| 254 |
- this.templatList = templatList; |
|
| 255 |
- } |
|
| 256 |
- |
|
| 257 |
- public String getUuid() {
|
|
| 258 |
- return uuid; |
|
| 259 |
- } |
|
| 260 |
- |
|
| 261 |
- public void setUuid(String uuid) {
|
|
| 262 |
- this.uuid = uuid; |
|
| 263 |
- } |
|
| 264 |
- |
|
| 265 |
- public String getName() {
|
|
| 266 |
- return name; |
|
| 267 |
- } |
|
| 268 |
- |
|
| 269 |
- public void setName(String name) {
|
|
| 270 |
- this.name = name; |
|
| 271 |
- } |
|
| 272 |
- |
|
| 273 |
- public String getStatus() {
|
|
| 274 |
- return status; |
|
| 275 |
- } |
|
| 276 |
- |
|
| 277 |
- public void setStatus(String status) {
|
|
| 278 |
- this.status = status; |
|
| 279 |
- } |
|
| 280 |
- |
|
| 281 |
- public boolean isBlock() {
|
|
| 282 |
- return block; |
|
| 283 |
- } |
|
| 284 |
- |
|
| 285 |
- public void setBlock(boolean block) {
|
|
| 286 |
- this.block = block; |
|
| 287 |
- } |
|
| 288 |
- |
|
| 289 |
- public boolean isDormant() {
|
|
| 290 |
- return dormant; |
|
| 291 |
- } |
|
| 292 |
- |
|
| 293 |
- public void setDormant(boolean dormant) {
|
|
| 294 |
- this.dormant = dormant; |
|
| 295 |
- } |
|
| 296 |
- |
|
| 297 |
- public String getTitle() {
|
|
| 298 |
- return title; |
|
| 299 |
- } |
|
| 300 |
- |
|
| 301 |
- public void setTitle(String title) {
|
|
| 302 |
- this.title = title; |
|
| 303 |
- } |
|
| 304 |
- |
|
| 305 |
- public String getDescription() {
|
|
| 306 |
- return description; |
|
| 307 |
- } |
|
| 308 |
- |
|
| 309 |
- public void setDescription(String description) {
|
|
| 310 |
- this.description = description; |
|
| 311 |
- } |
|
| 312 |
- |
|
| 313 |
- public String getImageUrl() {
|
|
| 314 |
- return imageUrl; |
|
| 315 |
- } |
|
| 316 |
- |
|
| 317 |
- public void setImageUrl(String imageUrl) {
|
|
| 318 |
- this.imageUrl = imageUrl; |
|
| 319 |
- } |
|
| 320 |
- |
|
| 321 |
- public String getListTitle() {
|
|
| 322 |
- return listTitle; |
|
| 323 |
- } |
|
| 324 |
- |
|
| 325 |
- public void setListTitle(String listTitle) {
|
|
| 326 |
- this.listTitle = listTitle; |
|
| 327 |
- } |
|
| 328 |
- |
|
| 329 |
- public String getListDescription() {
|
|
| 330 |
- return listDescription; |
|
| 331 |
- } |
|
| 332 |
- |
|
| 333 |
- public void setListDescription(String listDescription) {
|
|
| 334 |
- this.listDescription = listDescription; |
|
| 335 |
- } |
|
| 336 |
- |
|
| 337 |
- public String getSumTitle() {
|
|
| 338 |
- return sumTitle; |
|
| 339 |
- } |
|
| 340 |
- |
|
| 341 |
- public void setSumTitle(String sumTitle) {
|
|
| 342 |
- this.sumTitle = sumTitle; |
|
| 343 |
- } |
|
| 344 |
- |
|
| 345 |
- public String getSumDescription() {
|
|
| 346 |
- return sumDescription; |
|
| 347 |
- } |
|
| 348 |
- |
|
| 349 |
- public void setSumDescription(String sumDescription) {
|
|
| 350 |
- this.sumDescription = sumDescription; |
|
| 351 |
- } |
|
| 352 |
- |
|
| 353 |
- public String getProfileStatus() {
|
|
| 354 |
- return profileStatus; |
|
| 355 |
- } |
|
| 356 |
- |
|
| 357 |
- public void setProfileStatus(String profileStatus) {
|
|
| 358 |
- this.profileStatus = profileStatus; |
|
| 359 |
- } |
|
| 360 |
- |
|
| 361 |
- public boolean isAlimtalk() {
|
|
| 362 |
- return alimtalk; |
|
| 363 |
- } |
|
| 364 |
- |
|
| 365 |
- public void setAlimtalk(boolean alimtalk) {
|
|
| 366 |
- this.alimtalk = alimtalk; |
|
| 367 |
- } |
|
| 368 |
- |
|
| 369 |
- public boolean isBizchat() {
|
|
| 370 |
- return bizchat; |
|
| 371 |
- } |
|
| 372 |
- |
|
| 373 |
- public void setBizchat(boolean bizchat) {
|
|
| 374 |
- this.bizchat = bizchat; |
|
| 375 |
- } |
|
| 376 |
- |
|
| 377 |
- public boolean isBrandtalk() {
|
|
| 378 |
- return brandtalk; |
|
| 379 |
- } |
|
| 380 |
- |
|
| 381 |
- public void setBrandtalk(boolean brandtalk) {
|
|
| 382 |
- this.brandtalk = brandtalk; |
|
| 383 |
- } |
|
| 384 |
- |
|
| 385 |
- public String getCommittalCompanyName() {
|
|
| 386 |
- return committalCompanyName; |
|
| 387 |
- } |
|
| 388 |
- |
|
| 389 |
- public void setCommittalCompanyName(String committalCompanyName) {
|
|
| 390 |
- this.committalCompanyName = committalCompanyName; |
|
| 391 |
- } |
|
| 392 |
- |
|
| 393 |
- public String getChannelKey() {
|
|
| 394 |
- return channelKey; |
|
| 395 |
- } |
|
| 396 |
- |
|
| 397 |
- public void setChannelKey(String channelKey) {
|
|
| 398 |
- this.channelKey = channelKey; |
|
| 399 |
- } |
|
| 400 |
- |
|
| 401 |
- public boolean isBusinessProfile() {
|
|
| 402 |
- return businessProfile; |
|
| 403 |
- } |
|
| 404 |
- |
|
| 405 |
- public void setBusinessProfile(boolean businessProfile) {
|
|
| 406 |
- this.businessProfile = businessProfile; |
|
| 407 |
- } |
|
| 408 |
- |
|
| 409 |
- public String getBusinessType() {
|
|
| 410 |
- return businessType; |
|
| 411 |
- } |
|
| 412 |
- |
|
| 413 |
- public void setBusinessType(String businessType) {
|
|
| 414 |
- this.businessType = businessType; |
|
| 415 |
- } |
|
| 416 |
- |
|
| 417 |
- public String getTemplateMessageType() {
|
|
| 418 |
- return templateMessageType; |
|
| 419 |
- } |
|
| 420 |
- |
|
| 421 |
- public void setTemplateMessageType(String templateMessageType) {
|
|
| 422 |
- this.templateMessageType = templateMessageType; |
|
| 423 |
- } |
|
| 424 |
- |
|
| 425 |
- public String getTemplateEmphasizeType() {
|
|
| 426 |
- return templateEmphasizeType; |
|
| 427 |
- } |
|
| 428 |
- |
|
| 429 |
- public void setTemplateEmphasizeType(String templateEmphasizeType) {
|
|
| 430 |
- this.templateEmphasizeType = templateEmphasizeType; |
|
| 431 |
- } |
|
| 432 |
- |
|
| 433 |
- public String getTemplateContent() {
|
|
| 434 |
- return templateContent; |
|
| 435 |
- } |
|
| 436 |
- |
|
| 437 |
- public void setTemplateContent(String templateContent) {
|
|
| 438 |
- this.templateContent = templateContent; |
|
| 439 |
- } |
|
| 440 |
- |
|
| 441 |
- public String getTemplateExtra() {
|
|
| 442 |
- return templateExtra; |
|
| 443 |
- } |
|
| 444 |
- |
|
| 445 |
- public void setTemplateExtra(String templateExtra) {
|
|
| 446 |
- this.templateExtra = templateExtra; |
|
| 447 |
- } |
|
| 448 |
- |
|
| 449 |
- public String getTemplateAd() {
|
|
| 450 |
- return templateAd; |
|
| 451 |
- } |
|
| 452 |
- |
|
| 453 |
- public void setTemplateAd(String templateAd) {
|
|
| 454 |
- this.templateAd = templateAd; |
|
| 455 |
- } |
|
| 456 |
- |
|
| 457 |
- public String getTemplateImageName() {
|
|
| 458 |
- return templateImageName; |
|
| 459 |
- } |
|
| 460 |
- |
|
| 461 |
- public void setTemplateImageName(String templateImageName) {
|
|
| 462 |
- this.templateImageName = templateImageName; |
|
| 463 |
- } |
|
| 464 |
- |
|
| 465 |
- public String getTemplateImageUrl() {
|
|
| 466 |
- return templateImageUrl; |
|
| 467 |
- } |
|
| 468 |
- |
|
| 469 |
- public void setTemplateImageUrl(String templateImageUrl) {
|
|
| 470 |
- this.templateImageUrl = templateImageUrl; |
|
| 471 |
- } |
|
| 472 |
- |
|
| 473 |
- public String getTemplateTitle() {
|
|
| 474 |
- return templateTitle; |
|
| 475 |
- } |
|
| 476 |
- |
|
| 477 |
- public void setTemplateTitle(String templateTitle) {
|
|
| 478 |
- this.templateTitle = templateTitle; |
|
| 479 |
- } |
|
| 480 |
- |
|
| 481 |
- public String getTemplateSubtitle() {
|
|
| 482 |
- return templateSubtitle; |
|
| 483 |
- } |
|
| 484 |
- |
|
| 485 |
- public void setTemplateSubtitle(String templateSubtitle) {
|
|
| 486 |
- this.templateSubtitle = templateSubtitle; |
|
| 487 |
- } |
|
| 488 |
- |
|
| 489 |
- public String getTemplateHeader() {
|
|
| 490 |
- return templateHeader; |
|
| 491 |
- } |
|
| 492 |
- |
|
| 493 |
- public void setTemplateHeader(String templateHeader) {
|
|
| 494 |
- this.templateHeader = templateHeader; |
|
| 495 |
- } |
|
| 496 |
- |
|
| 497 |
- public Boolean getSecurityFlag() {
|
|
| 498 |
- return securityFlag; |
|
| 499 |
- } |
|
| 500 |
- |
|
| 501 |
- public void setSecurityFlag(Boolean securityFlag) {
|
|
| 502 |
- this.securityFlag = securityFlag; |
|
| 503 |
- } |
|
| 504 |
- |
|
| 505 |
- public String getInspectionStatus() {
|
|
| 506 |
- return inspectionStatus; |
|
| 507 |
- } |
|
| 508 |
- |
|
| 509 |
- public void setInspectionStatus(String inspectionStatus) {
|
|
| 510 |
- this.inspectionStatus = inspectionStatus; |
|
| 511 |
- } |
|
| 512 |
- |
|
| 513 |
- public List<KakaoButtonVO> getButtonList() {
|
|
| 514 |
- return buttonList; |
|
| 515 |
- } |
|
| 516 |
- |
|
| 517 |
- public void setButtonList(List<KakaoButtonVO> buttonList) {
|
|
| 518 |
- this.buttonList = buttonList; |
|
| 519 |
- } |
|
| 520 |
- |
|
| 521 |
- public List<KakaoButtonVO> getQuickReplyList() {
|
|
| 522 |
- return quickReplyList; |
|
| 523 |
- } |
|
| 524 |
- |
|
| 525 |
- public void setQuickReplyList(List<KakaoButtonVO> quickReplyList) {
|
|
| 526 |
- this.quickReplyList = quickReplyList; |
|
| 527 |
- } |
|
| 528 |
- |
|
| 529 |
- public List<KakaoCommentVO> getCommentList() {
|
|
| 530 |
- return commentList; |
|
| 531 |
- } |
|
| 532 |
- |
|
| 533 |
- public void setCommentList(List<KakaoCommentVO> commentList) {
|
|
| 534 |
- this.commentList = commentList; |
|
| 535 |
- } |
|
| 536 |
- |
|
| 537 |
- public List<KakaoItemVO> getItemList() {
|
|
| 538 |
- return itemList; |
|
| 539 |
- } |
|
| 540 |
- |
|
| 541 |
- public void setItemList(List<KakaoItemVO> itemList) {
|
|
| 542 |
- this.itemList = itemList; |
|
| 543 |
- } |
|
| 544 | 139 |
} |
--- src/main/java/itn/let/kakao/kakaoComm/KakaoSendAdvcVO.java
+++ src/main/java/itn/let/kakao/kakaoComm/KakaoSendAdvcVO.java
... | ... | @@ -41,8 +41,9 @@ |
| 41 | 41 |
private String subMsgSendYn; // 대체문자 전송 여부 |
| 42 | 42 |
private String subMsgTxt; // 대체문자 내용 |
| 43 | 43 |
private String subMsgType; // 대체문자 타입 |
| 44 |
- private String bizJsonName; // JSON 파일명 |
|
| 45 | 44 |
private String reqDate; // 예약일시 |
| 45 |
+ |
|
| 46 |
+ private String jsonStr; // jsonStr |
|
| 46 | 47 |
|
| 47 | 48 |
// ===== |
| 48 | 49 |
// ===== |
... | ... | @@ -71,8 +72,8 @@ |
| 71 | 72 |
"\n , subMsgSendYn=[" + subMsgSendYn + "]" + |
| 72 | 73 |
"\n , subMsgTxt=[" + subMsgTxt + "]" + |
| 73 | 74 |
"\n , subMsgType=[" + subMsgType + "]" + |
| 74 |
- "\n , bizJsonName=[" + bizJsonName + "]" + |
|
| 75 | 75 |
"\n , reqDate=[" + reqDate + "]" + |
| 76 |
+ "\n , jsonStr=[" + jsonStr + "]" + |
|
| 76 | 77 |
"\n , ==== MJ_MSG_DATA INSERT DATA END =======" + |
| 77 | 78 |
"\n " + |
| 78 | 79 |
"\n , smsPrice=[" + smsPrice + "]" + |
--- src/main/java/itn/let/kakao/kakaoComm/KakaoSendUtil.java
+++ src/main/java/itn/let/kakao/kakaoComm/KakaoSendUtil.java
... | ... | @@ -2,12 +2,12 @@ |
| 2 | 2 |
|
| 3 | 3 |
import java.text.SimpleDateFormat; |
| 4 | 4 |
import java.util.ArrayList; |
| 5 |
-import java.util.Arrays; |
|
| 6 | 5 |
import java.util.Calendar; |
| 7 | 6 |
import java.util.Date; |
| 8 |
-import java.util.HashMap; |
|
| 9 | 7 |
import java.util.List; |
| 10 | 8 |
import java.util.Map; |
| 9 |
+import java.util.regex.Matcher; |
|
| 10 |
+import java.util.regex.Pattern; |
|
| 11 | 11 |
|
| 12 | 12 |
import javax.annotation.Resource; |
| 13 | 13 |
|
... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 |
|
| 19 | 19 |
import itn.com.cmm.util.StringUtil; |
| 20 | 20 |
import itn.let.kakao.kakaoComm.kakaoApi.KakaoApiJsonSave; |
| 21 |
+import itn.let.kakao.kakaoComm.kakaoApi.KakaoApiTemplate; |
|
| 21 | 22 |
import itn.let.mail.service.StatusResponse; |
| 22 | 23 |
import itn.let.mjo.mjocommon.MjonCommon; |
| 23 | 24 |
import itn.let.mjo.msg.service.MjonMsgVO; |
... | ... | @@ -39,6 +40,9 @@ |
| 39 | 40 |
private MjonMsgDataService mjonMsgDataService; |
| 40 | 41 |
|
| 41 | 42 |
@Autowired |
| 43 |
+ KakaoApiTemplate kakaoApiTemplate; |
|
| 44 |
+ |
|
| 45 |
+ @Autowired |
|
| 42 | 46 |
private PriceAndPoint priceAndPoint; |
| 43 | 47 |
|
| 44 | 48 |
@Autowired |
... | ... | @@ -52,7 +56,7 @@ |
| 52 | 56 |
public static final String LONG_MSG_TYPE = "MMS"; |
| 53 | 57 |
|
| 54 | 58 |
/** |
| 55 |
- * @methodName : kakaoSendPrice_advc |
|
| 59 |
+ * @methodName : populateSendLists _advc |
|
| 56 | 60 |
* @author : 이호영 |
| 57 | 61 |
* @date : 2025. 3. 7. |
| 58 | 62 |
* @description : 기존 kakaoSendPrice 개선 |
... | ... | @@ -91,20 +95,40 @@ |
| 91 | 95 |
|
| 92 | 96 |
Calendar calendar = Calendar.getInstance(); |
| 93 | 97 |
calendar.setTime(baseDate); // calendar에 baseDate 설정 |
| 98 |
+ |
|
| 99 |
+ |
|
| 100 |
+ KakaoReturnVO templateDetail = kakaoApiTemplate.selectKakaoApiTemplateDetail(kakaoVO); |
|
| 101 |
+ log.info(" + templateDetail :: [{}]", templateDetail.toString());
|
|
| 102 |
+ String templateContent = templateDetail.getTemplateContent(); // 알림톡 템플릿 |
|
| 103 |
+ String templateTitle = templateDetail.getTemplateTitle(); |
|
| 104 |
+ log.info(" + templateTitle :: [{}]",templateTitle);
|
|
| 105 |
+ |
|
| 106 |
+ kakaoVO.setTxtReplYn(replYnChecker(templateContent+" "+templateTitle)); |
|
| 107 |
+ |
|
| 108 |
+ String subMsgTxt = kakaoVO.getSubMsgTxt(); // 실패 대체 문자 |
|
| 109 |
+ |
|
| 110 |
+ // 시스템 기본 단가 정보 불러오기 |
|
| 111 |
+ JoinSettingVO sysJoinSetVO = mjonMsgDataService.selectJoinSettingInfo(); |
|
| 112 |
+ // 사용자 개인 단가 정보 불러오기 |
|
| 113 |
+ MberManageVO mberManageVO = mjonMsgDataService.selectMberManageInfo(kakaoVO.getUserId()); |
|
| 114 |
+ |
|
| 94 | 115 |
|
| 95 | 116 |
int counter = 0; // 분할 건수 카운터 |
| 96 |
- |
|
| 97 | 117 |
// Map에 총 갯수가 수신자 갯수와 동일함 |
| 98 | 118 |
for(Map<String, String> variables : kakaoVO.getVarListMap()) {
|
| 99 | 119 |
|
| 100 | 120 |
KakaoSendAdvcVO sendVO = new KakaoSendAdvcVO(); |
| 101 | 121 |
|
| 102 |
- |
|
| 122 |
+// 공통 기본값 |
|
| 123 |
+ sendVO.setMsgType("8");
|
|
| 124 |
+ sendVO.setSenderKey(kakaoVO.getSenderKey()); |
|
| 125 |
+ sendVO.setTemplateCode(kakaoVO.getTemplateCode()); |
|
| 126 |
+ sendVO.setUserId(kakaoVO.getUserId()); // 수신자 |
|
| 127 |
+ sendVO.setCallFrom(kakaoVO.getCallFrom()); // 발신자 |
|
| 128 |
+ sendVO.setAgentCode("04"); // 발신자
|
|
| 103 | 129 |
|
| 104 | 130 |
// step1 |
| 105 | 131 |
// Step 1-1: 값 치환 및 수신번호 셋팅 |
| 106 |
- String templateContent = kakaoVO.getTemplateContent(); // 알림톡 템플릿 |
|
| 107 |
- |
|
| 108 | 132 |
// Step 1-2: 수신자 정보 설정 (callToList는 항상 설정). |
| 109 | 133 |
if (variables.containsKey("callToList")) {
|
| 110 | 134 |
sendVO.setCallTo(variables.get("callToList"));
|
... | ... | @@ -114,17 +138,19 @@ |
| 114 | 138 |
// Step 1-3: 템플릿 치환데이터 설정 |
| 115 | 139 |
// TxtReplYn이 "Y"일 때만 치환 수행 |
| 116 | 140 |
if ("Y".equals(kakaoVO.getTxtReplYn())) {
|
| 117 |
- templateContent = replaceTemplateVariables(templateContent, variables); |
|
| 141 |
+ templateContent = mjonCommon.ATReplaceTemplateVariables(templateContent, variables); |
|
| 142 |
+ if("TEXT".equals(templateDetail.getTemplateEmphasizeType())) {
|
|
| 143 |
+ templateTitle = mjonCommon.ATReplaceTemplateVariables(templateTitle, variables); |
|
| 144 |
+ } |
|
| 118 | 145 |
} |
| 146 |
+ sendVO.setTemplateTitle(templateTitle); |
|
| 119 | 147 |
sendVO.setTemplateContent(templateContent); |
| 120 |
- |
|
| 148 |
+ |
|
| 121 | 149 |
|
| 122 | 150 |
// Step 1-4: 실패 대체 문자 치환데이터 설정 |
| 123 |
- if("Y".equals(kakaoVO.getSubMsgSendYn())) {
|
|
| 124 |
- String subMsgTxt = kakaoVO.getSubMsgTxt(); // 실패 대체 치환 문자 |
|
| 125 |
- // TxtReplYn이 "Y"일 때만 치환 수행 |
|
| 126 |
- if ("Y".equals(kakaoVO.getSubMsgTxtReplYn())) {
|
|
| 127 |
- subMsgTxt = replaceTemplateVariables(subMsgTxt, variables); |
|
| 151 |
+ if("Y".equals(kakaoVO.getSubMsgSendYn())) { // 대체문자가 있나?
|
|
| 152 |
+ if ("Y".equals(kakaoVO.getSubMsgTxtReplYn())) { // 치환데이터가 있나?
|
|
| 153 |
+ subMsgTxt = mjonCommon.ATReplaceTemplateVariables(subMsgTxt, variables); |
|
| 128 | 154 |
} |
| 129 | 155 |
sendVO.setSubMsgTxt(subMsgTxt);// 실패 |
| 130 | 156 |
} |
... | ... | @@ -136,43 +162,41 @@ |
| 136 | 162 |
); |
| 137 | 163 |
*/ |
| 138 | 164 |
|
| 165 |
+ // Step1 END |
|
| 139 | 166 |
|
| 140 | 167 |
|
| 141 |
- // step3 |
|
| 142 |
- // 바이트 수 체크 및 금액설정 |
|
| 168 |
+// step3 |
|
| 169 |
+// 바이트 수 체크 및 금액설정 |
|
| 143 | 170 |
|
| 144 |
- // 시스템 기본 단가 정보 불러오기 |
|
| 145 |
- JoinSettingVO sysJoinSetVO = mjonMsgDataService.selectJoinSettingInfo(); |
|
| 146 | 171 |
|
| 147 |
- // 사용자 개인 단가 정보 불러오기 |
|
| 148 |
- MberManageVO mberManageVO = mjonMsgDataService.selectMberManageInfo(kakaoVO.getUserId()); |
|
| 149 | 172 |
Float kakaoAtPrice = mberManageVO.getKakaoAtPrice(); |
| 150 | 173 |
// 유효한 단가 계산 |
| 151 | 174 |
float shortPrice = getValidPrice(mberManageVO.getShortPrice(), sysJoinSetVO.getShortPrice()); |
| 152 | 175 |
float longPrice = getValidPrice(mberManageVO.getLongPrice(), sysJoinSetVO.getLongPrice()); |
| 153 | 176 |
|
| 154 | 177 |
// 공통 가격 설정 |
| 155 |
- kakaoVO.setSmsPrice(shortPrice); |
|
| 156 |
- kakaoVO.setMmsPrice(longPrice); |
|
| 178 |
+ sendVO.setSmsPrice(shortPrice); |
|
| 179 |
+ sendVO.setMmsPrice(longPrice); |
|
| 157 | 180 |
|
| 158 | 181 |
|
| 159 | 182 |
if("Y".equals(kakaoVO.getSubMsgSendYn())) {
|
| 160 | 183 |
int smsTxtByte = mjonCommon.getSmsTxtBytes(sendVO.getSubMsgTxt()); |
| 161 |
- |
|
| 162 | 184 |
String sendType = getMsgType(smsTxtByte); |
| 185 |
+ sendVO.setSubMsgType(sendType); |
|
| 163 | 186 |
|
| 164 | 187 |
if ("INVALID".equals(sendType)) {
|
| 165 | 188 |
statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "전송 문자 길이를 초과하였습니다.");return kakaoSendAdvcListVO; |
| 166 | 189 |
} |
| 167 | 190 |
|
| 168 | 191 |
boolean isMms = "MMS".equals(sendType); |
| 169 |
- kakaoAtPrice = isMms ? longPrice : shortPrice; |
|
| 170 |
- kakaoVO.setKakaoAtPrice(getValidPrice(mberManageVO.getKakaoAtPrice(), sysJoinSetVO.getKakaoAtPrice())); |
|
| 192 |
+// kakaoAtPrice = isMms ? longPrice : shortPrice; |
|
| 193 |
+// sendVO.setKakaoAtPrice(getValidPrice(mberManageVO.getKakaoAtPrice(), sysJoinSetVO.getKakaoAtPrice())); |
|
| 194 |
+ sendVO.setKakaoAtPrice(isMms ? longPrice : shortPrice); |
|
| 171 | 195 |
|
| 172 | 196 |
|
| 173 | 197 |
} else {
|
| 174 | 198 |
kakaoAtPrice = getValidPrice(mberManageVO.getKakaoAtPrice(), sysJoinSetVO.getKakaoAtPrice()); |
| 175 |
- kakaoVO.setKakaoAtPrice(kakaoAtPrice); |
|
| 199 |
+ sendVO.setKakaoAtPrice(kakaoAtPrice); |
|
| 176 | 200 |
} |
| 177 | 201 |
|
| 178 | 202 |
|
... | ... | @@ -181,7 +205,7 @@ |
| 181 | 205 |
// 예약 시간 설정 및 분할 데이터 설정 |
| 182 | 206 |
if ("Y".equalsIgnoreCase(kakaoVO.getReserveYn())) {
|
| 183 | 207 |
// 분할 발송일 경우 |
| 184 |
- if ("on".equalsIgnoreCase(kakaoVO.getDivideChk())) {
|
|
| 208 |
+ if ("Y".equalsIgnoreCase(kakaoVO.getDivideChk())) {
|
|
| 185 | 209 |
if (counter == Integer.parseInt(kakaoVO.getDivideCnt())) { // 지정된 건수마다 간격 추가
|
| 186 | 210 |
counter = 0; |
| 187 | 211 |
calendar.add(Calendar.MINUTE, Integer.parseInt(kakaoVO.getDivideTime())); |
... | ... | @@ -190,26 +214,20 @@ |
| 190 | 214 |
} |
| 191 | 215 |
// 예약 시간 설정 |
| 192 | 216 |
} |
| 193 |
- |
|
| 194 | 217 |
// 즉시 발송인경우 현재 시간 |
| 195 | 218 |
// 예약인 경우 위에 설정한 시간 입력 |
| 196 | 219 |
sendVO.setReqDate(sdf.format(calendar.getTime())); |
| 197 | 220 |
|
| 198 | 221 |
|
| 199 |
- |
|
| 200 |
- |
|
| 201 |
- |
|
| 202 |
- |
|
| 203 | 222 |
// step5 |
| 204 |
- // 전송 메세지 설정 kakaoSendMsg 참고 |
|
| 223 |
+ // 전송 메세지 설정 json파일 만들기 |
|
| 224 |
+ if("Y".equals(kakaoVO.getBizJsonYn())) {
|
|
| 225 |
+ String jsonStr = kakaoApiJsonSave.kakaoApiJsonSave_advc(sendVO, templateDetail); |
|
| 226 |
+ sendVO.setJsonStr(jsonStr); |
|
| 227 |
+ } |
|
| 228 |
+// log.info(" + sendVO :: [{}]", sendVO.toString());
|
|
| 205 | 229 |
|
| 206 |
- |
|
| 207 |
- |
|
| 208 |
-// kakaoSendAdvcVO.setSendType("AT");
|
|
| 209 |
- sendVO.setMsgType("8");
|
|
| 210 |
- sendVO.setUserId(kakaoVO.getUserId()); |
|
| 211 |
- |
|
| 212 |
- |
|
| 230 |
+ kakaoSendAdvcListVO.add(sendVO); |
|
| 213 | 231 |
} |
| 214 | 232 |
|
| 215 | 233 |
|
... | ... | @@ -217,6 +235,17 @@ |
| 217 | 235 |
} |
| 218 | 236 |
|
| 219 | 237 |
|
| 238 |
+ private String replYnChecker(String input) {
|
|
| 239 |
+ // #{...} 패턴을 확인하는 정규 표현식
|
|
| 240 |
+ String regex = "#\\{[^}]+\\}";
|
|
| 241 |
+ Pattern pattern = Pattern.compile(regex); |
|
| 242 |
+ Matcher matcher = pattern.matcher(input); |
|
| 243 |
+ |
|
| 244 |
+ // 패턴이 존재하면 "Y", 없으면 "N" 반환 |
|
| 245 |
+ return matcher.find() ? "Y" : "N"; |
|
| 246 |
+ } |
|
| 247 |
+ |
|
| 248 |
+ |
|
| 220 | 249 |
public Float getValidPrice(Float personalPrice, Float defaultPrice) {
|
| 221 | 250 |
return (personalPrice != null && personalPrice > 0) ? personalPrice : defaultPrice; |
| 222 | 251 |
} |
... | ... | @@ -251,25 +280,7 @@ |
| 251 | 280 |
} |
| 252 | 281 |
|
| 253 | 282 |
|
| 254 |
- /** |
|
| 255 |
- * @methodName : replaceTemplateVariables |
|
| 256 |
- * @author : 이호영 |
|
| 257 |
- * @date : 2025. 3. 12. |
|
| 258 |
- * @description : 헬퍼 메서드: 템플릿 변수 치환 |
|
| 259 |
- * @return : String |
|
| 260 |
- * @param content |
|
| 261 |
- * @param variables |
|
| 262 |
- * @return |
|
| 263 |
- */ |
|
| 264 |
- private String replaceTemplateVariables(String content, Map<String, String> variables) {
|
|
| 265 |
- String result = content; |
|
| 266 |
- for (Map.Entry<String, String> entry : variables.entrySet()) {
|
|
| 267 |
- String placeholder = entry.getKey(); |
|
| 268 |
- String value = entry.getValue(); |
|
| 269 |
- result = result.replace(placeholder, value); |
|
| 270 |
- } |
|
| 271 |
- return result; |
|
| 272 |
- } |
|
| 283 |
+ |
|
| 273 | 284 |
|
| 274 | 285 |
|
| 275 | 286 |
|
... | ... | @@ -312,8 +323,6 @@ |
| 312 | 323 |
String tempSubMagTxt = kakaoVO.getSubMsgTxt().replace("\r\n", "\n");
|
| 313 | 324 |
if(kakaoVO.getSubMsgTxtReplYn().equals("Y")) {
|
| 314 | 325 |
tempSubMagTxt = kakaoSubMagTxtRepl(tempSubMagTxt, kakaoVO, count); |
| 315 |
-// tempSubMagTxt = kakaoSubMagTxtRepl_advc(tempSubMagTxt, kakaoVO, count); |
|
| 316 |
- System.out.println("+ tempSubMagTxt :: "+ tempSubMagTxt);
|
|
| 317 | 326 |
} |
| 318 | 327 |
int bytes = tempSubMagTxt.getBytes(charset).length; |
| 319 | 328 |
|
... | ... | @@ -649,6 +658,106 @@ |
| 649 | 658 |
varValInfo = kakaoVO.getVarValList().get(count); |
| 650 | 659 |
} |
| 651 | 660 |
String jsonFileName = kakaoApiJsonSave.kakaoApiJsonSave(kakaoVO, varValInfo); |
| 661 |
+ setSendMsgVO.setBizJsonName(jsonFileName); //json 파일명 |
|
| 662 |
+ } |
|
| 663 |
+ |
|
| 664 |
+ kakaoSendList.add(setSendMsgVO); |
|
| 665 |
+ } |
|
| 666 |
+ kakaoVO.setKakaoSendList(kakaoSendList); |
|
| 667 |
+ |
|
| 668 |
+ } catch (Exception e) {
|
|
| 669 |
+ System.out.println(e.toString()); |
|
| 670 |
+ e.printStackTrace(); |
|
| 671 |
+ } |
|
| 672 |
+ |
|
| 673 |
+ return kakaoVO; |
|
| 674 |
+ } |
|
| 675 |
+ |
|
| 676 |
+ /** |
|
| 677 |
+ * @methodName : kakaoSendMsg_advc |
|
| 678 |
+ * @author : 이호영 |
|
| 679 |
+ * @date : 2025. 3. 13. |
|
| 680 |
+ * @description : kakaoSendMsg 개선 |
|
| 681 |
+ * @return : KakaoVO |
|
| 682 |
+ * @param kakaoVO |
|
| 683 |
+ * @return |
|
| 684 |
+ * @throws Exception |
|
| 685 |
+ * |
|
| 686 |
+ */ |
|
| 687 |
+ public KakaoVO kakaoSendMsg_advc(KakaoVO kakaoVO) throws Exception {
|
|
| 688 |
+ List<KakaoVO> kakaoSendList = new ArrayList<KakaoVO>(); |
|
| 689 |
+ //전체 받는사람 수량만큼 반복 확인 |
|
| 690 |
+ int callToCnt = kakaoVO.getCallToList().length; |
|
| 691 |
+ try {
|
|
| 692 |
+ for(int count =0; count < callToCnt; count++) {
|
|
| 693 |
+ |
|
| 694 |
+ KakaoVO setSendMsgVO = new KakaoVO(); |
|
| 695 |
+ |
|
| 696 |
+ setSendMsgVO.setDestPhone(kakaoVO.getCallToList()[count]); // 수신 번호 |
|
| 697 |
+ // 카카오 전송내용 설정 |
|
| 698 |
+ // 변환문자 포함(Y), 미포함(N) |
|
| 699 |
+ if(kakaoVO.getTxtReplYn().equals("Y")) {
|
|
| 700 |
+ |
|
| 701 |
+ String templateContent = kakaoSubMagTxtRepl(kakaoVO.getTemplateContent(), kakaoVO, count); |
|
| 702 |
+ setSendMsgVO.setTemplateContent(templateContent); |
|
| 703 |
+ |
|
| 704 |
+ if(kakaoVO.getTemplateEmphasizeType().equals("TEXT")) {
|
|
| 705 |
+ |
|
| 706 |
+ String title = kakaoSubMagTxtRepl(kakaoVO.getTemplateTitle(), kakaoVO, count); |
|
| 707 |
+ String subTitle = kakaoVO.getTemplateSubtitle(); |
|
| 708 |
+// title = title +"§§"+ subTitle; |
|
| 709 |
+ setSendMsgVO.setTemplateEmphasizeType(kakaoVO.getTemplateEmphasizeType()); |
|
| 710 |
+ setSendMsgVO.setTemplateTitle(title); |
|
| 711 |
+ } |
|
| 712 |
+ |
|
| 713 |
+ }else {
|
|
| 714 |
+ |
|
| 715 |
+ if(kakaoVO.getTemplateEmphasizeType().equals("TEXT")) {
|
|
| 716 |
+ |
|
| 717 |
+ String title = kakaoSubMagTxtRepl(kakaoVO.getTemplateTitle(), kakaoVO, count); |
|
| 718 |
+ String subTitle = kakaoVO.getTemplateSubtitle(); |
|
| 719 |
+// title = title +"§§"+ subTitle; |
|
| 720 |
+ setSendMsgVO.setTemplateEmphasizeType(kakaoVO.getTemplateEmphasizeType()); |
|
| 721 |
+ setSendMsgVO.setTemplateTitle(title); |
|
| 722 |
+ } |
|
| 723 |
+ |
|
| 724 |
+ // 템플릿 내용 설정 |
|
| 725 |
+ setSendMsgVO.setTemplateContent(kakaoVO.getTemplateContent()); |
|
| 726 |
+ } |
|
| 727 |
+ |
|
| 728 |
+ //대체문자 포함(Y), 미포함(N) |
|
| 729 |
+ if(kakaoVO.getSubMsgSendYn().equals("Y")) {
|
|
| 730 |
+ |
|
| 731 |
+ String charset = "euc-kr"; //문자 바이트 계산에 필요한 캐릭터 셋 : 한글 2Byte로 계산 |
|
| 732 |
+ |
|
| 733 |
+ String tempSubMagTxt = kakaoVO.getSubMsgTxt().replace("\r\n", "\n");
|
|
| 734 |
+ kakaoVO.setKakaoSubMagOrgnlTxt(tempSubMagTxt); |
|
| 735 |
+ if(kakaoVO.getSubMsgTxtReplYn().equals("Y")) {
|
|
| 736 |
+ tempSubMagTxt = kakaoSubMagTxtRepl(tempSubMagTxt, kakaoVO, count); |
|
| 737 |
+ } |
|
| 738 |
+ System.out.println("@@ 대체문자내용 : " + tempSubMagTxt);
|
|
| 739 |
+ setSendMsgVO.setSubMsgTxt(tempSubMagTxt); |
|
| 740 |
+ |
|
| 741 |
+ int FrBytes = tempSubMagTxt.getBytes(charset).length; |
|
| 742 |
+ System.out.println("@@ 대체문자길이 : " + FrBytes);
|
|
| 743 |
+ //메세지 길이가 90Byte가 초과시 MMS |
|
| 744 |
+ if(FrBytes > 90) {
|
|
| 745 |
+ setSendMsgVO.setSubMsgType("MMS");
|
|
| 746 |
+ }else {// 아니면 SMS
|
|
| 747 |
+ setSendMsgVO.setSubMsgType("SMS");
|
|
| 748 |
+ } |
|
| 749 |
+ |
|
| 750 |
+ System.out.println("@@ 대체문자타입 : " + setSendMsgVO.getSubMsgType());
|
|
| 751 |
+ } |
|
| 752 |
+ |
|
| 753 |
+ if(kakaoVO.getBizJsonYn().equals("Y")) {
|
|
| 754 |
+ kakaoVO.setDestPhone(kakaoVO.getCallToList()[count]); // 수신 번호 |
|
| 755 |
+ |
|
| 756 |
+ String[] varValInfo = null; |
|
| 757 |
+ if( kakaoVO.getVarValList().size() != 0) {
|
|
| 758 |
+ varValInfo = kakaoVO.getVarValList().get(count); |
|
| 759 |
+ } |
|
| 760 |
+ String jsonFileName = kakaoApiJsonSave.kakaoApiJsonSave(kakaoVO, varValInfo); |
|
| 652 | 761 |
// String jsonFileName = kakaoApiJsonSave.kakaoApiJsonSave_advc(kakaoVO, varValInfo); |
| 653 | 762 |
// String jsonFileName = kakaoApiJsonSave.kakaoApiJsonSave(kakaoVO, kakaoVO.getVarValList().get(count)); |
| 654 | 763 |
setSendMsgVO.setBizJsonName(jsonFileName); //json 파일명 |
--- src/main/java/itn/let/kakao/kakaoComm/kakaoApi/KakaoApiJsonSave.java
+++ src/main/java/itn/let/kakao/kakaoComm/kakaoApi/KakaoApiJsonSave.java
... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 |
import java.text.SimpleDateFormat; |
| 9 | 9 |
import java.util.Date; |
| 10 | 10 |
import java.util.List; |
| 11 |
+import java.util.Map; |
|
| 11 | 12 |
|
| 12 | 13 |
import org.json.simple.JSONArray; |
| 13 | 14 |
import org.json.simple.JSONObject; |
... | ... | @@ -18,6 +19,7 @@ |
| 18 | 19 |
import itn.com.cmm.util.StringUtil; |
| 19 | 20 |
import itn.let.kakao.kakaoComm.KakaoButtonVO; |
| 20 | 21 |
import itn.let.kakao.kakaoComm.KakaoReturnVO; |
| 22 |
+import itn.let.kakao.kakaoComm.KakaoSendAdvcVO; |
|
| 21 | 23 |
import itn.let.kakao.kakaoComm.KakaoVO; |
| 22 | 24 |
|
| 23 | 25 |
@Component |
... | ... | @@ -32,33 +34,7 @@ |
| 32 | 34 |
|
| 33 | 35 |
static String json; |
| 34 | 36 |
|
| 35 |
- public String kakaoApiJsonSave_advc(KakaoVO kakaoVO, String[] varValInfo) {
|
|
| 36 |
- // json파일 저장 |
|
| 37 |
- |
|
| 38 |
- |
|
| 39 |
- Date nowDate = new Date(); |
|
| 40 |
- SimpleDateFormat todayFrom = new SimpleDateFormat("yyyyMMdd");
|
|
| 41 |
- SimpleDateFormat timeFrom = new SimpleDateFormat("HHmmss");
|
|
| 42 |
- String jsonFileName = mjonBizJsonDir+"/"+kakaoVO.getUserId()+"/"+todayFrom.format(nowDate)+"/"+kakaoVO.getSendType(); // 아이디/날짜/타입 |
|
| 43 |
- |
|
| 44 |
- String fileName = timeFrom.format(nowDate)+"_"+kakaoVO.getDestPhone()+".json"; |
|
| 45 |
- |
|
| 46 |
- |
|
| 47 |
-// File userIdFile = new File(jsonFileName); |
|
| 48 |
-// if(!userIdFile.exists()) {
|
|
| 49 |
-// userIdFile.mkdirs(); // 없으면 하위 디렉토리 까지 생성 |
|
| 50 |
-// jsonFileName = jsonFileName +"/"+fileName; |
|
| 51 |
-// }else {
|
|
| 52 |
-// |
|
| 53 |
-// jsonFileName = jsonFileName +"/"+fileName; |
|
| 54 |
-// System.out.println("jsonFileName : "+jsonFileName);
|
|
| 55 |
-// File file1 = new File(jsonFileName); |
|
| 56 |
-// if (file1.isFile()) {
|
|
| 57 |
-// return jsonFileName; |
|
| 58 |
-// } |
|
| 59 |
-// } |
|
| 60 |
- |
|
| 61 |
- KakaoReturnVO templateDetail = kakaoApiTemplate.selectKakaoApiTemplateDetail(kakaoVO); |
|
| 37 |
+ public String kakaoApiJsonSave_advc(KakaoSendAdvcVO sendVO, KakaoReturnVO templateDetail) {
|
|
| 62 | 38 |
|
| 63 | 39 |
// 버튼리스트 JSON 생성 |
| 64 | 40 |
JSONArray buttonList = new JSONArray(); |
... | ... | @@ -86,44 +62,11 @@ |
| 86 | 62 |
JSONObject templateDetailInfo = new JSONObject(); |
| 87 | 63 |
String emphasizeType = templateDetail.getTemplateEmphasizeType(); |
| 88 | 64 |
|
| 65 |
+ |
|
| 89 | 66 |
if(emphasizeType.equals("TEXT")) {
|
| 90 |
- |
|
| 91 |
- String templateTitle = templateDetail.getTemplateTitle(); |
|
| 92 |
- if(kakaoVO.getVarNmList().size() != 0) {
|
|
| 93 |
- String[] varNm = new String[kakaoVO.getVarNmList().size()]; |
|
| 94 |
- int q=0; |
|
| 95 |
- for(String temp : kakaoVO.getVarNmList()) {
|
|
| 96 |
- temp = temp.replaceAll("\\#\\{" , "§§");
|
|
| 97 |
- temp = temp.replaceAll("\\}" , "§");
|
|
| 98 |
- varNm[q] = temp; |
|
| 99 |
- q++; |
|
| 100 |
- } |
|
| 101 |
- List<String[]> varValList = kakaoVO.getVarValList(); // value 값 |
|
| 102 |
- |
|
| 103 |
- templateTitle = templateTitle.replaceAll(String.valueOf((char)13), ""); |
|
| 104 |
- templateTitle = templateTitle.replaceAll("\\#\\{" , "§§");
|
|
| 105 |
- templateTitle = templateTitle.replaceAll("\\}" , "§");
|
|
| 106 |
- |
|
| 107 |
- for(int i=0; i < varNm.length; i++) {
|
|
| 108 |
- for(int j=0; j < varValInfo.length; j++) {
|
|
| 109 |
- if (templateTitle.indexOf(varNm[i]) > -1) {
|
|
| 110 |
- if(varValInfo[j] != null) {
|
|
| 111 |
- templateTitle = templateTitle.replaceAll(varNm[i] , StringUtil.getString(varValInfo[j])); |
|
| 112 |
- }else {
|
|
| 113 |
- templateTitle = templateTitle.replaceAll(varNm[i] , ""); |
|
| 114 |
- } |
|
| 115 |
- } |
|
| 116 |
- } |
|
| 117 |
- } |
|
| 118 |
- |
|
| 119 |
- templateDetailInfo.put("title", templateTitle);
|
|
| 120 |
- }else {
|
|
| 121 |
- templateDetailInfo.put("title", templateTitle);
|
|
| 122 |
- } |
|
| 67 |
+ templateDetailInfo.put("title", sendVO.getTemplateTitle());
|
|
| 123 | 68 |
}else if(emphasizeType.equals("IMAGE")) {
|
| 124 | 69 |
templateDetailInfo.put("msg_type", "ai");
|
| 125 |
- }else if(emphasizeType.equals("NONE")) {
|
|
| 126 |
- |
|
| 127 | 70 |
} |
| 128 | 71 |
|
| 129 | 72 |
|
... | ... | @@ -138,16 +81,8 @@ |
| 138 | 81 |
|
| 139 | 82 |
// 입력 json 데이터를 파일로 변경 |
| 140 | 83 |
String jsonStr = jo.toString(); |
| 141 |
-// System.out.println("jsonStr : "+jsonStr);
|
|
| 142 |
- |
|
| 143 |
-// File outPut = new File(jsonFileName); |
|
| 144 |
-// outPut.createNewFile(); |
|
| 145 | 84 |
|
| 146 |
-// BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outPut), "utf-8")); |
|
| 147 |
-// bw.write(jsonStr); |
|
| 148 |
-// bw.close(); |
|
| 149 |
- |
|
| 150 |
- return jsonFileName; |
|
| 85 |
+ return jsonStr; |
|
| 151 | 86 |
} |
| 152 | 87 |
|
| 153 | 88 |
public String kakaoApiJsonSave(KakaoVO kakaoVO, String[] varValInfo) {
|
--- src/main/java/itn/let/kakao/user/kakaoAt/service/impl/KakaoAlimTalkServiceImpl.java
+++ src/main/java/itn/let/kakao/user/kakaoAt/service/impl/KakaoAlimTalkServiceImpl.java
... | ... | @@ -1,6 +1,10 @@ |
| 1 | 1 |
package itn.let.kakao.user.kakaoAt.service.impl; |
| 2 | 2 |
|
| 3 |
+import java.math.BigDecimal; |
|
| 4 |
+import java.math.RoundingMode; |
|
| 3 | 5 |
import java.text.SimpleDateFormat; |
| 6 |
+import java.time.Duration; |
|
| 7 |
+import java.time.Instant; |
|
| 4 | 8 |
import java.util.ArrayList; |
| 5 | 9 |
import java.util.Calendar; |
| 6 | 10 |
import java.util.Date; |
... | ... | @@ -79,6 +83,9 @@ |
| 79 | 83 |
|
| 80 | 84 |
@Autowired |
| 81 | 85 |
private MjonCommon mjonCommon; |
| 86 |
+ |
|
| 87 |
+ @Autowired |
|
| 88 |
+ private PriceAndPoint priceAndPoint; |
|
| 82 | 89 |
|
| 83 | 90 |
//발신프로필 상태값 변경(삭제/복구 기능) |
| 84 | 91 |
@Override |
... | ... | @@ -878,22 +885,47 @@ |
| 878 | 885 |
StatusResponse statusResponse = new StatusResponse(); |
| 879 | 886 |
|
| 880 | 887 |
|
| 881 |
-/** 카카오톡 전송 기본 설정 -------------------------------------------*/ |
|
| 882 |
- |
|
| 883 |
- |
|
| 884 |
-/** 전송금액 설정 --------------------------------------------------*/ |
|
| 888 |
+/** 카카오톡 전송 설정 -------------------------------------------*/ |
|
| 885 | 889 |
List<KakaoSendAdvcVO> kakaoSendAdvcListVO = kakaoSendUtil.populateSendLists(kakaoVO, statusResponse); |
| 886 | 890 |
if (statusResponse.getStatus() != null && !statusResponse.getStatus().equals(HttpStatus.OK)) {
|
| 887 | 891 |
log.error(" + populateSendLists 처리 중 오류 발생: {}", statusResponse.getMessage());
|
| 888 | 892 |
return statusResponse; |
| 889 | 893 |
} |
| 894 |
+ |
|
| 895 |
+ // 측정할 메소드 호출 전 시간 기록 |
|
| 896 |
+ Instant start = Instant.now(); |
|
| 897 |
+/** 전송금액 확인 --------------------------------------------------*/ |
|
| 898 |
+ if (!isCashSufficient(userId, kakaoSendAdvcListVO)) {
|
|
| 899 |
+ log.error("Insufficient balance for message sending.");
|
|
| 900 |
+ return new StatusResponse(HttpStatus.BAD_REQUEST, "문자 발송에 필요한 보유 잔액이 부족 합니다."); |
|
| 901 |
+ } |
|
| 902 |
+ |
|
| 903 |
+ // 측정할 메소드 호출 후 시간 기록 |
|
| 904 |
+ Instant end = Instant.now(); |
|
| 905 |
+ |
|
| 906 |
+ log.info(" + start :: [{}]", start);
|
|
| 907 |
+ // 실행 시간 계산 (나노초, 밀리초, 초) |
|
| 908 |
+ System.out.println("메소드 실행 시간 (초): " + Duration.between(start, end).getSeconds() + " s");
|
|
| 909 |
+ System.out.println("메소드 실행 시간 (Nano): " + Duration.between(start, end).getNano() + " Nano");
|
|
| 890 | 910 |
|
| 891 | 911 |
|
| 892 | 912 |
|
| 893 | 913 |
|
| 894 | 914 |
|
| 895 |
- // step 1 |
|
| 896 |
-// List<String> idList = mjonCommon.getNextCustomMsgCId(mjonMsgSendVOList.size()); |
|
| 915 |
+ start = Instant.now(); |
|
| 916 |
+ List<String> idList = mjonCommon.getNextCustomMsgCId(kakaoSendAdvcListVO.size()); |
|
| 917 |
+ for (int i = 0; i < kakaoSendAdvcListVO.size(); i++) {
|
|
| 918 |
+ kakaoSendAdvcListVO.get(i).setMsgId(idList.get(i)); |
|
| 919 |
+ } |
|
| 920 |
+ |
|
| 921 |
+ // 측정할 메소드 호출 후 시간 기록 |
|
| 922 |
+ end = Instant.now(); |
|
| 923 |
+ |
|
| 924 |
+ log.info(" + start :: [{}]", start);
|
|
| 925 |
+ // 실행 시간 계산 (나노초, 밀리초, 초) |
|
| 926 |
+ System.out.println("메소드 실행 시간 (초): " + Duration.between(start, end).getSeconds() + " s");
|
|
| 927 |
+ System.out.println("메소드 실행 시간 (Nano): " + Duration.between(start, end).getNano() + " Nano");
|
|
| 928 |
+ kakaoSendAdvcListVO.forEach(t-> log.info(" + t.toString() :: [{}]", t.toString()) );
|
|
| 897 | 929 |
|
| 898 | 930 |
|
| 899 | 931 |
|
... | ... | @@ -910,14 +942,6 @@ |
| 910 | 942 |
|
| 911 | 943 |
|
| 912 | 944 |
|
| 913 |
- |
|
| 914 |
- |
|
| 915 |
- |
|
| 916 |
- |
|
| 917 |
-/** 카카오톡 전송 기본 설정 -------------------------------------------*/ |
|
| 918 |
- kakaoVO.setSendType("AT");
|
|
| 919 |
- kakaoVO.setMsgType("8");
|
|
| 920 |
- kakaoVO.setUserId(userId); |
|
| 921 | 945 |
|
| 922 | 946 |
|
| 923 | 947 |
|
... | ... | @@ -931,7 +955,27 @@ |
| 931 | 955 |
} |
| 932 | 956 |
|
| 933 | 957 |
|
| 934 |
- |
|
| 958 |
+ |
|
| 959 |
+ // 보유 금액이 충분한지 확인하는 메서드 |
|
| 960 |
+ private boolean isCashSufficient(String userId, List<KakaoSendAdvcVO> kakaoSendAdvcListVO) throws Exception {
|
|
| 961 |
+ |
|
| 962 |
+ |
|
| 963 |
+ String userMoney = priceAndPoint.getBefCash(userId); |
|
| 964 |
+ // 쉼표 제거 |
|
| 965 |
+ userMoney = userMoney.replace(",", "");
|
|
| 966 |
+ |
|
| 967 |
+ // 사용자 보유 금액 BigDecimal 변환 (HALF_EVEN 적용) |
|
| 968 |
+ BigDecimal befCash = new BigDecimal(userMoney).setScale(2, RoundingMode.HALF_EVEN); |
|
| 969 |
+ |
|
| 970 |
+ // 총 메시지 금액 계산 (HALF_EVEN 적용) |
|
| 971 |
+ BigDecimal totalEachPrice = kakaoSendAdvcListVO.stream() |
|
| 972 |
+ .map(msg -> new BigDecimal(String.valueOf(msg.getKakaoAtPrice()))) // 변환 오류 방지 |
|
| 973 |
+ .reduce(BigDecimal.ZERO, BigDecimal::add) |
|
| 974 |
+ .setScale(2, RoundingMode.HALF_EVEN); // 일관성 유지 |
|
| 975 |
+ |
|
| 976 |
+ // 비교 수행 |
|
| 977 |
+ return befCash.compareTo(totalEachPrice) >= 0; |
|
| 978 |
+ } |
|
| 935 | 979 |
|
| 936 | 980 |
|
| 937 | 981 |
|
--- src/main/java/itn/let/kakao/user/kakaoAt/web/KakaoAlimTalkSendController.java
+++ src/main/java/itn/let/kakao/user/kakaoAt/web/KakaoAlimTalkSendController.java
... | ... | @@ -220,8 +220,8 @@ |
| 220 | 220 |
model.addAttribute("sendPrice", kakaoSendUtil.selectSendPriceOfKakaoAtAndSmsAndMms(userId));
|
| 221 | 221 |
} |
| 222 | 222 |
|
| 223 |
-// return "web/kakao/msgdata/at/KakaoAlimtalkMsgDataView"; |
|
| 224 |
- return "web/kakao/msgdata/at/KakaoAlimtalkMsgDataView_advcbackup_20250310"; |
|
| 223 |
+ return "web/kakao/msgdata/at/KakaoAlimtalkMsgDataView"; |
|
| 224 |
+// return "web/kakao/msgdata/at/KakaoAlimtalkMsgDataView_advcbackup_20250310"; |
|
| 225 | 225 |
|
| 226 | 226 |
} |
| 227 | 227 |
|
--- src/main/java/itn/let/mjo/mjocommon/MjonCommon.java
+++ src/main/java/itn/let/mjo/mjocommon/MjonCommon.java
... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 |
import java.util.Calendar; |
| 7 | 7 |
import java.util.Date; |
| 8 | 8 |
import java.util.List; |
| 9 |
+import java.util.Map; |
|
| 9 | 10 |
|
| 10 | 11 |
import javax.annotation.Resource; |
| 11 | 12 |
|
... | ... | @@ -733,6 +734,27 @@ |
| 733 | 734 |
// log.info(" + smsBytes :: [{}]", smsBytes);
|
| 734 | 735 |
return smsBytes; |
| 735 | 736 |
} |
| 737 |
+ |
|
| 738 |
+ |
|
| 739 |
+ /** |
|
| 740 |
+ * @methodName : replaceTemplateVariables |
|
| 741 |
+ * @author : 이호영 |
|
| 742 |
+ * @date : 2025. 3. 12. |
|
| 743 |
+ * @description : 헬퍼 메서드: 템플릿 변수 치환 |
|
| 744 |
+ * @return : String |
|
| 745 |
+ * @param content |
|
| 746 |
+ * @param variables |
|
| 747 |
+ * @return |
|
| 748 |
+ */ |
|
| 749 |
+ public static String ATReplaceTemplateVariables(String content, Map<String, String> variables) {
|
|
| 750 |
+ String result = content; |
|
| 751 |
+ for (Map.Entry<String, String> entry : variables.entrySet()) {
|
|
| 752 |
+ String placeholder = entry.getKey(); |
|
| 753 |
+ String value = entry.getValue(); |
|
| 754 |
+ result = result.replace(placeholder, value); |
|
| 755 |
+ } |
|
| 756 |
+ return result; |
|
| 757 |
+ } |
|
| 736 | 758 |
|
| 737 | 759 |
|
| 738 | 760 |
|
--- src/main/java/itn/let/mjo/msgdata/web/MjonMsgDataController.java
+++ src/main/java/itn/let/mjo/msgdata/web/MjonMsgDataController.java
... | ... | @@ -2088,16 +2088,8 @@ |
| 2088 | 2088 |
|
| 2089 | 2089 |
} |
| 2090 | 2090 |
|
| 2091 |
- long startTime = System.currentTimeMillis(); // 시작 시간 측정 |
|
| 2092 |
- |
|
| 2093 | 2091 |
List<AddrVO> resultAddrList = mjonMsgDataService.selectMsgAddrListAjax(addrVO); |
| 2094 | 2092 |
|
| 2095 |
- long endTime = System.currentTimeMillis(); // 종료 시간 측정 |
|
| 2096 |
- |
|
| 2097 |
- long elapsedTime = endTime - startTime; // 소요 시간 계산 |
|
| 2098 |
- System.out.println("소요 시간: " + elapsedTime + " 밀리초");
|
|
| 2099 |
- |
|
| 2100 |
- |
|
| 2101 | 2093 |
|
| 2102 | 2094 |
modelAndView.addObject("resultAddrList", resultAddrList);
|
| 2103 | 2095 |
modelAndView.addObject("result", "success");
|
--- src/main/webapp/WEB-INF/jsp/web/kakao/msgdata/at/KakaoAlimtalkMsgDataView.jsp
+++ src/main/webapp/WEB-INF/jsp/web/kakao/msgdata/at/KakaoAlimtalkMsgDataView.jsp
... | ... | @@ -7,6 +7,8 @@ |
| 7 | 7 |
|
| 8 | 8 |
<!-- <script src="/publish/js/content.js"></script> --> |
| 9 | 9 |
<!-- 주소록관련 js --> |
| 10 |
+ |
|
| 11 |
+ |
|
| 10 | 12 |
<script type="text/javascript" defer src="<c:out value='/js/kakao/at/init.js' />"></script> |
| 11 | 13 |
<script type="text/javascript" src="<c:out value='/js/kakao/at/tabulator.js' />"></script> |
| 12 | 14 |
<script type="text/javascript" src="<c:out value='/js/kakao/at/addr.js' />"></script> |
... | ... | @@ -15,7 +17,6 @@ |
| 15 | 17 |
<script type="text/javascript" src="<c:out value='/js/common/popup.js' />"></script> |
| 16 | 18 |
<script type="text/javascript"> |
| 17 | 19 |
var loginVO = '${loginVO}';
|
| 18 |
- |
|
| 19 | 20 |
// 체크박스 동적 바인딩 |
| 20 | 21 |
$(document).on('click','.wrap01C', function(){
|
| 21 | 22 |
var total = $(".wrap01C").length;
|
... | ... | @@ -87,28 +88,52 @@ |
| 87 | 88 |
|
| 88 | 89 |
//선택삭제 버튼 클릭 이벤트 |
| 89 | 90 |
$("#select_del").on('click', function(){
|
| 90 |
- |
|
| 91 |
- if($('.wrap01C:checkbox:checked').length < 1)
|
|
| 92 |
- {
|
|
| 93 |
- alert("삭제할 연락처를 선택해주세요.!!");
|
|
| 91 |
+ |
|
| 92 |
+ |
|
| 93 |
+ if(tableL == null || tableL == ""){
|
|
| 94 |
+ |
|
| 95 |
+ alert("받는사람을 추가해 주세요.");
|
|
| 94 | 96 |
return false; |
| 97 |
+ |
|
| 95 | 98 |
} |
| 96 | 99 |
|
| 97 |
- $('.wrap01C').each(function(index, item){
|
|
| 98 |
- if($(item).is(':checked'))
|
|
| 99 |
- $(item).parent().parent().remove(); |
|
| 100 |
- }); |
|
| 101 |
- updateTotCnt(); |
|
| 100 |
+ var selectedData = tableL.getSelectedRows(); |
|
| 101 |
+ |
|
| 102 |
+ if(selectedData == "" || selectedData == null){
|
|
| 103 |
+ |
|
| 104 |
+ alert("삭제할 연락처를 선택해주세요.");
|
|
| 105 |
+ return false; |
|
| 106 |
+ |
|
| 107 |
+ // 선택한 Row 데이터 삭제하기 |
|
| 108 |
+ }else if(confirm("선택하신 받는 사람을 삭제하시겠습니까?")){
|
|
| 109 |
+ |
|
| 110 |
+ // 선택 데이터 삭제 |
|
| 111 |
+ selectedData.forEach(row => row.delete()); |
|
| 112 |
+ |
|
| 113 |
+ |
|
| 114 |
+ totRows = tableL.getRows().length; |
|
| 115 |
+ updateTotCnt(totRows); |
|
| 116 |
+ |
|
| 117 |
+ var smsTxtArea = $('#smsTxtArea').val();
|
|
| 118 |
+ |
|
| 119 |
+ //일괄변환 문구 결제금액 처리 |
|
| 120 |
+ |
|
| 121 |
+ } |
|
| 122 |
+ |
|
| 102 | 123 |
}); |
| 103 | 124 |
|
| 104 | 125 |
//선택삭제 버튼 클릭 이벤트 |
| 105 | 126 |
$("#all_del").on('click', function(){
|
| 106 |
- |
|
| 127 |
+ |
|
| 128 |
+ |
|
| 107 | 129 |
if(!confirm("받는사람 목록을 모두 삭제하시겠습니까?"))
|
| 108 | 130 |
return false; |
| 109 | 131 |
|
| 110 | 132 |
$('#wrap01_body .list_body').remove();
|
| 111 | 133 |
|
| 134 |
+ tableL.clearData(); |
|
| 135 |
+ |
|
| 136 |
+ |
|
| 112 | 137 |
$('#rowTotCnt').text(0);
|
| 113 | 138 |
$('#rowDupCnt').text(0);
|
| 114 | 139 |
}); |
... | ... | @@ -509,19 +534,13 @@ |
| 509 | 534 |
return false; |
| 510 | 535 |
} |
| 511 | 536 |
|
| 512 |
- //수신자 목록 체크 |
|
| 513 |
- if($('.phoneArea').length < 1)
|
|
| 514 |
- {
|
|
| 515 |
- alert('받는 사람 입력 후 발송해 주세요');
|
|
| 516 |
- return false; |
|
| 517 |
- } |
|
| 518 | 537 |
|
| 519 | 538 |
//수신자 목록 체크 |
| 520 |
- if($('.phoneArea').length > 500)
|
|
| 539 |
+ /* if($('.phoneArea').length > 500)
|
|
| 521 | 540 |
{
|
| 522 | 541 |
alert("최대 발송 건수는 500건 입니다.");
|
| 523 | 542 |
return false; |
| 524 |
- } |
|
| 543 |
+ } */ |
|
| 525 | 544 |
|
| 526 | 545 |
|
| 527 | 546 |
if($('#errorChk').val() === 'N'
|
... | ... | @@ -626,7 +645,13 @@ |
| 626 | 645 |
} |
| 627 | 646 |
|
| 628 | 647 |
|
| 629 |
- |
|
| 648 |
+ |
|
| 649 |
+ //수신자 목록 체크 |
|
| 650 |
+ if(dataList.length < 1) |
|
| 651 |
+ {
|
|
| 652 |
+ alert('받는 사람 입력 후 발송해 주세요');
|
|
| 653 |
+ return false; |
|
| 654 |
+ } |
|
| 630 | 655 |
|
| 631 | 656 |
|
| 632 | 657 |
// 채널 ID |
... | ... | @@ -768,22 +793,25 @@ |
| 768 | 793 |
function fn_callToListParsing(){
|
| 769 | 794 |
|
| 770 | 795 |
var dataList = []; |
| 771 |
- /* var callToList = []; |
|
| 772 |
- // excel body |
|
| 773 |
- $('.phoneArea').each(function(index, item){
|
|
| 774 |
- callToList.push($(item).text().replaceAll('\\t', ''));
|
|
| 775 |
- }); |
|
| 776 | 796 |
|
| 777 |
- $('#bizForm #callToList').val(callToList); */
|
|
| 778 |
- |
|
| 779 |
- $('.phoneArea').each(function(index, item){
|
|
| 797 |
+/* $('.phoneArea').each(function(index, item){
|
|
| 780 | 798 |
var row = {};
|
| 781 | 799 |
var value = $(item).text().replaceAll('\\t', '')
|
| 782 | 800 |
row["callToList"] = value; // 수신번호는 별도로 처리 |
| 783 | 801 |
dataList.push(row); |
| 784 | 802 |
}); |
| 803 |
+ */ |
|
| 804 |
+ |
|
| 805 |
+ // Tabulator 테이블의 데이터 가져오기 |
|
| 806 |
+ var tableData = tableL.getData(); |
|
| 785 | 807 |
|
| 786 |
- return dataList; |
|
| 808 |
+ tableData.forEach(function(row){
|
|
| 809 |
+ var dataRow = {};
|
|
| 810 |
+ dataRow["callToList"] = row.phone; // phone 필드 값을 callToList로 저장 |
|
| 811 |
+ dataList.push(dataRow); |
|
| 812 |
+ }); |
|
| 813 |
+ |
|
| 814 |
+ return dataList; |
|
| 787 | 815 |
|
| 788 | 816 |
|
| 789 | 817 |
|
... | ... | @@ -901,9 +929,9 @@ |
| 901 | 929 |
$('#smsLen').val(conLeng);
|
| 902 | 930 |
|
| 903 | 931 |
|
| 932 |
+ $('#msgLeng').html(conLeng + " / ");
|
|
| 904 | 933 |
if(conLeng > 90){
|
| 905 | 934 |
|
| 906 |
- $('#msgLeng').html(conLeng + " / ");
|
|
| 907 | 935 |
$('#limitLeng').html("2000");
|
| 908 | 936 |
$('.msg_com').html("장문");
|
| 909 | 937 |
$('#msgType').val("6"); // 메세지 타입 설정
|
... | ... | @@ -917,7 +945,6 @@ |
| 917 | 945 |
|
| 918 | 946 |
}else{
|
| 919 | 947 |
|
| 920 |
- $('#msgLeng').html(conLeng + " / ");
|
|
| 921 | 948 |
$('#limitLeng').html("90");
|
| 922 | 949 |
$('.msg_com').html("단문");
|
| 923 | 950 |
$('#msgType').val("4"); // 메세지 타입 설정
|
... | ... | @@ -930,7 +957,7 @@ |
| 930 | 957 |
} |
| 931 | 958 |
|
| 932 | 959 |
//수신목록 전체 데이터 갯수 구하기 |
| 933 |
- updateTotCnt(totRows); |
|
| 960 |
+ //updateTotCnt(totRows); |
|
| 934 | 961 |
} |
| 935 | 962 |
|
| 936 | 963 |
/** |
... | ... | @@ -1318,25 +1345,25 @@ |
| 1318 | 1345 |
</span> |
| 1319 | 1346 |
</div> |
| 1320 | 1347 |
<div class="receipt_num_midde"> |
| 1321 |
- <div class="listType list01" > |
|
| 1322 |
- <div class="list_table list_head"> |
|
| 1348 |
+ <div class="listType list01 callList_box_P"> |
|
| 1349 |
+ <!-- <div class="list_table list_head"> |
|
| 1323 | 1350 |
<div class="cb_wrap"> |
| 1324 | 1351 |
<label for="select_all" class="label"></label> |
| 1325 | 1352 |
<input type="checkbox" id="select_all"> |
| 1326 | 1353 |
</div> |
| 1327 | 1354 |
<div class="list_table_num"> |
| 1328 | 1355 |
<p>휴대폰</p> |
| 1329 |
-<!-- <img src="/publish/images/sortUp.png"> --> |
|
| 1330 |
-<!-- <img src="/publish/images/sortDown.png"> --> |
|
| 1356 |
+ <img src="/publish/images/sortUp.png"> |
|
| 1357 |
+ <img src="/publish/images/sortDown.png"> |
|
| 1331 | 1358 |
</div> |
| 1332 |
-<!-- <div class="list_table_name"> --> |
|
| 1333 |
-<!-- <p>이름</p> --> |
|
| 1334 |
-<!-- <img src="/publish/images/sortUp.png"> --> |
|
| 1335 |
-<!-- <img src="/publish/images/sortDown.png"> --> |
|
| 1336 |
-<!-- </div> --> |
|
| 1359 |
+ <div class="list_table_name"> |
|
| 1360 |
+ <p>이름</p> |
|
| 1361 |
+ <img src="/publish/images/sortUp.png"> |
|
| 1362 |
+ <img src="/publish/images/sortDown.png"> |
|
| 1363 |
+ </div> |
|
| 1337 | 1364 |
</div> |
| 1338 | 1365 |
<div class="list_body_wrap" id="wrap01_body"> |
| 1339 |
- </div> |
|
| 1366 |
+ </div> --> |
|
| 1340 | 1367 |
</div> |
| 1341 | 1368 |
<div class="put_right"> |
| 1342 | 1369 |
<div class="btn_popup_wrap spc_wrap"> |
... | ... | @@ -1648,7 +1675,9 @@ |
| 1648 | 1675 |
<!--// table --> |
| 1649 | 1676 |
</div> |
| 1650 | 1677 |
<div class="popup_btn_wrap2"> |
| 1651 |
- <button type="button" onClick="javascript:addrToList(); return false;">추가</button> |
|
| 1678 |
+ <button type="button" onClick="javascript:addrToList_advc('all'); return false;">전체추가</button>
|
|
| 1679 |
+ <button type="button" onClick="javascript:addrToList_advc('select'); return false;">선택추가</button>
|
|
| 1680 |
+<!-- <button type="button" onClick="javascript:addrToList(); return false;">추가</button> --> |
|
| 1652 | 1681 |
<button type="button" onClick="javascript:addrClose(); return false;">닫기</button> |
| 1653 | 1682 |
</div> |
| 1654 | 1683 |
<%-- 주소록 레이어 팝업 닫기 실행 코드 --%> |
--- src/main/webapp/WEB-INF/jsp/web/msgdata/MsgDataSMLView.jsp
+++ src/main/webapp/WEB-INF/jsp/web/msgdata/MsgDataSMLView.jsp
... | ... | @@ -18,9 +18,6 @@ |
| 18 | 18 |
|
| 19 | 19 |
$(document).ready(function(){
|
| 20 | 20 |
|
| 21 |
- |
|
| 22 |
- console.log("12111111111111");
|
|
| 23 |
- |
|
| 24 | 21 |
// console.log(' + $(#tabDision).val() : ',$('#tabDision').val())
|
| 25 | 22 |
// if($('#tabDision').val() == 'tab02'){
|
| 26 | 23 |
// $('#send_adYnY').prop('checked', true); // 상태 변경 및 이벤트 발생
|
--- src/main/webapp/js/MJUtill.js
+++ src/main/webapp/js/MJUtill.js
... | ... | @@ -200,6 +200,8 @@ |
| 200 | 200 |
|
| 201 | 201 |
//숫자 천단위 콤마 찍어주기 |
| 202 | 202 |
function numberWithCommas(x) {
|
| 203 |
+ console.log(' + typeof x : ',typeof x);
|
|
| 204 |
+ console.log(' + x : ',x);
|
|
| 203 | 205 |
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
| 204 | 206 |
} |
| 205 | 207 |
|
... | ... | @@ -1030,6 +1032,17 @@ |
| 1030 | 1032 |
} |
| 1031 | 1033 |
|
| 1032 | 1034 |
|
| 1035 |
+function setAllCntData(result){
|
|
| 1036 |
+ |
|
| 1037 |
+ console.log('result :: ', result);
|
|
| 1038 |
+ // 합쳐진 데이터를 tableL에 설정합니다. |
|
| 1039 |
+ tableL.setData(result.uniqueArray); |
|
| 1040 |
+ // 중복데이터 건수 입력 |
|
| 1041 |
+ setRowDupCnt(result.duplicateCount); |
|
| 1042 |
+ |
|
| 1043 |
+ $('#rowTotCnt').text(result.uniqueCount)
|
|
| 1044 |
+} |
|
| 1045 |
+ |
|
| 1033 | 1046 |
function validateRowLimit(totalRows, limit = 300000) {
|
| 1034 | 1047 |
// 값과 타입 확인 |
| 1035 | 1048 |
|
--- src/main/webapp/js/kakao/at/addr.js
+++ src/main/webapp/js/kakao/at/addr.js
... | ... | @@ -101,6 +101,7 @@ |
| 101 | 101 |
} |
| 102 | 102 |
|
| 103 | 103 |
//주소록 불러오기에서 수신자 리스트 추가해 주기 |
| 104 |
+/* |
|
| 104 | 105 |
function addrToList(){
|
| 105 | 106 |
|
| 106 | 107 |
var selectedData = tableAddr.getSelectedRows(); |
... | ... | @@ -114,10 +115,10 @@ |
| 114 | 115 |
}else{ // 선택한 Row 데이터 저장해주기
|
| 115 | 116 |
|
| 116 | 117 |
// 선택한 Row 데이터 저장해주기 |
| 117 |
- if(selectedData.length > 500){
|
|
| 118 |
- alert("최대 발송 건수는 500 입니다.");
|
|
| 119 |
- return false; |
|
| 120 |
- }else{
|
|
| 118 |
+// if(selectedData.length > 500){
|
|
| 119 |
+// alert("최대 발송 건수는 500 입니다.");
|
|
| 120 |
+// return false; |
|
| 121 |
+// }else{
|
|
| 121 | 122 |
for(var i=0; i < selectedData.length; i++){
|
| 122 | 123 |
|
| 123 | 124 |
//좌측 받는사람 리스트를 담아둔 배열에 데이터를 추가해 준다. |
... | ... | @@ -137,9 +138,67 @@ |
| 137 | 138 |
|
| 138 | 139 |
//주소록 레이어 팝업의 Tabulator 데이터 지워주기 |
| 139 | 140 |
tableAddr.clearData(); |
| 140 |
- } |
|
| 141 |
+// } |
|
| 141 | 142 |
} |
| 142 | 143 |
|
| 144 |
+} |
|
| 145 |
+*/ |
|
| 146 |
+ |
|
| 147 |
+//주소록 불러오기에서 수신자 리스트 추가해 주기 |
|
| 148 |
+function addrToList_advc(type){
|
|
| 149 |
+ |
|
| 150 |
+ |
|
| 151 |
+ // 선택된 데이터 또는 전체 데이터 변수 초기화 |
|
| 152 |
+ let selectedData = type === 'select' ? tableAddr.getSelectedRows() : tableAddr.getData(); |
|
| 153 |
+ |
|
| 154 |
+ // 데이터가 비어있으면 경고 후 종료 |
|
| 155 |
+ if (!selectedData || selectedData.length < 1) {
|
|
| 156 |
+ |
|
| 157 |
+ if(tableAddr.getDataCount() < 1){
|
|
| 158 |
+ alert("주소록을 선택해 주세요.");
|
|
| 159 |
+ }else{
|
|
| 160 |
+ alert("전화번호를 선택해 주세요.");
|
|
| 161 |
+ } |
|
| 162 |
+ |
|
| 163 |
+ return false; |
|
| 164 |
+ } |
|
| 165 |
+ |
|
| 166 |
+ |
|
| 167 |
+ // 데이터 변환 로직 |
|
| 168 |
+ const addrData = selectedData.map(row => {
|
|
| 169 |
+ const rowData = type === 'select' ? row.getData() : row; // 'select'는 행 객체에서 데이터 추출 |
|
| 170 |
+ return {
|
|
| 171 |
+ phone: removeDash(rowData.phone), |
|
| 172 |
+ }; |
|
| 173 |
+ }) |
|
| 174 |
+ .filter(row => checkHpNum(row.phone)); // 유효한 번호만 필터링; |
|
| 175 |
+ |
|
| 176 |
+ |
|
| 177 |
+ // 기존 tableL의 데이터를 가져옵니다. |
|
| 178 |
+ var existingData = tableL.getData(); |
|
| 179 |
+ // 기존 데이터와 새로운 데이터를 합칩니다. |
|
| 180 |
+ var combinedData = existingData.concat(addrData); |
|
| 181 |
+ |
|
| 182 |
+ // @ phone을 기준으로 중복 제거 및 갯수 계산 |
|
| 183 |
+ const result = removeDuplicatesAndCount(combinedData, 'phone'); |
|
| 184 |
+ |
|
| 185 |
+ |
|
| 186 |
+ |
|
| 187 |
+ // 총 30만건이 넘으면 false |
|
| 188 |
+ if (!validateRowLimit(result.uniqueCount)) {
|
|
| 189 |
+ return false; |
|
| 190 |
+ } |
|
| 191 |
+ |
|
| 192 |
+ setAllCntData(result); |
|
| 193 |
+ |
|
| 194 |
+ |
|
| 195 |
+ // 미리보기 버튼 활성화 |
|
| 196 |
+ |
|
| 197 |
+ |
|
| 198 |
+ $(".closeAddr").trigger("click");
|
|
| 199 |
+ //주소록 레이어 팝업의 Tabulator 데이터 지워주기 |
|
| 200 |
+ tableAddr.clearData(); |
|
| 201 |
+ fn_priceClclt(); |
|
| 143 | 202 |
} |
| 144 | 203 |
|
| 145 | 204 |
function loadAddrList(){
|
... | ... | @@ -150,7 +209,8 @@ |
| 150 | 209 |
*/ |
| 151 | 210 |
var data = $("#searchAddrGrpForm").serialize();
|
| 152 | 211 |
|
| 153 |
- var url = "/web/mjon/msgdata/selectMsgAddrListAjax.do"; |
|
| 212 |
+ // var url = "/web/mjon/msgdata/selectMsgAddrListAjax.do"; |
|
| 213 |
+ var url = "/web/mjon/msgdata/selectMsgAddrListAjax_advc.do"; |
|
| 154 | 214 |
|
| 155 | 215 |
$.ajax({
|
| 156 | 216 |
type: "POST", |
... | ... | @@ -159,43 +219,36 @@ |
| 159 | 219 |
dataType:'json', |
| 160 | 220 |
async: false, |
| 161 | 221 |
cache: false, |
| 162 |
- success: function (returnData, status) {
|
|
| 163 |
- console.log('returnData : ', returnData);
|
|
| 164 |
- if(status == 'success'){ // status 확인 필요한가. 석세스 안뜨면 에러 가지 않나
|
|
| 165 |
- if(returnData.result == "success"){
|
|
| 166 |
- |
|
| 167 |
- var addrList = returnData.resultAddrList; |
|
| 168 |
- var tableData = []; |
|
| 169 |
- |
|
| 170 |
- if(addrList.length == 0){
|
|
| 171 |
- |
|
| 172 |
- alert("주소록 정보가 없습니다.");
|
|
| 173 |
- tableAddr.setData(tableData); |
|
| 174 |
- return false; |
|
| 175 |
- } |
|
| 176 |
- |
|
| 177 |
- //받는사람 리스트를 담아둔 배열에 신규 추가 데이터를 추가해 준다. |
|
| 178 |
- for(var i=0; i < addrList.length; i++){
|
|
| 179 |
- |
|
| 180 |
- tableData.push({addrGroupNm: addrList[i].addrGrpNm, addrPhone: removeDash(addrList[i].addrPhoneNo) , addrName: addrList[i].addrNm, addrRep1: addrList[i].addrInfo1, addrRep2: addrList[i].addrInfo2, addrRep3: addrList[i].addrInfo3, addrRep4: addrList[i].addrInfo4});
|
|
| 181 |
- |
|
| 182 |
- } |
|
| 183 |
- |
|
| 184 |
- //우측 주소록 리스트 Tabulator에 입력해주기 |
|
| 185 |
- tableAddr.setData(tableData); |
|
| 186 |
- |
|
| 187 |
- }else{
|
|
| 188 |
- |
|
| 189 |
- alert(returnData.message); |
|
| 190 |
- return false; |
|
| 191 |
- |
|
| 192 |
- } |
|
| 193 |
- |
|
| 194 |
- } else if(status== 'fail'){
|
|
| 195 |
- alert("주소록 불러오기에 실패하였습니다. !!");
|
|
| 196 |
- } |
|
| 197 |
- }, |
|
| 198 |
- error: function (e) { alert("주소록 불러오기에 실패하였습니다."); console.log("ERROR : ", e); }
|
|
| 222 |
+ success: function (data) {
|
|
| 223 |
+ console.log('data : ', data);
|
|
| 224 |
+ if(data.status == "OK"){ // status 확인 필요한가. 석세스 안뜨면 에러 가지 않나
|
|
| 225 |
+ |
|
| 226 |
+ var addrList = data.object; |
|
| 227 |
+ |
|
| 228 |
+ if(addrList.length == 0){
|
|
| 229 |
+ |
|
| 230 |
+ alert("주소록 정보가 없습니다.");
|
|
| 231 |
+// tableAddr.setData([]); |
|
| 232 |
+ return false; |
|
| 233 |
+ } |
|
| 234 |
+ tableAddr.setData(addrList); |
|
| 235 |
+ } |
|
| 236 |
+ else |
|
| 237 |
+ {
|
|
| 238 |
+ alert("주소록 불러오기에 실패하였습니다. !!");
|
|
| 239 |
+ } |
|
| 240 |
+ }, |
|
| 241 |
+ error: function (e) {
|
|
| 242 |
+ alert("주소록 불러오기에 실패하였습니다."); console.log("ERROR : ", e);
|
|
| 243 |
+ } |
|
| 244 |
+ , beforeSend : function(xmlHttpRequest) {
|
|
| 245 |
+ //로딩창 show |
|
| 246 |
+ $('.loading_layer').addClass('active');
|
|
| 247 |
+ } |
|
| 248 |
+ , complete : function(xhr, textStatus) {
|
|
| 249 |
+ //로딩창 hide |
|
| 250 |
+ $('.loading_layer').removeClass('active');
|
|
| 251 |
+ } |
|
| 199 | 252 |
}); |
| 200 | 253 |
|
| 201 | 254 |
} |
--- src/main/webapp/js/kakao/at/alimtalkExcel.js
+++ src/main/webapp/js/kakao/at/alimtalkExcel.js
... | ... | @@ -198,6 +198,7 @@ |
| 198 | 198 |
* |
| 199 | 199 |
* */ |
| 200 | 200 |
function excelExportVarAjax(){
|
| 201 |
+ console.log(' :: excelExportVarAjax ::')
|
|
| 201 | 202 |
|
| 202 | 203 |
var data = document.getElementById('excelFile').files;
|
| 203 | 204 |
|
... | ... | @@ -245,7 +246,7 @@ |
| 245 | 246 |
//timeout: 600000, |
| 246 | 247 |
success: function (returnData, status) {
|
| 247 | 248 |
if(status == 'success'){ // status 확인 필요한가. 석세스 안뜨면 에러 가지 않나
|
| 248 |
- |
|
| 249 |
+ console.log('returnData : ', returnData);
|
|
| 249 | 250 |
if(returnData.success){
|
| 250 | 251 |
|
| 251 | 252 |
var data = returnData.data; |
... | ... | @@ -290,10 +291,10 @@ |
| 290 | 291 |
|
| 291 | 292 |
var totalDuplCnt = $('#rowDupCnt').text();//중복 건수 정보
|
| 292 | 293 |
var $excelBody = $('#excelBody02');
|
| 293 |
- var bodyData; |
|
| 294 | 294 |
var addDiv = ""; |
| 295 | 295 |
var phoneNum; |
| 296 | 296 |
|
| 297 |
+ var msgCnt = 0; |
|
| 297 | 298 |
//입력데이터를 역정렬해준다. |
| 298 | 299 |
data.reverse(); |
| 299 | 300 |
|
... | ... | @@ -337,6 +338,7 @@ |
| 337 | 338 |
|
| 338 | 339 |
if(lengthCheck){
|
| 339 | 340 |
addDiv += excelBody; |
| 341 |
+ msgCnt++; |
|
| 340 | 342 |
} |
| 341 | 343 |
|
| 342 | 344 |
} |
... | ... | @@ -359,6 +361,9 @@ |
| 359 | 361 |
|
| 360 | 362 |
//화면에 수신번호 및 변수 데이터 추가해 주기 |
| 361 | 363 |
$excelBody.append(addDiv); |
| 364 |
+ |
|
| 365 |
+ // 총 금액 계산 |
|
| 366 |
+ fn_priceClclt(msgCnt); |
|
| 362 | 367 |
|
| 363 | 368 |
} |
| 364 | 369 |
|
--- src/main/webapp/js/kakao/at/init.js
+++ src/main/webapp/js/kakao/at/init.js
... | ... | @@ -12,6 +12,8 @@ |
| 12 | 12 |
* |
| 13 | 13 |
* |
| 14 | 14 |
*/ |
| 15 |
+ |
|
| 16 |
+ |
|
| 15 | 17 |
$(document).ready(function(){
|
| 16 | 18 |
|
| 17 | 19 |
|
--- src/main/webapp/js/kakao/at/priceClclt.js
+++ src/main/webapp/js/kakao/at/priceClclt.js
... | ... | @@ -70,8 +70,6 @@ |
| 70 | 70 |
fn_priceClclt(); |
| 71 | 71 |
}); |
| 72 | 72 |
|
| 73 |
- |
|
| 74 |
- |
|
| 75 | 73 |
|
| 76 | 74 |
// 대상 노드에 감시자 전달 |
| 77 | 75 |
observer_wrap01.observe(target01, option); |
... | ... | @@ -85,18 +83,24 @@ |
| 85 | 83 |
/** |
| 86 | 84 |
* @description 금액 계산 function |
| 87 | 85 |
*/ |
| 88 |
-function fn_priceClclt(){
|
|
| 86 |
+function fn_priceClclt(phoneSu = 0){
|
|
| 89 | 87 |
|
| 90 |
- // 미리보기 텍스트 |
|
| 91 |
- var templateHtml = $('#smsTxtArea').val();
|
|
| 92 |
- // var templateHtml = $('.template_text').html();
|
|
| 93 |
- |
|
| 94 |
- // 수신 번호 개수 |
|
| 95 |
- var phoneSu = $('.phoneArea').length;
|
|
| 88 |
+ console.log(":: at fn_priceClclt :: ");
|
|
| 89 |
+ // 미리보기 텍스트 |
|
| 90 |
+ var templateHtml = $('#smsTxtArea').val();
|
|
| 91 |
+ // var templateHtml = $('.template_text').html();
|
|
| 92 |
+ |
|
| 93 |
+ // 치환문자 여부 확인 |
|
| 94 |
+ var txtReplYn = $('#txtReplYn').val()
|
|
| 95 |
+ console.log('txtReplYn : ', txtReplYn);
|
|
| 96 |
+ |
|
| 97 |
+ // 수신 번호 개수 |
|
| 98 |
+ if(phoneSu == 0 && txtReplYn == 'Y') |
|
| 99 |
+ phoneSu = $('.phoneArea').length;
|
|
| 100 |
+ if(phoneSu == 0 && txtReplYn == 'N') |
|
| 101 |
+ phoneSu = tableL.getData().length; |
|
| 96 | 102 |
// 대체문자 있는지 확인 |
| 97 | 103 |
var isSendFailChecked = $("#send_fail_check").is(":checked");
|
| 98 |
- // 치환문자 여부 확인 |
|
| 99 |
- var txtReplYn = $('#txtReplYn').val()
|
|
| 100 | 104 |
// 대체문자 하위에 장문 / 단문 select |
| 101 | 105 |
var msgTypeText = $('.msg_com').text().trim();
|
| 102 | 106 |
|
... | ... | @@ -212,8 +216,8 @@ |
| 212 | 216 |
if(msgTypeText == '단문') price = SHORT_PRICE * phoneSu; |
| 213 | 217 |
else if(msgTypeText == '장문') price = LONG_PRICE * phoneSu; |
| 214 | 218 |
else price = KAKAO_AT_PRICE * phoneSu; // 카카오 |
| 215 |
- |
|
| 216 |
- $('#totalPriceTxt').text((price).toFixed(1));
|
|
| 219 |
+ |
|
| 220 |
+ $('#totalPriceTxt').text(numberWithCommas((price).toFixed(1)));
|
|
| 217 | 221 |
} |
| 218 | 222 |
|
| 219 | 223 |
|
--- src/main/webapp/js/kakao/at/tabulator.js
+++ src/main/webapp/js/kakao/at/tabulator.js
... | ... | @@ -12,83 +12,41 @@ |
| 12 | 12 |
* |
| 13 | 13 |
* |
| 14 | 14 |
*/ |
| 15 |
- |
|
| 15 |
+var tableL = null; |
|
| 16 | 16 |
$(document).ready(function (){
|
| 17 |
- /** |
|
| 18 | 17 |
//받는사람 연락처 내용 처리 |
| 19 | 18 |
//Tabulator AJAX Data Loading |
| 20 |
- tableL = new Tabulator(".callList_box", {
|
|
| 19 |
+ tableL = new Tabulator(".callList_box_P", {
|
|
| 21 | 20 |
height:"255px", |
| 22 |
- layout:"fitColumns", |
|
| 23 |
- //data:tabledata, |
|
| 24 |
- //autoColumns:true, |
|
| 21 |
+ layout:"fitColumns", |
|
| 22 |
+ headerHozAlign:"center", |
|
| 23 |
+ validationMode:"highlight", |
|
| 25 | 24 |
headerHozAlign:"center", |
| 26 | 25 |
validationMode:"highlight", |
| 27 |
- //clipboard:false, |
|
| 28 |
- //clipboardCopySelector:"table", |
|
| 29 |
- //clipboardPasteAction:"insert", // insert, update, replace |
|
| 30 | 26 |
placeholder:"복사(Ctrl+C)한 내용을 여기에 붙여넣기(Ctrl+V) 해주세요.", //fit columns to width of table (optional) |
| 31 | 27 |
resizableColumns:false, |
| 28 |
+ columnDefaults:{ // 공통설정
|
|
| 29 |
+ hozAlign: "center", |
|
| 30 |
+ headerHozAlign: "center", |
|
| 31 |
+ editor: "input", |
|
| 32 |
+ editor: false |
|
| 33 |
+ }, |
|
| 32 | 34 |
columns:[ //Define Table Columns |
| 33 |
- {formatter:"rowSelection", titleFormatter:"rowSelection",clipboard:false, hozAlign:"center", headerSort:false, cellClick:function(e, cell){
|
|
| 35 |
+ {formatter:"rowSelection", titleFormatter:"rowSelection", width:60, clipboard:false, hozAlign:"center", headerSort:false, cellClick:function(e, cell){
|
|
| 34 | 36 |
cell.getRow().toggleSelect(); |
| 35 | 37 |
}}, |
| 36 |
- {title:"이름", hozAlign:"center", field:"name", editor:"input", validator:["maxLength:12"], cellEdited:function(cell){
|
|
| 37 |
- //cell - cell component |
|
| 38 |
- fnReplCell(); |
|
| 39 |
- }}, |
|
| 40 |
- {title:"휴대폰", hozAlign:"center", field:"phone", editor:"input", width:100, validator:["required","minLength:10", "maxLength:12"], cellEdited:function(cell){
|
|
| 38 |
+// {title:"이름", hozAlign:"center", field:"name", editor:"input", validator:["maxLength:12"], cellEdited:function(cell){
|
|
| 39 |
+// //cell - cell component |
|
| 40 |
+// fnReplCell(); |
|
| 41 |
+// }}, |
|
| 42 |
+ {title:"휴대폰", hozAlign:"center", field:"phone", editor:"input", validator:["required","minLength:10", "maxLength:12"], cellEdited:function(cell){
|
|
| 41 | 43 |
//cell - cell component |
| 42 | 44 |
fnDuplPhone(); |
| 43 | 45 |
}}, |
| 44 |
- {title:"[*1*]", hozAlign:"center", field:"rep1", editor:"input", minWidth:60, validator:["maxLength:40"], cellEdited:function(cell){
|
|
| 45 |
- //cell - cell component |
|
| 46 |
- fnReplCell(); |
|
| 47 |
- }}, |
|
| 48 |
- {title:"[*2*]", hozAlign:"center", field:"rep2", editor:"input", minWidth:60, validator:["maxLength:40"], cellEdited:function(cell){
|
|
| 49 |
- //cell - cell component |
|
| 50 |
- fnReplCell(); |
|
| 51 |
- }}, |
|
| 52 |
- {title:"[*3*]", hozAlign:"center", field:"rep3", editor:"input", minWidth:60, validator:["maxLength:40"], cellEdited:function(cell){
|
|
| 53 |
- //cell - cell component |
|
| 54 |
- fnReplCell(); |
|
| 55 |
- }}, |
|
| 56 |
- {title:"[*4*]", hozAlign:"center", field:"rep4", editor:"input", minWidth:60, validator:["maxLength:40"], cellEdited:function(cell){
|
|
| 57 |
- //cell - cell component |
|
| 58 |
- fnReplCell(); |
|
| 59 |
- }}, |
|
| 60 |
- |
|
| 61 |
- ], |
|
| 62 |
- validationFailed:function(cell, value, parameters){ // 유효성 체크 함수 - 아직 잘 모르겠음
|
|
| 63 |
- //take action on validation fail |
|
| 64 |
- var valid = cell.isValid(); |
|
| 65 |
- var fieldNm = cell.getField(); |
|
| 66 |
- var cellVal = cell.getValue(); |
|
| 67 |
- var returnVal = ""; |
|
| 68 |
- if(!valid){
|
|
| 69 |
- |
|
| 70 |
- if(fieldNm == "name"){
|
|
| 71 |
- alert("받는사람 이름은 최대 12글자까지만 입력 가능합니다.");
|
|
| 72 |
- cell.setValue(strMaxLengthSubstring(cellVal, 11)); //스크립트 함수가 0부터 시작이므로 원하는 글자수 -1을 해줘야한다. |
|
| 73 |
- cell.clearValidation(); |
|
| 74 |
- }else if(fieldNm == "phone"){
|
|
| 75 |
- alert("휴대폰번호는 하이픈(-)을 제외한 숫자만 정확히 입력해 주세요.");
|
|
| 76 |
- }else{
|
|
| 77 |
- alert("치환문자를 정확히 입력해 주세요. 40글자 이내로 입력 가능합니다.");
|
|
| 78 |
- cell.setValue(strMaxLengthSubstring(cellVal, 39)); |
|
| 79 |
- cell.clearValidation(); |
|
| 80 |
- } |
|
| 81 |
- |
|
| 82 |
- //해당 셀 데이터 삭제 |
|
| 83 |
- //cell.setValue("");
|
|
| 84 |
- |
|
| 85 |
- } |
|
| 86 |
- return value % parameters.phone; |
|
| 87 |
- }, |
|
| 46 |
+ ] |
|
| 88 | 47 |
|
| 89 | 48 |
}); |
| 90 | 49 |
|
| 91 |
- */ |
|
| 92 | 50 |
//주소록 불러오기 팝업 내용 |
| 93 | 51 |
//Tabulator AJAX Data Loading |
| 94 | 52 |
tableAddr = new Tabulator(".callAddr_box", {
|
... | ... | @@ -104,8 +62,8 @@ |
| 104 | 62 |
} |
| 105 | 63 |
}, |
| 106 | 64 |
{title:"그룹명", hozAlign:"center", field:"addrGroupNm", widthGrow: 3, editor:"input", validator:["required","minLength:2", "maxLength:40"]},
|
| 107 |
- {title:"이름", hozAlign:"center", field:"addrName", widthGrow: 2, editor:"input", validator:["maxLength:12"]},
|
|
| 108 |
- {title:"휴대폰번호", hozAlign:"center", field:"addrPhone", widthGrow: 3, editor:"input", validator:["required","minLength:10", "maxLength:11"]},
|
|
| 65 |
+ {title:"이름", hozAlign:"center", field:"name", widthGrow: 2, editor:"input", validator:["maxLength:12"]},
|
|
| 66 |
+ {title:"휴대폰번호", hozAlign:"center", field:"phone", widthGrow: 3, editor:"input", validator:["required","minLength:10", "maxLength:11"]},
|
|
| 109 | 67 |
|
| 110 | 68 |
], |
| 111 | 69 |
validationFailed:function(cell, value, parameters){ // 유효성 체크 함수 - 아직 잘 모르겠음
|
... | ... | @@ -132,53 +90,32 @@ |
| 132 | 90 |
//받는사람 번호 버튼 클릭시 Tabulator에 데이터 넣어주기 |
| 133 | 91 |
$('.addCallToF').click(function(){
|
| 134 | 92 |
|
| 135 |
- var callToNum = $('#callTo').val();
|
|
| 136 |
- if(callToNum == null || callToNum == ""){
|
|
| 137 |
- |
|
| 138 |
- alert("받는사람 번호를 입력해 주세요.");
|
|
| 139 |
- return false; |
|
| 140 |
- |
|
| 141 |
- }else if(!checkHpNum(callToNum)){
|
|
| 142 |
- |
|
| 143 |
- alert("올바른 전화번호를 입력해 주세요.");
|
|
| 144 |
- $('#callTo').val("");
|
|
| 145 |
- return false; |
|
| 146 |
- } |
|
| 147 |
- |
|
| 148 |
- //핸드폰 번호에 '-' 문자 제거하기 |
|
| 149 |
- callToNum = removeDash(callToNum); |
|
| 93 |
+ // checkHpNum(callToNum) |
|
| 94 |
+ |
|
| 95 |
+ |
|
| 150 | 96 |
|
| 151 |
- var dpCnt = 0; |
|
| 152 |
- $(".phoneArea p").each(function(index, item){
|
|
| 153 |
- if(this.textContent == callToNum){
|
|
| 154 |
- |
|
| 155 |
- dpCnt++; |
|
| 156 |
- |
|
| 157 |
- alert("받는사람 리스트에 동일한 연락처가 있습니다.");
|
|
| 158 |
- $('#callTo').val("");
|
|
| 159 |
- return false; |
|
| 160 |
- } |
|
| 161 |
- }); |
|
| 162 |
- |
|
| 163 |
- if(dpCnt > 0){
|
|
| 164 |
- alert("받는사람 리스트에 동일한 연락처가 있습니다.");
|
|
| 165 |
- $('#callTo').val("");
|
|
| 166 |
- return false; |
|
| 167 |
- }else{
|
|
| 168 |
- // fn_displayJsonToHtmlTable 재사용을 위한 |
|
| 169 |
- // 파라미터 형변환 |
|
| 170 |
- var data =[]; |
|
| 171 |
- data.push({ phone: callToNum, name: ''});
|
|
| 172 |
- fn_displayJsonToHtmlTable(data); |
|
| 173 |
- |
|
| 174 |
- /* |
|
| 175 |
- * 토탈 카운트 화면에 노출 |
|
| 176 |
- */ |
|
| 177 |
- updateTotCnt(); |
|
| 178 |
- |
|
| 179 |
- // 번호 추가란 초기화 |
|
| 180 |
- $('#callTo').val('');
|
|
| 181 |
- } |
|
| 97 |
+ var textarea = $('#callTo');
|
|
| 98 |
+ const numbers = textarea.val().split('\n')
|
|
| 99 |
+ .map(num => removeDash(num.trim())) |
|
| 100 |
+ .filter(num => num !== "") |
|
| 101 |
+ .filter(num => checkHpNum(num)); // 유효한 번호만 필터링; |
|
| 102 |
+ |
|
| 103 |
+ |
|
| 104 |
+ |
|
| 105 |
+ const formattedData = numbers.map(num => ({phone: num}));
|
|
| 106 |
+ |
|
| 107 |
+ // 기존 tableL의 데이터를 가져옵니다. |
|
| 108 |
+ var existingData = tableL.getData(); |
|
| 109 |
+ // 기존 데이터와 새로운 데이터를 합칩니다. |
|
| 110 |
+ var combinedData = existingData.concat(formattedData); |
|
| 111 |
+ |
|
| 112 |
+ // @ phone을 기준으로 중복 제거 및 갯수 계산 |
|
| 113 |
+ const result = removeDuplicatesAndCount(combinedData, 'phone'); |
|
| 114 |
+ |
|
| 115 |
+ setAllCntData(result); |
|
| 116 |
+ |
|
| 117 |
+ textarea.val('');
|
|
| 118 |
+ fn_priceClclt(); |
|
| 182 | 119 |
}); |
| 183 | 120 |
|
| 184 | 121 |
|
... | ... | @@ -442,9 +379,9 @@ |
| 442 | 379 |
* 토탈 카운트 화면에 노출 |
| 443 | 380 |
* 변수 없는 리스트만 체크 |
| 444 | 381 |
*/ |
| 445 |
-function updateTotCnt(){
|
|
| 382 |
+function updateTotCnt(cnt){
|
|
| 446 | 383 |
|
| 447 |
- $("#rowTotCnt").text($('#wrap01_body .list_body').length);
|
|
| 384 |
+ $("#rowTotCnt").text(cnt);
|
|
| 448 | 385 |
|
| 449 | 386 |
} |
| 450 | 387 |
|
... | ... | @@ -456,10 +393,10 @@ |
| 456 | 393 |
return; |
| 457 | 394 |
} |
| 458 | 395 |
|
| 459 |
- if(taData.length > 500){
|
|
| 460 |
- alert("최대 발송 건수는 500건 입니다.");
|
|
| 461 |
- return; |
|
| 462 |
- } |
|
| 396 |
+// if(taData.length > 500){
|
|
| 397 |
+// alert("최대 발송 건수는 500건 입니다.");
|
|
| 398 |
+// return; |
|
| 399 |
+// } |
|
| 463 | 400 |
|
| 464 | 401 |
|
| 465 | 402 |
/* |
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?