이준호 문자온 api 커밋

변수 및 response 파라미터 userMoney -> mberMoney 로 수정
This commit is contained in:
leejunho 2023-05-31 12:49:02 +09:00
parent 8febc28e63
commit 012b160166
5 changed files with 16 additions and 16 deletions

View File

@ -19,14 +19,14 @@ import org.apache.ibatis.annotations.Mapper;
public interface PriceMapper { public interface PriceMapper {
/** /**
* @methodName : selectUserMoney * @methodName : selectMberMoney
* @author : JunHo Lee * @author : JunHo Lee
* @date : 2023.05.22 * @date : 2023.05.22
* @description : * @description :
* @param priceVO * @param priceVO
* @return * @return
*/ */
double selectUserMoney(String mberId); double selectMberMoney(String mberId);
Map<String, String>selectMberPriceInfo(String mberId); Map<String, String>selectMberPriceInfo(String mberId);

View File

@ -28,7 +28,7 @@ public class PriceResponse {
private double longPrice; // 장문 이용단가 private double longPrice; // 장문 이용단가
private double picturePrice; // 그림 이용단가 private double picturePrice; // 그림 이용단가
private double userMoney; // 잔액 private double mberMoney; // 잔액
private int shortSendPsbltEa; // 단문 발송 가능건 private int shortSendPsbltEa; // 단문 발송 가능건
private int longSendPsbltEa; // 장문 발송 가능건 private int longSendPsbltEa; // 장문 발송 가능건

View File

@ -23,7 +23,7 @@ public class PriceVO implements Serializable{
private double longPrice; // 장문 이용단가 private double longPrice; // 장문 이용단가
private double picturePrice; // 그림 이용단가 private double picturePrice; // 그림 이용단가
private double userMoney; // 잔액 private double mberMoney; // 잔액
private int shortSendPsbltEa; // 단문 발송 가능건 private int shortSendPsbltEa; // 단문 발송 가능건
private int longSendPsbltEa; // 장문 발송 가능건 private int longSendPsbltEa; // 장문 발송 가능건

View File

@ -46,9 +46,9 @@ public class PriceServiceImpl implements PriceService {
try { try {
//사용자 잔액 //사용자 잔액
double userMoney = priceMapper.selectUserMoney(mberId); double mberMoney = priceMapper.selectMberMoney(mberId);
// 이용단가, 발송가능 건수 // 이용단가, 발송가능 건수
PriceVO priceVO = price_refine(mberId, userMoney, priceMapper); PriceVO priceVO = price_refine(mberId, mberMoney, priceMapper);
//response set //response set
priceResponse = PriceResponse.builder() priceResponse = PriceResponse.builder()
@ -57,7 +57,7 @@ public class PriceServiceImpl implements PriceService {
.message(StatMsg.valueOf(STAT_CODE).getMsg()) .message(StatMsg.valueOf(STAT_CODE).getMsg())
.localDateTime(LocalDateTime.now()) .localDateTime(LocalDateTime.now())
//1. 잔액 //1. 잔액
.userMoney(userMoney) .mberMoney(mberMoney)
//2. 이용단가 //2. 이용단가
.shortPrice(priceVO.getShortPrice()) .shortPrice(priceVO.getShortPrice())
.longPrice(priceVO.getLongPrice()) .longPrice(priceVO.getLongPrice())
@ -90,7 +90,7 @@ public class PriceServiceImpl implements PriceService {
} }
private PriceVO price_refine(String mberId, double userMoney, PriceMapper priceMapper) { private PriceVO price_refine(String mberId, double mberMoney, PriceMapper priceMapper) {
//시스템 단가 변수 //시스템 단가 변수
double sys_shortPrice = 0.0f; double sys_shortPrice = 0.0f;
@ -125,16 +125,16 @@ public class PriceServiceImpl implements PriceService {
int pictureSendPsbltEa = 0; int pictureSendPsbltEa = 0;
//2-1. 소수점 연산을 위한 BigDecimal Casting //2-1. 소수점 연산을 위한 BigDecimal Casting
BigDecimal userMoney_big = new BigDecimal(String.valueOf(userMoney)); BigDecimal mberMoney_big = new BigDecimal(String.valueOf(mberMoney));
BigDecimal shortPrice_big = new BigDecimal(String.valueOf(priceMap.get("sysShortPrice"))); BigDecimal shortPrice_big = new BigDecimal(String.valueOf(priceMap.get("sysShortPrice")));
BigDecimal longPrice_big = new BigDecimal(String.valueOf(priceMap.get("sysLongPrice"))); BigDecimal longPrice_big = new BigDecimal(String.valueOf(priceMap.get("sysLongPrice")));
BigDecimal picturePrice_big = new BigDecimal(String.valueOf(priceMap.get("sysPicturePrice"))); BigDecimal picturePrice_big = new BigDecimal(String.valueOf(priceMap.get("sysPicturePrice")));
//2-2. userMoney가 0일경우 제외 //2-2. mberMoney가 0일경우 제외
if(userMoney_big.compareTo(BigDecimal.ZERO) != 0) { if(mberMoney_big.compareTo(BigDecimal.ZERO) != 0) {
shortSendPsbltEa = userMoney_big.divide(shortPrice_big, BigDecimal.ROUND_DOWN).intValue(); shortSendPsbltEa = mberMoney_big.divide(shortPrice_big, BigDecimal.ROUND_DOWN).intValue();
longSendPsbltEa = userMoney_big.divide(longPrice_big, BigDecimal.ROUND_DOWN).intValue(); longSendPsbltEa = mberMoney_big.divide(longPrice_big, BigDecimal.ROUND_DOWN).intValue();
pictureSendPsbltEa = userMoney_big.divide(picturePrice_big, BigDecimal.ROUND_DOWN).intValue(); pictureSendPsbltEa = mberMoney_big.divide(picturePrice_big, BigDecimal.ROUND_DOWN).intValue();
} }
//result set //result set

View File

@ -5,11 +5,11 @@
<mapper namespace="com.itn.mjonApi.mjon.api.inqry.mapper.PriceMapper"> <mapper namespace="com.itn.mjonApi.mjon.api.inqry.mapper.PriceMapper">
<select id="selectUserMoney" <select id="selectMberMoney"
resultType="double" resultType="double"
> >
SELECT a.USER_MONEY AS userMoney SELECT a.USER_MONEY AS mberMoney
FROM lettngnrlmber a FROM lettngnrlmber a
WHERE a.MBER_ID = #{mberId} WHERE a.MBER_ID = #{mberId}