발송로직 진행중
This commit is contained in:
parent
666b26f568
commit
060c8afe41
@ -108,7 +108,13 @@ public class MjonMsgSendVO{
|
|||||||
private String filePath3;
|
private String filePath3;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 개별단가
|
||||||
|
*/
|
||||||
|
private String eachPrice;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,12 @@ package itn.com.cmm.util;
|
|||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -21,6 +26,8 @@ import itn.let.mail.service.StatusResponse;
|
|||||||
import itn.let.mjo.msg.service.MjonMsgVO;
|
import itn.let.mjo.msg.service.MjonMsgVO;
|
||||||
import itn.let.mjo.spammsg.web.ComGetSpamStringParser;
|
import itn.let.mjo.spammsg.web.ComGetSpamStringParser;
|
||||||
import itn.let.module.base.PriceAndPoint;
|
import itn.let.module.base.PriceAndPoint;
|
||||||
|
import itn.let.sym.site.service.JoinSettingVO;
|
||||||
|
import itn.let.uss.umt.service.MberManageVO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,7 +65,7 @@ public final class MsgSendUtils {
|
|||||||
String smsCont = smsTxt.replace("\r\n", "\n");
|
String smsCont = smsTxt.replace("\r\n", "\n");
|
||||||
smsBytes = smsCont.getBytes(charset).length;
|
smsBytes = smsCont.getBytes(charset).length;
|
||||||
}
|
}
|
||||||
log.info(" + smsBytes :: [{}]", smsBytes);
|
// log.info(" + smsBytes :: [{}]", smsBytes);
|
||||||
return smsBytes;
|
return smsBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,11 +187,37 @@ public final class MsgSendUtils {
|
|||||||
public static Boolean populateSendLists(MjonMsgVO mjonMsgVO, List<MjonMsgSendVO> mjonMsgSendListVO, StatusResponse statusResponse, List<String> resultSpamTxt) throws Exception{
|
public static Boolean populateSendLists(MjonMsgVO mjonMsgVO, List<MjonMsgSendVO> mjonMsgSendListVO, StatusResponse statusResponse, List<String> resultSpamTxt) throws Exception{
|
||||||
|
|
||||||
log.info(" :: populateSendLists :: ");
|
log.info(" :: populateSendLists :: ");
|
||||||
|
|
||||||
|
|
||||||
|
log.info(" + 예약여부 [{}]", mjonMsgVO.getReserveYn()); // 예약 여부
|
||||||
|
log.info(" + 시간 [{}]", mjonMsgVO.getReqDate()); // 시간
|
||||||
|
log.info(" + 분할체크 [{}]", mjonMsgVO.getDivideChk()); // 분할체크
|
||||||
|
log.info(" + 간격(분) [{}]", mjonMsgVO.getDivideTime()); // 간격
|
||||||
|
log.info(" + 몇 건씩 [{}]", mjonMsgVO.getDivideCnt()); // 몇 건식
|
||||||
|
|
||||||
|
|
||||||
|
// 예약 시간 기본값 설정
|
||||||
|
Date now = new Date();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
||||||
|
|
||||||
|
// ReqDate가 비어 있으면 현재 시간으로 설정, 그렇지 않으면 ReqDate로 설정
|
||||||
|
Date baseDate;
|
||||||
|
if (StringUtils.isEmpty(mjonMsgVO.getReqDate())) {
|
||||||
|
mjonMsgVO.setReqDate(sdf.format(now)); // ReqDate에 현재 시간 설정
|
||||||
|
baseDate = now;
|
||||||
|
} else {
|
||||||
|
baseDate = sdf.parse(mjonMsgVO.getReqDate()); // ReqDate를 baseDate로 설정
|
||||||
|
}
|
||||||
|
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(baseDate); // calendar에 baseDate 설정
|
||||||
|
int counter = 0; // 분할 건수 카운터
|
||||||
|
|
||||||
|
// 데이터 모두다 스팸 체크를 안하고 건별로 갯수를 정해서 스팸체크를 한다.
|
||||||
int spamChkSize = getSpamChkSize(mjonMsgSendListVO.size());
|
int spamChkSize = getSpamChkSize(mjonMsgSendListVO.size());
|
||||||
int sampleCounter = 0;
|
int sampleCounter = 0;
|
||||||
|
|
||||||
String smsTxtTemp = mjonMsgVO.getSmsTxt();
|
|
||||||
|
|
||||||
// 치환 구문과 필드 getter 매핑
|
// 치환 구문과 필드 getter 매핑
|
||||||
Map<String, Function<MjonMsgSendVO, String>> placeholders = new HashMap<>();
|
Map<String, Function<MjonMsgSendVO, String>> placeholders = new HashMap<>();
|
||||||
@ -196,6 +229,8 @@ public final class MsgSendUtils {
|
|||||||
|
|
||||||
boolean hasPerformedSpamCheck = false; // 치환 문자가 없는 경우, 스팸 체크가 한 번만 수행되도록 제어
|
boolean hasPerformedSpamCheck = false; // 치환 문자가 없는 경우, 스팸 체크가 한 번만 수행되도록 제어
|
||||||
boolean hasPerformedMsgType = false; // 치환 문자가 없는 경우, 스팸 체크가 한 번만 수행되도록 제어
|
boolean hasPerformedMsgType = false; // 치환 문자가 없는 경우, 스팸 체크가 한 번만 수행되도록 제어
|
||||||
|
|
||||||
|
String smsTxtTemp = mjonMsgVO.getSmsTxt();
|
||||||
Boolean replaceYN = getReplaceYN(smsTxtTemp);
|
Boolean replaceYN = getReplaceYN(smsTxtTemp);
|
||||||
|
|
||||||
String msgTypeResult = null;
|
String msgTypeResult = null;
|
||||||
@ -231,7 +266,6 @@ public final class MsgSendUtils {
|
|||||||
checkSpamAndSetStatus(mjonMsgVO, smsSpamChkTxt, resultSpamTxt);
|
checkSpamAndSetStatus(mjonMsgVO, smsSpamChkTxt, resultSpamTxt);
|
||||||
sampleCounter++;
|
sampleCounter++;
|
||||||
}
|
}
|
||||||
log.info(" ++ smsTxt:: [{}]", smsTxt);
|
|
||||||
sendVO.setSmsTxt(smsTxt);
|
sendVO.setSmsTxt(smsTxt);
|
||||||
|
|
||||||
// 이미지 셋팅
|
// 이미지 셋팅
|
||||||
@ -239,7 +273,6 @@ public final class MsgSendUtils {
|
|||||||
|
|
||||||
|
|
||||||
// msgType 셋팅 및 문자열 체크
|
// msgType 셋팅 및 문자열 체크
|
||||||
log.info(" + smsTxt :: [{}]", smsTxt);
|
|
||||||
if (!replaceYN && !hasPerformedMsgType) {
|
if (!replaceYN && !hasPerformedMsgType) {
|
||||||
log.info(" 치환 X ");
|
log.info(" 치환 X ");
|
||||||
// byte 체크와 msgType 구하기
|
// byte 체크와 msgType 구하기
|
||||||
@ -261,6 +294,30 @@ public final class MsgSendUtils {
|
|||||||
|
|
||||||
sendVO.setMsgType(msgTypeResult);
|
sendVO.setMsgType(msgTypeResult);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 예약 여부 확인
|
||||||
|
if ("Y".equalsIgnoreCase(mjonMsgVO.getReserveYn())) {
|
||||||
|
// 분할 발송일 경우
|
||||||
|
if ("on".equalsIgnoreCase(mjonMsgVO.getDivideChk())) {
|
||||||
|
if (counter == Integer.parseInt(mjonMsgVO.getDivideCnt())) { // 지정된 건수마다 간격 추가
|
||||||
|
counter = 0;
|
||||||
|
calendar.add(Calendar.MINUTE, Integer.parseInt(mjonMsgVO.getDivideTime()));
|
||||||
|
}
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
// 예약 시간 설정
|
||||||
|
sendVO.setReqDate(sdf.format(calendar.getTime())); // 분할된 시간 설정 또는 기본 예약 시간 사용
|
||||||
|
} else {
|
||||||
|
// 예약 여부가 N일 경우에도 기본 예약 시간 설정
|
||||||
|
sendVO.setReqDate(sdf.format(calendar.getTime()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -426,5 +483,94 @@ public final class MsgSendUtils {
|
|||||||
return array == null || array.length == 0;
|
return array == null || array.length == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setPriceforVO(MjonMsgVO mjonMsgVO, List<MjonMsgSendVO> mjonMsgSendVOList, JoinSettingVO sysJoinSetVO,
|
||||||
|
MberManageVO mberManageVO) {
|
||||||
|
|
||||||
|
// 사용자 단가 정보 설정 (협의 단가가 없을 경우 시스템 단가를 적용)
|
||||||
|
float shortPrice = MsgSendUtils.getValidPrice(mberManageVO.getShortPrice(), sysJoinSetVO.getShortPrice());
|
||||||
|
float longPrice = MsgSendUtils.getValidPrice(mberManageVO.getLongPrice(), sysJoinSetVO.getLongPrice());
|
||||||
|
float picturePrice = MsgSendUtils.getValidPrice(mberManageVO.getPicturePrice(), sysJoinSetVO.getPicturePrice());
|
||||||
|
float picture2Price = MsgSendUtils.getValidPrice(mberManageVO.getPicture2Price(), sysJoinSetVO.getPicture2Price());
|
||||||
|
float picture3Price = MsgSendUtils.getValidPrice(mberManageVO.getPicture3Price(), sysJoinSetVO.getPicture3Price());
|
||||||
|
|
||||||
|
// 각 메시지 타입에 따라 사용자 단가 설정 및 총 단가 계산
|
||||||
|
float totalPrice = 0.0f;
|
||||||
|
|
||||||
|
for (MjonMsgSendVO sendVO : mjonMsgSendVOList) {
|
||||||
|
String msgType = sendVO.getMsgType();
|
||||||
|
String eachPrice;
|
||||||
|
|
||||||
|
switch (msgType) {
|
||||||
|
case "4": // 단문 메시지 타입
|
||||||
|
eachPrice = Float.toString(shortPrice);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "6": // 장문 또는 이미지 메시지 타입
|
||||||
|
eachPrice = getPicturePrice(sendVO, longPrice, picturePrice, picture2Price, picture3Price);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// 기본값이 필요하다면 추가 가능
|
||||||
|
eachPrice = "0";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendVO.setEachPrice(eachPrice);
|
||||||
|
// log.info(" eachPrice :: [{}]", eachPrice);
|
||||||
|
|
||||||
|
// 각 가격을 합산
|
||||||
|
totalPrice += Float.parseFloat(eachPrice);
|
||||||
|
}
|
||||||
|
mjonMsgVO.setTotalPrice(totalPrice);
|
||||||
|
|
||||||
|
// log.debug("총 단가 합계: [{}]", totalPrice);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 이미지 파일 경로를 기준으로 적절한 가격을 반환하는 헬퍼 메소드.
|
||||||
|
*/
|
||||||
|
private static String getPicturePrice(MjonMsgSendVO sendVO, float longPrice, float picturePrice, float picture2Price, float picture3Price) {
|
||||||
|
if (StringUtils.isNotEmpty(sendVO.getFilePath3())) {
|
||||||
|
return Float.toString(picture3Price);
|
||||||
|
} else if (StringUtils.isNotEmpty(sendVO.getFilePath2())) {
|
||||||
|
return Float.toString(picture2Price);
|
||||||
|
} else if (StringUtils.isNotEmpty(sendVO.getFilePath1())) {
|
||||||
|
return Float.toString(picturePrice);
|
||||||
|
} else {
|
||||||
|
return Float.toString(longPrice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<MjonMsgSendVO> getOptimalMsgList(double totalPrice, double eventRemainCash,
|
||||||
|
List<MjonMsgSendVO> mjonMsgSendVOList) {
|
||||||
|
|
||||||
|
double targetCash = eventRemainCash;
|
||||||
|
|
||||||
|
// 최적의 리스트를 구성하기 위한 빈 리스트 생성
|
||||||
|
List<MjonMsgSendVO> optimalList = new ArrayList<>();
|
||||||
|
double sum = 0.0;
|
||||||
|
|
||||||
|
// 원본 리스트의 요소를 순회하며 조건에 맞는 항목을 최적 리스트에 추가
|
||||||
|
Iterator<MjonMsgSendVO> iterator = mjonMsgSendVOList.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
MjonMsgSendVO msg = iterator.next();
|
||||||
|
double eachPrice = Double.parseDouble(msg.getEachPrice());
|
||||||
|
|
||||||
|
// sum + eachPrice가 정확히 targetCash와 같거나 작을 때만 추가하고 원본에서 제거
|
||||||
|
if (sum + eachPrice <= targetCash) {
|
||||||
|
sum += eachPrice;
|
||||||
|
optimalList.add(msg);
|
||||||
|
iterator.remove(); // 원본 리스트에서 해당 요소 제거
|
||||||
|
} else {
|
||||||
|
break; // 초과하지 않도록, 더 이상 추가할 수 없는 경우 종료
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info(" + targetCash :: [{}]", targetCash);
|
||||||
|
log.info(" + sum :: [{}]", sum);
|
||||||
|
|
||||||
|
// 최적 리스트 반환
|
||||||
|
return optimalList;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,4 +38,6 @@ public interface MjonEventService {
|
|||||||
|
|
||||||
//현재 진행중 이벤트 상태 정보 불러오기
|
//현재 진행중 이벤트 상태 정보 불러오기
|
||||||
MjonEventCheckVO selectEventStatus(MjonEventCheckVO p_MjonEventCheckVO) throws Exception;
|
MjonEventCheckVO selectEventStatus(MjonEventCheckVO p_MjonEventCheckVO) throws Exception;
|
||||||
|
|
||||||
|
MjonEventVO selectEventMsgMberDefaultInfo_advc(String userId) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
package itn.let.mjo.event.service;
|
package itn.let.mjo.event.service;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
public class MjonEventVO {
|
public class MjonEventVO {
|
||||||
|
|
||||||
|
|
||||||
@ -32,220 +39,4 @@ public class MjonEventVO {
|
|||||||
private String userId; //사용자 아이디
|
private String userId; //사용자 아이디
|
||||||
private String frstRegisterId; //등록자 아이디
|
private String frstRegisterId; //등록자 아이디
|
||||||
|
|
||||||
public double getEventRemainOriginCash() {
|
|
||||||
return eventRemainOriginCash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventRemainOriginCash(double eventRemainOriginCash) {
|
|
||||||
this.eventRemainOriginCash = eventRemainOriginCash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventInfoId() {
|
|
||||||
return eventInfoId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventInfoId(String eventInfoId) {
|
|
||||||
this.eventInfoId = eventInfoId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUniqId() {
|
|
||||||
return uniqId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUniqId(String uniqId) {
|
|
||||||
this.uniqId = uniqId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMberId() {
|
|
||||||
return mberId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMberId(String mberId) {
|
|
||||||
this.mberId = mberId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMberNm() {
|
|
||||||
return mberNm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMberNm(String mberNm) {
|
|
||||||
this.mberNm = mberNm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventNttId() {
|
|
||||||
return eventNttId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventNttId(String eventNttId) {
|
|
||||||
this.eventNttId = eventNttId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventBbsId() {
|
|
||||||
return eventBbsId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventBbsId(String eventBbsId) {
|
|
||||||
this.eventBbsId = eventBbsId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventStartDate() {
|
|
||||||
return eventStartDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventStartDate(String eventStartDate) {
|
|
||||||
this.eventStartDate = eventStartDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventEndDate() {
|
|
||||||
return eventEndDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventEndDate(String eventEndDate) {
|
|
||||||
this.eventEndDate = eventEndDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getEventFrstCash() {
|
|
||||||
return eventFrstCash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventFrstCash(double eventFrstCash) {
|
|
||||||
this.eventFrstCash = eventFrstCash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getEventRemainCash() {
|
|
||||||
return eventRemainCash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventRemainCash(double eventRemainCash) {
|
|
||||||
this.eventRemainCash = eventRemainCash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventPgMoid() {
|
|
||||||
return eventPgMoid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventPgMoid(String eventPgMoid) {
|
|
||||||
this.eventPgMoid = eventPgMoid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventShortPrice() {
|
|
||||||
return eventShortPrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventShortPrice(String eventShortPrice) {
|
|
||||||
this.eventShortPrice = eventShortPrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventLongPrice() {
|
|
||||||
return eventLongPrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventLongPrice(String eventLongPrice) {
|
|
||||||
this.eventLongPrice = eventLongPrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventPicturePrice() {
|
|
||||||
return eventPicturePrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventPicturePrice(String eventPicturePrice) {
|
|
||||||
this.eventPicturePrice = eventPicturePrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventPicture2Price() {
|
|
||||||
return eventPicture2Price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventPicture2Price(String eventPicture2Price) {
|
|
||||||
this.eventPicture2Price = eventPicture2Price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventPicture3Price() {
|
|
||||||
return eventPicture3Price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventPicture3Price(String eventPicture3Price) {
|
|
||||||
this.eventPicture3Price = eventPicture3Price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventPolicyYn() {
|
|
||||||
return eventPolicyYn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventPolicyYn(String eventPolicyYn) {
|
|
||||||
this.eventPolicyYn = eventPolicyYn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventSmsYn() {
|
|
||||||
return eventSmsYn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventSmsYn(String eventSmsYn) {
|
|
||||||
this.eventSmsYn = eventSmsYn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventStatus() {
|
|
||||||
return eventStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventStatus(String eventStatus) {
|
|
||||||
this.eventStatus = eventStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventMemo() {
|
|
||||||
return eventMemo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventMemo(String eventMemo) {
|
|
||||||
this.eventMemo = eventMemo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFrstRegistPnttm() {
|
|
||||||
return frstRegistPnttm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFrstRegistPnttm(String frstRegistPnttm) {
|
|
||||||
this.frstRegistPnttm = frstRegistPnttm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLastUpdtPnttm() {
|
|
||||||
return lastUpdtPnttm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastUpdtPnttm(String lastUpdtPnttm) {
|
|
||||||
this.lastUpdtPnttm = lastUpdtPnttm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPayCount() {
|
|
||||||
return payCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPayCount(String payCount) {
|
|
||||||
this.payCount = payCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPoint() {
|
|
||||||
return point;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoint(String point) {
|
|
||||||
this.point = point;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserId(String userId) {
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFrstRegisterId() {
|
|
||||||
return frstRegisterId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFrstRegisterId(String frstRegisterId) {
|
|
||||||
this.frstRegisterId = frstRegisterId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,6 +45,14 @@ public class MjonEventServiceImpl extends EgovAbstractServiceImpl implements Mjo
|
|||||||
return mjonEventDAO.selectEventMsgMberDefaultInfo(mjonEventVO);
|
return mjonEventDAO.selectEventMsgMberDefaultInfo(mjonEventVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MjonEventVO selectEventMsgMberDefaultInfo_advc(String userId) throws Exception{
|
||||||
|
MjonEventVO mjonEventVO = new MjonEventVO();
|
||||||
|
mjonEventVO.setMberId(userId);
|
||||||
|
return mjonEventDAO.selectEventMsgMberDefaultInfo(mjonEventVO);
|
||||||
|
}
|
||||||
|
|
||||||
//등록된 이벤트 회원정보 조회
|
//등록된 이벤트 회원정보 조회
|
||||||
@Override
|
@Override
|
||||||
public int selectEventMsgMberDefaultInfoCnt(MjonEventVO mjonEventVO) throws Exception{
|
public int selectEventMsgMberDefaultInfoCnt(MjonEventVO mjonEventVO) throws Exception{
|
||||||
|
|||||||
@ -4043,38 +4043,11 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
|||||||
* 파라미터로 넘어온 개별단가(eachPrice), 총 결제캐시(totPrice)를 비요하여 동일하지 않으면 컨트롤러에서 계산한 금액으로 입력해줌.
|
* 파라미터로 넘어온 개별단가(eachPrice), 총 결제캐시(totPrice)를 비요하여 동일하지 않으면 컨트롤러에서 계산한 금액으로 입력해줌.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// int smsTxtByte = MsgSendUtils.getSmsTxtBytes(mjonMsgVO.getSmsTxt());
|
|
||||||
// if(smsTxtByte > 2000) {
|
|
||||||
// return new StatusResponse(HttpStatus.BAD_REQUEST, "문자 내용은 2000Byte를 넘을 수 없습니다.");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// MSG_TYPE 설정
|
|
||||||
// String msgType = MsgSendUtils.getMsgType(mjonMsgVO, smsTxtByte);
|
|
||||||
// if ("INVALID".equals(msgType)) {
|
|
||||||
// return new StatusResponse(HttpStatus.BAD_REQUEST, "문자 내용은 2000Byte를 넘을 수 없습니다.");
|
|
||||||
// }
|
|
||||||
// mjonMsgVO.setMsgType(msgType);
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// 금액 관련은 끝에서 이벤트 발송 / 기존금액 박송으로 나눠야하기 때문에 나중에 수정
|
// 금액 관련은 끝에서 이벤트 발송 / 기존금액 박송으로 나눠야하기 때문에 나중에 수정
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
/*
|
/*
|
||||||
//1.시스템 기본 단가 정보 불러오기
|
|
||||||
JoinSettingVO sysJoinSetVO = mjonMsgDataService.selectJoinSettingInfo();
|
|
||||||
|
|
||||||
|
|
||||||
//2.사용자 개인 단가 정보 불러오기
|
|
||||||
MberManageVO mberManageVO = mjonMsgDataDAO.selectMberManageInfo(userId);
|
|
||||||
|
|
||||||
|
|
||||||
// 3. 사용자 단가 정보 설정
|
|
||||||
//협의 단가가 없는 경우 시스템 단가 적용해 주기
|
|
||||||
float shortPrice = MsgSendUtils.getValidPrice(mberManageVO.getShortPrice(), sysJoinSetVO.getShortPrice());
|
|
||||||
float longPrice = MsgSendUtils.getValidPrice(mberManageVO.getLongPrice(), sysJoinSetVO.getLongPrice());
|
|
||||||
float picturePrice = MsgSendUtils.getValidPrice(mberManageVO.getPicturePrice(), sysJoinSetVO.getPicturePrice());
|
|
||||||
float picture2Price = MsgSendUtils.getValidPrice(mberManageVO.getPicture2Price(), sysJoinSetVO.getPicture2Price());
|
|
||||||
float picture3Price = MsgSendUtils.getValidPrice(mberManageVO.getPicture3Price(), sysJoinSetVO.getPicture3Price());
|
|
||||||
|
|
||||||
|
|
||||||
// 기존 소수점 2째자리에서 반올림하였으나, 정책 변경으로 소수점 버림 처리함
|
// 기존 소수점 2째자리에서 반올림하였으나, 정책 변경으로 소수점 버림 처리함
|
||||||
@ -4141,9 +4114,23 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
|||||||
// return statusResponse; // 유효성 검사 실패 시 처리
|
// return statusResponse; // 유효성 검사 실패 시 처리
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
log.info(" ++ mjonMsgVO.getSpamStatus() :: [{}]", mjonMsgVO.getSpamStatus());
|
// 삭제 전 리스트 크기 저장
|
||||||
|
int initialSize = mjonMsgSendVOList.size();
|
||||||
|
|
||||||
|
// 수신목록 셋팅
|
||||||
|
List<String> userBlockList = mjonMsgDAO.selectUserBlockList(mjonMsgVO);
|
||||||
|
mjonMsgSendVOList.removeIf(vo -> userBlockList.contains(vo.getPhone()));
|
||||||
|
// log.info(" !! mjonMsgSendVOList.size() :: [{}]",mjonMsgSendVOList.size());
|
||||||
|
// 삭제 후 리스트 크기 저장
|
||||||
|
int finalSize = mjonMsgSendVOList.size();
|
||||||
|
// 삭제된 건 수 계산
|
||||||
|
int deletedCount = initialSize - finalSize;
|
||||||
|
// log.info(" +삭제된 건수 :: [{}]",deletedCount);
|
||||||
|
|
||||||
|
|
||||||
|
// long startTime = System.nanoTime(); // 시작 시간 측정
|
||||||
|
|
||||||
// smstxt 치환 및 스팸체크 후 mjonMsgSendVOList 에 add()
|
// smstxt 치환 및 스팸체크 후 mjonMsgSendVOList 에 add()
|
||||||
List<String> resultSpamTxt = mjonMsgDataService.selectSpamKeywordList();
|
List<String> resultSpamTxt = mjonMsgDataService.selectSpamKeywordList();
|
||||||
if(!MsgSendUtils.populateSendLists(mjonMsgVO, mjonMsgSendVOList, statusResponse, resultSpamTxt)) {;
|
if(!MsgSendUtils.populateSendLists(mjonMsgVO, mjonMsgSendVOList, statusResponse, resultSpamTxt)) {;
|
||||||
@ -4151,31 +4138,52 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
|||||||
//문자 치환 중 오류가 발생하였습니다.
|
//문자 치환 중 오류가 발생하였습니다.
|
||||||
return statusResponse;
|
return statusResponse;
|
||||||
}
|
}
|
||||||
log.info(" ++ mjonMsgVO.getSpamStatus() :: [{}]", mjonMsgVO.getSpamStatus());
|
mjonMsgSendVOList.stream().forEach(t-> System.out.println(" + ReqDate :: "+t.getReqDate()));
|
||||||
|
|
||||||
|
// long endTime = System.nanoTime(); // 종료 시간 측정
|
||||||
|
// long duration = endTime - startTime; // 실행 시간 계산 (나노초)
|
||||||
|
|
||||||
|
// // 나노초를 초와 분으로 변환
|
||||||
|
// long seconds = duration / 1_000_000_000;
|
||||||
|
// long minutes = seconds / 60;
|
||||||
|
// seconds = seconds % 60; // 분으로 나누고 남은 초 계산
|
||||||
|
|
||||||
|
// System.out.println("Execution time: " + minutes + " minutes " + seconds + " seconds");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 수신목록 셋팅
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 수신거부 목록 불러오기
|
//1.시스템 기본 단가 정보 불러오기
|
||||||
List<String> userBlockList = mjonMsgDAO.selectUserBlockList(mjonMsgVO);
|
JoinSettingVO sysJoinSetVO = mjonMsgDataService.selectJoinSettingInfo();
|
||||||
|
//2.사용자 개인 단가 정보 불러오기
|
||||||
List<String> dupliBlockList = MJUtil.getDuplicateList(userBlockList);
|
MberManageVO mberManageVO = mjonMsgDataDAO.selectMberManageInfo(userId);
|
||||||
int usrBlockCnt = dupliBlockList.size();
|
MsgSendUtils.setPriceforVO(mjonMsgVO, mjonMsgSendVOList, sysJoinSetVO, mberManageVO);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 이벤트 영역
|
||||||
|
MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo_advc(userId);
|
||||||
|
|
||||||
|
List<MjonMsgSendVO> optimalMsgList = MsgSendUtils.getOptimalMsgList(mjonMsgVO.getTotalPrice(), eventMberInfo.getEventRemainCash(), mjonMsgSendVOList);
|
||||||
|
|
||||||
|
log.info(" + optimalMsgList :: [{}]", optimalMsgList.size());
|
||||||
|
log.info(" + mjonMsgSendVOList :: [{}]", mjonMsgSendVOList.size());
|
||||||
|
// log.info("mjonMsgVO.getTotalPrice() :: [{}]", mjonMsgVO.getTotalPrice());
|
||||||
|
|
||||||
|
// log.info(" + userId :: [{}]", userId);
|
||||||
|
// log.info(" + priceAndPoint.getBefCash(userId) :: [{}]", priceAndPoint.getBefCash(userId));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// mjonMsgSendVOList.stream().forEach(t-> System.out.println(t.getEachPrice()));
|
||||||
// mjonMsgSendVOList.stream().forEach(t-> System.out.println(t.toString()));
|
// mjonMsgSendVOList.stream().forEach(t-> System.out.println(t.toString()));
|
||||||
|
|
||||||
// mjonMsgSendVOList.stream()
|
// mjonMsgSendVOList.stream()
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package itn.let.mjo.rejt.web;
|
package itn.let.mjo.rejt.web;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -89,6 +90,52 @@ public class MjonRejectController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping(value = "/mjonRejectReceive_advc.do")
|
||||||
|
public HashMap<String, String> mjonRejectReceive_advc(@RequestBody MjonRejectVO rejectVO) throws Exception {
|
||||||
|
|
||||||
|
|
||||||
|
//ModelAndView mv = new ModelAndView();
|
||||||
|
//mv.setViewName("jsonView");
|
||||||
|
|
||||||
|
//System.out.println(rejectVO.getPhone()+"==============");
|
||||||
|
//System.out.println(rejectVO.getInsertDate()+"==============");
|
||||||
|
//System.out.println(rejectVO.getCallId()+"==============");
|
||||||
|
|
||||||
|
HashMap<String, String> map = new HashMap<String, String>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. mj_reject_log 테이블에 로그 insert
|
||||||
|
// String rejectLogId = mjonRejectService.insertRejectLog(rejectVO);
|
||||||
|
|
||||||
|
MjonBlockVO blockVO = new MjonBlockVO();
|
||||||
|
List<String> phoneNumberList = Arrays.asList(
|
||||||
|
"01083584250",
|
||||||
|
"01030266269",
|
||||||
|
"01012341234",
|
||||||
|
"01030266222",
|
||||||
|
"01012341237"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
for(String aa : phoneNumberList ) {
|
||||||
|
// blockVO.setRejectLogId(rejectLogId);
|
||||||
|
blockVO.setUserId("hylee250");
|
||||||
|
blockVO.setPhone(aa);
|
||||||
|
blockVO.setBlockType(1); // 080 수신거부
|
||||||
|
mjonBlockService.insertBlock(blockVO);
|
||||||
|
}
|
||||||
|
map.put("result", "100");
|
||||||
|
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
map.put("result", "error");
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 080수신거부 테스트 페이지
|
* 080수신거부 테스트 페이지
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import java.math.RoundingMode;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import egovframework.rte.fdl.idgnr.EgovIdGnrService;
|
import egovframework.rte.fdl.idgnr.EgovIdGnrService;
|
||||||
@ -31,7 +32,7 @@ import itn.let.uss.umt.service.MberManageVO;
|
|||||||
@Component
|
@Component
|
||||||
public class PriceAndPoint {
|
public class PriceAndPoint {
|
||||||
|
|
||||||
@Resource(name="MjonMsgDataDAO")
|
@Autowired
|
||||||
private MjonMsgDataDAO mjonMsgDataDAO;
|
private MjonMsgDataDAO mjonMsgDataDAO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1189,6 +1189,43 @@ function fn_sendMsgData(){
|
|||||||
}else{
|
}else{
|
||||||
form.msgKind.value = "N"; //일반문자 종류 설정
|
form.msgKind.value = "N"; //일반문자 종류 설정
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 예약 확인
|
||||||
|
var reserYn = $("input[name=reserYn]:checked").val(); // 예약 발송 여부 확인
|
||||||
|
form.reserveYn.value = reserYn; // 즉시 / 예약 문자 선택 여부
|
||||||
|
|
||||||
|
if(reserYn == 'Y'){
|
||||||
|
|
||||||
|
var date = $(".resDate").val();//form.msgResDate.value;
|
||||||
|
var hour = form.msgResHour.value;
|
||||||
|
var min = form.msgResMin.value;
|
||||||
|
|
||||||
|
if(date == ""){
|
||||||
|
|
||||||
|
alert("예약전송 날짜를 선택해 주세요.");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
var now = new Date();
|
||||||
|
var reqDate = date + " " + hour + ":" + min + ":00";
|
||||||
|
var gapDate = getGapDayTime(date, hour, min);
|
||||||
|
|
||||||
|
if(gapDate < 0){ // 음수이면 이전날짜, 크면 이후 날짜.
|
||||||
|
alert("예약 날짜는 현재 시간 이후의 날짜 및 시간을 선택해 주세요.");
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
form.reqDate.value = reqDate; //예약일자 파라미터 저장
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
form.reqDate.value = "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//발송 Ajax 호출해주기
|
//발송 Ajax 호출해주기
|
||||||
sendMsgAjax_advc();
|
sendMsgAjax_advc();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user