문자발송에 api return값 추가
This commit is contained in:
parent
141d8146ce
commit
7c5b5889c3
@ -57,6 +57,8 @@ public class StatusResponse {
|
||||
|
||||
private Object object;
|
||||
|
||||
private Object apiReturn;
|
||||
|
||||
private String messageTemp;
|
||||
|
||||
private LocalDateTime timestamp;
|
||||
@ -97,6 +99,15 @@ public class StatusResponse {
|
||||
this.message = message;
|
||||
this.object = object;
|
||||
}
|
||||
public StatusResponse(HttpStatus status, String message
|
||||
, Object object
|
||||
, Object apiReturn
|
||||
) {
|
||||
this.status = status;
|
||||
this.message = message;
|
||||
this.object = object;
|
||||
this.apiReturn = apiReturn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -3946,19 +3946,28 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
@Override
|
||||
public StatusResponse sendMsgData_advc(MjonMsgVO mjonMsgVO, HttpServletRequest request) throws Exception {
|
||||
|
||||
log.info("mjonMsgVO [{}]", mjonMsgVO.getMjonMsgSendVOList().get(0).getPhone());
|
||||
// log.info("mjonMsgVO [{}]", mjonMsgVO.getMjonMsgSendVOList().get(0).getPhone());
|
||||
log.info(" :: sendMsgData_advc :: ");
|
||||
log.info(" + mjonMsgVO.toString() :: [{}]", mjonMsgVO.toString());
|
||||
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
Map<String, Object> apiReturnMap = new HashMap<>();
|
||||
|
||||
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()
|
||||
? (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser()
|
||||
: null;
|
||||
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
|
||||
String userId = "";
|
||||
if("A".equals(mjonMsgVO.getSendKind()))
|
||||
{
|
||||
userId = mjonMsgVO.getMberId();
|
||||
}else {
|
||||
|
||||
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()
|
||||
? (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser()
|
||||
: null;
|
||||
userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
|
||||
|
||||
if (userId.equals("")) {
|
||||
return new StatusResponse(HttpStatus.BAD_REQUEST, "로그인 후 이용이 가능합니다.");
|
||||
}
|
||||
|
||||
if (userId.equals("")) {
|
||||
return new StatusResponse(HttpStatus.BAD_REQUEST, "로그인 후 이용이 가능합니다.");
|
||||
}
|
||||
|
||||
mjonMsgVO.setUserId(userId);
|
||||
@ -4015,6 +4024,7 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
int deletedCount = initialSize - finalSize;
|
||||
// 수신거부 목록
|
||||
returnMap.put("resultBlockSts", deletedCount);
|
||||
apiReturnMap.put("resultBlockSts", deletedCount);
|
||||
|
||||
if (mjonMsgSendVOList.size() < 1) {
|
||||
return new StatusResponse(HttpStatus.BAD_REQUEST, "수신거부와 매칭되는 번호 제거 후 \n발송 가능한 수신목록이 존재하지 않습니다.");
|
||||
@ -4139,6 +4149,8 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
// instTotalCnt : 화면에서 보여줄 총 발송건수
|
||||
int instTotalCnt = 0;
|
||||
// Step 2: 그룹화 된 데이터를 그룹별로 insert 처리
|
||||
String apiMsgGroupId = "";
|
||||
String apiMsgType = "";
|
||||
for (Map.Entry<String, List<MjonMsgSendVO>> entry : priceGroupedMessages.entrySet()) {
|
||||
List<MjonMsgSendVO> groupedMsgList = entry.getValue(); // 해당 가격의 메시지 리스트
|
||||
|
||||
@ -4146,6 +4158,15 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
String nextMsgGroupId = idgenMjonMsgGroupId.getNextStringId();
|
||||
groupedMsgList.forEach(t -> t.setMsgGroupId(nextMsgGroupId));
|
||||
|
||||
// api 전달 값
|
||||
apiMsgGroupId = StringUtils.isNotEmpty(apiMsgGroupId)
|
||||
? apiMsgGroupId + "," + nextMsgGroupId
|
||||
: nextMsgGroupId;
|
||||
|
||||
apiMsgType = StringUtils.isNotEmpty(apiMsgType)
|
||||
? apiMsgType + "," + mjonMsgSendVOList.get(0).getMsgType()
|
||||
: mjonMsgSendVOList.get(0).getMsgType();
|
||||
|
||||
// 발송 데이터 삽입
|
||||
int instCnt = this.insertMsgData_advc(groupedMsgList);
|
||||
|
||||
@ -4177,16 +4198,26 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
|
||||
log.debug("가격 [{}]의 총 갯수: [{}]", entry.getKey(), groupedMsgList.size());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 그룹 ID
|
||||
apiReturnMap.put("msgGroupId", apiMsgGroupId);
|
||||
// 메세지 타입
|
||||
apiReturnMap.put("msgType", apiMsgType);
|
||||
// 총 발송 건수
|
||||
returnMap.put("resultSts", instTotalCnt);
|
||||
apiReturnMap.put("resultSts", instTotalCnt);
|
||||
|
||||
|
||||
// db insert 성능 개선중 하나에 방법
|
||||
// 분할 최대건수가 되면 디비에 입력하기
|
||||
// 여러시도 했지만 일단 보류
|
||||
// 무시해도 됨
|
||||
// int instCnt = mjonMsgDataDAO.insertMsgDataInfo_advc(mjonMsgSendVOList);
|
||||
// int instCnt = mjonMsgDataDAO.insertMsgDataInfo_jdbc_advc(mjonMsgSendVOList);
|
||||
|
||||
// 총 발송 건수
|
||||
returnMap.put("resultSts", instTotalCnt);
|
||||
|
||||
// TEST발송 시 발송 후 캐시가 있어야함.
|
||||
returnMap.put("afterCash", priceAndPoint.getBefCash(userId));
|
||||
@ -4206,6 +4237,10 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
|
||||
statusResponse.setStatus(HttpStatus.OK);
|
||||
statusResponse.setObject(returnMap);
|
||||
|
||||
apiReturnMap.put("result", "success");
|
||||
apiReturnMap.put("message", "문자 전송이 완료되었습니다.");
|
||||
statusResponse.setApiReturn(apiReturnMap);
|
||||
return statusResponse;
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user