|
|
@ -1,14 +1,10 @@
|
|
|
|
package cokr.xit.fims.stat.service.bean;
|
|
|
|
package cokr.xit.fims.stat.service.bean;
|
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
import java.time.DayOfWeek;
|
|
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
|
|
|
import java.time.format.TextStyle;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Locale;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
@ -17,6 +13,7 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
|
|
import cokr.xit.base.code.CommonCode;
|
|
|
|
import cokr.xit.base.code.CommonCode;
|
|
|
|
import cokr.xit.fims.cmmn.CmmnQuery;
|
|
|
|
import cokr.xit.fims.cmmn.CmmnQuery;
|
|
|
|
|
|
|
|
import cokr.xit.fims.cmmn.CmmnUtil;
|
|
|
|
import cokr.xit.fims.cmmn.CodeConverter;
|
|
|
|
import cokr.xit.fims.cmmn.CodeConverter;
|
|
|
|
import cokr.xit.fims.stat.CodeSubsetInfo;
|
|
|
|
import cokr.xit.fims.stat.CodeSubsetInfo;
|
|
|
|
import cokr.xit.fims.stat.GroupInfo;
|
|
|
|
import cokr.xit.fims.stat.GroupInfo;
|
|
|
@ -128,23 +125,28 @@ public class StatBean extends AbstractComponent {
|
|
|
|
if(i != 0) {
|
|
|
|
if(i != 0) {
|
|
|
|
result += ",";
|
|
|
|
result += ",";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String colValue = item.string(groupInfo.getGroupColName());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!ifEmpty(groupInfo.getCategorizationAddOption(), ()-> "").equals("")) {
|
|
|
|
String refCol = groupInfo.getRefCol();
|
|
|
|
String addOption = groupInfo.getCategorizationAddOption();
|
|
|
|
String colValue = item.string(refCol);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ifEmpty(groupInfo.getCtgrType(), ()-> "").equals("")) {
|
|
|
|
|
|
|
|
result += colValue;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String ctgrType = groupInfo.getCtgrType();
|
|
|
|
|
|
|
|
String addOption = groupInfo.getDtlCtgr();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ctgrType.equals("date")) {
|
|
|
|
|
|
|
|
|
|
|
|
if(addOption.equals("YYYY")) { //연도별
|
|
|
|
if(addOption.equals("YYYY")) { //연도별
|
|
|
|
result += colValue.substring(0,4);
|
|
|
|
result += colValue.substring(0,4);
|
|
|
|
} else if(addOption.equals("YYYYMM")) { //연월별
|
|
|
|
} else if(addOption.equals("YYYYMM")) { //연월별
|
|
|
|
result += colValue.substring(0,6);
|
|
|
|
result += colValue.substring(0,6);
|
|
|
|
|
|
|
|
} else if(addOption.equals("YYYYMMDD")) { //일자별
|
|
|
|
|
|
|
|
result += colValue.substring(0,8);
|
|
|
|
} else if(addOption.equals("DAY_OF_WEEK")) { //요일별
|
|
|
|
} else if(addOption.equals("DAY_OF_WEEK")) { //요일별
|
|
|
|
int y = Integer.parseInt(colValue.substring(0,4));
|
|
|
|
result += CmmnUtil.getDayOfWeek(colValue);
|
|
|
|
int m = Integer.parseInt(colValue.substring(4,6));
|
|
|
|
|
|
|
|
int d = Integer.parseInt(colValue.substring(6,8));
|
|
|
|
|
|
|
|
LocalDate date = LocalDate.of(y, m, d);
|
|
|
|
|
|
|
|
DayOfWeek dayOfWeek = date.getDayOfWeek();
|
|
|
|
|
|
|
|
String dow = dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.KOREAN);
|
|
|
|
|
|
|
|
result += dow;
|
|
|
|
|
|
|
|
} else if(addOption.equals("HH")) { //시간대별
|
|
|
|
} else if(addOption.equals("HH")) { //시간대별
|
|
|
|
if(colValue.length() == 14) {
|
|
|
|
if(colValue.length() == 14) {
|
|
|
|
result += colValue.substring(8,10);
|
|
|
|
result += colValue.substring(8,10);
|
|
|
@ -154,16 +156,15 @@ public class StatBean extends AbstractComponent {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
result += colValue;
|
|
|
|
result += colValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else if(ctgrType.equals("code") || ctgrType.equals("otherCode")) {
|
|
|
|
|
|
|
|
|
|
|
|
if(groupInfo.getGroupColName().endsWith("_CD")
|
|
|
|
if(ctgrType.equals("code")
|
|
|
|
&& groupInfo.getCategoryNameConverter() != null
|
|
|
|
&& subsetInfoList != null
|
|
|
|
&& groupInfo.getCategoryNameConverter().startsWith("code=")
|
|
|
|
&& !subsetInfoList.isEmpty()
|
|
|
|
&& subsetInfoList != null && !subsetInfoList.isEmpty()
|
|
|
|
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
|
|
for(CodeSubsetInfo subsetInfo : subsetInfoList) {
|
|
|
|
for(CodeSubsetInfo subsetInfo : subsetInfoList) {
|
|
|
|
if(subsetInfo.getSourceGroup().equals(groupInfo.getCategoryNameConverter().split("=")[1])) {
|
|
|
|
if(subsetInfo.getSourceGroup().equals(addOption)) {
|
|
|
|
if(Arrays.asList(subsetInfo.getSourceCodes()).contains(colValue)) {
|
|
|
|
if(Arrays.asList(subsetInfo.getSourceCodes()).contains(colValue)) {
|
|
|
|
colValue = subsetInfo.getTargetCode();
|
|
|
|
colValue = subsetInfo.getTargetCode();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -171,8 +172,11 @@ public class StatBean extends AbstractComponent {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result += colValue;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
result += colValue;
|
|
|
|
result += colValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -219,6 +223,8 @@ public class StatBean extends AbstractComponent {
|
|
|
|
|
|
|
|
|
|
|
|
List<NumberValueInfo> numberValueInfoList = statQuery.getNumberValueInfoList();
|
|
|
|
List<NumberValueInfo> numberValueInfoList = statQuery.getNumberValueInfoList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<CodeSubsetInfo> subsetInfoList = statQuery.getCodeSubsetInfoList();
|
|
|
|
|
|
|
|
|
|
|
|
int[] aggregateArr = new int[numberValueInfoList.size()];
|
|
|
|
int[] aggregateArr = new int[numberValueInfoList.size()];
|
|
|
|
for(int i=0; i < numberValueInfoList.size(); i++) {
|
|
|
|
for(int i=0; i < numberValueInfoList.size(); i++) {
|
|
|
|
aggregateArr[i] = 0;
|
|
|
|
aggregateArr[i] = 0;
|
|
|
@ -230,32 +236,65 @@ public class StatBean extends AbstractComponent {
|
|
|
|
DataObject dataObject = listByKey.get(i);
|
|
|
|
DataObject dataObject = listByKey.get(i);
|
|
|
|
|
|
|
|
|
|
|
|
for(int j=0; j < aggregateArr.length; j++) {
|
|
|
|
for(int j=0; j < aggregateArr.length; j++) {
|
|
|
|
|
|
|
|
NumberValueInfo numverValueInfo = numberValueInfoList.get(j);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String seperatorRefCol = ifEmpty(numverValueInfo.getSeperatorRefCol(), ()-> "");
|
|
|
|
|
|
|
|
String conditionValue = ifEmpty(numverValueInfo.getConditionValue(), ()-> "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String seperatorCtgrType = ifEmpty(numverValueInfo.getSeperatorCtgrType(), ()-> "");
|
|
|
|
|
|
|
|
String seperatorDtlCtgr = ifEmpty(numverValueInfo.getSeperatorDtlCtgr(), ()-> "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String aggregateType = ifEmpty(numverValueInfo.getAggregateType(), ()-> "");
|
|
|
|
|
|
|
|
String sumRefCol = ifEmpty(numverValueInfo.getSumRefCol(), ()-> "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!seperatorRefCol.equals("")) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String dataColumnValue = dataObject.string(seperatorRefCol);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(seperatorCtgrType.equals("date")) {
|
|
|
|
|
|
|
|
if(seperatorDtlCtgr.equals("YYYY")) { //연도별
|
|
|
|
|
|
|
|
dataColumnValue = dataColumnValue.substring(0,4);
|
|
|
|
|
|
|
|
} else if(seperatorDtlCtgr.equals("YYYYMM")) { //연월별
|
|
|
|
|
|
|
|
dataColumnValue = dataColumnValue.substring(0,6);
|
|
|
|
|
|
|
|
} else if(seperatorDtlCtgr.equals("YYYYMMDD")) { //일자별
|
|
|
|
|
|
|
|
dataColumnValue = dataColumnValue.substring(0,8);
|
|
|
|
|
|
|
|
} else if(seperatorDtlCtgr.equals("DAY_OF_WEEK")) { //요일별
|
|
|
|
|
|
|
|
dataColumnValue = CmmnUtil.getDayOfWeek(dataColumnValue);
|
|
|
|
|
|
|
|
} else if(seperatorDtlCtgr.equals("HH")) { //시간대별
|
|
|
|
|
|
|
|
if(dataColumnValue.length() == 14) {
|
|
|
|
|
|
|
|
dataColumnValue = dataColumnValue.substring(8,10);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
dataColumnValue = dataColumnValue.substring(0,2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String condition = numberValueInfoList.get(j).getNumberValueSeperator();
|
|
|
|
} else if(seperatorCtgrType.equals("code") || seperatorCtgrType.equals("otherCode")) {
|
|
|
|
String aggregateType = numberValueInfoList.get(j).getAggregateType();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!condition.equals("")) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(condition.contains("=")) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String conditionColumn = condition.split("=")[0];
|
|
|
|
if(seperatorCtgrType.equals("code")
|
|
|
|
String conditionColumnValue = dataObject.string(conditionColumn);
|
|
|
|
&& subsetInfoList != null
|
|
|
|
String conditionValue = condition.split("=")[1];
|
|
|
|
&& !subsetInfoList.isEmpty()
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
|
|
if(conditionColumn.endsWith("_DT") && conditionValue.length() == 8) {
|
|
|
|
for(CodeSubsetInfo subsetInfo : subsetInfoList) {
|
|
|
|
conditionColumnValue = conditionColumnValue.substring(0,8);
|
|
|
|
if(subsetInfo.getSourceGroup().equals(seperatorDtlCtgr)) {
|
|
|
|
|
|
|
|
if(Arrays.asList(subsetInfo.getSourceCodes()).contains(dataColumnValue)) {
|
|
|
|
|
|
|
|
dataColumnValue = subsetInfo.getTargetCode();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(!conditionColumnValue.equals(conditionValue)) {
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
if(!dataColumnValue.equals(conditionValue)) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(aggregateType.startsWith("sum=")) {
|
|
|
|
if(aggregateType.equals("sum")) {
|
|
|
|
aggregateArr[j] += dataObject.number(aggregateType.split("=")[1]).intValue();
|
|
|
|
aggregateArr[j] += dataObject.number(sumRefCol).intValue();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
aggregateArr[j] += 1;
|
|
|
|
aggregateArr[j] += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -281,7 +320,8 @@ public class StatBean extends AbstractComponent {
|
|
|
|
|
|
|
|
|
|
|
|
int taskSeCdIndex = -1;
|
|
|
|
int taskSeCdIndex = -1;
|
|
|
|
for(int i=0; i < groupInfoList.size(); i++) {
|
|
|
|
for(int i=0; i < groupInfoList.size(); i++) {
|
|
|
|
if(groupInfoList.get(i).getCategoryNameConverter().equals("code=FIM054")) {
|
|
|
|
if(groupInfoList.get(i).getCtgrType().equals("code")
|
|
|
|
|
|
|
|
&& groupInfoList.get(i).getDtlCtgr().equals("FIM054")) {
|
|
|
|
taskSeCdIndex = i;
|
|
|
|
taskSeCdIndex = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -294,9 +334,12 @@ public class StatBean extends AbstractComponent {
|
|
|
|
for(int i=0; i < compositeItemId.length ;i++) {
|
|
|
|
for(int i=0; i < compositeItemId.length ;i++) {
|
|
|
|
|
|
|
|
|
|
|
|
GroupInfo groupInfo = groupInfoList.get(i);
|
|
|
|
GroupInfo groupInfo = groupInfoList.get(i);
|
|
|
|
String converter = groupInfo.getCategoryNameConverter();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(converter.equals("") || converter.equals("plain")) { //일반텍스트
|
|
|
|
String ctgrType = groupInfo.getCtgrType();
|
|
|
|
|
|
|
|
String dtlCtgr = groupInfo.getDtlCtgr();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ctgrType.equals("") || ctgrType.equals("plain")) { //일반텍스트
|
|
|
|
compositeItemName[i] = compositeItemId[i];
|
|
|
|
compositeItemName[i] = compositeItemId[i];
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -304,13 +347,13 @@ public class StatBean extends AbstractComponent {
|
|
|
|
|
|
|
|
|
|
|
|
String itemName = "";
|
|
|
|
String itemName = "";
|
|
|
|
|
|
|
|
|
|
|
|
if(converter.startsWith("code=")){ //공통코드
|
|
|
|
if(ctgrType.equals("code")){ //공통코드
|
|
|
|
|
|
|
|
|
|
|
|
itemName = codeConverter.codeToValue(converter.split("=")[1], compositeItemId[i]);
|
|
|
|
itemName = codeConverter.codeToValue(dtlCtgr, compositeItemId[i]);
|
|
|
|
|
|
|
|
|
|
|
|
} else if(converter.startsWith("otherCode=")) { //비공통코드
|
|
|
|
} else if(ctgrType.equals("otherCode")) { //비공통코드
|
|
|
|
|
|
|
|
|
|
|
|
if(converter.equals("otherCode=VLTN_CD")) {
|
|
|
|
if(dtlCtgr.equals("VLTN_CD")) {
|
|
|
|
|
|
|
|
|
|
|
|
String taskSeCd = "";
|
|
|
|
String taskSeCd = "";
|
|
|
|
if(taskSeCdIndex != -1) {
|
|
|
|
if(taskSeCdIndex != -1) {
|
|
|
@ -324,13 +367,13 @@ public class StatBean extends AbstractComponent {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
itemName = codeConverter.vltnCdToValue(taskSeCd, compositeItemId[i]);
|
|
|
|
itemName = codeConverter.vltnCdToValue(taskSeCd, compositeItemId[i]);
|
|
|
|
} else if(converter.equals("otherCode=VLTN_ID")) {
|
|
|
|
} else if(dtlCtgr.equals("VLTN_ID")) {
|
|
|
|
itemName = codeConverter.vltnIdToValue(compositeItemId[i]);
|
|
|
|
itemName = codeConverter.vltnIdToValue(compositeItemId[i]);
|
|
|
|
} else if(converter.equals("otherCode=SGG_CD")) {
|
|
|
|
} else if(dtlCtgr.equals("SGG_CD")) {
|
|
|
|
itemName = codeConverter.sggCodeToValue(compositeItemId[i]);
|
|
|
|
itemName = codeConverter.sggCodeToValue(compositeItemId[i]);
|
|
|
|
} else if(converter.equals("otherCode=DEPT_CD")) {
|
|
|
|
} else if(dtlCtgr.equals("DEPT_CD")) {
|
|
|
|
itemName = codeConverter.deptCodeToValue(compositeItemId[i]);
|
|
|
|
itemName = codeConverter.deptCodeToValue(compositeItemId[i]);
|
|
|
|
} else if(converter.equals("otherCode=USER_ID")) {
|
|
|
|
} else if(dtlCtgr.equals("USER_ID")) {
|
|
|
|
itemName = codeConverter.userIdToUserName(compositeItemId[i]);
|
|
|
|
itemName = codeConverter.userIdToUserName(compositeItemId[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -365,9 +408,9 @@ public class StatBean extends AbstractComponent {
|
|
|
|
|
|
|
|
|
|
|
|
String aggregateType = numberValueInfo.getAggregateType();
|
|
|
|
String aggregateType = numberValueInfo.getAggregateType();
|
|
|
|
|
|
|
|
|
|
|
|
if(aggregateType.startsWith("ratio=")) {
|
|
|
|
if(aggregateType.equals("ratio")) {
|
|
|
|
|
|
|
|
|
|
|
|
int refIndex = Integer.parseInt(aggregateType.split("=")[1]);
|
|
|
|
int refIndex = numberValueInfo.getRatioRefIndex();
|
|
|
|
|
|
|
|
|
|
|
|
int totValue = statItem.getNumberValue()[refIndex];
|
|
|
|
int totValue = statItem.getNumberValue()[refIndex];
|
|
|
|
if(totValue == 0) {
|
|
|
|
if(totValue == 0) {
|
|
|
|