payUserSWList 컨트롤러->서비스로직 분리
This commit is contained in:
parent
379cc8fa43
commit
0ce04cc12f
@ -1,6 +1,7 @@
|
||||
package itn.let.mjo.pay.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@ -140,4 +141,6 @@ public interface MjonPayService {
|
||||
//누적 납부금액 조회 (후불회원이 사용금액을 실 납부한 금액 합산 - 미납 금액 제외한 총 합산 금액)
|
||||
public String selectTotSumPaymentAfterPay(String userId) throws Exception;
|
||||
|
||||
Map<String, Object> payUserSWList(MjonPayVO mjonPayVO) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -25,11 +26,14 @@ import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
import egovframework.rte.fdl.idgnr.EgovIdGnrService;
|
||||
import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
|
||||
import itn.com.cmm.LoginVO;
|
||||
import itn.com.cmm.util.DateUtils;
|
||||
import itn.com.cmm.util.MJUtil;
|
||||
import itn.com.utl.fcc.service.EgovStringUtil;
|
||||
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.msgcampain.service.MjonCandidateVO;
|
||||
import itn.let.mjo.msgcampain.service.impl.MjonCandidateDAO;
|
||||
import itn.let.mjo.msgdata.service.MjonMsgDataService;
|
||||
import itn.let.mjo.msgdata.service.impl.MjonMsgDataDAO;
|
||||
import itn.let.mjo.pay.service.MjonPayService;
|
||||
@ -94,6 +98,10 @@ public class MjonPayServiceImpl extends EgovAbstractServiceImpl implements MjonP
|
||||
@Resource(name = "mberGrdService")
|
||||
MberGrdService mberGrdService;
|
||||
|
||||
@Resource(name="mjonCandidateDAO")
|
||||
private MjonCandidateDAO mjonCandidateDAO;
|
||||
|
||||
|
||||
@Override
|
||||
public List<MjonPayVO> selectPayList(MjonPayVO mjonPayVO) throws Exception {
|
||||
return mjonPayDAO.selectPayList(mjonPayVO);
|
||||
@ -2839,6 +2847,99 @@ public class MjonPayServiceImpl extends EgovAbstractServiceImpl implements MjonP
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> payUserSWList(MjonPayVO mjonPayVO) throws Exception{
|
||||
|
||||
|
||||
String userId = mjonPayVO.getUserId();
|
||||
|
||||
// 총 사용금액
|
||||
List<MjonPayVO> usedCashTotList = mjonPayDAO.selectUsedCashWithKakaoTotCnt(mjonPayVO);
|
||||
|
||||
// 사용가능한 금액
|
||||
// mberManageVO.prePaymentYn 선불 후불 회원 구분으로 인해 select함
|
||||
MberManageVO mberManageVO = mjonMsgDataDAO.selectMberManageInfo(userId);
|
||||
// 선거 후보자 정보 조회
|
||||
MjonCandidateVO mjonCandidateVO = new MjonCandidateVO();
|
||||
if("p".equals(mberManageVO.getDept())) { //개인회원 선거 후보자 정보 불러오기
|
||||
mjonCandidateVO = mjonCandidateDAO.selectCandidateDataInfo(userId);
|
||||
if(mjonCandidateVO != null) {
|
||||
mjonCandidateVO.setRegidentNo1(egovCryptoUtil.decrypt(mjonCandidateVO.getRegidentNo1()));
|
||||
mjonCandidateVO.setRegidentNo2(egovCryptoUtil.decrypt(mjonCandidateVO.getRegidentNo2()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 후불제 회원 관련 사용 요금 내역 정보 조회하기
|
||||
* 20231228 우영두 추가
|
||||
* 누적사용금액, 누적 납부금액, 당월 납부 예상금액 정보 조회
|
||||
*
|
||||
* */
|
||||
//누적 사용금액 조회 (캐시 테이블에서 현재까지 사용된 금액 합산 - 캐시 테이블에서 "-"로 사용된 금액만 합산)
|
||||
String totSumCashAfterPay = mjonPayDAO.selectTotalSumCashForAfterPay(userId);
|
||||
|
||||
//누적 사용 포인트 조회 (포인트 테이블에서 현재까지 사용된 포인트 합산 - 회원 포인트 정보 업데이트시 사용되는 쿼리 이용)
|
||||
String totSumPointAfterPay = mjonPayDAO.selectTotalSumPointForAfterPay(userId);
|
||||
|
||||
//누적 납부금액 조회 (후불회원이 사용금액을 실 납부한 금액 합산 - 미납 금액 제외한 총 합산 금액)
|
||||
String totSumPaymentAfterPay = mjonPayDAO.selectTotSumPaymentAfterPay(userId);
|
||||
|
||||
//누적 납부 포인트 조회 ( 누적 납부금액 합산에 대한 2% 포인트 정보 계산)
|
||||
float p_i_re_point = 0;
|
||||
JoinSettingVO sysJoinSetVO = mjonMsgDataService.selectJoinSettingInfo();
|
||||
if (sysJoinSetVO != null) {
|
||||
p_i_re_point = sysJoinSetVO.getPointPer();
|
||||
}
|
||||
int paymentPointAfterPay = Math.round((Float.parseFloat(totSumPaymentAfterPay) * p_i_re_point / 100));
|
||||
|
||||
//당월 납부 예상금액 (누적 사용금액 합산 - 누적 납부금액 합산 정보 계산)
|
||||
float unPaymentAfterPay = Float.parseFloat(totSumCashAfterPay) - Float.parseFloat(totSumPaymentAfterPay);
|
||||
|
||||
//당월 납부 예상 포인트 (당월 납부 예상 금액에 대한 2% 포인트 정보 계산)
|
||||
int unPaymentPointAfterPay = Math.round((unPaymentAfterPay * p_i_re_point / 100));
|
||||
|
||||
/*
|
||||
* 2024.02.06 후불제 회원 중 협의단가를 사용하는 회원은 포인트 적립이 되지 않아야함.
|
||||
* 후불제 협의 단가 여부 체크
|
||||
* 모든 협의 단가 금액을 합산하여 0보다 크면 협의단가 있음.
|
||||
* */
|
||||
float shortPrice = mberManageVO.getShortPrice();
|
||||
float longPrice = mberManageVO.getLongPrice();
|
||||
float picturePrice = mberManageVO.getPicturePrice() + mberManageVO.getPicture2Price() + mberManageVO.getPicture3Price();
|
||||
float kakaoAtPrice = mberManageVO.getKakaoAtPrice();
|
||||
float kakaoFtPrice = mberManageVO.getKakaoFtPrice();
|
||||
float totPrice = shortPrice + longPrice + picturePrice + kakaoAtPrice + kakaoFtPrice;
|
||||
String negoPriceYn = "N";
|
||||
|
||||
if(totPrice > 0) {
|
||||
negoPriceYn = "Y";
|
||||
}
|
||||
|
||||
|
||||
|
||||
Map<String, Object> returnData = new HashMap<>();
|
||||
|
||||
|
||||
returnData.put("usedCashTotList", usedCashTotList);
|
||||
returnData.put("mberManageVO", mberManageVO);
|
||||
returnData.put("mjonCandidateVO", mjonCandidateVO);
|
||||
returnData.put("totSumCashAfterPay", totSumCashAfterPay);
|
||||
returnData.put("totSumPointAfterPay", totSumPointAfterPay);
|
||||
returnData.put("totSumPaymentAfterPay", totSumPaymentAfterPay);
|
||||
returnData.put("sumPaymentPointAfterPay", paymentPointAfterPay);
|
||||
returnData.put("unPaymentAfterPay", unPaymentAfterPay);
|
||||
returnData.put("unPaymentPointAfterPay", unPaymentPointAfterPay);
|
||||
returnData.put("negoPriceYn", negoPriceYn);
|
||||
// 초기 날짜 셋팅
|
||||
returnData.put("startDate", DateUtils.getDateMonthsAgo(12));
|
||||
returnData.put("endDate", DateUtils.getCurrentDate());
|
||||
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
return returnData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -2612,6 +2612,7 @@ public class MjonPayController {
|
||||
MberManageVO mberManageVO, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request,
|
||||
ModelMap model) throws Exception{
|
||||
|
||||
|
||||
/*LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();*/
|
||||
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
|
||||
@ -2621,133 +2622,25 @@ public class MjonPayController {
|
||||
return "redirect:/web/user/login/login.do";
|
||||
}
|
||||
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
|
||||
mjonMsgVO.setUserId(userId);
|
||||
mjonPayVO.setUserId(userId);
|
||||
|
||||
|
||||
// 비즈니스 로직 부분
|
||||
// Map<String, Object> resultMap = mjonPayService.payUserSWList(mjonPayVO);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
{ // 충전캐시
|
||||
String sumPayMoney = mjonPayService.selectAgentSumPayMoney(userId);
|
||||
model.addAttribute("sumPayMoney", sumPayMoney);
|
||||
}
|
||||
|
||||
{ // 충전포인트
|
||||
String sumPoint = mjonPayService.selectSumPoint(userId);
|
||||
model.addAttribute("sumPoint", sumPoint);
|
||||
}
|
||||
*/
|
||||
|
||||
{ // 총 사용금액
|
||||
mjonPayVO.setUserId(userId);
|
||||
List<MjonPayVO> usedCashTotList = mjonPayService.selectUsedCashWithKakaoTotCnt(mjonPayVO);
|
||||
model.addAttribute("usedCashTotList", usedCashTotList);
|
||||
}
|
||||
{ // 사용가능한 금액
|
||||
// mberManageVO.prePaymentYn 선불 후불 회원 구분으로 인해 select함
|
||||
mberManageVO = mjonMsgDataService.selectMberManageInfo(userId);
|
||||
model.addAttribute("mberManageVO", mberManageVO);
|
||||
}
|
||||
/*
|
||||
{ // 발송건수
|
||||
mjonMsgVO.setReserveYn("N");
|
||||
List<MjonMsgVO> sendTotList = mjonMsgService.selectWithKakaoSendTotCnt(mjonMsgVO);
|
||||
model.addAttribute("sendTotList", sendTotList);
|
||||
}
|
||||
|
||||
{ // 예약건수
|
||||
mjonMsgVO.setReserveYn("Y");
|
||||
List<MjonMsgVO> reservToList = mjonMsgService.selectWithKakaoSendTotCnt(mjonMsgVO);
|
||||
model.addAttribute("reservToList", reservToList);
|
||||
}
|
||||
*/
|
||||
{// 선거 후보자 정보 조회
|
||||
MjonCandidateVO mjonCandidateVO = new MjonCandidateVO();
|
||||
if("p".equals(mberManageVO.getDept())) { //개인회원 선거 후보자 정보 불러오기
|
||||
mjonCandidateVO = mjonCandidateService.selectCandidateDataInfo(userId);
|
||||
if(mjonCandidateVO != null) {
|
||||
mjonCandidateVO.setRegidentNo1(egovCryptoUtil.decrypt(mjonCandidateVO.getRegidentNo1()));
|
||||
mjonCandidateVO.setRegidentNo2(egovCryptoUtil.decrypt(mjonCandidateVO.getRegidentNo2()));
|
||||
}
|
||||
}
|
||||
model.addAttribute("mjonCandidateVO", mjonCandidateVO);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
/**
|
||||
* 후불제 회원 관련 사용 요금 내역 정보 조회하기
|
||||
* 20231228 우영두 추가
|
||||
* 누적사용금액, 누적 납부금액, 당월 납부 예상금액 정보 조회
|
||||
*
|
||||
* */
|
||||
|
||||
//누적 사용금액 조회 (캐시 테이블에서 현재까지 사용된 금액 합산 - 캐시 테이블에서 "-"로 사용된 금액만 합산)
|
||||
String totSumCashAfterPay = mjonPayService.selectTotalSumCashForAfterPay(userId);
|
||||
model.addAttribute("totSumCashAfterPay", totSumCashAfterPay);
|
||||
|
||||
//누적 사용 포인트 조회 (포인트 테이블에서 현재까지 사용된 포인트 합산 - 회원 포인트 정보 업데이트시 사용되는 쿼리 이용)
|
||||
String totSumPointAfterPay = mjonPayService.selectTotalSumPointForAfterPay(userId);
|
||||
model.addAttribute("totSumPointAfterPay", totSumPointAfterPay);
|
||||
|
||||
//누적 납부금액 조회 (후불회원이 사용금액을 실 납부한 금액 합산 - 미납 금액 제외한 총 합산 금액)
|
||||
String totSumPaymentAfterPay = mjonPayService.selectTotSumPaymentAfterPay(userId);
|
||||
model.addAttribute("totSumPaymentAfterPay", totSumPaymentAfterPay);
|
||||
|
||||
//누적 납부 포인트 조회 ( 누적 납부금액 합산에 대한 2% 포인트 정보 계산)
|
||||
float p_i_re_point = 0;
|
||||
JoinSettingVO sysJoinSetVO = mjonMsgDataService.selectJoinSettingInfo();
|
||||
if (sysJoinSetVO != null) {
|
||||
p_i_re_point = sysJoinSetVO.getPointPer();
|
||||
}
|
||||
int paymentPointAfterPay = Math.round((Float.parseFloat(totSumPaymentAfterPay) * p_i_re_point / 100));
|
||||
model.addAttribute("sumPaymentPointAfterPay", paymentPointAfterPay);
|
||||
|
||||
//당월 납부 예상금액 (누적 사용금액 합산 - 누적 납부금액 합산 정보 계산)
|
||||
|
||||
float unPaymentAfterPay = Float.parseFloat(totSumCashAfterPay) - Float.parseFloat(totSumPaymentAfterPay);
|
||||
model.addAttribute("unPaymentAfterPay", unPaymentAfterPay);
|
||||
|
||||
//당월 납부 예상 포인트 (당월 납부 예상 금액에 대한 2% 포인트 정보 계산)
|
||||
int unPaymentPointAfterPay = Math.round((unPaymentAfterPay * p_i_re_point / 100));
|
||||
model.addAttribute("unPaymentPointAfterPay", unPaymentPointAfterPay);
|
||||
|
||||
/*
|
||||
* 2024.02.06 후불제 회원 중 협의단가를 사용하는 회원은 포인트 적립이 되지 않아야함.
|
||||
* 후불제 협의 단가 여부 체크
|
||||
* 모든 협의 단가 금액을 합산하여 0보다 크면 협의단가 있음.
|
||||
* */
|
||||
float shortPrice = mberManageVO.getShortPrice();
|
||||
float longPrice = mberManageVO.getLongPrice();
|
||||
float picturePrice = mberManageVO.getPicturePrice() + mberManageVO.getPicture2Price() + mberManageVO.getPicture3Price();
|
||||
float kakaoAtPrice = mberManageVO.getKakaoAtPrice();
|
||||
float kakaoFtPrice = mberManageVO.getKakaoFtPrice();
|
||||
float totPrice = shortPrice + longPrice + picturePrice + kakaoAtPrice + kakaoFtPrice;
|
||||
String negoPriceYn = "N";
|
||||
|
||||
if(totPrice > 0) {
|
||||
negoPriceYn = "Y";
|
||||
}
|
||||
model.addAttribute("negoPriceYn", negoPriceYn);
|
||||
|
||||
}
|
||||
{
|
||||
// 초기 날짜 셋팅
|
||||
model.addAttribute("startDate", DateUtils.getDateMonthsAgo(12));
|
||||
model.addAttribute("endDate", DateUtils.getCurrentDate());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// // 비즈니스 로직 부분
|
||||
Map<String, Object> resultMap = mjonPayService.payUserSWList(mjonPayVO);
|
||||
|
||||
|
||||
model.addAttribute("usedCashTotList", resultMap.get("usedCashTotList"));
|
||||
model.addAttribute("mjonCandidateVO", resultMap.get("mjonCandidateVO"));
|
||||
model.addAttribute("mberManageVO", resultMap.get("mberManageVO"));
|
||||
model.addAttribute("totSumCashAfterPay", resultMap.get("totSumCashAfterPay"));
|
||||
model.addAttribute("totSumPointAfterPay", resultMap.get("totSumPointAfterPay"));
|
||||
model.addAttribute("totSumPaymentAfterPay", resultMap.get("totSumPaymentAfterPay"));
|
||||
model.addAttribute("sumPaymentPointAfterPay", resultMap.get("sumPaymentPointAfterPay"));
|
||||
model.addAttribute("unPaymentAfterPay", resultMap.get("unPaymentAfterPay"));
|
||||
model.addAttribute("unPaymentPointAfterPay", resultMap.get("unPaymentPointAfterPay"));
|
||||
model.addAttribute("negoPriceYn", resultMap.get("negoPriceYn"));
|
||||
model.addAttribute("startDate", resultMap.get("startDate"));
|
||||
model.addAttribute("endDate", resultMap.get("endDate"));
|
||||
|
||||
|
||||
return "/web/pay/PayUserSWList";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user