Merge branch 'master' of http://vcs.iten.co.kr:9999/hylee/mjon_git
@4a140f57a64e2c0070e06f05d91083d1b2bc9253
--- src/main/java/itn/let/module/base/PriceAndPoint.java
+++ src/main/java/itn/let/module/base/PriceAndPoint.java
... | ... | @@ -9,6 +9,9 @@ |
| 9 | 9 |
import org.springframework.stereotype.Component; |
| 10 | 10 |
|
| 11 | 11 |
import egovframework.rte.fdl.idgnr.EgovIdGnrService; |
| 12 |
+import itn.let.mjo.event.service.MjonEventService; |
|
| 13 |
+import itn.let.mjo.event.service.MjonEventVO; |
|
| 14 |
+import itn.let.mjo.event.service.impl.MjonEventDAO; |
|
| 12 | 15 |
import itn.let.mjo.msg.service.MjonMsgVO; |
| 13 | 16 |
import itn.let.mjo.msgdata.service.impl.MjonMsgDataDAO; |
| 14 | 17 |
import itn.let.mjo.pay.service.MjonPayVO; |
... | ... | @@ -37,6 +40,9 @@ |
| 37 | 40 |
|
| 38 | 41 |
@Autowired |
| 39 | 42 |
private MjonPayDAO mjonPayDAO; |
| 43 |
+ |
|
| 44 |
+ @Autowired |
|
| 45 |
+ private MjonEventService mjonEventService; |
|
| 40 | 46 |
|
| 41 | 47 |
@Resource(name = "egovMjonCashIdGnrService") |
| 42 | 48 |
private EgovIdGnrService idgenMjonCashId; |
... | ... | @@ -119,6 +125,36 @@ |
| 119 | 125 |
mjonPayDAO.insertCash(mjonPayVO); //캐시 |
| 120 | 126 |
mjonPayDAO.updateMemberCash(mjonPayVO); //회원정보 업데이트 |
| 121 | 127 |
|
| 128 |
+ //이벤트 회원인 경우 이벤트 캐시도 함께 차감. |
|
| 129 |
+ MjonEventVO mjonEventVO = new MjonEventVO(); |
|
| 130 |
+ mjonEventVO.setMberId(mjonPayVO.getUserId()); |
|
| 131 |
+ mjonEventVO.setEventStatus("Y");
|
|
| 132 |
+ MjonEventVO eventMberInfo = mjonEventService.selectEventMsgMberDefaultInfo(mjonEventVO); |
|
| 133 |
+ |
|
| 134 |
+ if(eventMberInfo != null) {
|
|
| 135 |
+ |
|
| 136 |
+ float evntRemainCash = (float) eventMberInfo.getEventRemainCash(); |
|
| 137 |
+ totPrice = (float) Math.abs(mjonPayVO.getCash()); |
|
| 138 |
+ |
|
| 139 |
+ float totRemainCash = evntRemainCash - totPrice; |
|
| 140 |
+ mjonEventVO.setEventInfoId(eventMberInfo.getEventInfoId()); |
|
| 141 |
+ |
|
| 142 |
+ if(totRemainCash <= 0.0) {//차감액이 남아있지 않으면 이벤트를 종료
|
|
| 143 |
+ |
|
| 144 |
+ //이벤트 상태값을 종료로 변경한다. |
|
| 145 |
+ mjonEventVO.setEventStatus("E");
|
|
| 146 |
+ mjonEventVO.setEventRemainCash(0.0); |
|
| 147 |
+ mjonEventService.updateEventEndStatus(mjonEventVO); |
|
| 148 |
+ |
|
| 149 |
+ }else {//이벤트 회원 캐시 차감시킴
|
|
| 150 |
+ |
|
| 151 |
+ mjonEventVO.setEventRemainCash(totRemainCash); |
|
| 152 |
+ mjonEventService.updateEventRemainCash(mjonEventVO); |
|
| 153 |
+ |
|
| 154 |
+ } |
|
| 155 |
+ |
|
| 156 |
+ } |
|
| 157 |
+ |
|
| 122 | 158 |
} |
| 123 | 159 |
|
| 124 | 160 |
|
--- src/main/webapp/js/web/msgdata/msgDataView.js
+++ src/main/webapp/js/web/msgdata/msgDataView.js
... | ... | @@ -1067,11 +1067,33 @@ |
| 1067 | 1067 |
var eventRemainCash = parseFloat(form.eventRemainCash.value); |
| 1068 | 1068 |
console.log('eventStatus : ', eventStatus);
|
| 1069 | 1069 |
|
| 1070 |
- if(eventStatus == 'Y' |
|
| 1071 |
- && parseFloat(eventRemainCash) < parseFloat(totPriceOnly)) |
|
| 1070 |
+ if(eventStatus == 'Y' && parseFloat(eventRemainCash) < parseFloat(totPriceOnly)) |
|
| 1072 | 1071 |
{
|
| 1072 |
+ |
|
| 1073 |
+ // 이벤트 금액 부족 상태 요청하신 모두 발송할 수 없습니다 |
|
| 1073 | 1074 |
console.log('eventRemainCash : ', eventRemainCash);
|
| 1074 | 1075 |
if(!confirm("고객님의 이벤트 캐시 잔액(" + eventRemainCash + "원) 부족으로 요청하신 문자("+numberWithCommas($selectedData.length)+"건)를 모두 발송할 수 없습니다. 이벤트 캐시 초과 건에 대해서는 일반 단가를 적용하여 발송하시겠습니까?")){
|
| 1076 |
+ return false; |
|
| 1077 |
+ } |
|
| 1078 |
+ |
|
| 1079 |
+ // 이벤트 캐시 초과 건에 대해서는 일반 단가를 적용하여 발송하시겠습니까 |
|
| 1080 |
+ |
|
| 1081 |
+ var evnMsgType = $("#msgType").val(); // 문자전송 타입
|
|
| 1082 |
+ var norEachPrice = getNorEachPrice(evnMsgType); // 일반전송 금액 |
|
| 1083 |
+ var eventEachPrice = getEventEachPrice(evnMsgType); // 이벤트 전송 금액 |
|
| 1084 |
+ var eventCount = eventRemainCash/eventEachPrice; // 이벤트금액으로 전송가능한 수량 |
|
| 1085 |
+ console.log('eventCount : ', parseInt(eventCount));
|
|
| 1086 |
+ var norCount = numberWithCommas($selectedData.length)-parseInt(eventCount); // 일반금액으로 전송수량 |
|
| 1087 |
+ console.log('norCount : ', parseInt(norCount));
|
|
| 1088 |
+ |
|
| 1089 |
+ var norAccount = norCount * norEachPrice; // 일반금액으로 변경한 발송금액 |
|
| 1090 |
+ var totAccount = userMoneyOnly - norAccount // |
|
| 1091 |
+ console.log('norAccount : ', norAccount);
|
|
| 1092 |
+ console.log('userMoneyOnly : ', userMoneyOnly);
|
|
| 1093 |
+ console.log('totAccount : ', totAccount);
|
|
| 1094 |
+ |
|
| 1095 |
+ if(totAccount < 0){
|
|
| 1096 |
+ alert("고객님의 이벤트 캐시 잔액(" + parseInt(totAccount)*-1 + "원) 부족으로 요청하신 문자("+numberWithCommas($selectedData.length)+"건)를 모두 발송할 수 없습니다.");
|
|
| 1075 | 1097 |
return false; |
| 1076 | 1098 |
} |
| 1077 | 1099 |
} |
... | ... | @@ -1411,6 +1433,48 @@ |
| 1411 | 1433 |
return norEachPrice; |
| 1412 | 1434 |
} |
| 1413 | 1435 |
|
| 1436 |
+ |
|
| 1437 |
+//이벤트가 아닌 일반 개별 단가 셋팅해주기 |
|
| 1438 |
+function getEventEachPrice(evnMsgType){
|
|
| 1439 |
+ |
|
| 1440 |
+ var eventEachPrice = 0; |
|
| 1441 |
+ var evnImgCnt = $("#imgCnt").val();
|
|
| 1442 |
+ |
|
| 1443 |
+ //일반 단가로 변경해주기 |
|
| 1444 |
+ if(evnMsgType == '4'){
|
|
| 1445 |
+ |
|
| 1446 |
+ eventEachPrice = $("#sPrice").val();
|
|
| 1447 |
+ console.log("eventEachPrice Short::: "+eventEachPrice);
|
|
| 1448 |
+ |
|
| 1449 |
+ }else if(evnMsgType == '6'){
|
|
| 1450 |
+ |
|
| 1451 |
+ if(evnImgCnt == 0){//장문 가격
|
|
| 1452 |
+ |
|
| 1453 |
+ eventEachPrice = $("#mPrice").val();
|
|
| 1454 |
+ console.log("eventEachPrice Long ::: "+eventEachPrice);
|
|
| 1455 |
+ |
|
| 1456 |
+ }else if(evnImgCnt == 1){
|
|
| 1457 |
+ |
|
| 1458 |
+ eventEachPrice = $("#pPrice").val();
|
|
| 1459 |
+ console.log("eventEachPrice p1 ::: "+eventEachPrice);
|
|
| 1460 |
+ |
|
| 1461 |
+ }else if(evnImgCnt == 2){
|
|
| 1462 |
+ |
|
| 1463 |
+ eventEachPrice = $("#p2Price").val();
|
|
| 1464 |
+ console.log("eventEachPrice p2 ::: "+eventEachPrice);
|
|
| 1465 |
+ |
|
| 1466 |
+ }else if(evnImgCnt == 3){
|
|
| 1467 |
+ |
|
| 1468 |
+ eventEachPrice = $("#p3Price").val();
|
|
| 1469 |
+ console.log("eventEachPrice p3 ::: "+eventEachPrice);
|
|
| 1470 |
+ |
|
| 1471 |
+ } |
|
| 1472 |
+ |
|
| 1473 |
+ } |
|
| 1474 |
+ |
|
| 1475 |
+ return eventEachPrice; |
|
| 1476 |
+} |
|
| 1477 |
+ |
|
| 1414 | 1478 |
//빈 값이나 null 값을 제거하는 함수 |
| 1415 | 1479 |
function removeEmptyValues(obj) {
|
| 1416 | 1480 |
Object.keys(obj).forEach(function(key) {
|
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?