1. 과금계정(SUB_ID)은 테이블컬럼에 넣지 않도록 수정. 실제 운영환경에서는 필요할 수도 있음.

2. 기타 오류 수정
main
이범준 6 hours ago
parent b512e107c3
commit e40d6caf2e

@ -0,0 +1,53 @@
package cokr.xit.interfaces.message;
import cokr.xit.applib.Hangul;
public class MessageUtil {
public static String replaceLineChangeForNuri2Oracle(String str) {
String result = "";
result = str.replaceAll("\r","");
result = result.replaceAll("\n","\r\n");
return result;
}
public static String replaceLineChangeForNuri2Maria(String str) {
String result = "";
result = str.replaceAll("\r","");
result = result.replaceAll("\n", "\\\\r\\\\n");
return result;
}
public static int countLineChangeForNuri2Oracle(String str) {
if(str == null || str.equals("")) {
return 0;
}
return str.split("\r\n",-1).length - 1;
}
public static int countLineChangeForNuri2Maria(String str) {
if(str == null || str.equals("")) {
return 0;
}
return str.split("\\\\r\\\\n",-1).length - 1;
}
public static int countBytes(String str, int hangulBytes, String db) {
Hangul hangul = new Hangul(hangulBytes);
int contentsByteCnt = hangul.getByteLength(str);
if(db.equals("mariadb") || db.equals("mysql")) {
int lineChangeCnt = countLineChangeForNuri2Maria(str);
contentsByteCnt = contentsByteCnt - (lineChangeCnt*3);
} else {
int lineChangeCnt = countLineChangeForNuri2Oracle(str);
contentsByteCnt = contentsByteCnt - lineChangeCnt;
}
return contentsByteCnt;
}
}

@ -18,6 +18,7 @@ import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
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.service.MessageService; import cokr.xit.interfaces.message.service.MessageService;
@Service("messageService") @Service("messageService")
@ -109,10 +110,10 @@ public class MessageServiceBean extends AbstractServiceBean implements MessageSe
//XMS 내용 바이트 수 보정(줄바꿈문자) //XMS 내용 바이트 수 보정(줄바꿈문자)
if(databaseId.equals("mariadb") || databaseId.equals("mysql")) { if(databaseId.equals("mariadb") || databaseId.equals("mysql")) {
int lineChageCount = this.countLineChangeForNuri2Maria(messageEntity.getXmsText()); int lineChageCount = MessageUtil.countLineChangeForNuri2Maria(messageEntity.getXmsText());
xmsContentByteCnt = xmsContentByteCnt - (lineChageCount*3); xmsContentByteCnt = xmsContentByteCnt - (lineChageCount*3);
} else { } else {
int lineChageCount = this.countLineChangeForNuri2Oracle(messageEntity.getXmsText()); int lineChageCount = MessageUtil.countLineChangeForNuri2Oracle(messageEntity.getXmsText());
xmsContentByteCnt = xmsContentByteCnt - lineChageCount; xmsContentByteCnt = xmsContentByteCnt - lineChageCount;
} }
@ -154,21 +155,6 @@ public class MessageServiceBean extends AbstractServiceBean implements MessageSe
return resultMap; return resultMap;
} }
public int countLineChangeForNuri2Oracle(String str) {
if(str == null || str.equals("")) {
return 0;
}
return str.split("\r\n",-1).length - 1;
}
public int countLineChangeForNuri2Maria(String str) {
if(str == null || str.equals("")) {
return 0;
}
return str.split("\\\\r\\\\n",-1).length - 1;
}
@Override @Override
public List<DataObject> getList(MessageQuery messageQuery) { public List<DataObject> getList(MessageQuery messageQuery) {
return messageBean.getList(messageQuery); return messageBean.getList(messageQuery);

@ -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;
}
} }

@ -3,7 +3,7 @@
<mapper namespace="cokr.xit.interfaces.message.dao.MessageMapper"> <mapper namespace="cokr.xit.interfaces.message.dao.MessageMapper">
<select id="selectList" parameterType="cokr.xit.interfaces.message.MessageQuery" resultType="dataObject"> <select id="selectList" parameterType="cokr.xit.interfaces.message.MessageQuery" resultType="dataObject">
/* 문자전송 목록(msgMapper.selectList) */ /* 문자전송 목록(messageMapper.selectList) */
<include refid="utility.paging-prefix"/> <include refid="utility.paging-prefix"/>
SELECT A.MSG_KEY SELECT A.MSG_KEY
, A.SUB_ID , A.SUB_ID
@ -86,7 +86,7 @@ SELECT A.MSG_KEY
</select> </select>
<insert id="insert" parameterType="cokr.xit.interfaces.message.MessageEntity"> <insert id="insert" parameterType="cokr.xit.interfaces.message.MessageEntity">
/* 문자전송 요청 등록(msgMapper.insert) */ /* 문자전송 요청 등록(messageMapper.insert) */
INSERT INSERT
INTO NURI2_NRMSG_DATA ( INTO NURI2_NRMSG_DATA (
SUB_ID SUB_ID
@ -131,7 +131,12 @@ INSERT
, TASK_SE_CD , TASK_SE_CD
) )
VALUES ( VALUES (
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(subId)">
#{subId} #{subId}
</if>
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isEmpty(subId)">
NULL
</if>
, #{userKey}, #{userGroup}, #{userId}, #{userJobid} , #{userKey}, #{userGroup}, #{userId}, #{userJobid}
, CURRENT_TIMESTAMP <!-- 메시지 입력 일시 --> , CURRENT_TIMESTAMP <!-- 메시지 입력 일시 -->
, <include refid="utility.now"/> <!-- 메시지 입력 일시(사용자정의컬럼) --> , <include refid="utility.now"/> <!-- 메시지 입력 일시(사용자정의컬럼) -->
@ -186,8 +191,8 @@ VALUES (
) )
</insert> </insert>
<select id="selectStng" parameterType="cokr.xit.interfaces.message.MessageQuery"> <select id="selectStng" parameterType="cokr.xit.interfaces.message.MessageQuery" resultType="dataobject">
/* 문자전송 설정 정보 조회(msgMapper.selectStng) */ /* 문자전송 설정 정보 조회(messageMapper.selectStng) */
SELECT MSG_STNG_ID SELECT MSG_STNG_ID
, SGG_CD , SGG_CD
, STNG_INFO_TYPE , STNG_INFO_TYPE
@ -203,7 +208,7 @@ SELECT MSG_STNG_ID
FROM TB_MSG_STNG FROM TB_MSG_STNG
WHERE STNG_INFO_TYPE = #{stngInfoType} WHERE STNG_INFO_TYPE = #{stngInfoType}
AND USE_YN = 'Y' AND USE_YN = 'Y'
<if test="sggCd != null"> <if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(sggCd)">
AND SGG_CD = #{sggCd} AND SGG_CD = #{sggCd}
</if> </if>
</select> </select>

Loading…
Cancel
Save