|
|
@ -15,9 +15,11 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cokr.xit.foundation.data.DataObject;
|
|
|
|
import cokr.xit.foundation.web.AbstractController;
|
|
|
|
import cokr.xit.foundation.web.AbstractController;
|
|
|
|
import cokr.xit.interfaces.message.MessageEntity;
|
|
|
|
import cokr.xit.interfaces.message.MessageEntity;
|
|
|
|
import cokr.xit.interfaces.message.MessageQuery;
|
|
|
|
import cokr.xit.interfaces.message.MessageQuery;
|
|
|
|
|
|
|
|
import cokr.xit.interfaces.message.MessageUtil;
|
|
|
|
import cokr.xit.interfaces.message.dao.MessageMapper;
|
|
|
|
import cokr.xit.interfaces.message.dao.MessageMapper;
|
|
|
|
import cokr.xit.interfaces.message.service.MessageService;
|
|
|
|
import cokr.xit.interfaces.message.service.MessageService;
|
|
|
|
import net.minidev.json.JSONObject;
|
|
|
|
import net.minidev.json.JSONObject;
|
|
|
@ -55,13 +57,19 @@ public class MessageInterfaceController extends AbstractController {
|
|
|
|
MessageQuery messageQuery = new MessageQuery();
|
|
|
|
MessageQuery messageQuery = new MessageQuery();
|
|
|
|
messageQuery.setStngInfoType("01");
|
|
|
|
messageQuery.setStngInfoType("01");
|
|
|
|
messageQuery.setSggCd(System.getProperty("sgg"));
|
|
|
|
messageQuery.setSggCd(System.getProperty("sgg"));
|
|
|
|
String nuri2Id = messageMapper.selectStng(messageQuery).string("MODULE_ID");
|
|
|
|
|
|
|
|
if(ifEmpty(nuri2Id, ()->"").equals("")) {
|
|
|
|
DataObject stng = messageMapper.selectStng(messageQuery);
|
|
|
|
mav.addObject("failRsn", "문자발송모듈아이디 찾기 실패");
|
|
|
|
String nuri2Id = "";
|
|
|
|
mav.addObject("saved", false);
|
|
|
|
if(stng != null && !stng.isEmpty()) {
|
|
|
|
return mav;
|
|
|
|
nuri2Id = stng.string("MODULE_ID");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if(ifEmpty(nuri2Id, ()->"").equals("")) {
|
|
|
|
|
|
|
|
//mav.addObject("failRsn", "문자발송모듈아이디 찾기 실패");
|
|
|
|
|
|
|
|
//mav.addObject("saved", false);
|
|
|
|
|
|
|
|
//return mav;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
String reqSys = (String) apiSpec.get("reqSys"); //요청시스템(이노,진우,엑스아이티)
|
|
|
|
String reqSys = (String) apiSpec.get("reqSys"); //요청시스템(이노,진우,엑스아이티)
|
|
|
|
if(EgovStringUtil.null2void(reqSys).equals("")) {
|
|
|
|
if(EgovStringUtil.null2void(reqSys).equals("")) {
|
|
|
|
mav.addObject("failRsn", "요청시스템이 없습니다.");
|
|
|
|
mav.addObject("failRsn", "요청시스템이 없습니다.");
|
|
|
@ -116,40 +124,55 @@ public class MessageInterfaceController extends AbstractController {
|
|
|
|
messageEntity.setPhone(recptnNo);
|
|
|
|
messageEntity.setPhone(recptnNo);
|
|
|
|
|
|
|
|
|
|
|
|
if(databaseId.equals("mariadb") || databaseId.equals("mysql")){
|
|
|
|
if(databaseId.equals("mariadb") || databaseId.equals("mysql")){
|
|
|
|
mssageCn = this.replaceLineChangeForNuri2Maria(mssageCn);
|
|
|
|
mssageCn = MessageUtil.replaceLineChangeForNuri2Maria(mssageCn);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
mssageCn = this.replaceLineChangeForNuri2Oracle(mssageCn);
|
|
|
|
mssageCn = MessageUtil.replaceLineChangeForNuri2Oracle(mssageCn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(!EgovStringUtil.null2void(resDate).equals("")) {
|
|
|
|
if(!EgovStringUtil.null2void(resDate).equals("")) {
|
|
|
|
messageEntity.setResDate(resDate);
|
|
|
|
messageEntity.setResDate(resDate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String XMS_msgType = "";
|
|
|
|
|
|
|
|
String XMS_contentsType = "";
|
|
|
|
|
|
|
|
int xmsByteCount = MessageUtil.countBytes(mssageCn,2,databaseId);
|
|
|
|
|
|
|
|
if(xmsByteCount <= 90) {
|
|
|
|
|
|
|
|
XMS_msgType = "SMS";
|
|
|
|
|
|
|
|
XMS_contentsType = "SMS";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
XMS_msgType = "MMS";
|
|
|
|
|
|
|
|
XMS_contentsType = "LMS";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
boolean able_kko = false; //알림톡 가능 여부
|
|
|
|
boolean able_kko = false; //알림톡 가능 여부
|
|
|
|
boolean able_rcs = false; //RCS 가능 여부
|
|
|
|
boolean able_rcs = false; //RCS 가능 여부
|
|
|
|
|
|
|
|
|
|
|
|
if(able_kko && able_rcs) { // 알림톡+RCS+XMS
|
|
|
|
if(able_kko && able_rcs) { // 알림톡+RCS+XMS
|
|
|
|
messageEntity.configMsgTypes(new String[]{"ALT","RCS","MMS"});
|
|
|
|
messageEntity.configMsgTypes(new String[]{"ALT","RCS",XMS_msgType});
|
|
|
|
messageEntity.configContentsTypeN("ALT");
|
|
|
|
messageEntity.configContentsTypeN("ALT");
|
|
|
|
messageEntity.configContentsTypeN("RCL");
|
|
|
|
messageEntity.configContentsTypeN("RCL");
|
|
|
|
messageEntity.configContentsTypeN("LMS");
|
|
|
|
messageEntity.configContentsTypeN(XMS_contentsType);
|
|
|
|
} else if(able_kko && !able_rcs) { // 알림톡+XMS
|
|
|
|
} else if(able_kko && !able_rcs) { // 알림톡+XMS
|
|
|
|
messageEntity.configMsgTypes(new String[]{"ALT","MMS"});
|
|
|
|
messageEntity.configMsgTypes(new String[]{"ALT",XMS_msgType});
|
|
|
|
messageEntity.configContentsTypeN("ALT");
|
|
|
|
messageEntity.configContentsTypeN("ALT");
|
|
|
|
messageEntity.configContentsTypeN("LMS");
|
|
|
|
messageEntity.configContentsTypeN(XMS_contentsType);
|
|
|
|
messageEntity.setXmsText(mssageCn);
|
|
|
|
messageEntity.setXmsText(mssageCn);
|
|
|
|
} else if(!able_kko && able_rcs){ // RCS+XMS
|
|
|
|
} else if(!able_kko && able_rcs){ // RCS+XMS
|
|
|
|
messageEntity.configMsgTypes(new String[]{"RCS","MMS"});
|
|
|
|
messageEntity.configMsgTypes(new String[]{"RCS",XMS_msgType});
|
|
|
|
messageEntity.configContentsTypeN("RCL");
|
|
|
|
messageEntity.configContentsTypeN("RCL");
|
|
|
|
messageEntity.configContentsTypeN("LMS");
|
|
|
|
messageEntity.configContentsTypeN(XMS_contentsType);
|
|
|
|
messageEntity.setXmsText(mssageCn);
|
|
|
|
messageEntity.setXmsText(mssageCn);
|
|
|
|
} else {// XMS
|
|
|
|
} else {// XMS
|
|
|
|
messageEntity.configMsgTypes(new String[]{"MMS"});
|
|
|
|
messageEntity.configMsgTypes(new String[]{XMS_msgType});
|
|
|
|
messageEntity.configContentsTypeN("LMS");
|
|
|
|
messageEntity.configContentsTypeN(XMS_contentsType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
messageEntity.setXmsText(mssageCn);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
messageEntity.setXmsText(mssageCn);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(XMS_msgType.equals("MMS")) {
|
|
|
|
|
|
|
|
messageEntity.setXmsSubject("민원 처리결과 알림");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(able_kko) {
|
|
|
|
if(able_kko) {
|
|
|
@ -199,18 +222,6 @@ public class MessageInterfaceController extends AbstractController {
|
|
|
|
return mav;
|
|
|
|
return mav;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String replaceLineChangeForNuri2Oracle(String str) {
|
|
|
|
|
|
|
|
String result = "";
|
|
|
|
|
|
|
|
result = str.replaceAll("\r","");
|
|
|
|
|
|
|
|
result = result.replaceAll("\n","\r\n");
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String replaceLineChangeForNuri2Maria(String str) {
|
|
|
|
|
|
|
|
String result = "";
|
|
|
|
|
|
|
|
result = str.replaceAll("\r","");
|
|
|
|
|
|
|
|
result = result.replaceAll("\n", "\\\\r\\\\n");
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|