--- src/main/java/itn/let/fax/user/service/impl/FaxServiceImpl.java
+++ src/main/java/itn/let/fax/user/service/impl/FaxServiceImpl.java
... | ... | @@ -2,6 +2,8 @@ |
| 2 | 2 |
|
| 3 | 3 |
import java.io.File; |
| 4 | 4 |
import java.io.IOException; |
| 5 |
+import java.math.BigDecimal; |
|
| 6 |
+import java.math.RoundingMode; |
|
| 5 | 7 |
import java.text.SimpleDateFormat; |
| 6 | 8 |
import java.time.LocalDateTime; |
| 7 | 9 |
import java.util.ArrayList; |
... | ... | @@ -37,12 +39,15 @@ |
| 37 | 39 |
import itn.let.fax.user.service.FaxService; |
| 38 | 40 |
import itn.let.fax.user.service.FaxTranVO; |
| 39 | 41 |
import itn.let.mail.service.StatusResponse; |
| 42 |
+import itn.let.mjo.msg.service.MjonMsgVO; |
|
| 43 |
+import itn.let.mjo.msgdata.service.MjonMsgDataService; |
|
| 40 | 44 |
import itn.let.mjo.msgdata.service.MjonMsgDataVO; |
| 41 | 45 |
import itn.let.mjo.msgdata.service.impl.MjonMsgDataDAO; |
| 42 | 46 |
import itn.let.mjo.pay.service.MjonPayVO; |
| 43 | 47 |
import itn.let.mjo.pay.service.impl.MjonPayDAO; |
| 44 | 48 |
import itn.let.module.base.PriceAndPoint; |
| 45 | 49 |
import itn.let.sym.site.service.JoinSettingVO; |
| 50 |
+import itn.let.uss.umt.service.MberManageVO; |
|
| 46 | 51 |
import itn.let.utl.fcc.service.EgovStringUtil; |
| 47 | 52 |
|
| 48 | 53 |
|
... | ... | @@ -98,7 +103,11 @@ |
| 98 | 103 |
|
| 99 | 104 |
@Resource(name = "egovMjonCashIdGnrService") |
| 100 | 105 |
private EgovIdGnrService idgenMjonCashId; |
| 101 |
- |
|
| 106 |
+ |
|
| 107 |
+ |
|
| 108 |
+ @Resource(name = "MjonMsgDataService") |
|
| 109 |
+ private MjonMsgDataService mjonMsgDataService; |
|
| 110 |
+ |
|
| 102 | 111 |
@Autowired |
| 103 | 112 |
private PriceAndPoint priceAndPoint; |
| 104 | 113 |
|
... | ... | @@ -319,6 +328,11 @@ |
| 319 | 328 |
@Override |
| 320 | 329 |
public StatusResponse sendData(FaxTranVO faxTranVO, String userId) throws Exception {
|
| 321 | 330 |
|
| 331 |
+ // 단가확인 |
|
| 332 |
+ Boolean priceChk = this.getPriceChk(faxTranVO, userId); |
|
| 333 |
+ if(!priceChk) {
|
|
| 334 |
+ return new StatusResponse(HttpStatus.BAD_REQUEST, "팩스 발송에 필요한 회원님의 보유 잔액이 부족 합니다.", LocalDateTime.now()); |
|
| 335 |
+ } |
|
| 322 | 336 |
|
| 323 | 337 |
// 팩스발송 정보 삽입 |
| 324 | 338 |
faxTranVO.setFaxTranSeq(idgenPgiFaxTranId.getNextStringId()); |
... | ... | @@ -345,6 +359,49 @@ |
| 345 | 359 |
return new StatusResponse(HttpStatus.OK, "성공적으로 발송요청을 하였습니다.", LocalDateTime.now()); |
| 346 | 360 |
} |
| 347 | 361 |
|
| 362 |
+ |
|
| 363 |
+ private Boolean getPriceChk(FaxTranVO faxTranVO, String userId) throws Exception {
|
|
| 364 |
+ |
|
| 365 |
+ Boolean returnVal = true; |
|
| 366 |
+ |
|
| 367 |
+ MjonMsgVO mjonMsgVO = new MjonMsgVO(); |
|
| 368 |
+ mjonMsgVO.setUserId(userId); |
|
| 369 |
+ |
|
| 370 |
+ String userMoney = mjonMsgDataService.selectBeforeCashData(mjonMsgVO); |
|
| 371 |
+ String userPoint = mjonMsgDataService.selectBeforePointData(mjonMsgVO); |
|
| 372 |
+ mjonMsgVO.setBefPoint(userPoint); //현재 보유 포인트 정보 저장 |
|
| 373 |
+ |
|
| 374 |
+ BigDecimal befCash = new BigDecimal(userMoney).setScale(2, RoundingMode.HALF_EVEN); |
|
| 375 |
+ |
|
| 376 |
+ |
|
| 377 |
+ |
|
| 378 |
+ |
|
| 379 |
+ |
|
| 380 |
+ int callToSize = faxTranVO.getCallToList().split(",").length;
|
|
| 381 |
+ |
|
| 382 |
+ // 사용자 단가 |
|
| 383 |
+ Float faxPrice = this.getFaxPrice(userId); |
|
| 384 |
+ |
|
| 385 |
+ // 변환 완료 테이블에서 변환된 페이지 갯수 가져오기 |
|
| 386 |
+ // FROM PGI_FAXCONVERT |
|
| 387 |
+ int resPage = faxDao.findAllConvertTb(faxTranVO.getFaxConvertSeq()).getResPage(); |
|
| 388 |
+ System.out.println(" + resPage :: "+ resPage);
|
|
| 389 |
+ |
|
| 390 |
+ Float faxPriceTotalP = callToSize*faxPrice*resPage; |
|
| 391 |
+ |
|
| 392 |
+ |
|
| 393 |
+ // faxPrice를 BigDecimal로 변환 |
|
| 394 |
+ BigDecimal faxPriceBD = new BigDecimal(faxPriceTotalP.toString()); |
|
| 395 |
+ |
|
| 396 |
+ System.out.println(" + befCash :: "+ befCash);
|
|
| 397 |
+ System.out.println(" + faxPriceBD :: "+ faxPriceBD);
|
|
| 398 |
+ System.out.println(" + faxPriceBD.compareTo(befCash) :: "+ faxPriceBD.compareTo(befCash));
|
|
| 399 |
+ if (faxPriceBD.compareTo(befCash) > 0) {
|
|
| 400 |
+ returnVal = false; |
|
| 401 |
+ } |
|
| 402 |
+ |
|
| 403 |
+ return returnVal; |
|
| 404 |
+ } |
|
| 348 | 405 |
|
| 349 | 406 |
@Override |
| 350 | 407 |
public Map<String, Object> selectFaxSendDetailList(FaxGroupDataVO faxGroupDataVO) throws Exception {
|
... | ... | @@ -491,7 +548,6 @@ |
| 491 | 548 |
//2.사용자 개인 단가 정보 불러오기 |
| 492 | 549 |
faxPrice = mjonMsgDataDAO.selectMberManageInfo(userId).getFaxPrice(); |
| 493 | 550 |
|
| 494 |
- // SMS 인경우 |
|
| 495 | 551 |
// 사용자 개인 단가가 없으면 시스템 단가로 |
| 496 | 552 |
if(faxPrice == 0.0f) |
| 497 | 553 |
return sysJoinSetVO.getFaxPrice(); |
--- src/main/webapp/WEB-INF/jsp/web/fax/faxDataView.jsp
+++ src/main/webapp/WEB-INF/jsp/web/fax/faxDataView.jsp
... | ... | @@ -51,9 +51,9 @@ |
| 51 | 51 |
return false; |
| 52 | 52 |
} |
| 53 | 53 |
|
| 54 |
- if(!moneyChk()){
|
|
| 54 |
+ /* if(!moneyChk()){
|
|
| 55 | 55 |
return false; |
| 56 |
- } |
|
| 56 |
+ } */ |
|
| 57 | 57 |
|
| 58 | 58 |
|
| 59 | 59 |
if(!valueChk()){
|
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?