Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
bfd860d491
@ -0,0 +1,38 @@
|
||||
package com.itn.mjonApi.mjon.api.inqry.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO;
|
||||
|
||||
/**
|
||||
* @packageName : com.itn.mjonApi.mjon.api.inqry.service.mapper
|
||||
* @fileName : PriceMapper.java
|
||||
* @author : JunHo Lee
|
||||
* @date : 2023.05.15
|
||||
* @description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023.05.15 JunHo Lee 최초 생성
|
||||
*/
|
||||
@Mapper
|
||||
public interface HstryMapper {
|
||||
|
||||
/**
|
||||
* @methodName : selectUserMoney
|
||||
* @author : JunHo Lee
|
||||
* @date : 2023.05.22
|
||||
* @description :
|
||||
* @param priceVO
|
||||
* @return
|
||||
*/
|
||||
//double selectUserMoney(String mberId);
|
||||
|
||||
List<AccessKeyVO> selectApiInqryHstry(String mberId);
|
||||
|
||||
List<AccessKeyVO> selectApiInqryHstryDetail(String mberId, String msgGroupId);
|
||||
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
package com.itn.mjonApi.mjon.api.inqry.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import java.util.Map;
|
||||
|
||||
import com.itn.mjonApi.mjon.api.inqry.mapper.domain.PriceVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @packageName : com.itn.mjonApi.mjon.api.inqry.service.mapper
|
||||
@ -26,6 +26,8 @@ public interface PriceMapper {
|
||||
* @param priceVO
|
||||
* @return
|
||||
*/
|
||||
double selectUserMoney(PriceVO priceVO);
|
||||
double selectUserMoney(String mberId);
|
||||
|
||||
Map<String, String>selectMberPriceInfo(String mberId);
|
||||
|
||||
}
|
||||
|
||||
@ -1,14 +1,20 @@
|
||||
package com.itn.mjonApi.mjon.api.inqry.mapper.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PriceResponse {
|
||||
|
||||
//private HttpStatus status;
|
||||
@ -18,9 +24,15 @@ public class PriceResponse {
|
||||
|
||||
private LocalDateTime localDateTime;
|
||||
|
||||
private Object object;
|
||||
private double shortPrice; // 단문 이용단가
|
||||
private double longPrice; // 장문 이용단가
|
||||
private double picturePrice; // 그림 이용단가
|
||||
|
||||
private List<?> objectList;
|
||||
private double userMoney; // 잔액
|
||||
|
||||
private int shortSendPsbltEa; // 단문 발송 가능건 수
|
||||
private int longSendPsbltEa; // 장문 발송 가능건 수
|
||||
private int pictureSendPsbltEa; // 그림 발송 가능건 수
|
||||
|
||||
/*
|
||||
* 200-OK : 정상접속
|
||||
@ -34,22 +46,23 @@ public class PriceResponse {
|
||||
this.localDateTime = timestamp;
|
||||
}
|
||||
|
||||
public PriceResponse(HttpStatus status, String message, LocalDateTime timestamp, Object object) {
|
||||
this.resultCode = status.value();
|
||||
checkMessage(status, message);
|
||||
|
||||
this.object= object;
|
||||
this.localDateTime = timestamp;
|
||||
}
|
||||
|
||||
public PriceResponse(HttpStatus status, String message, LocalDateTime timestamp, List<?> objectList) {
|
||||
this.resultCode = status.value();
|
||||
checkMessage(status, message);
|
||||
|
||||
this.objectList = objectList;
|
||||
this.localDateTime = timestamp;
|
||||
|
||||
}
|
||||
// public PriceResponse(HttpStatus status
|
||||
// , String message
|
||||
// , LocalDateTime timestamp
|
||||
// , PriceVO priceVO
|
||||
// ) {
|
||||
// this.resultCode = status.value();
|
||||
// checkMessage(status, message);
|
||||
//
|
||||
// this.localDateTime = timestamp;
|
||||
// this.shortPrice = priceVO.getShortPrice();
|
||||
// this.longPrice = priceVO.getLongPrice();
|
||||
// this.picturePrice = priceVO.getPicturePrice();
|
||||
// this.userMoney = priceVO.getUserMoney();
|
||||
// this.shortSendPsbltEa = priceVO.getShortSendPsbltEa();
|
||||
// this.longSendPsbltEa = priceVO.getLongSendPsbltEa();
|
||||
// this.pictureSendPsbltEa = priceVO.getPictureSendPsbltEa();
|
||||
// }
|
||||
|
||||
private void checkMessage(HttpStatus status, String message) {
|
||||
if ("".equals(message)){ this.message = status.name();
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
package com.itn.mjonApi.mjon.api.inqry.service;
|
||||
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.mapper.domain.HstryDetailVO;
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.mapper.domain.HstryResponseVO;
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.mapper.domain.HstryVO;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
||||
|
||||
public interface HstryService {
|
||||
|
||||
|
||||
HstryResponseVO hstryList(MsgRequestVO msgRequestVO) throws Exception;
|
||||
//HstryResponseVO hstryListOld(MsgRequestVO msgRequestVO) throws Exception;
|
||||
|
||||
HstryResponseVO hstryList(HstryVO hstryVO) throws Exception;
|
||||
|
||||
HstryResponseVO hstryDetailList(HstryDetailVO HstryDetailVO) throws Exception;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.itn.mjonApi.mjon.api.inqry.service;
|
||||
|
||||
import com.itn.mjonApi.mjon.api.inqry.mapper.domain.PriceVO;
|
||||
import com.itn.mjonApi.mjon.api.inqry.mapper.domain.PriceResponse;
|
||||
|
||||
/**
|
||||
* @packageName : com.itn.mjonApi.mjon.api.inqry.service
|
||||
@ -15,6 +15,6 @@ import com.itn.mjonApi.mjon.api.inqry.mapper.domain.PriceVO;
|
||||
*/
|
||||
public interface PriceService {
|
||||
|
||||
double selectUserMoney(PriceVO priceVO) throws Exception;
|
||||
public PriceResponse selectUserPrice(String mberId) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@ -1,21 +1,16 @@
|
||||
package com.itn.mjonApi.mjon.api.inqry.service.impl;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.catalina.connector.Response;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.itn.mjonApi.cmn.apiServer.ApiService;
|
||||
import com.itn.mjonApi.mjon.api.inqry.mapper.HstryMapper;
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.HstryService;
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.mapper.domain.HstryDetailVO;
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.mapper.domain.HstryResponseVO;
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.mapper.domain.HstryVO;
|
||||
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.MsgRequestVO;
|
||||
import com.itn.mjonApi.util.MunjaUtil;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@ -26,8 +21,12 @@ public class HstryServiceImpl implements HstryService {
|
||||
|
||||
private ApiService<Response> apiService;
|
||||
|
||||
@Autowired
|
||||
HstryMapper hstryMapper;
|
||||
|
||||
@Autowired
|
||||
SendMapper sendMapper;
|
||||
|
||||
@Autowired
|
||||
public HstryServiceImpl(ApiService<Response> apiService) {
|
||||
this.apiService = apiService;
|
||||
@ -36,291 +35,54 @@ public class HstryServiceImpl implements HstryService {
|
||||
private static final String replaseStrList = "[*이름*],[*1*],[*2*],[*3*],[*4*]";
|
||||
|
||||
@Override
|
||||
public HstryResponseVO hstryList(MsgRequestVO msgRequestVO) throws Exception {
|
||||
public HstryResponseVO hstryList(HstryVO hstryVO) throws Exception {
|
||||
|
||||
//전체 발송 이력
|
||||
log.info(" :: hstryList ::");
|
||||
|
||||
//해당 id에 대한 전체 발송 리스트를 가져온다.
|
||||
HstryResponseVO hstryResponseVO = new HstryResponseVO();
|
||||
|
||||
try {
|
||||
hstryResponseVO = HstryResponseVO.builder()
|
||||
|
||||
Boolean byCallFrom = sendMapper.findByCallFrom(msgRequestVO);
|
||||
log.info(" :: byCallFrom ::" + byCallFrom);
|
||||
if(byCallFrom){
|
||||
.objectList(hstryMapper.selectApiInqryHstry(hstryVO.getMberId()))
|
||||
|
||||
}
|
||||
/*
|
||||
발신번호 체크
|
||||
SELECT PHONE_NUMBER
|
||||
FROM MJ_PHONE_MEMBER
|
||||
WHERE 1=1
|
||||
AND USER_ID = 'goodgkdus'
|
||||
AND AUTH_YN = 'Y'
|
||||
AND PHM_TYPE = '01'
|
||||
ORDER BY BASE_YN DESC
|
||||
* */
|
||||
|
||||
//sendMsg 문자 발송 전 체크 사항
|
||||
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
||||
// 1010
|
||||
|
||||
|
||||
|
||||
//step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
||||
// 1020
|
||||
|
||||
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 안됨
|
||||
// 1030
|
||||
|
||||
//step4.치환명 정상 여부 확인
|
||||
// 1040
|
||||
|
||||
//step5.발송일시 정상여부 확인
|
||||
// 1050
|
||||
|
||||
//step6.문자 타입에 따른 비용 처리 가능 여부 확인
|
||||
// 1060
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String message = "";
|
||||
// 폰번호 확인 - 빈 값 -> 유효성 정규식
|
||||
message = this.getCallToListChk(msgRequestVO);
|
||||
if(StringUtils.isNotEmpty(message)){
|
||||
return HstryResponseVO.builder()
|
||||
.result("fail")
|
||||
.message(message)
|
||||
.build();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info("selectPrice Error [{}]", e.getMessage());
|
||||
}
|
||||
|
||||
return hstryResponseVO;
|
||||
|
||||
// 치환데이터 여부 확인
|
||||
msgRequestVO.setTxtReplYn(this.getTxtReplYn(msgRequestVO));
|
||||
|
||||
if("Y".equals(msgRequestVO.getTxtReplYn())){
|
||||
|
||||
//일괄변환 문자에 콤마(,)가 들어가있으면 배열로 넘길때 문제가 발생하여 특수문자(§)로 치환하여 넘겨주도록 한다.
|
||||
msgRequestVO = this.getReplaceCommaToStrSymbol(msgRequestVO);
|
||||
|
||||
// 치환 후 단문 장문 개수 구하기
|
||||
msgRequestVO = getLengthOfShortAndLongMsg(msgRequestVO);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HstryResponseVO hstryDetailList(HstryDetailVO hstryDetailVO) throws Exception {
|
||||
|
||||
//전체 발송 이력
|
||||
log.info(" :: hstryList ::");
|
||||
|
||||
HstryResponseVO hstryResponseVO = new HstryResponseVO();
|
||||
|
||||
try {
|
||||
hstryResponseVO = HstryResponseVO.builder()
|
||||
|
||||
// 스팸체크 하는 부분
|
||||
MjonResponseVO spamChkEntity = apiService.postForEntity(
|
||||
"/web/user/login/selectSpamTxtChkAjax.do"
|
||||
, msgRequestVO
|
||||
, String.class
|
||||
);
|
||||
.objectList(hstryMapper.selectApiInqryHstryDetail(
|
||||
hstryDetailVO.getMberId()
|
||||
, hstryDetailVO.getMsgGroupId()
|
||||
))
|
||||
|
||||
if("spams".equals(spamChkEntity.getResult())){
|
||||
msgRequestVO.setSpamStatus("Y");
|
||||
};
|
||||
.build();
|
||||
|
||||
log.info("msgRequestVO.getSpamStatus() :: [[}]",msgRequestVO.getSpamStatus());
|
||||
|
||||
// 문자 전송하는 부분
|
||||
MjonResponseVO munjaSendResponse = apiService.postForEntity(
|
||||
"/web/user/login/sendMsgDataAjax.do"
|
||||
, msgRequestVO
|
||||
, String.class
|
||||
);
|
||||
|
||||
|
||||
|
||||
System.out.println("======HstryResponseVO hstryList===");
|
||||
|
||||
return null;
|
||||
// return munjaSendResponse;
|
||||
} catch (Exception e) {
|
||||
log.info("selectPrice Error [{}]", e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 치환 후 단문 장문 msg 개수 구하기
|
||||
* @param msgRequestVO
|
||||
* @return msgRequestVO
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
private static MsgRequestVO getLengthOfShortAndLongMsg(MsgRequestVO msgRequestVO) throws UnsupportedEncodingException {
|
||||
String charset = "euc-kr";
|
||||
int totListCnt = msgRequestVO.getCallToList().length;
|
||||
|
||||
int shortMsgCnt=0; // 치환 후 단문 개수
|
||||
int longMsgCnt=0; // 치환 후 장문 개수
|
||||
for(int i=0; i < totListCnt; i ++) {
|
||||
String smsTxt = msgRequestVO.getSmsTxt().replaceAll(String.valueOf((char)13), ""); //발송 문자 내용
|
||||
|
||||
String[] nameList = msgRequestVO.getNameList(); //치환 이름 리스트
|
||||
String[] phone = msgRequestVO.getCallToList(); //수신자 휴대폰 번호
|
||||
String[] rep1 = msgRequestVO.getRep1List(); //치환 문자1 리스트
|
||||
String[] rep2 = msgRequestVO.getRep2List(); //치환 문자2 리스트
|
||||
String[] rep3 = msgRequestVO.getRep3List(); //치환 문자3 리스트
|
||||
String[] rep4 = msgRequestVO.getRep4List(); //치환 문자4 리스트
|
||||
|
||||
if (smsTxt.indexOf("[*이름*]") > -1) {
|
||||
if(nameList.length > i && StringUtils.isNotEmpty(nameList[i])) {
|
||||
smsTxt = smsTxt.replaceAll("\\[\\*이름\\*\\]", MunjaUtil.getString(nameList[i].replaceAll("§", ",")));
|
||||
}else {
|
||||
smsTxt = smsTxt.replaceAll("\\[\\*이름\\*\\]", "");
|
||||
}
|
||||
}
|
||||
if (smsTxt.indexOf("[*1*]") > -1) {
|
||||
if(rep1.length > i && StringUtils.isNotEmpty(rep1[i])) {
|
||||
smsTxt = smsTxt.replaceAll("\\[\\*1\\*\\]", MunjaUtil.getString(rep1[i].replaceAll("§", ",")));
|
||||
}else {
|
||||
smsTxt = smsTxt.replaceAll("\\[\\*1\\*\\]", "");
|
||||
}
|
||||
}
|
||||
if (smsTxt.indexOf("[*2*]") > -1) {
|
||||
if(rep2.length > i && StringUtils.isNotEmpty(rep2[i])) {
|
||||
smsTxt = smsTxt.replaceAll("\\[\\*2\\*\\]", MunjaUtil.getString(rep2[i].replaceAll("§", ",")));
|
||||
}else {
|
||||
smsTxt = smsTxt.replaceAll("\\[\\*2\\*\\]", "");
|
||||
}
|
||||
}
|
||||
if (smsTxt.indexOf("[*3*]") > -1) {
|
||||
if(rep3.length > i && StringUtils.isNotEmpty(rep3[i])) {
|
||||
smsTxt = smsTxt.replaceAll("\\[\\*3\\*\\]", MunjaUtil.getString(rep3[i].replaceAll("§", ",")));
|
||||
}else {
|
||||
smsTxt = smsTxt.replaceAll("\\[\\*3\\*\\]", "");
|
||||
}
|
||||
}
|
||||
if (smsTxt.indexOf("[*4*]") > -1) {
|
||||
if(rep4.length > i && StringUtils.isNotEmpty(rep4[i])) {
|
||||
smsTxt = smsTxt.replaceAll("\\[\\*4\\*\\]", MunjaUtil.getString(rep4[i].replaceAll("§", ",")));
|
||||
}else {
|
||||
smsTxt = smsTxt.replaceAll("\\[\\*4\\*\\]", "");
|
||||
}
|
||||
}
|
||||
return hstryResponseVO;
|
||||
|
||||
|
||||
int bytes = smsTxt.getBytes(charset).length;
|
||||
|
||||
if(bytes > 90) {//장문문자 리스트 만들기
|
||||
longMsgCnt++;
|
||||
}else {//단문문자 리스트 만들기
|
||||
shortMsgCnt++;
|
||||
}
|
||||
}
|
||||
msgRequestVO.setLongMsgCnt(Integer.toString(longMsgCnt));
|
||||
msgRequestVO.setShortMsgCnt(Integer.toString(shortMsgCnt));
|
||||
|
||||
return msgRequestVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 치환문자가 있으면 , => §로 치환
|
||||
* @param msgRequestVO
|
||||
* @return
|
||||
*/
|
||||
private static MsgRequestVO getReplaceCommaToStrSymbol(MsgRequestVO msgRequestVO) {
|
||||
|
||||
AtomicInteger index = new AtomicInteger();
|
||||
|
||||
// 이름 배열
|
||||
if(StringUtils.isNotEmpty(msgRequestVO.getNameStr()))
|
||||
{
|
||||
msgRequestVO.setNameList(msgRequestVO.getNameStr().split("\\|"));
|
||||
String[] nameList = new String[msgRequestVO.getNameList().length];
|
||||
Arrays.stream(msgRequestVO.getNameList()).forEach(name -> {
|
||||
nameList[index.getAndIncrement()] = MunjaUtil.replaceCommaToStrSymbol(name);
|
||||
});
|
||||
msgRequestVO.setNameList(nameList);
|
||||
}
|
||||
|
||||
// Rep1 배열
|
||||
if(StringUtils.isNotEmpty(msgRequestVO.getRep1Str()))
|
||||
{
|
||||
index.set(0);
|
||||
msgRequestVO.setRep1List(msgRequestVO.getRep1Str().split("\\|"));
|
||||
String[] rep1List = new String[msgRequestVO.getRep1List().length];
|
||||
Arrays.stream(msgRequestVO.getRep1List()).forEach(str -> {
|
||||
rep1List[index.getAndIncrement()] = MunjaUtil.replaceCommaToStrSymbol(str);
|
||||
});
|
||||
msgRequestVO.setRep1List(rep1List);
|
||||
|
||||
}
|
||||
|
||||
// Rep2 배열
|
||||
if(StringUtils.isNotEmpty(msgRequestVO.getRep2Str()))
|
||||
{
|
||||
index.set(0);
|
||||
msgRequestVO.setRep2List(msgRequestVO.getRep2Str().split("\\|"));
|
||||
String[] rep2List = new String[msgRequestVO.getRep2List().length];
|
||||
Arrays.stream(msgRequestVO.getRep2List()).forEach(str -> {
|
||||
rep2List[index.getAndIncrement()] = MunjaUtil.replaceCommaToStrSymbol(str);
|
||||
});
|
||||
msgRequestVO.setRep2List(rep2List);
|
||||
}
|
||||
|
||||
// Rep3 배열
|
||||
if(StringUtils.isNotEmpty(msgRequestVO.getRep3Str()))
|
||||
{
|
||||
index.set(0);
|
||||
msgRequestVO.setRep3List(msgRequestVO.getRep3Str().split("\\|"));
|
||||
String[] rep3List = new String[msgRequestVO.getRep3List().length];
|
||||
Arrays.stream(msgRequestVO.getRep3List()).forEach(str -> {
|
||||
rep3List[index.getAndIncrement()] = MunjaUtil.replaceCommaToStrSymbol(str);
|
||||
});
|
||||
msgRequestVO.setRep3List(rep3List);
|
||||
}
|
||||
|
||||
// Rep4 배열
|
||||
if(StringUtils.isNotEmpty(msgRequestVO.getRep4Str()))
|
||||
{
|
||||
index.set(0);
|
||||
msgRequestVO.setRep4List(msgRequestVO.getRep4Str().split("\\|"));
|
||||
String[] rep4List = new String[msgRequestVO.getRep4List().length];
|
||||
Arrays.stream(msgRequestVO.getRep4List()).forEach(str -> {
|
||||
rep4List[index.getAndIncrement()] = MunjaUtil.replaceCommaToStrSymbol(str);
|
||||
});
|
||||
msgRequestVO.setRep4List(rep4List);
|
||||
}
|
||||
return msgRequestVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 치환 문자 여부 확인
|
||||
* @param msgRequestVO
|
||||
* @return
|
||||
*/
|
||||
private static String getTxtReplYn(MsgRequestVO msgRequestVO) {
|
||||
|
||||
int callLen = msgRequestVO.getCallToList().length;
|
||||
// 치환 데이터 확인
|
||||
Arrays.stream(replaseStrList.split(",")).forEach(
|
||||
str -> {
|
||||
if(msgRequestVO.getSmsTxt().indexOf(str) > -1){
|
||||
msgRequestVO.setTxtReplYn("Y");
|
||||
}
|
||||
}
|
||||
);
|
||||
return msgRequestVO.getTxtReplYn();
|
||||
}
|
||||
|
||||
/**
|
||||
* 수신자 목록 번호 검증
|
||||
* @param msgRequestVO
|
||||
* @return
|
||||
*/
|
||||
private static String getCallToListChk(MsgRequestVO msgRequestVO) {
|
||||
String message = "";
|
||||
for(String callTo : msgRequestVO.getCallToList()){
|
||||
if(!MunjaUtil.checkPhoneNumberEmpty(callTo)){
|
||||
message = "수신 목록에 핸드폰 번호가 없는 항목이 있습니다."; break;};
|
||||
if(!MunjaUtil.validatePNumWithRegex(callTo)){
|
||||
message = "휴대폰 번호가 올바르지 않습니다. : " + callTo; break;};
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,12 +1,17 @@
|
||||
package com.itn.mjonApi.mjon.api.inqry.service.impl;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.itn.mjonApi.mjon.api.inqry.mapper.PriceMapper;
|
||||
import com.itn.mjonApi.mjon.api.inqry.mapper.domain.PriceResponse;
|
||||
import com.itn.mjonApi.mjon.api.inqry.mapper.domain.PriceVO;
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.PriceService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @packageName : com.itn.mjonApi.mjon.api.inqry.service.impl
|
||||
* @fileName : PriceServiceImpl.java
|
||||
@ -18,6 +23,7 @@ import com.itn.mjonApi.mjon.api.inqry.service.PriceService;
|
||||
* -----------------------------------------------------------
|
||||
* 2023.05.15 JunHo Lee 최초 생성
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PriceServiceImpl implements PriceService {
|
||||
|
||||
@ -25,7 +31,72 @@ public class PriceServiceImpl implements PriceService {
|
||||
PriceMapper priceMapper;
|
||||
|
||||
@Override
|
||||
public double selectUserMoney(PriceVO priceVO) throws Exception {
|
||||
return priceMapper.selectUserMoney(priceVO);
|
||||
public PriceResponse selectUserPrice(String mberId) throws Exception {
|
||||
|
||||
PriceResponse priceResponse = new PriceResponse();
|
||||
|
||||
try {
|
||||
// 이용단가
|
||||
PriceVO priceVO = price_refine(mberId, priceMapper);
|
||||
// 발송가능건수
|
||||
sendEa_refine(priceVO);
|
||||
|
||||
priceResponse = PriceResponse.builder()
|
||||
//1. 잔액
|
||||
.userMoney(priceMapper.selectUserMoney(mberId))
|
||||
//2. 이용단가
|
||||
.shortPrice(priceVO.getShortPrice())
|
||||
.longPrice(priceVO.getLongPrice())
|
||||
.picturePrice(priceVO.getPicturePrice())
|
||||
//3. 발송가능건수
|
||||
.shortSendPsbltEa(0)
|
||||
.longSendPsbltEa(0)
|
||||
.pictureSendPsbltEa(0)
|
||||
.build();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info("selectPrice Error [{}]", e.getMessage());
|
||||
}
|
||||
|
||||
return priceResponse;
|
||||
}
|
||||
|
||||
private PriceVO price_refine(String mberId, 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.시스템 기본 단가 정보 불러오기
|
||||
//2.사용자 개인 단가 정보 불러오기
|
||||
Map<String, String> priceMap = priceMapper.selectMberPriceInfo(mberId);
|
||||
|
||||
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")));
|
||||
|
||||
// SMS 인경우
|
||||
// 사용자 개인 단가가 없으면 시스템 단가로
|
||||
PriceVO priceVO = PriceVO.builder()
|
||||
.shortPrice(shortPrice == 0.0f ? sys_shortPrice : shortPrice)
|
||||
.longPrice(longPrice == 0.0f ? sys_longPrice : longPrice)
|
||||
.picturePrice(picturePrice == 0.0f ? sys_picturePrice : picturePrice)
|
||||
.build();
|
||||
return priceVO;
|
||||
}
|
||||
|
||||
private PriceVO sendEa_refine(PriceVO priceVO) {
|
||||
|
||||
return priceVO;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
package com.itn.mjonApi.mjon.api.inqry.service.mapper.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(description = "전체 발송 정보에 필요한 값들을 받는 vo")
|
||||
public class HstryDetailVO implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = -7865729705175845268L;
|
||||
|
||||
@ApiModelProperty(value = "사용자 ID", example = "goodgkdus", required = true)
|
||||
private String mberId;
|
||||
|
||||
@ApiModelProperty(value = "Api Key", example = "0367a25ec370d1141898a0b9767103", required = true)
|
||||
private String accessKey;
|
||||
|
||||
@ApiModelProperty(value = "msg_group_id", example = "MSGGID_0000000011418", required = true)
|
||||
private String msgGroupId;
|
||||
|
||||
@ApiModelProperty(value = "page 번호", example = "1")
|
||||
private String page;
|
||||
|
||||
@ApiModelProperty(value = "page 당 출력갯수 30~500", example = "30")
|
||||
private String pageSize;
|
||||
|
||||
|
||||
|
||||
//private String mberId; // 사용자 ID
|
||||
|
||||
// private double shortPrice; // 단문 이용단가
|
||||
// private double longPrice; // 장문 이용단가
|
||||
// private double picturePrice; // 그림 이용단가
|
||||
|
||||
// private double userMoney; // 잔액
|
||||
|
||||
// private int sendPsbltEa; //발송 가능건 수
|
||||
|
||||
}
|
||||
@ -1,9 +1,16 @@
|
||||
package com.itn.mjonApi.mjon.api.inqry.service.mapper.domain;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.*;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.cmn.msg
|
||||
@ -23,27 +30,61 @@ import org.springframework.http.ResponseEntity;
|
||||
@AllArgsConstructor
|
||||
public class HstryResponseVO {
|
||||
|
||||
private String result;
|
||||
//private HttpStatus status;
|
||||
private int resultCode;
|
||||
|
||||
private String message;
|
||||
private String resultSts; // 전송결과 갯수
|
||||
private String resultBlockSts; // 수신거부 갯수
|
||||
private String msgGroupId;
|
||||
private String afterCash;
|
||||
|
||||
private LocalDateTime localDateTime;
|
||||
|
||||
|
||||
private List<?> objectList; //목록 배열
|
||||
//mid - 메시지ID
|
||||
//type - 문자구분(유형)
|
||||
//sender - 발신번호
|
||||
//sms_count - 전송요청수
|
||||
//reserve_state - 요청상태
|
||||
//msg - 메시지 내용
|
||||
//fail_count - 처리실패건수
|
||||
//reg_date - 등록일
|
||||
//reserve - 예약일자
|
||||
|
||||
private String next_yn; // 다음 조회 목록여부
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* 200-OK : 정상접속
|
||||
* 401-Unauthorized : 인증실패
|
||||
*
|
||||
* @param stringResponseEntity
|
||||
* @return ResponseEntity vo convert
|
||||
* @throws JsonProcessingException
|
||||
*/
|
||||
public static HstryResponseVO getMjonResponse(ResponseEntity<String> stringResponseEntity) throws JsonProcessingException {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
* */
|
||||
|
||||
HstryResponseVO mjonResponseVO = objectMapper.readValue(stringResponseEntity.getBody(), HstryResponseVO.class);
|
||||
return mjonResponseVO;
|
||||
public HstryResponseVO(HttpStatus status, String message, LocalDateTime timestamp) {
|
||||
this.resultCode = status.value();
|
||||
checkMessage(status, message);
|
||||
this.localDateTime = timestamp;
|
||||
}
|
||||
|
||||
// public PriceResponse(HttpStatus status
|
||||
// , String message
|
||||
// , LocalDateTime timestamp
|
||||
// , PriceVO priceVO
|
||||
// ) {
|
||||
// this.resultCode = status.value();
|
||||
// checkMessage(status, message);
|
||||
//
|
||||
// this.localDateTime = timestamp;
|
||||
// this.shortPrice = priceVO.getShortPrice();
|
||||
// this.longPrice = priceVO.getLongPrice();
|
||||
// this.picturePrice = priceVO.getPicturePrice();
|
||||
// this.userMoney = priceVO.getUserMoney();
|
||||
// this.shortSendPsbltEa = priceVO.getShortSendPsbltEa();
|
||||
// this.longSendPsbltEa = priceVO.getLongSendPsbltEa();
|
||||
// this.pictureSendPsbltEa = priceVO.getPictureSendPsbltEa();
|
||||
// }
|
||||
|
||||
private void checkMessage(HttpStatus status, String message) {
|
||||
if ("".equals(message)){ this.message = status.name();
|
||||
}else { this.message = message; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,16 +2,42 @@ package com.itn.mjonApi.mjon.api.inqry.service.mapper.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(description = "전체 발송 정보에 필요한 값들을 받는 vo")
|
||||
public class HstryVO implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = -7865729705175845268L;
|
||||
|
||||
private String mberId; // 사용자 ID
|
||||
@ApiModelProperty(value = "사용자 ID", example = "goodgkdus", required = true)
|
||||
private String mberId;
|
||||
|
||||
@ApiModelProperty(value = "Api Key", example = "0367a25ec370d1141898a0b9767103", required = true)
|
||||
private String accessKey;
|
||||
|
||||
@ApiModelProperty(value = "page 번호", example = "1")
|
||||
private String page;
|
||||
|
||||
@ApiModelProperty(value = "page 당 출력갯수 30~500", example = "30")
|
||||
private String pageSize;
|
||||
|
||||
@ApiModelProperty(value = "조회시작일자 기본값 오늘", example = "20230523")
|
||||
private String startDate;
|
||||
|
||||
@ApiModelProperty(value = "조회마감일자 기본값 내일", example = "20230524")
|
||||
private String endDate;
|
||||
|
||||
|
||||
//private String mberId; // 사용자 ID
|
||||
|
||||
// private double shortPrice; // 단문 이용단가
|
||||
// private double longPrice; // 장문 이용단가
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
package com.itn.mjonApi.mjon.api.inqry.web;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.HstryService;
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.mapper.domain.HstryDetailVO;
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.mapper.domain.HstryResponseVO;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.mapper.domain.HstryVO;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -40,7 +42,6 @@ public class HstryRestController {
|
||||
@Autowired
|
||||
private HstryService hstryService;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param msgRequestVO
|
||||
@ -50,10 +51,28 @@ public class HstryRestController {
|
||||
@CrossOrigin("*") // 모든 요청에 접근 허용
|
||||
@PostMapping("/api/inqry/hstry")
|
||||
@ApiOperation(value= "전송 내역 조회", notes = "전체 전송 내역 조회")
|
||||
public HstryResponseVO inqryHstry(MsgRequestVO msgRequestVO) throws Exception {
|
||||
public ResponseEntity<HstryResponseVO> apiInqryHstry(HstryVO hstryVO) throws Exception {
|
||||
|
||||
return hstryService.hstryList(msgRequestVO);
|
||||
return ResponseEntity.ok(hstryService.hstryList(hstryVO));
|
||||
|
||||
//return sendService.sendMsgData(msgRequestVO);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param msgRequestVO
|
||||
* @Discription 문자 발송 테스트
|
||||
* @return
|
||||
*/
|
||||
@CrossOrigin("*") // 모든 요청에 접근 허용
|
||||
@PostMapping("/api/inqry/hstryDetail")
|
||||
@ApiOperation(value= "전송 내역 조회(상세)", notes = "상세 전송 내역 조회")
|
||||
public ResponseEntity<HstryResponseVO> apiInqryHstryDetail(HstryDetailVO hstryDetailVO) throws Exception {
|
||||
|
||||
return ResponseEntity.ok(hstryService.hstryDetailList(hstryDetailVO));
|
||||
|
||||
//return sendService.sendMsgData(msgRequestVO);
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,6 @@
|
||||
package com.itn.mjonApi.mjon.api.inqry.web;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -12,8 +9,6 @@ import com.itn.mjonApi.mjon.api.inqry.mapper.domain.PriceResponse;
|
||||
import com.itn.mjonApi.mjon.api.inqry.mapper.domain.PriceVO;
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.PriceService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @packageName : com.itn.mjonApi.mjon.api.inqry.web
|
||||
* @fileName : PriceRestController.java
|
||||
@ -25,7 +20,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* -----------------------------------------------------------
|
||||
* 2023.05.15 JunHo Lee 최초 생성
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class PriceRestController {
|
||||
|
||||
@ -37,28 +31,11 @@ public class PriceRestController {
|
||||
* @author : JunHo Lee
|
||||
* @date : 2023.05.16
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/api/inqry/selectPrice")
|
||||
public ResponseEntity<PriceResponse> selectPrice(PriceVO priceVO){
|
||||
public ResponseEntity<PriceResponse> selectPrice(PriceVO priceVO) throws Exception{
|
||||
|
||||
PriceVO resultVO = new PriceVO();
|
||||
|
||||
System.out.println(priceVO.getMberId());
|
||||
//1. 잔액
|
||||
try {
|
||||
// resultVO.builder()
|
||||
// .userMoney(priceService.selectUserMoney(priceVO)).b;
|
||||
resultVO = PriceVO.builder()
|
||||
.userMoney(priceService.selectUserMoney(priceVO))
|
||||
.build();
|
||||
//2. 이용단가
|
||||
|
||||
//3. 발송가능건수
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info("selectPrice Error [{}]", e.getMessage());
|
||||
return ResponseEntity.ok(priceService.selectUserPrice(priceVO.getMberId()));
|
||||
}
|
||||
return ResponseEntity.ok(new PriceResponse(HttpStatus.OK, "test" , LocalDateTime.now(), resultVO.getUserMoney()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
466
src/main/resources/mapper/api/inqry/HstryMapper.xml
Normal file
466
src/main/resources/mapper/api/inqry/HstryMapper.xml
Normal file
@ -0,0 +1,466 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.itn.mjonApi.mjon.api.inqry.mapper.HstryMapper">
|
||||
|
||||
<select id="selectApiInqryHstry"
|
||||
resultType="hashmap"
|
||||
>
|
||||
|
||||
/* 문자온 발송결과 페이지 쿼리를 그대로 사용함 - http://localhost:9080/web/mjon/msgsent/selectMsgSentView.do */
|
||||
SELECT
|
||||
AAA.totMsgCnt
|
||||
, AAA.userId
|
||||
, AAA.msgGroupId
|
||||
, AAA.msgGroupCnt
|
||||
, AAA.smsTxt
|
||||
, AAA.subject
|
||||
, AAA.regdate
|
||||
, AAA.reqdate
|
||||
, AAA.curState
|
||||
, AAA.msgType
|
||||
, AAA.reserveCYn
|
||||
, AAA.msgTypeName
|
||||
, AAA.msgResult
|
||||
|
||||
, SUM(if(bbb.msgresultSts='W',bbb.msgResultCnt, 0)) w_cnt
|
||||
, SUM(if(bbb.msgresultSts='S',bbb.msgResultCnt, 0)) s_cnt
|
||||
, SUM(if(bbb.msgresultSts='F',bbb.msgResultCnt, 0)) f_cnt
|
||||
|
||||
, SUM(if(bbb.msgresultSts='W',bbb.msgResultCnt, 0))
|
||||
+ SUM(if(bbb.msgresultSts='S',bbb.msgResultCnt, 0))
|
||||
+ SUM(if(bbb.msgresultSts='F',bbb.msgResultCnt, 0)) ttl_cnt
|
||||
|
||||
FROM (
|
||||
SELECT COUNT(USER_ID) OVER() AS totMsgCnt ,
|
||||
USER_ID AS userId ,
|
||||
MSG_GROUP_ID AS msgGroupId ,
|
||||
MSG_GROUP_CNT AS msgGroupCnt ,
|
||||
SMS_TXT AS smsTxt ,
|
||||
SUBJECT AS subject ,
|
||||
DATE_FORMAT(REGDATE, '%Y-%m-%d %T') AS regdate ,
|
||||
DATE_FORMAT(REQ_DATE, '%Y-%m-%d %T') AS reqdate ,
|
||||
/*
|
||||
CALL_FROM AS callFrom ,
|
||||
CALL_TO AS callTo ,
|
||||
IFNULL(ADDR_NM, '-') AS addrNm ,
|
||||
TOT_PRICE AS totPrice ,
|
||||
EACH_PRICE AS eachPrice ,
|
||||
*/
|
||||
CUR_STATE AS curState ,
|
||||
/*
|
||||
RSLT_CODE AS rsltCode ,
|
||||
RSLT_CODE2 AS rsltCode2 ,
|
||||
IF( (RSLT_CODE != '0'
|
||||
AND RSLT_CODE != '100'
|
||||
AND RSLT_CODE != '101'
|
||||
AND RSLT_CODE != '110'
|
||||
AND RSLT_CODE != '800'
|
||||
AND RSLT_CODE != '4100'
|
||||
AND RSLT_CODE != '6600'
|
||||
AND RSLT_CODE != '1000'
|
||||
AND RSLT_CODE != '1001' OR RSLT_CODE2 != '0' ) , '1' ,'0') AS orderByrsltCode ,
|
||||
DEL_FLAG AS delFlag ,
|
||||
*/
|
||||
MSG_TYPE AS msgType ,
|
||||
/*
|
||||
FILE_CNT AS fileCnt ,
|
||||
AGENT_CODE AS agentCode ,
|
||||
*/
|
||||
RESERVE_C_YN AS reserveCYn ,
|
||||
/*
|
||||
CANCELDATE AS cancelDate ,
|
||||
'' AS msgId ,
|
||||
*/
|
||||
msgTypeName AS msgTypeName ,
|
||||
/*
|
||||
orderByCode AS orderByCode ,
|
||||
*/
|
||||
RESULT AS msgResult
|
||||
FROM ( SELECT B.USER_ID ,
|
||||
B.MSG_GROUP_ID ,
|
||||
B.MSG_GROUP_CNT ,
|
||||
B.SMS_TXT ,
|
||||
B.SUBJECT ,
|
||||
B.REGDATE ,
|
||||
B.REQ_DATE ,
|
||||
B.CALL_FROM ,
|
||||
B.TOT_PRICE ,
|
||||
B.EACH_PRICE ,
|
||||
B.DEL_FLAG ,
|
||||
B.MSG_TYPE ,
|
||||
B.FILE_CNT ,
|
||||
B.AGENT_CODE ,
|
||||
B.RESERVE_C_YN ,
|
||||
B.CANCELDATE ,
|
||||
A.MSG_SEQ ,
|
||||
A.CALL_TO ,
|
||||
A.CUR_STATE ,
|
||||
A.RSLT_CODE ,
|
||||
A.RSLT_CODE2 ,
|
||||
CASE
|
||||
WHEN B.MSG_TYPE = '6'
|
||||
AND B.FILE_CNT > 0
|
||||
THEN '그림(MMS)'
|
||||
WHEN B.MSG_TYPE = '6'
|
||||
AND B.FILE_CNT = 0
|
||||
THEN '장문(LMS)'
|
||||
ELSE '단문(SMS)'
|
||||
END msgTypeName ,
|
||||
CASE
|
||||
WHEN B.MSG_TYPE = '6'
|
||||
AND B.FILE_CNT > 0
|
||||
THEN '3'
|
||||
WHEN B.MSG_TYPE = '6'
|
||||
AND B.FILE_CNT = 0
|
||||
THEN '2'
|
||||
ELSE '1'
|
||||
END orderByCode , (
|
||||
CASE
|
||||
WHEN A.AGENT_CODE = '01'
|
||||
AND
|
||||
(
|
||||
A.RSLT_CODE = '100'
|
||||
AND
|
||||
(
|
||||
A.RSLT_CODE2 = '0'
|
||||
)
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN A.AGENT_CODE = '02'
|
||||
AND
|
||||
(
|
||||
A.RSLT_CODE = '0'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN A.AGENT_CODE = '03'
|
||||
AND
|
||||
(
|
||||
A.RSLT_CODE = '100' OR A.RSLT_CODE = '101' OR A.RSLT_CODE = '110' OR A.RSLT_CODE = '800'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN A.AGENT_CODE = '04'
|
||||
AND
|
||||
(
|
||||
A.RSLT_CODE = '4100' OR A.RSLT_CODE = '6600' OR A.RSLT_CODE = '7000'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN A.AGENT_CODE = '05'
|
||||
AND
|
||||
(
|
||||
A.RSLT_CODE = '1000' OR A.RSLT_CODE = '1001'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN A.AGENT_CODE = '07'
|
||||
AND
|
||||
(
|
||||
A.RSLT_CODE = '6' OR A.RSLT_CODE = '1000'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN
|
||||
(
|
||||
A.RSLT_CODE IS NULL
|
||||
AND A.RSLT_CODE2 IS NULL
|
||||
AND A.SENT_DATE IS NULL
|
||||
AND A.RSLT_DATE IS NULL
|
||||
)
|
||||
THEN 'W'
|
||||
ELSE 'F'
|
||||
END ) AS RESULT
|
||||
/* common query */
|
||||
FROM MJ_MSG_DATA A ,
|
||||
MJ_MSG_GROUP_DATA B
|
||||
WHERE A.MSG_GROUP_ID = B.MSG_GROUP_ID
|
||||
AND IFNULL(B.DEL_FLAG,'N') = 'N'
|
||||
AND A.DEL_FLAG = 'N'
|
||||
AND B.USER_ID = #{mberId}
|
||||
AND B.DEL_FLAG ='N'
|
||||
AND B.RESERVE_C_YN = 'N'
|
||||
AND DATE_ADD(NOW(), INTERVAL 60 MINUTE) >= B.REQ_DATE
|
||||
)
|
||||
M
|
||||
LEFT JOIN
|
||||
( SELECT ADDR_PHONE_NO ,
|
||||
ADDR_NM
|
||||
FROM MJ_ADDR
|
||||
WHERE 1 =1
|
||||
AND MBER_ID = #{mberId}
|
||||
GROUP BY ADDR_PHONE_NO
|
||||
)
|
||||
MA
|
||||
ON M.CALL_TO = MA.ADDR_PHONE_NO
|
||||
WHERE 1 =1
|
||||
AND CUR_STATE IN ('0',
|
||||
'1',
|
||||
'2',
|
||||
'3')
|
||||
AND MSG_TYPE IN ('4',
|
||||
'6')
|
||||
GROUP BY MSG_GROUP_ID
|
||||
/*
|
||||
ORDER BY 1=1,
|
||||
MSG_GROUP_ID DESC ,
|
||||
regdate DESC
|
||||
*/
|
||||
LIMIT 100
|
||||
OFFSET 0
|
||||
)AAA
|
||||
,(
|
||||
|
||||
|
||||
SELECT A.MSG_GROUP_ID AS msgGroupId ,
|
||||
A.USERDATA AS msgSeq ,
|
||||
COUNT(RESULT) AS msgResultCnt ,
|
||||
RESULT AS msgResultSts ,
|
||||
A.RSLT_CODE AS rsltCode ,
|
||||
A.RSLT_CODE2 AS rsltCode2 ,
|
||||
A.AGENT_CODE AS agentCode ,
|
||||
A.EACH_PRICE AS eachPrice
|
||||
FROM (SELECT MD.MSG_ID ,
|
||||
MD.MSG_GROUP_ID ,
|
||||
MD.USERDATA ,
|
||||
MD.CUR_STATE ,
|
||||
MD.SENT_DATE , (
|
||||
CASE
|
||||
WHEN MD.AGENT_CODE = '01'
|
||||
AND
|
||||
(
|
||||
MD.RSLT_CODE = '100'
|
||||
AND
|
||||
(
|
||||
MD.RSLT_CODE2 = '0'
|
||||
)
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN MD.AGENT_CODE = '02'
|
||||
AND
|
||||
(
|
||||
MD.RSLT_CODE = '0'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN MD.AGENT_CODE = '03'
|
||||
AND
|
||||
(
|
||||
MD.RSLT_CODE = '100' OR MD.RSLT_CODE = '101' OR MD.RSLT_CODE = '110' OR MD.RSLT_CODE = '800'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN MD.AGENT_CODE = '04'
|
||||
AND
|
||||
(
|
||||
MD.RSLT_CODE = '4100' OR MD.RSLT_CODE = '6600'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN MD.AGENT_CODE = '05'
|
||||
AND
|
||||
(
|
||||
MD.RSLT_CODE = '1000' OR MD.RSLT_CODE = '1001'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN MD.AGENT_CODE = '07'
|
||||
AND
|
||||
(
|
||||
MD.RSLT_CODE = '6' OR MD.RSLT_CODE = '1000'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN
|
||||
(
|
||||
MD.RSLT_CODE IS NULL
|
||||
AND MD.RSLT_CODE2 IS NULL
|
||||
AND MD.SENT_DATE IS NULL
|
||||
AND MD.RSLT_DATE IS NULL
|
||||
)
|
||||
THEN 'W'
|
||||
ELSE 'F'
|
||||
END ) AS RESULT ,
|
||||
MD.RSLT_CODE ,
|
||||
MD.RSLT_CODE2 ,
|
||||
MD.AGENT_CODE ,
|
||||
MG.EACH_PRICE
|
||||
FROM MJ_MSG_DATA MD
|
||||
LEFT JOIN MJ_MSG_GROUP_DATA MG
|
||||
ON MD.MSG_GROUP_ID = MG.MSG_GROUP_ID
|
||||
WHERE 1 =1
|
||||
AND MD.DEL_FLAG = 'N'
|
||||
AND MD.MSG_TYPE IN ('4',
|
||||
'6')
|
||||
)
|
||||
A
|
||||
GROUP BY A.MSG_GROUP_ID,
|
||||
RESULT
|
||||
ORDER BY A.MSG_GROUP_ID DESC
|
||||
|
||||
|
||||
|
||||
)BBB
|
||||
|
||||
WHERE aaa.msgGroupId=bbb.msgGroupId
|
||||
GROUP BY
|
||||
AAA.totMsgCnt
|
||||
, AAA.userId
|
||||
, AAA.msgGroupId
|
||||
, AAA.msgGroupCnt
|
||||
, AAA.smsTxt
|
||||
, AAA.subject
|
||||
, AAA.regdate
|
||||
, AAA.reqdate
|
||||
, AAA.curState
|
||||
, AAA.msgType
|
||||
, AAA.reserveCYn
|
||||
, AAA.msgTypeName
|
||||
, AAA.msgResult
|
||||
|
||||
ORDER BY 1=1,
|
||||
AAA.msgGroupId DESC ,
|
||||
AAA.regdate DESC
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectApiInqryHstryDetail"
|
||||
resultType="hashmap"
|
||||
>
|
||||
|
||||
/* 문자온 발송결과 페이지 실패 건수 팝업을 변형해서 사용함 - http://localhost:9080/web/mjon/msgsent/selectMsgSFDetailListAjax.do */
|
||||
|
||||
SELECT COUNT(USER_ID) OVER() AS totMsgCnt ,
|
||||
/*
|
||||
USER_ID AS userId ,
|
||||
IFNULL(ADDR_NM, '-') AS addrNm ,
|
||||
*/
|
||||
MSG_GROUP_ID AS msgGroupId ,
|
||||
'1' AS msgGroupCnt ,
|
||||
SMS_TXT AS smsTxt ,
|
||||
SUBJECT AS subject ,
|
||||
DATE_FORMAT(REGDATE, '%Y-%m-%d %T') AS regdate ,
|
||||
DATE_FORMAT(REQ_DATE, '%Y-%m-%d %T') AS reqdate ,
|
||||
CALL_FROM AS callFrom ,
|
||||
CALL_TO AS callTo ,
|
||||
/*
|
||||
TOT_PRICE AS totPrice ,
|
||||
EACH_PRICE AS eachPrice ,
|
||||
*/
|
||||
CUR_STATE AS curState ,
|
||||
/*
|
||||
RSLT_CODE AS rsltCode ,
|
||||
RSLT_CODE2 AS rsltCode2 ,
|
||||
DEL_FLAG AS delFlag ,
|
||||
*/
|
||||
MSG_TYPE AS msgType ,
|
||||
/*
|
||||
FILE_CNT AS fileCnt ,
|
||||
AGENT_CODE AS agentCode ,
|
||||
*/
|
||||
RESERVE_C_YN AS reserveCYn ,
|
||||
/*
|
||||
CANCELDATE AS cancelDate ,
|
||||
MSG_ID AS msgId ,
|
||||
MSG_SEQ AS msgSeq ,
|
||||
*/
|
||||
RESULT AS msgResult
|
||||
FROM (SELECT MGD.USER_ID ,
|
||||
MGD.MSG_GROUP_ID ,
|
||||
MGD.MSG_GROUP_CNT ,
|
||||
MGD.SMS_TXT ,
|
||||
MGD.SUBJECT ,
|
||||
MGD.REGDATE ,
|
||||
MGD.REQ_DATE ,
|
||||
MGD.CALL_FROM ,
|
||||
MGD.TOT_PRICE ,
|
||||
MGD.EACH_PRICE ,
|
||||
MGD.DEL_FLAG ,
|
||||
MGD.MSG_TYPE ,
|
||||
MGD.FILE_CNT ,
|
||||
MGD.AGENT_CODE ,
|
||||
MGD.RESERVE_C_YN ,
|
||||
MGD.CANCELDATE ,
|
||||
MD.MSG_ID ,
|
||||
MD.MSG_SEQ ,
|
||||
MD.USERDATA ,
|
||||
MD.CALL_TO ,
|
||||
MD.CUR_STATE ,
|
||||
MD.RSLT_CODE ,
|
||||
MD.RSLT_CODE2 , (
|
||||
CASE
|
||||
WHEN MD.AGENT_CODE = '01'
|
||||
AND
|
||||
(
|
||||
MD.RSLT_CODE = '100'
|
||||
AND
|
||||
(
|
||||
MD.RSLT_CODE2 = '0'
|
||||
)
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN MD.AGENT_CODE = '02'
|
||||
AND
|
||||
(
|
||||
MD.RSLT_CODE = '0'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN MD.AGENT_CODE = '03'
|
||||
AND
|
||||
(
|
||||
MD.RSLT_CODE = '100' OR MD.RSLT_CODE = '101' OR MD.RSLT_CODE = '110' OR MD.RSLT_CODE = '800'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN MD.AGENT_CODE = '04'
|
||||
AND
|
||||
(
|
||||
MD.RSLT_CODE = '4100' OR MD.RSLT_CODE = '6600'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN MD.AGENT_CODE = '05'
|
||||
AND
|
||||
(
|
||||
MD.RSLT_CODE = '1000' OR MD.RSLT_CODE = '1001'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN MD.AGENT_CODE = '07'
|
||||
AND
|
||||
(
|
||||
MD.RSLT_CODE = '6' OR MD.RSLT_CODE = '1000'
|
||||
)
|
||||
THEN 'S'
|
||||
WHEN
|
||||
(
|
||||
MD.RSLT_CODE IS NULL
|
||||
AND MD.RSLT_CODE2 IS NULL
|
||||
AND MD.SENT_DATE IS NULL
|
||||
AND MD.RSLT_DATE IS NULL
|
||||
)
|
||||
THEN 'W'
|
||||
ELSE 'F'
|
||||
END ) AS RESULT
|
||||
FROM MJ_MSG_DATA MD
|
||||
INNER JOIN MJ_MSG_GROUP_DATA MGD
|
||||
ON MD.MSG_GROUP_ID = MGD.MSG_GROUP_ID
|
||||
AND MD.MSG_GROUP_ID = #{msgGroupId}
|
||||
AND MGD.USER_ID = #{mberId}
|
||||
AND MGD.DEL_FLAG ='N'
|
||||
)
|
||||
A
|
||||
LEFT JOIN
|
||||
(SELECT ADDR_PHONE_NO ,
|
||||
ADDR_NM
|
||||
FROM MJ_ADDR
|
||||
WHERE 1 =1
|
||||
AND MBER_ID = #{mberId}
|
||||
GROUP BY ADDR_PHONE_NO
|
||||
)
|
||||
MA
|
||||
ON A.CALL_TO = MA.ADDR_PHONE_NO
|
||||
WHERE 1 =1
|
||||
/*
|
||||
AND A.RESULT IN ('F',
|
||||
'W')
|
||||
*/
|
||||
ORDER BY 1=1 ,
|
||||
regdate DESC
|
||||
LIMIT 5
|
||||
OFFSET 0
|
||||
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@ -6,14 +6,33 @@
|
||||
<mapper namespace="com.itn.mjonApi.mjon.api.inqry.mapper.PriceMapper">
|
||||
|
||||
<select id="selectUserMoney"
|
||||
resultType="com.itn.mjonApi.mjon.api.inqry.mapper.domain.PriceVO"
|
||||
resultType="double"
|
||||
>
|
||||
|
||||
SELECT a.MBER_ID AS mberId,
|
||||
a.USER_MONEY AS userMoney
|
||||
SELECT a.USER_MONEY AS userMoney
|
||||
FROM lettngnrlmber a
|
||||
WHERE a.MBER_ID = #{mberId}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectMberPriceInfo"
|
||||
resultType="hashmap"
|
||||
>
|
||||
|
||||
SELECT a.SHORT_PRICE AS sysShortPrice,
|
||||
a.LONG_PRICE AS sysLongPrice,
|
||||
a.PICTURE_PRICE AS sysPicturePrice,
|
||||
a.PICTURE2_PRICE AS sysPicturePrice2,
|
||||
a.PICTURE3_PRICE AS sysPicturePrice3,
|
||||
b.SHORT_PRICE AS shortPrice,
|
||||
b.LONG_PRICE AS longPrice,
|
||||
b.PICTURE_PRICE AS picturePrice,
|
||||
b.PICTURE2_PRICE AS picturePrice2,
|
||||
b.PICTURE3_PRICE AS picturePrice3
|
||||
FROM mj_mber_setting a ,
|
||||
lettngnrlmber b
|
||||
WHERE b.mber_id = #{mberId}
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user