통계 수정

main
이범준 1 year ago
parent 98411eaf61
commit 22db24e93d

@ -6,10 +6,7 @@ import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import javax.annotation.Resource;
import cokr.xit.base.code.CommonCode;
import cokr.xit.fims.stat.dao.StatMapper;
import cokr.xit.foundation.data.DataObject;
@ -22,13 +19,26 @@ public class CodeConverter {
List<DataObject> vltnList = new ArrayList<DataObject>();
List<DataObject> userList = new ArrayList<DataObject>();
@Resource(name = "statMapper")
private StatMapper statMapper;
public CodeConverter(Map<String, List<CommonCode>> commonCodes){
this.commonCodes = commonCodes;
}
public void putSgg(DataObject dataobject){
this.sggList.add(dataobject);
}
public void putDept(DataObject dataobject){
this.deptList.add(dataobject);
}
public void putVltn(DataObject dataobject){
this.vltnList.add(dataobject);
}
public void putUser(DataObject dataobject){
this.userList.add(dataobject);
}
/** .
* @param codeGroupName , value
* @return
@ -127,15 +137,6 @@ public class CodeConverter {
}
}
if(result.equals("")) {
DataObject findRow = statMapper.selectVltnById(vltnId);
if(findRow != null){
vltnList.add(findRow);
result = findRow.string("VLTN_NM");
}
}
return result;
}
@ -152,15 +153,6 @@ public class CodeConverter {
}
}
if(result.equals("")) {
DataObject findRow = statMapper.selectSggByCode(sggCd);
if(findRow != null){
vltnList.add(findRow);
result = findRow.string("SGG_NM");
}
}
return result;
}
@ -177,15 +169,6 @@ public class CodeConverter {
}
}
if(result.equals("")) {
DataObject findRow = statMapper.selectDeptByCode(deptCd);
if(findRow != null){
vltnList.add(findRow);
result = findRow.string("DEPT_NM");
}
}
return result;
}
@ -203,15 +186,6 @@ public class CodeConverter {
}
}
if(result.equals("")) {
DataObject findRow = statMapper.selectUserById(userId);
if(findRow != null){
vltnList.add(findRow);
result = findRow.string("USER_NM");
}
}
return result;
}

@ -9,6 +9,8 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.base.code.CommonCode;
@ -21,6 +23,7 @@ import cokr.xit.fims.stat.NumberValueInfo;
import cokr.xit.fims.stat.Stat;
import cokr.xit.fims.stat.StatItem;
import cokr.xit.fims.stat.StatQuery;
import cokr.xit.fims.stat.dao.StatMapper;
import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.DataObject;
@ -28,6 +31,9 @@ import cokr.xit.foundation.data.DataObject;
@Component("statBean")
public class StatBean extends AbstractComponent {
@Resource(name = "statMapper")
StatMapper statMapper;
/** .
* @param sql query, dayCol , from , to
* @return
@ -396,13 +402,53 @@ public class StatBean extends AbstractComponent {
itemName = codeConverter.vltnCdToValue(taskSeCd, compositeItemId[i]);
} else if(dtlCtgr.equals("VLTN_ID")) {
itemName = codeConverter.vltnIdToValue(compositeItemId[i]);
String find = codeConverter.vltnIdToValue(compositeItemId[i]);
if(!find.equals("")) {
itemName = find;
} else {
DataObject findRow = statMapper.selectVltnById(compositeItemId[i]);
if(findRow != null){
itemName = findRow.string("VLTN_NM");
codeConverter.putVltn(findRow);
}
}
} else if(dtlCtgr.equals("SGG_CD")) {
itemName = codeConverter.sggCodeToValue(compositeItemId[i]);
String find = codeConverter.sggCodeToValue(compositeItemId[i]);
if(!find.equals("")) {
itemName = find;
} else {
DataObject findRow = statMapper.selectSggByCode(compositeItemId[i]);
if(findRow != null){
itemName = findRow.string("SGG_NM");
codeConverter.putSgg(findRow);
}
}
} else if(dtlCtgr.equals("DEPT_CD")) {
itemName = codeConverter.deptCodeToValue(compositeItemId[i]);
String find = codeConverter.deptCodeToValue(compositeItemId[i]);
if(!find.equals("")) {
itemName = find;
} else {
DataObject findRow = statMapper.selectDeptByCode(compositeItemId[i]);
if(findRow != null){
itemName = findRow.string("DEPT_NM");
codeConverter.putDept(findRow);
}
}
} else if(dtlCtgr.equals("USER_ID")) {
itemName = codeConverter.userIdToUserName(compositeItemId[i]);
String find = codeConverter.userIdToUserName(compositeItemId[i]);
if(!find.equals("")) {
itemName = find;
} else {
DataObject findRow = statMapper.selectUserById(compositeItemId[i]);
if(findRow != null){
itemName = findRow.string("USER_NM");
codeConverter.putUser(findRow);
}
}
}
}
@ -445,8 +491,8 @@ public class StatBean extends AbstractComponent {
statItem.getNumberValue()[i] = 0;
} else {
int originalValue = statItem.getNumberValue()[i];
double ratioValue = originalValue / totValue;
double percent = ratioValue * 100 * (decimalPoint+1);
double ratioValue = (double) originalValue / (double) totValue;
double percent = ratioValue * Math.pow(10, 2+decimalPoint);
statItem.getNumberValue()[i] = (int) Math.floor(percent);
}
@ -458,4 +504,6 @@ public class StatBean extends AbstractComponent {
}
}

@ -16,6 +16,7 @@ import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.crdn.dao.GlobalStngMapper;
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.StatQuery;
import cokr.xit.fims.stat.service.StatService;
@ -46,30 +47,53 @@ public class Stat01Controller extends ApplicationController {
String sggCd = globalStngMapper.selectSggCd(curDeptCode);
statQuery.setSggCd(sggCd);
List<GroupInfo> groupInfoList = statQuery.getGroupInfoList();
List<String> codeGroup = new ArrayList<String>();
for(int i=0; i < groupInfoList.size(); i++) {
GroupInfo groupInfo = groupInfoList.get(i);
String ctgrType = groupInfo.getCtgrType();
String dtlCtgr = groupInfo.getDtlCtgr();
if(ctgrType.equals("code")) {
codeGroup.add(dtlCtgr);
} else if(ctgrType.equals("otherCode")) {
if(dtlCtgr.equals("VLTN_CD")) {
codeGroup.add("FIM054");
codeGroup.add("FIM004");
codeGroup.add("FIM005");
codeGroup.add("FIM006");
codeGroup.add("FIM061");
codeGroup.add("FIM064");
}
List<GroupInfo> groupInfoList = statQuery.getGroupInfoList();
if(groupInfoList != null) {
for(int i=0; i < groupInfoList.size(); i++) {
GroupInfo groupInfo = groupInfoList.get(i);
String ctgrType = ifEmpty(groupInfo.getCtgrType(), () -> "");
String dtlCtgr = ifEmpty(groupInfo.getDtlCtgr(), () -> "");
if(ctgrType.equals("code")) {
codeGroup.add(dtlCtgr);
} else if(ctgrType.equals("otherCode")) {
if(dtlCtgr.equals("VLTN_CD")) {
codeGroup.add("FIM054");
codeGroup.add("FIM004");
codeGroup.add("FIM005");
codeGroup.add("FIM006");
codeGroup.add("FIM061");
codeGroup.add("FIM064");
}
}
}
}
List<NumberValueInfo> numberValueInfoList = statQuery.getNumberValueInfoList();
if(numberValueInfoList != null) {
for(int i=0; i < numberValueInfoList.size(); i++) {
NumberValueInfo numberValueInfo = numberValueInfoList.get(i);
String ctgrType = ifEmpty(numberValueInfo.getSeperatorCtgrType(), () -> "");
String dtlCtgr = ifEmpty(numberValueInfo.getSeperatorDtlCtgr(), () -> "");
if(ctgrType.equals("code")) {
codeGroup.add(dtlCtgr);
} else if(ctgrType.equals("otherCode")) {
if(dtlCtgr.equals("VLTN_CD")) {
codeGroup.add("FIM054");
codeGroup.add("FIM004");
codeGroup.add("FIM005");
codeGroup.add("FIM006");
codeGroup.add("FIM061");
codeGroup.add("FIM064");
}
}
}
}
Map<String, List<CommonCode>> commonCodes = new HashMap<String, List<CommonCode>>();
if(codeGroup.size() > 0) {

@ -438,6 +438,18 @@ public class CmnController {
return super.statMain();
}
}
@Controller
@RequestMapping(name="종합 통계", value="/stat/stat05")
class Stat05Controller extends cokr.xit.fims.stat.web.Stat05Controller {
@Override
@RequestMapping(name="종합 통계 메인", value="/010/main.do")
public ModelAndView statMain() {
return super.statMain();
}
}
@Controller

@ -48,16 +48,16 @@
</div>
<div class="row g-1 my-2">
<div class="col-12">
<select id="schDateOpt--${pageName}" name="schDateOpt" class="form-select">
<select id="dayColumn--${pageName}" name="dayColumn" class="form-select">
</select>
<span class="form-search-linebox">
<input type="text" id="schDateFrom--${pageName}" name="schDateFrom"
<input type="text" id="firstDay--${pageName}" name="firstDay"
class="form-control form-date"
data-fmt-type="day" title="시작 날짜 선택" />
<button type="button" class="bx bx-sm bx-calendar bg-white"></button>
~
<input type="text" id="schDateTo--${pageName}" name="schDateTo"
<input type="text" id="lastDay--${pageName}" name="lastDay"
class="form-control form-date"
data-fmt-type="day" title="종료 날짜 선택">
<button type="button" class="bx bx-sm bx-calendar bg-white"></button>
@ -100,7 +100,7 @@
<label class="form-label fw-bold form-search-title text-end">집계항목</label>
<select id="preset--${pageName}" name="preset"
class="form-select w-100" style="max-width:100%">
<option value="TOT_CNT" selected>전체건수</option>
<option value="totCnt" selected>전체건수</option>
</select>
</div>
</div>
@ -173,6 +173,7 @@ $(document).ready(function(){
var $P = pageObject["${pageName}"];
$P.statQuery = {};
/**************************************************************************
* pageObject.function
**************************************************************************/
@ -230,11 +231,30 @@ $(document).ready(function(){
$P.getNumberValueInfoList = () => {
var numberValuefoLiost = [];
var preset = $("#preset--${pageName}").find(":selected");
if(preset.val() == "totCnt"){
numberValuefoLiost = [{ aggregateType : "count" }];
return numberValuefoLiost;
}
numberValuefoLiost = window[preset.val()];
return numberValuefoLiost;
}
$P.getCodeSubsetInfoList = () => {
var codeSubsetInfoList = [];
var preset = $("#preset--${pageName}").find(":selected");
if(window[preset.val()+"_codeSubsetInfoList"] != undefined){
codeSubsetInfoList = window[preset.val()+"_codeSubsetInfoList"];
}
return codeSubsetInfoList;
}
$P.changeGrid = () => {
$("#masterThead--${pageName}").html("");
@ -279,30 +299,59 @@ $(document).ready(function(){
$P.searchStat = () => {
var statQuery = {
structureType : "aggregate"
};
var formFields = new FimsFormFields("#frmSearch--${pageName}");
var formFieldsData = formFields.get();
if(formFieldsData.firstDay == "" || formFieldsData.lastDay == ""){
dialog.alert("시작일자와 종료일자를 입력하세요.");
return;
}
var statQuery = {
structureType : "aggregate",
decimalPoint : 1
};
//업무구분
if(formFieldsData.taskSeCd != ""){
statQuery.taskSeCd = formFieldsData.taskSeCd;
}
//날짜 조회조건
statQuery.dayColumn = formFieldsData.dayColumn;
statQuery.firstDay = formFieldsData.firstDay;
statQuery.lastDay = formFieldsData.lastDay;
//통계 유형
var preset = $("#preset--${pageName}").find(":selected");
if(preset.val() == "totCnt"){
statQuery.statDomain = $("#defaultStatDomain--${pageName}").val();
} else {
statQuery.statDomain = preset[0].dataset.statDomain;
}
//집계 그룹 정보
statQuery.groupInfoList = $P.getGroupInfoList();
statQuery.groupInfoList = $P.getGroupInfoList();
//수치값 정보
statQuery.numberValueInfoList = $P.getNumberValueInfoList();
//코드서브셋 정보
statQuery.codeSubsetInfoList = $P.getCodeSubsetInfoList();
//상세목록 조회 여부
statQuery.refListYn = formFieldsData.refListYn;
$P.statQuery = JSON.parse(JSON.stringify(statQuery));
statQuery = fnJsonToFormData(statQuery, "groupInfoList");
statQuery = fnJsonToFormData(statQuery, "numberValueInfoList");
statQuery = fnJsonToFormData(statQuery, "codeSubsetInfoList");
ajax.get({
url : wctx.url("/stat/stat01/010/info.do"),
data : defaultQuery,
data : statQuery,
success : (resp) => {
var stat = resp.stat;
$P.renderStat(stat);
@ -312,7 +361,22 @@ $(document).ready(function(){
}
$P.renderStat = (stat) => {
$("#masterTbody--${pageName}").html("");
var statItems = stat.statItems;
if(statItems == null || statItems.length == 0){
dialog.alert("조회된 자료가 없습니다.");
return;
}
//비율 소수점
var decimalPoint = 0;
if($P.statQuery.decimalPoint != null){
decimalPoint = $P.statQuery.decimalPoint;
}
var pointMove = Number.parseFloat(0.1 ** decimalPoint).toFixed(decimalPoint);
for(var i=0; i < statItems.length; i++){
var statItem = statItems[i];
@ -320,18 +384,34 @@ $(document).ready(function(){
var itemNames = statItem.itemName;
var numberValues = statItem.numberValue;
//
// "tr"
// "td" itemNames.length
// "td" numberValues.length
var tr = "<tr>";
for(var j=0; j < itemNames.length; j++){
tr += "<td>" + itemNames[j] + "</td>";
}
for(var k=0; k < numberValues.length; k++){
tr += "<td class='text-end' >";
if($P.statQuery.numberValueInfoList[k].aggregateType == "ratio"){
tr += Number.parseFloat(numberValues[k] * pointMove).toFixed(decimalPoint);
tr += " %";
} else {
tr += numberFormat.format(numberValues[k]);
}
tr += "</td>";
}
tr += "</tr>";
$("#masterTbody--${pageName}").append(tr);
}
}
initDatepicker("frmSearch--${pageName}"); //달력 초기화
$("#schDateOpt--${pageName}").append(document.getElementById("schDateOptDatalist--${pageName}").innerHTML);
$("#dayColumn--${pageName}").append(document.getElementById("dayColumnDatalist--${pageName}").innerHTML);
$("#searchForMenu--${pageName}").append(document.getElementById("searchForMenuTemplate--${pageName}").innerHTML);
@ -358,4 +438,6 @@ $(document).ready(function(){
$P.changeGrid();
});
</script>

@ -4,8 +4,10 @@
<c:set var="prefixName" scope="request">단속 통계</c:set>
<jsp:include page="/WEB-INF/jsp/fims/stat/stat01010-main.jsp" />
<datalist id="schDateOptDatalist--${pageName}">
<option value="crdnYmd">단속일자</option>
<input type="hidden" id="defaultStatDomain--${pageName}" value="crdn" />
<datalist id="dayColumnDatalist--${pageName}">
<option value="CRDN_YMD">단속일자</option>
</datalist>
<template id="searchForMenuTemplate--${pageName}">
@ -110,7 +112,9 @@
</datalist>
<datalist id="presetDatalist--${pageName}">
<option value="preset1"
<option value="crdnPreset1" data-stat-domain="crdn"
>단속건수,부과필요건수,부과유예건수,의견수용건수,경찰서이첩건수,서손건수,면제차량건수,부과건수,서손율,의견진술접수건수,의견진술수용율
</option>
</datalist>
<script src="<c:url value="/resources/js/fims/stat/crdnPreset.js?${ver}"/>"></script>

@ -4,12 +4,14 @@
<c:set var="prefixName" scope="request">부과 통계</c:set>
<jsp:include page="/WEB-INF/jsp/fims/stat/stat01010-main.jsp" />
<datalist id="schDateOptDatalist--${pageName}">
<option value="">부과일자</option>
<option value="">처리일자</option>
<input type="hidden" id="defaultStatDomain--${pageName}" value="levy" />
<datalist id="dayColumnDatalist--${pageName}">
<option value="LEVY_YMD">부과일자</option>
<option value="CRDN_STTS_CD">처리일자</option>
<option value="">소인일자</option>
<option value="">회계일자</option>
<option value="">수납일자</option>
<option value="RCVMT_YMD">수납일자</option>
<option value="">징수결의일자</option>
<option value="">부과수납일자</option>
<option value="">고지일자</option>

@ -4,9 +4,10 @@
<c:set var="prefixName" scope="request">발송 통계</c:set>
<jsp:include page="/WEB-INF/jsp/fims/stat/stat01010-main.jsp" />
<input type="hidden" id="defaultStatDomain--${pageName}" value="sndb" />
<datalist id="schDateOptDatalist--${pageName}">
<option value="sndngYmd">발송일자</option>
<datalist id="dayColumnDatalist--${pageName}">
<option value="SNDNG_YMD">발송일자</option>
</datalist>
<template id="searchForMenuTemplate--${pageName}">

@ -4,8 +4,10 @@
<c:set var="prefixName" scope="request">단속 통계</c:set>
<jsp:include page="/WEB-INF/jsp/fims/stat/stat01010-main.jsp" />
<datalist id="schDateOptDatalist--${pageName}">
<option value="crdnYmd">단속일자</option>
<input type="hidden" id="defaultStatDomain--${pageName}" value="sprt" />
<datalist id="dayColumnDatalist--${pageName}">
<option value="CRDN_YMD">단속일자</option>
</datalist>
<template id="searchForMenuTemplate--${pageName}">

@ -0,0 +1,22 @@
var crdnPreset1 = [
{ aggregateType : "count" }, //단속건수
{ aggregateType : "count", seperatorRefCol : "CRDN_STTS_CD", conditionValue : "levyNeed",
seperatorCtgrType : "code", seperatorDtlCtgr : "FIM010"}, //부과필요
{ aggregateType : "count", seperatorRefCol : "CRDN_STTS_CD", conditionValue : "부과유예코드없음" }, //부과유예
{ aggregateType : "count", seperatorRefCol : "CRDN_STTS_CD", conditionValue : "82" }, //의견제출수용
{ aggregateType : "count", seperatorRefCol : "CRDN_STTS_CD", conditionValue : "87" }, //경찰서이첩
{ aggregateType : "count", seperatorRefCol : "CRDN_STTS_CD", conditionValue : "81" }, //서손
{ aggregateType : "count", seperatorRefCol : "CRDN_STTS_CD", conditionValue : "면제코드없음" }, //면제
{ aggregateType : "count", seperatorRefCol : "CRDN_STTS_CD", conditionValue : "levyAfter",
seperatorCtgrType : "code", seperatorDtlCtgr : "FIM010"}, //부과
{ aggregateType : "ratio", seperatorRefCol : "CRDN_STTS_CD", conditionValue : "81" , ratioRefIndex : 0}, //서손율
{ aggregateType : "count", seperatorRefCol : "OPNN_SBMSN_YN", conditionValue : "Y" }, //의견진술접수건수
{ aggregateType : "ratio", seperatorRefCol : "CRDN_STTS_CD", conditionValue : "82" , ratioRefIndex : 9} //의견진술수용율
];
var crdnPreset1_codeSubsetInfoList = [
{ sourceGroup : "FIM010", sourceCodes : ["21","41","42","43"],
targetCode : "levyNeed", targetCodeVal : "부과필요" },
{ sourceGroup : "FIM010", sourceCodes : ["51","52","53","54","55","61","71","72","73","74","75","76","77"],
targetCode : "levyAfter", targetCodeVal : "부과" }
];
Loading…
Cancel
Save