|
|
@ -6,7 +6,9 @@ import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
import javax.sql.DataSource;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
|
|
|
|
import org.egovframe.rte.fdl.string.EgovStringUtil;
|
|
|
|
import org.egovframe.rte.fdl.string.EgovStringUtil;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
@ -21,6 +23,12 @@ import cokr.xit.foundation.data.DataObject;
|
|
|
|
@Service("msgService")
|
|
|
|
@Service("msgService")
|
|
|
|
public class MsgServiceBean extends AbstractServiceBean implements MsgService {
|
|
|
|
public class MsgServiceBean extends AbstractServiceBean implements MsgService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource(name="databaseIdProvider")
|
|
|
|
|
|
|
|
private VendorDatabaseIdProvider databaseIdProvider;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource(name="dataSource")
|
|
|
|
|
|
|
|
private DataSource dataSource;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource(name="msgBean")
|
|
|
|
@Resource(name="msgBean")
|
|
|
|
private MsgBean msgBean;
|
|
|
|
private MsgBean msgBean;
|
|
|
|
|
|
|
|
|
|
|
@ -31,11 +39,14 @@ public class MsgServiceBean extends AbstractServiceBean implements MsgService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String,Object> regist(List<MsgEntity> msgEntityList) {
|
|
|
|
public Map<String,Object> regist(List<MsgEntity> msgEntityList) {
|
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> resultMap = new HashMap<String,Object>();
|
|
|
|
Map<String,Object> resultMap = new HashMap<String,Object>();
|
|
|
|
|
|
|
|
|
|
|
|
List<MsgEntity> successList = new ArrayList<MsgEntity>();
|
|
|
|
List<MsgEntity> successList = new ArrayList<MsgEntity>();
|
|
|
|
List<MsgEntity> failList = new ArrayList<MsgEntity>();
|
|
|
|
List<MsgEntity> failList = new ArrayList<MsgEntity>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String databaseId = databaseIdProvider.getDatabaseId(dataSource);
|
|
|
|
|
|
|
|
|
|
|
|
for(MsgEntity msgEntity : msgEntityList) {
|
|
|
|
for(MsgEntity msgEntity : msgEntityList) {
|
|
|
|
|
|
|
|
|
|
|
|
boolean isSuccess = false;
|
|
|
|
boolean isSuccess = false;
|
|
|
@ -86,24 +97,37 @@ public class MsgServiceBean extends AbstractServiceBean implements MsgService {
|
|
|
|
//
|
|
|
|
//
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int xmlSubjectByteCnt = hangul.getByteLength(msgEntity.getXmsSubject());
|
|
|
|
//XMS 제목 바이트 수
|
|
|
|
int xmlContentByteCnt = hangul.getByteLength(msgEntity.getXmsText());
|
|
|
|
int xmsSubjectByteCnt = hangul.getByteLength(msgEntity.getXmsSubject());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//XMS 내용 바이트 수
|
|
|
|
|
|
|
|
int xmsContentByteCnt = hangul.getByteLength(msgEntity.getXmsText());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//XMS 내용 바이트 수 보정(줄바꿈문자)
|
|
|
|
|
|
|
|
if(databaseId.equals("mariadb") || databaseId.equals("mysql")) {
|
|
|
|
|
|
|
|
int lineChageCount = this.countLineChangeForNuri2Maria(msgEntity.getXmsText());
|
|
|
|
|
|
|
|
xmsContentByteCnt = xmsContentByteCnt - (lineChageCount*3);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
int lineChageCount = this.countLineChangeForNuri2Oracle(msgEntity.getXmsText());
|
|
|
|
|
|
|
|
xmsContentByteCnt = xmsContentByteCnt - lineChageCount;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String contentsTypeOfXMS = msgEntity.getContentsTypeOfXMS();
|
|
|
|
String contentsTypeOfXMS = msgEntity.getContentsTypeOfXMS();
|
|
|
|
|
|
|
|
|
|
|
|
if("SMS".equals(contentsTypeOfXMS) && xmlContentByteCnt > 90) {
|
|
|
|
if("SMS".equals(contentsTypeOfXMS) && xmsContentByteCnt > 90) {
|
|
|
|
isSuccess = false;
|
|
|
|
isSuccess = false;
|
|
|
|
msgEntity.setFailRsn("SMS 최대 바이트 수(90byte) 초과");
|
|
|
|
msgEntity.setFailRsn("SMS 최대 바이트 수(90byte) 초과");
|
|
|
|
failList.add(msgEntity);
|
|
|
|
failList.add(msgEntity);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if("LMS".equals(contentsTypeOfXMS)) {
|
|
|
|
if("LMS".equals(contentsTypeOfXMS)) {
|
|
|
|
if(xmlSubjectByteCnt > 30) {
|
|
|
|
if(xmsSubjectByteCnt > 30) {
|
|
|
|
isSuccess = false;
|
|
|
|
isSuccess = false;
|
|
|
|
msgEntity.setFailRsn("LMS 제목 최대 바이트 수(30byte) 초과");
|
|
|
|
msgEntity.setFailRsn("LMS 제목 최대 바이트 수(30byte) 초과");
|
|
|
|
failList.add(msgEntity);
|
|
|
|
failList.add(msgEntity);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(xmlContentByteCnt > 2000) {
|
|
|
|
if(xmsContentByteCnt > 2000) {
|
|
|
|
isSuccess = false;
|
|
|
|
isSuccess = false;
|
|
|
|
msgEntity.setFailRsn("LMS 내용 최대 바이트 수(2000byte) 초과");
|
|
|
|
msgEntity.setFailRsn("LMS 내용 최대 바이트 수(2000byte) 초과");
|
|
|
|
failList.add(msgEntity);
|
|
|
|
failList.add(msgEntity);
|
|
|
@ -125,4 +149,18 @@ public class MsgServiceBean extends AbstractServiceBean implements MsgService {
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|