feat: 문자 발송시 금액 조회기능 추가
This commit is contained in:
parent
fdcde25721
commit
0dd73503d5
89
src/main/java/com/itn/mjonApi/cmn/model/Price.java
Normal file
89
src/main/java/com/itn/mjonApi/cmn/model/Price.java
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
package com.itn.mjonApi.cmn.model;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.mjon.api.inqry.mapper.PriceMapper;
|
||||||
|
import com.itn.mjonApi.mjon.api.inqry.mapper.domain.PriceVO;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* packageName : com.itn.mjonApi.cmn.model
|
||||||
|
* fileName : priceRefine
|
||||||
|
* author : hylee
|
||||||
|
* date : 2023-07-03
|
||||||
|
* description :
|
||||||
|
* ===========================================================
|
||||||
|
* DATE AUTHOR NOTE
|
||||||
|
* -----------------------------------------------------------
|
||||||
|
* 2023-07-03 hylee 최초 생성
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class Price {
|
||||||
|
|
||||||
|
|
||||||
|
public static PriceVO priceRefine(String mberId, PriceMapper priceMapper) {
|
||||||
|
|
||||||
|
//사용자 잔액
|
||||||
|
double mberMoney = priceMapper.selectMberMoney(mberId);
|
||||||
|
|
||||||
|
//시스템 단가 변수
|
||||||
|
double sys_shortPrice = 0.0f;
|
||||||
|
double sys_longPrice = 0.0f;
|
||||||
|
double sys_picturePrice = 0.0f;
|
||||||
|
|
||||||
|
//최종 단가 변수
|
||||||
|
double shortPrice = 0.0f;
|
||||||
|
double longPrice = 0.0f;
|
||||||
|
double picturePrice = 0.0f;
|
||||||
|
|
||||||
|
//1.시스템 기본 단가, 사용자 개인단가 정보 불러오기
|
||||||
|
Map<String, String> priceMap = priceMapper.selectMberPriceInfo(mberId);
|
||||||
|
|
||||||
|
//1-2.단가 계산을 위한 set
|
||||||
|
sys_shortPrice = Double.parseDouble(String.valueOf(priceMap.get("sysShortPrice")));
|
||||||
|
sys_longPrice = Double.parseDouble(String.valueOf(priceMap.get("sysLongPrice")));
|
||||||
|
sys_picturePrice = Double.parseDouble(String.valueOf(priceMap.get("sysPicturePrice")));
|
||||||
|
|
||||||
|
shortPrice = Double.parseDouble(String.valueOf(priceMap.get("shortPrice")));
|
||||||
|
longPrice = Double.parseDouble(String.valueOf(priceMap.get("longPrice")));
|
||||||
|
picturePrice = Double.parseDouble(String.valueOf(priceMap.get("picturePrice")));
|
||||||
|
|
||||||
|
//1-3. 최종 단가 계산
|
||||||
|
shortPrice = shortPrice == 0.0f ? sys_shortPrice : shortPrice;
|
||||||
|
longPrice = longPrice == 0.0f ? sys_longPrice : longPrice;
|
||||||
|
picturePrice = picturePrice == 0.0f ? sys_picturePrice : picturePrice;
|
||||||
|
|
||||||
|
//2. 단가별 발송 가능건수 계산을위한 변수 set
|
||||||
|
int shortSendPsbltEa = 0;
|
||||||
|
int longSendPsbltEa = 0;
|
||||||
|
int pictureSendPsbltEa = 0;
|
||||||
|
|
||||||
|
//2-1. 소수점 연산을 위한 BigDecimal Casting
|
||||||
|
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. 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
|
||||||
|
PriceVO priceVO = PriceVO.builder()
|
||||||
|
.shortPrice(shortPrice)
|
||||||
|
.longPrice(longPrice)
|
||||||
|
.picturePrice(picturePrice)
|
||||||
|
.shortSendPsbltEa(shortSendPsbltEa)
|
||||||
|
.longSendPsbltEa(longSendPsbltEa)
|
||||||
|
.pictureSendPsbltEa(pictureSendPsbltEa)
|
||||||
|
.mberMoney(mberMoney)
|
||||||
|
.build();
|
||||||
|
return priceVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.itn.mjonApi.mjon.api.inqry.service.impl;
|
package com.itn.mjonApi.mjon.api.inqry.service.impl;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.cmn.model.Price;
|
||||||
import com.itn.mjonApi.cmn.msg.FailRestResponse;
|
import com.itn.mjonApi.cmn.msg.FailRestResponse;
|
||||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
import com.itn.mjonApi.cmn.msg.StatMsg;
|
import com.itn.mjonApi.cmn.msg.StatMsg;
|
||||||
@ -12,9 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @packageName : com.itn.mjonApi.mjon.api.inqry.service.impl
|
* @packageName : com.itn.mjonApi.mjon.api.inqry.service.impl
|
||||||
@ -44,10 +43,9 @@ public class PriceServiceImpl implements PriceService {
|
|||||||
PriceResponse priceResponse = new PriceResponse();
|
PriceResponse priceResponse = new PriceResponse();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//사용자 잔액
|
|
||||||
double mberMoney = priceMapper.selectMberMoney(mberId);
|
|
||||||
// 이용단가, 발송가능 건수
|
// 이용단가, 발송가능 건수
|
||||||
PriceVO priceVO = price_refine(mberId, mberMoney, priceMapper);
|
PriceVO priceVO = Price.priceRefine(mberId, priceMapper);
|
||||||
|
|
||||||
//response set
|
//response set
|
||||||
priceResponse = PriceResponse.builder()
|
priceResponse = PriceResponse.builder()
|
||||||
@ -56,7 +54,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. 잔액
|
||||||
.mberMoney(mberMoney)
|
.mberMoney(priceVO.getMberMoney())
|
||||||
//2. 이용단가
|
//2. 이용단가
|
||||||
.shortPrice(priceVO.getShortPrice())
|
.shortPrice(priceVO.getShortPrice())
|
||||||
.longPrice(priceVO.getLongPrice())
|
.longPrice(priceVO.getLongPrice())
|
||||||
@ -68,6 +66,7 @@ public class PriceServiceImpl implements PriceService {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
log.info("selectPrice Error [{}]", e.getMessage());
|
log.info("selectPrice Error [{}]", e.getMessage());
|
||||||
return new RestResponse(new FailRestResponse("STAT_5099", ""));
|
return new RestResponse(new FailRestResponse("STAT_5099", ""));
|
||||||
}
|
}
|
||||||
@ -75,65 +74,7 @@ public class PriceServiceImpl implements PriceService {
|
|||||||
return new RestResponse(priceResponse);
|
return new RestResponse(priceResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private PriceVO price_refine(String mberId, double mberMoney, PriceMapper priceMapper) {
|
|
||||||
|
|
||||||
//시스템 단가 변수
|
|
||||||
double sys_shortPrice = 0.0f;
|
|
||||||
double sys_longPrice = 0.0f;
|
|
||||||
double sys_picturePrice = 0.0f;
|
|
||||||
|
|
||||||
//최종 단가 변수
|
|
||||||
double shortPrice = 0.0f;
|
|
||||||
double longPrice = 0.0f;
|
|
||||||
double picturePrice = 0.0f;
|
|
||||||
|
|
||||||
//1.시스템 기본 단가, 사용자 개인단가 정보 불러오기
|
|
||||||
Map<String, String> priceMap = priceMapper.selectMberPriceInfo(mberId);
|
|
||||||
|
|
||||||
//1-2.단가 계산을 위한 set
|
|
||||||
sys_shortPrice = Double.parseDouble(String.valueOf(priceMap.get("sysShortPrice")));
|
|
||||||
sys_longPrice = Double.parseDouble(String.valueOf(priceMap.get("sysLongPrice")));
|
|
||||||
sys_picturePrice = Double.parseDouble(String.valueOf(priceMap.get("sysPicturePrice")));
|
|
||||||
|
|
||||||
shortPrice = Double.parseDouble(String.valueOf(priceMap.get("shortPrice")));
|
|
||||||
longPrice = Double.parseDouble(String.valueOf(priceMap.get("longPrice")));
|
|
||||||
picturePrice = Double.parseDouble(String.valueOf(priceMap.get("picturePrice")));
|
|
||||||
|
|
||||||
//1-3. 최종 단가 계산
|
|
||||||
shortPrice = shortPrice == 0.0f ? sys_shortPrice : shortPrice;
|
|
||||||
longPrice = longPrice == 0.0f ? sys_longPrice : longPrice;
|
|
||||||
picturePrice = picturePrice == 0.0f ? sys_picturePrice : picturePrice;
|
|
||||||
|
|
||||||
//2. 단가별 발송 가능건수 계산을위한 변수 set
|
|
||||||
int shortSendPsbltEa = 0;
|
|
||||||
int longSendPsbltEa = 0;
|
|
||||||
int pictureSendPsbltEa = 0;
|
|
||||||
|
|
||||||
//2-1. 소수점 연산을 위한 BigDecimal Casting
|
|
||||||
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. 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
|
|
||||||
PriceVO priceVO = PriceVO.builder()
|
|
||||||
.shortPrice(shortPrice)
|
|
||||||
.longPrice(longPrice)
|
|
||||||
.picturePrice(picturePrice)
|
|
||||||
.shortSendPsbltEa(shortSendPsbltEa)
|
|
||||||
.longSendPsbltEa(longSendPsbltEa)
|
|
||||||
.pictureSendPsbltEa(pictureSendPsbltEa)
|
|
||||||
.build();
|
|
||||||
return priceVO;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,8 +15,6 @@ import java.io.Serializable;
|
|||||||
* -----------------------------------------------------------
|
* -----------------------------------------------------------
|
||||||
* 2023-05-09 hylee 최초 생성
|
* 2023-05-09 hylee 최초 생성
|
||||||
*/
|
*/
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
@ -41,7 +39,11 @@ public class MsgRequestVO implements Serializable {
|
|||||||
|
|
||||||
private String eachPrice="0"; // value = "전송문자 개별가격", example = "0"
|
private String eachPrice="0"; // value = "전송문자 개별가격", example = "0"
|
||||||
|
|
||||||
private String sPrice="0"; // 임시
|
private String sPrice="0"; // 단문 단가
|
||||||
|
private String mPrice="0"; // 장문 단가
|
||||||
|
private String pPrice="0"; // 그림1장 단가
|
||||||
|
private String p2Price="0"; // 그림2장 단가
|
||||||
|
private String p3Price="0"; // 그림3장 단가
|
||||||
|
|
||||||
private String totPrice="0"; // value = "전송문자 토탈가격", example = "0"
|
private String totPrice="0"; // value = "전송문자 토탈가격", example = "0"
|
||||||
|
|
||||||
@ -200,4 +202,277 @@ public class MsgRequestVO implements Serializable {
|
|||||||
// private String todayYn;
|
// private String todayYn;
|
||||||
// private String nowDate;
|
// private String nowDate;
|
||||||
// private Float agentPrice;
|
// private Float agentPrice;
|
||||||
|
|
||||||
|
|
||||||
|
public String getMberId() {
|
||||||
|
return mberId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMberId(String mberId) {
|
||||||
|
this.mberId = mberId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccessKey() {
|
||||||
|
return accessKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccessKey(String accessKey) {
|
||||||
|
this.accessKey = accessKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSmsTxt() {
|
||||||
|
return smsTxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmsTxt(String smsTxt) {
|
||||||
|
this.smsTxt = smsTxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCallToList() {
|
||||||
|
return callToList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCallToList(String[] callToList) {
|
||||||
|
this.callToList = callToList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCallFrom() {
|
||||||
|
return callFrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCallFrom(String callFrom) {
|
||||||
|
this.callFrom = callFrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEachPrice() {
|
||||||
|
return eachPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEachPrice(String eachPrice) {
|
||||||
|
this.eachPrice = eachPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getsPrice() {
|
||||||
|
return sPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setsPrice(String sPrice) {
|
||||||
|
this.sPrice = sPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getmPrice() {
|
||||||
|
return mPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setmPrice(String mPrice) {
|
||||||
|
this.mPrice = mPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getpPrice() {
|
||||||
|
return pPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setpPrice(String pPrice) {
|
||||||
|
this.pPrice = pPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getP2Price() {
|
||||||
|
return p2Price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setP2Price(String p2Price) {
|
||||||
|
this.p2Price = p2Price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getP3Price() {
|
||||||
|
return p3Price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setP3Price(String p3Price) {
|
||||||
|
this.p3Price = p3Price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTotPrice() {
|
||||||
|
return totPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotPrice(String totPrice) {
|
||||||
|
this.totPrice = totPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFileCnt() {
|
||||||
|
return fileCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileCnt(String fileCnt) {
|
||||||
|
this.fileCnt = fileCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsgType() {
|
||||||
|
return msgType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsgType(String msgType) {
|
||||||
|
this.msgType = msgType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getSmsPrice() {
|
||||||
|
return smsPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmsPrice(float smsPrice) {
|
||||||
|
this.smsPrice = smsPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getMmsPrice() {
|
||||||
|
return mmsPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMmsPrice(float mmsPrice) {
|
||||||
|
this.mmsPrice = mmsPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getImgFilePath() {
|
||||||
|
return imgFilePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImgFilePath(String[] imgFilePath) {
|
||||||
|
this.imgFilePath = imgFilePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSpamStatus() {
|
||||||
|
return spamStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpamStatus(String spamStatus) {
|
||||||
|
this.spamStatus = spamStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTxtReplYn() {
|
||||||
|
return txtReplYn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtReplYn(String txtReplYn) {
|
||||||
|
this.txtReplYn = txtReplYn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNameStr() {
|
||||||
|
return nameStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNameStr(String nameStr) {
|
||||||
|
this.nameStr = nameStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRep1Str() {
|
||||||
|
return rep1Str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRep1Str(String rep1Str) {
|
||||||
|
this.rep1Str = rep1Str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRep2Str() {
|
||||||
|
return rep2Str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRep2Str(String rep2Str) {
|
||||||
|
this.rep2Str = rep2Str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRep3Str() {
|
||||||
|
return rep3Str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRep3Str(String rep3Str) {
|
||||||
|
this.rep3Str = rep3Str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRep4Str() {
|
||||||
|
return rep4Str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRep4Str(String rep4Str) {
|
||||||
|
this.rep4Str = rep4Str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getNameList() {
|
||||||
|
return nameList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNameList(String[] nameList) {
|
||||||
|
this.nameList = nameList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getRep1List() {
|
||||||
|
return rep1List;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRep1List(String[] rep1List) {
|
||||||
|
this.rep1List = rep1List;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getRep2List() {
|
||||||
|
return rep2List;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRep2List(String[] rep2List) {
|
||||||
|
this.rep2List = rep2List;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getRep3List() {
|
||||||
|
return rep3List;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRep3List(String[] rep3List) {
|
||||||
|
this.rep3List = rep3List;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getRep4List() {
|
||||||
|
return rep4List;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRep4List(String[] rep4List) {
|
||||||
|
this.rep4List = rep4List;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReserveYn() {
|
||||||
|
return reserveYn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReserveYn(String reserveYn) {
|
||||||
|
this.reserveYn = reserveYn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShortMsgCnt() {
|
||||||
|
return shortMsgCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShortMsgCnt(String shortMsgCnt) {
|
||||||
|
this.shortMsgCnt = shortMsgCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLongMsgCnt() {
|
||||||
|
return longMsgCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLongMsgCnt(String longMsgCnt) {
|
||||||
|
this.longMsgCnt = longMsgCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsgKind() {
|
||||||
|
return msgKind;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsgKind(String msgKind) {
|
||||||
|
this.msgKind = msgKind;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTest_yn() {
|
||||||
|
return test_yn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTest_yn(String test_yn) {
|
||||||
|
this.test_yn = test_yn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,17 @@
|
|||||||
package com.itn.mjonApi.mjon.api.send.service.impl;
|
package com.itn.mjonApi.mjon.api.send.service.impl;
|
||||||
|
|
||||||
import com.itn.mjonApi.cmn.apiServer.ApiService;
|
import com.itn.mjonApi.cmn.apiServer.ApiService;
|
||||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
import com.itn.mjonApi.cmn.model.Price;
|
||||||
import com.itn.mjonApi.cmn.msg.FailRestResponse;
|
import com.itn.mjonApi.cmn.msg.FailRestResponse;
|
||||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.SendSucRestResponse;
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
import com.itn.mjonApi.cmn.msg.StatMsg;
|
import com.itn.mjonApi.cmn.msg.StatMsg;
|
||||||
|
import com.itn.mjonApi.mjon.api.inqry.mapper.PriceMapper;
|
||||||
|
import com.itn.mjonApi.mjon.api.inqry.mapper.domain.PriceVO;
|
||||||
import com.itn.mjonApi.mjon.api.send.mapper.SendMapper;
|
import com.itn.mjonApi.mjon.api.send.mapper.SendMapper;
|
||||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MjonResponseVO;
|
import com.itn.mjonApi.mjon.api.send.mapper.domain.MjonResponseVO;
|
||||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
||||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgsRequestVO;
|
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgsRequestVO;
|
||||||
|
import com.itn.mjonApi.mjon.api.send.mapper.domain.SendSucRestResponse;
|
||||||
import com.itn.mjonApi.mjon.api.send.service.SendService;
|
import com.itn.mjonApi.mjon.api.send.service.SendService;
|
||||||
import com.itn.mjonApi.util.MunjaUtil;
|
import com.itn.mjonApi.util.MunjaUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -33,6 +36,10 @@ public class SendServiceImpl implements SendService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
SendMapper sendMapper;
|
SendMapper sendMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
PriceMapper priceMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public SendServiceImpl(ApiService<Response> apiService) {
|
public SendServiceImpl(ApiService<Response> apiService) {
|
||||||
this.apiService = apiService;
|
this.apiService = apiService;
|
||||||
@ -56,6 +63,7 @@ public class SendServiceImpl implements SendService {
|
|||||||
return new RestResponse(new FailRestResponse("STAT_1010",""));
|
return new RestResponse(new FailRestResponse("STAT_1010",""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
// step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
||||||
// 1020
|
// 1020
|
||||||
// 폰번호 확인 - 빈 값 -> 유효성 정규식
|
// 폰번호 확인 - 빈 값 -> 유효성 정규식
|
||||||
@ -88,6 +96,31 @@ public class SendServiceImpl implements SendService {
|
|||||||
msgRequestVO = this.getLengthOfShortAndLongMsg(msgRequestVO);
|
msgRequestVO = this.getLengthOfShortAndLongMsg(msgRequestVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PriceVO priceVO = Price.priceRefine(msgRequestVO.getMberId(), priceMapper);
|
||||||
|
|
||||||
|
|
||||||
|
// +""; => Double to String 와 같은 기능
|
||||||
|
msgRequestVO.setsPrice(priceVO.getShortPrice()+"");
|
||||||
|
msgRequestVO.setmPrice(priceVO.getLongPrice()+"");
|
||||||
|
msgRequestVO.setpPrice(priceVO.getPicturePrice()+"");
|
||||||
|
|
||||||
|
|
||||||
|
//문자열 길이 체크 해주기
|
||||||
|
// 문자 바이트 계산에 필요한 캐릭터 셋 : 한글 2Byte로 계산
|
||||||
|
int FrBytes = getFrBytes(msgRequestVO);
|
||||||
|
// 단문 장문 단가과 타입 지정
|
||||||
|
if(FrBytes > 90){
|
||||||
|
msgRequestVO.setEachPrice(msgRequestVO.getsPrice());
|
||||||
|
msgRequestVO.setMsgType("6");
|
||||||
|
}else {
|
||||||
|
msgRequestVO.setEachPrice(msgRequestVO.getmPrice());
|
||||||
|
msgRequestVO.setMsgType("4");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 문자 전송하는 부분
|
// 문자 전송하는 부분
|
||||||
// apiService.postForEntity => restTemplate.postForEntity 호출 후 MjonResponseVO에 맞게 데이터 정제하는 메소드
|
// apiService.postForEntity => restTemplate.postForEntity 호출 후 MjonResponseVO에 맞게 데이터 정제하는 메소드
|
||||||
MjonResponseVO munjaSendResponse = apiService.postForEntity(
|
MjonResponseVO munjaSendResponse = apiService.postForEntity(
|
||||||
@ -113,6 +146,12 @@ public class SendServiceImpl implements SendService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int getFrBytes(MsgRequestVO msgRequestVO) throws UnsupportedEncodingException {
|
||||||
|
String smsCont = msgRequestVO.getSmsTxt().replace("\r\n", "\n");
|
||||||
|
int FrBytes = smsCont.getBytes("euc-kr").length;
|
||||||
|
return FrBytes;
|
||||||
|
}
|
||||||
|
|
||||||
private RestResponse _getTestMsgReturnData(String testYn)
|
private RestResponse _getTestMsgReturnData(String testYn)
|
||||||
{
|
{
|
||||||
// YF => 실패 테스트 데이터
|
// YF => 실패 테스트 데이터
|
||||||
@ -176,6 +215,7 @@ public class SendServiceImpl implements SendService {
|
|||||||
if(StringUtils.isNotEmpty(msgsRequestVO.getTest_yn())){
|
if(StringUtils.isNotEmpty(msgsRequestVO.getTest_yn())){
|
||||||
return this._getTestMsgsReturnData(msgsRequestVO.getTest_yn());
|
return this._getTestMsgsReturnData(msgsRequestVO.getTest_yn());
|
||||||
}
|
}
|
||||||
|
|
||||||
// msgsVO -> msgVO List로 변환
|
// msgsVO -> msgVO List로 변환
|
||||||
List<MsgRequestVO> msgRequestVOList = this.getDataCleaning(msgsRequestVO);
|
List<MsgRequestVO> msgRequestVOList = this.getDataCleaning(msgsRequestVO);
|
||||||
|
|
||||||
@ -197,9 +237,41 @@ public class SendServiceImpl implements SendService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//사용자 잔액
|
||||||
|
// double mberMoney = priceMapper.selectMberMoney(mberId);
|
||||||
|
// 이용단가, 발송가능 건수
|
||||||
|
// PriceVO priceVO = this.price_refine(mberId, mberMoney, priceMapper);
|
||||||
|
|
||||||
|
|
||||||
|
PriceVO priceVO = Price.priceRefine(msgsRequestVO.getMberId(), priceMapper);
|
||||||
|
|
||||||
|
// +""; => Double to String 와 같은 기능
|
||||||
|
String sPrice = priceVO.getShortPrice()+"";
|
||||||
|
String mPrice = priceVO.getLongPrice()+"";
|
||||||
|
String pPrice = priceVO.getPicturePrice()+"";
|
||||||
List<MjonResponseVO> mjonResponseVOList = new ArrayList<MjonResponseVO>();
|
List<MjonResponseVO> mjonResponseVOList = new ArrayList<MjonResponseVO>();
|
||||||
for(MsgRequestVO msgRequestVO : msgRequestVOList){
|
for(MsgRequestVO msgRequestVO : msgRequestVOList){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//문자열 길이 체크 해주기
|
||||||
|
// 문자 바이트 계산에 필요한 캐릭터 셋 : 한글 2Byte로 계산
|
||||||
|
int FrBytes = getFrBytes(msgRequestVO);
|
||||||
|
// 단문 장문 단가과 타입 지정
|
||||||
|
if(FrBytes > 90){
|
||||||
|
msgRequestVO.setEachPrice(sPrice);
|
||||||
|
msgRequestVO.setMsgType("6");
|
||||||
|
}else {
|
||||||
|
msgRequestVO.setEachPrice(mPrice);
|
||||||
|
msgRequestVO.setMsgType("4");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 단가 셋팅
|
||||||
|
msgRequestVO.setsPrice(sPrice); // 단문
|
||||||
|
msgRequestVO.setmPrice(mPrice); // 장문
|
||||||
|
msgRequestVO.setpPrice(pPrice); // 사진
|
||||||
|
|
||||||
|
|
||||||
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 30분 지연으로 처리됨
|
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 30분 지연으로 처리됨
|
||||||
// 1030 => 현재 사용안함
|
// 1030 => 현재 사용안함
|
||||||
// 스팸체크 하는 부분
|
// 스팸체크 하는 부분
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
#spring.datasource.url=jdbc:mysql://192.168.0.125:3306/mjon?serverTimezone=Asia/Seoul
|
#spring.datasource.url=jdbc:mysql://192.168.0.125:3306/mjon?serverTimezone=Asia/Seoul
|
||||||
spring.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
spring.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
spring.datasource.url=jdbc:log4jdbc:mysql://192.168.0.125:3306/mjon?serverTimezone=Asia/Seoul
|
spring.datasource.url=jdbc:log4jdbc:mysql://192.168.0.125:3306/mjon?serverTimezone=Asia/Seoul
|
||||||
|
#spring.datasource.url=jdbc:log4jdbc:mysql://139.150.72.157:3306/mjon?serverTimezone=Asia/Seoul
|
||||||
|
|
||||||
spring.datasource.username=mjonUr
|
spring.datasource.username=mjonUr
|
||||||
spring.datasource.password=mjon!@#$
|
spring.datasource.password=mjon!@#$
|
||||||
@ -14,8 +15,9 @@ server.port=8088
|
|||||||
|
|
||||||
logging.level.root=info
|
logging.level.root=info
|
||||||
|
|
||||||
#api.root.url=http://192.168.0.125:8095/
|
|
||||||
api.root.url=http://localhost:8080/
|
api.root.url=http://localhost:8080/
|
||||||
|
#api.root.url=http://192.168.0.125:8095/
|
||||||
|
#api.root.url=https://www.munjaon.co.kr/
|
||||||
|
|
||||||
Ganpandaup.receiver.email=hylee250@kakao.com
|
Ganpandaup.receiver.email=hylee250@kakao.com
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user