이벤트 결제관련 오류처리
This commit is contained in:
parent
73986519b6
commit
a02fffcb76
@ -9,6 +9,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import egovframework.rte.fdl.idgnr.EgovIdGnrService;
|
||||
import itn.let.mjo.event.service.MjonEventService;
|
||||
import itn.let.mjo.event.service.MjonEventVO;
|
||||
import itn.let.mjo.event.service.impl.MjonEventDAO;
|
||||
import itn.let.mjo.msg.service.MjonMsgVO;
|
||||
import itn.let.mjo.msgdata.service.impl.MjonMsgDataDAO;
|
||||
import itn.let.mjo.pay.service.MjonPayVO;
|
||||
@ -37,6 +40,9 @@ public class PriceAndPoint {
|
||||
|
||||
@Autowired
|
||||
private MjonPayDAO mjonPayDAO;
|
||||
|
||||
@Autowired
|
||||
private MjonEventService mjonEventService;
|
||||
|
||||
@Resource(name = "egovMjonCashIdGnrService")
|
||||
private EgovIdGnrService idgenMjonCashId;
|
||||
@ -119,6 +125,36 @@ public class PriceAndPoint {
|
||||
mjonPayDAO.insertCash(mjonPayVO); //캐시
|
||||
mjonPayDAO.updateMemberCash(mjonPayVO); //회원정보 업데이트
|
||||
|
||||
//이벤트 회원인 경우 이벤트 캐시도 함께 차감.
|
||||
MjonEventVO mjonEventVO = new MjonEventVO();
|
||||
mjonEventVO.setMberId(mjonPayVO.getUserId());
|
||||
mjonEventVO.setEventStatus("Y");
|
||||
MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo(mjonEventVO);
|
||||
|
||||
if(eventMberInfo != null) {
|
||||
|
||||
float evntRemainCash = (float) eventMberInfo.getEventRemainCash();
|
||||
totPrice = (float) Math.abs(mjonPayVO.getCash());
|
||||
|
||||
float totRemainCash = evntRemainCash - totPrice;
|
||||
mjonEventVO.setEventInfoId(eventMberInfo.getEventInfoId());
|
||||
|
||||
if(totRemainCash <= 0.0) {//차감액이 남아있지 않으면 이벤트를 종료
|
||||
|
||||
//이벤트 상태값을 종료로 변경한다.
|
||||
mjonEventVO.setEventStatus("E");
|
||||
mjonEventVO.setEventRemainCash(0.0);
|
||||
mjonEventService.updateEventEndStatus(mjonEventVO);
|
||||
|
||||
}else {//이벤트 회원 캐시 차감시킴
|
||||
|
||||
mjonEventVO.setEventRemainCash(totRemainCash);
|
||||
mjonEventService.updateEventRemainCash(mjonEventVO);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1067,13 +1067,35 @@ function fn_sendMsgData(){
|
||||
var eventRemainCash = parseFloat(form.eventRemainCash.value);
|
||||
console.log('eventStatus : ', eventStatus);
|
||||
|
||||
if(eventStatus == 'Y'
|
||||
&& parseFloat(eventRemainCash) < parseFloat(totPriceOnly))
|
||||
if(eventStatus == 'Y' && parseFloat(eventRemainCash) < parseFloat(totPriceOnly))
|
||||
{
|
||||
|
||||
// 이벤트 금액 부족 상태 요청하신 모두 발송할 수 없습니다
|
||||
console.log('eventRemainCash : ', eventRemainCash);
|
||||
if(!confirm("고객님의 이벤트 캐시 잔액(" + eventRemainCash + "원) 부족으로 요청하신 문자("+numberWithCommas($selectedData.length)+"건)를 모두 발송할 수 없습니다. 이벤트 캐시 초과 건에 대해서는 일반 단가를 적용하여 발송하시겠습니까?")){
|
||||
return false;
|
||||
}
|
||||
|
||||
// 이벤트 캐시 초과 건에 대해서는 일반 단가를 적용하여 발송하시겠습니까
|
||||
|
||||
var evnMsgType = $("#msgType").val(); // 문자전송 타입
|
||||
var norEachPrice = getNorEachPrice(evnMsgType); // 일반전송 금액
|
||||
var eventEachPrice = getEventEachPrice(evnMsgType); // 이벤트 전송 금액
|
||||
var eventCount = eventRemainCash/eventEachPrice; // 이벤트금액으로 전송가능한 수량
|
||||
console.log('eventCount : ', parseInt(eventCount));
|
||||
var norCount = numberWithCommas($selectedData.length)-parseInt(eventCount); // 일반금액으로 전송수량
|
||||
console.log('norCount : ', parseInt(norCount));
|
||||
|
||||
var norAccount = norCount * norEachPrice; // 일반금액으로 변경한 발송금액
|
||||
var totAccount = userMoneyOnly - norAccount //
|
||||
console.log('norAccount : ', norAccount);
|
||||
console.log('userMoneyOnly : ', userMoneyOnly);
|
||||
console.log('totAccount : ', totAccount);
|
||||
|
||||
if(totAccount < 0){
|
||||
alert("고객님의 이벤트 캐시 잔액(" + parseInt(totAccount)*-1 + "원) 부족으로 요청하신 문자("+numberWithCommas($selectedData.length)+"건)를 모두 발송할 수 없습니다.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(' !!! imgFilePath : ', imgFilePath);
|
||||
@ -1411,6 +1433,48 @@ function getNorEachPrice(evnMsgType){
|
||||
return norEachPrice;
|
||||
}
|
||||
|
||||
|
||||
//이벤트가 아닌 일반 개별 단가 셋팅해주기
|
||||
function getEventEachPrice(evnMsgType){
|
||||
|
||||
var eventEachPrice = 0;
|
||||
var evnImgCnt = $("#imgCnt").val();
|
||||
|
||||
//일반 단가로 변경해주기
|
||||
if(evnMsgType == '4'){
|
||||
|
||||
eventEachPrice = $("#sPrice").val();
|
||||
console.log("eventEachPrice Short::: "+eventEachPrice);
|
||||
|
||||
}else if(evnMsgType == '6'){
|
||||
|
||||
if(evnImgCnt == 0){//장문 가격
|
||||
|
||||
eventEachPrice = $("#mPrice").val();
|
||||
console.log("eventEachPrice Long ::: "+eventEachPrice);
|
||||
|
||||
}else if(evnImgCnt == 1){
|
||||
|
||||
eventEachPrice = $("#pPrice").val();
|
||||
console.log("eventEachPrice p1 ::: "+eventEachPrice);
|
||||
|
||||
}else if(evnImgCnt == 2){
|
||||
|
||||
eventEachPrice = $("#p2Price").val();
|
||||
console.log("eventEachPrice p2 ::: "+eventEachPrice);
|
||||
|
||||
}else if(evnImgCnt == 3){
|
||||
|
||||
eventEachPrice = $("#p3Price").val();
|
||||
console.log("eventEachPrice p3 ::: "+eventEachPrice);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return eventEachPrice;
|
||||
}
|
||||
|
||||
//빈 값이나 null 값을 제거하는 함수
|
||||
function removeEmptyValues(obj) {
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user