통계 수정

main
이범준 1 year ago
parent 541a3abc5c
commit 9c640066a6

@ -0,0 +1,31 @@
package cokr.xit.fims.stat;
public class NumberValueInfo {
/**
*
*/
private String numberValueSeperator;
/**
* (count , sum , ratio )
*/
private String aggregateType;
public String getNumberValueSeperator(){
return this.numberValueSeperator;
}
public void setNumberValueSeperator(String numberValueSeperator){
this.numberValueSeperator = numberValueSeperator;
}
public String getAggregateType(){
return this.aggregateType;
}
public void setAggregateType(String aggregateType){
this.aggregateType = aggregateType;
}
}

@ -34,19 +34,9 @@ public class StatQuery extends CmmnQuery {
private List<GroupInfo> groupInfoList;
/**
* ()
*
*/
//private String[] groupColName;
/**
*
*/
//private String[] categorizationAddOption;
/**
* (ID)
*/
//private String[] categoryNameConverter;
private List<NumberValueInfo> numberValueInfoList;
/**
* ID ( )
@ -59,14 +49,9 @@ public class StatQuery extends CmmnQuery {
private String namedNumberValueSeperator;
/**
*
*
*/
private String[] compositeNumberValueSeperator;
/**
* (count , sum , ratio )
*/
private String[] aggregateType;
private String globalAggregate;
/**
* 릿
@ -115,6 +100,16 @@ public class StatQuery extends CmmnQuery {
return self();
}
public List<NumberValueInfo> getNumberValueInfoList() {
return this.numberValueInfoList;
}
public <T extends StatQuery> T setNumberValueInfoList(List<NumberValueInfo> numberValueInfoList) {
this.numberValueInfoList = numberValueInfoList;
return self();
}
public String getNamedNumberValueSeperator() {
return ifEmpty(namedNumberValueSeperator, () -> null);
}
@ -124,39 +119,12 @@ public class StatQuery extends CmmnQuery {
return self();
}
//public String[] getGroupColName() {
//return ifEmpty(groupColName, () -> null);
//}
//public <T extends StatQuery> T setGroupColName(String... groupColName) {
//this.groupColName = groupColName;
//return self();
//}
//public String[] getCategorizationAddOption() {
//return ifEmpty(categorizationAddOption, () -> null);
//}
//public <T extends StatQuery> T setCategorizationAddOption(String... categorizationAddOption) {
//this.categorizationAddOption = categorizationAddOption;
//return self();
//}
//public String[] getCategoryNameConverter() {
//return ifEmpty(categoryNameConverter, () -> null);
//}
//public <T extends StatQuery> T setCategoryNameConverter(String... categoryNameConverter) {
//this.categoryNameConverter = categoryNameConverter;
//return self();
//}
public String[] getAggregateType() {
return ifEmpty(aggregateType, () -> null);
public String getGlobalAggregate() {
return ifEmpty(globalAggregate, () -> null);
}
public <T extends StatQuery> T setAggregateType(String... aggregateType) {
this.aggregateType = aggregateType;
public <T extends StatQuery> T setGlobalAggregate(String globalAggregate) {
this.globalAggregate = globalAggregate;
return self();
}
@ -169,15 +137,6 @@ public class StatQuery extends CmmnQuery {
return self();
}
public String[] getCompositeNumberValueSeperator() {
return ifEmpty(compositeNumberValueSeperator, () -> null);
}
public <T extends StatQuery> T setCompositeNumberValueSeperator(String... compositeNumberValueSeperator) {
this.compositeNumberValueSeperator = compositeNumberValueSeperator;
return self();
}
public String[] getFixedItemId() {
return ifEmpty(fixedItemId, () -> null);
}

@ -20,6 +20,7 @@ import cokr.xit.fims.cmmn.CmmnQuery;
import cokr.xit.fims.cmmn.CodeConverter;
import cokr.xit.fims.stat.CodeSubsetInfo;
import cokr.xit.fims.stat.GroupInfo;
import cokr.xit.fims.stat.NumberValueInfo;
import cokr.xit.fims.stat.Stat;
import cokr.xit.fims.stat.StatItem;
import cokr.xit.fims.stat.StatQuery;
@ -67,41 +68,6 @@ public class StatBean extends AbstractComponent {
Stat stat = new Stat();
//통계 요청 설정
int compositeSize = 0;
String[] compositeNumberValueSeperator = statQuery.getCompositeNumberValueSeperator();
String[] aggregateType = statQuery.getAggregateType();
if(compositeNumberValueSeperator == null && aggregateType == null) {
compositeSize = 1;
compositeNumberValueSeperator = new String[] {""};
aggregateType = new String[] {"count"};
} else if(compositeNumberValueSeperator != null && aggregateType == null) {
compositeSize = compositeNumberValueSeperator.length;
aggregateType = new String[compositeSize];
} else if(compositeNumberValueSeperator == null && aggregateType != null) {
compositeSize = aggregateType.length;
compositeNumberValueSeperator = new String[compositeSize];
} else {
if(compositeNumberValueSeperator.length > aggregateType.length) {
compositeSize = compositeNumberValueSeperator.length;
} else {
compositeSize = aggregateType.length;
}
}
for(int i=0; i < compositeSize; i++) {
if(compositeNumberValueSeperator[i] == null) {
compositeNumberValueSeperator[i] = "";
}
if(aggregateType[i] == null || aggregateType[i].equals("")) {
aggregateType[i] = "count";
}
}
statQuery.setAggregateType(aggregateType);
statQuery.setCompositeNumberValueSeperator(compositeNumberValueSeperator);
//통계 항목별 그룹핑
Map<String, List<DataObject>> group = this.grouping(queryResult, statQuery);
@ -149,13 +115,6 @@ public class StatBean extends AbstractComponent {
List<GroupInfo> groupInfoList = statQuery.getGroupInfoList();
//String[] categorizations = statQuery.getGroupColName();
//String[] addOptions = statQuery.getCategorizationAddOption();
//String[] categoryNameConverters = statQuery.getCategoryNameConverter();
List<CodeSubsetInfo> subsetInfoList = statQuery.getCodeSubsetInfoList();
Map<String, List<DataObject>> group = queryResult.stream()
@ -258,11 +217,10 @@ public class StatBean extends AbstractComponent {
*/
public int[] extractNumberValue(List<DataObject> listByKey, StatQuery statQuery) {
String[] compositeNumberValueSeperator = statQuery.getCompositeNumberValueSeperator();
String[] aggregateType = statQuery.getAggregateType();
List<NumberValueInfo> numberValueInfoList = statQuery.getNumberValueInfoList();
int[] aggregateArr = new int[compositeNumberValueSeperator.length];
for(int i=0; i < compositeNumberValueSeperator.length; i++) {
int[] aggregateArr = new int[numberValueInfoList.size()];
for(int i=0; i < numberValueInfoList.size(); i++) {
aggregateArr[i] = 0;
}
@ -273,29 +231,31 @@ public class StatBean extends AbstractComponent {
for(int j=0; j < aggregateArr.length; j++) {
String condition = compositeNumberValueSeperator[j];
String condition = numberValueInfoList.get(j).getNumberValueSeperator();
String aggregateType = numberValueInfoList.get(j).getAggregateType();
if(condition.contains("=")) {
if(!condition.equals("")) {
String conditionColumn = condition.split("=")[0];
String conditionColumnValue = dataObject.string(conditionColumn);
String conditionValue = condition.split("=")[1];
if(condition.contains("=")) {
if(conditionColumnValue.equals("")) {
continue;
}
String conditionColumn = condition.split("=")[0];
String conditionColumnValue = dataObject.string(conditionColumn);
String conditionValue = condition.split("=")[1];
if(conditionColumn.endsWith("_DT") && conditionValue.length() == 8) {
conditionColumnValue = conditionColumnValue.substring(0,8);
}
if(conditionColumn.endsWith("_DT") && conditionValue.length() == 8) {
conditionColumnValue = conditionColumnValue.substring(0,8);
}
if(!conditionColumnValue.equals(conditionValue)) {
continue;
if(!conditionColumnValue.equals(conditionValue)) {
continue;
}
}
}
if(aggregateType[j].startsWith("sum=")) {
aggregateArr[j] += dataObject.number(aggregateType[j].split("=")[1]).intValue();
if(aggregateType.startsWith("sum=")) {
aggregateArr[j] += dataObject.number(aggregateType.split("=")[1]).intValue();
} else {
aggregateArr[j] += 1;
}
@ -396,15 +356,18 @@ public class StatBean extends AbstractComponent {
int decimalPoint = statQuery.getDecimalPoint();
String[] aggregateTypes = statQuery.getAggregateType();
List<NumberValueInfo> numberValueInfoList = statQuery.getNumberValueInfoList();
for(StatItem statItem : statItems) {
for(int i = 0; i < aggregateTypes.length ; i++) {
for(int i = 0; i < numberValueInfoList.size(); i++) {
NumberValueInfo numberValueInfo = numberValueInfoList.get(i);
String aggregateType = numberValueInfo.getAggregateType();
if(aggregateTypes[i].startsWith("ratio=")) {
if(aggregateType.startsWith("ratio=")) {
int refIndex = Integer.parseInt(aggregateTypes[i].split("=")[1]);
int refIndex = Integer.parseInt(aggregateType.split("=")[1]);
int totValue = statItem.getNumberValue()[refIndex];
if(totValue == 0) {

@ -2,7 +2,6 @@ package cokr.xit.fims.stat.service.bean;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -20,6 +19,7 @@ import cokr.xit.fims.excl.service.OpnnSbmsnService;
import cokr.xit.fims.sndb.SndbQuery;
import cokr.xit.fims.sndb.service.SndngService;
import cokr.xit.fims.stat.GroupInfo;
import cokr.xit.fims.stat.NumberValueInfo;
import cokr.xit.fims.stat.Stat;
import cokr.xit.fims.stat.StatQuery;
import cokr.xit.fims.stat.service.StatService;
@ -66,49 +66,42 @@ public class StatServiceBean extends AbstractServiceBean implements StatService
if(statQuery.getNamedNumberValueSeperator().equals("completeAndTotal")) { //완료자료 및 전체자료
String[] compositeNumberValueSeperator = new String[] {"COMPLETE_YN=Y", ""};
statQuery.setCompositeNumberValueSeperator(compositeNumberValueSeperator);
String seperator1 = "COMPLETE_YN=Y";
String seperator2 = "";
if(statQuery.getAggregateType() == null) {
String[] aggregateType = new String[] {"count", "count"};
statQuery.setAggregateType(aggregateType);
}
daySetting = true;
String globalAggregate = statQuery.getGlobalAggregate();
String aggregate1 = globalAggregate;
String aggregate2 = globalAggregate;
numberValueLabel = new String[] {"처리건수","전체건수"};
List<NumberValueInfo> numberValueInfoList = new ArrayList<NumberValueInfo>();
NumberValueInfo col1 = new NumberValueInfo();
col1.setNumberValueSeperator(seperator1);
col1.setAggregateType(aggregate1);
numberValueInfoList.add(col1);
NumberValueInfo col2 = new NumberValueInfo();
col2.setNumberValueSeperator(seperator2);
col2.setAggregateType(aggregate2);
numberValueInfoList.add(col2);
statQuery.setNumberValueInfoList(numberValueInfoList);
} else if(statQuery.getNamedNumberValueSeperator().equals("lastFewDays")) {
String[] compositeNumberValueSeperator = new String[dayRange];
for(int i=0; i<compositeNumberValueSeperator.length; i++) {
compositeNumberValueSeperator[i] = dayColumn+"="+CmmnUtil.addDay(firstDay,i);
}
statQuery.setCompositeNumberValueSeperator(compositeNumberValueSeperator);
numberValueLabel = new String[] {"처리","전체"};
daySetting = true;
if(statQuery.getAggregateType() == null) {
String[] aggregateType = new String[compositeNumberValueSeperator.length];
for(int i=0; i<compositeNumberValueSeperator.length; i++) {
aggregateType[i] = "count";
}
statQuery.setAggregateType(aggregateType);
} else if(statQuery.getAggregateType().length != statQuery.getCompositeNumberValueSeperator().length) {
String[] aggregateType = new String[compositeNumberValueSeperator.length];
} else if(statQuery.getNamedNumberValueSeperator().equals("lastFewDays")) {
String defaultType = statQuery.getAggregateType()[0];
if(ifEmpty(defaultType,()->"").equals("")) {
defaultType = "count";
}
String globalAggregate = statQuery.getGlobalAggregate();
for(int i=0; i<compositeNumberValueSeperator.length; i++) {
aggregateType[i] = defaultType;
}
List<NumberValueInfo> numberValueInfoList = new ArrayList<NumberValueInfo>();
statQuery.setAggregateType(aggregateType);
for(int i=0; i<dayRange; i++) {
NumberValueInfo numberValueInfo = new NumberValueInfo();
numberValueInfo.setNumberValueSeperator(dayColumn+"="+CmmnUtil.addDay(firstDay,i));
numberValueInfo.setAggregateType(globalAggregate);
numberValueInfoList.add(numberValueInfo);
}
statQuery.setNumberValueInfoList(numberValueInfoList);
numberValueLabel = new String[dayRange];
for(int i=0; i < dayRange; i++) {
@ -119,6 +112,7 @@ public class StatServiceBean extends AbstractServiceBean implements StatService
}
}
daySetting = true;
}
String domain = "";
@ -202,8 +196,8 @@ public class StatServiceBean extends AbstractServiceBean implements StatService
//비율 값 계산
boolean exsistRatioValue = false;
for(String aggregateType : Arrays.asList(statQuery.getAggregateType())) {
if(aggregateType.startsWith("ratio=")) {
for(NumberValueInfo numberValueInfo : statQuery.getNumberValueInfoList()) {
if(numberValueInfo.getAggregateType().startsWith("ratio=")) {
exsistRatioValue = true;
}
}

@ -199,6 +199,7 @@ function fnLoadStatisticsDatas(){
var mergedQuery = {};
var groupInfoList = [];
var numberValueInfoList = [];
var codeSubsetInfoList = [];
var defaultQuery = {};
@ -210,7 +211,8 @@ function fnLoadStatisticsDatas(){
defaultQuery = {
structureType : "aggregate",
fixedItemId : ["01","02","minwon","dobo"],
namedNumberValueSeperator : "completeAndTotal"
namedNumberValueSeperator : "completeAndTotal",
globalAggregate : "count"
};
groupInfoList = [
@ -247,12 +249,15 @@ function fnLoadStatisticsDatas(){
defaultQuery = {
structureType : "aggregate",
fixedItemId : ["등록대상","이첩대상"],
namedNumberValueSeperator : "completeAndTotal"
namedNumberValueSeperator : "completeAndTotal",
globalAggregate : "count"
};
groupInfoList = [
groupColName : "등록대상이첩대상구분",
categoryNameConverter : "code=FIM999"
{
groupColName : "등록대상이첩대상구분",
categoryNameConverter : "code=FIM999"
}
];
queryInQuery1 = fnJsonArrayToFormData(groupInfoList, "groupInfoList");
@ -265,12 +270,15 @@ function fnLoadStatisticsDatas(){
defaultQuery = {
structureType : "aggregate",
fixedItemId : ["01", "02", "03"],
namedNumberValueSeperator : "completeAndTotal"
namedNumberValueSeperator : "completeAndTotal",
globalAggregate : "count"
};
groupInfoList = [
groupColName : "SNDNG_SE_CD",
categoryNameConverter : "code=FIM047"
{
groupColName : "SNDNG_SE_CD",
categoryNameConverter : "code=FIM047"
}
];
queryInQuery1 = fnJsonArrayToFormData(groupInfoList, "groupInfoList");
@ -283,12 +291,15 @@ function fnLoadStatisticsDatas(){
defaultQuery = {
structureType : "aggregate",
fixedItemId : ["00", "acceptOrNonAccept", "03"],
namedNumberValueSeperator : "completeAndTotal"
namedNumberValueSeperator : "completeAndTotal",
globalAggregate : "count"
};
groupInfoList = [
groupColName : "OPNN_SBMSN_STTS_CD",
categoryNameConverter : "code=FIM031"
{
groupColName : "OPNN_SBMSN_STTS_CD",
categoryNameConverter : "code=FIM031"
}
];
queryInQuery1 = fnJsonArrayToFormData(groupInfoList, "groupInfoList");
@ -313,6 +324,7 @@ function fnLoadStatisticsDatas(){
structureType : "aggregate",
fixedItemId : ["01","02","dobo","minwon"],
namedNumberValueSeperator : "lastFewDays",
globalAggregate : "count",
dayRange : 15,
dayColumn : "CRDN_YMD"
};
@ -350,19 +362,29 @@ function fnLoadStatisticsDatas(){
//초기자료처리별 건수 차트
defaultQuery = {
structureType : "aggregate",
groupColName : ["초기자료처리"],
categoryNameConverter : ["code=FIM999"],
fixedItemId : ["단속","계고","서손"]
};
groupInfoList = [
groupColName : "초기자료처리",
categoryNameConverter : "code=FIM999"
{
groupColName : "초기자료처리",
categoryNameConverter : "code=FIM999"
}
];
queryInQuery1 = fnJsonArrayToFormData(groupInfoList, "groupInfoList");
mergedQuery = {...defaultQuery, ...queryInQuery1 };
numberValueInfoList = [
{
numberValueSeperator : "",
aggregateType : "count"
}
];
queryInQuery2 = fnJsonArrayToFormData(numberValueInfoList, "numberValueInfoList");
mergedQuery = {...defaultQuery, ...queryInQuery1, ...queryInQuery2 };
//fnLoadStatisticsData(mergedQuery, "doughnutChart1", "doughnut");
@ -373,13 +395,24 @@ function fnLoadStatisticsDatas(){
};
groupInfoList = [
groupColName : "SNDNG_SE_CD",
categoryNameConverter : "code=FIM047"
{
groupColName : "SNDNG_SE_CD",
categoryNameConverter : "code=FIM047"
}
];
queryInQuery1 = fnJsonArrayToFormData(groupInfoList, "groupInfoList");
mergedQuery = {...defaultQuery, ...queryInQuery1 };
numberValueInfoList = [
{
numberValueSeperator : "",
aggregateType : "count"
}
];
queryInQuery2 = fnJsonArrayToFormData(numberValueInfoList, "numberValueInfoList");
mergedQuery = {...defaultQuery, ...queryInQuery1, ... queryInQuery2};
//fnLoadStatisticsData(mergedQuery, "doughnutChart2", "doughnut");
@ -390,13 +423,24 @@ function fnLoadStatisticsDatas(){
};
groupInfoList = [
groupColName : "OPNN_SBMSN_STTS_CD",
categoryNameConverter : "code=FIM031"
{
groupColName : "OPNN_SBMSN_STTS_CD",
categoryNameConverter : "code=FIM031"
}
];
queryInQuery1 = fnJsonArrayToFormData(groupInfoList, "groupInfoList");
mergedQuery = {...defaultQuery, ...queryInQuery1 };
numberValueInfoList = [
{
numberValueSeperator : "",
aggregateType : "count"
}
];
queryInQuery2 = fnJsonArrayToFormData(numberValueInfoList, "numberValueInfoList");
mergedQuery = {...defaultQuery, ...queryInQuery1, ...queryInQuery2 };
//fnLoadStatisticsData(mergedQuery, "doughnutChart3", "doughnut");
}

Loading…
Cancel
Save