이준호 문자온 api 커밋
변수 및 response 파라미터 userMoney -> mberMoney 로 수정
This commit is contained in:
parent
8febc28e63
commit
012b160166
@ -19,14 +19,14 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
public interface PriceMapper {
|
||||
|
||||
/**
|
||||
* @methodName : selectUserMoney
|
||||
* @methodName : selectMberMoney
|
||||
* @author : JunHo Lee
|
||||
* @date : 2023.05.22
|
||||
* @description :
|
||||
* @param priceVO
|
||||
* @return
|
||||
*/
|
||||
double selectUserMoney(String mberId);
|
||||
double selectMberMoney(String mberId);
|
||||
|
||||
Map<String, String>selectMberPriceInfo(String mberId);
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ public class PriceResponse {
|
||||
private double longPrice; // 장문 이용단가
|
||||
private double picturePrice; // 그림 이용단가
|
||||
|
||||
private double userMoney; // 잔액
|
||||
private double mberMoney; // 잔액
|
||||
|
||||
private int shortSendPsbltEa; // 단문 발송 가능건 수
|
||||
private int longSendPsbltEa; // 장문 발송 가능건 수
|
||||
|
||||
@ -23,7 +23,7 @@ public class PriceVO implements Serializable{
|
||||
private double longPrice; // 장문 이용단가
|
||||
private double picturePrice; // 그림 이용단가
|
||||
|
||||
private double userMoney; // 잔액
|
||||
private double mberMoney; // 잔액
|
||||
|
||||
private int shortSendPsbltEa; // 단문 발송 가능건 수
|
||||
private int longSendPsbltEa; // 장문 발송 가능건 수
|
||||
|
||||
@ -46,9 +46,9 @@ public class PriceServiceImpl implements PriceService {
|
||||
|
||||
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
|
||||
priceResponse = PriceResponse.builder()
|
||||
@ -57,7 +57,7 @@ public class PriceServiceImpl implements PriceService {
|
||||
.message(StatMsg.valueOf(STAT_CODE).getMsg())
|
||||
.localDateTime(LocalDateTime.now())
|
||||
//1. 잔액
|
||||
.userMoney(userMoney)
|
||||
.mberMoney(mberMoney)
|
||||
//2. 이용단가
|
||||
.shortPrice(priceVO.getShortPrice())
|
||||
.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;
|
||||
@ -125,16 +125,16 @@ public class PriceServiceImpl implements PriceService {
|
||||
int pictureSendPsbltEa = 0;
|
||||
|
||||
//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 longPrice_big = new BigDecimal(String.valueOf(priceMap.get("sysLongPrice")));
|
||||
BigDecimal picturePrice_big = new BigDecimal(String.valueOf(priceMap.get("sysPicturePrice")));
|
||||
|
||||
//2-2. userMoney가 0일경우 제외
|
||||
if(userMoney_big.compareTo(BigDecimal.ZERO) != 0) {
|
||||
shortSendPsbltEa = userMoney_big.divide(shortPrice_big, BigDecimal.ROUND_DOWN).intValue();
|
||||
longSendPsbltEa = userMoney_big.divide(longPrice_big, BigDecimal.ROUND_DOWN).intValue();
|
||||
pictureSendPsbltEa = userMoney_big.divide(picturePrice_big, BigDecimal.ROUND_DOWN).intValue();
|
||||
//2-2. mberMoney가 0일경우 제외
|
||||
if(mberMoney_big.compareTo(BigDecimal.ZERO) != 0) {
|
||||
shortSendPsbltEa = mberMoney_big.divide(shortPrice_big, BigDecimal.ROUND_DOWN).intValue();
|
||||
longSendPsbltEa = mberMoney_big.divide(longPrice_big, BigDecimal.ROUND_DOWN).intValue();
|
||||
pictureSendPsbltEa = mberMoney_big.divide(picturePrice_big, BigDecimal.ROUND_DOWN).intValue();
|
||||
}
|
||||
|
||||
//result set
|
||||
|
||||
@ -5,11 +5,11 @@
|
||||
|
||||
<mapper namespace="com.itn.mjonApi.mjon.api.inqry.mapper.PriceMapper">
|
||||
|
||||
<select id="selectUserMoney"
|
||||
<select id="selectMberMoney"
|
||||
resultType="double"
|
||||
>
|
||||
|
||||
SELECT a.USER_MONEY AS userMoney
|
||||
SELECT a.USER_MONEY AS mberMoney
|
||||
FROM lettngnrlmber a
|
||||
WHERE a.MBER_ID = #{mberId}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user