문자전송 로직 리펙토링 중
This commit is contained in:
parent
07800e4543
commit
b7fe16bddf
@ -3241,267 +3241,262 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
@Override
|
||||
public StatusResponse sendMsgData_advc(MjonMsgVO mjonMsgVO, HttpServletRequest request) throws Exception {
|
||||
|
||||
String resultSts = "0";
|
||||
String resultBlockSts = "0";
|
||||
String userId = "";
|
||||
|
||||
|
||||
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
|
||||
userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
|
||||
|
||||
if(userId.equals("")) {
|
||||
// Map<String, String> returnMap = new HashMap<>();
|
||||
// returnMap.put("message", "로그인 후 이용이 가능합니다.");
|
||||
// returnMap.put("result", "loginFail");
|
||||
// returnMap.put("resultSts", resultSts);
|
||||
return new StatusResponse(HttpStatus.BAD_REQUEST, "로그인 후 이용이 가능합니다.");
|
||||
}
|
||||
|
||||
mjonMsgVO.setUserId(userId);
|
||||
|
||||
//발신번호가 등록된 유효한 번호인지 확인
|
||||
int sendCallFromCnt = mjonMsgDAO.selectCallFromNumberChk(mjonMsgVO);
|
||||
log.info("sendCallFromCnt :: [{}]", sendCallFromCnt);
|
||||
if(sendCallFromCnt < 1) {
|
||||
return new StatusResponse(HttpStatus.BAD_REQUEST, "등록된 발신번호를 찾을 수 없습니다.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원 정지된 상태이면 문자 발송이 안되도록 처리함
|
||||
* 현재 로그인 세션도 만료 처리함
|
||||
* */
|
||||
boolean mberSttus = userManageService.selectUserStatusInfo(userId);
|
||||
if(!mberSttus) {
|
||||
request.getSession().invalidate();
|
||||
// UNAUTHORIZED : 인증되지 않은 사용자가 접근하려고 할 때
|
||||
return new StatusResponse(HttpStatus.UNAUTHORIZED, "현재 고객님께서는 문자온 서비스 이용이 정지된 상태로 문자를 발송하실 수 없습니다. 이용정지 해제를 원하시면 고객센터로 연락주시기 바랍니다.");
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 어디에 사용하는지 모르겠음
|
||||
* //회원정보에서 스미싱 회원 여부 정보 조회
|
||||
UserManageVO userManageVO = new UserManageVO();
|
||||
|
||||
userManageVO.setMberId(userId);
|
||||
UserManageVO resultUserVO = userManageService.selectSmishingYnUserInfo(userManageVO);
|
||||
String smishingYn = resultUserVO.getSmishingYn();
|
||||
mjonMsgVO.setSmishingYn(smishingYn);
|
||||
*/
|
||||
|
||||
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);
|
||||
String resultSts = "0";
|
||||
String resultBlockSts = "0";
|
||||
String userId = "";
|
||||
|
||||
|
||||
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
|
||||
userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
|
||||
|
||||
if(userId.equals("")) {
|
||||
return new StatusResponse(HttpStatus.BAD_REQUEST, "로그인 후 이용이 가능합니다.");
|
||||
}
|
||||
|
||||
mjonMsgVO.setUserId(userId);
|
||||
|
||||
//발신번호가 등록된 유효한 번호인지 확인
|
||||
int sendCallFromCnt = mjonMsgDAO.selectCallFromNumberChk(mjonMsgVO);
|
||||
log.info("sendCallFromCnt :: [{}]", sendCallFromCnt);
|
||||
if(sendCallFromCnt < 1) {
|
||||
return new StatusResponse(HttpStatus.BAD_REQUEST, "등록된 발신번호를 찾을 수 없습니다.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원 정지된 상태이면 문자 발송이 안되도록 처리함
|
||||
* 현재 로그인 세션도 만료 처리함
|
||||
* */
|
||||
boolean mberSttus = userManageService.selectUserStatusInfo(userId);
|
||||
if(!mberSttus) {
|
||||
request.getSession().invalidate();
|
||||
// UNAUTHORIZED : 인증되지 않은 사용자가 접근하려고 할 때
|
||||
return new StatusResponse(HttpStatus.UNAUTHORIZED, "현재 고객님께서는 문자온 서비스 이용이 정지된 상태로 문자를 발송하실 수 없습니다. 이용정지 해제를 원하시면 고객센터로 연락주시기 바랍니다.");
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 어디에 사용하는지 모르겠음
|
||||
* set 후에 사용하는 곳이 없음
|
||||
* //회원정보에서 스미싱 회원 여부 정보 조회
|
||||
UserManageVO userManageVO = new UserManageVO();
|
||||
|
||||
userManageVO.setMberId(userId);
|
||||
UserManageVO resultUserVO = userManageService.selectSmishingYnUserInfo(userManageVO);
|
||||
String smishingYn = resultUserVO.getSmishingYn();
|
||||
mjonMsgVO.setSmishingYn(smishingYn);
|
||||
*/
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
//장문 메세지일 경우
|
||||
int fileCount = 0;
|
||||
if(msgType.equals("6")) {
|
||||
|
||||
//그림 이미지가 첨부된 경우
|
||||
if(mjonMsgVO.getImgFilePath() != null || mjonMsgVO.getImgFilePath().length > 0) {
|
||||
|
||||
String[] path = mjonMsgVO.getImgFilePath();
|
||||
String[] fileId = mjonMsgVO.getImgFileId();
|
||||
String[] templateYn = mjonMsgVO.getTemplateYn();
|
||||
|
||||
for(int i=0; i<path.length; i++) {
|
||||
|
||||
if("Y".equals(templateYn[i])) {
|
||||
//템플릿 사용누계 증가
|
||||
letterDAO.updateTemplateUseCount(fileId[i]);
|
||||
}
|
||||
|
||||
String imgFilePath = mjonMsgDAO.selectPhotoImgFileRealPath(fileId[i]);
|
||||
|
||||
// 아이하트, 현대퓨쳐넷 두 중계사는 이미지 경로는 풀패스 경로로 넘겨주면 됨
|
||||
switch (i) {
|
||||
case 0:
|
||||
mjonMsgVO.setFileName1(imgFilePath);
|
||||
break;
|
||||
case 1:
|
||||
mjonMsgVO.setFileName2(imgFilePath);
|
||||
break;
|
||||
default:
|
||||
mjonMsgVO.setFileName3(imgFilePath);
|
||||
break;
|
||||
}
|
||||
//장문 메세지일 경우
|
||||
int fileCount = 0;
|
||||
if(msgType.equals("6")) {
|
||||
|
||||
//그림 이미지가 첨부된 경우
|
||||
if(mjonMsgVO.getImgFilePath() != null || mjonMsgVO.getImgFilePath().length > 0) {
|
||||
|
||||
String[] path = mjonMsgVO.getImgFilePath();
|
||||
String[] fileId = mjonMsgVO.getImgFileId();
|
||||
String[] templateYn = mjonMsgVO.getTemplateYn();
|
||||
|
||||
for(int i=0; i<path.length; i++) {
|
||||
|
||||
if("Y".equals(templateYn[i])) {
|
||||
//템플릿 사용누계 증가
|
||||
letterDAO.updateTemplateUseCount(fileId[i]);
|
||||
}
|
||||
|
||||
String imgFilePath = mjonMsgDAO.selectPhotoImgFileRealPath(fileId[i]);
|
||||
|
||||
// 아이하트, 현대퓨쳐넷 두 중계사는 이미지 경로는 풀패스 경로로 넘겨주면 됨
|
||||
switch (i) {
|
||||
case 0:
|
||||
mjonMsgVO.setFileName1(imgFilePath);
|
||||
break;
|
||||
case 1:
|
||||
mjonMsgVO.setFileName2(imgFilePath);
|
||||
break;
|
||||
default:
|
||||
mjonMsgVO.setFileName3(imgFilePath);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
fileCount ++;
|
||||
}
|
||||
|
||||
//첨부파일 갯수 셋팅해주기
|
||||
mjonMsgVO.setFileCnt(Integer.toString(fileCount));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
fileCount ++;
|
||||
}
|
||||
// 파일 갯수는 있는데 파일 경로가 없는 경우 문자발송이 안되도록 튕겨내도록 함 - 20220520 우영두
|
||||
// 리펙토링 20240930 이호영
|
||||
if(fileCount > 0) {
|
||||
|
||||
//if(mjonMsgVO.getFileName1() == null && mjonMsgVO.getFileName2() == null && mjonMsgVO.getFileName3() == null) {
|
||||
|
||||
//첨부파일 갯수 셋팅해주기
|
||||
mjonMsgVO.setFileCnt(Integer.toString(fileCount));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//파일 갯수는 있는데 파일 경로가 없는 경우 문자발송이 안되도록 튕겨내도록 함 - 20220520 우영두
|
||||
if(fileCount > 0) {
|
||||
|
||||
// if(mjonMsgVO.getFileName1() == null && mjonMsgVO.getFileName2() == null && mjonMsgVO.getFileName3() == null) {
|
||||
|
||||
boolean allFilesAreNull = Stream.of(
|
||||
mjonMsgVO.getFileName1(),
|
||||
mjonMsgVO.getFileName2(),
|
||||
mjonMsgVO.getFileName3()
|
||||
).allMatch(Objects::isNull);
|
||||
|
||||
|
||||
if (allFilesAreNull) {
|
||||
return new StatusResponse(HttpStatus.NO_CONTENT
|
||||
, "문자 메세지 이미지 추가에 오류가 발생하여 문자 발송이 취소 되었습니다."
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
boolean allFilesAreNull = Stream.of(
|
||||
mjonMsgVO.getFileName1(),
|
||||
mjonMsgVO.getFileName2(),
|
||||
mjonMsgVO.getFileName3()
|
||||
).allMatch(Objects::isNull);
|
||||
|
||||
if (allFilesAreNull) {
|
||||
return new StatusResponse(HttpStatus.NO_CONTENT
|
||||
, "문자 메세지 이미지 추가에 오류가 발생하여 문자 발송이 취소 되었습니다."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 화면에서 넘어오는 단가 금액 및 총 결제 캐시 금액 체크 해주기
|
||||
* 검증을 위해서 시스템 단가, 회원 협의 단가, 이벤트 단가 정보 조회
|
||||
* 조회 단가를 이용하여 총 결제 캐시 금액 계산
|
||||
* 파라미터로 넘어온 개별단가(eachPrice), 총 결제캐시(totPrice)를 비요하여 동일하지 않으면 컨트롤러에서 계산한 금액으로 입력해줌.
|
||||
*/
|
||||
|
||||
|
||||
MjonEventVO mjonEventVO = new MjonEventVO();
|
||||
mjonEventVO.setMberId(userId);
|
||||
|
||||
//1.시스템 기본 단가 정보 불러오기
|
||||
JoinSettingVO sysJoinSetVO = mjonMsgDataService.selectJoinSettingInfo();
|
||||
|
||||
// 등급제 단가 추출 => 시스템 단가에 적용
|
||||
/*
|
||||
* 화면에서 넘어오는 단가 금액 및 총 결제 캐시 금액 체크 해주기
|
||||
* 검증을 위해서 시스템 단가, 회원 협의 단가, 이벤트 단가 정보 조회
|
||||
* 조회 단가를 이용하여 총 결제 캐시 금액 계산
|
||||
* 파라미터로 넘어온 개별단가(eachPrice), 총 결제캐시(totPrice)를 비요하여 동일하지 않으면 컨트롤러에서 계산한 금액으로 입력해줌.
|
||||
*/
|
||||
|
||||
|
||||
MjonEventVO mjonEventVO = new MjonEventVO();
|
||||
mjonEventVO.setMberId(userId);
|
||||
|
||||
//1.시스템 기본 단가 정보 불러오기
|
||||
JoinSettingVO sysJoinSetVO = mjonMsgDataService.selectJoinSettingInfo();
|
||||
|
||||
// 등급제 단가 추출 => 시스템 단가에 적용
|
||||
// sysJoinSetVO = mberGrdService.selectMberGrdDefaultInfo(sysJoinSetVO, userId);
|
||||
|
||||
//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.사용자 개인 단가 정보 불러오기
|
||||
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째자리에서 반올림하였으나, 정책 변경으로 소수점 버림 처리함
|
||||
// boolean compareEndDate = false;
|
||||
float paramEachPrice = Float.parseFloat(mjonMsgVO.getEachPrice());
|
||||
float paramEachPrice = Float.parseFloat(mjonMsgVO.getEachPrice());
|
||||
|
||||
|
||||
MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo(mjonEventVO);
|
||||
// 호출부에서 handleEventStatus를 호출하고 예외 처리를 추가
|
||||
|
||||
// 기존 컨트롤러 2352 라인
|
||||
if (eventMberInfo != null) {
|
||||
String eventEndDate = eventMberInfo.getEventEndDate();
|
||||
boolean compareEndDate = MJUtil.getCompareDate(eventEndDate);
|
||||
boolean isSuccess = handleEventStatus(eventMberInfo, paramEachPrice, mjonEventVO, compareEndDate);
|
||||
|
||||
if (!isSuccess) {
|
||||
// 예외가 발생했을 때의 리턴 처리
|
||||
return new StatusResponse(HttpStatus.INTERNAL_SERVER_ERROR, "이벤트 상태 처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
// 이벤트 진행 회원의 발송 단가 처리
|
||||
if(eventMberInfo != null && "Y".equals(eventMberInfo.getEventStatus()) && compareEndDate) {
|
||||
shortPrice = Float.parseFloat(eventMberInfo.getEventShortPrice());
|
||||
longPrice = Float.parseFloat(eventMberInfo.getEventLongPrice());
|
||||
picturePrice = Float.parseFloat(eventMberInfo.getEventPicturePrice());
|
||||
picture2Price = Float.parseFloat(eventMberInfo.getEventPicture2Price());
|
||||
picture3Price = Float.parseFloat(eventMberInfo.getEventPicture3Price());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo(mjonEventVO);
|
||||
// 호출부에서 handleEventStatus를 호출하고 예외 처리를 추가
|
||||
if (eventMberInfo != null) {
|
||||
String eventEndDate = eventMberInfo.getEventEndDate();
|
||||
boolean compareEndDate = MJUtil.getCompareDate(eventEndDate);
|
||||
boolean isSuccess = handleEventStatus(eventMberInfo, paramEachPrice, mjonEventVO, compareEndDate);
|
||||
// 토탈금액 "," 리플레이스 처리
|
||||
mjonMsgVO.setTotPrice(mjonMsgVO.getTotPrice().replaceAll(",", ""));
|
||||
|
||||
float tmpOrgEachPrice = Float.parseFloat(mjonMsgVO.getEachPrice());
|
||||
float tmpOrgTotPrice = Float.parseFloat(mjonMsgVO.getTotPrice());
|
||||
|
||||
// 각 문자 종류별 단가 설정
|
||||
float tmpEachPrice = MsgSendUtils.determinePriceByMsgType(mjonMsgVO, shortPrice, longPrice, picturePrice, picture2Price, picture3Price);
|
||||
mjonMsgVO.setEachPrice(Float.toString(tmpEachPrice));
|
||||
|
||||
// 수신자 총 수 * 단가를 통해 총 결제 금액 계산
|
||||
int tmpTotCallCnt = mjonMsgVO.getCallToList().length;
|
||||
float tmpTotPrice = tmpTotCallCnt * tmpEachPrice;
|
||||
|
||||
// 화면에서 넘어온 파라미터 개별 단가와 컨트롤러에서 계산한 단가를 비교하여 맞지 않으면 컨트롤러 계산 단가 입력
|
||||
if (tmpOrgEachPrice != tmpEachPrice) {
|
||||
mjonMsgVO.setEachPrice(Float.toString(tmpEachPrice));
|
||||
log.info("화면 : tmpOrgEachPrice ::: [{}]", tmpOrgEachPrice);
|
||||
log.info("컨트롤러 : tmpEachPrice ::: [{}]", tmpEachPrice);
|
||||
} else {
|
||||
log.info("tmpOrgEachPrice ::: [{}]", tmpOrgEachPrice);
|
||||
}
|
||||
|
||||
if (tmpOrgTotPrice != tmpTotPrice) {
|
||||
mjonMsgVO.setTotPrice(Float.toString(tmpTotPrice));
|
||||
log.info("화면 : tmpOrgTotPrice ::: [{}]", tmpOrgTotPrice);
|
||||
log.info("컨트롤러 : tmpTotPrice ::: [{}]", tmpTotPrice);
|
||||
} else {
|
||||
log.info("tmpOrgTotPrice ::: [{}]", tmpOrgTotPrice);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// 치환 여부
|
||||
////////////////////////////////////////////////
|
||||
StatusResponse statusResponse = new StatusResponse();
|
||||
if (MsgSendUtils.isReplacementRequired(mjonMsgVO)) {
|
||||
|
||||
if (!MsgSendUtils.isReplacementDataValid(mjonMsgVO)) {
|
||||
return new StatusResponse(HttpStatus.BAD_REQUEST, "특정문구 일괄변환 치환문자 데이터가 없습니다.");
|
||||
}
|
||||
|
||||
|
||||
if (!MsgSendUtils.checkReplacementDataValidity(mjonMsgVO, statusResponse)) {
|
||||
return statusResponse;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 치환 문자 리스트 생성
|
||||
ReplacementListsVO intiLists = MsgSendUtils.createReplacementLists(mjonMsgVO);
|
||||
MsgSendUtils.populateReplacementLists(mjonMsgVO ,intiLists, statusResponse);
|
||||
// 에러가 발생했는지 상태를 확인
|
||||
if (statusResponse.getStatus() == HttpStatus.BAD_REQUEST) {
|
||||
// 에러 메시지 처리
|
||||
return statusResponse;
|
||||
}
|
||||
|
||||
// 발송 처리
|
||||
statusResponse = processMessageSending(mjonMsgVO, intiLists, statusResponse);
|
||||
} else {
|
||||
// 일반 문자 발송
|
||||
statusResponse = fncSendMsg(mjonMsgVO);
|
||||
}
|
||||
|
||||
return statusResponse;
|
||||
|
||||
if (!isSuccess) {
|
||||
// 예외가 발생했을 때의 리턴 처리
|
||||
return new StatusResponse(HttpStatus.INTERNAL_SERVER_ERROR, "이벤트 상태 처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
// 이벤트 진행 회원의 발송 단가 처리
|
||||
if(eventMberInfo != null && "Y".equals(eventMberInfo.getEventStatus()) && compareEndDate) {
|
||||
shortPrice = Float.parseFloat(eventMberInfo.getEventShortPrice());
|
||||
longPrice = Float.parseFloat(eventMberInfo.getEventLongPrice());
|
||||
picturePrice = Float.parseFloat(eventMberInfo.getEventPicturePrice());
|
||||
picture2Price = Float.parseFloat(eventMberInfo.getEventPicture2Price());
|
||||
picture3Price = Float.parseFloat(eventMberInfo.getEventPicture3Price());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 토탈금액 "," 리플레이스 처리
|
||||
mjonMsgVO.setTotPrice(mjonMsgVO.getTotPrice().replaceAll(",", ""));
|
||||
|
||||
float tmpOrgEachPrice = Float.parseFloat(mjonMsgVO.getEachPrice());
|
||||
float tmpOrgTotPrice = Float.parseFloat(mjonMsgVO.getTotPrice());
|
||||
|
||||
// 각 문자 종류별 단가 설정
|
||||
float tmpEachPrice = MsgSendUtils.determinePriceByMsgType(mjonMsgVO, shortPrice, longPrice, picturePrice, picture2Price, picture3Price);
|
||||
mjonMsgVO.setEachPrice(Float.toString(tmpEachPrice));
|
||||
|
||||
// 수신자 총 수 * 단가를 통해 총 결제 금액 계산
|
||||
int tmpTotCallCnt = mjonMsgVO.getCallToList().length;
|
||||
float tmpTotPrice = tmpTotCallCnt * tmpEachPrice;
|
||||
|
||||
// 화면에서 넘어온 파라미터 개별 단가와 컨트롤러에서 계산한 단가를 비교하여 맞지 않으면 컨트롤러 계산 단가 입력
|
||||
if (tmpOrgEachPrice != tmpEachPrice) {
|
||||
mjonMsgVO.setEachPrice(Float.toString(tmpEachPrice));
|
||||
log.info("화면 : tmpOrgEachPrice ::: [{}]", tmpOrgEachPrice);
|
||||
log.info("컨트롤러 : tmpEachPrice ::: [{}]", tmpEachPrice);
|
||||
} else {
|
||||
log.info("tmpOrgEachPrice ::: [{}]", tmpOrgEachPrice);
|
||||
}
|
||||
|
||||
if (tmpOrgTotPrice != tmpTotPrice) {
|
||||
mjonMsgVO.setTotPrice(Float.toString(tmpTotPrice));
|
||||
log.info("화면 : tmpOrgTotPrice ::: [{}]", tmpOrgTotPrice);
|
||||
log.info("컨트롤러 : tmpTotPrice ::: [{}]", tmpTotPrice);
|
||||
} else {
|
||||
log.info("tmpOrgTotPrice ::: [{}]", tmpOrgTotPrice);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// 치환 여부
|
||||
////////////////////////////////////////////////
|
||||
StatusResponse statusResponse = new StatusResponse();
|
||||
if (MsgSendUtils.isReplacementRequired(mjonMsgVO)) {
|
||||
|
||||
if (!MsgSendUtils.isReplacementDataValid(mjonMsgVO)) {
|
||||
return new StatusResponse(HttpStatus.BAD_REQUEST, "특정문구 일괄변환 치환문자 데이터가 없습니다.");
|
||||
}
|
||||
|
||||
|
||||
if (!MsgSendUtils.checkReplacementDataValidity(mjonMsgVO, statusResponse)) {
|
||||
return statusResponse;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 치환 문자 리스트 생성
|
||||
ReplacementListsVO intiLists = MsgSendUtils.createReplacementLists(mjonMsgVO);
|
||||
MsgSendUtils.populateReplacementLists(mjonMsgVO ,intiLists, statusResponse);
|
||||
// 에러가 발생했는지 상태를 확인
|
||||
if (statusResponse.getStatus() == HttpStatus.BAD_REQUEST) {
|
||||
// 에러 메시지 처리
|
||||
return statusResponse;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 발송 처리
|
||||
statusResponse = processMessageSending(mjonMsgVO, intiLists, statusResponse);
|
||||
} else {
|
||||
// 일반 문자 발송
|
||||
statusResponse = fncSendMsg(mjonMsgVO);
|
||||
}
|
||||
|
||||
return statusResponse;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 그림 문자 발송 처리 메서드
|
||||
private StatusResponse processMessageSending(MjonMsgVO mjonMsgVO, ReplacementListsVO lists, StatusResponse statusResponse) {
|
||||
}
|
||||
|
||||
|
||||
// 그림 문자 발송 처리 메서드
|
||||
private StatusResponse processMessageSending(MjonMsgVO mjonMsgVO, ReplacementListsVO lists, StatusResponse statusResponse) {
|
||||
|
||||
Map<String, String> resultMap = new HashMap<String, String>();
|
||||
// 단문 문자 발송
|
||||
@ -3543,10 +3538,6 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
|
||||
statusResponse.setMessage(returnMessage);
|
||||
statusResponse.setObject(resultMap);
|
||||
// modelAndView.addObject("message", returnMessage);
|
||||
// modelAndView.addObject("result", returnStatus);
|
||||
// modelAndView.addObject("resultSts", "0");
|
||||
// modelAndView.addObject("resultBlockSts", "0");
|
||||
|
||||
return statusResponse;
|
||||
}
|
||||
@ -3556,10 +3547,6 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
Map<String, String> returnMap = new HashMap<String, String>();
|
||||
returnMap.put("msgType", mjonMsgVO.getMsgType());
|
||||
returnMap.put("msgGroupId", mjonMsgVO.getMsgGroupId());
|
||||
// returnMap.put("message", returnMessage);
|
||||
// returnMap.put("result", returnStatus);
|
||||
// returnMap.put("resultSts", resultSts);
|
||||
// returnMap.put("resultBlockSts", resultBlockSts);
|
||||
|
||||
|
||||
statusResponse.setObject(returnMap);
|
||||
@ -4273,7 +4260,7 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
// 이벤트 상태를 종료로 변경
|
||||
mjonEventVO.setEventInfoId(eventMberInfo.getEventInfoId());
|
||||
mjonEventVO.setEventStatus("E");
|
||||
mjonEventVO.setEventMemo("발송 최소 금액(" + paramEachPrice + ") 부족 혹은 이벤트 종료일 초과로 종료");
|
||||
mjonEventVO.setEventMemo("발송 최소 금액("+ paramEachPrice +") 부족 혹은 이벤트 종료일 초과되어 이벤트 종료 시킴");
|
||||
mjonEventVO.setEventRemainCash(eventRemainCash);
|
||||
mjonEventService.updateEventEndStatus(mjonEventVO);
|
||||
eventMberInfo.setEventStatus("E");
|
||||
|
||||
@ -3165,6 +3165,7 @@ public class MjonMsgDataController {
|
||||
HttpServletRequest request,
|
||||
ModelMap model) throws Exception{
|
||||
|
||||
|
||||
return ResponseEntity.ok().body(mjonMsgDataService.sendMsgData_advc(mjonMsgVO, request)) ;
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user