통계 수정

main
이범준 1 year ago
parent 43760f562a
commit 42c545abdc

@ -13,22 +13,12 @@ public class StatItem {
/**
* ID
*/
private String itemId;
private String[] itemId;
/**
*
*/
private String itemName;
/**
*
*/
private String[] compositeItemId;
/**
*
*/
private String[] compositeItemName;
private String[] itemName;
/**
*

@ -69,16 +69,9 @@ public class StatBean extends AbstractComponent {
statQuery.setCompositeNumberValueSeperator(compositeNumberValueSeperator);
//통계 항목별 그룹핑
Map<String, List<DataObject>> group;
String[] categorizations = statQuery.getCategorization();
if(statQuery.getCategorization().length < 2) {
group = queryResult.stream()
.collect(Collectors.groupingBy(item -> item.string(statQuery.getCategorization()[0])));
} else {
String[] categorizations = statQuery.getCategorization();
group = queryResult.stream()
Map<String, List<DataObject>> group = queryResult.stream()
.collect(
Collectors.groupingBy(
(item) -> {
@ -93,7 +86,7 @@ public class StatBean extends AbstractComponent {
}
)
);
}
//고정 항목 설정
if(statQuery.getFixedItemId() != null) {
@ -109,11 +102,7 @@ public class StatBean extends AbstractComponent {
String key = it.next();
StatItem statItem = new StatItem();
if(statQuery.getCategorization().length < 2) {
statItem.setItemId(key);
} else {
statItem.setCompositeItemId(key.split(","));
}
statItem.setItemId(key.split(","));
List<DataObject> listByKey = group.get(key);
@ -223,30 +212,23 @@ public class StatBean extends AbstractComponent {
CodeConverter codeConverter = new CodeConverter(allCode);
if(categoryNameConverter.length > 1) {
String[] codeGroups = categoryNameConverter;
for(StatItem statItem : statItems) {
String[] compositeItemId = statItem.getCompositeItemId();
String[] compositeItemName = new String[compositeItemId.length];
for(int i=0; i < compositeItemId.length ;i++) {
if(codeGroups[i].equals("")) {
compositeItemName[i] = compositeItemId[i];
} else {
String itemName = codeConverter.codeToValue(codeGroups[i], compositeItemId[i]);
compositeItemName[i] = itemName;
}
String[] nameConverters = categoryNameConverter;
for(StatItem statItem : statItems) {
String[] compositeItemId = statItem.getItemId();
String[] compositeItemName = new String[compositeItemId.length];
for(int i=0; i < compositeItemId.length ;i++) {
if(nameConverters[i].equals("") || nameConverters[i].equals("plain")) {
compositeItemName[i] = compositeItemId[i];
} else if(nameConverters[i].startsWith("code=")){
String itemName = codeConverter.codeToValue(nameConverters[i].split("=")[1], compositeItemId[i]);
compositeItemName[i] = itemName;
}
statItem.setCompositeItemName(compositeItemName);
}
} else {
for(StatItem statItem : statItems) {
String itemId = statItem.getItemId();
String itemName = codeConverter.codeToValue(categoryNameConverter[0] , itemId);
statItem.setItemName(itemName);
}
statItem.setItemName(compositeItemName);
}
}
/** .
@ -262,13 +244,13 @@ public class StatBean extends AbstractComponent {
String targetCodeName = regroupInfo[1];
StatItem newItem = new StatItem();
newItem.setItemId("regroup"+i);
newItem.setItemName(targetCodeName);
newItem.setItemId(new String[]{"regroup"+i});
newItem.setItemName(new String[]{targetCodeName});
int[] numberValues = null;
for(StatItem statItem : statItems) {
if(Arrays.asList(sourceCodes).contains(statItem.getItemId())) {
if(Arrays.asList(sourceCodes).contains(statItem.getItemId()[0])) {
if(numberValues == null) {
numberValues = statItem.getNumberValue();
} else {
@ -281,7 +263,7 @@ public class StatBean extends AbstractComponent {
newItem.setNumberValue(numberValues);
statItems.removeIf(item -> Arrays.asList(sourceCodes).contains(item.getItemId()));
statItems.removeIf(item -> Arrays.asList(sourceCodes).contains(item.getItemId()[0]));
statItems.add(newItem);

@ -1,5 +1,7 @@
package cokr.xit.fims.stat.web;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -41,7 +43,17 @@ public class StatController extends ApplicationController {
String[] categoryNameConverter = statQuery.getCategoryNameConverter();
Map<String, List<CommonCode>> commonCodes = getCodesOf(categoryNameConverter);
List<String> codeGroup = new ArrayList<String>();
for(int i=0; i < categoryNameConverter.length; i++) {
if(categoryNameConverter[i].startsWith("code=")) {
codeGroup.add(categoryNameConverter[i].split("=")[1]);
}
}
Map<String, List<CommonCode>> commonCodes = new HashMap<String, List<CommonCode>>();
if(codeGroup.size() > 0) {
commonCodes = getCodesOf(codeGroup.toArray(new String[codeGroup.size()]));
}
Stat stat = statService.getStatistics(statQuery, commonCodes);

@ -202,7 +202,7 @@ function fnLoadStatisticsDatas(){
queryParam = {
structureType : "aggregate",
categorization : ["CRDN_SE_CD"],
categoryNameConverter : ["FIM002"],
categoryNameConverter : ["code=FIM002"],
fixedItemId : ["01","02","06","13","08","09","10","11"],
regroupInfos : ["08,09,10,11=민원","06,13=도보"],
namedNumberValueSeperator : "completeAndTotal"
@ -213,7 +213,7 @@ function fnLoadStatisticsDatas(){
queryParam = {
structureType : "aggregate",
categorization : ["등록대상이첩대상구분"],
categoryNameConverter : ["FIM999"],
categoryNameConverter : ["code=FIM999"],
fixedItemId : ["등록대상","이첩대상"],
namedNumberValueSeperator : "completeAndTotal"
};
@ -223,7 +223,7 @@ function fnLoadStatisticsDatas(){
queryParam = {
structureType : "aggregate",
categorization : ["SNDNG_SE_CD"],
categoryNameConverter : ["FIM047"],
categoryNameConverter : ["code=FIM047"],
fixedItemId : ["01", "02", "03"],
namedNumberValueSeperator : "completeAndTotal"
};
@ -233,7 +233,7 @@ function fnLoadStatisticsDatas(){
queryParam = {
structureType : "aggregate",
categorization : ["OPNN_SBMSN_STTS_CD"],
categoryNameConverter : ["FIM031"],
categoryNameConverter : ["code=FIM031"],
fixedItemId : ["00", "01", "02", "03"],
regroupInfo : ["01,02=수용/미수용"],
namedNumberValueSeperator : "completeAndTotal"
@ -244,7 +244,7 @@ function fnLoadStatisticsDatas(){
queryParam = {
structureType : "aggregate",
categorization : ["CRDN_SE_CD"],
categoryNameConverter : ["FIM002"],
categoryNameConverter : ["code=FIM002"],
fixedItemId : ["01","02","06","13","08","09","10","11"],
regroupInfos : ["08,09,10,11=민원","06,13=도보"],
namedNumberValueSeperator : "lastFewDays",
@ -257,7 +257,7 @@ function fnLoadStatisticsDatas(){
queryParam = {
structureType : "aggregate",
categorization : ["초기자료처리"],
categoryNameConverter : ["FIM999"],
categoryNameConverter : ["code=FIM999"],
fixedItemId : ["단속","계고","서손"]
};
//fnLoadStatisticsData(queryParam, "doughnutChart1", "doughnut");
@ -266,7 +266,7 @@ function fnLoadStatisticsDatas(){
queryParam = {
structureType : "aggregate",
categorization : ["SNDNG_SE_CD"],
categoryNameConverter : ["FIM047"],
categoryNameConverter : ["code=FIM047"],
fixedItemId : ["01", "02", "03"]
};
//fnLoadStatisticsData(queryParam, "doughnutChart2", "doughnut");
@ -275,7 +275,7 @@ function fnLoadStatisticsDatas(){
queryParam = {
structureType : "aggregate",
categorization : ["OPNN_SBMSN_STTS_CD"],
categoryNameConverter : ["FIM031"],
categoryNameConverter : ["code=FIM031"],
fixedItemId : ["01", "02", "03"]
};
//fnLoadStatisticsData(queryParam, "doughnutChart3", "doughnut");
@ -317,7 +317,7 @@ function fnRenderDashboardContents(returnData, cursor, statType){
function fnRenderProgressAndTotal(returnData, cursor){
for(var i=0; i < returnData.statItems.length; i++){
var icon = $("#"+cursor).find("i[title='" + returnData.statItems[i].itemName + "']");
var icon = $("#"+cursor).find("i[title='" + returnData.statItems[i].itemName[0] + "']");
var p = icon.prev("p");
p.html(returnData.statItems[i].numberValue[0] + "/" + returnData.statItems[i].numberValue[1]);
}
@ -363,7 +363,7 @@ function fnRenderLine(returnData, cursor){
pointHoverBorderColor: config.colors.cardColor
};
defaultObject.label = returnData.statItems[i].itemName;
defaultObject.label = returnData.statItems[i].itemName[0];
defaultObject.data = returnData.statItems[i].numberValue;
@ -492,7 +492,7 @@ function fnRenderDoughnut(returnData, cursor){
var datas = [];
var colors = [];
for(var i=0; i < returnData.statItems.length; i++){
lebels.push(returnData.statItems[i].itemName);
lebels.push(returnData.statItems[i].itemName[0]);
datas.push(returnData.statItems[i].numberValue[0]);
if(i % 3 == 0){ colors.push(cyanColor); }
if(i % 3 == 1){ colors.push(orangeLightColor); }

Loading…
Cancel
Save